Chapter 2 Link Layer Verilog Hardware Implementation, and One Wireless Broadcast Link, I.E
Total Page:16
File Type:pdf, Size:1020Kb
Modern Computer Networks: An open source approach Chapter 2 Modern Computer Networks: An open source approach Chapter 2 package, one wired broadcast link, i.e. Ethernet in Section 2.4 along with its Chapter 2 Link Layer Verilog hardware implementation, and one wireless broadcast link, i.e. wireless LAN (WLAN) in Section 2.5 plus a brief on Bluetooth and WiMAX. PPP is Problem Statement popularly used in the last-mile dial-up services or routers carrying various network protocols over point-to-point links. Ethernet has occupied more than 95 percent of To effectively and efficiently transmit data over physical links from one node wired LANs. It is also poised to be ubiquitous in MANs and WANs. In contrast to to one or more nodes, there is much more to do than simply modulating or desktop PCs, which usually use wired links, many devices such as laptop PCs encoding bit stream into signal. Transmission impairments, such as crosstalk and cellular phones are mobile and prefer wireless links such as WLAN, Bluetooth, between two adjacent pairs, can unexpectedly change transmission signal and and WiMAX. thus result in errors. The transmitter might transmit faster than the receiver can Table 2.1 Link protocols. handle. The transmitter has to somehow indicate the destination(s), if on a PAN/LAN MAN/WAN broadcast link, i.e. LAN, and usually needs to name itself to let the receiver know Token Bus (802.4) DQDB (802.6) Token Ring (802.5) HDLC where the source is. If multiple stations share a LAN, an arbitration mechanism is HIPPI X.25 required to determine who can transmit next. Beyond all of the above, we need to Obsolete or Fiber Channel Frame Relay Isochronous (802.9) SMDS interconnect LANs, i.e. bridging to forward packets between LANs, to extend the Fading Demand Priority (802.12) ISDN coverage beyond a single LAN. These problems need to be addressed by a set of FDDI B-ISDN ATM functions above the physical link. The link layer in the 4-layer Internet architecture, HIPERLAN or the physical layer and the data link layer together in the 7-layer OSI Ethernet (802.3) Ethernet (802.3) WLAN (802.11) Resilient Packet Ring (802.17) architecture, manages the physical link to solve these problems. Upper layers are Mainstream or Bluetooth (802.15) Point-to-Point Protocol (PPP) therefore exempt from the duty of controlling parameters in a physical network. Fiber Channel DOCSIS Still active HomeRF WiMAX (802.16) These services greatly alleviate upper-layer protocol design and make it virtually HomePlug ATM independent of physical transmission characteristics. In this chapter, we present (1) functions or services provided in the link layer, As an independent issue, bridging for LAN interconnection is covered in (2) real-world popular link protocols, and (3) some of their open source software Section 2.6, along with its open source implementations of two key components, or hardware implementations. self learning and spanning tree. At the end, Section 2.7 illustrates the general Section 2.1 addresses the general issues in designing link layer functions concepts of Linux device drivers. We go deep into the Ethernet driver ranging from framing, addressing, error control, flow control, access control, to implementation. interfaces with other layers. Their possible solution alternatives are reviewed. Function calls in Linux are used to illustrate the interfaces and sk_buff packet 2.1 General Issues flows with the network adaptor and the upper IP layer, as a zoom-in of a packet life in Section 1.5. To prepare readers with physical background, Section 2.2 first Sandwiched between the physical link and the network layer, the link layer briefs the wired and wireless medium, and then their encoding and modulation provides control on physical communications and services to upper network layer. schemes. This layer includes the following major functions. Given the vast number of real-world links, it is nearly impossible to describe all of them. We summarize well-known data-link protocols in Table 2.1. Some are Framing Control information, in the header, comes along with the data, in the obsolete or fading nowadays, some are in the mainstream, and still some others payload, in the bit stream to specify the destination station, indicate the are under development. Among the mainstream, we detail one point-to-point link, upper-layer protocol, check possible errors and so on. Data are sent and i.e. Point-to-Point Protocol (PPP) in Section 2.3 along with an open source processed in units of frames which are “packets or packet data units (PDUs) at the 1 2 Modern Computer Networks: An open source approach Chapter 2 Modern Computer Networks: An open source approach Chapter 2 link layer” and usually contains two main parts: control information and the data. Ethernet (i.e., 100 Mb/s) because it can detect the physical link status. The latter The link protocols refer to control information during frame processing. The data is unable to to do so because it cannot tell whether the physical link is broken or part is from the upper layer and encapsulated with the control information into the no frames are being transmitted (no signal is on the link in both cases). It was frame. The link layer service should delimit the bit stream into frames and turn used in 10 Mb/s Ethernet, and no longer used in later Ethernet technology. frames into bit stream. The two terms, packets and frames, are usually used A bit-oriented frame can specify a special bit pattern, say 01111110 in HDLC, interchangeably. We refer to the packet data unit in the link layer as frames to be while a byte-oriented frame can specify special characters, say SOH (start of specific. Similarly for payload/data, header/control information, and node/station, header) and STX (start of text) to mark the beginning of frame header and data. data, control information, and station are called more often in the link layer. An ambiguity may exist when normal data characters or bits are the same as the Addressing We need an address when writing a letter to our friends, and also special characters or pattern. A technique called byte- or bit-stuffing is used to need a phone number when dialing up to them. Addressing is needed for the solve the ambiguity, as illustrated in Figure 2.1. A special escape character, same reason in the link layer. The identity of a station is indicated by an address, namely DLE (data link escape), precedes a special character to indicate the next often presented in a numeric form of a certain length. character is normal data in a byte-oriented frame. Because DLE itself is also a Error control Frames transmitted over physical media are subject to errors, special character, two consecutive DLEs represent a normal DLE character. For which must be detected by the receiver. The receiver may simply drop the frame, 01111110 used in HDLC, when five consecutive 1’s are in the normal data bits, a 0 or inform the transmitter that errors occur for the transmitter to retransmit the data. is stuffed, so that the pattern 01111110 never appears in normal data. Both the Flow control The transmitter may send at a rate faster than the receiver can transmitter and the receiver follow the same rule to solve the ambiguity. afford. In this case, the receiver has to discard the frames, making the transmitter A different approach is in the Ethernet. For example, 100BASE-X uses retransmits the dropped frames, but this is inefficient. Flow control provides a special encoding to mark the boundary because after 4B/5B encoding, 32 (= 25) method to let the receiver slow down the transmitter. possible codes can be transmitted over physical media while only 16 out of them Medium Access control There must be an arbitration mechanism when multiple come from actual data. Other codes can serve as control codes. These control nodes want to transmit data over shared media. A good arbitration mechanism codes are uniquely recognizable by the receiver and thus used to delimit a frame must offer fair access to a shared medium and keep the utilization of the shared out of a sequence of bit stream. Another Ethernet system, 10BASE-T, recognizes medium high when many nodes have backlog, i.e. queued data to transmit. the frame boundary simply according to the presence or absence of a signal. 2.1.1 Framing Frame Format A frame is divided into header fields that include various kinds of control Frame Delimiting information and the data from the network layer, which again contains control Because data are transmitted in raw bit stream in the physical layer, the link information of higher layers and the actual data. The control information of higher layer must tell the beginning and the end of a frame. It must also turn frames into layers is treated as normal data in the link layer. Typical header fields of control raw bit stream for physical transmission. This function is called framing. Many information other than the data field are listed below. methods can delimit the frames. Depending on the basic unit of a frame, which Address: It usually indicates the source or the destination address. The receiver can be byte (or octet) or bit, called a byte-oriented or bit-oriented frame, special knows the frame is for it if the destination address matches its own. It also can sentinel characters or bit patterns can mark the frame boundary. We introduce the respond to the source by filling in the destination address of the outgoing frame framing examples of bit-oriented HDLC frames.