<?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-chang-6tisch-msf-00">
<front>
    <title>
        6TiSCH Minimal Scheduling Function (MSF)
    </title>
    <author initials="T" surname="Chang" fullname="Tengfei Chang" role="editor">
        <organization>Inria</organization>
        <address>
            <postal>
                <street>2 rue Simone Iff</street>
                <city>Paris</city>
                <code>75012</code>
                <country>France</country>
            </postal>
            <email>tengfei.chang@inria.fr</email>
        </address>
    </author>
    <author initials="M." surname="Vucinic" fullname="Malisa Vucinic">
        <organization>University of Montenegro</organization>
        <address>
            <postal>
                <street>Dzordza Vasingtona bb</street>
                <city>Podgorica</city>
                <code>81000</code>
                <country>Montenegro</country>
            </postal>
            <email>malisav@ac.me</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>
    <date/>
    <area>Internet Area</area>
    <workgroup>6TiSCH</workgroup>
    <keyword>Draft</keyword>
    <abstract>
        <t>
            This specification defines the 6TiSCH Minimal Scheduling Function (MSF).
            This Scheduling Function describes both
                the behavior of a node when joining the network, and
                how the communication schedule is managed in a distributed fashion.
            MSF builds upon
                the 6top Protocol (6P) and
                the Minimal Security Framework for 6TiSCH.
        </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" />.
        </t>
    </note>
</front>
<middle>
    <section title="Introduction"                                              anchor="sec_intro">
        <t>
            The 6TiSCH Minimal Scheduling Function (MSF), defined in this specification, is a 6TiSCH Scheduling Function (SF).
            The role of an SF is entirely defined in <xref target="I-D.ietf-6tisch-6top-protocol" />: it complements <xref target="I-D.ietf-6tisch-6top-protocol" /> by providing the rules of when to add/delete cells in the communication schedule.
            The SF defined in this document follows that definition, and satisfies all the requirements for an SF listed in Section 4.2 of <xref target="I-D.ietf-6tisch-6top-protocol" />.
        </t>
        <t>
            MSF builds on top of the following specifications:
                the Minimal IPv6 over the TSCH Mode of IEEE 802.15.4e (6TiSCH) Configuration <xref target="RFC8180" />,
                the 6top Protocol (6P) <xref target="I-D.ietf-6tisch-6top-protocol" />, and
                the Minimal Security Framework for 6TiSCH <xref target="I-D.ietf-6tisch-minimal-security" />.
        </t>
        <t>
            MSF defines both
                the behavior of a node when joining the network, and
                how the communication schedule is managed in a distributed fashion.
            When a node running MSF boots up, it joins the network by following the 7 steps described in <xref target="sec_boot" />.
            The end state of the join process is that the node
                is synchronized to the network,
                has mutually authenticated to the network,
                has identified a preferred routing parent, and
                has scheduled a single dedicated cell to that parent.
            After the join process, the node can continuously add/delete/relocate cells, as described in <xref target="sec_add_delete" />.
            It does so for 3 reasons:
                to match the link-layer resources to the traffic,
                to handle changing parent,
                to handle a schedule collision.
        </t>
        <t>
            MSF is designed to operate in a wide range of application domains.
            It is optimized for applications with regular upstream traffic (from the nodes to the Internet).
            <xref target="sec_performance" /> contains a performance evaluation of MSF.
        </t>
        <t>
            This specification follows the recommended structure of an SF specification in Appendix A of <xref target="I-D.ietf-6tisch-6top-protocol" />, with the following adaptations:
            <list style="symbols">
                <t>
                    We have reordered part of the sections, in particular to have the section on the node behavior at boot <xref target="sec_boot" /> appear early in this specification.
                </t>
                <t>
                    We added sections on
                        the interface to the minimal 6TiSCH configuration <xref target="sec_minimal" />,
                        the use of the SIGNAL command <xref target="sec_signal" />,
                        the MSF constants <xref target="sec_constants" />,
                        the MSF statistics <xref target="sec_stats" />,
                        the performance of MSF <xref target="sec_performance" />.
                </t>
                <t>
                    We have not included an examples section.
                </t>
            </list>
        </t>
    </section>
    <section title="Interface to the Minimal 6TiSCH Configuration"             anchor="sec_minimal">
        <t>
            A node implementing MSF MUST implement the Minimal 6TiSCH Configuration <xref target="RFC8180" />, which defines the "minimal cell", a single shared cell providing minimal connectivity between the nodes in the network.
        </t>
        <t>
            MSF uses the minimal cell to exchange the following packets:
            <list style="numbers">
                <t>
                    Enhanced Beacons (EBs), defined by <xref target="IEEE802154-2015" />.
                    These are broadcast frames.
                </t>
                <t>
                    DODAG Information Objects (DIOs), defined by <xref target="RFC6550" />.
                    These are broadcast frames.
                </t>
                <t>
                    The Join Request and Join Response packets when sent between the pledge and the Join Proxy, defined by <xref target="I-D.ietf-6tisch-minimal-security" />.
                    These are unicast frames.
                </t>
                <t>
                    The first 6P packet a node issues to a neighbor it doesn't have dedicated cells to, as defined by <xref target="I-D.ietf-6tisch-6top-protocol" />.
                    These are unicast frames.
                </t>
            </list>
        </t>
        <t>
            Because the minimal cell is SHARED, the back-off algorithm defined in <xref target="IEEE802154-2015" /> is used to resolve collisions.
            To ensure there is enough bandwidth available on the minimal cell for the unicast traffic, a node implementing MSF SHOULD enforce the following rules for broadcast frames:
            <list style="numbers">
                <t>send EBs  on a portion of the minimal cells not exceeding 1/(3(N+1)), where N is the number of neighbors of the node.</t>
                <t>send DIOs on a portion of the minimal cells not exceeding 1/(3(N+1)), where N is the number of neighbors of the node.</t>
            </list>
        </t>
        <t>
            The RECOMMENDED behavior for sending EBs  is to have a node send EBs with a probability of 1/(3(N+1)).
            The RECOMMENDED behavior for sending DIOs is to use a Trickle timer with rate-limiting.
        </t>
        <t>
            <xref target="sec_ebs" /> describes how to evaluate the number of neighbors during the joining process.
            After the joining process, how to evaluate the number of neighbors is implementation-specific.
        </t>
        <t>
            As detailed in Section 2.2 of <xref target="I-D.ietf-6tisch-6top-protocol" />, MSF MUST schedule cells from Slotframe 1, while Slotframe 0 is used for traffic defined in the Minimal 6TiSCH Configuration.
            The length of Slotframe 0 and Slotframe 1 MUST be the same value.
            The default of SLOTFRAME_LENGTH is RECOMMENDED, although any value can be advertised in the EBs.
        </t>
    </section>
    <section title="Node Behavior at Boot"                                     anchor="sec_boot">
        <t>
            This section details the behavior the node SHOULD follow from the moment it is switched on, until it has successfully joined the network.
            <xref target="sec_start_state" /> details the start state;
            <xref target="sec_end_state" />   details the end   state.
            The other sections detail the 7 steps of the joining process.
            We use the term "pledge" and "joined node", as defined in <xref target="I-D.ietf-6tisch-minimal-security" />.
        </t>
        <section title="Start State"                                           anchor="sec_start_state">
            <t>
                A node implementing MSF MUST implement the Minimal Security Framework for 6TiSCH <xref target="I-D.ietf-6tisch-minimal-security" />.
                As a corollary, this means that a pledge, before being switched on, is pre-configured with the Pre-Shared Key (PSK) for joining, as well as any other configuration detailed in <xref target="I-D.ietf-6tisch-minimal-security" />.
            </t>
        </section>
        <section title="Step 1 - Choosing Frequency"                           anchor="sec_frequency">
            <t>
                When switched on, the pledge SHOULD randomly choose a frequency among the available frequencies, and start listening for EBs on that frequency.
            </t>
        </section>
        <section title="Step 2 - Receiving EBs"                                anchor="sec_ebs">
            <t>
                Upon receiving the first EB, the pledge SHOULD continue listening for additional EBs to learn:
                <list style="numbers">
                    <t>the number of neighbors N in its vicinity</t>
                    <t>which neighbor to choose as a Join Proxy (JP) for the joining process</t>
                </list>
            </t>
            <t>
                While the exact behavior is implementation-specific, the RECOMMENDED behavior is to follow <xref target="RFC8180" />, and listen until EBs sent by NUM_NEIGHBOURS_TO_WAIT (defined in <xref target="RFC8180" />) have been received.
            </t>
            <t>
                During this step, the pledge MAY synchronize to any EB it receives from the network it wishes to join.
                How to decide whether an EB originates from a node from the network it wishes to join is implementation-specific, but MAY involve filtering EBs by
                    the PAN ID field it contains,
                    the presence and contents of the IE defined in <xref target="I-D.richardson-6tisch-join-enhanced-beacon" />, or
                    the key used to authenticate it.
            </t>
            <t>
                The decision of which neighbor to use as a JP is implementation-specific, and discussed in <xref target="I-D.ietf-6tisch-minimal-security" />.
            </t>
        </section>
        <section title="Step 3 - Join Request/Response"                        anchor="sec_join">
            <t>
                As per <xref target="I-D.ietf-6tisch-minimal-security" />, after having selected a JP, the pledge sends a Join Request to its JP.
                Because no dedicated cells are in place at this point, this happens on the minimal cell.
                The JP then forwards the Join Request to the JRC, possibly over multiple hops.
                When forwarding this Join Request, a node MUST use a dedicated cell it has with its preferred parent (not the minimal cell).
                How such dedicated cells are installed is detailed in <xref target="sec_6padd" />.
            </t>
            <t>
                As per <xref target="I-D.ietf-6tisch-minimal-security" />, the JRC sends back a Join Response to the pledge, through the JP.
                When forwarding this Join Response, a node MUST use a dedicated cell it has with its child (not the minimal cell).
                How such dedicated cells are installed is detailed in <xref target="sec_6padd" />.
            </t>
            <t>
                As per <xref target="I-D.ietf-6tisch-minimal-security" />, after receiving the Join Response, the pledge learns the keying material used in the network, as well as other configurations, and becomes a "joined node".
            </t>
        </section>
        <section title="Step 4 - Acquiring a RPL rank"                         anchor="sec_rank">
            <t>
                Because it has learned the link-layer keying material used in the network, the joined node can now decrypt the DIO packets sent by its neighbors.
                Per <xref target="RFC6550" />, the joined node
                    receives DIOs,
                    computes its own rank, and
                    selects a preferred parent.
            </t>
        </section>
        <section title="Step 5 - 6P ADD to Preferred Parent"                   anchor="sec_6padd">
            <t>
                After having selected a preferred parent, the joined node MUST issue a 6P ADD command to that parent, with the following fields:
                <list style="symbols">
                    <t>CellOptions: set to TX=1,RX=1,SHARED=1</t>
                    <t>NumCells:    set to 1</t>
                    <t>CellList:    at least 5 cells, chosen according to <xref target="sec_celllist" /></t>
                </list>
            </t>
            <t>
                After the 6P Transaction is finished, the node MUST synchronize only to its preferred parent.
                At this point, the node has a dedicated cell which allows for bidirectional communication with its preferred parent.
            </t>
        </section>
        <section title="Step 6 - Send EBs and DIOs"                            anchor="sec_eb_dio">
            <t>
                The node SHOULD start sending EBs and DIOs on the minimal cell, while following the transmit rules for broadcast frames from <xref target="sec_minimal" />.
            </t>
        </section>
        <section title="Step 7 - Neighbor Polling"                             anchor="sec_polling">
            <t>
                The node SHOULD send some form of keep-alive messages to all its neighbors it has dedicated cells with.
                The Keep-Alive (KA) mechanism is detailed in <xref target="RFC7554" />.
                It uses the keep-alive messages to its preferred parent to stay synchronized.
                It uses the keep-alive messages to its children (with which it has a dedicated cell to, which the child has created) to ensure the child is still reachable.
                The RECOMMENDED period for sending keep-alive messages is KA_PERIOD.
            </t>
            <t>
                If the keep-alive message to a child fails at the link layer (i.e. the maximum number of link-layer retries is reached), the node SHOULD declare the child as unreachable.
                This can happen for example when the child node is switched off.
            </t>
            <t>
                When a neighbor is declared unreachable, the node
                    MUST issue a 6P CLEAR to that neighbor (which can fail at the link-layer), and
                    MUST remove all dedicated links with that neighbor from its own schedule.
            </t>
        </section>
        <section title="End State"                                             anchor="sec_end_state">
            <t>
                For a new node, the end state of the joining process is:
                <list style="symbols">
                    <t>it is synchronized to the network</t>
                    <t>it is using the link-layer keying material it learned through the secure joining process</t>
                    <t>it has identified its preferred routing parent</t>
                    <t>it has a single dedicated cell to its preferred routing parent</t>
                    <t>it is periodically sending DIOs, potentially serving as a router for other nodes' traffic</t>
                    <t>it is periodically sending EBs,  potentially serving as a JP for new joining nodes</t>
                </list>
            </t>
        </section>
    </section>
    <section title="Rules for Adding/Deleting Cells"                           anchor="sec_add_delete">
        <t>
            Once a node has joined the 6TiSCH network, it adds/deletes/relocates cells with its preferred parent for three reasons:
            <list style="symbols">
                <t>to match the link-layer resources to the traffic between the node and its preferred parent (<xref target="sec_traffic" />)</t>
                <t>to handle switching preferred parent (<xref target="sec_switching_parent" />)</t>
                <t>to handle a schedule collision (<xref target="sec_collision" />)</t>
            </list>
        </t>
        <section title="Adapting to Traffic"                                   anchor="sec_traffic">
            <t>
                A node implementing MSF MUST implement the behavior described in this section.
            </t>
            <t>
                The goal of MSF is to manage the communication schedule in the 6TiSCH schedule in a distributed manner.
                For a node, this translates into monitoring the current usage of the cells it has to its preferred parent:
                <list style="symbols">
                    <t>
                        If the node determines that the number of link-layer frames it is attempting to exchange with its preferred parent per unit of time is larger than the capacity offered by the TSCH cells it has scheduled with it, it triggers a 6P Transaction with its preferred parent to add cells to the TSCH schedule of both nodes.
                    </t>
                    <t>
                        If the traffic is lower than the capacity, the node triggers a 6P Transaction with its preferred parent to delete cells from the TSCH schedule of both nodes.
                    </t>
                </list>
            </t>
            <t>
                From the join process, the node already has one dedicated cell scheduled to its preferred parent.
                A node MUST NOT remove all cells to its preferred parent, i.e. there must always be at least one dedicated cell scheduled between a node and its preferred parent, even if no frames are being exchanged between them.
            </t>
            <t>
                Adding/removing/relocating cells involves exchanging frames that contain 6P commands.
                Once the first cell has been established as part of the join process, all 6P frames MUST be sent on the dedicated cells (not the minimal cell).
            </t>
            <t>
                The node MUST maintain the following counters for its preferred parent:
                <list hangIndent="4" style="hanging">
                    <t hangText="NumCellsPassed:">
                        Counts the number of dedicated cells that have passed since the counter was initialized.
                        This counter is initialized at 0.
                        Each time the TSCH state machine indicates the current cell is a dedicated cell to the preferred parent, NumCellsPassed is incremented by exactly 1.
                    </t>
                    <t hangText="NumCellsUsed:">
                        Counts the number of dedicated cells that have been used.
                        This counter is initialized at 0.
                        NumCellsUsed is incremented by exactly 1 when, during a dedicated cell to the preferred parent, either of the following happens:
                        <list style="symbols">
                            <t>
                                The node sends a frame to its preferred parent.
                                The counter increments regardless of whether a link-layer acknowledgment was received or not.
                            </t>
                            <t>
                                The node receives a frame from its preferred parent.
                            </t>
                        </list>
                    </t>
                </list>
            </t>
            <t>
                Implementors MAY choose to create the same counters for each neighbor, and add them as additional statistics in the neighbor table.
            </t>
            <t>
                The counters are used as follows:
                <list style="numbers">
                    <t>
                        Both NumCellsPassed and NumCellsUsed are initialized to 0 when the node boots.
                    </t>
                    <t>
                        When the value of NumCellsPassed reaches MAX_NUMCELLS:
                        <list style="symbols">
                            <t>If NumCellsUsed &gt; LIM_NUMCELLSUSED_HIGH, trigger 6P to add    a single cell to the preferred parent</t>
                            <t>If NumCellsUsed &lt; LIM_NUMCELLSUSED_LOW,  trigger 6P to remove a single cell to the preferred parent</t>
                            <t>Reset both NumCellsPassed and NumCellsUsed to 0 and go to step 2.</t>
                        </list>
                    </t>
                </list>
            </t>
        </section>
        <section title="Switching Parent"                                      anchor="sec_switching_parent">
            <t>
                A node implementing MSF MUST implement the behavior described in this section.
            </t>
            <t>
                Part of its normal operation, the RPL routing protocol can have a node switch preferred parents.
                The procedure for switching from the old preferred parent to the new preferred parent is:
                <list style="numbers">
                    <t>the node counts the number of dedicated cells it has per slotframe to the old preferred parent</t>
                    <t>the node triggers one or more 6P ADD commands to schedule the same number of dedicated cells to the new preferred parent</t>
                    <t>when that successfully completes, the node issues a 6P CLEAR command to its old preferred parent</t>
                </list>
            </t>
        </section>
        <section title="Handling Schedule Collisions"                          anchor="sec_collision">
            <t>
                A node implementing MSF SHOULD implement the behavior described in this section.
                The "MUST" statements in this section hence only apply if the node implements schedule collision handling.
            </t>
            <t>
                Since scheduling is entirely distributed, there is a non-zero probability that two pairs of nearby neighbor nodes schedule a cell at the same [slotOffset,channelOffset] location in the TSCH schedule.
                In that case, data exchanged by the two pairs may collide on that cell.
                We call this case a "schedule collision".
            </t>
            <t>
                The node MUST maintain the following counters for each cell to its preferred parent:
                <list hangIndent="4" style="hanging">
                    <t hangText="NumTx:">
                        Counts the number of transmission attempts on that cell.
                        Each time the node attempts to transmit a frame on that cell, NumTx is incremented by exactly 1.
                    </t>
                    <t hangText="NumTxAck:">
                        Counts the number of successful transmission attempts on that cell.
                        Each time the node receives an acknowledgment for a transmission attempt, NumTxAck is incremented by exactly 1.
                    </t>
                </list>
            </t>
            <t>
                Implementors MAY choose to maintain the same counters for each cell in the schedule.
            </t>
            <t>
                Since both NumTx and NumTxAck are initialized to 0, we necessarily have NumTxAck &lt;= NumTx.
                We call Packet Delivery Ratio (PDR) the ratio NumTxAck/NumTx; and represent it as a percentage.
                A cell with PDR=50% means that half of the frames transmitted are not acknowledged (and need to be retransmitted).
            </t>
            <t>
                Each time the node switches preferred parent (or during the join process when the node selects a preferred parent for the first time), both NumTx and NumTxAck MUST be reset to 0.
                They increment over time, as the schedule is executed and the node sends frames to its preferred parent.
                When NumTx reaches 256, both NumTx and NumTxAck MUST be divided by 2.
                That is, for example, from NumTx=256 and NumTxAck=128, they become NumTx=128 and NumTxAck=64.
                This operation does not change the value of the PDR, but allows the counters to keep incrementing.
            </t>
            <t>
                The key for detecting a schedule collision is that, if a node has several cells to the same preferred parent, all cells should exhibit the same PDR.
                A cell which exhibits a PDR significantly worse than the others indicates than there are collisions on that cell.
            </t>
            <t>
                Every HOUSEKEEPINGCOLLISION_PERIOD, the node executes the following steps:
                <list style="numbers">
                    <t>
                        It aborts this series of steps if NumTx hasn't been divided by 2 since it was last reset.
                        This avoids triggering cell relocation when the values of NumTx and NumTxAck are not statistically significant yet.
                    </t>
                    <t>
                        It computes, for each cell with its preferred parent, that cell's PDR.
                    </t>
                    <t>
                        It identifies the cell with the highest PDR.
                    </t>
                    <t>
                        For each other cell, it compare its PDR against that of the cell with the highest PDR.
                        If it's less than RELOCATE_PDRTHRES, it triggers the relocation of that cell using a 6P RELOCATE command.
                    </t>
                </list>
            </t>
        </section>
    </section>
    <section title="6P SIGNAL command"                                         anchor="sec_signal">
        <t>
            The 6P SIGNAL command is not used by MSF.
        </t>
    </section>
    <section title="Scheduling Function Identifier"                            anchor="sec_sfid">
        <t>
            The Scheduling Function Identifier (SFID) of MSF is IANA_6TISCH_SFID_MSF.
        </t>
    </section>
    <section title="Rules for CellList"                                        anchor="sec_celllist">
        <t>
            MSF uses 2-step 6P Transactions exclusively.
            6P Transactions are only initiated by a node towards it preferred parent.
            As a result, the cells to put in the CellList of a 6P ADD command, and in the candidate CellList of a RELOCATE command, are chosen by the node.
            In both cases, the same rules apply:
            <list>
                <t>the CellList SHOULD contain 5 or more cells.</t>
                <t>Each cell in the CellList MUST have a different slotOffset value.</t>
                <t>For each cell in the CellList, the node MUST NOT have any scheduled cell on the same slotOffset.</t>
                <t>The slotOffset value of any cell in the CellList MUST NOT be the same as the slotOffset of the minimal cell (slotOffset=0).</t>
                <t>The slotOffset    of a cell in the CellList SHOULD be randomly and uniformly chosen among all the slotOffset values that satisfy the restriction above.</t>
                <t>The channelOffset of a cell in the CellList SHOULD be randomly and uniformly in [0..numFrequencies] where numFrequencies represents the number of frequencies a node can communicate on.</t>
            </list>
        </t>
    </section>
    <section title="6P Timeout Value"                                          anchor="sec_timeout">
        <t>
            The 6P Timeout is not a constant value.
            It is calculated a (C/PDR)*6PTIMEOUT_SEC_FACTOR, where:
            <list style="symbols">
                <t>C represents the number of cells per second scheduled to that neighbor</t>
                <t>PDR represents the average PDR of those cells</t>
                <t>6PTIMEOUT_SEC_FACTOR is a security factor, a constant</t>
            </list>
        </t>
    </section>
    <section title="Rule for Ordering Cells"                                   anchor="sec_ordering">
        <t>
            Cells are ordered slotOffset first, channelOffset second.
        </t>
        <t>
            The following sequence is correctly ordered (each element represents the [slottOffset,channelOffset] of a cell in the schedule):
        </t>
        <t>
            [1,3],[1,4],[2,0],[5,3],[6,0],[6,3],[7,9]
        </t>
    </section>
    <section title="Meaning of the Metadata Field"                             anchor="sec_metadata">
        <t>
            The Metadata field is not used by MSF.
        </t>
    </section>
    <section title="6P Error Handling"                                         anchor="sec_error">
        <t>
            Section 6.2.4 of <xref target="I-D.ietf-6tisch-6top-protocol" /> lists the 6P Return Codes.
            <xref target="tab_error" /> lists the same error codes, and the behavior a node implementing MSF SHOULD follow. 
        </t>
        <figure title="Recommended behavior for each 6P Error Code."           anchor="tab_error">
<artwork><![CDATA[
              +-------------+----------------------+
              | Code        | RECOMMENDED behavior |
              +-------------+----------------------+
              | RC_SUCCESS  | nothing              |
              | RC_EOL      | nothing              |
              | RC_ERROR    | quarantine           |
              | RC_RESET    | quarantine           |
              | RC_VERSION  | quarantine           |
              | RC_SFID     | quarantine           |
              | RC_SEQNUM   | clear                |
              | RC_CELLLIST | clear                |
              | RC_BUSY     | waitretry            |
              | RC_LOCKED   | waitretry            |
              +-------------+----------------------+
]]></artwork>
        </figure>
        <t>
            The meaning of each behavior from <xref target="tab_error" /> is:
            <list hangIndent="4" style="hanging">
                <t hangText="nothing:">
                    Indicates that this Return Code is not an error.
                    No error handling behavior is hence triggered.
                </t>
                <t hangText="clear:">
                    Abort the 6P Transaction.
                    Issue a 6P CLEAR command to that neighbor (this command may fail).
                    Remove all cells scheduled with that neighbor from the local schedule.
                    Keep that node in the neighbor and routing tables.
                </t>
                <t hangText="quarantine:">
                    Same behavior as for "clear".
                    In addition, remove the node from the neighbor and routing tables.
                    Place the node's identifier in a quarantine list for QUARANTINE_DURATION.
                    When in quarantine, drop all frames received from that node.
                </t>
                <t hangText="waitretry:">
                    Abort the 6P Transaction.
                    Wait for a duration randomly and uniformly chosen in [WAITDURATION_MIN,WAITDURATION_MAX].
                    Retry the same transaction.
                </t>
            </list>
        </t>
    </section>
    <section title="Schedule Inconsistency Handling"                           anchor="sec_inconsistency">
        <t>
            The behavior when schedule inconsistency is detected is explained in <xref target="tab_error" />, for 6P Return Code RC_SEQNUM.
        </t>
    </section>
    <section title="MSF Constants"                                             anchor="sec_constants">
        <t>
            <xref target="tab_constants" /> lists MSF Constants and their RECOMMENDED values. 
        </t>
        <figure title="MSF Constants and their RECOMMENDED values."            anchor="tab_constants">
<artwork><![CDATA[
        +------------------------------+-------------------+
        | Name                         | RECOMMENDED value |
        +------------------------------+-------------------+
        | KA_PERIOD                    |       10 s        |
        | LIM_NUMCELLSUSED_HIGH        |       75 %        |
        | LIM_NUMCELLSUSED_LOW         |       25 %        |
        | HOUSEKEEPINGCOLLISION_PERIOD |        1 min      |
        | RELOCATE_PDRTHRES            |       50 %        |
        | 6PTIMEOUT_SEC_FACTOR         |        3 x        |
        | SLOTFRAME_LENGTH             |      101 slots    |
        | QUARANTINE_DURATION          |        5 min      |
        | WAITDURATION_MIN             |       30 s        |
        | WAITDURATION_MAX             |       60 s        |
        +------------------------------+-------------------+
]]></artwork>
        </figure>
    </section>
    <section title="MSF Statistics"                                            anchor="sec_stats">
        <t>
            <xref target="tab_stats" /> lists MSF Statistics and their RECOMMENDED width. 
        </t>
        <figure title="MSF Statistics and their RECOMMENDED width."            anchor="tab_stats">
<artwork><![CDATA[
                +-----------------+-------------------+
                | Name            | RECOMMENDED width |
                +-----------------+-------------------+
                | NumCellsPassed  |      1 byte       |
                | NumCellsUsed    |      1 byte       |
                | NumTx           |      1 byte       |
                | NumTxAck        |      1 byte       |
                +-----------------+-------------------+
]]></artwork>
        </figure>
    </section>
    <section title="Security Considerations"                                   anchor="sec_security">
        <t>
            MSF defines a series of "rules" for the node to follow.
            It triggers several actions, that are carried out by the protocols defined in the following specifications:
                the Minimal IPv6 over the TSCH Mode of IEEE 802.15.4e (6TiSCH) Configuration <xref target="RFC8180" />,
                the 6top Protocol (6P) <xref target="I-D.ietf-6tisch-6top-protocol" />, and
                the Minimal Security Framework for 6TiSCH <xref target="I-D.ietf-6tisch-minimal-security" />.
            In particular, MSF does not define a new protocol or packet format.
        </t>
        <t>
            MSF relies entirely on the security mechanisms defined in the specifications listed above.
        </t>
    </section>
    <section title="IANA Considerations"                                       anchor="sec_iana">
        <section title="MSF Scheduling Function Identifiers"                   anchor="sec_iana_sfid">
            <t>
                This document adds the following number to the
                    "6P Scheduling Function Identifiers" sub-registry,
                    part of the "IPv6 over the TSCH mode of IEEE 802.15.4e (6TiSCH) parameters" registry,
                    as defined by <xref target="I-D.ietf-6tisch-6top-protocol" />:
            </t>
            <figure title="IETF IE Subtype '6P'."                              anchor="fig_iana_sfid">
<artwork><![CDATA[
+----------------------+-----------------------------+-------------+
|  SFID                | Name                        | Reference   |
+----------------------+-----------------------------+-------------+
| IANA_6TISCH_SFID_MSF | Minimal Scheduling Function | RFCXXXX     |
|                      | (MSF)                       | (NOTE:this) |
+----------------------+-----------------------------+-------------+
]]></artwork>
            </figure>
        </section>
    </section>
</middle>
<back>
    <references title="Normative References">
        <!-- RFC 6TiSCH-->
        <?rfc include='reference.RFC.8180'?>     <!-- Minimal IPv6 over the TSCH Mode of IEEE 802.15.4e (6TiSCH) Configuration -->
        <?rfc include='reference.RFC.7554'?>     <!-- Using IEEE 802.15.4e Time-Slotted Channel Hopping (TSCH) in the Internet of Things (IoT): Problem Statement -->
        <!-- RFC others -->
        <?rfc include='reference.RFC.6550'?>     <!-- RPL: IPv6 Routing Protocol for Low-Power and Lossy Networks -->
        <?rfc include='reference.RFC.2119'?>     <!-- Key words for use in RFCs to Indicate Requirement Levels -->
        <!-- I-D 6TiSCH -->
        <?rfc include='reference.I-D.ietf-6tisch-6top-protocol'?>
        <?rfc include='reference.I-D.ietf-6tisch-minimal-security'?>
        <?rfc include='reference.I-D.richardson-6tisch-join-enhanced-beacon'?>
        <!-- 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 6TiSCH-->
        <!-- RFC others -->
        <?rfc include='reference.RFC.6982'?>     <!-- Improving Awareness of Running Code: The Implementation Status Section -->
        <!-- I-D 6TiSCH -->
        <!-- I-D others -->
        <!-- external -->
        <reference                                                             anchor="OpenWSN">
            <front>
                <title>OpenWSN: a Standards-Based Low-Power Wireless Development Environment</title>
                <author initials="T" surname="Watteyne"   fullname="Thomas Watteyne" />
                <author initials="X" surname="Vilajosana" fullname="Xavier Vilajosana" />
                <author initials="B" surname="Kerkez"     fullname="Branko Kerkez" />
                <author initials="F" surname="Chraim"     fullname="Fabien Chraim" />
                <author initials="K" surname="Weekly"     fullname="Kevin Weekly" />
                <author initials="Q" surname="Wang"       fullname="Qin Wang" />
                <author initials="S" surname="Glaser"     fullname="Steven Glaser" />
                <author initials="K" surname="Pister"     fullname="Kris Pister" />
                <date month="August" year="2012" />
            </front>
            <seriesInfo name="Transactions on Emerging Telecommunications Technologies" value="" />
        </reference>
    </references>
    <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="OpenWSN:">
                    MSF is being implemented in the OpenWSN project <xref target="OpenWSN"/> under a BSD open-source license.
                    The authors of this document are collaborating with the OpenWSN community to gather feedback about the status and performance of the protocols described in this document.
                    Results from that discussion will appear in this section in future revision of this specification.
                    More information about this implementation at http://www.openwsn.org/.
                </t>
                <t hangText="6TiSCH simulator">
                    The 6TiSCH simulator is a Python-based high-level simulator on which MSF is being implemented.
                    More information at https://bitbucket.org/6tisch/simulator/.
                </t>
            </list>
        </t>
    </section>
    <section title="Performance Evaluation"                                    anchor="sec_performance">
        <t>
            The performance of MSF may be published as companion documents to this specification, possibly under the form a applicability statements.
        </t>
    </section>
    <section title="[TEMPORARY] Changelog">
        <t>
            <list style="symbols">
                <t>draft-chang-6tisch-msf-00
                    <list style="symbols">
                        <t>Initial submission.</t>
                    </list>
                </t>
            </list>
        </t>
    </section>
</back>
</rfc>
