Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Csma 3

Download as pdf or txt
Download as pdf or txt
You are on page 1of 34

WLAN, part 2

Contents

IEEE 802.11 MAC layer operation


• Basic CSMA/CA operation
• Network Allocation Vector (NAV)
• Backoff operation
• Wireless medium access example
Usage of RTS / CTS

Wireless Innovative Transmission Lab 1


WLAN, part 2

Wireless Innovative Transmission Lab 2


WLAN, part 2

Wireless Innovative Transmission Lab 3


WLAN, part 2

Medium Access Control (MAC)

Medium access control: Different nodes must gain access


to the shared medium (for instance a wireless channel) in
a controlled fashion (otherwise there will be collisions).
Access methods:
:
FDMA Assigning channels in frequency domain
LLC
TDMA Assigning time slots in time domain
MAC
CDMA Assigning code sequences in code domain
PHY
CSMA Assigning transmission opportunities in
time domain on a statistical basis
(Randomly chosen numbers)

Wireless Innovative Transmission Lab 4


WLAN, part 2

CSMA/CD vs. CSMA/CA (1)

CSMA/CD (Collision Detection) is the MAC method used in


a wired LAN (Ethernet). Wired LAN stations can (whereas
wireless stations cannot) detect collisions.
Basic CSMA/CD operation:
CSMA/CD rule:
1) Wait for free medium Backoff after collision
2) Transmit frame
3) If collision, stop transmission immediately
4) Retransmit after random time (backoff)

Wireless Innovative Transmission Lab 5


WLAN, part 2

CSMA/CD
(Flowchart)

Wireless Innovative Transmission Lab 6


WLAN, part 2

CSMA/CD vs. CSMA/CA (2)

CSMA/CA (Collision Avoidance) is the MAC method used in


a wireless LAN. Wireless stations cannot detect collisions
(i.e. the whole packets will be transmitted anyway).
Basic CSMA/CA operation:
CSMA/CA rule:
1) Wait for free medium Backoff before
2) Wait a random time (backoff) collision
3) Transmit frame
4) If collision, the stations do not notice it
5) Collision => erroneous frame => no ACK returned

Wireless Innovative Transmission Lab 7


WLAN, part 2

CSMA/CA
(Flowchart)

Wireless Innovative Transmission Lab 8


WLAN, part 2

Basic wireless medium access

wired LAN
transmission in downlink
AP (from the AP)
and
transmission in uplink
(from a station)

CSMA:
One packet at a time

Wireless Innovative Transmission Lab 9


WLAN, part 2

Wireless medium access (1)

Transmitted
frame
(A=>B) ACK
(B=>A)
If the received frame
is erroneous, no ACK
DIFS SIFS
will be sent

When a frame is received without bit errors, the receiving


station (B) sends an Acknowledgement (ACK) frame back
to the transmitting station (A).

Wireless Innovative Transmission Lab 10


WLAN, part 2

Wireless medium access (2)

Earliest allowed
transmission time
Transmitted
of next frame
frame
(A=>B) ACK
(B=>A)
Next frame
(from any station)
DIFS SIFS DIFS

During the transmission sequence (Frame + SIFS + ACK)


the medium (radio channel) is reserved. The next frame
can be transmitted at earliest after the next DIFS period.

Wireless Innovative Transmission Lab 11


WLAN, part 2

Wireless medium access (5)

The two most important interframe spacing times are


SIFS and DIFS:
SIFS (Short Interframe Space) = 10 µs (16 µs)
DIFS (DCF Interframe Space) = 50 µs (34 µs)
802.11b 802.11g

When two stations try to access the medium at the


same time, the one that has to wait for the time SIFS
wins over the one that has to wait for the time DIFS.
In other words, SIFS has higher priority over DIFS.

Wireless Innovative Transmission Lab 12


WLAN, part 2

Wireless medium access (8)

Channel was idle at


least DIFS seconds
Transmitted
frame
(A=>B) ACK
(B=>A)
Next frame
(from any station)
DIFS SIFS t > DIFS

When a station wants to send a frame and the channel has


been idle for a time > DIFS (counted from the moment the
station first probed the channel) => can send immediately.

Wireless Innovative Transmission Lab 13


WLAN, part 2

Wireless medium access (9)

Channel was busy


when station wanted
Transmitted
to send frame
frame
(A=>B) ACK
(B=>A)
Backoff Next
frame
DIFS SIFS DIFS

When a station wants to send a frame and the channel is


busy => the station must wait a backoff time before it is
allowed to transmit the frame. Reason? Next two slides…

Wireless Innovative Transmission Lab 14


WLAN, part 2

No backoff => collision is certain

Suppose that several stations (B and C in the figure) are


waiting to access the wireless medium.
When the channel becomes idle, these stations start
sending their packets at the same time => collision!

Station A ACK

Station B
Collision!
Station C
DIFS

Wireless Innovative Transmission Lab 15


WLAN, part 2

Backoff => collision probability is reduced

Contending stations generate random backoff values bn.


Backoff counters count downwards, starting from bn.
When a counter reaches zero, the station is allowed to
send its frame. All other counters stop counting until the
channel becomes idle again.
Remaining
Station A ACK
Backoff
backoff time

Station B bn is large

Station C
DIFS bn is small

Wireless Innovative Transmission Lab 16


WLAN, part 2

Contention window (CW) for 802.11b

If transmission of a frame was unsuccessful and the frame


is allowed to be retransmitted, before each retransmission
the Contention Window (CW) from which bn is chosen is
increased.
802.11b
CW
Initial attempt DIFS
… CW = 25-1 = 31 slots
(slot = 20 µs)
1st retransm. DIFS

CW = 26-1 = 63 slots
:
5th (and further)
DIFS
… CW = 210-1
retransmissions = 1023 slots

Wireless Innovative Transmission Lab 17


WLAN, part 2

Contention window (CW) for 802.11g

In the case of 802.11g operation, the initial CW length is


15 slots. The slot duration is 9 µs. The backoff operation
of 802.11g is substantially faster than that of 802.11b.

802.11g
CW
Initial attempt DIFS
… CW = 24-1 = 15 slots
(slot = 9 µs)
1st retransm. DIFS

CW = 25-1 = 31 slots
:
6th (and further)
DIFS
… CW = 210-1
retransmissions = 1023 slots

Wireless Innovative Transmission Lab 18


WLAN, part 2

No shortcuts for any station…

Transmitted Backoff Next


frame frame
(A=>B) ACK (A=>B)
(B=>A)

DIFS SIFS DIFS

When a station wants to send more than one frame, it has


to use the backoff mechanism like any other station (of
course it can ”capture” the channel by sending a long
frame, for instance using fragmentation).

Wireless Innovative Transmission Lab 19


WLAN, part 2

Hidden Terminal Problem

A X

carrier not free ≠ OK to transmit

Wireless Innovative Transmission Lab 20


WLAN, part 2

Usage of RTS & CTS

The RTS/CTS (Request/Clear To Send) scheme is used as


a countermeasure against the “hidden node” problem:

Hidden node problem: WS 1


WS 1 and WS 2 can ”hear” AP
the AP but not each other
=>
If WS 1 sends a packet, WS 2 does not
notice this (and vice versa) => collision! WS 2

Wireless Innovative Transmission Lab 21


WLAN, part 2

Reservation of medium using NAV

The RTS/CTS scheme makes use of “SIFS-only” and the


NAV (Network Allocation Vector) to reserve the medium:
SIFS DIFS

WS 1 RTS Data frame


AP CTS ACK

SIFS SIFS

NAV in RTS NAV = CTS + Data + ACK + 3xSIFS


NAV in CTS NAV = Data + ACK + 2xSIFS

Wireless Innovative Transmission Lab 22


WLAN, part 2

CSMA/CA and NAV

Wireless Innovative Transmission Lab 23


WLAN, part 2

Danger of collision only during RTS

WS 2 does not hear the RTS frame (and associated NAV),


but can hear the CTS frame (and associated NAV).

WS 1 RTS Data frame


AP CTS ACK

Danger of collision

NAV in RTS NAV = CTS + Data + ACK + 3xSIFS


NAV in CTS NAV = Data + ACK + 3xSIFS

Wireless Innovative Transmission Lab 24


WLAN, part 2

Exposed Terminal Problem

Wireless Innovative Transmission Lab 25


WLAN, part 2

Exposed Terminal Problem

Wireless Innovative Transmission Lab 26


WLAN, part 2

Advantage of RTS & CTS (1)

Usage of RTS/CTS offers an advantage if the data frame


is very long compared to the RTS frame:

WS 1 RTS Data frame (RTS/CTS used)

AP CTS ACK
Short interval: collision not likely

WS 1 Data frame (RTS/CTS not used)

AP ACK
Long interval: collision likely

Wireless Innovative Transmission Lab 27


WLAN, part 2

Advantage of RTS & CTS (2)

A long “collision danger” interval (previous slide) should


be avoided for the following reasons:
Larger probability of collision
Greater waste of capacity if a collision occurs and the
frame has to be retransmitted.

A threshold parameter (IEEE 802.11 frame~Threshold)


can be set in the wireless station. Frames shorter than
this value will be transmitted without using RTS/CTS.

Wireless Innovative Transmission Lab 28


WLAN, part 2

Fragmentation

Fragmentation makes use of the RTS/CTS scheme and the


NAV mechanism:
SIFS SIFS DIFS

WS 1 RTS Frag 0 Frag 1


AP CTS ACK 0 ACK 1

SIFS SIFS SIFS

RTS
NAV in WS Frag 0
NAV in AP CTS ACK 0

Wireless Innovative Transmission Lab 29


WLAN, part 2

Advantage of fragmentation

Transmitting long data frames should be avoided for the


following reasons:
Larger probability that the frame is erroneous
Greater waste of capacity if a frame error occurs and
the whole frame has to be retransmitted.

A threshold parameter (dot11FragmentationThreshold)


can be set in the wireless station. Frames longer than
this value will be transmitted using fragmentation.

Wireless Innovative Transmission Lab 30


WLAN, part 2

WBAN CSMA/CA

Transmitting long data frames should be avoided for the


following reasons:
Larger probability that the frame is erroneous
Greater waste of capacity if a frame error occurs and
the whole frame has to be retransmitted.

A threshold parameter (dot11FragmentationThreshold)


can be set in the wireless station. Frames longer than
this value will be transmitted using fragmentation.

Wireless Innovative Transmission Lab 31


WBAN
WLAN, part 2

UP7 All UPs UP7 All UPs All UPs


CSMA/Slotted CSMA/Slotted CSMA/Slotted CSMA/Slotted Polling Mechanisms CSMA/Slotted
Aloha Aloha Polling Mechanisms Aloha Aloha Aloha
B B2
EAP1 RAP1 MAP1 EAP2 RAP2 MAP2 CAP

Beacon period (superframe) n

Wireless Innovative Transmission Lab 32


WLAN, part 2
Start

UPi node has a

WBAN CSMA/CA packet to


transmit

(Flowchart)
Collision Counter BC=rand (1,CW )
i,j
j=0

Backoff Counter
(BC)=rand (1,CWi ,min ) BC=rand (1,CW )
i,max

Y
Freeze the BC
CWi,j > CWi,max N
Y Channel is
Busy?

N   New CW Size;
 
 j
 
2
BC = BC-1 CW =2  CW
i,j i,min

N
BC=0? N j=j+1

Y N

Transmit Packet and ACK rece ived


Y
within tim eout
Wait for ACK period?

Wireless Innovative Transmission Lab 33


WLAN, part 2
Start

UPi node has a


packet to
transmit

WBAN CSMA/CA Collision Counter


j=0
BC=rand (1,CW )
i,j

Flowchart for all the Backoff Counter


(BC)=rand (1,CWi ,min ) BC=rand (1,CW )
i,max

access phases Y

CW > CW N
i,j i,max
Freeze the BC
Current time is
outside of suitable
access phase?
Y
N
Y   New CW Size;

Channel is  j 
 2 
Busy? 
BC = BC-1 CW =2 CW
i,j i,min

N
N
No enough time left N j=j+1
Y in the suitable access
BC=0?
phase(s) to transmit
the packet? N
Y
ACK received
Transmit Packet and
within timeout
Wait for ACK period?

End

Wireless Innovative Transmission Lab 34

You might also like