detected

A
Link Layer
B
Message M
• Problem: Given a message M at a node A
consisting of several packets, how do you send
the packets to a “neighbor” node B
– Neighbor: A node attached to the same link
– Link can be point-to-point or broadcast
– Link can be guided media (a copper, coax, fiber wire)
or unguided media (wireless)
1
Link and Physical Layers
Message M
A
link
physical
link
physical
B
• This communication problem is handled by 2 protocols
– A Link Layer (LL) that sits on top of the physical layer (PL) and
deals with
•
•
•
•
Packet Encapsulation, Mux/Demux
Framing – Detecting frame boundaries
Error Detection/Recovery – Detecting corrupt frames
Media Access Control (if the link is multi-access or broadcast)
• Reliable delivery, flow control? – Optional
– A Physical Layer (PL)
• deals with encoding/decoding bits of a frame to/from the link
2
Broadcast Links, Addressing
and Media Access Control
Message M
A
link
physical
link
physical
C
link
physical
B
• In a broadcast link, there are two additional issues that
must be resolved
– How do the nodes agree on who gets to use the link next?
• Called the Media Access Control problem
– How does A tell that the frame is destined to B not to C?
• Addressing problem: Each station must have a UNIQUE address,
called the Media Access Control (MAC) address
3
MAC Addresses
• Typically 48 bit (for most
LANs)
– burned in adapter ROM
Broadcast
Link
(LAN)
• Flat addresses, i.e., no
hierarchical organization
• Address space assigned
and managed by IEEE
– Manufacturer buys portion
of MAC address space to
ensure GLOBAL uniqueness
• Special LAN broadcast
address
– FF-FF-FF-FF-FF-FF
4
Media Access Control Protocols
Three broad categories:
• Channel Partitioning
– divide channel into smaller “pieces” (time slots,
frequency), allocate piece to node for exclusive use
• TDM, FDM
• Random Access
– allow collisions
– “recover” from collisions
• “Taking turns”
– tightly coordinate shared access to avoid collisions
Goal: efficient, fair, simple, decentralized
5
Random Access MAC Protocols
• When node has packet to send
– transmit at full channel data rate R.
– no a priori coordination among nodes
• two or more transmitting nodes -> “collision”,
• Random Access MAC protocol specifies:
– how to detect collisions
– how to recover from collisions (e.g., via delayed
retransmissions)
• Examples of random access MAC protocols:
– ALOHA , slotted ALOHA, CSMA, CSMA/CD
6
CSMA: Carrier Sense Multiple Access
• Listen before transmit:
– If channel sensed idle: transmit entire pkt
– If channel sensed busy, defer transmission
• Persistent CSMA:
– retry immediately with probability p when channel
becomes idle
• Non-persistent CSMA:
– retry after random interval
7
CSMA Collisions
collisions can occur:
spatial layout of nodes along ethernet
propagation delay means
two nodes may not hear
each other’s
transmission
collision:
entire packet transmission
time wasted
note:
role of distance and
propagation delay in
determining collision prob.
8
CSMA/CD (Collision Detection)
• CSMA/CD: carrier sense multiple
access/collision detect
– collisions detected within short time
– colliding transmissions aborted, reducing channel
wastage
– persistent or non-persistent retransmission
• collision detection:
– For wired LANs: measure signal strengths, compare
transmitted, received signals
9
CSMA/CD Collision Detection
10
“Taking Turns” MAC protocols
Polling:
• master node “invites”
slave nodes to
transmit in turn (USB)
• Request to Send, Clear
to Send msgs (802.11)
• concerns:
– polling overhead
– latency
– single point of failure
(master)
Token passing:
• control token passed from
one node to next
sequentially.
• token message
• concerns:
– token overhead
– latency
– single point of failure (token)
• Used in USB
11
Functionality of a LL With MAC
Datagram
Protocol
Datagram
H
H
Datagram
Y
D-MAC == MyMAC ||
D-MAC == FFFFFFFFFFFF
EDC
LL Frame
LL
Datagram
LL
H
All
bits in D’
OK?
Media Access Control
Link
N
Drop
the frame
Y
Add Framing
Information
N
Detected error
D’
EDC‘
Decode Bits
from the Link
PL
PL
Encode Bits
to the Link
Datagram
Link
12