490 likes | 860 Views
Data Link Control Chapter 7. Placement of the Data Link Protocol. Functions of Data Link Control. Frame synchronization Flow control Error control Addressing Control and data on same link Link management
E N D
Data Link Control Chapter 7 EE3900 Computer Networks Data Link Control Slide 1
Placement of the Data Link Protocol EE3900 Computer Networks Data Link Control Slide 2
Functions of Data Link Control • Frame synchronization • Flow control • Error control • Addressing • Control and data on same link • Link management • By performing all of the above functions, the datalink layer aims at providing a reliable point-to-point communication link for used by the upper layers EE3900 Computer Networks Data Link Control Slide 4
Frame Synchronization • Why framing? • Easier to detect errors by breaking the bit stream up into discrete frames and compute the checksum for each frame • Data in upper layer (e.g. IP layer in TCP/IP) is organized in units of packets EE3900 Computer Networks Data Link Control Slide 5
Frame Synchronization • Common methods: • Character count • Starting and ending characters, with character stuffing • Starting and ending flags, with bit stuffing (will be discussed in HDLC) • Others EE3900 Computer Networks Data Link Control Slide 6
Character Count EE3900 Computer Networks Data Link Control Slide 7
Starting/ending Characters EE3900 Computer Networks Data Link Control Slide 8
Flow Control • to assure that transmitting entity does not overwhelm receiving entity with data • size of receiver's buffer is limited EE3900 Computer Networks Data Link Control Slide 9
Common Flow Control Methods • Stop and Wait Protocol • Sliding Window Protocols EE3900 Computer Networks Data Link Control Slide 10
We first consider flow control for for error-free transmission. For transmission with errors, techniques such as Automatic Repeat reQuest (ARQ, will be discussed later) are used. EE3900 Computer Networks Data Link Control Slide 11
Stop and Wait • Source transmit a frame, stop and wait for acknowledgement • Destination send back an acknowledgement after reception • Source send the next frame when ACK is received • Destination can stop flow by not send ACK • Works well for a few large frames EE3900 Computer Networks Data Link Control Slide 12
Large block of data may be split into small frames Limited buffer size Errors detected sooner (when whole frame received) On error, retransmission of smaller frames is needed Prevents one station occupying medium for long periods Stop and wait becomes inadequate Fragmentation EE3900 Computer Networks Data Link Control Slide 13
Stop and Wait - Utilization • a = (Propagation Delay)/(Frame transmission time) • a>1: under-utilized • a<1: inefficiently utilized (since time is still wasted in waiting the ACK) • therefore, not suitable for very high data rates or very long distance transmission (why?) EE3900 Computer Networks Data Link Control Slide 15
Sliding-Window • Efficiency improved if multiple frames can be transmitted at the same time • Consider transmission from A to • B: • - B can buffers n frames • - A can send up to n frames without ACK • - or window size = n • - frame sequence number: 0 to m-1 • - n<m, and m is a power of 2 EE3900 Computer Networks Data Link Control Slide 16
Receiver can acknowledge frames without permitting further transmission (Receive Not Ready) Must send a normal acknowledge to resume If duplex, use piggybacking If no data to send, use acknowledgement frame If data but no acknowledgement to send, send last acknowledgement number again Sliding Window Enhacements EE3900 Computer Networks Data Link Control Slide 19
Why Error Detection? • Consider a transmission system with BER=1E-6 • Frame size = 1000 bits • Prob that a frame received with no error = 0.999, or 1 error frame per 1000 transmitted frames, too large! • Frame error rate increases when frame size increases EE3900 Computer Networks Data Link Control Slide 20
K-bit message n-bit frame check sequence (FCS) use Modulo 2 Arithmetic, just the same as exclusive-or operation: 1111 11001 + 1010 × 11 --------- ----------- 0101 11001 11001 ----------- 101011 Cyclic Redundancy Check (CRC) EE3900 Computer Networks Data Link Control Slide 22
Define: T=(k+n)-bit transmitted frame, with n<k M=k-bit message F=n-bit FCS P=a predetermined (n+1)-bit divisor T=2nM + F, where F=Remainder of (2nM)/P Generation of FCS EE3900 Computer Networks Data Link Control Slide 23
M=1010001101 (10 bits) P=110101 (6 bits) F: to be calculated, should be 5 bits 1101010110 P 110101101000110100000 2nM 110101 111011 110101 111010 110101 111110 110101 101100 110101 110010 110101 01110 F Example of FCS Generation EE3900 Computer Networks Data Link Control Slide 24
M=1010001101 (10 bits) P=110101 (6 bits) F=01110 1101010110 P 110101101000110101110 T 110101 111011 110101 111010 110101 111110 110101 101111 110101 110101 110101 00000 No Error! Example of Error Checking EE3900 Computer Networks Data Link Control Slide 25
CRC-16: X16 + X15 + X2 + 1 CRC-CCITT: X16 + X12 + X5 + 1 CRC-32: X32 + X26 + X23 + X16 + X12 + X11 + X10 + X8 + X7 + X5 + X4 + X2 + X + 1 Widely Used Polynomials EE3900 Computer Networks Data Link Control Slide 26
Automatic Repeat Request (ARQ) • Why ARQ? Error-free transmission is not possible in real life • ARQ involves: • Error detection • Positive acknowledgement • Retransmission after timeout • Negative acknowledgement • and retransmission EE3900 Computer Networks Data Link Control Slide 27
based on Stop-and-Wait flow control, plus timeout mechanism simple inefficient Stop-and-Wait ARQ EE3900 Computer Networks Data Link Control Slide 28
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 ACK0 and ACK1 Stop and Wait ARQ EE3900 Computer Networks Data Link Control Slide 29
Go-back-N ARQ • allow multiple frames to be • transmitted at the same time • to improve performance • +ve ack (RR=Receive Ready) • for sliding-window flow • control • -ve ack (REJ=Reject) for • frame retransmission request EE3900 Computer Networks Data Link Control Slide 31
RR2 = Receive Ready 2, or the receiver is now ready to receive frame #2, or the receiver is now looking for frame #2 P bit = indicates that P-bit timer expires EE3900 Computer Networks Data Link Control Slide 32
Selective-reject ARQ • Only frames with -ve ack (SREJ) are retransmitted • more efficient • larger buffer than Go-back-N EE3900 Computer Networks Data Link Control Slide 33
High-level Data Link Control (HDLC) • The most important data • link control protocol • 3 station types • 2 link configurations • 3 data transfer models EE3900 Computer Networks Data Link Control Slide 34
Primary station Controls operation of link Frames issued are called commands Maintains separate logical link to each secondary station Secondary station Under control of primary station Frames issued called responses Combined station May issue commands and responses Station Types EE3900 Computer Networks Data Link Control Slide 35
Unbalanced One primary and one or more secondary stations Supports full duplex and half duplex Balanced Two combined stations Supports full duplex and half duplex HDLC Link Configurations EE3900 Computer Networks Data Link Control Slide 36
Data Transfer Modes • Normal response mode • (NRM) • used with unbalanced configuration • used on multidrop lines • Asynchronous response • mode (ARM) • rarely used • Asynchronous balanced • mode (ABM) EE3900 Computer Networks Data Link Control Slide 37
Asynchronous Balanced mode (ABM) • most widely used of the 3 modes • used with a balanced configuration • each combined station may initiate • transmission without receiving • permission from the other • used as the data link layer protocol • of the widely used packet-switched • X.25 networks EE3900 Computer Networks Data Link Control Slide 38
Synchronous transmission All transmissions in frames Single frame format for all data and control exchanges Frame Structure EE3900 Computer Networks Data Link Control Slide 39
Flag Field • delimit the frame at both ends with 01111110 • a single flag may be used as the closing flag of • one frame and the opening flag of the next • receiver continuously hunting for the flag, if • found, it continues to hunt for ending flag • if the pattern 01111110 appears inside the frame, • then ... EE3900 Computer Networks Data Link Control Slide 40
Bit stuffing Figure 6. 11 Bit Stuffing EE3900 Computer Networks Data Link Control Slide 41
Address Field • for identifying the secondary station • not needed for point-to-point link (e.g. PPP) • 11111111 means all stations, for broadcast use • Control Field • HDLC defines 3 types of frames, each with a different • control field format: • Information frames (I-frames) carry the data • Supervisory frames (S-frames) provide the ARQ • mechanism when piggybacking is not used (e.g. • when there is acknowledgement to be sent, but no • data to be sent back) • Unnumbered frames (U-frames) provide supplemental • link control functions EE3900 Computer Networks Data Link Control Slide 42
Notes: • 3-bit sequence numbers are used • N(S) is the sequence number of the frame • N(R): which number I-frame expected to be received • S: indicate the flow control and error control functions: • Receive Ready (RR) • Receive Not Ready (RNR) • Reject (REJ): initiate the go-back-N ARQ • Selective Reject (SREJ): request retransmission of • just a single frame EE3900 Computer Networks Data Link Control Slide 43
Poll/Final Bit • Use depends on context • Command frame • P bit • 1 to solicit (poll) response from peer • Response frame • F bit • 1 indicates response to soliciting command • Information Field • present only in I-frames and some U-frames • in I-frames it contains upper layer data (e.g. IP packets) • Frame Check Sequence Field • normal code is the 16-bit CRC-CCITT EE3900 Computer Networks Data Link Control Slide 44
HDLC Operations • Consists of the exchange of I-frames, S-frames, and U-frames • Involves 3 phases: • - Initialization • - Data Transfer • - Disconnect EE3900 Computer Networks Data Link Control Slide 45
Initialization • signals the other side that initialization is requested • specifies the mode (NRM, ABM, or ARM) • specifies whether 3- or 7-bit sequence numbers are used • example: EE3900 Computer Networks Data Link Control Slide 46
Examples of Operation (1) EE3900 Computer Networks Data Link Control Slide 47
Examples of Operation (2) EE3900 Computer Networks Data Link Control Slide 48
Other Data Link Protocols • LAPB • used in X.25 • subset of HDLC which provides only the • Asynchronous Balanced Mode (ABM) • LAPD • used in ISDN • also similar to HDLC • LAPDm used in GSM • Point-to-Point Protocol (PPP) • use subset of HDLC • widely used in dialup access to Internet • also widely used in connecting WAN routers • LLC • IEEE 802, used in LAN EE3900 Computer Networks Data Link Control Slide 49