Hello everyone,
Today I will share with you packet receiving.
Packets are transmitted as optical/electrical signals through communication cables. Signal receiving, forwarding, switching and sending are just some aspects of data communication.
This chapter details the following:
Conversion between optical/electrical signals and data frames
Validity check on data frames
Packet parsing
Packet encapsulating
Packet Receiving and Sending on PICs
Data is transmitted as optical/electrical signals (or bit flows at the physical layer) through communication cables. To allow routers to interpret these signals for later forwarding, each cable-inserting interface contains a physical interface controller (PIC). The PIC detects and converts these signals to data frames, such as Ethernet frames, PPP frames, or ATM cells.
A PIC has two important functions: to receive and send optical/electrical signals at the physical layer and to check the validity of data frames. Data may become malformed during cable transmission. Malformed packets are called error packets, and cannot be correctly parsed by the PFE. To prevent this problem, PICs must check the validity of data frames.
The following figure shows the format of an Ethernet frame:
Ethernet standards specify that a frame is invalid if:
The frame length is not integral bytes.
The frame contains errors discovered by the FCS.
The frame payload is not between 46 bytes to 1500 bytes.
Invalid frames are discarded, and not retransmitted.
Ethernet frames require an interframe gap between each frame. This means a device must wait for a configured period of time before sending another frame. The interframe gap ensures the frame receiver has enough time to process a received frame before receiving another. This allows for processes such as the adjusting of the buffer pointer or updating statistics to be performed.
Ethernet standards set the minimum interframe gap at 12 bytes, all filled with 1s. GE interfaces may reduce the interframe gap to 64 bits. 10GE interfaces may reduce the interframe gap to 40 bits.
Ethernet standards also specify that the preamble is 7 bytes, and the value is 10101010 10101010 10101010 10101010 10101010 10101010 10101010 in binary ( 0xAA-AA-AA-AA-AA-AA-AA in hexadecimal). The start-frame delimiter is 1 byte: 10101011 in binary ( 0xAB in hexadecimal).
The conditions of a data frame being discarded varies according to which of the above three standards is broken.
A PIC will allow for variance in interframe gap (for example if it is not all 1s). The preamble and start-frame delimiter however, must comply with standards, otherwise, they will be processed as a part of an interframe gap.
After a PIC converts data signals to a data frame and verifies validity, it sends the frame content to the PFE. The frame's content excludes the interframe gap, preamble, and start-frame delimiter.
The PIC type determines the LPU service type. For example, if 4 x 2.5G POS PICs are integrated on an LPU, the LPU supports 4 x 2.5G POS services; if 10 x GE PICs are integrated on an LPU, the LPU supports 10 x GE services. After a PIC is installed on an LPU, the PFE can learn the PIC type and parse PIC-sent data based on the service type.
A data packet forwarded by a PFE and switched by an SFU will arrive at a downlink LPU, which also holds a PIC.
The downlink PIC performs the following functions:
Calculates the FCS based on data frame content.
Adds the interframe gap, preamble, start-frame delimiter, and FCS to the data frame.
Converts the data frame to optical/electrical signals.
Sends the signals through the outbound cable.
Packet Parsing
A Huawei router is diversely functional, enabling it to meet varying service requirements. Most functions may be enabled, disabled, or adjusted by engineers using commands.
Upon receiving a data frame from a PIC, the PFE first parses the frame's Layer 2 header and then performs checking and processing based on the configuration.
All configuration commands are parsed by MPUs and then delivered to LPUs. The LPU contains many tables, including the FIB, ingress port attribute table (IPAT), egress port attribute table (EPAT), ACL table, and traffic classification table. During LPU start up, an MPU begins to deliver configurations to the LPU. This is the process of setting table entry values on the LPU. Then, LPU components search for various entries and process the data based on found values. The LPU is updated in real time with configurations that have been added, deleted, or modified.
For example, if users require an Ethernet interface to provide access to services for VLANs 10 to 20, VLANs outside this range will be discarded. To meet this requirement, the portswitch command must be configured on the Ethernet interface. This command configures the interface to work in Layer 2 mode. The interface must be configured as a trunk interface and allow VLAN IDs 10 to 20 to pass. With these configurations delivered, the interface's Layer 2 bridge forwarding status is Enable, interface type is Trunk, and the VLAN ID in the IPAT ranges from 10 to 20. Now when a frame arrives, the PFE first determines the interface type is trunk. The PFE then checks whether the frame's Layer 2 header carries a VLAN tag. If no VLAN tag is present, the PFE discards the frame. If there is a VLAN tag, the PFE checks whether the VLAN ID in the tag ranges between 10 and 20. If the VLAN ID is outside the range, the PFE discards the frame.
The PFE then performs traffic classification, packet filtering, and redirection based on IPAT configurations. These processes will be detailed in later chapters.
If the frame matches configured parameters, the PFE searches the FIB and forwards the frame based on the forwarding action configured in the IPAT.
For example, when transmitting an Ethernet frame, the PFE will check the frame destination MAC address and then proceed with one of the following:
If the destination of the MAC address is not the local device, the PFE will perform Layer 2 bridge forwarding.
If the destination of the MAC address is the local device, the PFE performs forwarding based on the Type field of the frame header. These include IP, MPLS, and other forwarding protocols.
Note: If the forwarding status in the IPAT does not match parsed status, the frame will be discarded. For example, if IPv6 status is set to Disable in the IPAT and the interface receives an IPv6 packet, the interface will discard the packet.
FIB-based forwarding does not apply to ARP, RARP, IS-IS, LLDP, LACP, or PPP control packets. When a PFE parses Layer 2 frame headers, it uses the Protocol field to determine that these protocol packets must be sent directly to the device CPU. FIB-based forwarding does not apply to protocol packets with multicast address destinations (ranging from 224.0.0.1 to 224.0.0.255).
Packet Encapsulating
Different packets use varying encapsulation methods. Illustrated in the following figure, an Ethernet packet is going to be sent from PC-A to PC-B. This is the simplest of IP forwarding scenarios, with the packet being sent from PC-A to PC-B over an intermediate router. The router is PC-A's gateway.
The characteristics of the packet are as follows:
Destination IP address is PC-B's IP address.
Source IP address is PC-A's IP address.
Packet type is IPv4.
Destination MAC address is the routers Port 1 MAC address.
Source MAC address is PC-A's MAC address.
The forwarding process is as follows:
Upon receiving this packet, the router discovers the destination MAC address belongs to Port 1, indicating that the router needs to parse the packet further.
The router continues to parse the packet and finds the Type field is 0x800, meaning it must be forwarded in IPv4 format.
The router then searches the FIB table and discovers that the packet destination is outside the router, and it needs to be sent to Port 2. The router will not parse content following this destination IP address.
The router replaces the destination and source MAC address with PC-B's and Port 2's MAC addresses, respectively. This is known as encapsulation.
The router then sends the packet to the PIC. The packet is then sent out from Port 2 by the PIC.
Information that is added to a packet to be sent is known as encapsulation information.
The router obtains the following encapsulation information, namely the source and destination MAC addresses from the downlink LPU's PFE in the following ways: ARP table for IP-MAC mapping and EPAT for outbound interface-MAC mapping.
An IP packet forwarding scenario with both source and destination MAC addresses encapsulated follows this process:
The uplink PFE obtains the outbound interface of the packet from the FIB table.
The packet arrives at the downlink PFE, the PFE looks up the ARP table and obtains the destination MAC address based on the destination IP address.
The PFE looks up the EPAT and obtains the source MAC address based on the outbound interface.
Note: Different scenarios may require additional encapsulation information. For example, in a QinQ scenario, VLAN tags must be added. In an MPLS scenario, MPLS labels must be added. All encapsulation is performed on the downlink LPU's PFE.
Outbound Processing
Similar to uplink processing, the PFE must perform outbound checking and processing based on the EPAT before an encapsulated data frame is sent to the downlink PIC. For example, the PFE will check whether the frame length exceeds the MTU of the outbound interface. If exceeded, the PFE may fragment the frame or performs other operation. For details about MTU, see Special Topic - MTU.
That is all I want to share with you! Thank you!