<?xml version="1.0" encoding="US-ASCII"?>
<!-- This template is for creating an Internet Draft using xml2rfc,
     which is available here: http://xml.resource.org. -->
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<!-- used by XSLT processors -->
<!-- For a complete list and description of processing instructions (PIs), 
     please see http://xml.resource.org/authoring/README.html. -->
<?rfc strict="yes" ?>
<!-- give errors regarding ID-nits and DTD validation -->
<!-- control the table of contents (ToC) -->
<?rfc toc="yes"?>
<!-- generate a ToC -->
<?rfc tocdepth="3"?>
<!-- the number of levels of subsections in ToC. default: 3 -->
<!-- control references -->
<?rfc symrefs="yes"?>
<!-- use symbolic references tags, i.e, [RFC2119] instead of [1] -->
<?rfc sortrefs="yes" ?>
<!-- sort the reference entries alphabetically -->
<!-- control vertical white space 
     (using these PIs as follows is recommended by the RFC Editor) -->
<?rfc compact="yes" ?>
<!-- do not start each main section on a new page -->
<?rfc subcompact="no" ?>
<!-- keep one blank line between list items -->
<!-- end of list of popular I-D processing instructions -->
<rfc category="std" docName="draft-song-mpls-sr-eh-01" ipr="trust200902">
  <front>
    <title abbrev="SR with MPLS Extension Header">Segment Routing with MPLS Extension Header</title>

    <author fullname="Haoyu Song" initials="H." role="editor" surname="Song">
      <organization>Futurewei Technologies</organization>
      <address>
        <postal>
          <street>2330 Central Expressway</street>
          <city>Santa Clara</city>
          <country>USA</country>
        </postal>
        <email>haoyu.song@futurewei.com</email>
      </address>
    </author>

    <!---->

    <keyword>Segment Routing, MPLS, Extension Header, Network Programming</keyword>

    <abstract>
	    <t> This document describes an alternative approach to implement segment routing in MPLS networks with the use of a post-stack MPLS extension header under the MPLS network action framework. The idea is applicable to other encoding styles for post-stack MPLS network actions. 
		The new approach reduces the MPLS label stack depth and provide supports for advanced functions such as network programming similar to SRv6.     
	    </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 <xref target="RFC2119">RFC 2119</xref>.</t>
    </note>
  </front>

  <middle>
    <section title="Motivation">
             
        <t> <xref target="RFC8402">Segment Routing (SR)</xref> allows a node to steer a packet based on an ordered list
		    of segments. It can be applied on an MPLS data plane (i.e., SR-MPLS) or an IPv6 data plane (i.e., SRv6). 
		    In SR-MPLS, each segment identifier (SID) is encoded in an MPLS label <xref target="RFC8660"></xref>. 
		    The SID list forms an MPLS label stack. Each hop 
	            will pop the top label from a packet's label stack and forward the packet based on the SID encoded in the label.</t>

		<t> MPLS has a wide deployment base and SR-MPLS can be directly applied on an MPLS data plane without any change.
		    Meanwhile, SR-MPLS's SID overhead is small and each SID in SR-MPLS is only 4 bytes.</t>

	    <t> However, SR-MPLS has several drawbacks:</t>

	    <t><list style="symbols">
		<t> The SID label stack may be deep, which can hurt the forwarding performance when the bottom of stack needs to be accessed or deep packet
			inspection needs to be performed. For example, network load balancing based on <xref target="RFC6790">entropy label</xref> or IP header, 
			and other network services such as <xref target="I-D.ietf-ippm-ioam-data">In-situ OAM</xref>,
			rely on headers deeply embedded in a packet. A deep MPLS label stack is unfavorable in such occasions.</t>
		<t> While the compactness of an MPLS label helps to reduce the header overhead, it leaves no room
			to encode extra information other than SID. Because of this, a noticeable missing feature of SR-MPLS is the 
			<xref target="RFC8986">network programming</xref>. Network programming is a powerful
	            feature of SRv6.  It enables a network operator or an application to specify a packet processing program 
				by encoding a sequence of instructions in the IPv6 packet header. Obviously, it is preferred for SR-MPLS 
				to support the same feature as well.</t>
    	    </list></t>

	    <t> In MPLS networks, MPLS Network Action (MNA) <xref target="I-D.ietf-mpls-mna-fwk"/> extends the MPLS label stack by supporting extra network actions encoded both in stack and post stack. The post-stack actions are encapsulated in <xref target="I-D.song-mpls-extension-header">MPLS extension headers</xref>. SR in MPLS can be implemented with an extension header. If other post-stack MNA encoding style is adopted, the method is still valid. The new approach not only retains MPLS's advantages but also overcomes its drawbacks.</t>

    </section>
    
    <section title="Segment Routing with MPLS Extension Header">

	    <t> With the presence of MPLS extension header, the SID label stack is kept in an extension header. Only the current SID label is copied to the top of the MPLS label stack.
	        An example for the packet format is shown in Figure 1.</t> 

 <t><figure anchor="figure_1" title="SR in MPLS with Extension Header">
         <artwork><![CDATA[

   0                                  31 
   +--------+--------+--------+--------+  - 
   |             SID Label             |  ^
   +--------+--------+--------+--------+  | MPLS Label Stack
   |   Post-stack   MNA Indicator      |  |
   ~                                   ~  V
   +--------+--------+--------+--------+  - 
   |          HEH             | NH=SR  |  ^
   +--------+--------+--------+--------+  |
   |                                   |  | MPLS SR Extension Header 
   ~    Segment Routing Header (SRH)   ~  |
   |                                   |  V
   +--------+--------+--------+--------+  -
   |                                   |  ^
   ~    Upper Layer Protocols/Payload  ~  | Upper Layer Packet
   |                                   |  V
   +--------+--------+--------+--------+  -
   
]]></artwork>
	</figure></t>

           <t> The format of the extension header for the SID list, or the Segment Routing Header (SRH), is shown in Figure 2.</t> 

 <t><figure anchor="figure_2" title="SRH Format">
         <artwork><![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 
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+  
   | NH=UL         |  HLEN         | Segment Count |Segment Pointer|
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+  
   |          SID[0]                       |                       |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                       |
   |                                                               |
   |                   FUNCT and ARGS [0]                          |
   |                                                               | 
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+  
   |                                                               |
   ~                            ...                                ~
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+  
   |          SID[n-1]                     |                       |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                       |
   |                                                               |
   |                   FUNCT and ARGS [n-1]                        |
   |                                                               | 
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 
   |                                                               |   
   ~                        Optional TLVs                          ~
   |                                                               |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+  

]]></artwork>
	</figure></t>

	<t>The meaning of the fields in an SRH is as follows:</t>

      		<t><list style="hanging">
			<t hangText="NH:"> As defined in <xref target="I-D.song-mpls-extension-header"/>.</t> 
			<t hangText="HLEN:"> As defined in <xref target="I-D.song-mpls-extension-header"/>.</t>
			<t hangText="Segment Count:"> 8-bit unsigned integer for the number of SIDs in the segment list.</t>
			<t hangText="Segment Pointer:"> 8-bit index (zero based) of the current SID in the segment list.</t>
			<t hangText="SID[i]:"> The i-th 20-bit SID. SID[0] is the first segment of the path.</t>
			<t hangText="FUNCT and ARGS[i]:"> The i-th 108-bit instructions and parameters for network programming at the i-th segment.</t> 
			<t hangText="TLVs:"> Optional Type-Length-Value, TBD.</t>
	        </list></t>	
		
		<t>The operator is free to partition the FUNCT and ARGS field to encode the function and parameters at a segment.</t>

    </section>

    <section anchor="processing" title="Segment Routing Data Plane Processing">
	
	<t> The SR source node generates the SRH. The Segment Pointer field of the SRH is initialized to 0. The SRH is inserted into the MPLS packet as an MPLS extension header.
		The SID[0] in the SRH is copied into an MPLS label. The TTL field in the label is initialized to a configured value. 
		The label is pushed to the top of the label stack. The packet is then forwarded based on the top label.</t>

	<t> At each node, if the SID in the top label matches the local SID, the function associated with the SID in the SRH is executed. 
	    If there are still segment(s) left in the segment list (i.e., Segment Count > Segment Pointer + 1), then the Segment Pointer in the SRH is incremented by 1, 
	    and the SID pointed by the Segment Pointer is copied to the top label in the MPLS label stack. The TTL field in the top label is decremented by 1.
            The packet is then forwarded based on the top label.</t>

        <t> If the current segment is the last segment, the top label is popped and the SRH extension header is deleted. The packet is then forwarded based on the header of the remaining packet. </t>

    </section>

    <section anchor="sfc" title="Support SFC using SR with MPLS Extension Header">

	    <t> The document <xref target="I-D.ietf-spring-sr-service-programming"></xref> describes how the 
		    <xref target="RFC7665">SFC</xref> can be achieved through SR-MPLS.  Similarly, 
	    the Segment Routing with MPLS Extension Header can also realize the service chaining, with additional advantages over the previous proposal.
        </t>

	<t>A noticeable issue of the SR-MPLS based SFC is its lack of metadata carrying capability. Metadata may be critical for message passing and 
		information sharing between service functions. This drawback limits the applicability of SR-MPLS for SFC. 
	       In our solution, the metadata can be carried in the optional TLVs in the SRH.</t>

       <t> Another document <xref target="I-D.ietf-spring-nsh-sr"></xref> proposes to integrate the SR and the 
	       <xref target="RFC8300">NSH</xref> to better support SFC, in which NSH provides a service plane and SR supports transport. 
	       Again, in our proposal, 
	       the NSH can be encapsulated into a TLV in the SRH.</t> 

    </section> 
		
    <section anchor="Security" title="Security Considerations">
      <t>This document shares the same security considerations with the SR-MPLS, network-programming, and SFC.</t>
    </section>

    <section anchor="IANA" title="IANA Considerations">
      <t>This document requires IANA to assign a new protocol number (TBA1) to indicate the SID list.</t>
    </section>
    
    <section anchor="Contributors" title="Contributors">
      <t>TBD.</t>
    </section>

    <section anchor="Acknowledgments" title="Acknowledgments">
      <t>TBD.</t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <?rfc include='reference.RFC.2119'?>
    </references>

    <references title="Informative References">
	  <?rfc include='reference.RFC.7665'?>
	  <?rfc include='reference.RFC.8300'?>
	  <?rfc include='reference.RFC.6790'?>
	  <?rfc include='reference.RFC.8402'?>
	  <?rfc include='reference.RFC.8660'?>
	  <?rfc include='reference.RFC.8754'?>
      <?rfc include='reference.I-D.ietf-ippm-ioam-data'?>
	  <?rfc include='reference.I-D.song-mpls-extension-header'?>
      <?rfc include='reference.RFC.8986'?> 
      <?rfc include='reference.I-D.ietf-spring-sr-service-programming'?> 
      <?rfc include='reference.I-D.ietf-spring-nsh-sr'?> 
	  <?rfc include='reference.I-D.ietf-mpls-mna-fwk'?>
    </references>
  </back>
</rfc>
