Patent ID: 12238001

DETAILED DESCRIPTION

A packet processor of a typical network device, such as a switch, router, etc., is designed to analyze and modify headers of packets, and is incapable of analyzing, adding, or removing trailers of packets. In order to handle the analyzing, adding, or removing of trailers of packets, such packets are sent to a central processing unit (CPU) of the network device for processing, in typical network devices.

In embodiments described below, a packet processor of a network device is configured to analyze, add, modify, and/or remove trailers of packets. In some embodiments, the packet processor is configured to i) generate a packet descriptor that includes a) header information extracted from a header of a packet and b) trailer information extracted from a trailer of the packet, and ii) process the packet descriptor, including processing the trailer information in the packet descriptor.

In some embodiments, the packet processor is configured to store a packet, which does not include a trailer when received by the network device, in a memory, generate a trailer that is to be added to the packet, and store the trailer in the memory at a location proximate to a location of the header of the packet in the memory (i.e., not at an end of the packet). In such embodiments, in connection with transmitting the trailer of the packet, the trailer is read from the location in the memory that is proximate to the location of the header of the packet.

FIG.1is a block diagram of an example network device104that includes a packet processor108that is configured to process trailers of packets, according to an embodiment. The network device104includes a plurality of network interfaces (e.g., ports)112configured to couple to respective network links. The network device104also includes one or more receive processors116coupled to the network interfaces112. Although only one receive processor116is shown inFIG.1, and the one receive processor116is shown as being coupled to only one network interface112, the network device104includes multiple receive processors116and each of the multiple processors116is coupled to a respective set of one or more network interface112, in some embodiments. The multiple receive processors116may be considered collectively as a single receive processor.

The receive processor116is configured to store packet data (e.g., at least payloads) corresponding to received packets in a packet memory120. InFIG.1, the receive processor116is illustrated storing an entire packet124in the packet memory120. However, the receive processor116stores, for each of multiple packets, only an end portion of the packet124(e.g., including a payload128and a trailer136) in the packet memory120at least initially, according to another embodiment. At least a portion of a header132of the packet124is later stored in the packet memory120by the network device104, according to an embodiment. The receive processor116stores, for each of multiple packets, the payload128and the trailer136, and at least a portion of the header132in the packet memory120at least initially, according to another embodiment. A remaining portion of the header132are later stored in the packet memory120by the network device104, according to an embodiment. The receive processor116stores, for each of multiple packets, the entire packet124in the packet memory120, according to yet another embodiment.

In an embodiment, the receive processor116includes direct memory access (DMA) circuitry (not shown) configured to store received packets (or at least portions of the packets) in the packet memory120via one or more read/write interfaces of the packet memory120.

The receive processor116generates, for each of multiple packets, a packet descriptor140associated with the packet124, according to an embodiment. Each packet descriptor140includes information regarding the corresponding packet, such as header information144from the header132of the packet124, trailer information148from the trailer136of the packet124, and optionally control information152associated with the packet124, such as location information regarding a location of the corresponding packet in the packet memory120, according to an embodiment. Each packet descriptor140has a data length that is much shorter than a length of a typical packet, according to some embodiments.

In an embodiment, the receive processor116is configured to i) extract header information144from the packet124and store the extracted header information144in the packet descriptor140, and ii) extract trailer information136from the packet124and store the extracted trailer information136in the packet descriptor140. In some embodiments, the receive processor116is configured to extract the entire trailer136from the packet124and store the extracted trailer136in the packet descriptor140. In other embodiments, the receive processor116is configured to extract only a portion of the trailer136from the packet124and store the portion of the trailer136in the packet descriptor140.

In some embodiments, the receive processor116is configured to i) extract a fixed length of packet data144from a beginning portion of the packet124and store the extracted information144in the packet descriptor140, and ii) extract a fixed length of packet data136from an ending portion of the packet124and store the extracted information136in the packet descriptor140. For example, the receive processor116is configured to i) extract a first 128 bytes (or another suitable length) of packet data144from the beginning portion of the packet124and store the extracted information144in the packet descriptor140, and ii) extract a last 6 bytes (or another suitable length) of packet data136from an ending portion of the packet124and store the extracted information136in the packet descriptor140, according to an illustrative embodiment.

The receive processor116provides the packet descriptors140to the packet processor108, which is configured to process packets (e.g., by analyzing packet descriptors140corresponding to the packets), in an embodiment. In other embodiments, the receive processor116(or the packet processor108) stores packet descriptors140in a packet descriptor memory (not shown) separate from the packet memory120, and the packet processor108processes the packet descriptors stored in the packet descriptor memory. In such embodiments, a smaller packet descriptor includes an indicator of a location of the packet descriptor140in the packet descriptor memory, and the smaller packet descriptor is passed between components of the packet processor108, and the indicator (within the smaller packet descriptor) of the location of the packet descriptor140in the packet descriptor memory is used by components of the packet processor108to access the packet descriptor140. In some embodiments, the smaller packet descriptor optionally includes control information associated with the packet124, such as location information regarding a location of the corresponding packet in the packet memory120.

The packet processor108includes a forwarding engine172. The forwarding engine172is configured to analyze at least header information144in packet descriptors140to determine network interfaces112via which packets (corresponding to the packet descriptors140) are to be transmitted (referred to herein as “target network interfaces”). As merely an illustrative example, the forwarding engine172is configured to use at least a destination address in a header of a packet to perform a lookup in a forwarding database (not shown), which stores correspondences between destination addresses and network interfaces112, to determine a target network interface112for the packet. As another illustrative example, the forwarding engine172is configured to use at least a VLAN ID in a header of a packet to perform a lookup in a forwarding database (not shown) (e.g., the same forwarding database discussed above or a different forwarding database), which stores correspondences between VLAN IDs and network interfaces112, to determine a particular set of one or more target network interfaces112for the packet. The forwarding engine172is configured to store an ID of a target network interface (or set of multiple target network interfaces) in the packet descriptor corresponding to the packet, according to an embodiment.

The packet processor108also includes a header modification engine174that is configured to selectively modify header information corresponding to the packet124. For example, header modification engine174that is configured to selectively modify a next hop address in a header of the packet124, remove a tunneling header from the packet124, add a tunneling header to the packet124, etc., in accordance with processing of the packet descriptor performed by the header modification engine174and/or one or more other processing elements of the packet processor108. In one embodiment, the header modification engine174selectively modifies the header information144in the packet descriptor140. As will be described in more detail below, when the packet124is to be transmitted, the network device104transmits the modified header information144rather than the header132, in some embodiments.

In other embodiments in which the header132is stored in the packet memory120, the header modification engine174is configured to selectively modify the header132stored in the packet memory120.

The packet processor108also includes a trailer processor176that is configured to analyze at least trailer information148in a packet descriptor140to determine how the trailer136is to be processed. As merely an illustrative example, the trailer processor176is configured to use at least i) a source address in the header information144and ii) a sequence number in the trailer information148to determine if the packet124associated with the packet descriptor140is to be dropped. For example, the trailer processor176determines whether a previous packet having the same source address and the same sequence number was previously received within a suitable time period; in response to determining that a previous packet having the same source address and the same sequence number was previously received within the time period, the trailer processor176determines that the packet associated the packet descriptor140is to be dropped by the network device104. In response to the trailer processor176determining that the packet associated the packet descriptor140is to be dropped, the packet processor108drops the packet. For example, the packet processor108discards the packet descriptor140and designates memory resources in the packet memory120corresponding to the packet as available for storage.

In an embodiment, for packets that the trailer processor176determines are not to be dropped, the trailer processor176further determines whether the trailer136is to be removed from the packet124so that the packet124is transmitted by the network device104without the trailer136, at least in some scenarios. For the PRP, removing a PRP trailer may be useful, for example, if the network device104is connected to an endpoint device that is not capable of processing PRP trailers but for which it is desired to use PRP to achieve redundant communications. In some embodiments, the trailer processor176maintains a database (not shown) that indicates one or more endpoint devices for which trailers are to be removed from packets that the network device104is to forward to the one or more endpoint devices. In some such embodiments, the trailer processor176is configured to use at least a destination address in the header information144to search the database to determine if the trailer136is to be removed from the packet124.

In response to the trailer processor176determining that the trailer136is to be removed from the packet124, the trailer processor176stores an indication in the packet descriptor140that the trailer136is to be removed from the packet124. As will be discussed below, another processing unit in the network device104causes, in response to the indication in the packet descriptor, the packet124to be transmitted from the network device104without the trailer136.

In some embodiments, the trailer processor176is configured to determine whether the trailer136is to be modified. In embodiments in which the trailer processor176is configured to determine whether the trailer136is to be modified, and when the trailer processor176determines that the trailer136is to be modified, the trailer processor176modifies the trailer information148within the packet descriptor140. In some embodiments, when the trailer processor176modifies the trailer information148, the trailer processor176modifies the packet descriptor140to indicate that the trailer information148has been modified. As will be described in more detail below, when the packet124is to be transmitted, the network device104transmits the modified trailer information148rather than the original trailer136stored in the packet memory120, in some embodiments.

After the packet descriptor140has been processed by the header modification engine174and the trailer processor176, the packet processor108stores the header information144and the trailer information148in the packet memory120(or another memory (not shown) separate from the packet memory120, according to some embodiments. In such embodiments, the header information144and the trailer information148are stored together in the packet memory120(or the other memory (not shown)), i.e., the trailer information148is stored at a location that is proximate to a location of the header information144. In some embodiments, the header information144and the trailer information148are stored together in the packet memory120at a different location than the location at which a remaining portion of the packet124(e.g., at least the payload128and the trailer136) is stored.

In some embodiments, the packet processor108modifies the packet descriptor to140to include one or more indications of the locations in the packet memory120(or the other memory (not shown)) at which the header information144and the trailer information148are stored. In an embodiment in which the trailer information148has a fixed length (e.g., 6 bytes or another suitable length) and the trailer information148is stored in the packet memory120(or the other memory (not shown)) before and next to the header information144, the location of the header information144can be determined using the location of the trailer information148and the fixed length of the trailer information148. In an embodiment in which the header information144has a fixed length (e.g., 128 bytes or another suitable length) and the trailer information148is stored in the packet memory120(or the other memory (not shown)) after and next to the header information144, the location of the trailer information148can be determined using the location of the header information144and the fixed length of the header information144.

In some embodiments in which the packet processor108stores the header information144and the trailer information148in the packet memory120(or the other memory (not shown)) after the packet descriptor140has been processed by the header modification engine174and the trailer processor176, the packet processor108shortens the packet descriptor140by removing the header information144and the trailer information148, or creates a new packet descriptor140that omits the header information144and the trailer information148.

The network device104further comprises a respective set of one or more transmit queues188for each of multiple network interfaces112. For example, different transmit queues, all corresponding to a single network interface112, each correspond to a different priority, in an embodiment.

The packet processor108stores the packet descriptors140into appropriate transmit queues188corresponding to appropriate target network interfaces112.

For example, the packet processor108analyzes information in the packet descriptors (e.g., target network interface IDs, priority information, etc.) to determine appropriate transmit queues188into which the packet descriptors140are to be stored. As an illustrative example, respective pluralities of transmit queues188correspond to respective ports, where each transmit queue188corresponding to a single port also corresponds to a respective priority level, according to an embodiment. At least some of the transmit queues188are arranged as first-in-first-out (FIFO) linked lists, according to an embodiment.

When a packet descriptor reaches the head of a transmit queue188, the packet descriptor is provided to a transmit processor192that corresponds to the target network interface112of the packet corresponding to the packet descriptor. Although only one transmit processor192is shown inFIG.1, and the one transmit processor192is shown as being coupled to only one network interface112, the network device104includes multiple transmit processors192and each of the multiple transmit processors192is coupled to a respective set of one or network interfaces112, in some embodiments. The multiple transmit processors192may be considered collectively as a single transmit processor.

The transmit processor192retrieves packet data corresponding to the packet descriptor from the packet memory120via the one or more read/write interfaces of the packet memory120. In an embodiment, the transmit processor192includes DMA circuitry configured to retrieve packets (or at least payloads of the packets) in the packet memory120via the one or more read/write interfaces of the packet memory120. In embodiments in which the header information144and the trailer information148are stored in the other memory (not shown) separate from the packet memory120, the transmit processor192retrieves the header information144and, optionally, the trailer information148from the other memory via the one or more read/write interfaces of the other memory. In an embodiment, the packet descriptor140includes first location information indicating a location of the header information144in the packet memory120(or the other memory), and the transmit processor192uses the first location information to retrieve the header information144from the packet memory120(or the other memory (not shown). The transmit processor192then provides the header information144to the network interface112for transmission.

In an embodiment, the packet descriptor140includes second location information indicating a location of other packet data in the packet memory120(e.g., including at least the payload128), and the transmit processor192uses the second location information to retrieve the other packet data corresponding to the packet descriptor140from the packet memory120. The transmit processor192then provides the other packet data to the network interface112for transmission.

In an embodiment, if the packet descriptor140includes an indication that the trailer136is to be removed from the packet124, the transmit processor192, in response to the indication, does not retrieve the trailer136from the packet memory120, and does not retrieve the trailer information148from the packet memory120(or the other memory (not shown)), and provides the packet data, which omits the trailer136and omits the trailer information148, to the network interface112, i.e., the packet data, after having been provided to the network interface112, does not include the trailer136nor the trailer information148. Accordingly, the network interface112transmits the packet such that the packet, after having been transmitted by the network interface112, does not include the trailer136.

In an embodiment, if the packet descriptor140includes an indication that the trailer information148was modified and does not include an indication that the trailer is to be removed, the transmit processor192, in response to the indications, does not retrieve the trailer136from the packet memory120, but rather retrieves the trailer information148from the packet memory120(or the other memory (not shown)), and provides the packet data, which includes the trailer information148, to the network interface112, i.e., the packet data, after having been provided to the network interface112, includes the trailer information148. Accordingly, the network interface112transmits the packet such that the packet, after having been transmitted by the network interface112, includes the trailer information148.

In some embodiments, the transmit processor192is configured to determine whether the original trailer information136or the trailer information148is to be retrieved in connection with transmitting a trailer of the packet124. In some embodiments, the transmit processor192is configured to make the determination based on whether the packet descriptor140indicates that the trailer information148was modified by the packet processor108. In other embodiments, when the trailer is to be transmitted, the transmit processor192is configured retrieve the trailer information148in connection with transmitting a trailer of the packet124regardless of whether the packet descriptor140indicates that the trailer information148was modified by the packet processor108.

In an embodiment, the network device104further includes one or more central processing units (CPUs) (not shown).

The receive processor116is implemented using i) one or more processors executing machine readable instructions stored in one or more memories, ii) hardware circuitry (e.g., one or more hardware state machines, a hardware pipeline processor, etc.), iii) or a combination of i) and ii), in some embodiments.

The packet processor108is implemented using i) one or more processors executing machine readable instructions stored in one or more memories, ii) hardware circuitry (e.g., one or more hardware state machines), iii) or a combination of i) and ii), in some embodiments. In an embodiment, the packet processor108comprises a hardware pipeline processor, and the forwarding engine172and the trailer processor176are pipeline elements hardware pipeline processor.

The transmit processor192is implemented using i) one or more processors executing machine readable instructions stored in one or more memories, ii) hardware circuitry (e.g., one or more hardware state machines), iii) or a combination of i) and ii), in some embodiments.

FIG.2is a block diagram of another example network device204that includes a packet processor208that is configured to selectively add trailers to packets, according to an embodiment. For the PRP, adding a PRP trailer may be useful, for example, if the network device204is connected to a source device that is not capable of adding PRP trailers but for which it is desired to use PRP to achieve redundant communications. The network device204includes some of the same components as the network device104ofFIG.1, and like-numbered elements are not discussed again in detail for purposes of brevity.

The receive processor116is configured to store packet data (e.g., at least payloads) corresponding to received packets in the packet memory120. InFIG.2, the receive processor116is illustrated storing at least a portion of a payload224of a packet220in the packet memory120, the packet220not having a trailer when received by the network device204. In some embodiments, the receive processor116stores, for each of multiple packets, the entire packet220in the packet memory120. The receive processor116stores, for each of multiple packets, the payload224and at least a portion of the header228in the packet memory120, according to another embodiment. A remaining portion of the header228is later stored in the packet memory120by the network device204, according to an embodiment.

The receive processor116generates, for each of multiple packets, a packet descriptor240associated with the packet220, according to an embodiment. Each packet descriptor240includes information regarding the corresponding packet, such as header information244from the header228of the packet220, and optionally control information248associated with the packet220, such as location information regarding a location of the corresponding packet in the packet memory120, according to an embodiment.

In an embodiment, the receive processor116is configured to extract the header information244from the packet220and store the extracted header information244in the packet descriptor240.

In some embodiments, the receive processor116is configured to extract a fixed length of packet data244from a beginning portion of the packet220and store the extracted information244in the packet descriptor240. For example, the receive processor116is configured to extract a first 128 bytes (or another suitable length) of packet data244from the beginning portion of the packet220and store the extracted information244in the packet descriptor240, according to an illustrative embodiment.

The receive processor116provides the packet descriptors240to the packet processor208, which is configured to process packets (e.g., by analyzing packet descriptors corresponding to the packets), in an embodiment. In other embodiments, the receive processor116(or the packet processor208) stores packet descriptors240in a packet descriptor memory (not shown) separate from the packet memory120, and the packet processor208processes the packet descriptors stored in the packet descriptor memory. In such embodiments, a smaller packet descriptor includes an indicator of a location of the packet descriptor240in the packet descriptor memory, and the smaller packet descriptor is passed between components of the packet processor208, and the indicator (within the smaller packet descriptor) of the location of the packet descriptor240in the packet descriptor memory is used by components of the packet processor208to access the packet descriptor240. In some embodiments, the smaller packet descriptor optionally includes control information associated with the packet220, such as location information regarding a location of the corresponding packet in the packet memory120.

The packet processor208also includes a trailer processor260that is configured to analyze at least the header information244to determine whether a trailer264is to be added to the packet220. As merely an illustrative example, the trailer processor260maintains a database (not shown) that indicates one or more source devices (or optionally source device, destination device pairs) for which trailers are to be added to packets that the network device204receives from the one or more source devices (and optionally are intended for the one or more destination devices in the source device, destination device pairs). In some such embodiments, the trailer processor260also maintains, in the database, path identifiers corresponding to respective network paths from source devices to destination devices used for packets with trailers; and last-used sequence numbers for packets with trailers from source devices to destination devices. In an embodiment, the trailer processor260uses header information (e.g., a source address and/or a destination address) to retrieve from the database content information that is to be included in the trailer264, such as a sequence number and a path identifier.

For example, the trailer processor260queries the database with header information (e.g., a source address and a destination address) to determine whether a trailer264is to be added to the packet220, and if the trailer264is to be added, to determine contents of the trailer (e.g., a sequence number, a path identifier, etc.).

In response to the trailer processor260determining that the trailer264is to be added to the packet220, the trailer processor260generates the trailer264. Additionally, the trailer processor260stores the trailer264in the descriptor240, according to an embodiment.

In another embodiment, the trailer processor260stores the trailer264in the packet memory120at a location proximate to a location of a beginning of the header228of the packet220, as opposed to storing the trailer264proximate to a location of an end of the packet220in the packet memory120. In an embodiment, the trailer processor260appends the trailer264to a beginning of the header228in the packet memory120. Because existing packet processors typically have access to packet headers in a packet memory (e.g., for modifying existing headers, appending tunnelling headers to existing headers, etc.), configuring the packet processor260to store the trailer264in the packet memory120at a location proximate to the location of the beginning of the header228can be achieved without requiring large-scale changes to packet processor architecture.

Also in response to the trailer processor260determining that the trailer264is to be added to the packet220, the trailer processor260stores an indication in the packet descriptor240(or the smaller packet descriptor) that the trailer264is to be added to the packet220. As will be discussed below, another processing unit in the network device204adds, in response to the indication in the packet descriptor, the trailer264proximate to an end the packet220so that the packet220is transmitted from the network device204with the trailer264proximate to the end of the packet220.

After the packet descriptor240has been processed by the header modification engine174and the trailer processor260, the packet processor208stores the header information244and the trailer information264in the packet memory120(or another memory (not shown) separate from the packet memory120, according to some embodiments. In such embodiments, the header information244and the trailer information264are stored together in the packet memory120(or the other memory (not shown)), i.e., the trailer information264is stored at a location that is proximate to a location of the header information244. In some embodiments, the header information244and the trailer information264are stored together in the packet memory120at a different location than the location at which a remaining portion of the packet220(e.g., at least the payload224) is stored.

In some embodiments, the packet processor208modifies the packet descriptor to240to include one or more indications of the locations in the packet memory120(or the other memory (not shown)) at which the header information244and the trailer information264are stored. In an embodiment in which the trailer information264has a fixed length (e.g., 6 bytes or another suitable length) and the trailer information264is stored in the packet memory120(or the other memory (not shown)) before and next to the header information244, the location of the header information244can be determined using the location of the trailer information264and the fixed length of the trailer information264. In an embodiment in which the header information244has a fixed length (e.g., 128 bytes or another suitable length) and the trailer information264is stored in the packet memory120(or the other memory (not shown)) after and next to the header information244, the location of the trailer information264can be determined using the location of the header information244and the fixed length of the header information244.

In some embodiments in which the packet processor208stores the header information244and the trailer information264in the packet memory120(or the other memory (not shown)) after the packet descriptor240has been processed by the header modification engine174and the trailer processor260, the packet processor208shortens the packet descriptor240by removing the header information244and the trailer information260, or creates a new packet descriptor240that omits the header information244and the trailer information264.

The packet processor208stores the packet descriptors240(or corresponding smaller packet descriptors) into appropriate transmit queues188corresponding to appropriate target network interfaces112.

When a packet descriptor reaches the head of a transmit queue188, the packet descriptor240is provided to a transmit processor292that corresponds to the target network interface112of the packet corresponding to the packet descriptor. Although only one transmit processor292is shown inFIG.2, and the one transmit processor292is shown as being coupled to only one network interface112, the network device204includes multiple transmit processors292and each of the multiple transmit processors292is coupled to a respective set of one or network interfaces112, in some embodiments. The multiple transmit processors292may be considered collectively as a single transmit processor.

In an embodiment, the transmit processor292includes DMA circuitry configured to retrieve packet data in the packet memory120via the one or more read/write interfaces of the packet memory120. In an embodiment in which the header information244and the trailer information264are stored in the other memory (not shown), the transmit processor292includes DMA circuitry configured to retrieve packet data from the other memory via the one or more read/write interfaces of the other memory.

In an embodiment, if the packet descriptor240includes an indication that the trailer264is to be added to the packet220, the transmit processor292, in response to the indication, transfers the trailer264corresponding to the packet descriptor from the packet memory120(or the other memory (not shown)) to a memory296(referred to herein as a “scratchpad” memory) associated with the transmit processor292. In an embodiment, the packet descriptor240includes location information indicating a location of the trailer264in the packet memory120(or the other memory (not shown)), and the transmit processor292uses the location information to retrieve the trailer264from the packet memory120(or the other memory (not shown)). Additionally, the transmit processor292retrieves packet data corresponding to the packet descriptor240from the packet memory120via the one or more read/write interfaces of the packet memory120. In an embodiment, the transmit processor292uses location information in the packet descriptor240to retrieve packet data (e.g., the header information244and the payload224) corresponding to the packet descriptor from the packet memory120.

The transmit processor292then provides the header244and the payload224to the network interface112for transmission. In connection with the transmit processor292providing an end of the payload224to the network interface112, the transmit processor292retrieves the trailer264from the scratchpad memory296and provides the trailer264to the network interface112so that the network interface112transmits the trailer264after the end of the payload224.

In another embodiment, the network device204omits the scratchpad memory296. In such embodiments, the transmit processor292, in connection with providing an end of the payload224to the network interface112, retrieves the trailer264from the packet memory120(or the other memory (not shown)) and provides the trailer264to the network interface112so that the network interface112transmits the trailer264after the end of the payload224.

The packet processor208is implemented using i) one or more processors executing machine readable instructions stored in one or more memories, ii) hardware circuitry (e.g., one or more hardware state machines), iii) or a combination of i) and ii), in some embodiments. In an embodiment, the packet processor208comprises a hardware pipeline processor, and the forwarding engine172and the trailer processor260are pipeline elements hardware pipeline processor.

In an embodiment, the network device204further includes one or more CPUs (not shown).

The transmit processor292is implemented using i) one or more processors executing machine readable instructions stored in one or more memories, ii) hardware circuitry (e.g., one or more hardware state machines), iii) or a combination of i) and ii), in some embodiments.

In some embodiments, a network processor combines the functionality of the network processor104(FIG.1) and the functionality of the network processor204(FIG.2). In such embodiments, the network processor includes functionality and structure described with reference toFIG.1and functionality and structure described with reference toFIG.2.

FIG.3is a flow diagram of an example method300for processing packets having trailers in a network device, according to an embodiment. The method300is implemented in the example network device104ofFIG.1, according to an embodiment, and the method300is described with reference toFIG.1for ease of explanation. In other embodiments, the method300is implemented in a suitable network device different than the example network device104.

At block304, a packet is received by the network device via a first network interface, the packet having a header and a trailer. In an embodiment, the header is adjacent to a beginning portion of a payload of the packet, and the trailer is adjacent to an end portion of the payload.

At block308, a packet descriptor is generated for the packet, the packet descriptor being generated to include i) header information extracted from the header of the packet, and ii) trailer information extracted from the trailer of the packet. For example, the receive processor116extracts header information144from the header132and extracts trailer information148from the trailer136, and stores the header information144and the trailer information148in the packet descriptor, according to an embodiment.

In some embodiments, the method300further comprises storing at least some packet data from the packet received at block304in a packet memory of the network device, and storing in the packet descriptor an indication of a location of the packet data in the packet memory.

At block312, a packet processor of the network device processes the packet descriptor, including processing header information and trailer information in the packet descriptor, to determine one or more actions to be performed on the packet. For example, the trailer processor176processes the packet descriptor140, including processing header information144and trailer information148, to determine one or more actions to be performed on the packet124, according to an embodiment.

In an embodiment, block312comprises processing header information and trailer information in the packet descriptor to determine whether the packet is to be dropped. In an embodiment, block312comprises processing header information and trailer information in the packet descriptor to determine whether the trailer of the packet is to be removed.

At block316, the network device performs at least one of the processing action(s) determined at block312. For example, at block320, when the network device determines at block312that the packet is to be dropped, the network device drops the packet. Dropping the packet includes preventing the network device from ever transmitting the packet to a destination indicated in the header of the packet, according to an embodiment.

On the other hand, at block324, when the packet processor determines that the packet is to be transmitted via a second network interface, the network device transmits the packet via the second network interface. For example, the transmit processor192retrieves at least a portion of the packet124from the packet memory120and provides the at least the portion of the packet124to corresponding the network interface112for transmission of the least the portion of the packet124.

In an embodiment, when the network device determines at block312that the trailer of the packet is to be removed, block324includes transmitting the packet without the trailer so that the packet, when transmitted, does not include the trailer.

FIG.4is a flow diagram of an example method400for adding trailers to packets in a network device, according to an embodiment. The method400is implemented in the example network device204ofFIG.2, according to an embodiment, and the method400is described with reference toFIG.2for ease of explanation. In other embodiments, the method400is implemented in a suitable network device different than the example network device204.

At block404, a packet is received by the network device via a first network interface, the packet having a header. In an embodiment, the header is adjacent to a beginning portion of a payload of the packet.

At block408, the network device stores the packet in a packet memory of the network device. For example, the receive processor116stores the packet220in the packet memory120, according to an embodiment. In an embodiment, the header is stored adjacent to a beginning portion of a payload of the packet in the memory.

At block412, the network device determines that a trailer is to be added to the packet. For example, the trailer processor260determines that a trailer is to be added to the packet220. In an embodiment, the method400comprises generating a packet descriptor, and block412includes processing the packet descriptor to determine that a trailer is to be added to the packet. For example, the receive processor116extracts header information244from the header228and stores the header information244in the packet descriptor240, according to an embodiment. In embodiments that include generating a packet descriptor, the packet descriptor is generated to include header information extracted from the header of the packet, and the network device processes at least the header information to determine that a trailer is to be added to the packet.

At block416, the trailer is generated. For example, the trailer processor260generates the trailer264when the trailer processor260determines that a trailer is to be added to the packet220, according to an embodiment.

At block420, the network device stores the trailer in the packet memory at a first location that is proximate to a second location at which the header of the packet is stored. For example, the trailer processor260stores the trailer264in the packet memory120at a first location that is proximate to a second location at which the header228of the packet is stored, according to an embodiment.

At block424, the network device transmits the packet via the second network interface. Transmitting the packet at block424includes retrieving the trailer from the packet memory120at the first location in connection with transmitting the trailer. For example, the transmit processor292retrieves the header228and the payload224from the packet memory120and provides the header228and the payload224to a corresponding network interface112for transmission of the header228and the payload224. In connection with transmitting the trailer264, the transmit processor292retrieves the trailer264from the packet memory120at the first location.

In an embodiment, block424includes retrieving the trailer from the packet memory120at the first location and storing the trailer in another memory (e.g., the scratchpad memory296) different than the packet memory120; and then retrieving the trailer from the other memory in connection with transmitting the trailer.

At least some of the various blocks, operations, and techniques described above may be implemented utilizing hardware, a processor executing firmware instructions, a processor executing software instructions, or any combination thereof. When implemented utilizing a processor executing software or firmware instructions, the software or firmware instructions may be stored in any computer readable memory such as on a magnetic disk, an optical disk, or other storage medium, in a RAM or ROM or flash memory, processor, hard disk drive, optical disk drive, tape drive, etc. The software or firmware instructions may include machine readable instructions that, when executed by one or more processors, cause the one or more processors to perform various acts.

When implemented in hardware, the hardware may comprise one or more of discrete components, an integrated circuit, an application-specific integrated circuit (ASIC), a programmable logic device (PLD), etc.

While the present invention has been described with reference to specific examples, which are intended to be illustrative only and not to be limiting of the invention, changes, additions and/or deletions may be made to the disclosed embodiments without departing from the scope of the invention.