Sunteți pe pagina 1din 52

UNIT 2

DATA-LINK LAYER AND


PROTOCOLS
SRI DATIA

OUTLINE
Encoding Techniques
Data Link Layer Fundamental
Direct-link Protocols
BSC, DDCMP, HDLC, PPP

SRI DATIA

SIGNAL ENCODING
TECHNIQUES

SRI DATIA

ENCODING SCHEMES

SRI DATIA

BIT RATE AND BAUD RATE


Bit rate or data rate: number of bits transmitted
over a period of time (bit per second)
Baud rate: number of symbols transmitted over
a period of time (baud)

SRI DATIA

NON-RETURN TO ZEROLEVEL (NRZ-L)


two different voltages for 0 and 1 bits
voltage constant during bit interval
no transition I.e. no return to zero voltage
such as absence of voltage for zero (0 V), constant positive
voltage for one (+5V)
more often, negative voltage (-5 V) for one value and
positive (+5 V) for the other

SRI DATIA

PROBLEMS OF NRZ-L
Long sequence of 0s or 1s signal leads to baseline
wander
Receiver maintains baseline of detecting 0 or 1
Too many 0s or 1s cause this baseline to change

Clock synchronization
Frequent transitions of signals are necessary to enable clock
recovery
Every clock cycle the sender transmits a bit and the receiver
recovers a bit
Slightly difference in clocks at either sender and receivers may
cause a problem
SRI DATIA

NON-RETURN TO ZERO
INVERTED (NRZI)
nonreturn to zero inverted on ones
constant voltage pulse for duration of bit
data encoded as presence or absence of signal transition at
beginning of bit time
transition (low to high or high to low) denotes binary 1
no transition denotes binary 0

example of differential encoding since have

data represented by changes rather than levels


More example of different encoding: Different Manchester
more reliable detection of transition rather than level
easy to lose sense of polarity
SRI DATIA

MANCHESTER ENCODING
has transition in middle of each bit period
transition serves as clock and data no need to send clock
low to high represents one (1), high to low represents zero (0)
used by IEEE 802.
Both 0s and 1s result in a transition to the signal, the clock can be
effectively recovered at the receiver

SRI DATIA

DIFFERENTIAL MANCHESTER
ENCODING
midbit transition is clocking only
transition at start of bit period representing 0
no transition at start of bit period representing 1
this is a differential encoding scheme

used by IEEE 802.5 (Token Ring)

SRI DATIA

10

PROBLEMS OF
MANCHESTER ENCODING
Double the rate at which signal transition are
made on the link the receiver has half the time
to detect each pulse of the signal.
Bit rate is half of baud rate encoding is only 50%
efficient

SRI DATIA

11

4B/5B
Used together with other encoding techniques
Used in 100Base-TX transmission
The idea is to insert extra bits into the bit stream so as to break
up long sequences of 0s and 1s
Every 4 bits of actual data are encoded in a 5-bit code 4B/5B
Each 5-bit code has no more than one leading 0s and no more
than two trailing 0s.
No pair of 5-bit codes results in more than three consecutive 0s
solve problem of many consecutive 0s
Then the 5-bit codes are then transmitted using the NRZI
encoding
NRZI already solved the problem of consecutive 1s so 4B/5B results
in 80% efficiency

SRI DATIA

12

4B/5B ENCODING
4-bit data is encoded into 5-bit code
One leading 0, two trailing 0s rule
16 codes used, left the other 16 codes
for other purposes
Code 00000 line is dead
Code 1111 line is idle
Code 00100 halt
7 of them violates the rule
The other 6 represent control symbols

SRI DATIA

13

OUTLINE
Encoding Techniques
Data Link Layer Fundamental
Direct-link Protocols
BSC, DDCMP, HDLC, PPP

SRI DATIA

14

DATA LINK LAYER


Because of transmission errors, or because the receiver
may need to regulate data rate, it is necessary to have a
layer of control communication devices
Need layer of logic above Physical to manage exchange of
data over a link

Frame synchronization: beginning and end of each frame must


be recognizable
Flow control: sender must not send frames at a rate faster that the
receiver can absorb them
Error control: correct bit errors
Addressing: identify involving communication parties
Control and data: receiver can distinguish control information
from transmitted data
Link management: initiation, maintenance, and termination
SRI DATIA

15

FLOW CONTROL
ensure sending entity does not overwhelm receiving
entity
by preventing buffer overflow

influenced by:
transmission time
time taken to emit all bits into medium

propagation time
time for a bit to traverse the link

SRI DATIA

16

STOP AND WAIT


source transmits frame
destination receives frame and replies with
acknowledgement (ACK)
source waits for ACK before sending next
destination can stop flow by not send ACK
works well for a few large frames
Stop and wait becomes inadequate if large block of data
is split into small frames
SRI DATIA

17

SLIDING WINDOWS FLOW


CONTROL
allows multiple numbered frames to be in transit
receiver has buffer W long
transmitter sends up to W frames without ACK
ACK includes number of next frame expected
sequence number is bounded by size of field (k)
frames are numbered modulo 2k
giving max window size of up to 2k - 1

must send a normal acknowledge to resume


Piggybacking: insert acknowledgement number field in data
frame so that a frame can contain both sequence number and
ACK numbers
SRI DATIA

18

SLIDING WINDOW DIAGRAM

SRI DATIA

19

ERROR CONTROL
detection and correction of errors such as:
lost frames
damaged frames

common techniques use:


error detection
positive acknowledgment (ACK)
retransmission after timeout
negative acknowledgement (NAK) & retransmission

SRI DATIA

20

AUTOMATIC REPEAT
REQUEST (ARQ)
collective name for such error control
mechanisms, including:
stop and wait
go back N
selective reject (selective retransmission)

SRI DATIA

21

STOP AND WAIT


source transmits single frame
wait for ACK
if received frame damaged, discard it
transmitter has timeout
if no ACK within timeout, retransmit

if ACK damaged,transmitter will not recognize it


transmitter will retransmit
receive gets two copies of frame
use alternate numbering and ACK0 / ACK1
SRI DATIA

22

STOP AND WAIT


see example with both types of errors
pros and cons
simple
inefficient

SRI DATIA

23

GO BACK N
based on sliding window
if no error, ACK as usual
use window to control number of outstanding
frames
if error, reply with rejection
discard that frame and all future frames until error frame
received correctly
transmitter must go back and retransmit that frame and all
subsequent frames
SRI DATIA

24

GO BACK N - HANDLING
Damaged Frame
error in frame i so receiver rejects frame i
transmitter retransmits frames from i

Lost Frame
frame i lost and either
transmitter sends i+1 and receiver gets frame i+1 out of seq and rejects
frame i
or transmitter times out and send ACK with P bit set which receiver
responds to with ACK i

transmitter then retransmits frames from i

SRI DATIA

25

GO BACK N - HANDLING
Damaged Acknowledgement
receiver gets frame i, sends ack (i+1) which is lost
acks are cumulative, so next ack (i+n) may arrive before
transmitter times out on frame i
if transmitter times out, it sends ack with P bit set
can be repeated a number of times before a reset procedure
is initiated

Damaged Rejection
reject for damaged frame is lost
handled as for lost frame when transmitter times out
SRI DATIA

26

SELECTIVE REJECT
also called selective retransmission
only rejected frames are retransmitted
subsequent frames are accepted by the receiver and
buffered
minimizes retransmission
receiver must maintain large enough buffer
more complex logic in transmitter
hence less widely used
useful for satellite links with long propagation delays
SRI DATIA

27

GO BACK N
VS
SELECTIVE
REJECT

SRI DATIA

28

ERROR DETECTION
Two-dimensional parity
Internet checksum
Cyclic Redundancy Check

SRI DATIA

29

INTERNET CHECKSUM
Not used in the link layer
checksum for the internet protocol:

Sum 16-bit data blocks


Take one complement of the result to produce the checksum

E.g. calculate checksum of 5 and 3

5 (0101) + 3 (0011) = 8 (1000)


Checksum = -8 (0111)
Send 5, 3, -8 to receiver send 010100110111
Calculate 5+3+(-8)
0101
0011
0111
1111
SRI DATIA

30

OUTLINE
Encoding Techniques
Data Link Layer Fundamental
Direct-link Protocols
BSC, DDCMP, HDLC, PPP

SRI DATIA

31

BSC (OR BISYNC)


PROTOCOL
Binary Synchronous Communication
Byte-oriented approach: view each frame as a collection
of bytes (characters) rather than a collection of bits
Support a particular character set: ASCII, EBCDIC, and
IBMs 6-bit Transcode

SRI DATIA

32

PROBLEM OF BISYNC
ETX character may appear in the body of a frame
Solved by character stuffing insert a special
character called DLE (data-link-escape) character
whenever it appears in the body

SRI DATIA

33

POINT-TO-POINT (PPP)
PROTOCOL
Designed to encapsulate IP inter-network data
Commonly run over dial-up modem links, but can be used on
any leased line for point-to-point connections not supported by
FR or ATM.
Have character stuffing
Several of the field sizes are negotiated rather than fixed
using LCP (Link Control Protocol)
Two sub protocols: LCP (Link Control Protocol) and NCP
(Network Control Protocol) to negotiate options for a networklayer protocol running on top of PPP
IPCP (Internet Protocol Control Protocol) for IP

IPXCP for IPX, ATCP for AppleTalk


SRI DATIA

34

PPP FRAME FORMAT


Flag: 011111110
Protocol: identify high-level protocol e.g. IP or IPX
Payload: size is negotiated, default at 150 bytes
Checksum: 2-4 bytes long

SRI DATIA

35

LCP
Negotiation of payload size is conducted by LCP
Frame payload size can be negotiated, 1500 byte by default
LCP sends control messages encapsulated in PPP frames
Such messages are denoted by an LCP identifier in the PPP Protocol
field
Sizes are changed based on the information contained in those control
messages

SRI DATIA

36

PPP (CONTD)
PPP tends to be reserved for dialup or a mixedvendor environment, whereas HDLC is the default
for T1 serial connections

SRI DATIA

37

DECNETS DDCMP
Byte-Counting Approach: include number of bytes
contained in a frame as a field in the frame header
Transmission error can corrupt the COUNT field
framing error

SRI DATIA

38

HIGH-LEVEL DATA LINK


CONTROL (HDLC)
Previously known as Synchronous Data Link Control (SDLC)
protocol
Most popular data link control (L2) protocol
Form the basis of ISDN and FR protocols and services
specified as ISO 33009, ISO 4335
station types:
Primary - controls operation of link

Frames issued are called commands

Secondary - under control of primary station


Frames issued are called responses

Combined - issues commands and responses

link configurations

Unbalanced - 1 primary, multiple secondary


Balanced - 2 combined stations
SRI DATIA

39

HDLC TRANSFER MODES


Normal Response Mode (NRM)
unbalanced config, primary initiates transfer, secondary may only
transmit data in response to a command
used on multi-drop lines, e.g. host + terminals

Asynchronous Balanced Mode (ABM)


balanced config, either station initiates transmission, has no polling
overhead, widely used

Asynchronous Response Mode (ARM)


unbalanced config, secondary may initiate transmit without permission
from primary, rarely used

SRI DATIA

40

HDLC FRAME STRUCTURE


synchronous transmission of frames (no start-stop bits
required)
single frame format used
header

trailer

SRI DATIA

41

FLAG FIELDS AND BIT


STUFFING
delimit frame at both ends with 01111110 sequence
The sequence is transmitted any time that the link is idle to keep
clock synchronized
bit stuffing used to avoid confusion with data containing flag
sequence 01111110
0 inserted after every sequence of five 1s
if receiver detects five 1s it checks next bit
if next bit is 0, it is deleted (was stuffed bit)
if next bit is 1 and seventh bit is 0, accept as the end-of-frame flag

if sixth and seventh bits 1, sender is indicating abort (error occurred)

SRI DATIA

42

FLAG FIELDS AND BIT


STUFFING (CONTD)
In both bit stuff and character stuffing, the size of a frame
is dependent on the data being sent in the payload.
Not possible to make all the frames exactly the same size

SRI DATIA

43

ADDRESS FIELD
identifies secondary station that sent or will receive frame
usually 8 bits long
may be extended to multiples of 7 bits
LSB indicates if is the last octet (1) or not (0)

not needed for point-to-point link


all ones address 11111111 is broadcast

Allow primary station to broadcast a frame for reception by all secondaries

SRI DATIA

44

CONTROL FIELD
different for different frame type
Information (I-) frame - data transmitted to user (next layer up)
Flow and error control piggybacked on information frames

Supervisory (S-) frame - ARQ when piggyback not used


Unnumbered (U-) frame - supplementary link control

first 1-2 bits of control field identify frame type

SRI DATIA

45

CONTROL FIELD (CONTD)

use of Poll/Final bit depends on context

in command frame is P bit set to1 to solicit (poll) response from


peer
in response frame is F bit set to 1 to indicate response to
soliciting command
Sequence number in S- and I-frames usually 3 bits
can extend to 8 bits as shown below

SRI DATIA

46

INFORMATION & FCS


FIELDS
Information Field
in information and some unnumbered frames
must contain integral number of octets
variable length

Frame Check Sequence Field (FCS)


used for error detection
either 16 bit CRC or 32 bit CRC

SRI DATIA

47

HDLC OPERATION
consists of exchange of information, supervisory and
unnumbered frames
have three phases
initialization
by either side, set mode & seq

data transfer

Selective reject

with flow and error control


using both I & S-frames (RR, RNR, REJ, SREJ)

disconnect

Go Back N reject

when ready or fault noted

SRI DATIA

48

HDLC
COMMANDS
AND
RESPONSES

SRI DATIA

49

HDLC OPERATION EXAMPLE


Set sync
balanced mode

Send seq no

Receive seq no

busy

Unnumbered
acknowledgement

Disconnect

A must
respond with
RR or RNR

Return from
busy condition

SRI DATIA

50

HDLC OPERATION EXAMPLE

SRI DATIA

51

Next Lecture

QUESTIONS?

LANs and Hispeed LANs


SRI DATIA

52

S-ar putea să vă placă și