5 DLL-LLC- Book

50

description

To achieve unnecessary control over data communication link A logic is added above the physical interface which is referred as Data Link Control/ Protocol To see the need of data link control, some of the requirements and objectives for data communication are listed as follows Frame synchronization- start and end should be recognizable Flow control- the sender and receiver data rate Error control- check the error and correct it Addressing- identify the address Control and Data on same link- should have control information Link Management- the initiation, maintenance and termination We will study the three mechanisms that are a part of data link control Flow control, error detection and error control A presentation prepared by my friend's friend. I have done no editing at all, I'm just uploading the presentation as it is.

Transcript of 5 DLL-LLC- Book

Page 1: 5 DLL-LLC- Book
Page 2: 5 DLL-LLC- Book

Introduction To achieve unnecessary control over data communication link A logic is added above the physical interface which is referred

as Data Link Control/ Protocol To see the need of data link control, some of the requirements

and objectives for data communication are listed as follows Frame synchronization- start and end should be recognizable Flow control- the sender and receiver data rate Error control- check the error and correct it Addressing- identify the address Control and Data on same link- should have control information Link Management- the initiation, maintenance and termination

We will study the three mechanisms that are a part of data link control

Flow control, error detection and error control

Page 3: 5 DLL-LLC- Book

Flow ControlFlow control is used to make sure that the

transmitted data is not over whelming the receiver The receiver allocates a data buffer for the

processing before passing it to higher level softwareIn the absence the system may bottle neck

Page 4: 5 DLL-LLC- Book

Ideal Flow ControlIn the absence of errors, the model in

figure depicts a vertical time sequence

It has advantage of showing time dependencies

Each arrow represents a single frame (data + control info)

It was an errorless communicationHowever, transmitted frame suffers a

variable amount of delay

Page 5: 5 DLL-LLC- Book

Stop and Wait Flow ControlSimplest form of flow controlSource transmit a frame, after reception the

destination indicates its willingness to accept more data by sending back an acknowledgment of the frame just received

The source waits for the acknowledgmentThe destination can thus stop the data flow by with

holding acknowledgmentIf a larger data is broken down into smaller blocks,

this is done for the following reasons

Page 6: 5 DLL-LLC- Book

Stop and Wait Flow Control Limited buffer size Longer the transmission, more likely there will be an error Smaller frames, errors are detected sooner and

retransmitted faster On LANs not to permit a station to hold a medium for longer

time

With multiple frames of a message, stop and wait may be inadequate

We know about transmission time and propagation delay

Page 7: 5 DLL-LLC- Book

Stop and Wait Flow Control

Page 8: 5 DLL-LLC- Book

Stop and Wait Flow ControlAs per previous figure transmission time is normalized to 1

and propagation is expressed as variable ‘a’When a<1 the propagation time is less than transmission time

The frame is long and before it is transmitted it arrives destination When a>1 the propagation time is greater than transmission

timeThe sender completes transmission before the frame arrives at

receiverNote that for a>1 line is always underutilized and for a<1 line is

inefficiently utilizedIn essence for high data rates or for long distances stop and

flow control provides inefficient line utilization

Page 9: 5 DLL-LLC- Book

Sliding Windows Flow ControlAs per the previous flow control the efficiency can be improved

by allowing multiple frames to be in transit at same timeA and B are connected via full duplex link (A -> B)B allocates a buffer for n frames to be received from ATo keep track of the frames, they are labeled B ack a frame by sending ack that includes sequence number of

next expectedThe scheme can be used to ack multiple framesA and B both maintains a list; sent sequence numbers and

received sequence numbersEach of these lists can be thought of as a window or frameAdditional comments need to be made

Page 10: 5 DLL-LLC- Book

Sliding Windows Flow ControlTo represent a sequence number, it occupies a field

in a frameFor K-bit field, the range of sequence number is O

through 2k-1

Page 11: 5 DLL-LLC- Book

Sliding Windows Flow ControlReceiver can control the size of the sending windowBy limiting the size of the sending window data flow from

sender to receiver can be limitedLet 3 bits sequence has max of 7 frames, A->BAfter transmitting some frames without ack A shrunk its

window to 4 framesB then transmits RR3 (receive ready) which is ack of receive

frames With this ack A is back up to permission of transmitting 7

frames starting from 3 onwardsRNR (receive not ready) a station can cut off a flow of frames

if it exceeds its buffer size

Page 12: 5 DLL-LLC- Book

Sliding Windows Flow Control

Page 13: 5 DLL-LLC- Book

Sliding Window TransmissionIf 2 stations exchange data, each has to maintain 2 windows

(two directional)One for transmit and one for receive And each one has to send data and ack to otherPiggybank- provides efficient support for above requirement

Each frame holds sequence number of frame + field that holds sequence number for ack

Thus a station sends data and ack both in one frame, saving communication capacity

If station has ack but no data, it sends a separate ack frameSimilarly no ack but data to send, it must repeat the last ack it

sent Because data frame includes a field for ack number and some

number has to be put in that field Duplications are simply ignored Pipe line concept

Page 14: 5 DLL-LLC- Book

Error detectingWe talked about transmission impairments and the effect of

data rate and signal-to-noise ratio on bit error rate. Regardless of the design of the transmission system, there will

be errors, resulting in the change of one or more bits in a transmitted frame.

So, how can a receiver know if the data received is error free? There are several methods that can be implemented to

accomplish this. Some of these methods are simple and somewhat effective –

others are complicated and very effective.

Page 15: 5 DLL-LLC- Book

Error DetectionData transmission can contain errors

Single-bitBurst errors of length n

How to detect errorsIf only data is transmitted, errors cannot be detected

Send more information with data that satisfies a special relationship Add redundancy

Page 16: 5 DLL-LLC- Book

Error Detection MethodsParity bitThe simplest error-detection scheme is to append a parity bit

to the end of a block of data. A typical example is ASCII transmission, in which a parity bit is attached to each 7-bit ASCII character.

The value of this bit is selected so that the character has an even number of 1s (even parity) or an odd number of 1s (odd parity).

If one bit (or any odd number of bits) is erroneously inverted during transmission then the receiver will detect an error.

Note, however, that if two (or any even number) of bits are inverted due to error, an undetected error occurs.

Typically, Even parity is used for synchronous transmission and Odd parity for asynchronous transmission

Page 17: 5 DLL-LLC- Book

Error Detection MethodsVertical Redundancy Check (VRC)

Append a single bit at the end of data block such that the number of ones is even Even Parity (odd parity is similar)0110011 011001100110001 01100011

VRC is also known as Parity CheckPerformance:

Detects all odd-number errors in a data block

Page 18: 5 DLL-LLC- Book

Longitudinal Redundancy Check (LRC)Organize data into a table and create a parity for

each column

11100111 11011101 00111001 10101001

11100111110111010011100110101001

10101010

11100111 11011101 00111001 10101001 10101010

Original Data LRC

Page 19: 5 DLL-LLC- Book

ChecksumA checksum error detection method give us more accuracy if

used with a parity bit method.The checksum field can be one or more bytesA checksum method will basically check the sum of all the '1's

in a message and check that value against the checksum value added by the sender to the message.

A checksum method can provide more precision to your error detection efforts, there are still limitations. A simple checksum cannot detect an even number of errors

which sum to zero, an insertion of bytes which sum to zero (add 0), or even the re-ordering of bytes in the message.

While there are some more advanced implementations of the checksum method, including Fletcher's checksum method

Page 20: 5 DLL-LLC- Book

CRC (cyclic redundancy check)A better method to detect errors in a large block of data

involves the use of CRC codes. The hardware required to implement a CRC code is slightly

more complicated than other error detection codes but it has an error detection effectiveness greater than 99.9%.

CRC, which can be described as follows. Given a k-bit block of bits, or message, the transmitter generates

an n-bit sequence, known as a frame check sequence (FCS)Making a resulting frame, consisting of k + n bits which is exactly

divisible by some predetermined number. The receiver then divides the incoming frame by that number

and, if there is no remainder, assumes there was no error.

Page 21: 5 DLL-LLC- Book

CRC ConceptLet M(x) be the message polynomialLet P(x) be the generator polynomial

P(x) is fixed for a given CRC schemeP(x) is known both by sender and receiver

Create a block polynomial F(x) based on M(x) and P(x) such that F(x) is divisible by P(x)

)(

0)(

)(

)(

xPxQ

xP

xF

Page 22: 5 DLL-LLC- Book

Cyclic Redundancy CheckSending

1.Multiply M(x) by xn 2.Divide xnM(x) by P(x)3. Ignore the quotient and keep the reminder C(x)4.Form and send F(x) = xnM(x)+C(x)

Receiving1.Receive F’(x)2.Divide F’(x) by P(x)3.Accept if remainder is 0, reject otherwise

Page 23: 5 DLL-LLC- Book

Generating PolynomialOne way of considering CRC systems is to treatthe stream of transmitted bits as a representation of a

polynomial with coefficients of 1:

Let us assume k message bits and n bits of redundancy

Associate bits with coefficients of a polynomial1 0 1 1 0 1 11x6+0x5+1x4+1x3+0x2+1x1+1x0

= x6+x4+x3+x+1

Page 24: 5 DLL-LLC- Book

Generating PolynomialCRC-16: G(x) = x16 + x15 + x2 + 1

detects single and double bit errorsAll errors with an odd number of bitsBurst errors of length 16 or lessMost errors for longer bursts

CRC-32: G(x) = x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x + 1Used in ethernetAlso 32 bits of 1 added on front of the message

Initialize the LFSR to all 1s

Page 25: 5 DLL-LLC- Book

Modulo 2 ArithmeticModulo 2 arithmetic uses binary addition with no

carries, which is just the exclusive-ORoperation. For example:

Page 26: 5 DLL-LLC- Book

ExampleSend

M(x) = 110011 x5+x4+x+1 (6 bits)

P(x) = 11001 x4+x3+1 (5 bits, n = 4) 4 bits of redundancy

Form xnM(x) 110011 0000 x9+x8+x5+x4

Divide xnM(x) by P(x) to find C(x)

100001

1001

11001

10000

11001

110011000011001

= C(x)

Receive

Send the block 110011 1001

00000

11001

11001

11001

110011100111001

No remainder Accept

Page 27: 5 DLL-LLC- Book

Designing of CRC polynomial The most commonly used

polynomial lengths are 9 bits (CRC-8) 17 bits (CRC-16) 33 bits (CRC-32) 65 bits (CRC-64)

CRC-8:x8+x2+x+1

Used in: 802.16 (along with error correction).

CRC-CCITT: x16+x12+x5+1

Used in: HDLC, SDLC, PPP default

IBM-CRC-16 (ANSI):x16+x15+x2+1

802.3:x32+x26+x23+x22 +x16+x12+x11+x10 +x8+x7+x5+x4+x2+x+1

Append 32 bits to the message. Detects all bursts of length 32 or

less. Used in: Ethernet, PPP option

Page 28: 5 DLL-LLC- Book

Hamming Distance Based Checks

If we want to detect d bit errors in an n bit word we can map every n bit word into a bigger n+d+1 bit word so that the minimum Hamming distance between each valid mapping is d+1.

Meaning if error-correcting bits are included with a message, and if those bits can be arranged such that different incorrect bits produce different error results, then bad bits could be identified.

In a 7-bit message, there are seven possible single bit errors, so three error control bits could potentially specify not only that an error occurred but also which bit caused the error.

Hamming studied the existing coding schemes.To start with he developed a nomenclature to describe the

system, including the number of data bits and error-correction bits in a block.

Page 29: 5 DLL-LLC- Book

Calculating the Hamming Code The key to the Hamming Code is the use of extra parity bits to allow the

identification of a single error. Create the code word as follows: Mark all bit positions that are powers of two as parity bits.

(positions 1, 2, 4, 8, 16, 32, 64, etc.) All other bit positions are for the data to be encode Each parity bit calculates the parity for some of the bits in the code word. The position of the parity bit determines the sequence of bits.

Position 1: check 1 bit, skip 1 bit, check 1 bit, skip 1 bit, etc. (1,3,5,7,9,11,13,15,...)

Position 2: check 2 bits, skip 2 bits, check 2 bits, skip 2 bits, etc. (2,3,6,7,10,11,14,15,...)

Position 4: check 4 bits, skip 4 bits, check 4 bits, skip 4 bits, etc.

(4,5,6,7,12,13,14,15,20,21,22,23,...) Position 8: check 8 bits, skip 8 bits, check 8 bits, skip 8 bits, etc.

(8-15,24-31,40-47,...) Position 16: check 16 bits, skip 16 bits, check 16 bits, skip 16 bits, etc.

(16-31,48-63,80-95,...) Position 32: check 32 bits, skip 32 bits, check 32 bits, skip 32 bits, etc.

(32-63,96-127,160-191,...) Set a parity bit to 1 if the total number of ones in the positions it checked is odd

and 0 if the total number of ones in the positions it checks is even.

Page 30: 5 DLL-LLC- Book

ExampleWith Hamming, can find errors quickly by just looking at one pattern: Let's say error in a data bit:

100 sent 111000 became: 111001 i.e. data 101, but check bits wrong

Check bit 1 - 1 - checks bits 3,5 - 1 0 - OK Check bit 2 - 1 - checks bits 3,6 - 1 1 - WRONG Check bit 4 - 0 - checks bits 5,6 - 0 1 - WRONG

The bad bit is bit 2 + 4 = bit 6. Data was corrupted. Data should be 100.

Page 31: 5 DLL-LLC- Book

Example Let's say error in a check bit:

100 sent 111000 became: 011000 i.e. data 100, but check bits wrong

Check bit 1 - 0 - checks bits 3,5 - 1 0 - WRONG Check bit 2 - 1 - checks bits 3,6 - 1 0 - OK Check bit 4 - 0 - checks bits 5,6 - 0 0 - OK

The bad bit is bit 1. Check bit was corrupted. Data is fine.

Page 32: 5 DLL-LLC- Book

Finding and fixing a bad bit Do a example and then add an error and check the resultFor above example create a code word of 011100101010.Insert and error suppose the word that was received was

011100101110 instead. Then the receiver could calculate which bit was wrong and

correct it. The method is to verify each check bit. Write down all the

incorrect parity bits.Doing so, you will discover that parity bits 2 and 8 are

incorrect. It is not an accident that 2 + 8 = 10, and that bit position 10 is the location of the bad bit.

In general, check each parity bit, and add the positions that are wrong, this will give you the location of the bad bit.

Page 33: 5 DLL-LLC- Book

Error CorrectionThere are various methods used to correct errors. An obvious and simple one is to just detect the error

and then do nothing, assuming that something else will fix it.

This method is fine when something else is able to fix the error, but is of no use if there is no something else!

_____In computers radiation can cause the gates to change state from time to time.

Modern computer memory corrects these errors it is called FEC (Forward Error Control) to differentiate it from ARQ systems.

Page 34: 5 DLL-LLC- Book

Techniques For Error ControlThe most common are based on some or all of the

following ingredients:Error detection. Techniques and coding of data.Positive acknowledgment.Retransmission after timeout. The source

retransmits a frame that has not been acknowledged after a predetermined amount of time.

Negative acknowledgment and retransmission. The estimation returns a negative acknowledgment to frames in which an error is detected. The source retransmits such frames.

Page 35: 5 DLL-LLC- Book

ARQ (Automatic Repeat reQuest)

In data communication protocols, it is common to just ignore errors that are received, while acknowledging correct data.

If an error is received, the lack of an acknowledgement eventually leads to a retransmission after some timeout period.

The effect of ARQ is to turn an unreliable data link into a reliable one

This technique is called ARQ (for Automatic Repeat reQuest).Three versions of ARQ have been standardized:

Stop-and-wait Go-back-N Selective-reject

Page 36: 5 DLL-LLC- Book

Stop N Wait ARQBased on the stop-and-wait flow-control technique The source station transmits a single frame and then must

await an acknowledgment (ACK). No other data frames can be sent until the destination station's

reply arrives at the source station.Error Control - Two sorts of errors could occur. First, the frame that arrives at the destination could be

damaged; the receiver detects this by error detection technique

referred to earlier and simply discards the frame. To account for this possibility, the source station is equipped

with a timer. After a frame is transmitted, the source station waits for an

acknowledgment. If no acknowledgment is received by the time the timer expires, then the same frame is sent again, keeping a copy at transmitter

Page 37: 5 DLL-LLC- Book

Stop N wait Second, damaged acknowledgment. Station A sends to station B, which

responds with an acknowledgment (ACK). The ACK is damaged in transit and is not

recognized by A, which eventually ends timer & generate frame

This duplicate frame arrives and is accepted by B, which has therefore accepted two copies of the same frame as if they were separate.

To avoid this problem, frames are alternately labeled with 0 or 1

ACK are of the form ACKO and ACK1. In keeping with the sliding-window

convention, an ACKO acknowledges receipt of a frame numbered 1 and indicates that the receiver is ready for a frame numbered 0.

The sliding-window flow control technique can be adapted to provide more efficient line use.

Page 38: 5 DLL-LLC- Book

Go back N ARQThe form of error control based on sliding-window flow control In go-back-N ARQ, a station may send a series of frames

sequentially numberedThe number of unacknowledged frames outstanding is determined

by window size, using the sliding-window flow control technique. While no errors occur, the destination will acknowledge (RR =

receive ready) If the destination station detects an error in a frame, it sends a

negative acknowledgment (REJ = reject) for that frame. The destination station will discard that frame and all future incoming

frames until the frame in error is correctly received. Thus, at source station, when it receives an REJ, must retransmit the

frame in error plus all succeeding frames that were transmitted in the interim.

Page 39: 5 DLL-LLC- Book

GO Back N When A is sending to B the following errors could

occur which is called Damaged frame. There are three sub cases: A transmits frame i. B detects an error and has

previously successfully received frame (i - 1). B sends REJ i, indicated that frame i is rejected.

When A receives the REJ, it must retransmit frame i and all subsequent frames, since the original transmission of i.

Frame i is lost in transit. A subsequently sends frame (i + 1). B receives frame (i + 1) out of order and sends an REJ i

Frame i is lost in transit, and A does not soon send additional frames.

B receives nothing and returns neither an RR nor an REJ.

When A's timer expires, it transmits an RR frame that includes a bit known as the P bit, set to =1

B interprets the RR frame with a P bit of 1 as a command that must be acknowledged by sending an RR indicating the next frame that it expects.

When A receives the RR, it retransmits frame i.

Page 40: 5 DLL-LLC- Book

Go Back N Damaged RR. There are two sub cases: B receives frame i and sends RR (i + I), which is lost in transit. Because acknowledgments are cumulative (e.g., RR 6 means that all frames through 5 are acknowledged), A will receive a subsequent RR to a subsequent frame and that it will arrive

before the timer associated with frame i expires. If A's timer expires, it transmits an RR command as in case of pervious slide. It

sets another timer, called the P-bit timer. If B fails to respond to the RR command, or if its response is damaged, then A's

P-bit timer will expire. At this point A will try again by issuing a new RR command and restarting the P-bit timer. This procedure is tried for a number of iterations. If A fails to obtain an Ack after some maximum number of attempts, it initiates a

reset procedure. Damaged REJ. If an REJ is lost, this is equivalent to the case lost in transit

Page 41: 5 DLL-LLC- Book

Selective-reject ARQWith selective-reject ARQ, the only frames retransmitted are those

that receive a negative acknowledgment, in this case called SREJ, or that time-out.

This would appear to be more efficient than go-back-N, because it minimizes the amount of retransmission.

On the other hand, the receiver must maintain a buffer large enough to save post-SREJ frames until the frame in error is retransmitted

and it must contain logic for reinserting that frame in the proper sequence.

The transmitter, too, requires more complex logic to be able to send a frame out of sequence.

Because of such complications, select-reject ARQ is much less used than go-back- N ARQ.

The window-size limitation is more restrictive for selective-reject than for go back- N. Consider the case of a 3-bit sequence-number size for selective-reject.

Page 42: 5 DLL-LLC- Book

Selective reject Allow a window size of seven, and consider the following scenario1. Station A sends frames 0 through 6 to station B. Frame

(0,1,2,3,4,5,6,7,0,1,2,3,4,5)2. Station B receives all seven frames and cumulatively Ack with RR 7.3. Because of some noise burst, the RR 7 is lost/corrupted4. A’s times out and retransmits frame 0 - 6.5. B has already advanced its receive window to accept frames

7,0,1,2,3,4, and 56. Thus, B assumes that frame 7 has been lost and that this is a new

frame 0,which it accepts. The problem with this scenario is that there is an overlap between the

sending and receiving windows. To overcome the problem, the maximum window size should be no more

than half the range of sequence numbers. In this above scenario, if only four unacknowledged frames may be

outstanding, no confusion can result. In general, for a k-bit sequence number field, which provides a sequence

number range of 2k, the maximum window size is limited to 2k-1.

Page 43: 5 DLL-LLC- Book

OTHER DATA LINK CONTROL PROTOCOLSIn addition to HDLC, there are a number of other

important data link control protocols. LAPBLAPDLogical Link Control (LLC)

Frame RelayAsynchronous Transfer Mode (ATM)

Page 44: 5 DLL-LLC- Book

Frame structure

Page 45: 5 DLL-LLC- Book

LAPBLAPB (Link Access Procedure, Balanced) was

issued by ITU-T as part of its X.25packet-switching network-interface standard. It is a

subset of HDLC that providesonly the asynchronous balanced mode (ABM); it is

designed for the point-to-pointlink between a user system and a packet-switching

network node. Its frame formatis the same as that of HDLC.

Page 46: 5 DLL-LLC- Book

LAPDLAPD (Link Access Procedure, D-Channel) was issued by ITU-T as

part of its setof recommendations on ISDN (Integrated Services Digital Network). LAPD provides data link control over the D channel, which is a

logical channel at the user-ISDN interface.There are several key differences between LAPD and HDLC. Like LAPB, LAPD is restricted to ABM. LAPD always uses 7-bit

sequence numbers; 3-bit sequence numbers are not allowed. The FCS for LAPD is always the 16-bit CRC.Finally, the address field for LAPD is a 16-bit field that actually

contains two sub-addresses: one is used to identify one of possibly multiple devices on the user side

of the interface, and The other is used to identify one of possibly multiple logical users of

LAPD on the user side of the interface.

Page 47: 5 DLL-LLC- Book

LLCLLC is part of the IEEE 802 family of standards for

controlling operation over alocal area network (LAN). LLC is lacking some features found in HDLC and

also has some features not found in HDLC.The most obvious difference between LLC and

HDLC is the difference in frame format. Link control functions in the case of LLC are actually

divided between two layers: A medium access control (MAC) layer, and The LLC layer, which operates on top of the MAC

layer.

Page 48: 5 DLL-LLC- Book

LLCAbove Figure shows the structure of the combined MAC/LLC

frame; The shaded portion corresponds to the fields produced at the

LLC layer. The unshaded portions are the header and trailer of the MAC

frame. The MAC layer includes source and destination addresses for

devices attached to the LAN. Two addresses are needed as there is no concept of primary

and secondary in the LAN environment; therefore, both the sender and receiver must be identified.

Error detection is done at the MAC level, using a 32-bit CRC. Finally, there are some control functions peculiar to medium-

access control that may be included in a MAC control field.

Page 49: 5 DLL-LLC- Book

Frame RelayFrame relay is a data link control facility designed to provide a

streamlined capability for use over high-speed packet-switched networks.

It is used in place of X.25,which consists of both a data link control protocol (LAPB) and a network-layerprotocol (called X.25 packet layer).

The data link control protocol defined for frame relay is LAPF (Link Access Procedure for Frame-Mode Bearer Services).

There are actually two protocols: a control protocol, which has similar features to HDLC, and a core protocol, which is a subset of the control protocol.

There are several key differences between the LAPF control protocol and HDLC.

Page 50: 5 DLL-LLC- Book

Asynchronous Transfer Mode (ATM)Like frame relay, ATM is designed to provide a

streamlined data-transfer capability across high-speed networks.

Unlike frame relay, ATM is not based on HDLC.Instead, ATM is based on a completely new frame

format, known as a cell, that provides minimum processing overhead.