Presentation is loading. Please wait.

Presentation is loading. Please wait.

Part 3: Examples of Data Link Layer protocols

Similar presentations


Presentation on theme: "Part 3: Examples of Data Link Layer protocols"— Presentation transcript:

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

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

3 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 3

4 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 4

5 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 5

6 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 6

7 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 7

8 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 8

9 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 9

10 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 10

11 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 11

12 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 12

13 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 13

14 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.

15 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

16 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.

17 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.

18 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.

19 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.

20 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.

21 IEEE MAC

22 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.

23 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).

24 IEEE MAC

25 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

26 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

27 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

28 IEEE MAC

29 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.

30 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.

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

32 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.

33 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.

34 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.

35 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.

36 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 "Part 3: Examples of Data Link Layer protocols"

Similar presentations


Ads by Google