370 likes | 540 Views
Wireless Networks and Mobile Systems. Lecture 7 Medium Access in WLANs. Lecture Objectives. Discuss how access to the wireless medium is decided in IEEE 802.11 and Bluetooth networks
E N D
Wireless Networks and Mobile Systems Lecture 7Medium Access in WLANs
Lecture Objectives • Discuss how access to the wireless medium is decided in IEEE 802.11 and Bluetooth networks • Identify the hidden node and exposed node problems and how the exchange of control messages can be used to mitigate them • Describe the frame formats for IEEE 802.11 and Bluetooth Medium Access in WLANs 2
Agenda • IEEE 802.11 • MAC frame format • CSMA/CA • RTS/CTS • IEEE 802.11e • Bluetooth • Packet format • Links and connection establishment Medium Access in WLANs 3
MAC frame format CSMA/CA RTS/CTS IEEE 802.11e IEEE 802.11 Medium Access
IEEE 802.11 Reference Model Medium Access Control (MAC) sublayer MAC sublayer management station management Data Link Layer Physical Layer convergence procedure (PLCP) sublayer PHY sublayer management Physical Layer Physical medium Dependent (PMD) sublayer Medium Access in WLANs 5
MAC Frame Format Bytes: 2 2 6 6 6 2 6 0-2312 4 FrmCntl Dur/ID Adr1 Adr2 Adr3 SeqCntl Adr4 FrameBody FCS 2 bits 2 bits 4 bits ProtocolVersion Type Subtype Byte 1 1 1 1 1 1 1 1 1 ToDS FromDS MoreFrags Retry PowerMgmt MoreData WEP Order Byte 2 Medium Access in WLANs 6
Frame Control Field (1) • Protocol Version (2 bits) – current version of the standard • Type (2 bits) – differentiates among a management frame (00), control frame (01), or data frame (10) • Subtype (4 bits) – further defines the type of frame • Type 00, subtype 0000 – association request • Type 00, subtype 0001 – association response • Type 01, subtype 1011 – RTS • Type 01, subtype 1100 – CTS • Type 01, subtype 1101 – ACK • Type 10, subtype 0000 – data • Many others… Medium Access in WLANs 7
Frame Control Field (2) • To/from DS (1 bit each) – flags set when the frame is sent to/from the distribution system • More Fragment (1 bit) – flag set when more fragments belonging to the same frame are to follow • Retry (1 bit) – indicates that this frame is a retransmission • Power Management (1 bit) – indicates power management mode (active, power saving) • More data (1 bit) – more frames buffered by station for the same destination • WEP (1 bit) – payload encrypted with WEP • Order (1 bit) –strictly-ordered service Medium Access in WLANs 8
Other Fields • Duration ID (2 bytes) – for data frames, it contains the duration of the frame • Sequence control (2 bytes) – sequence # • Frame body (0 to 2312 bytes) • FCS (4 bytes) – Frame Check Sequence (32 bit CRC) • Address fields (6 bytes each) – may contain BSSID, source/destination address, transmitting/receiving station address • Interpretation depends on values of ToDS/FromDS bits Medium Access in WLANs 9
Address Fields ToDS FromDS Addr.1 Addr. 2 Addr.3 Addr. 4 0 0 DA SA BSSID N/A 0 1 DA BSSID SA N/A 1 0 BSSID SA DA N/A 1 1 RA TA DA SA Medium Access in WLANs 10
Indirection by Distribution System Distribution System (DS) AP1 AP2 STA1 STA3 STA4 STA6 STA2 STA5 BSS1 BSS2 SA = STA2 DA = STA5 TA = STA2 RA = AP1 SA = STA2 DA = STA5 TA = AP2 RA = STA5 Medium Access in WLANs 11
PHY • MAC Protocol Data Unit (MPDU) is encapsulated by PLCP • Format of PLCP PDU different for IEEE 802.11 (DSSS, FHSS, IR), IEEE 802.11b (long preamble/short preamble), IEEE 802.11a • PLCP PDU for IEEE 802.11b with long preamble compatible with PLCP PDU for IEEE 802.11 DHSS • In this lecture, we will focus on IEEE 802.11b PLCP PDU Medium Access in WLANs 12
802.11b Long Preamble PLCP PDU • Compatible with legacy IEEE 802.11 systems • Preamble (SYNC + Start of Frame Delimiter) allows receiver to acquire the signal and synchronize itself with the transmitter • Signal identifies the modulation scheme, transmission rate • Length specifies the length of the MPDU (expressed in time to transmit it) PLCP PDU (PPDU) 128 16 8 8 16 8 SYNC SFD Signal Service Length CRC MPDU PLCPHeader PLCPPreamble Medium Access in WLANs 13
802.11b Short Preamble PLCP PDU • Not compatible with legacy IEEE 802.11 systems PLCP PDU (PPDU) 58 16 8 8 16 8 SYNC SFD Signal Service Length CRC MPDU PLCPHeader PLCPPreamble Medium Access in WLANs 14
802.11 Medium Access • Distributed Coordination Function (DCF) • Stations contend for the medium and transmit when the medium becomes idle • Mandatory in 802.11 standard • Point Coordination Function (PCF) • Works in conjunction with DCF • Optional • Access point polls stations during contention free periods and grants access to individual station Medium Access in WLANs 15
Why not use CSMA/CD? • In IEEE 802.3 (Ethernet), nodes sense the medium, transmit if the medium is idle, and listen for collisions • If a collision is detected, after a back-off period, the node retransmits the frame • Collision detection is not feasible in WLANs • Node cannot know whether the signal was corrupted due to channel impairments in the vicinity of the receiving node • IEEE 802.11 uses Carrier Sense Multiple Access (CSMA), but adopts collision avoidance, rather than collision detection Medium Access in WLANs 16
CSMA • Station waits a random amount of time before transmitting, while still monitoring the medium • Avoids collisions due to multiple stations transmitting immediately after they sense the medium as idle • Loss of throughput due to the waiting period is compensated by fewer retransmissions • No explicit collision detection • Retransmissions are triggered if ACK is not received • Exponential backoff similar to IEEE 802.3 • Optionally, transmitting and receiving nodes can exchange control frames to “reserve” the channel Medium Access in WLANs 17
Network Allocation Vector (NAV) • Counter maintained by each station with amount of time that must elapse until the medium will become free again • Contains the time that the station that currently has the medium will require to transmit its frame • Station cannot transmit until NAV is zero • Each station calculates how long it will take to transmit its frame (based on data rate and frame length); this information is included in the Duration field of the frame header • This information is used by all other stations to set their NAV Medium Access in WLANs 18
Timeline Cwin = contention window Starts sensing the medium (idle) time Data Source SIFS DIFS ACK Destination DIFS Another station Data Defers access Pick random backoff time in [0, Cwin] Medium Access in WLANs 19
Timeline Discussed • DCF = Distributed Coordinated Function • Basic access method for 802.11 (uses CSMA/CA) • DIFS = DCF Inter Frame Space • Stations must listen to an idle medium for at least that amount of time before transmitting • SIFS = Short Inter Frame Space • Period between reception of the data frame and transmission of the ACK • SIFS < DIFS • What happens if another station starts listening to the medium exactly during the idle period between data transmission and acknowledgment? Medium Access in WLANs 20
Hidden Node Problem Range of transmission/reception of node A • Node A is not aware that node B is currently busy receiving from node C, and therefore may start its own transmission, causing a collision RA RC transmission Node A Node C Node B Medium Access in WLANs 21
Exposed Node Problem • Node B wants to transmit to node C but mistakenly thinks that this will interfere with A’s transmission to D, so B refrains from transmitting (loss in efficiency) RD RA transmission Node A Node B Node D Node C Medium Access in WLANs 22
RTS/CTS • Sender transmits a Request to Send (RTS) indicating how long it wants to hold the medium • Receiver replies with Clear to Send (CTS) echoing expected duration of transmission • Any node that hears the CTS knows it is near the receiver and should refrain from transmitting for that amount of time • Nodes that hear the RTS but not the CTS are free to transmit • Receiver sends ACK to sender after successfully receiving a frame. All nodes must wait for the receiver to ACK before attempting to transmit Medium Access in WLANs 23
Timeline with RTS/CTS Cwin = contention window Starts sensing the medium (idle) time RTS Data Source SIFS SIFS SIFS DIFS CTS ACK Destination DIFS Another station RTS Pick random backoff time in [0, Cwin] Defers access Medium Access in WLANs 24
IEEE 802.11e • MAC enhancements to support quality of service (QoS) in IEEE 802.11a/b/g • Defines different categories of traffic • Each QoS-enabled station marks its traffic according to its performance requirements • Stations still contend for the medium, but different traffic types are associated with different inter frame spacing and contention window • Qualitative, comparative QoS (no “guarantees”) Medium Access in WLANs 25
Service Differentiation Source: Xtreme Spectrum, “Tradeoff Analysis (802.11e versus 802.15.3 QoS mechanism),” white paper, July 2002. Medium Access in WLANs 26
Packet format Links and connection establishment Bluetooth
Packet Format • Packets may consist of • Access code only (in which case the access code is 68 bits, not 72) • Access code + header • Access code + header + payload • Note: discussion of BT MAC follows v.1.1 core specifications Medium Access in WLANs 28
Access Code • Access code is used for synchronization and identification • All packets sent in a piconet use the same channel access code • There are specific access codes for signaling and inquiry (for instance, to discover what other BT devices are in range) Medium Access in WLANs 29
Header (1) • AM_ADDR: • 3-bit slave address • temporary, assigned while the slave is active, and specific to the piconet • Messages from slave to master and from master to slave carry this address • All zeros: broadcast address Medium Access in WLANs 30
Header (2) • TYPE: • Distinguishes between synchronous and asynchronous links, indicates how many slots the packet will occupy • FLOW: • Asynchronous flow control in asynchronous links • ARQN: • ACK (ARQN = 1) or NAK (ARQN = 0) Medium Access in WLANs 31
Header (3) • SEQN: • Sequence number • 1 bit is sufficient for very simple ARQ • HEC: • Header error check Medium Access in WLANs 32
Types of Links • Synchronous Connection-oriented link (SCO) • Point-to-point • Reserves duplex slots at regular intervals (“circuit-switched”) • Synchronous and symmetric • Asynchronous Connectionless Link (ACL) • Used in slots that are not reserved for SCO links (“packet-switching) • These slots can be used by the master to broadcast packets • Master scheduling (polling) • Asynchronous, can be asymmetric Medium Access in WLANs 33
Establishing a Connection • Inquiry and paging procedures • Inquiry is used for a unit to discover what other BT units are in range and what their addresses are • Inquiry has a unique device address and a unique set of hop frequencies • Devices perform Inquire scans • Paging procedure establishes the connection • Unit that establishes the connection carries out a paging procedure and automatically becomes the master Medium Access in WLANs 34
Forming a Scatternet • A master or slave in one piconet can become the slave in another piconet by being paged by the master in that piconet • Example: the master of piconet 2 is a slave in piconet 3 • Details not yet defined in BT specifications Medium Access in WLANs 35