Fragmentation ================= .. contents:: :local: :depth: 3 Overview -------- IEEE 802.11 **fragmentation** allows a large MAC Service Data Unit (MSDU) to be split into smaller MAC Protocol Data Units (MPDUs), known as *fragments*, before transmission. Fragmentation improves reliability over noisy channels by ensuring that only the lost fragment must be retransmitted, rather than the entire frame. Purpose ~~~~~~~ - Increase reliability under high Bit Error Rate (BER) conditions. - Limit retransmission overhead. - Maintain better efficiency on lossy or interference-prone wireless links. Fragmentation Threshold ----------------------- - **Parameter:** ``dot11FragmentationThreshold`` - **Range:** 256–2346 bytes - **Default:** 2346 bytes (effectively disables fragmentation) Rule: .. code-block:: none if MSDU_size > fragmentation_threshold: fragment MSDU else: send as single frame Fragmentation at the MAC Layer ------------------------------ The MAC layer divides an MSDU into smaller MPDUs (fragments). Each fragment: - Is transmitted independently. - Shares the **same Sequence Number**. - Has a unique **Fragment Number** (0, 1, 2, …). - Uses the **More Fragments (MF)** bit in the Frame Control field to indicate whether more fragments follow. Fragment fields summary ~~~~~~~~~~~~~~~~~~~~~~~ +-------------------+----------------------------------------------+ | Field | Description | +===================+==============================================+ | Sequence Number | Same for all fragments | | Fragment Number | Increments from 0 | | More Fragments | 1 for all but last fragment, 0 for last one | | Duration/ID | Updated per fragment for NAV reservation | | Frame Control | Contains MF bit | +-------------------+----------------------------------------------+ Frame Structure --------------- Each fragment is transmitted as a complete 802.11 frame: :: +----------------------------+ | Frame Control (MF bit) | | Duration / ID | | Address 1 (Receiver) | | Address 2 (Transmitter) | | Address 3 (BSSID) | | Sequence Control (Seq+Frag)| | Payload (MSDU fragment) | | FCS | +----------------------------+ - **MF Bit:** 1 for all but the last fragment. - **Sequence Control:** Upper bits = Sequence Number, lower 4 bits = Fragment Number. Timing Relationships -------------------- Fragmentation uses separate ACKs for each fragment. Once a station wins medium access, it transmits all fragments sequentially separated by **SIFS** intervals — no further backoff. Timing example: :: [DIFS + Backoff] → Frag#0 → SIFS → ACK → SIFS → Frag#1 → SIFS → ACK → SIFS → Frag#2 → SIFS → ACK Key rules: - **SIFS** separates each fragment and ACK. - **No DIFS/backoff** between fragments of the same MSDU. - Each fragment is ACKed individually. NAV and Duration Field Handling ------------------------------- Each fragment updates the **Duration field** to indicate how long the medium will be busy for the remaining fragments and their ACKs. Other stations set their **NAV (Network Allocation Vector)** accordingly. Example NAV update sequence: +-----------+--------------+-------------+ | Fragment | MF Bit | Duration (µs) | +===========+=========+=================+ | Frag #0 | 1 | 900 | | Frag #1 | 1 | 600 | | Frag #2 | 0 | 0 | +-----------+---------+-----------------+ Stations that overhear these frames set their NAVs to the corresponding durations. Acknowledgment and Retransmission --------------------------------- - Each fragment must be **individually acknowledged**. - ACK sent after **SIFS**. - If no ACK is received, **only that fragment** and subsequent ones are retransmitted. Retransmission logic ~~~~~~~~~~~~~~~~~~~~ .. code-block:: c for (i = 0; i < num_fragments; i++) { send(fragment[i]); if (wait_for_ack()) { continue; // next fragment } else { if (retry_count++ > SHORT_RETRY_LIMIT) { drop_msdus(); break; } retransmit(fragment[i]); i--; // retry current fragment } } Reassembly at Receiver ---------------------- Receiver reassembles fragments based on: - **Transmitter Address** - **BSSID** - **Sequence Number** - **Fragment Number** Fragments must arrive in order. If any fragment is missing or corrupt, the receiver **discards the entire MSDU**. :: MF=1, Frag#0 → MF=1, Frag#1 → MF=0, Frag#2 → reassembly complete Reassembly Steps ~~~~~~~~~~~~~~~~ 1. Collect all fragments with same Sequence Number and source. 2. Sort by Fragment Number. 3. Verify integrity (CRC/FCS). 4. Deliver MSDU to LLC layer when final fragment (MF=0) arrives. 5. Discard incomplete MSDUs after timeout or CRC failure. Interaction with RTS/CTS ------------------------ If **RTS/CTS** is enabled: - The **RTS/CTS** exchange occurs only before **Fragment #0**. - CTS Duration field covers the time for all fragments + ACKs. - All subsequent fragments are protected by NAV values set by the CTS. This minimizes collision risk across the entire fragment burst. Security Considerations ----------------------- Encryption is applied **after fragmentation**. - Each fragment is individually encrypted. - Each fragment carries its own IV (for WEP/TKIP) or PN (for CCMP). - Receiver decrypts and verifies each fragment separately. :: Fragmentation → Encryption → Transmission This ensures message integrity and replay protection for every fragment. Performance Implications ------------------------ **Advantages:** - Less retransmission overhead on noisy channels. - Better performance with high BER links. **Disadvantages:** - Higher MAC overhead (headers, ACKs, SIFS). - Slightly reduced throughput in clean channels. Optimal fragmentation threshold depends on: - PHY rate - Channel quality (BER) - Traffic type (bulk vs. latency-sensitive) Fragmentation Example --------------------- Given a 4000-byte MSDU and a fragmentation threshold of 1500 bytes: +-----------+-----------+---------+---------+---------------+ | Fragment | Size (B) | MF Bit | Frag # | Seq # | +===========+===========+=========+=========+===============+ | Frag #0 | 1500 | 1 | 0 | 110 | | Frag #1 | 1500 | 1 | 1 | 110 | | Frag #2 | 1000 | 0 | 2 | 110 | +-----------+-----------+---------+---------+---------------+ Transmission timeline: :: DIFS + Backoff ↓ Frag#0 → SIFS → ACK SIFS → Frag#1 → SIFS → ACK SIFS → Frag#2 → SIFS → ACK ASCII Timing Diagram -------------------- .. code-block:: none Sender: [DIFS] [Backoff] ──Frag#0── SIFS ──ACK── SIFS ──Frag#1── SIFS ──ACK── SIFS ──Frag#2── SIFS ──ACK── Receiver: Receive0 SIFS SendACK0 SIFS Receive1 SIFS SendACK1 SIFS Receive2 SIFS SendACK2 Others: NAV set for entire burst duration (from Duration fields) Implementation Notes -------------------- - Always recompute FCS for each fragment. - Maintain same Sequence Number across fragments. - Increment Fragment Number sequentially. - Apply same priority and QoS parameters for all fragments. - Respect SIFS and ACK timing precisely (µs granularity). References ---------- - IEEE Std **802.11-2020**, Clause **9.3.2.10** — Fragmentation and Defragmentation - IEEE Std **802.11-2016**, Clause **9.2.5** - M. Gast, *802.11 Wireless Networks: The Definitive Guide* - Heusse et al., *Performance Anomaly of 802.11b*, IEEE INFOCOM 2003 Figures ------- .. figure:: _static/fragmentation_timing.svg :align: center :alt: Fragmentation timing diagram Example of Fragmentation and ACK exchange timing. .. figure:: _static/fragmentation_reassembly.svg :align: center :alt: Fragment reassembly process Receiver defragmentation process showing MSDU reconstruction.