You are on page 1of 37

17F NET3900

Wireless Networks – Module 2.v5


MAC Layer
Marvin Krym
krymm@algonquincollege.com
bitDegree.ca

Channel Access

NET3900 © 2016 Algonquin College. 2


bitDegree.ca
Distributed Coordination Function – CSMA/CD

Ethernet CSMA/CD Wi-Fi CSMA/CA

• Both CSMA/CD and CSMA/CA are half-duplex architectures


• Ethernet uses CSMA/CD – Collision Detection
– Ethernet stations transmit with the Tx wires
– Since the station also listens with the Rx wires, collisions are detected immediately

• 802.11 uses CSMA/CA – Collision Avoidance


– Radios only transmit or receive at any time
– 802.11 devices only detect a collision when the transmitter has not
received an Acknowledgement.
3
NET3900 © 2016 Algonquin College.
bitDegree.ca
MAC Protocol Requirements

Office 1 Office 2

1. Provide users orderly access to the limited bandwidth transmission medium


(i.e. RF Channel) such that throughput is maximized. Stations cannot
communicate with each other while attempting to seize the channel.

2. Permit adjacent, uncoordinated deployment of Wi-Fi systems such as


between office 1 and 2 in the diagram. (Wi-Fi spectrum is unlicensed but
regulated)

3. Allow high priority traffic to be transmitted before low priority stations.


NET3900 © 2016 Algonquin College. 4
bitDegree.ca
Protocol Requirements and Solutions

1. Provide users orderly access.


• Solution 1: Contention Protocol – Distributed Coordination Function
• Solution 2: Polling Reservation (Not Implemented)

2. Permit adjacent, uncoordinated deployment of Wi-Fi systems.


• Solution: Etiquette Rules for Unlicensed Spectrum - Wi-Fi employs
listen before talk rule.

3. Allow high priority station traffic to be transmitted before low priority stations
traffic
• Solution: Arbitration Wait Times. Stations with lower priority frames wait
a longer interval before they can make a transmission attempt.

NET3900 © 2016 Algonquin College. 5


bitDegree.ca
Carrier Sense

• Physical Carrier Sense


– A station listens for RF energy in the air on the used channel
– If an energy level threshold is crossed, the channel is deemed busy
– Information is passed to the MAC layer

• Virtual Carrier Sense


– The Station waits for the NAV Timer to Expire
– Network Allocation Vector (NAV) – This is a timer mechanism. It is set
based on a prediction of how much time the transmitting station needs to
transmit it’s current frame.

NET3900 © 2016 Algonquin College. 6


bitDegree.ca
Virtual Carrier Sense - details

Ref: 802.11 Arbitration;


CWNP White Paper

• Virtual Carrier Sense Operates as follows:


1. A transmitting station calculates a DURATION value and sends this in the frame.
The DURATION value is the time needed to transmit additional frames and IFS

2. All receiving stations hear this frame and calculate the expected Busy Time:
Busy Time = time to receive current frame + DURATION value

3. All receiving stations use the Busy Time to set a NAV timer. The stations will not
attempt to transmit until the NAV timer expires.

NET3900 © 2016 Algonquin College. 7


bitDegree.ca
Distributed Coordination Function
1. Listen for a Clear Channel
- Physical Carrier Sense – Clear Channel Assessment
- Virtual Carrier Sense - NAV Timer
- Both have to be clear

2. Wait For My Turn


- Wait for Interframe Spacing
- Select and Wait for Contention Window Slot

3. Transmit/Talk
- Retry on Collision

NET3900 © 2016 Algonquin College. 8


bitDegree.ca
Interframe Spacing Definitions
Ensures stations with higher priority frames transmit first.

• DIFS – DCF Interface Space


– Minimum amount of medium idle time until contention-based services begin.
• SIFS – Short Interframe Space
– Used to separate frames transmitted in the opposite direction ie ACKs, RTS, CTS
• RIFS – Reduced Interframe Spacing
– Used to separate multiple frames transmitted in the same direction
• AIFS – Arbitration Interframe Space
– Used to provide over the air priority or QoS. Lower priority frames use a longer
AIFS
NET3900 © 2016 Algonquin College. 9
bitDegree.ca
Contention Window Example
Small Contention Window
Large Contention Window
C
C
A
B A
B

Tx A
Tx B Tx A

Tx C Tx B
collision
Tx C
small contention window large contention window

A collision may occur when two stations select the same transmit slot within
a contention window. The likelihood increases with larger numbers of
wireless stations.

Selecting a larger contention window reduces the likelihood of collision.


NET3900 © 2016 Algonquin College. 10
bitDegree.ca
DCF Example 1

1. Listen 2. Wait 3. Talk

DIFS Contention Window Slot STA1


Busy RF
Channel Frame Transmission
Contention
DIFS Window Slot STA2
Time

Station 2 seizes the channel first because it has the


shortest Contention Window random wait.

NET3900 © 2016 Algonquin College. 11


bitDegree.ca
DCF Example 2

1. Listen 2. Wait 3. Talk

DIFS STA1
Busy RF
Channel ACK Transmission
SIFS STA2
Time

DIFS – DCF Interframe Spacing – Used to for Data Frame Transmission


SIFS – Short Interframe Spacing – Used for Highest Priority Control Frames

Station 2 seizes the channel first because it has the


shortest Interframe Spacing

NET3900 © 2016 Algonquin College. 12


bitDegree.ca
Contention Window

- Contention Window Size in units of “slots”


- Slot size = 9 microseconds for
802.11 a/g/n

• The station selects a random time slot from the Contention


Window Interval. The station waits this amount of time before
attempting to transmit. It helps ensure that stations transmit at
different times.

• If the frame fails, then a retransmission attempt is made at the


next opportunity but using the next size contention window
NET3900 © 2016 Algonquin College. 13
bitDegree.ca

Frames and Messaging

NET3900 © 2016 Algonquin College. 14


bitDegree.ca
General MAC Frame

The MAC frame format comprises a set of fields that occur in a fixed order in
all frames.

The first three fields (Frame Control, Duration/ID, and Address 1) and the
last field (FCS) constitute the minimal frame format and are present in all
frames, including reserved types and subtypes.

The fields Address 2, Address 3, Sequence Control, Address 4, QoS Control,


HT Control, and Frame Body are present only in certain frame types and
subtypes.

NET3900 © 2016 Algonquin College. 15


bitDegree.ca
Frame Control Field

• version 0

• Management
• Control
• Data
• Association (M)
• Reassociation (M)
• Probe (M)
• Authentication (M)
• RTS/CTS (C)
• ACK (C)
• Data (D)

The Type and Subtype fields together identify the function of the frame.
There are three frame types: control (C,) data (D), and management (M).
Each of the frame types has several defined subtypes.

NET3900 © 2016 Algonquin College. 16


bitDegree.ca
Frame Control Field: ToDS, FromDS

To DS: indicates a frame is destined for the DS (Distribution System)


From DS: indicates a frame is sourced from the DS (Distribution System)

Function ToDS Field FromDS Field

STA – STA in IBSS OR 0 0


Management and Control
Tx Towards Distribution 1 0
System
Rx From Distribution System 0 1

Wireless Bridge 1 1

NET3900 © 2016 Algonquin College. 17


bitDegree.ca
Address Fields

There are four address fields in the MAC frame format.


The definition of each address fields of 4 MAC address fields will
change based on the ToDS and FromDS Fields.

These fields are used to indicate these addresses


• basic service set identifier (BSSID),
• source address (SA),
• destination address (DA),
• transmitting STA address (TA),
• receiving STA address (RA)

For more information: https://mrncciew.com/2014/09/28/cwap-mac-headeraddresses/

NET3900 © 2016 Algonquin College. 18


bitDegree.ca

Connection Process

NET3900 © 2016 Algonquin College. 19


bitDegree.ca
Beacon Frame Information
Beacons are essentially the heartbeat of the wireless network. The AP of a basic service set
sends the beacons while the clients listen for the beacon frames.

The beacon frame contains all the necessary information for a client station to learn about the
parameters of the basic service set before joining the BSS. Beacons are transmitted about 10
times per second.

Each beacon contains a time stamp, which client stations use to keep their clocks synchronized
with the AP.

NET3900 © 2016 Algonquin College. 20


bitDegree.ca
Scanning Process
Passive Scanning
• AP Broadcasts Beacon at regular intervals
(default = 100 ms)
• Beacon contains sufficient information to permit station
connectivity
• When Station needs to find an AP it begins the passive
scanning process
• Scanning Process Includes:
o Go to Next Channel
o Wait For Beacon
o Check Connection Parameters
o Measure RSSI
o Add to Scan Table

Active Scanning
• Stations Send Probe Request Frame Per Channel
o Broadcast
o SSID Specific
o SSID Generic
• AP Replies with Probe Response
o Same info as Beacon
• Scanning Process Same as Passive
• Active Scanning is Preferred Approach
o Faster than Passive Scanning

NET3900 © 2016 Algonquin College. 21


bitDegree.ca

Station Connectivity – Multiple APs

Most likely Vivian will


communicate with AP 2,
which matches her SSID
and has the stronger
signal strength.

• How a station chooses an AP is not specified in 802.11.


• It is left up to the vendor.
• It could be, Matching SSIDs, Signal Strength, Supported data rates.

Rick Graziani

NET3900 © 2016 Algonquin College. 22


bitDegree.ca
Station Connection Process

• Only after a station has both authenticated and associated with the access point can
it use the Distribution System (DS) services and communicate with devices beyond
the access point.
• Association includes the negotiation of:
- Capabilities (protocol features and functions),
- Data Rate Usage
- QoS
• The current state determines the permitted frames: Class 1, Class 2 or Class 3 23
NET3900 © 2016 Algonquin College.
bitDegree.ca
Authentication Process

• Authentication provides a here I am role. It used to provide a stronger security role now
replaced by the User Authentication Process.
• 802.11 specifies two types of authentication:
– Open-system
– Shared-key (makes use of WEP)
• Open System Authentication is typically used with strong User Authentication

NET3900 © 2016 Algonquin College.


24
bitDegree.ca

Association Process
1. Association Request
2. Association Response

• The Association provides a logical connection between the station and AP


• It includes the negotiation of:
- Capabilities (protocol features and functions),
- Data Rate Usage
- QoS
- etc…
• A wireless station can only associate with one AP (802.11 restriction)
• During the 802.11 association process the AP maps a logical port known as the
Association Identifier (AID) to the wireless station.

Rick Graziani

25
NET3900 © 2016 Algonquin College.
bitDegree.ca
Hidden Node Problem

STA1 and STA2 cannot


STA1
X hear each other

WALL
X
STA2
AP

Example 1 Example 2

• Two wireless stations, that cannot hear each other transmit at the same time
to the same Access Point.
• The AP can hear both wireless stations
• The result is a collision and failed reception.
• Possible Causes:
- Example 1: Two stations are too far apart to hear each other
Rick Graziani
- Example 2: A barrier blocks the signal between wireless stations 50 26

NET3900 © 2016 Algonquin College.


bitDegree.ca
Hidden Node Problem

STA1 and STA2 cannot


STA1
X hear each other

WALL
X
STA2
AP

Example 1 Example 2

Solutions:
– Add an AP
– Remove the obstacle
– Use RTS/CTS (Request to Send / Clear to Send)
- RTS/CTS is a last resort solution
Best Practice Solution:
Good AP Placement Design which prevents Hidden Node Problems
NET3900 © 2016 Algonquin College. 27
bitDegree.ca
RTS / CTS Solution

STA1 and STA2 cannot


STA1
X hear each other

RTS CTS
WALL
X
CTS
STA2
AP

Exmple 1 Exmple 2

• Station 1 needs to transmit and sends an RTS message to the AP

• The AP replies with an CTS which contains a NAV timer value

• The NAV timer prevents the other stations (i.e. Station 2) from transmitting

• Station 1 transmits its message without concern for collisions

NET3900 © 2016 Algonquin College. 28


bitDegree.ca

Throughput Analysis

NET3900 © 2016 Algonquin College. 29


bitDegree.ca

Channel Capacity Estimation

Contention PHY Data Ack


DIFS Header SIFS
Window - CW Frame Time
Total Frame Duration

No. of Data Bits in Frame


Data Throughput =
Total Frame Duration

Total Frame Duration = DIFS + CW + PHY Header + DataFrame + SIFS + ACK


REF: https://mentor.ieee.org/802.11/dcn/07/11-07-2704-00-0vht-efficiency-of-voip-on-802-11n.ppt

Duration Term Calculation


DIFS (usec) 34 us (see AIFS for other values)
Average CW (usec) (15 x slots)/n; slot=9 us, n= 2 but will vary depending on number of STA
PHY Header (usec) 11n->28 us; 11a->20 us typical
Data Frame Duration approximate formula: DataFrameSize(bits) / PHYrate (Mbps)
(usec)
SIFS (usec) 16 us
ACK (usec) 11n->32 us; 11a->24 typical

NET3900 © 2016 Algonquin College. 30


bitDegree.ca
Example Using UDP Frames
(802.11a, 64-QAM, R=3/4, GI=800ns, 1 Spatial Stream, PHY rate = 54 Mbps)

• Estimate the channel capacity for a Data Frame Size of 1500 Bytes:

1. Calculate the Data Frame Duration


Data Frame Duration = DataFrameSize(bits) / PHYrate (Mbps)
= 1500B x 8 / 54 Mbps
= 222 us

2. Calculate the Total Frame Duration


Frame Duration = DIFS + CW + PHY + DataFrameDuration +
SIFS + ACK
= 34us + (15 x 9 / 2)us + 20us + 222 us + 16us +
24us
= 383.5 us
3. Calculate the Data Throughput
Estimated Throughput = Bits per Data Frame / Frame Duration
= 1500B x 8 / 383.5 us
= 31 Mbps @ 1500 Bytes Data Frame
NET3900 © 2016 Algonquin College. 31
bitDegree.ca
Capacity Example Using UDP Frames
(802.11a, 64-QAM, R=3/4, GI=800ns, 1 Spatial Stream, PHY rate = 54 Mbps)

• Estimate the channel capacity for a Data Frame Size of 250 Bytes:

1. Calculate the Data Frame Duration


Data Frame Duration = DataFrameSize(bits) / PHYrate (Mbps)
= 250B x 8 / 54 Mbps
= 37 us

2. Calculate the Total Frame Duration


Frame Duration = DIFS + CW + PHY + DataFrameDuration +
SIFS + ACK
= 34us + (15 x 9 / 2)us + 20us + 37 us + 16us +
24us
= 198.5 us
3. Calculate the Data Throughput
Estimated Throughput = Bits per Data Frame / Frame Duration
= 250B x 8 / 198.5 us
= 10 Mbps @ 250 Bytes Data Frame
NET3900 © 2016 Algonquin College. 32
bitDegree.ca
Protocol Efficiency

Channel Capacity
Protocol Efficiency = x 100%
PHY Rate

Based on the previous examples

At 1500B:
31 Mbps
Protocol Efficiency = x 100%
54 Mbps

= 57%

At 250B:
10 Mbps
Protocol Efficiency = x 100%
54 Mbps

= 18%
NET3900 © 2016 Algonquin College. 33
bitDegree.ca
Question
What is the purpose of the Contention Window?

a) Prevents transmission collisions by forcing all stations to


wait a fixed period of time called the Contention Window.

b) Prevents transmission collisions by spreading


transmission attempts from multiple wireless stations over
time interval called the Contention Window.

c) Prevents transmission collisions by allowing only one


station to transmit during the Contention Window.

d) I need more information.

NET3900 © 2016 Algonquin College. 34


bitDegree.ca
Question

Contention PHY Data Ack


DIFS Header SIFS
Window - CW Frame Time
Total Frame Duration

The Data Frame has a size of 1000B and is transmitted at a PHY


rate of 250 Mbps. What is the transmission time of the Data
Frame?

a) 32 msec

b) 32 usec

c) 32 nsec

d) none of the above

NET3900 © 2016 Algonquin College. 35


bitDegree.ca
MAC Frame Aggregation

Contention PHY Data


DIFS Window SIFS Ack
Header Frame
Time
A. Single Data Frame Transmission

Contention

RIFS

SIFS
PHY Data Data Block Ack
DIFS Window Header Frame Frame
B. Multi Data Frame Transmission Time

• Frame Aggregation combines multiple Data Frames into a single 802.11


Frame when the data is available.

• Frame Aggregation is part of the 802.11n Standard.

• It significantly improves protocol efficiency for 802.11n and later protocols.

NET3900 © 2016 Algonquin College. 36


bitDegree.ca

END

NET3900 © 2016 Algonquin College. 37

You might also like