WiFi

 

 

 

TIM(Traffic Indication Map)

 

The Traffic Indication Map (TIM) is a component of the beacon frame broadcast by Wi-Fi access points (APs) that plays a crucial role in power management for devices connected to the Wi-Fi network.

In daily use, the TIM mechanism operates transparently to users, allowing devices like smartphones and laptops to conserve power by remaining in sleep mode as much as possible, only waking when necessary to maintain network connectivity and communication.

How does the TIM work?

Let's start with the problem that the TIM solves. A station in power save mode turns its receiver off, so the AP cannot deliver a frame to it at any time it likes. The AP therefore buffers the frame and announces it in a beacon. The list below follows the mechanism step by step, from the beacon to the delivery.

  • Inclusion in Beacon Frames:
    • The TIM is included in the beacon frames sent by an AP at regular intervals (the beacon interval).
    • These intervals are typically set to 100ms but can vary depending on the network setup.
  • Structure:
    • The TIM contains a bitmap representing each associated client device by its Association ID (AID).
    • Each bit in the TIM corresponds to a different AID. If a bit is set to '1', it indicates that the AP has buffered data waiting for the device with that AID.
  • Power-Saving Devices:
    • Devices that are power-saving mode (PSM) will wake up at each beacon interval to listen for the beacon frame.
    • The device checks the TIM element within the beacon to determine if the AP has any data buffered for it.
    • If the TIM indicates that data is buffered, the device will send a PS-Poll frame to the AP to retrieve the data.
  • DTIM and Multicast/Broadcast Traffic:
    • The Delivery Traffic Indication Map (DTIM) is another element related to the TIM.
    • The DTIM period, a count of beacon intervals, indicates how often the AP will include buffered multicast or broadcast traffic in the TIM.
    • Devices in power-saving mode will wake up for every DTIM beacon to check for multicast or broadcast traffic.
  • Efficient Network Usage:
    • By indicating which devices have data waiting for them, the TIM allows devices to remain in a low-power state until they need to be active.
    • This conserves battery life on mobile devices by reducing the need for them to constantly check in with the AP.
  • Retrieving Buffered Data:
    • When a device finds its AID in the TIM, it sends a frame indicating it's ready to receive data.
    • The AP then sends the buffered data to the device.

 

NOTE : How an AP can figure out if a client support TIM or not ?

Here is the sequence of events for a client using power-saving mode:

  • Association: The client device associates with the AP and agrees on various capabilities, including power-saving modes.
  • Communication of Power-Saving Intention: When the client device wants to enter power-saving mode, it sends a frame to the AP indicating this intention. This is usually done through a data frame known as a Null function frame with the power management bit set.
  • Listening to Beacons: The client then listens to beacon frames at its specified listen interval to check the TIM.
  • Checking the TIM: If the TIM indicates that the AP has buffered frames for the client (by setting the bit corresponding to the client's AID), the client will send a PS-Poll frame to the AP to request the delivery of the buffered data.
  • Receiving Data: The AP sends the buffered data to the client, which may involve multiple exchanges of PS-Poll frames and data frames if there are multiple packets buffered.
  • Returning to Sleep: Once the data exchange is complete, the client may return to a low-power sleep state until the next beacon interval when it will wake up to check the TIM again.

The answer to the question in the note is the Power Management bit. The AP does not look for a TIM capability. It only needs to know which stations are asleep, and each station tells it with the Power Management bit in the Frame Control field of the frames it sends. When the bit is 1, the AP buffers the frames for that station. When the bit is 0, the AP delivers them at once. The Null function frame carries no data, so its only job here is to carry this bit.

PS-Poll is the oldest way to fetch the buffered frames, and many devices now use other ways. With U-APSD, which WMM Power Save uses, a station sends a QoS Data or QoS Null frame as a trigger. The AP then sends the buffered frames for that access category without one PS-Poll per frame. 802.11ax adds Target Wake Time, where the station and the AP agree on the wake times in advance. The TIM is still in every beacon, because stations that use the legacy method depend on it.

  • The AP buffers, the beacon announces : a sleeping station learns about its frames only from the TIM, so it must wake up for beacons.
  • The Power Management bit decides buffering : the station sets it in any frame it sends, often in a Null function frame.
  • PS-Poll is one of several delivery methods : U-APSD and Target Wake Time reduce the number of frames a station needs to fetch its data.

How is the TIM element built?

The TIM element is in every beacon, so its size matters. A plain bitmap with one bit for every possible AID would add many octets to each beacon, even when almost every bit is 0. So the element carries only the part of the bitmap that contains the 1 bits. The table below shows its fields.

 

Field

Octets

Content

Element ID

1

5, which identifies the TIM element

Length

1

3 + the length of the Partial Virtual Bitmap

DTIM Count

1

How many beacons, including this one, come before the next DTIM. 0 means this beacon is a DTIM.

DTIM Period

1

The number of beacon intervals between two DTIMs

Bitmap Control

1

Bit 0 is the traffic indicator for AID 0, which means buffered group addressed frames. Bits 1 to 7 are the Bitmap Offset.

Partial Virtual Bitmap

1 or more

The part of the full bitmap that holds the 1 bits

 

The Bitmap Offset tells the station where the partial bitmap starts in the full bitmap. Let's call that starting octet N1. N1 is always an even number, and the 7-bit Bitmap Offset holds N1/2. So when you read the whole Bitmap Control octet and clear bit 0, you get N1 directly. After that, bit j of octet i of the Partial Virtual Bitmap stands for AID = 8 x N1 + 8 x i + j.

Let's work through an example. The AP has buffered frames for AID 100 and AID 105. AID 100 is bit 4 of octet 12 of the full bitmap, and AID 105 is bit 1 of octet 13. Octets 0 to 11 are all zero, so the AP sets N1 = 12 and sends only octets 12 and 13. The Bitmap Control octet is 0x0C, the Partial Virtual Bitmap is 0x10 0x02 and the Length is 3 + 2 = 5. A station with AID 105 computes 8 x 12 + 8 x 1 + 1 = 105 and finds its bit set. Without the offset, the AP would need 14 octets of bitmap to reach AID 105.

Bit 0 of Bitmap Control works differently from the rest. The AP sets it only in a DTIM beacon, and only when it has buffered group addressed frames. It tells every sleeping station to stay awake after this beacon, because the AP sends the broadcast and multicast frames right after it.

  • DTIM is a value, not a separate element : a DTIM beacon is a beacon whose TIM element has DTIM Count = 0.
  • Only the non-zero part of the bitmap is sent : the Bitmap Offset skips the leading zero octets, and the Length ends the bitmap after the last non-zero octet.
  • A station finds its bit with one formula : AID = 8 x N1 + 8 x i + j, where N1 is the Bitmap Control octet with bit 0 cleared.

How often does a sleeping station wake up?

The bullets above say that a station wakes up for beacons, but they do not say for which beacons. Three numbers decide it, and all of them count in beacon intervals. So let's first get the beacon interval itself right.

The beacon interval is counted in Time Units, and one TU is 1024 microseconds. The usual value of 100 is therefore 100 TU, which is 102.4 ms rather than exactly 100 ms. The DTIM Period counts beacons. With a DTIM Period of 3, every third beacon is a DTIM, so the AP sends buffered group addressed frames every 3 x 102.4 = 307.2 ms.

The Listen Interval is the third number. The station sends it to the AP in the Association Request, in units of beacon intervals. It tells the AP how many beacons the station may sleep through, so the AP knows how long it must keep the buffered frames. For example, a Listen Interval of 10 means that the station checks the TIM at least every 10 x 102.4 = 1024 ms. But a station that wants broadcast traffic such as ARP must still wake up for every DTIM beacon.

So the network designer faces a trade-off. A longer DTIM Period lets the stations sleep longer and saves battery. But group addressed frames then wait longer, up to one full DTIM period, which is 307.2 ms in the example above. A DTIM Period of 1 gives the lowest broadcast delay and the highest power consumption.

  • 100 TU is 102.4 ms : every wake-up time in Wi-Fi power save is a multiple of 1024 microseconds.
  • DTIM Period sets the delay of broadcast traffic : group addressed frames go out only after a DTIM beacon.
  • Listen Interval sets how long the AP buffers : the station promises it in the Association Request, and it may still wake up more often.

YouTube