900 likes | 1.12k Views
Link Layer: Wireless Media Access Control. Y. Richard Yang 11 /08/2012. Outline. Admin. and recap Wireless Media access control (MAC) Slotted Aloha Hidden terminal Example: 802.11 Hidden terminal with 802.11 revisited. Admin. Project check point I: next Tuesday
E N D
Link Layer:Wireless Media Access Control Y. Richard Yang 11/08/2012
Outline • Admin. and recap • Wireless Media access control (MAC) • Slotted Aloha • Hidden terminal • Example: 802.11 • Hidden terminal with 802.11 revisited
Admin. • Project check point I: next Tuesday • Feedback on topics to cover
Recap: Wireless Access Problem • Problem: single shared medium, hence if two transmissions overlap on all dimensions [time, space, frequency, and code], then it is a collision • Solution covered: Aloha (random access with collision recovery) A B
Recap: Slotted Aloha [Norm Abramson] • Time is divided into equal size slots (= pkt trans. time) • Node with new arriving pkt: transmit at beginning of next slot with probability p • If collision: retransmit pkt in future slots with probability p, until successful. A B Success (S), Collision (C), Empty (E) slots
Slotted Aloha Recap: Slotted Aloha: Goodput vs. Offered Load Curve S = throughput = “goodput” (success rate) 1.5 2.0 0.5 1.0 Define G = offered load = np • Goodput is optimal when offered load G (=p*n) = 1 • Goodput is less than 1/e (~37%) at optimal
Recap: Slotted Aloha Dynamics n backlogged each transmits with prob. p m-n: unbacklogged each transmits with prob. pa
desirable stable point successful transmission rate at offered load np + (m-n)pa new arrival rate:(m-n) pa undesirable stable point Recap: Slotted Aloha Dynamics • - assume a total of • m stations • pa << p • success rate is thedeparture rate, the rate the backlog is reducing dep. and arrival rate of backlogged stations n: number of backlogged stations m 0 offered load = 1 Slotted Aloha can have an undesirable stable point
Summary of Problems of Slotted Aloha • Advantages • Simple, decentralized random access protocol • Issues • Low efficiency • Only ~37% at optimal transmission rate • Even lower efficiency at non-optimal (fixed p) • No rate allocation/fairness
Ethernet Fix for Efficiency • Introduce collision detection: instead of wasting the whole frame transmission time (a slot), we waste only the time needed to detect collision. • Introduce adaptive probability: reduce probability of trans. as # of collisions increases • If more collisions => p is high => should reduce p P: packet size, C: contention window C C C P
Ethernet Fix: Carrier-Sense Multiple Access /Collision Detection/Exponential Backoff Carrier sense The Ethernet algorithm • get a frame from upper layer; • K := 0; n := 0; // K: control wait time; n: no. of collisions • repeat: • wait for K * 512 bit-time; • while (network busy) wait; • wait for 96 bit-time after detecting no signal; • transmit and detect collision; • if detect collision • stop and transmit a 48-bit jam signal; • n ++; • m:= min(n, 10), where n is the number of collisions • choose K randomly from {0, 1, 2, …, 2m-1}. • if n < 16 goto repeat • else give up • else • declare success Detect Collision Adapt Probability Q: Does Ethernet alg work well in wireless?
Outline • Admin. and recap • Media access control • Slotted Aloha • Hidden terminal • Example: 802.11 • Hidden terminal with 802.11 revisited
The Hidden Terminal Problem • A is sending to B, but C cannot detect the transmission • Therefore C sends to B • In summary, A is “hidden” from C E D A B C
CSMA/CD + Hidden Terminals • get a frame from upper layer; • K := 0; n := 0; // K: control wait time; n: no. of collisions • repeat: • wait for K * 512 bit-time; • while (network busy) wait; • wait for 96 bit-time after detecting no signal; • transmit and detect collision; • if detect collision • stop and transmit a 48-bit jam signal; • n ++; • m:= min(n, 10), where n is the number of collisions • choose K randomly from {0, 1, 2, …, 2m-1}. • if n < 16 goto repeat • else give up • else • declare success Hidden terminals => 0 goodput! Q: what is the outcome of CSMA/CD + hidden terminals,assume two senders with infinite backlog?
Hidden Terminals • Why cannot senders C and A detect collisions or potential collisions? • Collision is spatially dependent • C/A is at a different location than B • Only receiver can detect a collision happened or potential collisions A B C
Solution I: Receiver Notifies Collision Happened • Solution: receiver sends ACK to sender to indicate a collision happened or not • If no ACK from receiver, sender assumes a collision
Solution II: Receiver Signals Potential Collision • Receiver sends busy-tone • Used in CDPD (cellular digital packet data) • The base station sends a busy tone on the down link when receiving data
DATA RTS CTS CTS Solution III: Receiver Signals Potential Collision Using Virtual Carrier Sense/ACK • Short signaling packets (virtual carrier sense) • Sender: RTS (request to send) • Receiver: CTS (clear to send) • contain sender address, receiver address, transmission duration, called network allocation vector (NAV) • A node keeps quiet for NAV in CTS A B C D
Comparisons: Media Access Techniques Handling Hidden Terminals • Slotted Aloha • very simple to implement but low efficiency • CSMA/CD (Ethernet alg.) • hidden terminals can cause 0 goodput • CSMA/CD + ACK • simple to implement • low efficiency
Comparisons: Media Access Techniques Handling Hidden Terminals • Busy tone • simple to implement but need a channel for busy signal • Virtual carrier sensing (RTS/CTS) • higher efficiency when a collision occurs (not waste the whole duration) • But energy consumption can be high because a node needs to monitor the environment all the time • Idle:receive:send: 1:1.05:1.4 [Stemm and Katz]; Digitan 2 Mbps WLAN 1:2:2.5 • many measurements show that overhead hurts performance
Outline • Admin. and recap • Media access control • Slotted Aloha • Hidden terminal • Example: 802.11 • Hidden terminal with 802.11 revisited
Portal Distribution System 802.11: Infrastructure Mode • Architecture similar to cellular • networks station (STA) • terminal with access mechanisms to the wireless medium and radio contact to the access point • access point (AP) • station integrated into the wireless LAN and the distribution system • basic service set (BSS) • group of stations using the same AP • portal • bridge to other (wired) networks • distribution system • interconnection network to form one logical network (EES: Extended Service Set) based on several BSS 802.11 LAN 802.x LAN STA1 BSS1 Access Point Access Point ESS BSS2 STA2 STA3 802.11 LAN
802.11 – MAC Traffic Services • Asynchronous Data Service (ADS) • Objective: exchange data packets based on distributed random access • Approach: Implement ADS using distributed coordinate function (DCF): • DCF CSMA/CA (mandatory) • - collision avoidance via randomized “back-off“ • ACK packet for acknowledgements/detection • DCF w/ RTS/CTS (optional) • additional virtual “carrier sensing • Time-Bounded Service (TBS) • Objective: Exchange of bounded delay service • Approach: implemented TBS using point (access point) coordinated function (PCF)
802.11 CSMA/CA • CSMA: Listen before transmit • Collision avoidance • when transmitting a packet, choose a backoff interval in the range [0, CW] • CW is contention window • Count down the backoff interval when medium is idle • count-down is suspended if medium becomes busy • Transmit when backoff interval reaches 0
802.11 Backoff • IEEE 802.11 contention window CWis adapted dynamically depending on collision occurrence • after each collision, CW is doubled • thus CW varies from CWmin to CWmax
B1 = 25 wait data data wait B2 = 10 B2 = 20 Congestion Avoidance: Example busy B1 = 5 B2 = 15 busy B1 and B2 are backoff intervals at nodes 1 and 2 cw = 31
802.11 – RTS/CTS + ACK • Sender sends RTS with NAV (Network allocation Vector, i.e. reservation parameter that determines amount of time the data packet needs the medium) • Receiver acknowledges via CTS (if ready to receive) • CTS reserves channel for sender, notifying possibly hidden stations • Sender can now send data at once, acknowledgement via ACK • Other stations store NAV distributed via RTS and CTS DIFS RTS data sender SIFS SIFS SIFS CTS ACK receiver DIFS NAV (RTS) data other stations NAV (CTS) t defer access new contention
DIFS DIFS PIFS SIFS medium busy contention next frame t Integrating PCF and DCF • Using different inter frame spacing values to implement priority • SIFS (Short Inter Frame Spacing); 10 us in 802.11b • highest priority, for ACK, CTS, polling response • PIFS (PCF IFS); 30 us in 802.11b • medium priority, for time-bounded service using PCF • DIFS (DCF, Distributed Coordination Function IFS); 50 us in 802.11b • lowest priority, for asynchronous data service direct access if medium is free DIFS
802.11: PCF for Polling (Infrastructure Mode) SIFS PIFS D D point coordinator SIFS U polled wireless stations NAV NAV contention free period t medium busy contention period D: downstream poll, or data from point coordinator U: data from polled wireless station
802.11b Frame Format preamble 2 Sync SFD PLCP header MAC Data CRC Preamble (192 usec; or optional 96 short version) - Sync: alternating 0s and 1s (DSSS 128 bits) - SFD: Start Frame delimiter: 0000 1100 1011 1101 PLCH (Phsical Layer Convergence Procedure) Header - payload length - signaling field: the rate info. - CRC: 16 bit protection of header
802.11 – MAC Format • Types • control frames, management frames, data frames • Sequence numbers • important against duplicated frames due to lost ACKs • Addresses • receiver, transmitter (physical), BSS identifier, sender (logical) • Miscellaneous • sending time, checksum, frame control, data bytes 2 2 6 6 6 2 6 0-2312 4 Frame Control Duration/ ID Address 1 Address 2 Address 3 Sequence number Address 4 Data CRC bits 1 1 1 1 1 1 2 2 4 1 1 Protocol version Type Subtype To DS From DS More Frag Retry Power Mgmt More Data WEP Order
Example: 802.11b/ACK Timing • Suppose TCP with 1460 bytes data payload • TCP data frame size (not including preamble) • 1536 bytes (1460 + 40 TCP header + 36 802.11 header) • TCP ACK data frame size (not including preamble) • 76 bytes • 802.11b ACK frame size 14 bytes • Suppose 802.11b at the highest rate • 8 bits per symbol • 1.375 Msps http://www.andrews.edu/~swensen/Wifi%20Throughput.pdf
Example: 802.11g/ACK Timing • Suppose 802.11g at the highest rate (54Mbps) • symbol duration: 4 usec; 216 bits/symbol • 20 usec preamble; 6 usec “signal extension time” at the end of each frame • Suppose TCP with 1460 bytes data payload • data: 57 (=1536*8/216) symbols; ACK: 3 (=76*8/216) symbols • 802.11b ACK frame size 14 bytes • 1 symbol http://www.andrews.edu/~swensen/Wifi%20Throughput.pdf
Example: TCP/802.11g + CTS • RTS/CTS uses 802.11b DIFS (50 usec) and long preamble (192 usec) • RTS/CTS uses 802.11b frame coding • 20 bytes RTS • 14 bytes CTS http://www.andrews.edu/~swensen/Wifi%20Throughput.pdf
Outline • Admin. and recap • Media access control • Slotted Aloha • Hidden terminal • Example: 802.11 • Hidden terminal with 802.11 revisited
Hidden Terminal with 802.11 No ACK Collision! Bob Alice
Hidden Terminal with 802.11 Retransmission One more Collision Bob Alice
802.11 Setting: Two Collisions of Two Packets Pa Pa Pb Pb