Data Link Layer Kuang Chiu Huang TCM NCKU Goals of This Lecture Through the lecture and in-class discussion, students are enabled to describe role and functions of the link layer, and compare different error control schemes. In addition, students can apply media access controls for different transmission media. 2 Outline of the Class Address resolution protocol Flow and error control Multiple access control Engineering Questions How can we associate link and network layer addressing? How can we transfer information reliably across a link? How can we control the throughput of a communications channel? How can we coordinate several accesses in one link? 3
Functions Systems Context End-to-end protocols Network layer protocol Link Layer Link Layer Link Layer What are the end to end protocols? What are the network layer protocols? How are network layer protocols different from link layer? Link Layer Addresses Physical delivery address Need only be locally unique Typically known as the MAC address Often physically embedded in Network Interface Card (NIC) Finding a Host on a Subnet Hosts are known to a subnet (eg. LAN) by their local attachment address (eg. Ethernet or MAC address) An IP address does not help deliver a packet
Finding a Host on a Subnet Address Resolution Protocol Solution: Make a table associating IP with network attachment addresses How? Broadcast unknown IP addresses to all hosts on a subnet Wait for a host to respond Address Resolution Protocol (ARP) Address Resolution Protocol Ethereal session transcript Source Destination Protocol Info 136.142.116.22 Broadcast ARP Who has 136.142.116.238? Tell 136.142.116.22 Ethernet II, Src: 08:00:20:8f:70:66, Dst: ff:ff:ff:ff:ff:ff Address Resolution Protocol (request) Flow Control versus Error Control Flow control: Coordinates the amount of data can be sent before receiving an acknowledge The most important duty of this layer Process: some buffers on receiver side Error control: Error detection and correction Error detection: Parity check, VRC, CRC Error correction: ARQ and FEC Inform the sender any frames are lost or damaged and coordinates the retransmission
Types of errors Lost frames Damaged frames Causes of errors Bit errors Burst errors Error Control Strategies for Flow Control ARQ automatic repeat request Correct errors through retransmission Elements Use error detection Positive acknowledgement Retransmission after timeout NAK and retransmission Forward error correction Encode data so that errors can be detected and corrected Requires redundancy Use FEC when retransmission is impractical Long transmission channels Real time systems Error Detection Parity Vertical redundancy check Longitudinal redundancy check Still not that effective Cyclical redundancy check Based on polynomial division Much more effective than VRC and LRC Vertical and Longitudinal Redundancy Checks Character 1 Character 2 Character m Parity Bit 1 Bit 2 b 11 b 1m C 1 b 2m Bit n Parity b 21 b n1 R 1 b 12 b 22 b n2 R 2 C 2 C n C n+1 b nm R m LRC VRC
Types of ARQ Stop-and-Wait (Idle RQ) Sliding Window (Continuous RQ) Stop and Wait Transmitter sends a packet Receiver receives packet and checks for errors Transmitter must wait for ACK or NAK before sending additional messages Stop and Wait Stop and Wait (Long Channel) 1 Data 0 2 ACK 0 3 Data 1 4 NACK 1 5 Data 1 6 1 ACK 7 Data 2 1 Data 0 2 0 ACK 3 Data 1 4 ACK 1 Increasing bit rate 1 Data 3 2 3 ACK 3 Data 4 4 ACK 4
Sliding Window Transmitter may transmit several messages before awaiting response The number of unacknowledged messages permitted is the Window Size Sliding Window If an error occurs Transmitter resends everything since the error (Go-Back-N) Only the errored packet (Selective Retransmission) Sliding Window (n>3) Sliding Window (Go-Back-N) 0 Data 0 1 Data 1 2 Data 2 3 ACK 2 0 4 Data 4 5 Data 5 6 Data 6 7 NACK 6 1 8 Data 4 9 Data 5 10 Data 6
U 1.0 0.8 0.6 0.4 Performance Issues Stop and Wait Sliding Window (N=7) P=10-3 Performance Issues Stop and Wait Error free tt 1 1 U = = = t p 2tp + tt 2 1 2a 1 t + + With errors t 0.2 0 0.1 1 10 100 1000 Normalized Propagation Delay (a) U 1 P 1 P = = t 1+ 2 p 1 2a t + t Performance Issues Sliding window 1 N 2a+ 1 U = N N < 2a+ 1 ( 1 + 2a) where t a = t p t Medium Access Control Why is MAC necessary? What is the relationship between MAC and the link layer protocols we discussed?
Data link layer divided into two functionality-oriented sublayers Taxonomy of multiple-access protocols discussed in this class RANDOM ACCESS Frames in a pure ALOHA network In random access or contention methods, no station is superior to another station and none is assigned the control over another. No station permits, or does not permit, another station to send. At each instance, a station that has data to send uses a procedure defined by the protocol to make a decision on whether or not to send.
Procedure for pure ALOHA protocol Vulnerable time for pure ALOHA protocol Frames in a slotted ALOHA network Vulnerable time for slotted ALOHA protocol
Vulnerable time in CSMA Collision of the first bit in CSMA/CD Flow diagram for the CSMA/CD Energy level during transmission, idleness, or collision
Timing in CSMA/CA Note In CSMA/CA, if the station finds the channel busy, it does not restart the timer of the contention window; it stops the timer and restarts it when the channel becomes idle. Flow diagram for CSMA/CA CONTROLLED ACCESS In controlled access,, the stations consult one another to find which station has the right to send. A station cannot send unless it has been authorized by other stations. We discuss three popular controlled-access methods.
Reservation access method Polling Token Passing CHANNELIZATION Channelization is a multiple-access method in which the available bandwidth of a link is shared in time, frequency, or through code, between different stations. In this section, we discuss three channelization protocols.
Frequency-division multiple access (FDMA) Note In FDMA, the available bandwidth of the common channel is divided into bands that are separated by guard bands. Time-division multiple access (TDMA) Note In TDMA, the bandwidth is just one channel that is timeshared between different stations.
Simple idea of communication with code Note In CDMA, one channel carries all transmissions simultaneously. Figure 12.24 Chip sequences Figure 12.25 Data representation in CDMA
Figure 12.26 Sharing channel in CDMA Thank you! Q & A 58