Wi-Fi MAC Layer

IEEE 802.11 MAC sub-layer is responsible for coordinating access to the shared physical air interface so that the Access Point (AP) and Wi-Fi stations in range can communicate effectively. MAC takes data from a higher sub-layer called LLC, adds header and tail bytes, and sends them to lower physical layer for transmission. The reverse happens when receiving data from the physical layer. If a frame is received in error, MAC can retransmit it.

Multiple access is based on carrier sensing, channel contention and random backoff. Due to contention, a Wi-Fi network with a large number of active stations can suffer from low throughput and high latency. IEEE 802.11e and its subset Wi-Fi Multimedia attempt to alleviate this problem.

Discussion

  • What's the purpose of MAC layer in 802.11?
    MAC deals with MSDUs and MPDUs. Source: Vergès 2015.
    MAC deals with MSDUs and MPDUs. Source: Vergès 2015.

    MAC stands for "Medium Access Control", which implies that it's main function is to control access to a shared medium. The air interface is a shared medium through which all multiple Wi-Fi stations and access point (AP) attempt to transfer data. MAC implements the control mechanisms that allow multiple devices to reliably communicate by sharing the medium as specified in the standard.

    Formally, MAC functions include scanning, authentication, association, power saving and fragmentation.

    When it comes to the actual handling of data, MAC sits as a sub-layer within Data Link Layer. It takes a packet of data called MAC Service Data Unit (MSDU) from Logical Link Control (LLC) sub-layer. MAC adds necessary header and tail bytes to form MAC Protocol Data Unit (MPDU). MPDU is then sent to the physical layer for transmission. The reverse flow happens when MAC receives a packet from physical layer.

  • How does a Wi-Fi station discover and associate with an AP?

    There are two modes of discovery and the station is at liberty to use either or both:

    • Passive scanning: The station looks for beacon frames that are regularly sent by an AP. These frames contain essential information about the network. If there are multiple APs within range, it selects the strongest one. Station then attempts to connect to the AP. Communication happens on the channel in which the AP is operating.
    • Active scanning: The station sends a probe request either to a specific AP or to any AP within range. Either way, it expects a probe response from one or more APs, selects the strongest and attempts to connect to that AP. Since no prior beacon is decoded, station will send its probe on all channels.
  • What multiple access scheme is used in 802.11?

    MAC uses what's called Point Coordination Function (PCF) or Distributed Coordination Function (DCF). The latter is more prevalent in industry and employs Carrier Sense Multiple Access with Collision Avoidance (CSMA/CA).

    There are two parts to CSMA/CA as suggested by the name:

    • Carrier Sensing: Wi-Fi stations must first sense the air interface. Only if the channel is idle for a specified amount of time (of duration DIFS), they can transmit. DIFS stands for DCF InterFrame Spacing.
    • Collision Avoidance: If channel is sensed busy, the station waits till it's free for DIFS duration, then waits for a random interval before transmitting. This randomness reduces the chances that two waiting stations end up transmitting at the same time. "Collisions" can still occur and they are inferred when no acknowledgement is received by the sender. If ACK is not received, station backs off for a random duration and repeats the process again.
  • What's the structure of 802.11 MAC frames?
    MAC data and ACK frames, along with details of Frame Control Field. Source: Adapted from National Instruments 2017, figs. 6-8.
    MAC data and ACK frames, along with details of Frame Control Field. Source: Adapted from National Instruments 2017, figs. 6-8.

    There are three types of MAC frames: data, control and management. Only data frames contain higher layer data. Control frames include ACK, RTS, CTS, Power Save Poll, etc. Management frames help stations discover and connect to AP.

    All frames start with a 2-byte Frame Control that specifies the frame type and further details. All frames end with a 4-byte Frame Check Sequence (FCS) that's used to detect errors. Frame Control is part of what's called the MAC header, which can vary in length. For data frames, MAC header and FCS are added by MAC layer around the MSDU received from LLC. MSDU is often called MAC payload or frame body. Further details on MAC frame are available online.

  • Are there techniques in MAC to improve the reliability of communication?
    When (B) hears the CTS meant for (A) it defers it's own transmission. Source: Campbell 2018, slide 11.
    When (B) hears the CTS meant for (A) it defers it's own transmission. Source: Campbell 2018, slide 11.

    MAC uses many techniques and here we describe the important ones:

    • Error Detection: Every MAC frame contains 4-byte FCS that's used to detect errors.
    • Retransmission: For a corrupted frame, receiver will not send an acknowledgment frame. Sender will therefore retransmit the frame.
    • Fragmentation & Reassembly: When frames are larger, there's a higher chance of collision. MAC can therefore fragment data/management frames and transmit them as individual MAC frames. Any errors, only fragments need to be retransmitted.
    • RTS/CTS: Request-to-Send and Clear-to-Send are used to solve the hidden-node problem. When stations are widely spread around an AP, some may be hidden from others on the wireless channel. RTS/CTS handshaking alleviates this problem and reduces collision. This is an optional feature.
  • What are the MAC enhancements due to High Throughput (HT)?
    Showing 802.11n frame aggregations A-MSDU and A-MPDU. Source: Hoffmann 2010, slide 19.
    Showing 802.11n frame aggregations A-MSDU and A-MPDU. Source: Hoffmann 2010, slide 19.

    IEEE 802.11n introduced changes to MAC that are part of High Throughput (HT). The idea was to reduce MAC overhead and increase overall throughput. This is done using Frame Aggregation. Two types are possible:

    • Aggregate MAC Service Data Unit (A-MSDU): Multiple MSDUs are packed into a single MPDU that in turn maps to a single transmission frame. In this case, all MSDUs share the same MAC header.
    • Aggregate MAC Protocol Data Unit (A-MPDU): Multiple MPDUs are carried within a single transmission frame. Obviously, each MPDU has its own MAC header.

    These two are not mutually exclusive: a single transmission can have a combination of A-MSDUs and A-MPDUs, sometimes called two level frame aggregation. In fact, research has shown that a combination of the two gives best performance on both 802.11n and 802.11ac devices.

    MAC frame is extended: new header field called HT Control plus larger payload size. Block Acknowledgments (BACK) is introduced.

  • What are the MAC enhancements due to Very High Throughput (VHT)?

    IEEE 802.11ac introduced changes to MAC that are part of Very High Throughput (VHT). VHT also impacts deployments in 60 GHz band such as for 802.11ad.

    Frame aggregation can happen like in 802.11n but in larger sizes: MPDU size of about 8KB (11n) vs 11KB (11ac); PSDU size of about 64 KB (11n) vs 4 MB (11ac). MAC frame is updated: HT Control is defined for 11ac plus larger payload size. All frames are sent as A-MPDUs even if they contain only one MPDU.

  • I've heard of the terms "lower MAC" and "upper MAC". What are these?

    Part of MAC that interacts with LLC sub-layer is sometimes called upper MAC while the part that interacts with PHY layer is called lower MAC. Thus, MSDUs and A-MSDUs are processed in upper MAC while MPDUs and A-MPDUs are processed in lower MAC. In general, lower MAC deals with more time-critical operations such as MPDU transmissions and acknowledgements. For example, association of stations with AP is done by upper MAC but actual medium access (time-critical) is handled by lower MAC.

    It's common for lower MAC to be implemented in hardware such as in FPGA.

Milestones

2005

IEEE 802.11e introduces QoS enhancements to MAC. Hybrid Coordination Function (HCF) is introduced. MAC header includes a 2-byte QoS Control field.

Oct
2009

IEEE 802.11n is released and it includes changes to MAC.

Jan
2014

IEEE 802.11ac is released and it includes changes to MAC.

References

  1. CWNP. 2016a. "802.11 MAC Series – Basics of MAC Architecture – Part 1 of 3." CWNP, January 8. Accessed 2018-03-07.
  2. CWNP. 2016b. "802.11 MAC Series – Basics of MAC Architecture – Part 2 of 3." CWNP, February 3. Accessed 2018-03-07.
  3. CWNP. 2016c. "802.11 MAC Series – Basics of MAC Architecture – Part 3 of 3." CWNP, February 3. Accessed 2018-03-07.
  4. Campbell, Andrew T. 2018. "MAC Layer - WiFi Case Study." CS60, Dept. of Computer Science, Dartmouth College. Accessed 2018-03-08.
  5. Engwer, Darwin. 2008. "Very High Throughput WLAN." Nortel Networks, via SlideShare, April 29. Accessed 2018-03-07.
  6. Gast, Matthew S. 2012. "802.11n: A Survival Guide." Safari Books Online, April. O'Reilly Media, Inc. Accessed 2018-03-07.
  7. Gast, Matthew S. 2013. "802.11ac: A Survival Guide." Safari Books Online, August. O'Reilly Media, Inc. Accessed 2018-03-07.
  8. Geier, Jim. 2002a. "802.11 MAC Layer Defined." Wi-Fi Planet, June 4. Accessed 2018-03-07.
  9. Geier, Jim. 2002b. "Improving WLAN Performance with RTS/CTS." Wi-Fi Planet, August 13. Accessed 2018-03-08.
  10. Geier, Jim. 2002c. "Improving WLAN Performance with Fragmentation." Wi-Fi Planet, September 23. Accessed 2018-03-08.
  11. Hoffmann, Oliver. 2010. "Tutorial on radio communications: From the basics to future developments: Part 3: Advances in wireless LANs." MobiLight, May 12, Barcelona, via SlideShare. Accessed 2018-03-07.
  12. Karmakar, Raja, Samiran Chattopadhyay, and Sandip Chakraborty. 2017. "Impact of IEEE 802.11n/ac PHY/MAC High Throughput Enhancements over Transport/Application Layer Protocols – A Survey." IEEE Communication Surveys and Tutorials, via arXiv, February 10. Accessed 2018-03-07.
  13. Lee, Byeong Gi and Sunghyun Choi. 2008. "Broadband Wireless Access and Local Networks: Mobile WiMax and WiFi." Artech House, London.
  14. National Instruments. 2017. "Overview of MAC Layer Features in the LabVIEW Communications 802.11 Application Framework." August 28. Accessed 2018-03-07.
  15. Ong, Eng Hwee, J. Kneckt, O. Alanen, Z. Chang, T. Huovinen and T. Nihtilä. 2011. "IEEE 802.11ac: Enhancements for very high throughput WLANs." IEEE 22nd International Symposium on Personal, Indoor and Mobile Radio Communications, Toronto, ON, pp. 849-853. Accessed 2018-03-07.
  16. Poole, Ian. 2018. "802.11e for QoS." Radio Electronics. Accessed 2018-03-07.
  17. RF Wireless World. 2018. "WLAN MAC Protocol Inside." RF Wireless World. Accessed 2018-03-07.
  18. Vergès, François. 2015. "Wireshark: How to check if a data frame is sent using 802.11n." Semfio Networks, April 14. Accessed 2018-03-07.
  19. WARP. 2014. "Upper-level MAC Description." Wireless Open-Access Research Platform, October 2. Accessed 2018-03-07.
  20. von Nagy, Andrew. 2015. "Understanding 802.11 Medium Contention." Aruba Networks, Technology Blog, March 25. Accessed 2018-03-07.

Further Reading

  1. Geier, Jim. 2002. "802.11 MAC Layer Defined." Wi-Fi Planet, June 4. Accessed 2018-03-07.
  2. von Nagy, Andrew. 2015. "Understanding 802.11 Medium Contention." Aruba Networks, Technology Blog, March 25. Accessed 2018-03-07.
  3. Poole, Ian. 2018. "802.11e for QoS." Radio Electronics. Accessed 2018-03-07.
  4. Karmakar, Raja, Samiran Chattopadhyay, and Sandip Chakraborty. 2017. "Impact of IEEE 802.11n/ac PHY/MAC High Throughput Enhancements over Transport/Application Layer Protocols – A Survey." IEEE Communication Surveys and Tutorials, via arXiv, February 10. Accessed 2018-03-07.

Article Stats

Author-wise Stats for Article Edits

Author
No. of Edits
No. of Chats
DevCoins
3
0
3033
3
1
32
1287
Words
13
Likes
32K
Hits

Cite As

Devopedia. 2021. "Wi-Fi MAC Layer." Version 6, June 5. Accessed 2023-11-12. https://devopedia.org/wi-fi-mac-layer
Contributed by
2 authors


Last updated on
2021-06-05 09:03:24