﻿<?xml version="1.0"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?rfc toc="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc subcompact="yes"?>
<rfc category="std" ipr="trust200902" docName="draft-duquennoy-6tisch-asf-00">
<front>
    <title>
        6TiSCH Autonomous Scheduling Function (ASF)
    </title>
    <author initials="S" surname="Duquennoy" fullname="Simon Duquennoy" role="editor">
        <organization>Inria</organization>
        <address>
            <postal>
                <street>40 Avenue Halley</street>
                <street>Building A</street>
                <city>Villeneuve d'Ascq</city>
                <country>France</country>
            </postal>
            <email>simon.duquennoy@inria.fr</email>
        </address>
    </author>
    <author initials="X" surname="Vilajosana" fullname="Xavier Vilajosana" >
        <organization>Universitat Oberta de Catalunya</organization>
        <address>
            <postal>
                <street>156 Rambla Poblenou</street>
                <city>Barcelona</city>
                <region>Catalonia</region>
                <code>08018</code>
                <country>Spain</country>
            </postal>
            <email>xvilajosana@uoc.edu</email>
        </address>
    </author>
    <author initials="T" surname="Watteyne" fullname="Thomas Watteyne">
        <organization>Inria</organization>
        <address>
            <postal>
                <street>2 Rue Simone Iff</street>
                <city>Paris</city>
                <country>France</country>
            </postal>
            <email>thomas.watteyne@inria.fr</email>
        </address>
    </author>
    <date/>
    <area>Internet Area</area>
    <workgroup>6TiSCH</workgroup>
    <keyword>Draft</keyword>
    <abstract>
        <t>
            This document defines a Scheduling Function called "ASF": the 6TiSCH Autoonomous Scheduling Function.
            With ASF, nodes maintain their TSCH schedule based on local neighborhood knowledge, without any signaling.
            Hashes of the nodes' MAC address are used to deterministically derive the [slotOffset,channelOffset] location of cells in the TSCH schedule.
            The MAC, control, and application traffic planes are assigned to distinct slotframes, for isolation and flexible dimensioning.
            This approach provides over-provisioned schedules with low maintenance, in pursuit for simplicity rather than optimality.
        </t>
    </abstract>
    <note title="Requirements Language">
        <t>
            The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "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="TEMPORARY EDITORIAL NOTES">
        <t>
            This document is an Internet Draft, so work-in-progress by nature.
            It contains the following work-in-progress elements:
            <list style="symbols">
                <t>
                    "TODO" statements are elements which have not yet been written by the authors for some reason (lack of time, ongoing discussions with no clear consensus, etc).
                    The statement does indicate that the text will be written at some point.
                </t>
                <t>
                    "TEMPORARY" appendices are there to capture current ongoing discussions, or the changelog of the document.
                    These appendices will be removed in the final text.
                </t>
                <t>
                    "IANA_*" identifiers are placeholders for numbers assigned by IANA.
                    These placeholders are to be replaced by the actual values they represent after their assignment by IANA.
                </t>
                <t>
                    "RFCXXXX" refers to the RFC number of this specification, once published.
                </t>
                <t>
                    The string "REMARK" is put before a remark (questions, suggestion, etc) from an author, editor or contributor.
                    These are on-going discussions at the time of writing, and will not be part of the final text.
                </t>
                <t>
                    This section will be removed in the final text.
                </t>
            </list>
        </t>
    </section>
    <section title="Introduction"                                    anchor="sec_intro">
        <t>
            This document defines an autonomous Scheduling Function for the 6top sublayer <xref target="I-D.ietf-6tisch-6top-protocol"/>, called "ASF".
            It is designed to operate without any signaling, keeping the TSCH schedule consistent between neighbors at all times (matching slots for transmission and reception).
            ASF uses 6P for neighbor schedule inspection (commands STATUS and LIST), but not for adding/deleting cells.
            ASF isolates the traffic from different planes in distinct slotframes, so as to avoid any disruption between MAC synchronization, control and application traffic.
        </t>
        <t>
            ASF addresses all requirements listed in Section "Requirements for an SF" from <xref target="I-D.ietf-6tisch-6top-protocol"/>.
            The organization of this document follows section "Recommended Structure of an SF Specification" in <xref target="I-D.ietf-6tisch-6top-protocol"/>.
            This document follows the terminology defined in <xref target="I-D.ietf-6tisch-terminology"/>.
        </t>
        <section title="Application Domains"                             anchor="sec_applications">
            <t>
                ASF is primarily targeted at applications with random traffic flows, such as interactive CoAP traffic.
                Its main strength is its signaling-free nature, which ensures the slots installed at neighboring nodes are consistent at all times.
                Its main weakness is its contention-based nature and its need to over-provision the schedule, rendering it unable to meet stringent latency and energy requirements.
                An example application domains is building instrumentation.
                ASF was evaluated experimentally and shown to achieve over 99.99% end-to-end delivery in 6TiSCH/RPL testbeds <xref target="Orchestra-SenSys" />.
            </t>
        </section>
      </section>
      <section title="General Operation"                               anchor="sec_generalop">
          <t>
            ASF uses multiple slotframes, each assigned to one particular type of traffic, e.g. TSCH synchronization, routing control or application traffic.
            Nodes maintain the cells within the slotframes autonomously, based on the hash of either the source's or destination's MAC address.
            Each slotframe is uniquely assigned a set of channel offsets.
          </t>
          <section title="Types of Slotframes"                               anchor="sec_types_of_slotframes">
            <t>
                There are three different types of slotframes, decribed next:
                <list hangIndent="3" style="hanging">
                    <t hangText="Rendez-vous slotframe:">
                        Contains a contention-based rendez-vous cell with fixed coordinates, options Rx, Tx, and Shared.
                        The cell can be used for any type of traffic, including broadcast.
                        This slotframe is equivalent to the 6TiSCH minimal schedule <xref target="RFC8180"/>.
                    </t>
                    <t hangText="Receiver-based slotframe:">
                        Nodes have one receive (option Rx) cell at coordinates derived from a hash of their MAC address.
                        For transmitting to a given neighbor, nodes maintain a cell (options Tx, Shared) at coordinates derived from a hash of the neighbor's MAC address.
                        For instance, a node may maintain such a transmit cell for each known neighbor in the IPv6 NDP cache, or to a subset such as the RPL preferred parent(s) or TSCH time source(s).
                    </t>
                    <t hangText="Sender-based slotframe:">
                        Nodes have one transmit cell (options Tx, Shared) at coordinates derived from a hash of their MAC address.
                        To listen to a given neighbor, they maintain a cell (option Rx) at coordinates derived from a hash of the neighbor's MAC address.
                        Typically, nodes only listen to a subset of neighbors, such as the RPL preferred parent(s) or TSCH time source(s).
                    </t>
                </list>
            </t>
          </section>
          <section title="Cell Coordinates"                               anchor="sec_cell_coordinates">
            <t>
                Cell coordinates in ASF are either fixed (for rendez-vous slotframes) or derived from a MAC address (for receiver- and sender-based slotframes).
                To derive coordinates from a MAC address, nodes MUST use the hash function SAX <xref target="SAX-DASFAA"/> on the EUI-64.
                Let S_len be the length of slotframe S, and S_channels be the set of channels assigned to slotframe S.
                The slot coordinates derived from a given MAC address are computed as follows:
                <list>
                    <t>slotOffset(MAC) = hash(MAC) % S_len </t>
                    <t>channelOffset(MAC) = S_channels[(hash(MAC) / L) % len(S_channels)]</t>
                </list>
            </t>
          </section>
          <section title="Slotframes Definition"                               anchor="sec_slotframes_definition">
            <t>
              By default, nodes maintain the four following slotframes:
              <list hangIndent="3" style="hanging">
                  <t hangText="SlotframeA: TSCH Enhanced Beacons:">
                      Nodes MUST send all TSCH Enhanced Beacons (EBs) on this slotframe.
                      This is a sender-based slotframe.
                      Nodes have one transmit cell based on their MAC address, and listen to their TSCH time source with one receive cell (with additional option TimeKeeping).
                  </t>
                  <t hangText="SlotframeB: TSCH Keep-Alives:">
                      Nodes MUST send all Keep-Alives (KAs) on this slotframe.
                      This is a receiver-based slotframe.
                      Nodes have one receive cell based on their MAC address, and one transmit cell towards their TSCH time source (with additional option TimeKeeping).
                  </t>
                  <t hangText="SlotframeC: Application traffic:">
                      Nodes MUST send all unicast UDP and TCP frames in this slotframe.
                      This is a received-based slotframe.
                      Nodes have one receive cell based on their MAC address, and maintain as many transmit cells as they have neighbors in their IPv6 NDP cache.
                      Every time a node is added/removed to the NDP cache, a new transmit cell is immediatly added/removed.
                  </t>
                  <t hangText="SlotframeD: Other Traffic:">
                      Nodes MUST send all other traffic to this slotframe, such as 6P or ICMPv6 traffic.
                      This is a rendez-vous slotrame.
                      All nodes have one single cell at slotOffset 0 and at the first channel offset of the slotframe.
                  </t>
              </list>
            </t>
            <t>
              As the slotframes repeat over time, cells from different slotframes will overlap periodically.
              In case a node has multiple cells schedule at the same time, the precedence rules from <xref target="IEEE802154-2015"/> apply.
            </t>
            <t>
              In order to fully isolate the different planes, we RECOMMEND provisioning separate packet queues for each slotframe.
              This ensures that transient bursts at the application layer will not affect TSCH synchronization nor routing topology maintenance.
              Conversely, occasional routing or TSCH traffic will not affect each other nor affect the application.
            </t>
          </section>
      </section>
      <section title="Configuration"                        anchor="sec_configparams">
          <t>
              ASF defines a set of configuration parameters listed in <xref target="tab_config_params" />.
              In order to distribute cell overlap uniformly (see <xref target="sec_slotframes_definition" />), we RECOMMEND selecting slotframe lengths that are co-primes.
              TODO define how configuration is discovered. Can be through new EB IEs, or through new/extended 6P command(s).
          </t>
          <figure title="Example Settings for ASF."                    anchor="tab_config_params">
<artwork>
+--------------------------------+----------------------------------+
|            Property            |         Example Setting          |
+--------------------------------+----------------------------------+
| SlotframeA length              | 397                              |
+--------------------------------+----------------------------------+
| SlotframeA handle              | 4 (lowest precedence)            |
+--------------------------------+----------------------------------+
| SlotframeA channelOffsets      | 0                                |
+--------------------------------+----------------------------------+
| SlotframeA type of cells       | ADVERTISING                      |
+--------------------------------+----------------------------------+
| SlotframeB length              | 389                              |
+--------------------------------+----------------------------------+
| SlotframeB handle              | 0 (highest precedence)           |
+--------------------------------+----------------------------------+
| SlotframeB channelOffsets      | 1                                |
+--------------------------------+----------------------------------+
| SlotframeB type of cells       | NORMAL                           |
+--------------------------------+----------------------------------+
| SlotframeC length              | Trades-off app. traffic capacity |
|                                | against energy. Ex. value: 17    |
+--------------------------------+----------------------------------+
| SlotframeC handle              | 1                                |
+--------------------------------+----------------------------------+
| SlotframeC channelOffsets      | 2 to 14                          |
+--------------------------------+----------------------------------+
| SlotframeA type of cells       | NORMAL                           |
+--------------------------------+----------------------------------+
| SlotframeD length              | 31                               |
+--------------------------------+----------------------------------+
| SlotframeD handle              | 2                                |
+--------------------------------+----------------------------------+
| SlotframeD channelOffsets      | 15                               |
+--------------------------------+----------------------------------+
| SlotframeD type of cells       | NORMAL                           |
+--------------------------------+----------------------------------+
</artwork>
          </figure>
    </section>
    <section title="Scheduling Function Identifier"                  anchor="sec_sfid">
        <t>
            The Scheduling Function Identifier (SFID) of ASF is IANA_SFID_ASF.
        </t>
    </section>
    <section title="Rules for Adding/Deleting Cells"                 anchor="sec_scheduling">
        <t>
            ASF nodes maintain their cells autonomously, and do not use 6P ADD nor DELETE.
        </t>
    </section>
    <section title="Rules for CellList"                              anchor="sec_celllist">
        <t>
            For the 6P LIST command, ASF uses the default CellList field format defined in Section 4.2.4 [TODO: update if needed] of <xref target="I-D.ietf-6tisch-6top-protocol"/>.
        </t>
    </section>
    <section title="6P Timeout Value"                                anchor="sec_timeout">
        <t>
            The timeout is of low criticality in ASF as 6P Requests are only used for schedule inspection, not for cell addition/removal.
            The RECOMMENDED timeout value in slots is:
        </t>
        <t>
            2^(macMaxBe+2)*SlotframeD_len
        </t>
        <t>
            which is an upper bound of the maximum time spent in transmission attempts of a 6P Request and Response, over slotframeD (where 6P traffic is sent).
            The upper bound is conservative, giving extra time for time spent in packet queues.
        </t>
        <t>
            Assuming default values (<xref target="IEEE802154-2015"/> and <xref target="tab_config_params" />), that is macMaxBe==5 and Slotframe2_len==31, this results in a timeout of 3968 timeslots.
        </t>
    </section>
    <section title="Rule for Ordering Cells"                         anchor="sec_ordering">
        <t>
            Cells are ordered by increasing slotframe handle, then by timeslot, then channel offset.
        </t>
    </section>
    <section title="Meaning of the Metadata Field"                   anchor="sec_container">
        <t>
            The Metadata 16-bit field is used as follows:
            Figure <xref target="tab_metadata_field" /> shows the format of the Metadata field, where:
            <list style="symbols">
                <t>
                    Slotframe: is used to identify a slotframe by its handle.
                </t>
                <t>
                    BITS 8-15 are reserved.
                </t>
            </list>
            <figure title="Format of the Metadata Field."                    anchor="tab_metadata_field">
<artwork>
                  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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           Slotframe           |            Reserved           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
</artwork>
            </figure>
        </t>
    </section>
    <section title="Node Behavior at Boot"                           anchor="sec_boot">
        <t>
            At boot, ASF creates four empty slotframes with length and handle described in <xref target="sec_configparams" />.
          <!--  The Rendez-vous slotframe as described in <xref target="sec_types_of_slotframes" /> is used to announce and advertise the network. This slotframe is equivalent to the proposed by the <xref target="RFC8180" />. -->
        </t>
        <t>
            TODO describe configuration discovery.
        </t>
    </section>
    <section title="6P Error Handling"                               anchor="sec_error_handling">
        <t>
            ASF only uses 6P commands COUNT and LIST.
            In case of error on STATUS or LIST, the node MAY retry to contact this neighbor after the 6P timeout.
        </t>
    </section>
    <section title="Examples"                                        anchor="sec_examples">
        <t>
            TODO
        </t>
    </section>
    <section title="Implementation Status"                           anchor="sec_implementation">
        <!-- START BOILERPLATE FROM RFC6982 -->
        <t>
            This section records the status of known implementations of the protocol defined by this specification at the time of posting of this Internet-Draft, and is based on a proposal described in <xref target="RFC6982" />.
            The description of implementations in this section is intended to assist the IETF in its decision processes in progressing drafts to RFCs.
            Please note that the listing of any individual implementation here does not imply endorsement by the IETF.
            Furthermore, no effort has been spent to verify the information presented here that was supplied by IETF contributors.
            This is not intended as, and must not be construed to be, a catalog of available implementations or their features.
            Readers are advised to note that other implementations may exist.
        </t>
        <t>
            According to <xref target="RFC6982" />, "this will allow reviewers and working groups to assign due consideration to documents that have the benefit of running code, which may serve as evidence of valuable experimentation and feedback that have made the implemented protocols more mature.
            It is up to the individual working groups to use this information as they see fit".
        </t>
        <!-- STOP BOILERPLATE FROM RFC6982 -->
        <t>
            <list style="hanging">
                <t hangText="Contiki:">
                    The mechanism behind this specification is implemented in the Contiki project <xref target="Contiki" />.
                    Adjustments to exactly match this specification are in progress.
                    The mechanism was evaluated experimentally in large-scale testbeds in <xref target="Orchestra-SenSys" />.
                </t>
            </list>
        </t>
    </section>
    <section title="Security Considerations"                         anchor="sec_security">
        <t>
            ASF is not threatened by attacks on 6P messages as it operates without signaling.
            However, it bases its TSCH schedule on external information, namely:
            (1) the identify of the current TSCH time source and
            (2) the MAC address of its neighbors.
            ASF relies on link-layer security to ensure the integrity of the above information.
        </t>
    </section>
    <section title="IANA Considerations"                             anchor="sec_iana">
        <section title="6P Scheduling Function Identifiers 'ASF'"    anchor="sec_iana_sfid_asf">
            <t>
                This document adds the following number to the "6P Scheduling Function Identifiers" registry defined by <xref target="I-D.ietf-6tisch-6top-protocol"/>:
            </t>
            <figure title="6P Scheduling Function Identifiers 'ASF'." anchor="fig_iana_sfid_asf">
<artwork><![CDATA[
 +----------------------+--------------------------------------+-----------+
 | SFID                 | Name                                 | Reference |
 +----------------------+--------------------------------------+-----------+
 | IANA_6TiSCH_SFID_ASF | Autonomous Scheduling Function (ASF) | TODO      |
 +----------------------+--------------------------------------+-----------+
]]></artwork>
            </figure>
        </section>
    </section>
</middle>
<back>
    <references title="Normative References">
        <!-- RFC 6TiSCH-->
        <!-- RFC others -->
        <?rfc include='reference.RFC.2119'?>                         <!-- Key words for use in RFCs to Indicate Requirement Levels -->
        <!-- I-D 6TiSCH -->
        <!-- I-D others -->
        <!-- external -->
        <reference                                                   anchor="IEEE802154-2015">
            <front>
                <title>
                    IEEE Std 802.15.4-2015 Standard for Low-Rate Wireless Personal Area Networks (WPANs)
                </title>
                <author>
                    <organization>IEEE standard for Information Technology</organization>
                </author>
                <date month="December" year="2015"/>
            </front>
        </reference>
    </references>
    <references title="Informative References">
       <!-- RFC others -->
        <?rfc include='reference.RFC.8180'?>
        <?rfc include='reference.RFC.6982'?>                         <!-- Improving Awareness of Running Code: The Implementation Status Section -->
        <!-- I-D 6TiSCH -->
        <?rfc include='reference.I-D.ietf-6tisch-terminology'?>
        <?rfc include='reference.I-D.ietf-6tisch-6top-protocol'?>
        <!-- <?rfc include='reference.I-D.ietf-6tisch-minimal'?>-->
        <!-- I-D others -->
        <!-- external -->
        <reference                                                   anchor="Contiki">
            <front>
                <title>The Contiki Open Source OS for the Internet of Things</title>
                <author initials="A" surname="Dunkels"     fullname="Adam Dunkels" />
                <author initials="A" surname="Lignan"      fullname="Antonio Lignan" />
                <author initials="B" surname="Thébaudeau"  fullname="Benoît Thébaudeau" />
                <author initials="R" surname="Quattlebaum" fullname="Robert Quattlebaum" />
                <author initials="F" surname="Rosendal"    fullname="Fredrik Rosendal" />
                <author initials="G" surname="Oikonomou"   fullname="George Oikonomou" />
                <author initials="L" surname="Deru"        fullname="Laurent Deru" />
                <author initials="M" surname="Alvira"      fullname="Mariano Alvira" />
                <author initials="N" surname="Tsiftes"     fullname="Nicolas Tsiftes" />
                <author initials="O" surname="Schmidt"     fullname="Oliver Schmidt" />
                <author initials="S" surname="Duquennoy"   fullname="Simon Duquennoy" />
                <date month="November" year="2016" />
            </front>
            <seriesInfo name="https://github.com/contiki-os/contiki" value="" />
        </reference>
        <reference                                                   anchor="Orchestra-SenSys">
            <front>
                <title>Orchestra: Robust Mesh Networks Through Autonomously Scheduled TSCH</title>
                <author initials="S" surname="Duquennoy"   fullname="Simon Duquennoy" />
                <author initials="B" surname="Al Nahas"   fullname="Beshr Al Nahas" />
                <author initials="O" surname="Landsiedel"   fullname="Olaf Landsiedel" />
                <author initials="T" surname="Watteyne"   fullname="Thomas Watteyne" />
                <date month="November" year="2015" />
            </front>
            <seriesInfo name="ACM SenSys 2015" value="" />
        </reference>
        <reference                                                   anchor="SAX-DASFAA">
            <front>
                <title> Performance in Practice of String Hashing Functions</title>
                <author initials="M.V" surname="Ramakrishna"/>
                <author initials="J" surname="Zobel"/>
                <date year="1997" />
            </front>
            <seriesInfo name="DASFAA" value="" />
        </reference>
    </references>
    <section title="Contributors"                                    anchor="sec_contributors">
      <t>
          Beshr Al Nahas (Chalmers University, beshr@chalmers.se) and Olaf Landsiedel (Chalmers University, olafl@chalmers.se) contributed to the design and evaluation of ASF.
      </t>
    </section>
    <section title="Acknowledgments"                                 anchor="sec_acks">
        <t>
            TODO people
        </t>
        <t>
            TODO projects
        </t>
    </section>
    <section title="[TEMPORARY] Changelog">
        <t>
            <list style="symbols">
                <t>draft-duquennoy-6tisch-asf-00
                    <list style="symbols">
                        <t>Initial draft.</t>
                    </list>
                </t>
            </list>
        </t>
    </section>
</back>
</rfc>
