MAC layer Taekyoung Kwon
Media access in wireless - start with IEEE 802.11 • In wired link, – Carrier Sense Multiple Access with Collision Detection – send as soon as the medium is free, listen into the medium if a collision occurs (original method in IEEE 802.3)
• In wireless – Signal strength decreases in proportional to at least square of the distance – Collision detection only at receiver – Half-duplex mode – Furthermore, CS is not possible after propagation range
Hidden terminal problem • Hidden terminals – A sends to B, C cannot receive A – C wants to send to B, C senses a “free” medium (CS fails) – collision at B, A cannot receive the collision (CD fails) – A is “hidden” for C
A
B
C
Exposed terminal problem • Exposed terminals – B sends to A, C wants to send to D – C has to wait, CS signals a medium in use – but A is outside the radio range of C, thus waiting is not necessary – C is “exposed” to B A
B
C
D
Multiple access methods • FDMA • TDMA • CDMA • SDMA
ALOHA, Slotted-ALOHA • Mechanism – random, distributed (no central arbiter), timemultiplex – Slotted Aloha additionally uses time-slots, sending must always start at slotcollision boundaries
• Aloha sender A sender B sender C t
• Slotted Aloha
collision
sender A sender B sender C t
MACA (multiple access collision avoidance) • MACA (Multiple Access with Collision Avoidance) uses short signaling packets for collision avoidance – RTS (request to send): a sender request the right to send from a receiver with a short RTS packet before it sends a data packet – CTS (clear to send): the receiver grants the right to send as soon as it is ready to receive
• aka, virtual carrier sense
MACA operation • MACA avoids the problem of hidden terminals – A and C want to send to B – A sends RTS first – C waits after receiving CTS from B
RTS
RTS CTS
CTS B
A
C
• MACA avoids the problem of exposed terminals – B wants to send to A, C to another terminal – now C does not have to wait for it cannot receive CTS from A
RTS CTS
RTS
CTS A
B
C
PRMA •Implicit reservation (PRMA - Packet Reservation MA) – a certain number of slots form a frame, frames are repeated – stations compete for empty slots according to the slotted aloha principle – once a station reserves a slot successfully, this slot is automatically assigned to this station in all following frames as long as the station has data to send – competition for this slots starts again as soon as the slot reservation was empty in the 1 last 2 3 frame 4 5 6 7 8 time-slot ACDABA-F
ACDABA-F AC-ABAFA---BAFD ACEEBAFD
frame1 A C D A B A frame2 A C
F
A B A
frame3 A
B A F
frame4 A
B A F D
frame5 A C E E B A F D
collision at reservation attempts t
IEEE 802.11 wireless LAN infrastructure network AP AP
wired network
ad-hoc network
AP: Access Point
802.11 infrastructure mode •Station (STA) 802.11 LAN
STA1
802.x LAN
– terminal with access mechanisms to the wireless medium and radio contact to the access point
•Basic Service Set (BSS) BSS1 Portal
Access Point
•Access Point
Distribution System Access Point
ESS
– station integrated into the wireless LAN and the distribution system
•Portal – bridge to other (wired) networks
BSS2
STA2
– group of stations using the same radio frequency
•Distribution System
802.11 LAN
STA3
– interconnection network to form one logical network (ESS: Extended Service Set) based on several BSS
802.11 MAC requirements
802.11 MAC • Traffic services – Asynchronous Data Service (mandatory) • exchange of data packets based on “best-effort” • support of broadcast and multicast
– Time-Bounded Service (optional) • implemented using PCF (Point Coordination Function)
• Access methods – DFWMAC-DCF CSMA/CA (mandatory) • collision avoidance via randomized back-off mechanism • minimum distance between consecutive packets • ACK packet for acknowledgements (not for broadcasts)
– DFWMAC-DCF w/ RTS/CTS (optional) • Distributed Foundation Wireless MAC • avoids hidden terminal problem
– DFWMAC- PCF (optional) • access point polls terminals according to a list
802.11 layers • PLCP
Physical Layer Convergence
Protocol
• MAC – access mechanisms, fragmentation, encryption
• MAC Management – synchronization, roaming, MIB, power management
– clear channel assessment signal (carrier sense)
• PMD
Physical Medium Dependent
– modulation, coding
• PHY Management – channel selection, MIB
• Station Management – coordination of all management functions
Infrastructure mode fixed terminal mobile terminal
infrastructure network access point application
application
TCP
TCP
IP
IP
LLC
LLC
LLC
802.11 MAC
802.11 MAC
802.3 MAC
802.3 MAC
802.11 PHY
802.11 PHY
802.3 PHY
802.3 PHY
802.11 MAC • Priorities – defined through different inter frame spaces – no guaranteed, hard priorities – SIFS (Short Inter Frame Spacing) • highest priority, for ACK, CTS, polling response
– PIFS (PCF IFS) • medium priority, for time-bounded service using PCF
– DIFS (DCF, Distributed Coordination Function IFS) • lowest priority, for asynchronous data service DIFS
DIFS PIFS medium busy direct access if medium is free ≥ DIFS
SIFS
contention
next frame t
802.11 CSMA/CA DIFS
DIFS
contention window (randomized back-off mechanism)
medium busy direct access if medium is free ≥ DIFS
next frame t slot time
– station ready to send starts sensing the medium (Carrier Sense based on CCA, Clear Channel Assessment) – if the medium is free for the duration of an Inter-Frame Space (IFS), the station can start sending (IFS depends on service type) – if the medium is busy, the station has to wait for a free IFS, then the station must additionally wait a random back-off time (collision avoidance, multiple of slot-time) – if another station occupies the medium during the backoff time of the station, the back-off timer stops (fairness)
802.11 CSMA/CA: contention resolution DIFS
DIFS
station1 station2
DIFS boe
bor
boe
busy
DIFS boe bor
boe
boe busy
boe bor
boe
boe
busy
busy
station3 station4
boe bor
station5
busy
bor t
busy
medium not idle (frame, ack etc.)
boe elapsed backoff time
packet arrival at MAC
bor residual backoff time
802.11 CSMA/CA: detailed • Sending unicast packets – station has to wait for DIFS before sending data – receivers acknowledge at once (after waiting for SIFS) if the packet was received correctly (CRC) – automatic retransmission of data packets in case of transmission errors DIFS sender
data SIFS
receiver
ACK DIFS
other stations
waiting time
data t
contention
802.11: RTS & CTS • Sending unicast packets – station can send RTS with reservation parameter after waiting for DIFS (reservation determines amount of time the data packet needs the medium) – acknowledgement via CTS after SIFS by receiver (if ready to receive) – sender can now send data at once, acknowledgement via ACK – other stations store medium reservations distributed via RTS andDIFS CTS sender
RTS
data
SIFS receiver
other stations
CTS SIFS
SIFS
NAV (RTS) NAV (CTS) defer access
ACK
DIFS
data t
contention
802.11 beaconing (infrastructure mode) beacon interval
access point medium
B
B busy
busy
B busy
B busy t
value of the timestamp
B
beacon frame
802.11 beaconing (ad hoc mode) beacon interval
station1
B1
B1 B2
station2 medium
busy
busy
B2 busy
busy t
value of the timestamp
B
beacon frame
random delay