Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Networks The Data Link Layer Part 3: Error Control

Similar presentations


Presentation on theme: "Computer Networks The Data Link Layer Part 3: Error Control"— Presentation transcript:

1 Computer Networks The Data Link Layer Part 3: Error Control
EEE449 Computer Networks The Data Link Layer Part 3: Error Control En. Mohd Nazri Mahmud MPhil (Cambridge, UK) BEng (Essex, UK) Room 2.14 Semester

2 Error Control & Detection
detection and correction of errors such as: lost frames damaged frames common techniques use: error detection positive acknowledgment retransmission after timeout negative acknowledgement & retransmission Error control refers to mechanisms to detect and correct errors that occur in the transmission of frames. The model that we will use, which covers the typical case, was illustrated earlier in Figure 7.1b. As before, data are sent as a sequence of frames; frames arrive in the same order in which they are sent; and each transmitted frame suffers an arbitrary and potentially variable amount of delay before reception. In addition, we admit the possibility of two types of errors: • Lost frame: frame fails to arrive at the other side, eg. because a noise burst damaged a frame so badly it is not recognized • Damaged frame: A recognizable frame does arrive, but some of the bits are in error (have been altered during transmission). The most common techniques for error control are based on some or all of the following ingredients: • Error detection: As discussed in the Chapter 6. • Positive acknowledgment: The destination returns a positive acknowledgment to successfully received, error-free frames. • Retransmission after timeout: The source retransmits a frame that has not been acknowledged after a predetermined amount of time. • Negative acknowledgment and retransmission: The destination returns a negative acknowledgment to frames in which an error is detected. The source retransmits such frames. Copyright USM Semester

3 Error detection Parity Check CRC Copyright USM Semester

4 Error detection Parity Check The simplest error detection scheme
Appends a parity bit to the end of a block of data 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) Example – transmission of a 7-bit IRA character G ( ) using odd parity will append a 1 and transmit The receiver examines the received character and of the number of 1s is odd it assumes no error. If one bit is erroneously inverted during transmission then the receiver will detect an error However, if two (or any even number) of bits are inverted due to error, an undetected error occur. The use of parity bit is not foolproof as the noise impulses are often long enough to destroy more than one bit particularly at high data rates. Copyright USM Semester

5 Error detection Cyclic Redundancy Check
Given a k-bit block of bits, or message , the transmitter generates an n-bit sequence known as a frame check sequence (FCS) so that the resulting frame consisting of k+n bits 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 If one bit is erroneously inverted during transmission then the receiver will detect an error However, if two (or any even number) of bits are inverted due to error, an undetected error occur. The use of parity bit is not foolproof as the noise impulses are often long enough to destroy more than one bit particularly at high data rates. Copyright USM Semester

6 Error detection Cyclic Redundancy Check Let
T = (k+n)-bit frame to be transmitted, with n<k M= k-bit message, the first k bits of T F- n-bit FCS, the last n bits of T P = pattern of n+1 bits, the predetermined divisor Example M = (10 bits) Pattern P = (6 bits) FCS R = to be calculated(5 bits) If one bit is erroneously inverted during transmission then the receiver will detect an error However, if two (or any even number) of bits are inverted due to error, an undetected error occur. The use of parity bit is not foolproof as the noise impulses are often long enough to destroy more than one bit particularly at high data rates. Copyright USM Semester

7 Error detection Cyclic Redundancy Check
Example M = (10 bits) Pattern P = (6 bits) FCS R = to be calculated(5 bits ie n=5) Operations are carried out in modulo-2 arithmetic The message is multiplied by 2n ie=(25) giving The product is divided by P giving remainder or 01110 The remainder is added to 2nM to give T = At the receiver the received frame is divided by P, if there is no remainder, it assumes no error. The pattern P is chosen to be one bit longer than the desired FCS and the exact bit pattern chosen depends on the types of errors expected If one bit is erroneously inverted during transmission then the receiver will detect an error However, if two (or any even number) of bits are inverted due to error, an undetected error occur. The use of parity bit is not foolproof as the noise impulses are often long enough to destroy more than one bit particularly at high data rates. Copyright USM Semester

8 Error detection Cyclic Redundancy Check
Polynomial treatment of the CRC Express all values as polynomials in a dummy variable X with binary coefficients The coefficients correspond to the bits in the binary number For example for a message M = in polynomial form is X9 + X7 + X3 + X2 + 1 and pattern P= as X5 + X4 +X2 + 1 Modulo-2 arithmetic is used again If one bit is erroneously inverted during transmission then the receiver will detect an error However, if two (or any even number) of bits are inverted due to error, an undetected error occur. The use of parity bit is not foolproof as the noise impulses are often long enough to destroy more than one bit particularly at high data rates. Copyright USM Semester

9 Error detection Cyclic Redundancy Check
4 versions of pattern, P are widely used CRC-12 system is used for transmission of streams of 6-bit characters and generates a 12-bit FCS Both CRC-16 and CRC-CCITT are popular for 8-bit characters with 16-bit FCS. If one bit is erroneously inverted during transmission then the receiver will detect an error However, if two (or any even number) of bits are inverted due to error, an undetected error occur. The use of parity bit is not foolproof as the noise impulses are often long enough to destroy more than one bit particularly at high data rates. Copyright USM Semester

10 Error detection Cyclic Redundancy Check Digital Logic Implementation
The CRC process can be implemented as individual circuit consisting of EX-OR gates and a shift register If one bit is erroneously inverted during transmission then the receiver will detect an error However, if two (or any even number) of bits are inverted due to error, an undetected error occur. The use of parity bit is not foolproof as the noise impulses are often long enough to destroy more than one bit particularly at high data rates. Copyright USM Semester

11 Error detection Cyclic Redundancy Check Digital Logic Implementation
The register contains n bits (equal to the length of the FCS) There are up to n EX-OR gates The presence or absence of a gate corresponds to the presence or absence of a term in the divisor polynomial, P(X) excluding the Xn term If one bit is erroneously inverted during transmission then the receiver will detect an error However, if two (or any even number) of bits are inverted due to error, an undetected error occur. The use of parity bit is not foolproof as the noise impulses are often long enough to destroy more than one bit particularly at high data rates. Copyright USM Semester

12 Error detection Cyclic Redundancy Check Digital Logic Implementation
The process begins with the shift register cleared (all zeros) The message is then entered one bit at a time starting with the most significant bit After the last bit is processed the shift register contains the remainder (FCS) At the receiver, the same logic is used As each bit of M arrives, it is inserted into the shift register. If there have been no errors, the shift register should contain the bit pattern for R at the conclusion of M If one bit is erroneously inverted during transmission then the receiver will detect an error However, if two (or any even number) of bits are inverted due to error, an undetected error occur. The use of parity bit is not foolproof as the noise impulses are often long enough to destroy more than one bit particularly at high data rates. Copyright USM Semester

13 Error detection Cyclic Redundancy Check Digital Logic Implementation
At the receiver, the same logic is used As each bit of M arrives, it is inserted into the shift register. If there have been no errors, the shift register should contain the bit pattern for R at the conclusion of M The transmitted bits of R now begin to arrive and the effect is to zero out the register so that at the conclusion of reception, the register contains all 0s If one bit is erroneously inverted during transmission then the receiver will detect an error However, if two (or any even number) of bits are inverted due to error, an undetected error occur. The use of parity bit is not foolproof as the noise impulses are often long enough to destroy more than one bit particularly at high data rates. Copyright USM Semester

14 Error detection Cyclic Redundancy Check
Digital Logic Implementation For example for message M = and divisor P = If one bit is erroneously inverted during transmission then the receiver will detect an error However, if two (or any even number) of bits are inverted due to error, an undetected error occur. The use of parity bit is not foolproof as the noise impulses are often long enough to destroy more than one bit particularly at high data rates. Copyright USM Semester

15 Error detection Copyright USM Semester 1 2009-2010
If one bit is erroneously inverted during transmission then the receiver will detect an error However, if two (or any even number) of bits are inverted due to error, an undetected error occur. The use of parity bit is not foolproof as the noise impulses are often long enough to destroy more than one bit particularly at high data rates. Copyright USM Semester

16 Error Control : Automatic Repeat Request (ARQ)
collective name for such error control mechanisms, including: stop and wait go back N selective reject (selective retransmission) Collectively, these mechanisms are all referred to as automatic repeat request (ARQ); the effect of ARQ is to turn an unreliable data link into a reliable one. Three versions of ARQ have been standardized: Stop-and-wait ARQ Go-back-N ARQ Selective-reject ARQ All of these forms are based on the use of the flow control techniques discussed in Section 7.1. We examine each in turn. Copyright USM Semester

17 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 Stop-and-wait ARQ is based on the stop-and-wait flow control technique outlined previously. 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. Two sorts of errors could occur. First, the frame that arrives at the destination could be damaged. The receiver detects this by using the 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 that the timer expires, then the same frame is sent again. Note that this method requires that the transmitter maintain a copy of a transmitted frame until an acknowledgment is received for that frame. The second sort of error is a damaged acknowledgment, which is not recognizable by A, which will therefore time out and resend the same frame. This duplicate frame arrives and is accepted by B. B 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, and positive acknowledgments are of the form ACK0 and ACK1. In keeping with the sliding-window convention, an ACK0 acknowledges receipt of a frame numbered 1 and indicates that the receiver is ready for a frame numbered 0. Copyright USM Semester

18 Stop and Wait see example with both types of errors pros and cons
simple inefficient Stallings DCC8e Figure 7.5 gives an example of the use of stop-and-wait ARQ, showing the transmission of a sequence of frames from source A to destination B. The figure shows the two types of errors just described. The third frame transmitted by A is lost or damaged and therefore B does not return an ACK. A times out and retransmits the frame. Later, A transmits a frame labeled 1 but the ACK0 for that frame is lost. A times out and retransmits the same frame. When B receives two frames in a row with the same label, it discards the second frame but sends back an ACK0 to each. The principal advantage of stop-and-wait ARQ is its simplicity. Its principal disadvantage is that stop-and-wait is an inefficient mechanism. Copyright USM Semester

19 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 The sliding-window flow control technique can be adapted to provide more efficient line use, sometimes referred to as continuous ARQ. The form of error control based on sliding-window flow control that is most commonly used is called go-back-N ARQ. In this method, a station may send a series of frames sequentially numbered modulo some maximum value. The 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 incoming frames as usual (RR = receive ready, or piggybacked acknowledgment). If the destination station detects an error in a frame, it may send a negative acknowledgment (REJ = reject) for that frame, as explained in the following rules. The destination station will discard that frame and all future incoming frames until the frame in error is correctly received. Thus, the source station, when it receives a REJ, must retransmit the frame in error plus all succeeding frames that were transmitted in the interim. Copyright USM Semester

20 Go Back N - Handling Damaged Frame Lost 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 Suppose that station A is sending frames to station B. After each transmission, A sets an acknowledgment timer for the frame just transmitted. Suppose that B has previously successfully received frame (i – 1) and A has just transmitted frame i. The go-back-N technique takes into account the following contingencies: 1. Damaged frame. 2. Lost Frame 3. Damaged Ack 4. Damaged Reject Copyright USM Semester

21 Go Back N - Handling Damaged Acknowledgement Damaged Rejection
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 Copyright USM Semester

22 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 With selective-reject ARQ, the only frames retransmitted are those that receive a negative acknowledgment, in this case called SREJ, or those that time out. Selective reject 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 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 widely used than go-back-N ARQ. Selective reject is a useful choice for a satellite link because of the long propagation delay involved. Copyright USM Semester

23 Go Back N vs Selective Reject
Stallings DCC8e Figure 7.6a is an example of the frame flow for go-back-N ARQ. Because of the propagation delay on the line, by the time that an acknowledgment (positive or negative) arrives back at the sending station, it has already sent at least one additional frame beyond the one being acknowledged. In this example, frame 4 is damaged. Frames 5 and 6 are received out of order and are discarded by B. When frame 5 arrives, B immediately sends a REJ 4. When the REJ to frame 4 is received, not only frame 4 but frames 5 and 6 must be retransmitted. Note that the transmitter must keep a copy of all unacknowledged frames. Figure 7.6a also shows an example of retransmission after timeout. No acknowledgment is received for frame 5 within the timeout period, so A issues an RR to determine the status of B. Stallings DCC8e Figure 7.6b illustrates selective-reject ARQ. When frame 5 is received out of order, B sends a SREJ 4, indicating that frame 4 has not been received. However, B continues to accept incoming frames and buffers them until a valid frame 4 is received. At that point, B can place the frames in the proper order for delivery to higher-layer software. Copyright USM Semester

24 Protocol case studies HDLC MAC for IEEE 802.3 (The Ethernet)
IEEE (WiFi)

25 Data Link Control Protocol: High Level Data Link Control (HDLC)
an important data link control protocol specified as ISO 33009, ISO 4335 station types: Primary - controls operation of link Secondary - under control of primary station Combined - issues commands and responses link configurations Unbalanced - 1 primary, multiple secondary Balanced - 2 combined stations The most important data link control protocol is HDLC (ISO 3009, ISO 4335). Not only is HDLC widely used, but it is the basis for many other important data link control protocols, which use the same or similar formats and the same mechanisms as employed in HDLC. To satisfy a variety of applications, HDLC defines: three station types: • Primary station: Responsible for controlling the operation of the link. Frames issued by the primary are called commands. • Secondary station: Operates under the control of the primary station. Frames issued by a secondary are called responses. The primary maintains a separate logical link with each secondary station on the line. • Combined station: Combines the features of primary and secondary. A combined station may issue both commands and responses. It also defines two link configurations: • Unbalanced configuration: Consists of one primary and one or more secondary stations and supports both full-duplex and half-duplex transmission. • Balanced configuration: Consists of two combined stations and supports both full-duplex and half-duplex transmission. Semester 25

26 HDLC Transfer Modes Normal Response Mode (NRM)
unbalanced config, primary initiates transfer used on multi-drop lines, eg 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 HDLC defines three data transfer modes: • Normal response mode (NRM): Used with an unbalanced configuration. The primary may initiate data transfer to a secondary, but a secondary may only transmit data in response to a command from the primary. NRM is used on multi-drop lines, in which a number of terminals are connected to a host computer. • Asynchronous balanced mode (ABM): Used with a balanced configuration. Either combined station may initiate transmission without receiving permission from the other combined station. ABM is the most widely used of the three modes; it makes more efficient use of a full-duplex point-to-point link because there is no polling overhead. • Asynchronous response mode (ARM): Used with an unbalanced configuration. The secondary may initiate transmission without explicit permission of the primary. The primary still retains responsibility for the line, including initialization, error recovery, and logical disconnection. ARM is rarely used; it is applicable to some special situations in which a secondary may need to initiate transmission. Semester 26

27 HDLC Frame Structure synchronous transmission of frames
single frame format used HDLC uses synchronous transmission. All transmissions are in the form of frames, and a single frame format suffices for all types of data and control exchanges. Stallings DCC8e Figure 7.7a depicts the structure of the HDLC frame. The flag, address, and control fields that precede the information field are known as a header. The FCS and flag fields following the data field are referred to as a trailer. Semester 27

28 Flag Fields and Bit Stuffing
delimit frame at both ends with seq receiver hunts for flag sequence to synchronize bit stuffing used to avoid confusion with data containing flag seq 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 flag if sixth and seventh bits 1, sender is indicating abort Flag fields delimit the frame at both ends with the unique pattern A single flag may be used as the closing flag for one frame and the opening flag for the next. On both sides of the user-network interface, receivers are continuously hunting for the flag sequence to synchronize on the start of a frame. While receiving a frame, a station continues to hunt for that sequence to determine the end of the frame. Because the protocol allows the presence of arbitrary bit patterns, there is no assurance that the pattern will not appear somewhere inside the frame, thus destroying synchronization. To avoid this problem, a procedure known as bit stuffing is used. For all bits between the starting and ending flags, the transmitter inserts an extra 0 bit after each occurrence of five 1s in the frame. After detecting a starting flag, the receiver monitors the bit stream. When a pattern of five 1s appears, the sixth bit is examined. If this bit is 0, it is deleted. If the sixth bit is a 1 and the seventh bit is a 0, the combination is accepted as a flag. If the sixth and seventh bits are both 1, the sender is indicating an abort condition. With the use of bit stuffing, arbitrary bit patterns can be inserted into the data field of the frame. This property is known as data transparency. Stallings DCC8e Figure 7.8 shows an example of bit stuffing. Note that in the first two cases, the extra 0 is not strictly necessary for avoiding a flag pattern but is necessary for the operation of the algorithm. Semester 28

29 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) all ones address is broadcast The address field identifies the secondary station that transmitted or is to receive the frame. This field is not needed for point-to-point links but is always included for the sake of uniformity. The address field is usually 8 bits long but, by prior agreement, an extended format may be used in which the actual address length is a multiple of 7 bits. The leftmost bit of each octet is 1 or 0 according as it is or is not the last octet of the address field. The remaining 7 bits of each octet form part of the address. The single-octet address of is interpreted as the all-stations address in both basic and extended formats. It is used to allow the primary to broadcast a frame for reception by all secondaries. Semester 29

30 Control Field different for different frame type
Information - data transmitted to user (next layer up) Flow and error control piggybacked on information frames Supervisory - ARQ when piggyback not used Unnumbered - supplementary link control first 1-2 bits of control field identify frame type HDLC defines three types of frames, each with a different control field format. Information frames (I-frames) carry the data to be transmitted for the user (the logic above HDLC that is using HDLC). Additionally, flow and error control data, using the ARQ mechanism, are piggybacked on an information frame. Supervisory frames (S-frames) provide the ARQ mechanism when piggybacking is not used. Unnumbered frames (U-frames) provide supplemental link control functions. The first one or two bits of the control field serves to identify the frame type. The remaining bit positions are organized into subfields as indicated in Figures 7.7c and d (next slide). Semester 30

31 Control Field 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 seq number usually 3 bits can extend to 8 bits as shown below All of the control field formats contain the poll/final (P/F) bit. Its use depends on context. Typically, in command frames, it is referred to as the P bit and is set to 1 to solicit (poll) a response frame from the peer HDLC entity. In response frames, it is referred to as the F bit and is set to 1 to indicate the response frame transmitted as a result of a soliciting command. Note that the basic control field for S- and I-frames uses 3-bit sequence numbers, as shown on previous slide. With the appropriate set-mode command, an extended control field can be used for S- and I-frames that employs 7-bit sequence numbers. U-frames always contain an 8-bit control field. Semester 31

32 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 The information field is present only in I-frames and some U-frames. The field can contain any sequence of bits but must consist of an integral number of octets. The length of the information field is variable up to some system-defined maximum. The frame check sequence (FCS) is an error-detecting code calculated from the remaining bits of the frame, exclusive of flags. The normal code is the 16-bit CRC-CCITT defined in Section 6.3. An optional 32-bit FCS, using CRC-32, may be employed if the frame length or the line reliability dictates this choice. Semester 32

33 HDLC Operation consists of exchange of information, supervisory and unnumbered frames have three phases initialization by either side, set mode & seq data transfer with flow and error control using both I & S-frames (RR, RNR, REJ, SREJ) disconnect when ready or fault noted HDLC operation consists of the exchange of I-frames, S-frames, and U-frames between two stations. The various commands and responses defined for these frame types are listed in Stallings DCC8e Table 7.1. In describing HDLC operation, we will discuss these three types of frames. The operation of HDLC involves three phases: First, one side or another initializes the data link so that frames may be exchanged in an orderly fashion. During this phase, the options that are to be used are agreed upon, such as which of the three modes (NRM, ABM, ARM) is requested, and whether 3- or 7-bit sequence numbers are to be used. After initialization, the two sides exchange user data and the control information to exercise flow and error control. Both sides may begin to send user data in I-frames, starting with sequence number 0. The N(S) and N(R) fields of the I-frame are sequence numbers that support flow control and error control. S-frames are also used for flow control and error control. The receive ready (RR) frame acknowledges the last I-frame received. Receive not ready (RNR) acknowledges an I-frame, as with RR, but also asks the peer entity to suspend transmission of I-frames. When again ready, it sends an RR. REJ initiates the go-back-N ARQ. It indicates that the last I-frame received has been rejected and that retransmission of all I-frames beginning with number N(R) is required. Selective reject (SREJ) is used to request retransmission of just a single frame. Finally, one of the two sides signals the termination of the operation, either on its own initiative if there is some sort of fault, or at the request of its higher-layer user. HDLC issues a disconnect by sending a disconnect (DISC) frame. Semester 33

34 HDLC Operation Example
Examples of HDLC operation are shown here in Stallings DCC8e Figure 7.9. Figure 7.9a shows the frames involved in link setup and disconnect. One side issues an SABM command and starts a timer. Upon receiving the SABM,the recipient returns a UA response and sets local variables and counters to initial values. The initiating entity receives the UA response, sets its variables and counters, and stops the timer. The logical connection is now active, and both sides may begin transmitting frames. Should the timer expire without a response to an SABM, the originator will repeat the SABM, as illustrated. The same figure (Figure 7.9a) shows the disconnect procedure. One side issues a DISC command, and the other responds with a UA response. Figure 7.9b illustrates the full-duplex exchange of I-frames. When an entity sends a number of I-frames in a row with no incoming data, then the receive sequence number is simply repeated (e.g., I,1,1; I,2.1 in the A-to-B direction). When an entity receives a number of I-frames in a row with no outgoing frames, then the receive sequence number in the next outgoing frame must reflect the cumulative activity (e.g., I,1,3 in the B-to-A direction). Figure 7.9c shows an operation involving a busy condition, where the entity's receive buffer fills up and it must halt the incoming flow of I-frames, using an RNR command. In this example, A issues an RNR, which requires B to halt transmission of I-frames. The station receiving the RNR will usually poll the busy station at some periodic interval by sending an RR with the P bit set. This requires the other side to respond with either an RR or an RNR. When the busy condition has cleared, A returns an RR, and I-frame transmission from B can resume. Semester 34

35 HDLC Operation Example
Figure 7.9d shows an example of error recovery using the REJ command. In this example, A transmits I-frames numbered 3, 4, and 5. Number 4 suffers an error and is lost. When B receives I-frame number 5, it discards this frame because it is out of order and sends an REJ with an N(R) of 4. This causes A to initiate retransmission of I-frames previously sent, beginning with frame 4. A may continue to send additional frames after the retransmitted frames. An example of error recovery using a timeout is shown in Figure 7.9e. In this example, A transmits I-frame number 3 as the last in a sequence of I-frames. The frame suffers an error. B detects the error and discards it. However, B cannot send an REJ, because there is no way to know if this was an I-frame. If an error is detected in a frame, all of the bits of that frame are suspect, and the receiver has no way to act upon it. A, however, would have started a timer as the frame was transmitted. This timer has a duration long enough to span the expected response time. When the timer expires, A initiates recovery action. This is usually done by polling the other side with an RR command with the P bit set, to determine the status of the other side. Because the poll demands a response, the entity will receive a frame containing an N(R) field and be able to proceed. In this case, the response indicates that frame 3 was lost, which A retransmits. Semester 35

36 MAC for IEEE Wired LAN Ethernet: IEEE Local Area Network (LAN) protocols Ethernet protocols refer to the family of local-area network (LAN) covered by the IEEE Access to the shared medium is controlled by Carrier-Sense Multiple Access/Collision Detection (CSMA/CD) protocol.

37 MAC for IEEE Wired LAN The MAC sub-layer has two primary responsibilities: Data encapsulation, including frame assembly before transmission, and frame parsing/error detection during and after reception Media access control, including initiation of frame transmission and recovery from transmission failure

38 MAC for IEEE Wired LAN Each Ethernet-equipped computer operates independently of all other stations on the network: there is no central controller To send data a station first listens to the channel, and when the channel is idle the station transmits its data in the form of an Ethernet frame, or packet After each frame transmission, all stations on the network must contend equally for the next frame transmission opportunity. The medium access control mechanism is based on a system called Carrier Sense Multiple Access with Collision Detection (CSMA/CD).  As each Ethernet frame is sent onto the shared signal channel, all Ethernet interfaces look at the destination address If the destination address of the frame matches with the interface address, the frame will be read entirely and be delivered to the networking software running on that computer All other network interfaces will stop reading the frame when they discover that the destination address does not match their own address.

39 IEEE MAC Frame Format Preamble: A 7-octet pattern of alternating 0s and 1s used by the receiver to establish bit synchronization. Start Frame Delimiter (SFD): The sequence , which indicates the actual start of the frame and enables the receiver to locate the first bit of the rest of the frame. Destination Address (DA): Specifies the station(s) for which the frame is intended. It may be a unique physical address, a group address, or a global address. Source Address (SA): Specifies the station that sent the frame.

40 IEEE MAC Frame Format Length/Type: Length of LLC data field in octets, or Ethernet Type field, depending on whether the frame conforms to the IEEE standard or the earlier Ethernet specification. In either case, the maximum frame size, excluding the Preamble and SFD, is 1518 octets. LLC Data: Data unit supplied by LLC. Pad: Octets added to ensure that the frame is long enough for proper CD operation. Frame Check Sequence (FCS): A 32-bit cyclic redundancy check, based on all fields except preamble, SFD, and FCS.

41 IEEE MAC For reliable data delivery, access control and security physical layer unreliable noise, interference, and other propagation effects result in loss of frames even with error-correction codes, frames may not successfully be received IEEE includes a frame exchange protocol When a station receives a data frame from another station, it returns an acknowledgment (ACK) frame to the source station If the source does not receive an ACK within a short period of time, either because its data frame was damaged or because the returning ACK was damaged, the source retransmits the frame. can use four-frame exchange for better reliability a source first issues a Request to Send (RTS) frame to the destination. The destination then responds with a Clear to Send (CTS). After receiving the CTS, the source transmits the data frame, and the destination responds with an ACK. The RTS alerts all stations that are within reception range of the source that an exchange is under way; these stations refrain from transmission in order to avoid a collision between two frames transmitted at the same time the CTS alerts all stations that are within reception range of the destination that an exchange is under way.

42 IEEE 802.11 MAC For access control
distributed access protocols, distribute the decision to transmit over all the nodes using a carrier sense mechanism centralized access protocols, which involve regulation of transmission by a centralized decision maker a MAC algorithm called DFWMAC (distributed foundation wireless MAC) that provides a distributed access control mechanism with an optional centralized control built on top of that.

43 IEEE MAC

44 IEEE MAC The lower sublayer of the MAC layer is the distributed coordination function (DCF). DCF uses a contention algorithm to provide access to all traffic. Ordinary asynchronous traffic directly uses DCF. The point coordination function (PCF) is a centralized MAC algorithm used to provide contention-free service. PCF is built on top of DCF and exploits features of DCF to assure access for its users.

45 IEEE MAC The DCF sublayer makes use of a simple CSMA (carrier sense multiple access) algorithm If a station has a MAC frame to transmit, it listens to the medium. If the medium is idle, the station may transmit; otherwise the station must wait until the current transmission is complete before transmitting. The DCF does not include a collision detection function (i.e., CSMA/CD) because collision detection is not practical on a wireless network. The dynamic range of the signals on the medium is very large, so that a transmitting station cannot effectively distinguish incoming weak signals from noise and the effects of its own transmission. To ensure the smooth and fair functioning of this algorithm, DCF includes a set of delays that amounts to a priority scheme known as an interframe space (IFS).

46 IEEE MAC

47 IEEE 802.11 MAC The rules for CSMA access are as follows
1. A station with a frame to transmit senses the medium. If the medium is idle, it waits to see if the medium remains idle for a time equal to IFS. If so, the station may transmit immediately. 2. If the medium is busy (either because the station initially finds the medium busy or because the medium becomes busy during the IFS idle time), the station defers transmission and continues to monitor the medium until the current transmission is over. 3. Once the current transmission is over, the station delays another IFS. If the medium remains idle for this period, then the station backs off a random amount of time and again senses the medium. If the medium is still idle, the station may transmit. During the backoff time, if the medium becomes busy, the backoff timer is halted and resumes when the medium becomes idle. 4.If the transmission is unsuccessful, which is determined by the absence of an acknowledgement, then it is assumed that a collision has occurred. 5. To ensure that backoff maintains stability, binary exponential backoff is used. Repeated failed attempts to transmit result in longer and longer backoff times, which helps to smooth out the load

48 IEEE MAC Scheme is refined for DCF to provide priority-based access using three values for IFS: • SIFS (short IFS): The shortest IFS, used for all immediate response actions • PIFS (point coordination function IFS): A midlength IFS, used by the centralized controller in the PCF scheme when issuing polls • DIFS (distributed coordination function IFS): The longest IFS, used as a minimum delay for asynchronous frames contending for access

49 IEEE MAC SIFS Any station using SIFS to determine transmission opportunity has the highest priority, because it will always gain access in preference to a station waiting an amount of time equal to PIFS or DIFS. used in the following circumstances: • Acknowledgment (ACK): • Clear to Send (CTS). • Poll response PIFS. used by the centralized controller in issuing polls and takes precedence over normal contention traffic DIFS used for all ordinary asynchronous traffic

50 IEEE MAC

51 IEEE MAC PCF an alternative access method implemented on top of the DCF The operation consists of polling by the centralized polling master (point coordinator). The point coordinator makes use of PIFS when issuing polls. Because PIFS is smaller than DIFS, the point coordinator can seize the medium and lock out all asynchronous traffic while it issues polls and receives responses. stations with time-sensitive traffic are controlled by the point coordinator while remaining traffic contends for access using CSMA. an interval known as the superframe is defined. During the first part of this interval, the point coordinator issues polls in a round-robin fashion to all stations configured for polling. The point coordinator then idles for the remainder of the superframe, allowing a contention period for asynchronous access.

52 IEEE 802.11 MAC the medium may be busy at the end of a superframe.
In this case, the point coordinator must wait until the medium is idle to gain access; this results in a foreshortened superframe period for the next cycle.

53 IEEE MAC Frame format This general format is used for all data and control frames, but not all fields are used in all contexts.

54 IEEE MAC Frame format Frame Control: Indicates the type of frame (control, management, or data) and provides control information. Control information includes whether the frame is to or from a DS, fragmentation information, and privacy information. • Duration/Connection ID: If used as a duration field, indicates the time (in microseconds) the channel will be allocated for successful transmission of a MAC frame. In some control frames, this field contains an association, or connection, identifier. • Addresses: The number and meaning of the 48-bit address fields depend on context. The transmitter address and receiver address are the MAC addresses of stations joined to the BSS that are transmitting and receiving frames over the wireless LAN. The service set ID (SSID) identifies the wireless LAN over which a frame is transmitted. • Sequence Control: Contains a 4-bit fragment number subfield, used for fragmentation and reassembly, and a 12-bit sequence number used to number frames sent between a given transmitter and receiver. • Frame Body: Contains an MSDU or a fragment of an MSDU. The MSDU is a LLC protocol data unit or MAC control information. • Frame Check Sequence: A 32-bit cyclic redundancy check.

55 IEEE MAC Frame format Control frames assist in the reliable delivery of data frames. There are six control frame subtypes: Power Save-Poll (PS-Poll): sent by any station to the station that includes the AP (access point) to request that the AP transmit a frame that has been buffered for this station while the station was in power-saving mode. Request to Send (RTS): the first frame in the four-way frame exchange alerting a potential destination, and all other stations within reception range, that it intends to send a data frame to that destination. Clear to Send (CTS): the second frame in the four-way exchange sent by the destination station to the source station to grant permission to send a data frame. Acknowledgment: Provides an acknowledgment from the destination to the source that the immediately preceding data, management, or PS-Poll frame was received correctly. Contention-Free (CF)-end: Announces the end of a contention-free period CF-End + CF-Ack: Acknowledges the CF-end. This frame ends the contention-free period and releases stations from the restrictions associated with that period.

56 IEEE MAC Frame format Eight data frame subtypes, organized into two groups. The first four subtypes define frames that carry upper-level data from the source station to the destination station. The four data-carrying frames are: • Data: the simplest data frame, may be used in both a contention period and a contention-free period. • Data + CF-Ack: May only be sent during a contention-free period, also acknowledges previously received data. • Data + CF-Poll: Used by a point coordinator to deliver data to a mobile station and also to request that the mobile station send a data frame that it may have buffered. • Data + CF-Ack + CF-Poll: Combines the functions of the Data + CF-Ack and Data + CF-Poll into a single frame.

57 IEEE MAC Frame format The remaining four subtypes of data frames do not carry any user data. The Null Function data frame used only to carry the power management bit in the frame control field to the AP, to indicate that the station is changing to a low-power operating state. CF-Ack, CF-Poll, CF-Ack + CF-Poll : have the same functionality as the corresponding data frame subtypes in the preceding list (Data + CF-Ack, Data + CF-Poll, Data + CF-Ack + CF-Poll) but without the data.

58 IEEE 802.11 MAC Frame format Management frames
used to manage communications between stations and APs such as management of associations requests, response, reassociation, dissociation, and authentication


Download ppt "Computer Networks The Data Link Layer Part 3: Error Control"

Similar presentations


Ads by Google