<?xml version="1.0" encoding="UTF-8"?>
  <?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
  <!-- generated by https://github.com/cabo/kramdown-rfc version 1.7.5 (Ruby 2.6.10) -->


<!DOCTYPE rfc  [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">

]>


<rfc ipr="trust200902" docName="draft-papadopoulos-schc-fec-00" category="std" consensus="true" submissionType="IETF" tocInclude="true" sortRefs="true" symRefs="true">
  <front>
    <title abbrev="TODO - Abbreviation">Forward Error Correction (FEC) for SCHC framework</title>

    <author fullname="Georgios Papadopoulos">
      <organization>IMT Atlantique</organization>
      <address>
        <email>georgios.papadopoulos@imt-atlantique.fr</email>
      </address>
    </author>

    <author fullname="Amaury Bruniaux">
      <organization>IMT Atlantique</organization>
      <address>
        <email>amaury.bruniaux@imt-atlantique.fr</email>
      </address>
    </author>

    <date year="2024" month="March" day="25"/>

    <area>AREA</area>
    <workgroup>SCHC Working Group</workgroup>
    <keyword>next generation</keyword> <keyword>unicorn</keyword> <keyword>sparkling distributed ledger</keyword>


    <abstract>
      <?line 57?>
      <t>
        This document describes a Forward Error Correction (FEC) method that is applied over the SCHC framework to improve the network performance under certain range of loss/error rates.
      </t>
    </abstract>


    <note title="About This Document" removeInRFC="true">
      <t>
        The latest revision of this draft can be found at <eref target="https://example.com/LATEST"/>.
        Status information for this document may be found at <eref target="https://datatracker.ietf.org/doc/draft-todo-yourname-protocol/"/>.
      </t>
      <t>
        Discussion of this document takes place on the
        WG Working Group mailing list (<eref target="mailto:WG@example.com"/>),
        which is archived at <eref target="https://example.com/WG"/>.
      </t>
      <t>Source for this draft and an issue tracker can be found at
        <eref target="https://github.com/USER/REPO"/>.</t>
    </note>


  </front>

  <middle>


<?line 62?>

<section anchor="introduction"><name>Introduction</name>  <!-- Introduction -->
  <t>
    <!-- See 8.1. Overview section of RFC 8724 for more information. -->
    In Low-Power Wide Area Network (LPWAN) technologies, the L2 MTU typically ranges from tens to hundreds of bytes. 
  </t>
  <t>
    The RFC 8724 standard defines the Static Context Header Compression and fragmentation (SCHC) framework, which provides header compression and optional fragmentation mechanisms to enable LPWAN technologies, 
    that do not come with internal fragmentation/reassembly functionalities, to comply with the IPv6 MTU requirement of 1280 bytes <xref target="RFC8200"/>. 
  </t>
  <t>
    However, this standardized framework struggles in low link-quality scenarios. 
    This document describes a Forward Error Correction (FEC) method that is applied over the SCHC framework to improve the network performance under certain range of loss/error rates.
  </t>


</section>  <!-- Introduction -->


<section anchor="conventions-and-definitions"><name>Conventions and Definitions</name>  <!-- Conventions and Definitions -->

<t>The key words "<bcp14>MUST</bcp14>", "<bcp14>MUST NOT</bcp14>", "<bcp14>REQUIRED</bcp14>", "<bcp14>SHALL</bcp14>", "<bcp14>SHALL
NOT</bcp14>", "<bcp14>SHOULD</bcp14>", "<bcp14>SHOULD NOT</bcp14>", "<bcp14>RECOMMENDED</bcp14>", "<bcp14>NOT RECOMMENDED</bcp14>",
"<bcp14>MAY</bcp14>", and "<bcp14>OPTIONAL</bcp14>" 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>

<?line -18?>

</section>  <!-- Conventions and Definitions -->


<section anchor="terminology"><name>Terminology</name>  <!-- Terminology -->

</section>  <!-- Terminology -->


<section anchor="fec-in-schc"><name>FEC in SCHC</name>  <!-- FEC in SCHC -->
  <t>
    FEC is a method employed to control errors in packet transmission by embedding additional redundant information within transmitted fragments, thereby reducing the chances for the destination node to request retransmission of missing fragments. 
    Employed in satellite communications and mobile networks, FEC mechanisms use encoding algorithms that allow the destination node to detect errors and often to recover missing components (i.e., to correct the errors).
  </t>

  <t>
    FEC can be classified into intra-frame, where error correction codes add redundancy inside a packet to correct errors on individual packets, and inter-frame (or inter-fragment), where additional redundant frames are transmitted.
    LoRa technology employed the intra-frame FEC.
    Indeed, the intra-frame FEC of LoRa uses Coding Rates (CR) 4/5 to 4/8.
    In this document, a generic inter-frame FEC mechanism is presented in order to obtain higher Data Delivery Rate (DDR).
  </t>

  <t>
    SCHC framework can be applied over lossy radio links such as LPWAN where some of the fragments of a SCHC packet can be lost, 
    which may lead to the failure of the reception of the whole SCHC packet (notably in the case of No-ACK mode). 
    <!--  CG: if No-ACK is used, "lead" is correct. 
          CG: With ACK-Always and ACK-on-Error, there are retries (up to some max. number) -->    
    Therefore, incorporating FEC into SCHC allows the destination node to increase the chances for the destination node to recover the missing SCHC fragments without the need for the sender to retransmit the missing SCHC fragments.
  </t>

  <t>
    While FEC mechanisms increase network reliability in lossy networks, they also introduce additional costs.
    This is because sending additional fragments demands energy and bandwidth.
    Furthermore, the increase in traffic can ultimately lead to overflow in the transmission queues of relay nodes when such nodes exist. 
    Consequently, the implementation of FEC schemes in networks with constrained resources warrants careful consideration.
  </t>

<!--- THIS IS A COMMENT
In order to address the traffic increase, deactivating FEC when the network presents low loss probability could be a workaround, while we propose a mechanism that lowers the number of fragments when it is not detrimental to the QOS. 

         CG: lowers the number of fragments: what fragments? redundant fragments? retransmitted fragments?

FEC can also enable the reception of packets that would otherwise be lost but this option comes with additional delay since the fragments used in the recovery process are sent after the original fragments. Finally, the FEC schemes that use encoding require the nodes to be able to perform the encoding and decoding operations with costs of additional computations. 
-->

  <section anchor="xorfec-algorithm"> <!-- XORFEC Algorithm -->
    <name>XORFEC Algorithm</name>
    <t>
      XORFEC employs the Exclusive OR (XOR) operator (⊕) within its FEC mechanism to produce an extra fragment for a fragmented IPv6 SCHC packet. 
      This supplementary fragment contains the redundant information.
      This additional fragment is sent after the original fragments of the SCHC packet and allows the destination node to detect a potential loss of an original fragment and to recover it, 
      mitigating thus the scenario where the loss of one fragment leads to the entire packet being lost and/or to reduce the number of fragment retries required to avoid the entire packet being lost.
    </t>

    
    <section anchor="the-xor-operator">
      <name>The XOR Operator</name>  <!-- The XOR Operator -->
      <t>
        XOR is a logical operator employed in encoding mechanisms, blending information from multiple fragments during encoding and subsequently decoding the encoded fragments upon reception.
        XOR is a binary operator, and when applied to fragments that consist of series of bits, is applied bitwise. 
        The key property of XOR utilized in XORFEC for fragment recovery is that applying XOR to the result of an initial XOR operation and one of its input values (i.e.,  of the first XOR) yields the other input value, see an eample below:
      </t>

      <t>
        B = A ⊕ (A ⊕ B)<br />
        A = B ⊕ (A ⊕ B)
      </t>

      <t>
        Indeed, if a SCHC packet is fragmented into two fragments A and B, the additional fragment C generated by the source node will be:
      </t>

      <t>
        C = A ⊕ B
      </t>

      <t>
        In this case, if the destination node receives the A and C fragments but does not receive the B fragment, it can recover B fragment by applying the XOR operator to the successfully received fragments.
      </t>

      <t>
        Note that this function can be generalised to SCHC packets that consists of more than two fragments.
        Indeed, with k original fragments (F1, F2, F3, ..., Fk), the additional fragment F_additional will be:
      </t>

      <t>
        F_additional = F1 ⊕ F2 ⊕ F3 ⊕ ... ⊕ Fk
      </t>

      <t>
        In a scenario where the destination node receives successfully all fragments except Fi, then it can recover the latter by applying the XOR operator to the successfully received fragments, as it is shown below:
      </t>

      <t>
        Fi = (F1 ⊕ ... ⊕ Fi−1 ⊕ Fi+1 ⊕ ... ⊕ Fm) ⊕ F_additional
      </t>

      <t>
        The main limitation of the XORFEC algorithm is that the loss tolerance is one missing fragment.
        Indeed, in the previous example of k fragments, the recovery of Fi is only possible if no more than one fragment is lost.
      </t>
    </section>  <!-- The XOR Operator -->
    
    
    <section anchor="xorfec-operation-example-in-lpwan"><name>XORFEC Operation Example in LPWAN</name> <!-- XORFEC Operation Example in LPWAN -->
      <section anchor="xorfec-over-no-ack-mode">  <!-- XORFEC over No-ACK mode -->
        <name>XORFEC over No-ACK mode</name>
        <t>
          In No-ACK mode, a SCHC Packet is first fragmented into k original fragments and the additional fragment (i.e., F_additional) is generated by applying the XOR operator to these k fragments.
        </t>
        
        <t>
          In <xref target="fig_NoACK"/>, the example (i.e., Figure 29) from <xref target="RFC8724"/> of No-ACK mode of a SCHC Packet that needs 5 SCHC Fragments (and where FCN is 1 bit wide) is adapted when XORFEC is applied to all 5 SCHC Fragments.
        </t>

<figure title="Successful transmission of a fragmented SCHC Packet with XORFEC over No-ACK mode: even though one fragment was lost (i.e., 3rd Fragment), it is recovered thanks to the additional XOR fragment." anchor="fig_NoACK">
  <artwork><![CDATA[
Sender          Receiver
  |-----FCN=0----->| 1st Fragment (received)
  |-----FCN=0----->| 2nd Fragment (received)
  |-----FCN=0--X-->| 3rd Fragment (not received)
  |-----FCN=0----->| 4th Fragment (received)
  |-----FCN=0----->| 5th Fragment (received)
  |---FCN=1 + RCS->| The XOR Fragment with Integrity check: success
(End)
  ]]></artwork>
</figure>

        <t>
          Thus, even if with No-ACK mode there is no feedback from the receiver, by employing XORFEC, the receiver may successfully reassemble the original SCHC Packet.
          As a result, both the network reliability and the spectrum/bandwidth utlization efficiency are increased for a certain range of loss/error rates.
          <!--  CG: I guess the latter is true for a certain range of loss/error rates... 
                For example, for 0% loss rate, the efficiency decreases.
                If loss rate is 100%, the efficiency decreases too.-->
        </t>
      </section>  <!-- XORFEC over No-ACK mode -->


      <section anchor="xorfec-over-ack-on-error-mode">  <!-- XORFEC over ACK-on-Error mode -->
        <name>XORFEC over ACK-on-Error mode</name>
        <t>
          In ACK-on-Error mode, the XOR is applied per Window.
          In case, when there is one Tile per Fragment, then one additional fragment is introduced per Window.
        </t>

        <t>
          In <xref target="fig_ACKonERROR"/>, the example (i.e., Figure 31) from <xref target="RFC8724"/> of ACK-on-Error mode of a SCHC Packet fragmented in 11 tiles is adapted when XORFEC is applied on ACK-on-Error mode is illustrated. 
          A SCHC Packet is fragmented in 11 Tiles, with one Tile per SCHC Fragment, N=3, WINDOW_SIZE=7, and two lost SCHC Fragments.</t>
          <!-- Figure 31 from RFC8724 -->

          <!--
          FCN 7 = 111

          FCN 6 = 110
          FCN 5 = 101
          FCN 4 = 100
          FCN 3 = 011
          FCN 2 = 010
          FCN 1 = 001

          FCN 0 = 000
          -->
<figure title="Successful transmission of a fragmented SCHC Packet with XORFEC over ACK-on-Error mode (11 Tiles, One Tile per SCHC Fragment, Two Lost SCHC Fragments): even though 2 fragments were lost (i.e., 5th and 9th Fragments), they were recovered thanks to the additional XOR fragments." anchor="fig_ACKonERROR">
  <artwork><![CDATA[
Sender               Receiver
  |-----W=0, FCN=6----->| 1st Tile/Fragment (received)
  |-----W=0, FCN=5----->| 2nd Tile/Fragment (received)
  |-----W=0, FCN=4----->| 3rd Tile/Fragment (received)
  |-----W=0, FCN=3----->| 4th Tile/Fragment (received)
  |-----W=0, FCN=2--X-->| 5th Tile/Fragment (not received)
  |-----W=0, FCN=1----->| 6th Tile/Fragment (received)
  |-----W=0, FCN=0----->| The additional (XOR) Fragment
(no ACK)
  |-----W=1, FCN=6----->| 7th Tile/Fragment (received)
  |-----W=1, FCN=5----->| 8th Tile/Fragment (received)
  |-----W=1, FCN=4--X-->| 9th Tile/Fragment (not received)
  |-----W=1, FCN=3----->| 10th Tile/Fragment (received)
  |-----W=1, FCN=2----->| 11th Tile/Fragment (received)          
  |- W=1, FCN=7 + RCS ->| The XOR Fragment with Integrity check: success
  |<-- ACK, W=1, C=1 ---| C=1
(End)
  ]]></artwork>
</figure>

        <t>
          As it can be calculated, in the original example, there were in total 16 transmissions with two fragment losses,
          i.e., 11 original transmissions from the Sender, two retransmissions from the Sender, and three acknowledgments from the Receiver.
          In this XORFEC based approach, there are in total 14 transmissions, 
          i.e., 11 original fragment transmissions from the Sender, two additional XOR transmissions from the Sender, and the ACK at the end from the Receiver.
          As a result, thanks to the XORFEC, the communication was reduced by two transmissions.
          Indeed, the ACK transmissions with the Bitmap of the missing fragments was not transmitted, and consequently the retransmissions of the missing fragments.
        </t>
      </section>  <!-- XORFEC over ACK-on-Error mode -->


      <section anchor="xorfec-over-ack-always-mode">  <!-- XORFEC over ACK-Always mode -->
        <name>XORFEC over ACK-Always mode</name>
        <t>
          Similar to ACK-on-Error mode, in ACK-Always, the XOR is applied per Window.
          In case, when there is one Tile per Fragment, then one additional fragment is introduced per Window.
        </t>

        <t>
          In <xref target="fig_ACKALWAYSmode"/>, the example (i.e., Figure 34) from <xref target="RFC8724"/> when XORFEC is applied on ACK-Always is illustrated.
          A SCHC Packet fragmented in 11 tiles, with one tile per SCHC Fragment, N=3, WINDOW_SIZE=7 and two lost SCHC Fragments.
          <!--
          Where N is the size of FCN in bits.
          -->
        </t>

<figure title="Successful transmission of a fragmented SCHC Packet with XORFEC over ACK-Always mode (11 Tiles, One Tile per SCHC Fragment, Two Lost SCHC Fragments): even though 2 fragments were lost (i.e., 5th and 9th Fragments), they were recovered thanks to the additional XOR fragments." anchor="fig_ACKALWAYSmode">
  <artwork><![CDATA[
Sender               Receiver
  |-----W=0, FCN=6----->| 1st Tile/Fragment (received)
  |-----W=0, FCN=5----->| 2nd Tile/Fragment (received)
  |-----W=0, FCN=4----->| 3rd Tile/Fragment (received)
  |-----W=0, FCN=3----->| 4th Tile/Fragment (received)
  |-----W=0, FCN=2--X-->| 5th Tile/Fragment (not received)
  |-----W=0, FCN=1----->| 6th Tile/Fragment (received)
  |-----W=0, FCN=0----->| The additional (XOR) Fragment - 6543210
  |<-- ACK, W=0, C=0 ---|                         Bitmap: 1111111

  |-----W=1, FCN=6----->| 7th Tile/Fragment (received)
  |-----W=1, FCN=5----->| 8th Tile/Fragment (received)
  |-----W=1, FCN=4--X-->| 9th Tile/Fragment (not received)
  |-----W=1, FCN=3----->| 10th Tile/Fragment (received)
  |-----W=1, FCN=2----->| 11th Tile/Fragment (received)
  |- W=1, FCN=7 + RCS ->| The XOR Fragment with Integrity check: success                    
  |<-- ACK, W=1, C=1 ---| C=1
(End)
  ]]></artwork>
</figure>
        </section>  <!-- XORFEC over ACK-Always mode -->

    </section>  <!-- XORFEC Operation Example in LPWAN -->
  </section>  <!-- XORFEC Algorithm -->
</section>  <!-- FEC in SCHC -->

<section anchor="security-considerations"><name>Security Considerations</name>

<t>TODO Security</t>

</section>
<section anchor="iana-considerations"><name>IANA Considerations</name>

<t>This document has no IANA actions.</t>

</section>


  </middle>

  <back>


<references title='Normative References' anchor="sec-normative-references">
  <reference anchor="RFC2119">
    <front>
      <title>Key words for use in RFCs to Indicate Requirement Levels</title>
      <author fullname="S. Bradner" initials="S." surname="Bradner"/>
      <date month="March" year="1997"/>
      <abstract>
        <t>In many standards track documents several words are used to signify the requirements in the specification. These words are often capitalized. This document defines these words as they should be interpreted in IETF documents. This document specifies an Internet Best Current Practices for the Internet Community, and requests discussion and suggestions for improvements.</t>
      </abstract>
    </front>
    <seriesInfo name="BCP" value="14"/>
    <seriesInfo name="RFC" value="2119"/>
    <seriesInfo name="DOI" value="10.17487/RFC2119"/>
  </reference>

  <reference anchor="RFC8174">
    <front>
      <title>Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words</title>
      <author fullname="B. Leiba" initials="B." surname="Leiba"/>
      <date month="May" year="2017"/>
      <abstract>
        <t>RFC 2119 specifies common key words that may be used in protocol specifications. This document aims to reduce the ambiguity by clarifying that only UPPERCASE usage of the key words have the defined special meanings.</t>
      </abstract>
    </front>
    <seriesInfo name="BCP" value="14"/>
    <seriesInfo name="RFC" value="8174"/>
    <seriesInfo name="DOI" value="10.17487/RFC8174"/>
  </reference>
</references>

<references title="Informative References">
  <?rfc include="reference.RFC.8724"?> <!-- OAM definition -->
  <?rfc include="reference.RFC.8200"?> <!-- IPv6 -->  
</references>


<?line 102?>

<section numbered="false" anchor="acknowledgments"><name>Acknowledgments</name>

<t>
  Thanks to Carles Gomez for useful design considerations, reviews and comments.
</t>

</section>


  </back>

<!-- ##markdown-source:
H4sIACxbAWYAA41V3W7bNhS+51OcKRf7QeQ0W4F1atZOjZ3WgBN3toOuGHZB
ibRNWCYFikrqBXmXPcuebN+hFCdei2E3Nnl0fr/zncM0TcXR0ZE4orEN2lsd
0qGXy0CX0m+Uu7W00Nu6kkELVpppK7eawto0tDSVpqV3W1JskQanXLpzrWeV
tPYuuNJVg62i4GilAzVB+qDVAH66GNHX0vmtDASHSefn7MHHq/Ts1vnNyru2
xj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