Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r...

33
Data Link Layer

Transcript of Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r...

Page 1: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

Data Link Layer

Page 2: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

Useful References

Wireless Communications and Networks by William Stallings

Computer Networks (third edition) by Andrew Tanenbaum

Computer Networking (second edition) by J. Kurose and K. Ross

Page 3: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

Network protocol stack application: supporting network

applications FTP, SMTP, STTP

transport: host-host data transfer TCP, UDP

network: routing of datagrams from source to destination IP, routing protocols

link: data transfer between neighboring network elements PPP, Ethernet

physical: bits “on the wire”

application

transport

network

link

physical

Page 4: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

Links

A communication path consists of a series of communication links, starting at the source host, passing through a series of routers and ending at the destination host.

How are packets sent across individual links within the end-to-end communication path?

Page 5: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

Multiple Access Links and Protocols

Two types of “links”: 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

Page 6: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

Multiple Access protocols Single shared broadcast channel Two or more simultaneous transmissions by nodes:

interference Only one node can send successfully at a time

A multiple access protocol is characterized as follows:

Distributed algorithm that determines how nodes share channel, i.e., determine when node can transmit

Communication about channel sharing must use channel itself!

Page 7: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

Ideal Multiple Access Protocol

Broadcast channel of rate R bps1. When one node wants to transmit, it can send

at rate R.2. When M nodes want to transmit, each can

send at average rate R/M3. Fully decentralized:

no special node to coordinate transmissions no synchronization of clocks, slots

4. Simple

Page 8: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

MAC Protocols: a taxonomy

Three broad classes: Channel Partitioning

Divide channel into smaller “pieces” (time slots, frequency, code)

Allocate piece to node for exclusive use

Random Access Channel not divided, allow collisions “recover” from collisions

“Taking turns” Tightly coordinate shared access to avoid collisions

Page 9: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

Channel Partitioning MAC protocols: TDMA

TDMA: Time Division Multiple Access Access to channel in "rounds" Each station gets fixed length slot (length =

pkt trans time) in each round Unused slots go idle Example: 6-station LAN, 1,3,4 have pkt, slots

2,5,6 idle

Page 10: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

Channel Partitioning MAC protocols: FDMA

FDMA: Frequency Division Multiple Access Channel spectrum divided into frequency bands Each station assigned fixed frequency band Unused transmission time in frequency bands go

idle Example: 6-station LAN, 1,3,4 have pkt,

frequency bands 2,5,6 idle

frequ

ency

bands time

Page 11: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

Channel PartitioningCDMA (Code Division Multiple Access) Unique “code” assigned to each user; i.e., code

set partitioning Used mostly in wireless broadcast channels

(cellular, satellite, etc) all users share same frequency, but each user

has own “chipping” sequence (i.e., code) to encode data

encoded signal = (original data) X (chipping sequence)

decoding: inner-product of encoded signal and chipping sequence

Page 12: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

CDMA

Let di be the value of the data bit for the ith bit slot.

For mathematical convenience, we represent a data bit with a o value as –1.

Each bit slot is further subdivided into M minislots.

In this example, M=8 (although usually it is higher).

Page 13: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

CDMA

The CDMA code used by the sender consists of a sequence of M values: c1 c2 c3 …cM each taking a +1 or –1 value. In the example, the CDMA code being used is (1,1,1,-1,1,-1,-1,-1).

Page 14: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

CMDA Encode

For the mth minislot of the slot transmitting di, the output of the CDMA encoder Zi,m, is the value of di multiplied by the mth bit in the assigned CDMA code, cm: Zi,m = di*cm

Page 15: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

CDMA Encode/Decode

Page 16: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

CDMA Decode

The original data bit di is recovered by computing:

di = (1/M)Zi,m . Cm (m=1…M)

Page 17: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

CDMA Encode/Decode

Page 18: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

CDMA: Two-Sender Interference

The world is far from ideal. CDMA must work in the presence of

interfering senders that are encoding and transmitting their data using a different assigned code.

How then does a CDMA receiver recover a sender’s original data bits when those data bits are being tangled with bits from other senders.

Page 19: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

CDMA: Two-Sender Interference

Page 20: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

CDMA Codes must be carefully chosen so that there

is minimal interference. Codes must be orthogonal which means that

the inner product of two distinct codes should be 0

The inner product of a code with itself should be one.

The inner product of a code with its complement should be –1.

Page 21: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

CDMA Assumptions

The codes satisfy the properties mentioned earlier.

The receiver knows who the sender is. Our discussion made the assumption that the

received signal strengths from various senders at a receiver are the same; this is difficult to achieve in practice.

Page 22: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

Random Access 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: Slotted ALOHA ALOHA CSMA, CSMA/CD, CSMA/CA

Page 23: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

CSMA (Carrier Sense Multiple Access)

CSMA: listen before transmit: If channel sensed idle: transmit entire frame If channel sensed busy, defer transmission

Human analogy: don’t interrupt others!

Page 24: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

CSMA collisions

Collisions can still occur:propagation delay means two nodes may not heareach other’s transmissionCollision:entire packet transmission time wasted

spatial layout of nodes

Note:role of distance & propagation delay in determining collision probability

Page 25: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

CSMA/CD (Collision Detection)

CSMA/CD: carrier sensing, deferral as in CSMA Collisions detected within short time Colliding transmissions aborted, reducing

channel wastage Collision detection:

Easy in wired LANs: measure signal strengths, compare transmitted, received signals

Difficult in wireless LANs; can be costly Human analogy: the polite conversationalist

Page 26: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

CSMA/CD collision detection

Page 27: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

CSMA/CA Collision if 2 or more nodes transmit at same

time CSMA makes sense:

get all the bandwidth if you’re the only one transmitting shouldn’t cause a collision if you sense another

transmission

Collision detection doesn’t work: hidden terminal problem

Location

Sig

nal

Stre

ngth

Page 28: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

CSMA/CA

CSMA sender- if sense channel idle for

DIFS sec. then transmit entire frame

(no collision detection)-if sense channel busy

then binary backoffCSMA receiver- if received OK return ACK after SIFS (ACK is needed due to

hidden terminal problem)

Page 29: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

Collision Avoidance: RTS-CTS exchange

Sender transmits short RTS (request to send) packet: indicates duration of transmission

Receiver replies with short CTS (clear to send) packet Notifying (possibly

hidden) nodes

Hidden nodes will not transmit for specified duration: NAV

Page 30: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

Collision Avoidance: RTS-CTS exchange

RTS and CTS short: Collisions less likely, of

shorter duration End result similar to

collision detection

Page 31: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

“Taking Turns” MAC protocols

Channel partitioning MAC protocols: Share channel efficiently and fairly at high

load Inefficient at low load: delay in channel

access, 1/N bandwidth allocated even if only 1 active node!

Random access MAC protocols Efficient at low load: single node can fully

utilize channel High load: collision overhead

“taking turns” protocolsLook for best of both worlds!

Page 32: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

“Taking Turns” MAC protocols

Polling: Master node

“invites” slave nodes to transmit in turn

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)

Page 33: Data Link Layer. Useful References r Wireless Communications and Networks by William Stallings r Computer Networks (third edition) by Andrew Tanenbaum.

Summary of MAC protocols

What do you do with a shared media? Channel Partitioning, by time, frequency or

code• Time Division,Code Division, Frequency Division

Random partitioning (dynamic), • ALOHA, S-ALOHA, CSMA, CSMA/CD• carrier sensing: easy in some technologies (wire),

hard in others (wireless)• CSMA/CD used in Ethernet• CMSA/CA and CMSA can be used in 802.11

(discussed later) Taking Turns

• polling from a central site, token passing