<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="3"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<rfc category="std" docName="draft-zhuang-idr-flowspec-extension-for-ncm-00"
     ipr="trust200902" updates="">
  <front>
    <title abbrev="FlowSpec for NCM">BGP Flow Specification Extensions for
    Network Congestion Management</title>

    <author fullname="Shunwan Zhuang" initials="S." surname="Zhuang">
      <organization>Huawei</organization>

      <address>
        <postal>
          <street>156 Beiqing Road</street>

          <city>Beijing</city>

          <code>100095</code>

          <country>P.R. China</country>
        </postal>

        <email>zhuangshunwan@huawei.com</email>
      </address>
    </author>

    <author fullname="Haibo Wang" initials="H." surname="Wang">
      <organization>Huawei</organization>

      <address>
        <postal>
          <street>156 Beiqing Road</street>

          <city>Beijing</city>

          <code>100095</code>

          <country>P.R. China</country>
        </postal>

        <email>rainsword.wang@huawei.com</email>
      </address>
    </author>

    <date day="19" month="March" year="2026"/>

    <area>Routing</area>

    <workgroup>IDR Working Group</workgroup>

    <abstract>
      <t>BGP Flow Specification (FlowSpec) <xref target="RFC8955"/> and <xref
      target="RFC8956"/> has been proposed to distribute traffic filter policy
      (traffic filters and actions) via BGP <xref target="RFC4271"/>. Multiple
      applications have used BGP FlowSpec to distribute traffic filter policy.
      These applications include the following: mitigation of denial of
      service (DoS), enabling traffic filtering in BGP/MPLS VPNs, centralized
      traffic control of router firewall functions, and SFC traffic
      insertion.</t>

      <t>Due to its powerful extensibility, FlowSpec can be easily used for
      network congestion management. This document describes how to use BGP
      FlowSpec to implement network congestion management.</t>

      <t/>
    </abstract>

    <note title="Requirements Language">
      <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
      "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
      document are to be interpreted as described in BCP 14 <xref
      target="RFC2119"/> <xref target="RFC8174"/> when, and only when, they
      appear in all capitals, as shown here.</t>

      <t/>
    </note>
  </front>

  <middle>
    <section title="Introduction">
      <t>Explicit Congestion Notification (ECN) is an extension to the
      Internet Protocol (IP) and the Transmission Control Protocol (TCP),
      defined in RFC 3168. ECN allows for end-to-end notification of
      congestion control to avoid packet loss. ECN is an optional feature that
      may be used by two endpoints if the underlying network infrastructure
      supports it.</t>

      <t>Typically, a TCP/IP network indicates a channel congestion by
      dropping packets. In the case of successful ECN negotiation, an
      ECN-aware router can set a flag in the IP header instead of dropping the
      packet to indicate that congestion is about to occur. The receiver of
      the packet then responds to the sender by reducing its transmission
      rate.</t>

      <t>The ECN (Explicit Congestion Notification) field in an IP header
      (bits 6 and 7 of the Traffic Class/ToS byte) allows routers to signal
      network congestion by marking packets instead of dropping them. Defined
      in RFC 3168, it uses four values (00-11) to indicate ECN capability and
      congestion status, enabling end-to-end congestion control while reducing
      packet loss and retransmissions.</t>

      <t>ECN Field Codepoints (Bits 6-7)</t>

      <t><list style="symbols">
          <t>00 (Non-ECT): Non-ECN-Capable Transport. The packet does not
          support ECN.</t>

          <t>01 or 10 (ECT): ECN-Capable Transport (0 or 1). The endpoints
          support ECN, and the path is not currently congested.</t>

          <t>11 (CE): Congestion Experienced. The router is experiencing
          congestion and marks the packet, prompting the receiver to notify
          the sender to slow down.</t>
        </list>When a router's buffer exceeds a certain threshold, it changes
      the ECN field from ECT (01/10) to CE (11) rather than dropping the
      packet.</t>

      <t>It occupies the last two bits of the Type of Service (ToS) field in
      IPv4 or the Traffic Class field in IPv6.</t>

      <t/>

      <t>Fast-CNP (Congestion Notification Packet) is a mechanism for Remote
      Direct Memory Access (RoCEv2) networks that allows switches to directly
      send congestion notifications to the source node, bypassing the
      traditional, slower method of waiting for destination server feedback.
      By reducing latency in congestion signaling, Fast-CNP prevents severe
      buffer congestion and improves network performance.</t>

      <t>This document describes how to use BGP FlowSpec to implement network
      congestion management.</t>

      <t/>
    </section>

    <section title="Definitions and Acronyms">
      <t><list style="symbols">
          <t>BGP-FS: BGP Flow Specification</t>

          <t>CE: Congestion Experienced</t>

          <t>DPI: Deep Packet Inspection</t>

          <t>ECN: Explicit Congestion Notification</t>

          <t>ECT: ECN Capable Transport</t>

          <t>FlowSpec: Flow Specification</t>

          <t>FSv2: BGP Flow Specification Version 2</t>

          <t>SR: Segment Routing</t>

          <t>SR-MPLS: SR over the MPLS data plane</t>

          <t>SRv6: SR over the IPv6 data plane</t>

          <t>SAFI: Subsequent Address Family Identifier</t>

          <t>SID: Segment Identifier</t>

          <t>SRH: Segment Routing Header</t>

          <t>TE: Traffic Engineering</t>

          <t>USD: Ultimate Segment Decapsulation</t>
        </list></t>
    </section>

    <section title="The Flow Specification Encoding for Network Congestion Management">
      <t/>

      <section title="Type TBD1 - ECN">
        <t>Encoding: &lt;type (1 octet), [numeric_op, value]+&gt;</t>

        <t>Defines a list of {numeric_op, value} pairs used to match the 2-bit
        ECN field (see also [RFC3168] and [RFC8200]).</t>

        <t>This component uses the Numeric Operator (numeric_op) described in
        Section 4.2.1.1 of [RFC8955]. The ECN component values MUST be encoded
        as single octet (numeric_op len=00).</t>

        <t>The two least significant bits contain the ECN value. All other
        bits SHOULD be treated as 0.</t>

        <t>An example of an ECN Flow Specification component encoding for:
        "all packets matching ECN {1 or 2}".</t>

        <t><figure anchor="ecn-filter-example"
            title="Example of ECN flow specification TLV encoding">
            <artwork align="center"><![CDATA[
       ECN Flow Specification TLV's Type (2 octets)
             |
             v           
          0x nn 01 01 91 02 
]]></artwork>
          </figure></t>

        <t/>

        <t><figure anchor="ecn-filter-example-decoded"
            title="Decoded the example of ECN flow specification TLV encoding">
            <artwork align="center"><![CDATA[
Decoded:
         Value 
         0xnn     Type         Type nn - ECN Flow Specification 
                               component's Type 
         0x01     numeric_op   value size = 1, ==
         0x01     value        1, ECN's value = 1
         0x91     numeric_op   end-of-list, value size = 1, ==
         0x02     value        2, ECN's value = 2

]]></artwork>
          </figure></t>
      </section>

      <section title="ECN Marking (ecn-marking) Sub-Type TBD2">
        <t>The ecn marking Extended Community instructs a system to modify the
        ECN bits in the IP header (Section 5 of [RFC3168]) of a transiting IP
        packet to the corresponding value encoded in the 6 least significant
        bits of the Extended Community value, as shown in Figure XXX.</t>

        <t>The Extended Community is encoded as follows:</t>

        <t><figure anchor="ecn-making"
            title="ECN Marking Extended Community Encoding">
            <artwork align="center"><![CDATA[
   0                   1                   2                   3
   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |      Type     |   Sub-Type    |   fast-cnp    |   reserved    |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  |                            reserved (cont.)               |ECN|
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 

]]></artwork>
          </figure></t>

        <t>Type (1 octet): 0x80</t>

        <t>Sub-Type (1 octet): TBD2</t>

        <t>ECN: new ECN value for the transiting IP packet</t>

        <t>reserved (46 bits): MUST be set to 0 on encoding and MUST be
        ignored during decoding</t>

        <t/>
      </section>

      <section title="Extending the Traffic-Action (traffic-action) field">
        <t>The traffic-action Extended Community consists of 6 octets of which
        only the 2 least significant bits of the 6th octet (from left to
        right) are defined by [RFC8955], as shown in <xref
        target="figure_traffic_action_encoding"/>.</t>

        <t><figure anchor="figure_traffic_action_encoding"
            title="Traffic-Action Extended Community Encoding">
            <artwork align="center"><![CDATA[
   0                   1                   2                   3
   0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  | Traffic Action Field                                          |
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  | Tr. Action Field (cont.)|C|S|T|
  +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

]]></artwork>
          </figure>The S and T bits are defined in [RFC8955], and this
        document defines the C bit as follows:</t>

        <t>C Fast-CNP (bit 45): Enables the Fast CNP function (only effective
        when set).</t>

        <t/>
      </section>

      <section title="Fast-CNP Action Extended Community Sub-Type TBD3">
        <t>The Fast-CNP Action Extended Community instructs a system to send
        fast congestion notification packets to the source node.</t>

        <t><figure anchor="fast_cnp_action"
            title="Fast-CNP Action Extended Community Encoding">
            <artwork align="center"><![CDATA[
    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |      Type     |   Sub-Type    |   fast-cnp    |   reserved    |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |                     reserved                                  |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

]]></artwork>
          </figure>Type (1 octet): 0x80</t>

        <t>Sub-Type (1 octet): TBD3</t>

        <t>fast-cnp (1 octet): Enables the Fast CNP function if set to 1 and
        disables the Fast CNP function if set to 0</t>

        <t>reserved (5 octets): MUST be set to 0 on encoding and MUST be
        ignored during decoding</t>
      </section>

      <section title="Marking Threshold Action Extended Community Sub-Type TBD4">
        <t>The Marking Threshold Action Extended Community instructs a system
        to set a threshold for the target traffic.</t>

        <t><figure anchor="marking_threshold_action"
            title="Marking Threshold Action Extended Community">
            <artwork align="center"><![CDATA[
    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |      Type     |   Sub-Type    |          lower threshold      |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |      upper threshold          |          Reserved           |E|
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

]]></artwork>
          </figure></t>

        <t>Type (1 octet): 0x80</t>

        <t>Sub-Type (1 octet): TBD4</t>

        <t>lower threshold (2 octets): Lower threshold of the forwarding
        queue.</t>

        <t>upper threshold (2 octets): Upper threshold of the forwarding
        queue.</t>

        <t>reserved (7 bits): MUST be set to 0 on encoding and MUST be ignored
        during decoding.</t>

        <t>E (1 bit): Indicates whether to mark ECN flag.</t>

        <t/>
      </section>
    </section>

    <section title="Use Cases">
      <t/>

      <section title="Case1: Detects the risk of traffic congestion and proactively sets the ECN flag">
        <t>A traffic management device on the network analyzes traffic on the
        network, and finds that there is a risk of packet loss due to
        congestion in traffic sent from Sender to Receiver through R1, R2,...,
        and Rn. The management device sends a Flowspec route to the device R1.
        The Flowspec route carries characteristic information of target
        traffic by using a Flowspec NLRI, and carries an marking ECN action
        defined in this draft.</t>

        <t><figure anchor="case1"
            title="Detects the risk of traffic congestion and proactively sets the ECN flag">
            <artwork align="center"><![CDATA[
      +------------+
      |  BGP FS    |
      | Controller |
      +------------+
            | FlowSpec route to R1:
            |   NLRI: Filter Rules
            |   Ext-Community: Remarking-ECN Action
            |
            |    .-----.
            |   (       )
            |--(         )--.
+-------+  (v                )  +--------+
|       |_( R1---R2---...---Rn)_|        |
|Sender | (                   ) |Receiver|
+-------+  (                 )  +--------+
            '--(         )--'   
                (       )       
                 '-----'

]]></artwork>
          </figure></t>

        <t>When R1 receives a FlowSpec route, it uses the NLRI in the FlowSpec
        route to match the target traffic and marks the target traffic with
        the ECN flag according to the instruction of the ECN-Marking
        action.</t>

        <t>The traffic with the ECN flag is forwarded to the next hop. In this
        way, other devices along the path and the receiver can detect network
        congestion in a timely manner based on the ECN flag and make
        corresponding adjustments.</t>

        <t/>
      </section>

      <section title="Case2: Detects traffic congestion and Sends Fast-CNP to Sender">
        <t>When a traffic management device in the network detects that
        traffic forwarded from a Sender terminal to a Receiver terminal
        through the network path R1, R2,..., Rn may encounter a risk of
        congestion and packet loss, the management device sends a Flowspec
        route to a device on the network path, for example, R2. The NLRI of
        the Flowspec route carries the characteristic of the target traffic,
        and the Flowspec route carries the Fast-CNP action defined in this
        draft.</t>

        <t><figure anchor="case2"
            title="Detects traffic congestion and Sends Fast-CNP to Sender">
            <artwork align="center"><![CDATA[
      +------------+
      |  BGP FS    |
      | Controller |
      +------------+
            | FlowSpec route to R2:
            |   NLRI: Filter Rules
            +   Ext-Community: Fast-CNP Action
             \
              \  .------.
               \(        )
            .--(\         )--.
+-------+  (     \            )  +--------+
|       |_( R1---R2---...---Rn )_|        |
|Sender | (                   )  |Receiver|
+-------+  (                 )   +--------+
            '--(         )--'   
                (       )       
                 '-----'

]]></artwork>
          </figure></t>

        <t>After receiving the FlowSpec route, R2 uses the NLRI field in the
        FlowSpec route to match the target traffic. In addition, R2 identifies
        that the FlowSpec route carries the Fast-CNP action. According to the
        instruction of this action, R2 obtains the address of the sender
        terminal from the target traffic, constructs a Fast-CNP packet to be
        sent from R2 to the sender terminal, and sends the packet to the
        sender terminal.</t>

        <t>After receiving the Fast-CNP packet, the sender terminal reduces
        the rate at which packets are sent to the receiver terminal.</t>

        <t/>
      </section>

      <section title="Case3: Optimizing the traffic that contains congestion indication information">
        <t>When the traffic management device in the network detects that
        traffic forwarding from a Sender terminal to a Receiver terminal
        through the network path R1, R2,..., Rn encounters congestion, the
        management device sends a Flowspec route to a device (for example, R1)
        on the network path. The NLRI of the Flowspec route carries the
        characteristic of the target traffic, where an ECN matching element is
        included, and the Flowspec route carries various possible traffic
        optimization actions.</t>

        <t>The traffic optimization action may include redirecting to a next
        hop, setting an optimized DCSP value, or indicating a forwarding
        through a path with a higher priority etc,.</t>

        <t><figure anchor="case3"
            title="Optimizing the traffic that contains congestion indication information">
            <artwork align="center"><![CDATA[
      +------------+
      |  BGP FS    |
      | Controller |
      +------------+
            | FlowSpec route to R1:
            |   NLRI: Filter rules, including ECN matching 
            |         element(value=3)
            |   Ext-Community: Traffic optimization action
            |
            |    .-----.
            |   (       )
            |--(         )--.
+-------+  (v                )  +--------+
|       |_( R1---R2---...---Rn)_|        |
|Sender | (                   ) |Receiver|
+-------+  (                 )  +--------+
            '--(         )--'   
                (       )       
                 '-----'


]]></artwork>
          </figure></t>

        <t>After receiving the FlowSpec route, R1 matches the target traffic
        based on the NLRI field in the FlowSpec route. The ECN value in the
        FlowSpec route must be the same as that in the target traffic. After
        the target traffic is matched, R1 performs the traffic optimization
        action specified in the FlowSpec route on the target traffic. The
        traffic optimization action may include redirecting to a next hop,
        setting an optimized DCSP value, or indicating a forwarding through a
        path with a higher priority etc,.</t>

        <t/>
      </section>

      <section title="Case4: Set a threshold for the target traffic and enable the ECN marking function.">
        <t>When a management device on the network plans to optimize and
        manage target traffic on a device, the management device delivers a
        FlowSpec route to the network device (for example, R1 in the following
        figure). The FlowSpec route encapsulates the characteristics of the
        target traffic in the NLRI and uses the Marking Threshold Action
        community attribute defined in this document to set a threshold for
        the target traffic. In addition, the management device sets the E bit
        to instruct the network device to mark the target traffic with the ECN
        flag when the rate of the target traffic is within the threshold
        range.</t>

        <t><figure anchor="case4"
            title="Detects the risk of traffic congestion and proactively sets the ECN flag">
            <artwork align="center"><![CDATA[
      +------------+
      |  BGP FS    |
      | Controller |
      +------------+
            | FlowSpec route to R1:
            |   NLRI: Filter Rules
            |   Ext-Community: Marking Threshold Action
            |
            |    .-----.
            |   (       )
            |--(         )--.
+-------+  (v                )  +--------+
|       |_( R1---R2---...---Rn)_|        |
|Sender | (                   ) |Receiver|
+-------+  (                 )  +--------+
            '--(         )--'   
                (       )       
                 '-----'


]]></artwork>
          </figure></t>

        <t>When receiving the FlowSpec route, the network device R1 matches
        the target traffic based on the NLRI field in the FlowSpec route, sets
        a threshold for the target traffic according to the instruction of the
        marking-threshold action defined in this document, and enables the
        function of marking the target traffic with the ECN flag.</t>

        <t>The traffic with the ECN flag is forwarded to the next hop. In this
        way, other devices along the path and the receiver can detect network
        congestion in a timely manner based on the ECN flag and make
        corresponding adjustments.</t>

        <t/>
      </section>
    </section>

    <section anchor="IANA" title="IANA Considerations">
      <t>TBD</t>

      <t/>
    </section>

    <section anchor="Security" title="Security Considerations">
      <t>The security considerations of BGP [RFC4271] and BGP FlowSpec
      [RFC8955] [RFC8956] apply to this document.</t>

      <t/>
    </section>

    <section title="Contributors ">
      <t>The following people made significant contributions to this
      document:</t>

      <t>TBD</t>
    </section>

    <section anchor="Acknowledgements" title="Acknowledgements">
      <t>The authors would like to acknowledge the review and inputs from XXX
      (TBD).</t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <?rfc include="reference.RFC.2119"?>

      <?rfc include='reference.RFC.4271'?>

      <?rfc include='reference.RFC.4360'?>

      <?rfc include='reference.RFC.4760'?>

      <?rfc include='reference.RFC.5701'?>

      <?rfc include='reference.RFC.8174'?>

      <?rfc include='reference.RFC.8660'?>

      <?rfc include='reference.RFC.8669'?>

      <?rfc include='reference.RFC.8955'?>

      <?rfc include='reference.RFC.8956'?>

      <?rfc include='reference.RFC.9012'?>

      <?rfc include='reference.RFC.9252'?>

      <?rfc include='reference.RFC.9256'?>

      <?rfc include='reference.I-D.ietf-idr-sr-policy-safi'?>

      <?rfc include='reference.I-D.ietf-idr-fsv2-ip-basic'?>

      <?rfc include='reference.I-D.ietf-idr-flowspec-redirect-ip'?>
    </references>

    <references title="Informative References">
      <?rfc include='reference.RFC.8754'?>

      <?rfc include='reference.I-D.ietf-pce-segment-routing-policy-cp'?>
    </references>
  </back>
</rfc>
