Framming data link layer

PREMALGAJJAR 7,379 views 88 slides May 26, 2014
Slide 1
Slide 1 of 88
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56
Slide 57
57
Slide 58
58
Slide 59
59
Slide 60
60
Slide 61
61
Slide 62
62
Slide 63
63
Slide 64
64
Slide 65
65
Slide 66
66
Slide 67
67
Slide 68
68
Slide 69
69
Slide 70
70
Slide 71
71
Slide 72
72
Slide 73
73
Slide 74
74
Slide 75
75
Slide 76
76
Slide 77
77
Slide 78
78
Slide 79
79
Slide 80
80
Slide 81
81
Slide 82
82
Slide 83
83
Slide 84
84
Slide 85
85
Slide 86
86
Slide 87
87
Slide 88
88

About This Presentation


Data Link Control
FRAMING
The data link layer needs to pack bits into frames, so that each frame is distinguishable from another. Our postal system practices a type of framing. The simple act of inserting a letter into an envelope separates one piece of information from another; the envelope serves...


Slide Content

11.1
Data Link Control

11.2
11-1 FRAMING
Thedatalinklayerneedstopackbitsintoframes,so
thateachframeisdistinguishablefromanother.Our
postalsystempracticesatypeofframing.Thesimple
actofinsertingaletterintoanenvelopeseparatesone
pieceofinformationfromanother;theenvelopeserves
asthedelimiter.
Fixed-Size Framing
Variable-Size Framing
Topics discussed in this section:

11.3
Figure 11.1 A frame in a character-oriented protocol

11.4
Figure 11.2 Byte stuffing and unstuffing

11.5
Byte stuffing is the process of adding 1
extra byte whenever there is a flag or
escape character in the text.
Note

11.6
Figure 11.3 A frame in a bit-oriented protocol

11.7
Bit stuffing is the process of adding one
extra 0 whenever five consecutive 1s
follow a 0 in the data, so that the
receiver does not mistake
the pattern 0111110 for a flag.
Note

11.8
Figure 11.4 Bit stuffing and unstuffing

11.9
11-2 FLOW AND ERROR CONTROL
Themostimportantresponsibilitiesofthedatalink
layerareflowcontrolanderrorcontrol.Collectively,
thesefunctionsareknownasdatalinkcontrol.
Flow Control
Error Control
Topics discussed in this section:

11.10
Flow control refers to a set of procedures
used to restrict the amount of data
that the sender can send before
waiting for acknowledgment.
Note

11.11
Error control in the data link layer is
based on automatic repeat request,
which is the retransmission of data.
Note

11.12
11-3 PROTOCOLS
Nowletusseehowthedatalinklayercancombine
framing,flowcontrol,anderrorcontroltoachievethe
deliveryofdatafromonenodetoanother.The
protocolsarenormallyimplementedinsoftwareby
usingoneofthecommonprogramminglanguages.To
makeourdiscussionslanguage-free,wehavewritten
inpseudocodeaversionofeachprotocolthat
concentratesmostlyontheprocedureinsteadof
delvingintothedetailsoflanguagerules.

11.13
Figure 11.5 Taxonomy of protocols discussed in this chapter

11.14
11-4 NOISELESS CHANNELS
Letusfirstassumewehaveanidealchannelinwhich
noframesarelost,duplicated,orcorrupted.We
introducetwoprotocolsforthistypeofchannel.
Simplest Protocol
Stop-and-Wait Protocol
Topics discussed in this section:

11.15
Figure 11.6 The design of the simplest protocol with no flow or error control

11.16
Figure11.7showsanexampleofcommunicationusing
thisprotocol.Itisverysimple.Thesendersendsa
sequenceofframeswithouteventhinkingaboutthe
receiver.Tosendthreeframes,threeeventsoccuratthe
sendersiteandthreeeventsatthereceiversite.Notethat
thedataframesareshownbytiltedboxes;theheightof
theboxdefinesthetransmissiontimedifferencebetween
thefirstbitandthelastbitintheframe.
Example 11.1

11.17
Figure 11.7 Flow diagram for Example 11.1

11.18
Figure 11.8 Design of Stop-and-Wait Protocol

11.19
Figure11.9showsanexampleofcommunicationusing
thisprotocol.Itisstillverysimple.Thesendersendsone
frameandwaitsforfeedbackfromthereceiver.Whenthe
ACKarrives,thesendersendsthenextframe.Notethat
sendingtwoframesintheprotocolinvolvesthesenderin
foureventsandthereceiverintwoevents.
Example 11.2

11.20
Figure 11.9 Flow diagram for Example 11.2

11.21
11-5 NOISY CHANNELS
AlthoughtheStop-and-WaitProtocolgivesusanidea
ofhowtoaddflowcontroltoitspredecessor,noiseless
channelsarenonexistent.Wediscussthreeprotocols
inthissectionthatuseerrorcontrol.
Stop-and-Wait Automatic Repeat Request
Go-Back-N Automatic Repeat Request
Selective Repeat Automatic Repeat Request
Topics discussed in this section:

11.22
Error correction in Stop-and-Wait ARQ is
done by keeping a copy of the sent
frame and retransmitting of the frame
when the timer expires.
Note

11.23
In Stop-and-Wait ARQ, we use sequence
numbers to number the frames.
The sequence numbers are based on
modulo-2 arithmetic.
Note

11.24
In Stop-and-Wait ARQ, the
acknowledgment number always
announces in modulo-2 arithmetic the
sequence number of the next frame
expected.
Note

11.25
Figure 11.10 Design of the Stop-and-Wait ARQ Protocol

11.26
Figure11.11showsanexampleofStop-and-WaitARQ.
Frame0issentandacknowledged.Frame1islostand
resentafterthetime-out.Theresentframe1is
acknowledgedandthetimerstops.Frame0issentand
acknowledged,buttheacknowledgmentislost.The
senderhasnoideaiftheframeortheacknowledgment
islost,soafterthetime-out,itresendsframe0,whichis
acknowledged.
Example 11.3

11.27
Figure 11.11 Flow diagram for Example 11.3

11.28
Assumethat,inaStop-and-WaitARQsystem,the
bandwidthofthelineis1Mbps,and1bittakes20msto
makearoundtrip.Whatisthebandwidth-delayproduct?
Ifthesystemdataframesare1000bitsinlength,whatis
theutilizationpercentageofthelink?
Solution
The bandwidth-delay product is
Example 11.4

11.29
Thesystemcansend20,000bitsduringthetimeittakes
forthedatatogofromthesendertothereceiverandthen
backagain.However,thesystemsendsonly1000bits.We
cansaythatthelinkutilizationisonly1000/20,000,or5
percent.Forthisreason,foralinkwithahighbandwidth
orlongdelay,theuseofStop-and-WaitARQwastesthe
capacityofthelink.
Example 11.4 (continued)

11.30
Whatistheutilizationpercentageofthelinkin
Example11.4ifwehaveaprotocolthatcansendupto
15framesbeforestoppingandworryingaboutthe
acknowledgments?
Solution
Thebandwidth-delayproductisstill20,000bits.The
systemcansendupto15framesor15,000bitsduringa
roundtrip.Thismeanstheutilizationis15,000/20,000,or
75percent.Ofcourse,iftherearedamagedframes,the
utilizationpercentageismuchlessbecauseframeshave
toberesent.
Example 11.5

11.31
In the Go-Back-N Protocol, the sequence
numbers are modulo 2
m
,
where m is the size of the sequence
number field in bits.
Note

11.32
Figure 11.12 Send window for Go-Back-N ARQ

11.33
The send window is an abstract concept
defining an imaginary box of size 2
m
− 1
with three variables: S
f, S
n, and Ssize.
Note

11.34
The send window can slide one
or more slots when a valid
acknowledgment arrives.
Note

11.35
Figure 11.13 Receive window for Go-Back-N ARQ

11.36
The receive window is an abstract
concept defining an imaginary box
of size 1 with one single variable Rn.
The window slides
when a correct frame has arrived;
sliding occurs one slot at a time.
Note

11.37
Figure 11.14 Design of Go-Back-N ARQ

11.38
Figure 11.15 Window size for Go-Back-N ARQ

11.39
In Go-Back-N ARQ, the size of the send
window must be less than 2
m
;
the size of the receiver window
is always 1.
Note

11.40
Example 11.6
Figure11.16showsanexampleofGo-Back-N.Thisisan
exampleofacasewheretheforwardchannelisreliable,
butthereverseisnot.Nodataframesarelost,butsome
ACKsaredelayedandoneislost.Theexamplealso
showshowcumulativeacknowledgmentscanhelpif
acknowledgmentsaredelayedorlost.Afterinitialization,
therearesevensenderevents.Requesteventsare
triggeredbydatafromthenetworklayer;arrivalevents
aretriggeredbyacknowledgmentsfromthephysical
layer.Thereisnotime-outeventherebecauseall
outstandingframesareacknowledgedbeforethetimer
expires.NotethatalthoughACK2islost,ACK3servesas
bothACK2andACK3.

11.41
Figure 11.16 Flow diagram for Example 11.6

11.42
Figure11.17showswhathappenswhenaframeislost.
Frames0,1,2,and3aresent.However,frame1islost.
Thereceiverreceivesframes2and3,buttheyare
discardedbecausetheyarereceivedoutoforder.The
senderreceivesnoacknowledgmentaboutframes1,2,or
3.Itstimerfinallyexpires.Thesendersendsall
outstandingframes(1,2,and3)becauseitdoesnotknow
whatiswrong.Notethattheresendingofframes1,2,and
3istheresponsetoonesingleevent.Whenthesenderis
respondingtothisevent,itcannotacceptthetriggeringof
otherevents.ThismeansthatwhenACK2arrives,the
senderisstillbusywithsendingframe3.
Example 11.7

11.43
Thephysicallayermustwaituntilthiseventiscompleted
andthedatalinklayergoesbacktoitssleepingstate.We
haveshownaverticallinetoindicatethedelay.Itisthe
samestorywithACK3;butwhenACK3arrives,the
senderisbusyrespondingtoACK2.Ithappensagain
whenACK4arrives.Notethatbeforethesecondtimer
expires,alloutstandingframeshavebeensentandthe
timerisstopped.
Example 11.7 (continued)

11.44
Figure 11.17 Flow diagram for Example 11.7

11.45
Stop-and-Wait ARQ is a special case of
Go-Back-N ARQ in which the size of the
send window is 1.
Note

11.46
Figure 11.18 Send window for Selective Repeat ARQ

11.47
Figure 11.19 Receive window for Selective Repeat ARQ

11.48
Figure 11.20 Design of Selective Repeat ARQ

11.49
Figure 11.21 Selective Repeat ARQ, window size

11.50
In Selective Repeat ARQ, the size of the
sender and receiver window
must be at most one-half of 2
m
.
Note

11.51
Figure 11.22 Delivery of data in Selective Repeat ARQ

11.52
ThisexampleissimilartoExample11.3inwhichframe1
islost.WeshowhowSelectiveRepeatbehavesinthis
case.Figure11.23showsthesituation.Onemain
differenceisthenumberoftimers.Here,eachframesent
orresentneedsatimer,whichmeansthatthetimersneed
tobenumbered(0,1,2,and3).Thetimerforframe0
startsatthefirstrequest,butstopswhentheACKforthis
framearrives.Thetimerforframe1startsatthesecond
request,restartswhenaNAKarrives,andfinallystops
whenthelastACKarrives.Theothertwotimersstart
whenthecorrespondingframesaresentandstopatthe
lastarrivalevent.
Example 11.8

11.53
Atthereceiversiteweneedtodistinguishbetweenthe
acceptanceofaframeanditsdeliverytothenetwork
layer.Atthesecondarrival,frame2arrivesandisstored
andmarked,butitcannotbedeliveredbecauseframe1is
missing.Atthenextarrival,frame3arrivesandis
markedandstored,butstillnoneoftheframescanbe
delivered.Onlyatthelastarrival,whenfinallyacopyof
frame1arrives,canframes1,2,and3bedeliveredtothe
networklayer.Therearetwoconditionsforthedeliveryof
framestothenetworklayer:First,asetofconsecutive
framesmusthavearrived.Second,thesetstartsfromthe
beginningofthewindow.
Example 11.8 (continued)

11.54
AnotherimportantpointisthataNAKissentafterthe
secondarrival,butnotafterthethird,althoughboth
situationslookthesame.Thereasonisthattheprotocol
doesnotwanttocrowdthenetworkwithunnecessary
NAKsandunnecessaryresentframes.ThesecondNAK
wouldstillbeNAK1toinformthesendertoresendframe
1again;thishasalreadybeendone.ThefirstNAKsentis
remembered(usingthenakSentvariable)andisnotsent
againuntiltheframeslides.ANAKissentonceforeach
windowpositionanddefinesthefirstslotinthewindow.
Example 11.8 (continued)

11.55
ThenextpointisabouttheACKs.Noticethatonlytwo
ACKsaresenthere.Thefirstoneacknowledgesonlythe
firstframe;thesecondoneacknowledgesthreeframes.In
SelectiveRepeat,ACKsaresentwhendataaredeliveredto
thenetworklayer.Ifthedatabelongingtonframesare
deliveredinoneshot,onlyoneACKissentforallofthem.
Example 11.8 (continued)

11.56
Figure 11.23 Flow diagram for Example 11.8

11.57
Figure 11.24 Design of piggybacking in Go-Back-N ARQ

11.58
11-6 HDLC
High-levelDataLinkControl(HDLC)isabit-oriented
protocolforcommunicationoverpoint-to-pointand
multipointlinks.ItimplementstheARQmechanisms
wediscussedinthischapter.
Configurations and Transfer Modes
Frames
Control Field
Topics discussed in this section:

11.59
Figure 11.25 Normal response mode

11.60
Figure 11.26 Asynchronous balanced mode

11.61
Figure 11.27 HDLC frames

11.62
Figure 11.28 Control field format for the different frame types

11.63
Table 11.1 U-frame control command and response

11.64
Figure11.29showshowU-framescanbeusedfor
connectionestablishmentandconnectionrelease.NodeA
asksforaconnectionwithasetasynchronousbalanced
mode(SABM)frame;nodeBgivesapositiveresponse
withanunnumberedacknowledgment(UA)frame.After
thesetwoexchanges,datacanbetransferredbetweenthe
twonodes(notshowninthefigure).Afterdatatransfer,
nodeAsendsaDISC(disconnect)frametoreleasethe
connection;itisconfirmedbynodeBrespondingwitha
UA(unnumberedacknowledgment).
Example 11.9

11.65
Figure 11.29 Example of connection and disconnection

11.66
Figure11.30showsanexchangeusingpiggybacking.
NodeAbeginstheexchangeofinformationwithan
I-framenumbered0followedbyanotherI-frame
numbered1.NodeBpiggybacksitsacknowledgmentof
bothframesontoanI-frameofitsown.NodeB’sfirst
I-frameisalsonumbered0[N(S)field]andcontainsa2
initsN(R)field,acknowledgingthereceiptofA’sframes
1and0andindicatingthatitexpectsframe2toarrive
next.NodeBtransmitsitssecondandthirdI-frames
(numbered1and2)beforeacceptingfurtherframesfrom
nodeA.
Example 11.10

11.67
ItsN(R)information,therefore,hasnotchanged:B
frames1and2indicatethatnodeBisstillexpectingA’s
frame2toarrivenext.NodeAhassentallitsdata.
Therefore,itcannotpiggybackanacknowledgmentonto
anI-frameandsendsanS-frameinstead.TheRRcode
indicatesthatAisstillreadytoreceive.Thenumber3in
theN(R)fieldtellsBthatframes0,1,and2haveallbeen
acceptedandthatAisnowexpectingframenumber3.
Example 11.10 (continued)

11.68
Figure 11.30 Example of piggybacking without error

11.69
Figure11.31showsanexchangeinwhichaframeislost.
NodeBsendsthreedataframes(0,1,and2),butframe1
islost.WhennodeAreceivesframe2,itdiscardsitand
sendsaREJframeforframe1.Notethattheprotocol
beingusedisGo-Back-NwiththespecialuseofanREJ
frameasaNAKframe.TheNAKframedoestwothings
here:Itconfirmsthereceiptofframe0anddeclaresthat
frame1andanyfollowingframesmustberesent.Node
B,afterreceivingtheREJframe,resendsframes1and2.
NodeAacknowledgesthereceiptbysendinganRRframe
(ACK)withacknowledgmentnumber3.
Example 11.11

11.70
Figure 11.31 Example of piggybacking with error

11.71
11-7 POINT-TO-POINT PROTOCOL
AlthoughHDLCisageneralprotocolthatcanbeused
forbothpoint-to-pointandmultipointconfigurations,
oneofthemostcommonprotocolsforpoint-to-point
accessisthePoint-to-PointProtocol(PPP).PPPisa
byte-orientedprotocol.
Framing
Transition Phases
Multiplexing
Multilink PPP
Topics discussed in this section:

11.72
Figure 11.32 PPP frame format

11.73
PPP is a byte-oriented protocol using
byte stuffing with the escape byte
01111101.
Note

11.74
Figure 11.33 Transition phases

11.75
Figure 11.34 Multiplexing in PPP

11.76
Figure 11.35 LCP packet encapsulated in a frame

11.77
Table 11.2 LCP packets

11.78
Table 11.3 Common options

11.79
Figure 11.36 PAP packets encapsulated in a PPP frame

11.80
Figure 11.37 CHAP packets encapsulated in a PPP frame

11.81
Figure 11.38 IPCP packet encapsulated in PPP frame

11.82
Table 11.4 Code value for IPCP packets

11.83
Figure 11.39 IP datagram encapsulated in a PPP frame

11.84
Figure 11.40 Multilink PPP

11.85
Letusgothroughthephasesfollowedbyanetworklayer
packetasitistransmittedthroughaPPPconnection.
Figure11.41showsthesteps.Forsimplicity,weassume
unidirectionalmovementofdatafromtheusersitetothe
systemsite(suchassendingane-mailthroughanISP).
Thefirsttwoframesshowlinkestablishment.Wehave
chosentwooptions(notshowninthefigure):usingPAP
forauthenticationandsuppressingtheaddresscontrol
fields.Frames3and4areforauthentication.Frames5
and6establishthenetworklayerconnectionusingIPCP.
Example 11.12

11.86
ThenextseveralframesshowthatsomeIPpacketsare
encapsulatedinthePPPframe.Thesystem(receiver)
mayhavebeenrunningseveralnetworklayerprotocols,
butitknowsthattheincomingdatamustbedeliveredto
theIPprotocolbecausetheNCPprotocolusedbeforethe
datatransferwasIPCP.
Afterdatatransfer,theuserthenterminatesthedatalink
connection,whichisacknowledgedbythesystem.Of
coursetheuserorthesystemcouldhavechosento
terminatethenetworklayerIPCPandkeepthedatalink
layerrunningifitwantedtorunanotherNCPprotocol.
Example 11.12 (continued)

11.87
Figure 11.41 An example

11.88
Figure 11.41 An example (continued)
Tags