Medium Access Control (MAC) Sublayer

Download Report

Transcript Medium Access Control (MAC) Sublayer

More on the link layer
Logical Link Control (LLC)
Medium Access Control (MAC)
SMU
CSE 4344
link layer functions
• services
•
•
•
•
•
– un-ACKed connectionless
– ACKed connectionless
– ACKed connection oriented
framing
encoding
error control
flow control (vs. congestion control?)
MAC
SMU
CSE 4344
point-to-point vs. broadcast media
• point-to-point
– PPP for dial-up access
– point-to-point link between Ethernet switch and host
• broadcast (shared wire or medium)
– traditional Ethernet
– 802.11 wireless LAN
SMU
CSE 4344
data link protocols (logical)
• unrestricted simplex
• simplex stop-and-wait
• simplex for noisy channel
– discussion
• sliding window protocols
SMU
CSE 4344
sliding window protocols
• piggybacked ACKs
– less overhead (bandwidth, interrupts, buffering, ...)
– how to deal with timeouts?
• sequence numbers
• sending window
• receiving window
SMU
CSE 4344
1-frame sliding window
SMU
CSE 4344
1-bit sliding window
(seq#, ACK#, pkt#); ACK#: last OK frame
SMU
CSE 4344
pipelining
• idea
– do not block transmitter during the roundtrip time
– increase the window size
• what happens with errors
– go back n
– selective repeat
SMU
CSE 4344
go back n
• if error
–
–
–
–
–
SMU
receiver discards subsequent frames
no ACKs for the discarded frames
receiver window size = 1
transmitter times-out, resends unACKed frames
inefficient if the error rate is high
CSE 4344
selective repeat
• if error
–
–
–
–
–
SMU
receiver still stores the subsequent good frames
transmitter retransmits the bad frame
receiver window size > 1
efficient at higher error rate
trade-off between bandwidth and buffer space
CSE 4344
sliding window schemes
“go back n”
(a) “go back n” (frames received out of sequence discarded)
(b)( “selective repeat” (frames received out of sequence buffered)
a
(after error, receiver may NAK frame 2 to short-circuit sender timeout)
SMU
CSE 4344
3-bit sequence numbers
SMU
CSE 4344
line utilization
• b = channel capacity in bits per second
• f = frame size in bits
• R = round-trip propagation time
• frame transmission time = (f / b) seconds
• line utilization = f / (f + bR)
• if f < bR, then efficiency < 1/2
SMU
CSE 4344
window size
• sender needs n buffers for window size n
• go back n
– sender needs enough buffers for
• timeout
• RTT of frame + NACK
• selective repeat
– window size = floor((maxseq+1)/2)
– why?
• optimal window size, sequence#s
SMU
CSE 4344
(review this in detail)
protocol specification by FSM
(a) state diagram; key to state ovals: (SRC), S in {0,1}, R in {0,1}, C in {0,1,A,-}
(b) transition chart
(from Tanenbaum text)
SMU
CSE 4344
(review this in detail)
Petri net for simplex “wait for ACK”
•
•
•
•
[Tanenbaum 4/e, 233]
places, tokens, transitions, input/output arcs
tokens not conserved
no composite states:
sender, receiver, channel separated
• transitions may be viewed as a “grammar”
SMU
CSE 4344
multiple access protocols
• single shared broadcast channel
– multiple nodes can speak at once
– collisions lead to garbled data
• multiple access protocol (medium access control)
– distributed algorithm for sharing the channel
– algorithm determines which node can transmit
SMU
CSE 4344
types of MAC
• static bandwidth allocation: channel partitioning
–
–
–
–
TDM
FDM
CDMA (see handout)
problems?
• deterministic sharing
– token-passing
– polling
– reservations, scheduling
• contention
– random access: allow collisions, and then recover
– ALOHA, CSMA, more
SMU
CSE 4344
“taking turns” MAC protocols
polling
token passing
• master node “invites”
slave nodes to
transmit in turn
• control token passed from one
node to next sequentially
• concerns:
– polling overhead
– latency
– single point of failure
(master)
SMU
• token message
• concerns:
– token overhead
– latency
– single point of failure (token)
CSE 4344
token rings
• (a) transmit token after frame is sent
• (b) transmit token while frame is being stripped
SMU
CSE 4344
ring topology
• self-healing ring (SHR)
SMU
CSE 4344
random access protocols
• when node has packet to send
– transmit at full channel data rate
– no a priori coordination among nodes
• >= 2 nodes transmit concurrently ➜ “collision”
• random access MAC protocol specification
– collision detection
– collision recovery
• examples
– ALOHA, slotted ALOHA
– CSMA, CSMA/CD, CSMA/CA
SMU
CSE 4344
key ideas of random access
• station model
– n independent stations (nodes, terminals)
• single channel
– all transmission/reception on shared channel
– nodes have equivalent ability
– node priority may vary dynamically
• time
– continuous
– slotted (discrete, timed intervals, “master clock”)
SMU
CSE 4344
key ideas of random access
• carrier sense (or not)
– listen before speaking, and don’t interrupt
– check if someone else is already sending data ...
– … wait till the other node is done
• collision detection (or not)
– if someone else starts talking at the same time, stop
– if the data on the wire is garbled ...
– ... another node is transmitting, too, so stop
• randomness
– don’t start talking again right away
– wait for a random time before trying again
SMU
CSE 4344
pure ALOHA
in pure ALOHA, frames are transmitted at completely
arbitrary times
temporal collisions destroy colliding frames
send when data arrives; if collision, random delay, resend
SMU
CSE 4344
ALOHA
Vulnerable period for the shaded frame.
shaded frame vulnerability period modeled as two frame times
intuition: collisions of partially-overlapping frames
slotted ALOHA:
during contention, frames collide in some single slot/frame time
SMU
CSE 4344
slotted ALOHA
assumptions
operation
• all frames same size
• when node obtains fresh
frame, transmits in next slot
• time divided into equal slots
(time to transmit a frame)
• nodes start to transmit
frames only at start of slots
• nodes are synchronized
• if two or more nodes
transmit, all nodes detect
collision
SMU
• no collision: node can send
new frame in next slot
• collision: node retransmits
frame in each subsequent
slot with probability p until
success
CSE 4344
pure vs. slotted ALOHA
Throughput versus offered traffic for ALOHA
systems.
max throughput: ALOHA 1/(2e) ~ 18%; slotted ALOHA 1/e ~ 37%
SMU
CSE 4344
CSMA: carrier sensing multiple access
• 1-persistent CSMA:
–
–
–
–
if idle, send; ... ; if collision, random delay, sense ...
propagation delay → collision
“two nodes waiting for idle” → collision
idea behind Ethernet LAN protocol
• non-persistent CSMA:
– if idle, send; else, random delay
• p-persistent CSMA (slotted time):
– if idle, send with probability p; if collision, random
delay
– slotted transmission discipline
SMU
CSE 4344
persistent and non-persistent CSMA
non-persistent CSMA: very good throughput under high load
0.01-persistent CSMA: best throughput
tolerance for delay can enhance throughput in chaotic environments
SMU
CSE 4344
collision-free protocols
basic bit-map protocol
- contention slots are constant overhead
- overhead means less as frames get large
SMU
CSE 4344
collision-free protocols
addresses:
(AND of addresses)
binary countdown protocol (log2n bits); dash indicates silence.
SMU
CSE 4344
limited-contention protocols
throughput of
contention protocols
under high load
Acquisition
probability
for a symmetric
contention channel.
~ 1/e
- motivation for hybrid deterministic/probabilistic protocols
- idea: allow contention at low load, use taking-turns at high load
SMU
CSE 4344
adaptive tree walk protocol
tree for eight stations: depth first search, LR
nodes
- at idle, each station ready to send data signals 1 or not,
according to a clever plan
- example: only station H ready to send:
slot1 = 1 (candidate sender is under 1),
s2 = 0 (not under 2), s3 = 0 (not under 6),
s4 = 0 (not G), s5 = 1 (H).
- for binary tree, sender is chosen in O(log2(n)) time
SMU
CSE 4344
WDM access protocol (one example out of 100s)
Wavelength division multiple access.
- fixed data output & control input
- tunable data input & control output
- on control channel: control slots; on data channel, status slot
- classes of traffic: CBR, VBR, datagram
SMU
CSE 4344
IEEE 802.3: Ethernet
•
•
•
•
•
•
•
[Metcalfe, Boggs, 1976]: first LAN, “the Ethernet”
TCP/IP/Ethernet: a connectionless stack
simple to use, reliable, cheap, scalable
LAN collision domains (broadcast) (bus, hub)
store-and-forward switches, point-to-point links
10 Mbps, 100 Mbps, gigabit, 10 gigabit
becoming very rare for network paths not to
traverse any Ethernet links
SMU
CSE 4344
“original flavor” 10 Mbps Ethernet
common kinds of Ethernet cabling
only twisted pair and fiber are still being deployed
(except in specialized environments)
SMU
CSE 4344
10 Mbps (“plain”) Ethernet PHY
(a) and (b) (10base5, 10base2) seldom deployed
(c) 10baseT hub is a collision domain
SMU
CSE 4344
10 Mbps Ethernet PHY topologies
- broadcast medium
- same logical topologies
- no loops (rings) allowed
SMU
-no path has > 4 repeaters
- network diameter <= 2500 m
CSE 4344
intermission
SMU
CSE 4344
Ethernet MAC sublayer protocol
- no two nodes are farther apart than A and B
- τ is the diameter of the network,
the one-way propagation time between the farthest nodes
SMU
CSE 4344
Ethernet: CSMA/CD (Collision Detection)
contention slot time = 2τ = max(signal round-trip time)
(10 Mbps Ethernet slot = 51.2 microsec = 512 100-nanosec-wide bits)
contention period: series of slot-length collisions/jamming frames
half-duplex: cannot receive while listening for own transmission collision
 sense; if idle, send; if collision, abort, random delay
SMU
CSE 4344
performance of Ethernet
efficiency of 10 Mbps Ethernet, 512-bit slot times
SMU
CSE 4344
switched Ethernet vs. hub
half-duplex
“collision domain”
full-duplex point-to-point links
SMU
CSE 4344
100 Mbps (“fast”) Ethernet cabling
T4: 4 each, “cat 3” unshielded twisted pairs,
3 pairs simplex forward, 1 pair simplex reverse (dynamic)
ternary encoding (trits, not bits)
TX: 2 each cat 5 unshielded twisted pairs (opposing simplex)
FX: 2 multimode fiber (opposing simplex), point-to-point links only
SMU
CSE 4344
gigabit Ethernet cabling
100 m and 25 m copper segments used,
e.g., in data center or POP of ISP
SMU
CSE 4344
Ethernet MAC sublayer framing
(a) DIX (Digital, Intel, Xerox)
(b) IEEE 802.3
preamble: for receiver clock sync
dest addr: 0* unicast, 1* multicast, all 1s broadcast
type: network protocol to call at dest,
OR
length: # data bytes (“type” embedded in data)
pad: frame length (without preamble) >= 64 bytes = 512 bits
SMU
CSE 4344
Why MAC is a sublayer
• Ethernet (one of the MAC protocols) interfaces
directly to network layer (IP)
• the Ethernet MAC offers best-effort, no-guarantee,
datagram service
• this is great for TCP/IP, nothing else is needed
• but, other network layer protocols expect link layer
error control and flow control services
• IEEE 802.2 (LLC) supports these services, built on
various MAC sublayers (e.g., Ethernet)
SMU
CSE 4344
IEEE 802.2: logical link control
- Ethernet MAC sends best effort datagrams
- LLC supports flow-control & error-control
PHY
PHY
(a) network layer sees the same LLC, regardless of type of MAC
(b) LLC encapsulates network layer packet,
MAC encapsulates LLC frame before passing to PHY
SMU
CSE 4344
wireless LANs
• IEEE 802.11 (“WiFi”)
• Distributed Coordination Function (DCF )
– CSMA-CA
• Point Control Function (PCF)
– centrally controlled by basestation (access point)
• short-range RF (rooms, battlefields)
• ad hoc and basestation flavors
• many PHY layer options
– 802.11, 802.11a, 802.11b, 802.11g, 802.11n (pre-std)
SMU
CSE 4344
The 802.11 Protocol Stack
1-2 Mbps
54 Mbps 11 Mbps 54 Mbps
1997
SMU
1999
CSE 4344
2001
CSMA fails off the wire
why CSMA falls short in packet radio networks
and mobile ad hoc networks
C wants to send to B
C wants to send to D
channel sounds clear to C
channel sounds busy to C
C cannot hear A
D cannot hear B
the “hidden station problem”
the “exposed station problem”
(not “unhidden station problem”)
SMU
CSE 4344
wireless LAN protocols (CSMA-CA)
MACA(W), multiple access collision avoidance:
A sends RTS to B, B sends CTS to A
all potential “interrupters” hear B's CTS, wait for frame
(“W”ireless: sense first, ACK every frame, sophisticated backoff)
SMU
CSE 4344
802.11 MAC sublayer protocol
The use of virtual channel sensing using
CSMA/CA.
- C hears A’s RTS … D hears B’s CTS
(NAV: transmitter quiet time)
- notice how politely C and D each set aside time for A and B
SMU
CSE 4344
802.11 MAC sublayer protocol
A fragment burst.
- A sends a burst to B … C and D wait for it
- after each data or control frame, a system of delay intervals …
SMU
CSE 4344
802.11 delay timing
• how can PCF and DCF protocols coexist?
• end of frame or ACK starts series of timers
• {Short, PCF, DCF, Expanded} InterFrame Spacing
• Short for burst fragment, receiver ACK, or CTS
• PCF for central control (beacons, polling)
• DCF for contention (RTS)
• Extended for bad frame reporting (NAK)
SMU
CSE 4344
802.11 MAC sublayer protocol
PCF and DCF coexist in a single collision domain:
Interframe spacing in 802.11.
fragment
CTS
FRAME
dead
ACK
central ctl
RTS
NAK
ACK
the starting guns go off at different times for different frame types
SMU
CSE 4344
RF signaling
•
•
•
•
•
RF signal strength at node's own antenna
2-antenna implementation?
shared channel
RF signal strength from distant antennae
how to detect?
– interference
– fading
– multipath
SMU
CSE 4344
IEEE 802.11
• access point infrastructure largely 802.11
– 100 Million 802.11 chipsets per annum (out of date statistic)
– strong application development efforts
• IEEE 802.11 spec: CSMA-CA
– RTS/CTS channel reservation, ACK
• explicit ACK
– CSMA sender will not hear interference, fading, multipath
• contention: short RTS frames, collisions waste less
• if sender’s CTS times out, it knows the RTS failed
– random backoff (countdown proceeds while channel is idle)
SMU
CSE 4344
802.11 distribution services
• association (connect to access point cell)
– beacons in the “jungle”; “there can only be one”
– next, DHCP discovery
• disassociation
• reassociation (cell-to-cell handover)
• distribution (how to route frames)
• integration (802.11  external network format)
SMU
CSE 4344
802.11 intracell services
• authentication (challenge frame, key, encryption)
– if invoked, a pre-condition for association
• deauthentication
• privacy (data encryption)
• data delivery (best effort)
SMU
CSE 4344
802.11 data frame
- type: data, ctl, mgt; subtype: RTS, CTS, probe (scanning for new AP)
- to DS/from DS: activation of address 3, 4 for “distribution system” APs
- MF: “more frags”; retry; more (frames)
- duration, sequence
SMU
CSE 4344
broadband wireless comparison ...
• 802.11 (WiFi)
– mobile Ethernet LAN
– centralized infrastructure (APs and cell architecture)
– or, distributed architecture
• ad hoc
• mobile ad hoc (MANET)
–
–
–
–
SMU
best effort delivery
short range, half-duplex
power concerns
limited budget (commodotized)
CSE 4344
... broadband wireless comparison
• 802.16 (WiMax)
– wireless “local loop” for buildings
– metro area coverage, full duplex
– many users aggregated per endpoint
– connection oriented
– FEC (Hamming codes), security
– base station control (centralized control)
– fixed, directional antennas
SMU
CSE 4344
802.16 Protocol Stack
modulation schemes vary with range to end-points
(what is wrong with this picture?)
SMU
CSE 4344
The 802.16 Physical Layer
The 802.16 transmission environment.
SMU
CSE 4344
The 802.16 Physical Layer
- shown: TDD (time division duplexing) PHY frames
- not shown: FDD (frequency division duplexing)
- millimeter RF waves are not omnidirectional
SMU
CSE 4344
The 802.16 Frame Structure
(a) A generic frame.
SMU
(b) A bandwidth request
frame.
CSE 4344
802.16 MAC sublayer protocol
service classes
• constant bit rate service (regular slots)
• real-time variable bit rate service (regular polling)
• non-real-time variable bit rate service (frequent polling)
• best effort service (contend for request slots)
• aggregator switch at subscriber building may negotiate
with base station for all users, and arbitrate received
bandwidth between users
SMU
CSE 4344
personal area networks (PANs)
• Bluetooth (Ericsson, IBM, Intel, Nokia, Toshiba)
• “cable replacement”
• specifies complete networking stack
• TDM; 10 m; 2.4 Ghz FHSS; 79 1-MHz channels
• IEEE 802.15
– only PHY & LL
• interferes with 802.11 (2.4 GHz)
• master/slave “piconets”
• slaves can bridge piconets to form “scatternets”
SMU
CSE 4344
remarks
• networks run on various link layer technologies
– point-to-point links vs. shared media
– wide varieties within each class
• link layer performs key services
– encoding, framing, and error detection
– optionally error correction and flow control
• shared media introduce interesting challenges
– decentralized control over resource sharing
– partitioned channel, taking turns, and random access
– Ethernet as a wildly popular example
• next: switches and bridges
SMU
CSE 4344
summary/glossary
SMU
CSE 4344