WiFi Mac Layer Introduction

Source: Internet
Author: User

1. Access mechanism Csma/ca:carrier sense multiple access with collision avoidance
WiFi uses a collision-avoidance carrier-monitoring multi-access mechanism to control access to the transport media

Unlike Ethernet, WiFi does not have a clear collision detection mechanism
The WiFi MAC layer specifies the following rules to detect collision collisions

-Before using media, speaker must indicate how long it will take to notify other potential speakers of the time required to use the media
-Until the time indicated by the previous speaker, the other speaker can use the media
-When a positive acknowledgment is received, Speaker believes the data was transferred successfully
-If Double participants happen to start speaking at the same time, they is unaware they is speaking over each other.
The speakers determine they is speaking over each of the other because they does not receive confirmation that their voices were H Eard.
-When the sent data does not receive a positive acknowledgment, speaker waits for a random time and then again uses the media to send the data without success

WiFi mac layer thinks a collision is detected when no positive acknowledgement is received

2. Mac sub-layer function

The Mac sub-layer includes DCF and PCF

dcf:distributed Coordination Functionpcf:point Coordination Function
1. Carrier monitoring (Carrier sense)

STA has two methods to determine whether the current media is idle

-Check PHY layer for carrier presence
-Using the virtual Carrier-sense function, NAV (Network Allocation Vector)

Nav is a timer provided by the MAC layer that preserves the duration of the media used by other STA
The STA updates its NAV when the other STA sends data with duration greater than the saved time
STA can send data when NAV is 0 and the PHY layer indicates that the current media is available

2. DCF

DCF is a CSMA/CA-based access method that avoids conflicts as much as possible and can automatically and efficiently share media

DCF provides both basic and rts/cts modes of media access
Using binary exponential fallback mechanism of competition window to coordinate multiple STA access to shared link to avoid the inability to communicate due to scramble for media
The core idea is to use the binary exponential fallback mechanism to reduce the collision of data packet and to realize the finite retransmission control of the packet after the collision.

When the STA sends a data frame, it detects the state of the media first
If the media is idle and lasts a difs time (DCF interframe Space)
-Send data frames immediately in basic mode
-In rts/cts mode, send RTS frames
and simultaneously detects that there are no group collisions occurring

If a collision occurs, the STA randomly selects a value between [0,wi] random ()
? WI is called the competition window, and its size depends on the number of data packet retransmissions

Cwmin≤cw≤cwmax
and calculates the Backoff timer (=random () * Slot time)

Then, when the STA detects that the media idle time equals a slot, the counter is reduced by 1
The counter value remains the same when media busy is detected
And when the media idle time equals difs, the delay counter is reactivated and the STA continues to monitor the media
The Mac frame is not sent until the counter value is reduced to 0 o'clock STA

In addition, in order to avoid an STA long time consuming channel, the STA must be randomly delayed between two successive data frame sends.

3. Answer Frame

Some frames need to receive an STA response to an answer frame, called an ACK frame
Transmission of ACK frames does not need to wait for Backoff timer
Instead, wait for sifs (short interframe Space) time
SIFs usually 2 slots shorter than difs time

4. Hidden node issues and rts/cts

Rts:request to send
Cts:clear to send

Because of the signal (too far away), some of the STA can not communicate directly, can not perceive each other's existence,
If at the same time to the STA in between the send frame, resulting in the middle STA like Blake awkward
Because only the middle STA knew there was a conflict.
At this point, you need to use rts/cts to solve the problem

STA sends RTS frames, reserved media use rights and requests to receive STA to remain silent
The receiving STA is answered in CTS, and the CTS frame requires that the STA in the vicinity remain silent until the process is over
Then start the transfer process of the frame

Rts/cts are often used in high-volume environments and where transmission competition is more pronounced

5. Frame Fragmentation

The role of frame fragmentation is to improve the reliability of transmission in wireless media
Divides a full frame into smaller frames to be transmitted separately, each fragment frame needs an ACK
This way, when an error occurs on a shard frame, only the frame can be retransmitted
However, this can also increase the MAC layer overload problem (Overhead)

Attention:
-Frame shards only occur in unicast frames
-Each shard frame has the same frame sequence number and an incremented frame number

6. PCF

PCF as a supplement to DCF, is an optional media access mechanism
Provides services that do not require competition to consume media in order to meet real-time business needs
Used in infrastructure mode network architecture, coordinated by APS

PCF transmits frames in the form of cycles
Each cycle includes a non-competitive phase and a competitive phase
-Non-competitive stage (Cfp:contention-free Period)
-Competition phase (Cp:contention Period)
CFP phase transfer real-time service, PCF works
CP Phase transfer non-real-time service, DCF function

~ ~ ~ seems to use less, follow-up supplement

3. Mac frame Format

Mac frame Format

4. MAC layer Operation set

MAC layer Operation set: scanning, authentication, correlation, and power-saving status

WiFi Mac Layer Introduction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.