Networking · Wireless Networking

A-MPDU Aggregation and Block Acknowledgement

How 802.11n packs many frames into one transmission, why each subframe keeps its own check sequence, and what the block ack bitmap window buys.

A 1500-byte data frame, 12,000 bits, occupies about 222 microseconds of payload time at 54 Mbit/s in a 20 MHz channel. Around it sits a 20 microsecond preamble and signal field, a 24-byte MAC header carried in the data symbols, two interframe spaces of 16 and 34 microseconds, and a 14-byte acknowledgement that itself takes tens of microseconds at one of the low rates. Summed, the fixed costs approach the payload cost. Raising the modulation helps only partly, because the preamble and signal field are sent at the low rate and the interframe spaces are wall-clock constants. The only way to improve efficiency is to send more payload per acquisition of the medium.

Aggregation does exactly that: one transmission carries many frames, one acknowledgement covers all of them, and the preamble and interframe spaces are paid once.

Two aggregation forms

The high-throughput amendment defines two, and they behave differently enough that implementations choose per frame.

Aggregate MAC service data unit, A-MSDU, concatenates several Ethernet-like payloads into a single MAC frame. Each payload is prefixed with a 14-byte subframe header containing the destination, source, and length, and the whole aggregate carries one frame check sequence. The efficiency is high because there is only one MAC header and one check sequence. The weakness is that the aggregate is a single unit for reliability: a bit error anywhere corrupts the whole aggregate, and the receiver cannot tell which payload failed, so all of them are retransmitted.

Aggregate MAC protocol data unit, A-MPDU, wraps each frame in its own MPDU delimiter and its own frame check sequence. The delimiter is 4 bytes: a 12-bit length, four reserved bits, an 8-bit check over that 16-bit word, and a fixed signature byte, 0x4E, as the last octet. Each subframe is an ordinary 802.11 frame with its own header and trailer. The receiver checks each subframe independently and reports which ones passed in a bitmap. A corrupt subframe is the only one retransmitted.

The cost of A-MPDU’s independence is per-subframe overhead. Each subframe repeats the 24- or 30-byte MAC header, the 4-byte check sequence, and the 4-byte delimiter, over 30 bytes of framing per payload before any security encapsulation. For small payloads that is significant; for full-size payloads it is a few percent. The benefit is that a partial failure costs only the failed subframes, which on a lossy channel is the difference between a functioning link and a stalled one.

The aggregation limit is a time, not a count

The receiver must hold every subframe of an aggregate in its reorder buffer until the block acknowledgement settles which ones it may pass upward, and the transmitter must not hold the medium so long that other stations starve. Both concerns are addressed by a duration limit rather than a size limit.

The maximum A-MPDU length is 65,535 octets in the high-throughput amendment, and the number of subframes in one aggregate is bounded at 64 in the original definition. But the binding constraint in practice is the transmit opportunity: an aggregate is limited to the duration the transmitter has reserved, which is bounded by a value the AP advertises in its management frames and which is typically a few milliseconds. A station that has reserved 3 milliseconds and is transmitting at a rate where a subframe takes 200 microseconds fits about fifteen subframes, well below the count limit.

The duration limit exists because a single station holding the medium for a long time is exactly the unfairness the contention procedure is meant to prevent. The counter-argument is that a long aggregate amortises contention, so the medium is more efficient overall. The advertised limit is the compromise, and it is one of the few places where a network administrator’s choice directly changes efficiency.

Padding matters at the margin. Subframes must end on a 4-byte boundary, so each is padded with 0 to 3 bytes, and the padding is excluded from the length field. An implementation that computes its aggregate size from payload lengths alone and forgets padding will exceed its reserved duration and truncate the last subframe.

/* Octets an aggregate occupies: a 4-byte delimiter plus the MPDU, padded so
   that every subframe ends on a 4-byte boundary. */
static size_t ampdu_octets(const struct mpdu *m, size_t n)
{
    size_t total = 0;
    for (size_t i = 0; i < n; i++)
        total += (4 + m[i].len + 3) & ~(size_t)3;
    return total;
}

/* How many queued MPDUs fit in the duration the transmitter reserved.
   A subframe that does not fit is deferred, not truncated. */
static size_t fit_in_txop(const struct mpdu *m, size_t n, size_t budget)
{
    size_t total = 0, k = 0;
    while (k < n) {
        size_t sub = (4 + m[k].len + 3) & ~(size_t)3;
        if (total + sub > budget)
            break;
        total += sub;
        k++;
    }
    return k;
}

The check byte covers the 16-bit length word and not the signature, so a receiver performs two independent tests on each delimiter: the check must agree with the length it has just read, and the fourth octet must be 0x4E. If either test fails, the length cannot be trusted, and the receiver steps forward four octets at a time until it finds a delimiter that passes both. That resynchronisation is why the fixed pattern exists: the MPDUs are protected by their own frame check sequences, but nothing inside a damaged subframe reliably says where the next delimiter begins.

Later amendments widened the length so that a single MPDU can exceed 4,095 bytes, taking the bits from the reserved field. The delimiter’s job does not change with the width: it states where the next MPDU starts and lets a receiver reject a boundary it has mis-parsed.

Block acknowledgement as a sliding window

The acknowledgement for an aggregate is a Block Ack, and its structure is a compressed bitmap rather than a list of sequence numbers. The frame carries a starting sequence number and a bitmap of up to 64 bits, one per sequence number, where a set bit means the subframe arrived intact.

The window is the mechanism. A transmitter may have up to 64 outstanding sequence numbers in flight, and the Block Ack’s starting sequence number is the lowest one it has not yet seen acknowledged. The bitmap covers the 64 numbers from there. Any subframe beyond the window must wait for the window to slide, which happens when the Block Ack advances the starting sequence number.

The window size is why a station cannot simply keep transmitting while acknowledgements are pending. If it sends subframe 100 while the receiver still expects the window to start at 40, the receiver’s bitmap cannot express it and the subframe is dropped. The transmitter’s send queue therefore must stall when it has 64 unacknowledged subframes, which in practice means a rate-times-delay product limit: at 300 Mbit/s with a 2 millisecond round trip, 64 subframes of 1500 bytes is 96 kilobytes, and 96 kilobytes at 300 Mbit/s is 2.5 milliseconds. The window is roughly matched to the path, and on a link with a longer round trip it becomes the throughput ceiling.

Two variants of the mechanism exist. The original Block Ack was a single frame sent in response to a Block Ack Request, with the exchange negotiated as a session between two stations. The high-throughput amendment introduced a compressed variant that can be sent immediately in response to an aggregate after a short interframe space, which removes the request round trip. Compressed here means the bitmap is one bit per sequence number rather than encoding fragment counts as well, so 64 sequence numbers fit in 8 bytes.

Reordering, duplicate detection, and the sequence number space

Aggregation makes reordering normal rather than exceptional. If subframes 3 and 5 arrive and 4 does not, the receiver must either deliver 3 and 5 to the upper layer out of order or hold them until 4 is retransmitted. The standard permits both, but a receiver that holds must have a reorder buffer sized to the window, and it must have a timeout after which it gives up and delivers what it has, because the missing subframe may never come.

Duplicates are possible because a Block Ack that is lost causes the transmitter to retransmit subframes the receiver already has. The sequence number and a retry flag in the frame control let the receiver discard them. The sequence number space is 12 bits, 4096 values, so it wraps on a link that has been busy for a while; a window of 64 is far below half that space, which is what keeps a wrapped number from being confused with a live one.

The block ack session itself is stateful. It is set up with an add block ack request and torn down with a delete, and both stations track the starting sequence number and the window. A station that loses the session state — for instance after a roam to a new AP — must renegotiate, and subframes sent in the interim are lost without the transmitter knowing why. The interaction between aggregation state and mobility is one of the reasons roaming is more than an association change, as described in Roaming, fast transition, and BSS selection.

When aggregation hurts

Aggregation is not unconditionally good, and the cases where it loses are worth knowing.

It adds latency. A voice frame queued behind fourteen others in an aggregate waits for all of them to be transmitted and acknowledged. The standard provides a way to end an aggregate early when a higher-priority frame arrives, but the mechanism is a policy decision, and a station that aggregates aggressively will produce jitter that a voice codec notices.

It wastes airtime when the channel is poor. A station that aggregates sixty subframes into a transmission that fails entirely loses the whole duration, then retransmits at a lower rate with a smaller aggregate. The rate controller and the aggregator interact, and a controller that lowers the rate after a failure should also shrink the aggregate, since the same duration now carries less.

It amplifies the effect of a single interferer. A long aggregate is a long reservation, and any station that starts transmitting inside it collides with the tail rather than the head, corrupting the last subframes and producing a partial acknowledgement that costs a full retransmission round.

The mitigation for the last two is the same: bound the aggregate by duration rather than by count, and let the rate and the aggregate size fall together. Both quantities are the ones that Airtime fairness and the slow-client problem computes when it decides whether a station is consuming more than its share, and both depend on the frame durations that OFDM subcarrier spacing, guard intervals, and channel width fixes.

References

  1. IEEE 802.11n: Enhancements for Higher Throughput — IEEE
  2. IEEE 802.11: Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications — IEEE
  3. 802.11 Wireless Networks: The Definitive Guide — Matthew Gast, O'Reilly
  4. Next Generation Wireless LANs: 802.11n and 802.11ac — Perahia and Stacey, Cambridge University Press