KioskeaKioskeaCommentCaMarcheSign up, it's free !
Friday July 4, 2008 - 10:54:43 am BST

WiFi - Data link layer and access methods


Data link layer

The data link layer of the 802.11 standard is composed of two sublayers: the Logical Link Control layer (or LLC for short), and the Media Access Control layer (or MAC).

The MAC layer defines two different access methods:

  • The CSMA/CA method, which uses the Distributed Coordination Function (DCF)
  • The Point Coordination Function (PCF)

The CSMA/CA access method

In an ordinary local Ethernet network, machines use the access method CSMA/CD (Carrier Sense Multiple Access with Collision Detection), in which every machine is free to communicate at any given time. Each machine, when sending out a message, checks to make sure that no other machine is sending out a message at the same time. If one of them is, then both machines must wait for a random period of time before starting to send the message again.

In a wireless environment, this process is impossible, as two stations communicating with a receiver cannot hear one another at the same time, due to differences in their transmission ranges For this reason, the 802.11 standard uses a similar protocol called CSMA/CA (Carrier Sense Multiple Access with Collision Avoidance).

The CSMA/CA protocol uses a collision-avoidance mechanism based on reciprocal confirmation-of-receipt messages traded by the transmitter and receiver:

RTS / CTS / Data / ACK
The station that wants to transmit listens to the network. If the network is busy, the transmission is held off until later. On the other hand, if the medium remains free for a certain period of time (called DIFS for Distributed Interframe Space), then the station can transmit the signal. The station transmits a "Ready To Send " message (called "RTS" for short) containing information on the amount of data that it wishes to send, and its transmission speed. The receiver (generally an access point) responds with a "Clear To Send" message (CTS), and then the station starts sending data.

When all the data sent by the station has been received, the receiver sends an acknowledgement notice (ACK). All nearby stations then wait for as long as deemed necessary to trasmit that amount of information at the declared speed.

Checksum

The MAC layer of the 802.11 protocol has a error detection mechanism that lets it verify the integrity of the data sent. This marks a fundamental difference from the Ethernet standard. Ethernet has no error-detecting or error-correcting system, as this duty is left to higher-level transport protocols. (TCP).

In a wireless network, the error rate is higher, and this is why error detection has been included in the data link level. The error detection mechanism is based on the following 32-bit polynomial:

x32+x26+x23+x22+x16+x12+x10+x8+x7+x5+x4+x2+x+1

Fragmentation and reassembly

On the other hand, the transmission error rate on wireless network generally increases with large-size packets, and for this reason the 802.11 standard has a fragmentation mechanism, which lets a frame be broken down into many pieces, called "fragments".

Frame format

The 802.11 standard defines the format for data frames sent using the protocol. Each data frame is composed of a 30-byte-long header (called the MAC header), a body, and an FCS (Frame Sequence Check) which allows errors to be corrected.

FC
(2)
D/ID
(2)
Address 1
(4 bytes)
Address 2
(4 bytes)
Address 3
(4 bytes)
SC
(2)
Address 4
(4 bytes)
Frame body
(0 to 2312 bytes)
FCS
(2)

A description of these fields:

  • FC (Frame Control): This two-byte field is made up of the following information:

    Protocol version
    28 bits
    Type
    28 bits
    Subtype
    4 bits
    To DS
    (1 bit)
    From DS
    (1 bit)
    More Frag
    (1 bit)
    Retry
    (1 bit)
    Power Mgt.
    (1 bit)
    More Data
    (1 bit)
    WEP
    (1 bit)
    Order
    (1 bit)

    • Protocol version: This two-bit field keeps track of changes between different versions of the 802.11 standard For the first version, the value is set to 0.
    • Type and Subtype: These fields (two and four bits, respectively) define the type and subtype of the frames as explained in the table below. The type management corresponds to association requests as well as announcements sent from the access point. The type control is used for accessing the medium in order to request send authorisations. Finally, the type data relates to sending data (which is most traffic on the network).
    • To DS: This bit is set to 1 when the frame is being sent to a distribution system (DS), otherwise it is set to 0. Any frame being sent by a station to an access point has its To DS field set to 1.
    • From DS: This bit is set to 1 when the frame is coming from a distribution system (DS), otherwise it is set to 0. Therefore, when the To and From fields are set to 0, the communication is traveling directly between two stations (ad hoc mode).
    • More Fragments: Indicates, when set to 1, that there are still fragments left to be transmitted.
    • Retry: This bit specifies that the current fragment is a retransmission of a previously sent (and presumably lost) fragment.
    • Power Management: Indicates, when set to 1, that the station which sent this fragment is entering power management mode.
    • More Data): This bit, used in power management mode, is used by the access point to specifty to a station that additional frames are being stored in a wait state.
    • WEP: This bit indicates that the WEP encryption algorithm has been used to encrypt the body of the frame.
    • Order: Indicates that the frame has been sent using Strictly-Ordered Service Class.
  • Duration / ID: This field for how long the transmission canal is going to be used.
  • Address fields: A frame can contain up to 3 addresses in addition to the 48-bit address.
  • Sequence control: This field lets the reassembly mechanism distinguish between the various fragments of a single frame. It is composed of two sub-fields which allow fragments to be reordered:
    • The fragment number
    • The sequence number
  • CRC (cyclic redundancy check): a checksum used for checking data integrity.

The table below gives the frame types and subtypes contained in the frame control field of the MAC header:

Type Description of type Subtype Description of subtype
00 Management 0000 Association request
00 Management 0001 Association response
00 Management 0010 Reassociation request
00 Management 0011 Reassociation response
00 Management 0100 Probe request
00 Management 0101 Probe response
00 Management 0110-0111 Reserved
00 Management 1000 Beacon
00 Management 1001 Annoucement traffic indication message (ATIM)
00 Management 1010 Disassociation
00 Management 1011 Authentication
00 Management 1100 Deauthentication
00 Management 1101-1111 Reserved
01 Control 0000-1001 Reserved
01 Control 1010 Power Save (PS)-Poll
01 Control 1011 Request To Send (RTS)
01 Control 1100 Clear To Send (CTS)
01 Control 1101 ACK
01 Control 1110 Contention Free (CF)-end
01 Control 1111 CF-end + CF-ACK
10 Data 0000 Data
10 Data 0001 Data + CF-ACK
10 Data 0010 Data + CF-Poll
10 Data 0011 Data + CF-ACK+CF-Poll
10 Data 0100 Null function
10 Data 0101 CF-ACK
10 Data 0110 CF-Poll
10 Data 0111 CF-ACK + CF-Poll
10 Data 1000-1111 Reserved
11 Data 0000-1111 Reserved

Point Coordination Function (PCF)

The Point Coordination Function (PCF) is called a controlled access mode. It is based on checking the role of the stations one by one (a process called polling), which is controlled by the access point. A station can only send data if it is authorised to do so, and can only receive data if it is selected. This method is designed for real-time applications like voice and video, where data transmission delays must be managed.
This document entitled « WiFi - Data link layer and access methods » from Kioskea (en.kioskea.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the licence, as this note appears clearly.