Chapt 3 Data Link Layer1 Data Link Layer Functions –Provides services to network layer Well-defined interface –Framing –Flow control – between adjacent machines –Error control –between adjacent machines The last two functions are provided for wireless LANs & in transport layer between host machines Other layers may also contain error & flow control –Modems today include error control
Chapt 3 Data Link Layer2 Services to network layer Unacknowledged connectionless service –Wired LANs use this because they have low error rate If frame must be corrected, transport layer will handle it Multimedia is better lost than late –We assume all frames are sent on same path for LANs Acknowledged connectionless service –If no ack is received, frame is resent Cheaper to correct at lower layer for unreliable media Acknowledged connection-oriented service –Connection established; state maintained
Chapt 3 Data Link Layer3 Framing –Frame delimiting Stop (0)/start (1) bits Beginning delimiter + character count Starting and ending characters –Character (byte) stuffing –Start (STX ) and end (ETX) flags for delimiting –ESC stuffed if encountered internally Starting and ending flags – delimiter with bit stuffing after 5 internal 1s Code violations
Error Detecting Codes Parity bits – perhaps one bit for each byte –Odd/ even parity –Detects only an odd number of incorrect bits –Not appropriate for burst errors Arrange data by columns –Compute parity bits at the end of each column –Detects errors perhaps.95% of the time (depending on channel) Chapt 3 Data Link Layer4
5 Error Detecting Codes (cont.) Backward Error Control (BEC) –Burst and random errors assumed CRC (cyclic redundancy code) »e.g., CRC-CCITT (16 bits) Example p.214 » by –Sender must resend incorrect frame Does receiver send NAK and/or does sender time-out and resend –Timer needed because NAK may be lost –Is this appropriate for multimedia applications? Delay! –At what layer and for what applications is BEC used?
Chapt 3 Data Link Layer6 Error Control Forward Error Control (FEC) –Enough redundancy is transmitted to correct errors that occur Codewords and Hamming distance Applications – ATM header, military use, space exploration, cellular phones –Note that ATM is defined for fiber, typically one bit errors, FEC is more appropriate P. 213
Chapt 3 Data Link Layer7 Flow control Stop sender from flooding receiver- frames may be lost If ack is part of protocol, frame can be discarded –Sender will time-out and resend –But this will cause additional traffic –Sender and Receiver agree to buffer size Option negotiation –Receiver sends signal for more frames May be after each frame or after group of frames
Chapt 3 Data Link Layer8 Flow control (cont.) ARQ –Window size of 1 (stop and wait) –Sender sends a frame and waits for receiver’s acknowledgement Error and flow control are integrated Frame and ack must be numbered 0 or 1 (1 bit sequence number) –Time-out and resend if ack is not received
Chapt 3 Data Link Layer9 Utilization of the channel This is a percentage, always less than 1 –U = good stuff / total stuff –We compute in terms of time U = transmission time of frame transmission time of (frame + ack) + 2T p –Increasing window size can increase utilization
Efficiency of Stop and Wait Assume use of stop and wait flow control for GEOs; 36 *10 6 meters high with transmission rate of 100Mbps; frame size of 1000 bits T x = 1000 bits /1000Mbps = 1 millionth of a sec. T p = 36 *10 6 meters/ 3 * 10 8 meters/sec =12/100 sec uplink and downlink propagation is.024 sec. Utilization of channel = T x = = 1 T x +2T p Chapt 3 Data Link Layer10
Chapt 3 Data Link Layer11 Flow control (cont.) For greater efficiency, allow multiple frames on the channel at the same time (fill the pipe) ARQ go back N –Windows size > 1 Sender size 2 bits in sequence number - 1 Receiver – window size of 1 ARQ selective reject –Window sizes of sender and receiver sum to –2 bits in sequence number
Chapt 3 Data Link Layer12 Sample Protocol - HDLC Framing – bit stuffing CRC Control field –Information frames Sequence Number Acknowledgment number –Supervisory frames for REJ, RR, RNR –Unnumbered frames
Chapt 3 Data Link Layer13 Sample Protocol – PPP Based on HDLC –RFC 1661,1662,1663 –Used for user-to-ISP, router-to-router –No address or control field may be necessary Can be left off –Character stuffing instead of bit stuffing –Protocol field to work with different protocols –Control field of (unnumbered)
Chapt 3 Data Link Layer14 Frame Relay & ATM Developed for fiber –Connection oriented –no ARQ –ATM dropped error control (except forward error control on header) and flow control – basically no data link coverage