+ All Categories
Home > Documents > Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim...

Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim...

Date post: 29-Jan-2016
Category:
Upload: naomi-leonard
View: 214 times
Download: 0 times
Share this document with a friend
Popular Tags:
86
Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner
Transcript
Page 1: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Data Link LayerTC625

Sources: Dr. Yusuf Ozturk, ECE Department

San Diego State University and Jim Buckner

Page 2: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Data Link Layer

• The principle service is transferring data from the network layer on the source machine to the network layer on the destination machine.

• Data link layer provides– Unacknowledged connectionless service

– Acknowledged connectionless service

– Acknowledged connection-oriented service

Page 3: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Unacknowledged connectionless service

• Source machine send independent frames to destination frame without having the destination machine acknowledge them.

• No connection is established beforehand or released afterward.

• If a frame is lost due to noise on the line, no attempt is made to recover it in the data link layer.

• Appropriate when the error rate is very low so recovery is left to higher layers.

• Also appropriate for real time traffic, such as speech in which late data are worse than lost data.

Page 4: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Acknowledged connectionless service

• There are still no connections used, but each frame sent is individually acknowledged. In this way the sender knows whether or not a frame has arrived safely. If it has not arrived within a specified time interval, it can be sent again.

• This service is usefull over unreliable channels, such as wireless systems.

Page 5: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Question

• WHY DO WE HAVE AN UNACKNOWLEDGED SERVICE AND NOT ALL THE COMMUNICATION ACKNOWLEDGED ????

Page 6: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Connection-Oriented Services

• The source and destination machines establish a communictaion before any data are transferred. Each frame sent over the connection is numbered, and the data link layer quarantess that each frame is indeed received.

• Furthermore, it quarantees that each data frame is received only once and all frames are received in the right order.

• QUESTION : IS IT POSSIBLE TO HAVE MULTIPLE COPIES OF THE SAME MESSAGE UN CONNECTIONLESS SERVICES ???

Page 7: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Connection-Oriented services

• Three phases– Connection Establishment– Data transfer– Connection release

Page 8: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Framing

• Breaking bit streams into frames

• A naive solution

Insert time gaps between frames

Problem : Networks never make any guarantees about timing, It is possiblethese gaps might be squeezed out, or othergaps may be inserted during transmission

Page 9: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Framing

• Since inserting time gaps is not acceptable we need to find out other ways handling framing– Character count– Starting and ending characters, with character

stuffing– Starting and ending flags– Physical layer coding violations

Page 10: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Framing : Character count

• Uses a field in the header to specify the number of characters in the frame.

5 1 13 2 4 2 1 3 2 5 4 4 6 2 4 7 1 3 2 5 4 2 62

Character count

What if we have an error

7 1 13 2 4 2 1 3 2 5 4 4 6 2 4 7 1 3 2 5 4 2 62

Character count error will propagate --- Now a character count ?

Page 11: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Framing: Starting and Ending Characters

DLE

DLE

DLE

STX

STX

STX

A

A

A

DLE

DLE

DLE

B

DLE

B

DLE

B

DLE

ETX

DLE

ETX

ETX

DLE : Data Link EscapeSTX : Start of TextETX: End of Text

Problem : When object program or floating point data is transmitted , we may have DLE inside the data. We may escape this accidental occurrence of DLE by inserting another DLE character. This is called character stuffing

Page 12: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Framing: Starting and Ending Flags with bit stuffing

• Each frame begins and ends with with a special bit pattern 01111110

• What if we have this sequence among the data sequence

• Bit stuffing : The sender inserts a zero where it encounters five consecutive 1s.

• 0111111001010101111101101011111001111110

Stuffed bits

The receiver will remove stuffed bits to recover the data

Page 13: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Framing : Physical layer violations

• This method is applicable if the physical medium contains some redundancy.

• We will discuss manchester encoding and differential manchester encoding with the MAC sublayer ..

• (Clock-Based Framing) SONET (Synchronous Optical Network).Two special bytes every 810 bytes (OC-1), 125 us per frame When you see enough, you can tell you are in sync!

• 810*8/(125*10^-6) = 51.84

Page 14: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Error Control

• How to make sure all frames are eventually delivered to the network layer at the destination and in the proper order.

• Failures :

– Bit errors– Hardware failures

Page 15: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Flow Control

• How to keep a fast sender to communicate with a slow receiver ? and not to overload the receiver …

• The answer is : Flow control

Page 16: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Error Detection and Correction

• Error Correction Codes : include enough redundancy with each block of information to enable the receiver to deduce what the transmitted character must have been.

• Error Detection Codes : Include only enough redundancy to allow that receiver to deduce that an error occured, but not which error.

Page 17: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

What is an error

• Consider two codewords

01100011

01110101

• Now it is possible to determine how many bits are different.

• Hamming Distance = 3 bits

• IF TWO CODEWORDS ARE A HAMMING DISTANCE D APART, IT WILL REQUIRE D SINGLE BIT ERRORS TO CONVERT ONE INTO THE OTHER..

Page 18: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Detecting-Correcting Errors• To detect d errors you will need a distance d+1

code, because with such a code there is no way d single bit errors can change a codeword into another. ( Recall that parity can only detect one bit errors)….

• To correct d errors , you will need a 2d+1 code, because the legal codewords will be so far apart that even after d single bir errors the original codeword will still be closer than all the other codewords in our dictionary.

Page 19: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Error correction

• Imagine we want to design a code with m message bits and r check bits that will allow all single errors to be corrected.

• Each or the 2m legal messages has n illegal codewords at a distance 1 from it.

• Thus each of the 2m legal messages requires n+1 bit patterns dedicated to it. Since the total number patterns is 2n, we must have

• (n+1)2m <= 2n.

• Using n=m+r, this requirement becomes (m+r+1) <= 2r

• Given m this puts a lower limit on the number of check bits needed to correct single errors.

Page 20: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Error Correction• Hamming (1950)

• Place the check bits in the bit positions which are powers of 2 ( 1,2,4,8,16,32 etc)

• All the other locations will be filled with data bits

• Each check bit may be computed by one or more data bits including itself

• 1 2 3 4 5 6 7 8 9 10 11

• x x 0 1 0 1 1 x 1 0 1

• x x 1 1 1 0 0 x 1 1 1

11-----> 8+2+110------>8+29 ------>8+17 ------->4+2+1

6-----> 4+25-----> 4+13 ----> 2+1

Check bit 1 will be computed from 11,9,7 ,5,3

Check bit 2 from 11, 10, 7, 6, 3

Page 21: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Parity

Even Parity 01001110

Data Parity

0

01001100 1

Odd Parity 01001110 1

01001100 0

Parity bit provides weak error detection: parity will fail to detect 50% of errors involving 2 or more bits.

Parity is often used for low-speed communications. Asynchronous communications usually use odd parity (why?).

Page 22: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Two Dimensional Parity

01001110

Data Parity

1

00000000 1

01000010 1

01001100 0

Two-dimensional parity will detect all errors involving 1 - 3 bits, and most 4 bit errors. May miss many burst errors.

Disadvantage: uses lots of bits for parity, but error detection is still not strong.

11000000 1

01001100 000110011 1

colum

n pa

rity

row parity

Page 23: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Internet Checksum

01001110

Data

00000001

01000010

00001100

Sum data as 16-bit words using ones complement arithmetic.

11000000+ 00001100

101111001

1

01111010

Su

m da

ta in

fram

e as

16-b

it word

s

10010001

1010100011

01010010

+ 11000000

Ones complement arithmetic

Checksum:

Page 24: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Internet ChecksumProvides weak error detection -- misses some 2 bit errors.IP packets use 16-bit checksum. The checksum is calculated over all header fields, including the checksum itself (initially set to zero), then the bitwise complement is taken.

Version HLen TOS Length

Ident Flags Offset

TTL Protocol Checksum

SourceAddr

DestinationAddr

Options (variable) Pad(variable)

0 4 8 16 19 31

Data

IP packet header (IPv4)

Q: Why sum over the checksum itself? Why bitwise inversion?

Page 25: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Internet Checksum Algorithm

• View message as a sequence of 16-bit unsigned integers (buf)

• sum using 16-bit ones complement arithmetic• return bitwise complement of the resultu_short

cksum(u_short *buf, int count){ register u_long sum = 0; while (count--) { sum += *buf++; if (sum & 0xFFFF0000) { /* carry occurred, so wrap around */ sum &= 0xFFFF; sum++; } } return ~(sum & 0xFFFF);}

Page 26: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Cyclic Redundancy Codes

message M

T = transmitted bit stream

n+1 bits

CRC bits R

Select a CRC generator C of length k.

Let T = 2nM - R. Hence T / C = 0.

For a message M of length n+1 bits, the sender computes a k bit CRC value R using a pre-defined divisor C.R is appended to the message bits and transmitted.The receiver divides the augmented message string by C. If the result is zero, the receiver assumes the message is correct.

How do we choose C so that this method has good error detection ability?

Shift the message M left by k bits, e.g. 2kM

Find the remainder R = 2kM / C using binary polynomial arithmetic (no carry)

Transmit T.

Receiver checks T / C. Should be 0.

k bits

Page 27: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Binary Polynomial Arithmetic

Addition and Subtraction are the same as bitwise XOR.

11010+ 10011

01001

11010- 10011

01001

Two bit strings of same size (both with leading “1”) can divide each other. Find remainder by subtraction.

x4+x3+0+x+0+ x4+ 0+0+x+1

x3+0+0+1

Binary bit strings correspond to binary polynomials.

11010 is equivalent to x4+x3+0+x+0

x4+x3+0+x+0- x4+ 0+0+x+1

x3+0+0+1

1 10100 10001

-10100Remainder: 101

1 x4+ 0+ x2 x4+0+ 0+0+1

- x4+0+x2+0+0

x2+0+1

Page 28: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

CRC Example

Frame with checksum: 11010110111110

CRC calculation:

10011/11010110110000-10011.........1001110110000

-10011........10110000-10011...0101000-10011.

Remainder: 1110

Frame: 1101011011

CRC Polynomial: C = x4 + x + 1.

CRC Polynomial as bits: 10011Frame with 0’s appended: 11010110110000

Page 29: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Standard CRC PolynomialsName Polynomial Used in

CRC-8 x8 + x2 + x + 1 ATM

CRC-10 x10 + x9 + x5 + x4 + x + 1 ATM

CRC-12 x12 + x11 + x3 + x2 + x + 1

CRC-16 x16 + x15 + x2 + 1

CRC-CCITT x16 + x12 + x5 + 1 HDLC

CRC-32 x32 +x26 +x23 +x22 +x16 +x12 +x11 Ethernet, ATM,

+ x10 + x8 + x7 + x5 + x4 + x2 + 1 802.5 Token Ring

Page 30: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Standard CRC Polynomials

Properties of standard CRC polynomial of degree n

• detects all 1 and 2 bit errors• detects all errors involving an odd number of bits• detects all burst errors of length n or less (i.e., first

and last bits of burst are in error, middle bits may be)

• probability of not detecting a burst error of length n+1 is only 1/2n-1

• probability of not detecting a burst error of length n+2 or longer is only 1/2n

Page 31: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Example:

CRC-16 will detect all burst errors of length 16; the probably of detecting a 17-bit burst error is 99.97%; and the probably of detecting an 18-bit or longer burst error is 99.998%.

Page 32: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

How are the CRC Polynomials Chosen?

The CRC polynomial C(x) is chosen so that an error is unlikely to be evenly divisible by C(x). Let E(x) represent an error.

The receiver gets: T(x) + E(x) and computes: (T(x) + E(x))/C(x) = T(x)/C(x) + E(x)/C(x)

The error will not be detected if and only if E(x) is divisible by C(x).

Page 33: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Single-bit errors: if the CRC polynomial has non-zero leading/ending terms, then a single bit error (E = xp) is not divisible by C(x).

Double-bit errors (E = xi+ xj): as long as C(x) contains a factor with at least three terms, E cannot be divided by C.

Odd number of errors: if C(x) contains the factor (x + 1) then E is not divisible by C.

Burst error of length less than or equal to k: E(x)=xi(xj +...+ 1) ; if C contains a constant “1” term, C won’t divide E.

Page 34: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

CODE RATE

• A measure of coding efficiency can be computed by calculating the code rate.

E=Bi

Bt

=Information bits per symbol

Total bits per symbol

For example ASCII code with one bit parity

E=7

8= 87.5 %

Page 35: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

DLL PROTOCOLS

Network Layer

Data Link Layer

Framing ( What is a frame ?)

Error control

Network Layer

Data Link Layer

The data is framed and some error correction capability is introduced. The next problem is to get this frame to the receiver

Page 36: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Data Link Layer

Network Layer

Physical Layer

From Physical LayerTo Physical Layer

To Network LayerFrom network Layer

Page 37: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Data Link Layer Wait_for_event(&event)

case(event)

xx: ?????????????

xx: ?????????????

xx: ?????????????

` xx: ?????????????

default :

end {end case}

Consider an event based structure ….

Page 38: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

FRAME

Header Data Trailer

kind : what kind of frame is this ?

seq : sequence number

ack : acknowledgement number

Page 39: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

PACKET - FRAME

Network Layer

packetpacketpacketpacketpacket

Data link layer

packettraile

rHEADER

A single packet may fill one frame or more than one frame. Also it is possible to combine more than one packets into a single frame..

Page 40: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Some primitive procedures

• to_network_layer

• from_network_layer• to_physical_layer• from_physical_layer• start_timer• stop_timer• enable_network_layer• disable_network_layer

Page 41: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Unrestricted Simplex

Sender Receiver

No sequence numbers

No acknowledgements

No errors

No flow control

Receiver infinitely fast

UNREALISTIC

Page 42: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Simplex Stop-and-Wait

Sender Receiver

Data

Ack

Each frame needs to be acknowledged

Prevents the fast sender overload the receiver

No error correction

No timeout , No resend , Not feasible in an errornous channel

Page 43: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Simplex for a Noisy Channel

Sender Receiver

DataAck

NackResent Data

Page 44: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Simplex for a Noisy Channel

Sender Receiver

Data

Start Timer

Timeout

Resent Data

The receiver has not responded with an ack nor nack message.

POSSIBLE SCENARIOSCLASS DISCUSSIONPLEASE GET READY

Page 45: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Sliding Windows Protocols

• Two way communication– Best if we have separate channels for incoming

and outgoing traffic– Piggybacking Piggybacking

• embed the acknowledgement into the data frames

• Allows better utilization of the channel

• What are the Complications of piggybacking ????

Page 46: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Sliding Window Protocols

• Each outbound frame contains a sequence number from 0 to some maximum. The maximum is usually 2n-1 so that the sequence frame nicely fits into n bits.

• The stop and wait protocol introduced earlier uses n=1, restricting the sequence numbers to zero and one.

0 1 2 3 4 5 76

0 1 2 3 4 5 76

Senders Window

Receiver’s Window

Page 47: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

0 1 2 3 4 5 76

0 1 2 3 4 5 76

0 1 2 3 4 5 76

0 1 2 3 4 5 76

0 1 2 3 4 5 76

0 1 2 3 4 5 76

0 1 2 3 4 5 76

0 1 2 3 4 5 76

INITIAL

AFTER THE FIRST FRAME SENT

AFTER THE FIRST FRAME HAS BEEN RECEIVED

AFTER THE FIRST FRAME HAS BEEN ACKNOWLEDGED

FRAME SENT BUT NOT ACKNOWLEDGEDTHE FRAMES THAT MAY BE ACCEPTED

Page 48: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

One Bit Sliding WindowA sends (0,1,A0)

B gets (0,1,A0)B sends (0,0,B0)

A gets (0,1,B0)A sends (1,0,A1) B gets (1,0,A1)

B sends 1,1,B1)

A gets (1,1,B1)A sends (0,1,A2) B gets (0,1,A2)

B sends (0,0,B2)

A gets (0,0,B2)A sends (1,0,A3) B gets (1,0,A3)

B sends (1,1,B3)

(XX,YY,ZZ)

Packet Number

Acknowledgement(Number of the last frame receoved without error)

Sequence number(Number of the frame sent)

Page 49: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

PIPELINING• When the round trip travel time is much higher than the

transmission time to put messages onto the physical medium.

• PIPELINING

– PUSH MORE THAN ONE FRAMES INTO THE CHANNEL BEFORE ACCEPTING AN ACKNOWLEDGEMENT..

– FLOW CONTROL INVOLVES TWO ALTERNATIVES

• GO-BACK-N

• SELECTIVE REPEAT

Page 50: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

GO BACK N

• IN CASE OF AN ERROR THE RECEIVER WILL REJECT ALL THE FRAMES UNTIL A CORRECT VERSION OF THE MISSING FRAME IS GIVEN TO THE NETWORK LAYER.

• DOES NOT BUFFER FRAMES

• DOES NOT REQUIRE MUCH BUFFER SPACE BUT CONSUMES CHANNEL CAPACITIY

• EACH FRAME SHOULD HAVE A SEPARATE TIMEOUT FIELD AND SHOULD TIME OUT INDEPENDENT OF ALL OTHER FRAMES.

Page 51: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

SELECTIVE REPEAT

• RECEIVER BUFFERS ALL FRAMES WITHIN THE ALLOWED WINDOW SIZE AND REQUESTS A RETRANSMISSION OF THE FRAME RECEIVED IN ERROR.

• UTILIZES BANDWITH BETTER BUT REQUIRES MOR BUFFER SPACE AND ADDS COMPLEXITY TO THE ALGORITHM.

• EACH FRAME NEEDS TO HAVE ITS OWN TIMEOUT..

Page 52: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Performance Issues

Assume stop and Wait protocol ( Every frame needs to be acknowledged)

Assume n frames are to be sent from Station 1 to Station 2

Than the Total time to send the data can be written as T=Tpropagation + Tframe+Tprocessing+ Tpropagation + Tacknowledge+Tprocessing

Assume Tprocessing is negligible and Tacknowledge is relatively small

Then T=n(2 Tpropagation + Tframe )

of this time only n*Tframe is spent to transmit data , the rest is overhead

Page 53: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Performance Issues

• Then Utilization of the link can be written as

• U=n*Tframe/n*(2Tpropogation+Tframe)

• U= Tframe/(2Tpropogation+Tframe)

• PROPAGATION TIME

d= distance of link

V=velocity of propagationTpropogation = d/V

V=3*108 m/sec for unguided transmission

V=3*108 m/sec for fiber

V=3*108 *0.67 for fiber

Define a= Tprop/Tframe

then

U=1/(1+2a)

This is maximum utilization

Page 54: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Performance Issues

• Transmission time = L/R = Frame length in bits/ Data Rate

• a=(d/V)/(L/R) = (R*d) /(V*L)

• Thus for fixed frame length and fixed distance

• a is proportial to Data rate/ Velocity of propogation

Page 55: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Performance Issues

S1S2

d=1000 kmFrame size = 424 bitData Rate = 155.52 Mbits/sec

Transmission time = 424/(155.52 * 106) = 2.7*10-6 secAssuming optical fiber usedTpropagation = 106 meters /3*108 m/sec =0.33*10-2 sec

Thus a=0.33 *10-2 / 2.7 *10-6 = 1200U=1/(1+2a) = 0.0007 !!!!

Page 56: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Performance Issues

• V=2*108m/sec

• Frame size = 1000 bits

• Data rate = 10Mbits/sec

• d=1000 meters

• Tpropogation = 1000/2*108 m/sec = (1/2) 10-5 sec

• Ttransmission = 1000/10*103 = 0.1 sec

• a=(1/2)10-5/10-1 = (1/2) * 10-4

• U=1/(1+2a) = 1/(1+2*(1/2)*10-4) = ?????%

Page 57: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

PERFORMANCE ISSUES

• For a sliding windows protocol the efficiency of line depends on both window size N and the value of a.

• Now assume Transmission time = 1, then a=Propogation time

A BStart of frame1

t0

Frame -1

Frame -2

Frame - Frame -

[a-1]Frame -

[a]

Ack -1

Frame -[a+2]

Frame -[a+3]

Frame - Frame -

[2a]Frame -[2a+1]

Page 58: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

PERFORMANCE ISSUESTwo important cases

N > 2a+1 The acknowledge for frame 1 reaches A before A has exhausted its window, Thus A can continue transmission with no pause, Utilization is 1.

N<2a+1 , An exhaust occurs at t0+N and can not send frames until t0+2a+1. Thus line utilization is N time units out of a (2a+1) period

U= 1 for N>2a+1

U=N/(2a+1) for N<(2a+1)

Page 59: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

TRIB

• Transfer Rate of Information Bits

Number of Information bits

Time to take information bits from sender to receiver=

ninfo

t3

t3 = N(data) + N(ack)

Bit transmission rate of the channel

Page 60: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

TRIB

• 1000 character message of ASCII text

• Half Duplex Asysnchronous Channel

• 1200 bps circuit

• Retransmission request is instantaneous

• BER = 10-5

TRIB = ??????

Page 61: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Question

• A Modem can operate at 19200 bps with a BER of 10-4 and at 38400 bps with a BER of 10-3 . Which mode would you prefer ??

• Which modem will you buy – one with BER = 10-3 and Data Rate = 38400 bps

– One with BER =10-4 and Data Rate = 19200 bps

Page 62: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

PROTOCOL VERIFICATION

• Realistic protocols and the programs that implement them are quite often complicated.

– Finite state machine– Petri Net Models

Page 63: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

FINITE STATE MACHINES

• States– Usually choosen to be those instants that the protocol

machine is waiting for the next event to occur..

• Transitions– Changes in state variables that takes the finite state

machine from one state to the next

• Initial state

• Reachability analysis

Page 64: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Finite State Machines• Formally a finite state machine model of a

protocol can be regarded as a quadruple (S,M,I,T) where– S is the set of states the processes and channel

can be in– M is the set of frames that can be exchanged

over the channel– I is the set of initial states and processes– T is the set of transitions between states

Page 65: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

HDLC - High Level Data Link Control

• Bit Oriented

• Uses bit stuffing for data transparency

01111110

Address Control Data 01111110Checksu

m

Important on lines that has multiple terminals attached

For point-to-point lines sometimes used to distinguish commands from responses

Page 66: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

HDLCControl field is used for sequence numbers, acknowledgements, and other puposes.

There are three types of framesInformationSupervisoryUnnumbered

0 Seq P/F Next

1 Type P/F Next0

1 Type P/F Modifier1

Bits 1 3 1 3I

S

U

Piggyback acknext frame expectedPOLL/FINAL

Page 67: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

0 Seq P/F NextBits 1 3 1 3

I

Used when a computer or concentrator is polling a group of terminals.

When used as P, the computer is inviting the terminal to send data

All frames sent by the terminal, except the last one, have P/F bit set to P/ The final one is set to F

Page 68: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

1 Type P/F Next0S

Type 0: Acknowledgement (Used when there is no reverse traffic to use piggybacking)

Type 1: Negative acknowledgement ( a transmission error has been detected)

Type 2: Acknowledges all frames but the next, ( Different from type 0 in that , it tells the sender stop sending)

Type 3: Selective reject ( Retransmit only the frame specified)

Page 69: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

1 Type P/F Modifier1U

Mainly used for control but can also be used for data when unreliable connectionless service is required.

DISC (Disconnect)SNRM ( Set normal response mode)SABM( Set asynchronous balanced mode)SABMESNRMEFRMR (Frame reject)UA ( Unnumbered acknowledge -- to acknowledge control framesUI ( Unnumbered information)

All other commands are sychnronizationPollingStatus reporting

Page 70: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

SLIP• Developed to allow IP packets over telephone lines.

Computer Modem

Modem

Server

Sends raw IP packets over the line, with a special flag byte at the end for framing (0xC0)

If the flag byte occurs within data sequence (0xDB,0xDC) is send instead.

Some allows TCP and IP header compression

Does not do any error correction-detection,

Works with only IP

Each side must know each others IP addresse in advance

Does not provide any form of authentication -- Neither parties knows whom really they are talking to

It is not an approved standart and many different versions of it exists..

Page 71: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

MORE INFORMATION :

http://sunsite.nus.sg/pub/slip-ppp/

Page 72: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

PPP

• Provides– A framing method that unambiguously delineates the end of one

frame and start of the second, The frame also handles error detection.

– A link Control protocol for bringing lines up, testing them, negotiating options, bringing them down when they are no longer needed (LPC - Link control protocol)

– A way to negotiate network layer options in a way that is independent of the network layer protocol to be used. This method chosen to have a different NCP ( Network control protocol) for each network layer supported.

Page 73: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

PPP

Call provider Answer call

LCP packetsData link layer

options are negotiated

Exhange NCP packets to configure network layer

Page 74: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

PPP

01111110

Address11111111

Control00000011

Protocol PayloadChecksu

m0111111

0

LCP

NCP

IP

IPX

Appletalk

etc.

1 1 1 1 or 2 Variable 2 1

Page 75: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

PPP

• For More information • http://www.cis.ohio-state.edu/htbin/rfc/rfc1661.html• FOR A COMPARISON OF SLIP AND PPP• http://www.morningstar.com/MorningStar/slip-ppp-compare.html

• HEADER COMPRESSION• http://www.cis.ohio-state.edu/htbin/rfc/rfc1144.html• HOW TO SETUP SUN-PPP• http://www.ts.go.dlr.de/~bob/sugwww/service/PPP.sunservice.tip.html• MORE INFO ON PPP AND SLIP• http://sunsite.nus.sg/pub/slip-ppp/

Page 76: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

LLC Layer Realities

• IP and IPX protocol suites do not use the rich services provided by 802.2– Make use of the MAC/PHY abstraction advantage

– Use simplest Type 1 connectionless service

– Don’t use flow control, error control, SAP multiplexing, connection oriented services

– Implement these services at higher layers

• Some do NetBIOS, LAT– Non-routeable protocols

Page 77: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Media Access Layer Protocols

• As always, many solutions in this area

• We’ll Examine:– Pure ALOHA– 802.3 CSMA/CD– 802.5 and FDDI Token Passing

Page 78: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Services provided at MAC layer

• Arbitration of access to shared media– Provide orderly and efficient use of the media

• Unicast and Multicast addressing– Address information to one or several recipients

• Data integrity checking– Spot bogus frames

• Reference Stallings 4.3 and Chapter 6

Page 79: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Pure ALOHA

• Developed at University of Hawaii as a project to solve the channel allocation problem

• Originally implemented with radios• The algorithm is simple:

– Got traffic? Send it. Don’t wait, just send it.

– Wait for ACK for up to max round trip of network

– If you get the ACK, you’re done

– If you don’t get the ACK, re-transmit

Page 80: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

ALOHA continued

• Collisions will happen

• Assumption is that collisions generate bum frames that don’t get acknowledged

• It can be shown that max channel utilization is a whopping 18% or thereabouts

• Still useful to examine from a historical point of view

Page 81: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

CSMA/CD

• Carrier Sense Multiple Access with Collision Detect

• Used by 802.3 Ethernet• Solves ALOHA’s most basic problems• Transmission algorithm is a bit more involved but

still simple to implement• Still sort of a free for all

– Non-deterministic allocation of bandwidth– Can’t guarantee bandwidth for critical applications

Page 82: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

CSMA/CD Basic Algorithm

• Got traffic? First, listen for the carrier to make sure that nobody else is using the media– If busy, defer the transmission, and try again

• Once coast is clear, start transmitting• While transmitting, listen for collisions

– If you detect a collision within the collision window, stop transmitting and back off for a random amount of time. Retry

• Try for a number of times, then give up– 802.3 specifies 16 re-tries

Page 83: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Network Management Sidebar

• Network systems keep statistics for tracking problems

• Among the stats kept by Ethernet 802.3 stations are:– Transmit deferrals– Transmits OK after single collisions– Transmits OK after multiple collisions– Transmits failed due to excessive collisions– Transmits failed due to late collisions

• See RFC-1643 for the rest of the story

Page 84: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Token Passing

• Used by 802.5 and FDDI

• Allows for deterministic access– Characteristics totally predictable– Guaranteed bandwidth and latency possible

• Access algorithm is more complex to implement

Page 85: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Token Passing Basic Algorithm

• Wait for the token to arrive– Token not exactly on time? Reinitialize Network

• Once you have the token, start your token hold timer– Timer expired yet?

• No: Got traffic? send it. Strip frame when it gets back to you. No traffic? Release the token to your neighbor.

• Yes: Release token to your neighbor

• Reset your token rotation timer• Notice where Got Traffic? is checked

Page 86: Data Link Layer TC625 Sources: Dr. Yusuf Ozturk, ECE Department San Diego State University and Jim Buckner.

Token Passing Continued

• Token hold time and token rotation time are constant for a given network

• Negotiated during initialization or set by user• Predictable network performance• Equitable division of bandwidth

• Algorithm presented is purposefully simplified• 802.5 and FDDI add some important steps to the

algorithm• Example: Use of timers, Ring Initialization, Token Release• We’ll get the details on these differences later


Recommended