Sunday, March 27, 2011

802.11 MAC (Media Access Control)


802.11 MAC (Media Access Control)

The following section describes the common Media Access Control layer used by the 802.11 family of standards.
The 802.11 family uses a MAC layer known as CSMA/CA (Carrier Sense Multiple Access/Collision Avoidance) NOTE: Classic Ethernet uses CSMA/CD - collision detection). CSMA/CA is, like all Ethernet protocols, peer-to-peer (there is no requirement for a master station).
In CSMA/CA a Wireless node that wants to transmit performs the following sequence:
  1. Listen on the desired channel.
  2. If channel is idle (no active transmitters) it sends a packet.
  3. If channel is busy (an active transmitter) node waits until transmission stops then a further CONTENTION period. (The Contention period is a random period after every transmit on every node and statistically allows every node equal access to the media. To allow tx to rx turn around the contention time is slotted 50 micro sec for FH and 20 micro sec for DS systems).
  4. If the channel is still idle at the end of the CONTENTION period the node transmits its packet otherwise it repeats the process defined in 3 above until it gets a free channel.
csma ca
CSMA/CA Protocol
Key:
  1. D = DCF Inter Frame Space (DIFS)
  2. S = Short Inter Frame Space (SIFS)
  3. CW = Contention Window
  4. MPDU = MAC Protocol Data Unit
  5. A = Ack
802 11 also offers a polling mode (known as PCF - Point Co-ordination Function) which is fairly classic polling scheme e.g. 3270 bi-sync!! As with all polling protocols a single master (Base Station) is required.
To improve efficiency additional features are employed:
  1. Positive Acknowledgement (ACK)
  2. MAC level retransmission
  3. Fragmentation

ACKing

At the end of every packet the receiver, if it has successfully received the packet, will return an ACK packet (if not received or received with errors the receiver will NOT respond i.e. there is no NACK). The transmit window allows for the ACK i.e. CONTENTION period starts after the ACK should have been sent.

MAC level retransmission

If no ACK is received the sender will retry the transmit (using the normal CSMA/CA procedures) until either successful or the operation is abandoned with exhausted retries.
Fragmentation
Bit error rates on wireless systems (10**-5, 10**-6) are substantially higher than wire-line systems (10**-12). Large blocks may approach the number of bits where the probability of an error occurring may = 1 i.e. every block could fail including the re-transmission. To reduce the possibility of this happening large blocks may be fragmented by the transmitter and reassembled by the receiver node e.g. a 1500 byte block (12,000 bits) may be fragmented into 5 blocks of 300 bytes (2,400 bits). While there is some overhead in doing this - both the probability of an error occurring is reduced and, in the event of an error, the re-transmission time is also reduced.

The Hidden Node Problem

The hidden node problem occurs in a point to multi-point network and is defined as being one in which three (or more nodes) are present. Node A, Node B and Node C. It is possible that in this case Node B can hear Node A (and vice versa) and Node B can hear Node C (and vice versa) BUT Node C cannot hear Node A. In a CSMA/CA environment Nodes A and C would both properly transmit (they cannot hear each other on the 'listen' phase so could both simultaneously and properly transmit a packet) but Node B would get corrupted data.  Nodes A and C are said to be 'hidden' from each other.
hidden node

Use of RTS and CTS

Hidden Nodes are solved by the use of a RTS (request to send)/CTS (clear to send) protocol prior to packet transmission. In our three node network above Node A sends a small RTS packet which is heard by Node B which send a small CTS packet which is heard by both Nodes A and Node C. Node C will not transmit in this case.
CSMA - RTS
CSMA/CA with RTS/CTS
Key:
  1. D = DCF Inter Frame Space (DIFS)
  2. S = Short Inter Frame Space (SIFS)
  3. CW = Contention Window
  4. MPDU = MAC Protocol Data Unit
  5. A = Ack

Node Identification

Each node in a 802.11 network is identified by its MAC address (exactly the same as Ethernet a 6 byte - 48 bit value). Receiving nodes recognize their MAC address.

Access Points

MAC Packet Format

The following defines the format of an 802.11 packet (for 802.3 packet format see here)
Frame ControlDuration IDAddress1
(source)
Address2
(destination)
Address3
(rx node)
Sequence ControlAddress4
(tx node)
DataFCS
22666260 - 2,3124
Values:
NOTE: Bits are numbered right to left (i.e. bit number is same as 2**n)
FieldBitsValuesNotes/Description
Frame
Control
15 - 14 Protocol version. Currently 0
 13 - 12 Type
 11 - 8 Subtype
 7 To DS. 1 = to the distribution system.
 6 From DS. 1 = exit from the Distribution System.
 5 More Frag. 1 = more fragment frames to follow (last or unfragmented frame = 0)
 4 Retry. 1 = this is a re-transmission.
 3 Power Mgt. 1 = station in power save mode, 1 = active mode.
 2 More Data. 1 = additional frames buffered for the destination address (address x).
 1 WEP. 1 = data processed with WEP algorithm. 0 = no WEP.
 0 Order. 1 = frames must be strictly ordered.
Duration ID15 - 0 For data frames = duration of frame. For Control Frames the associated identity of the transmitting station.
Address 147 - 0 Source address (6 bytes).
Address 247 - 0 Destination address (6 bytes).
Address 347 - 0 Receiving station address (destination wireless station)
Sequence Control15 - 0  
Address 447 - 0 Transmitting wireless station.
Frame Body  0 - 2312 octets (bytes).
FCS31 - 0 Frame Check Sequence (32 bit CRC). defined in P802.11.

No comments:

Post a Comment