Search

US-12627751-B2 - Variable-length headers

US12627751B2US 12627751 B2US12627751 B2US 12627751B2US-12627751-B2

Abstract

The techniques disclosed herein enhance the functionality of computer networking devices through an accelerated packet header analysis algorithm that enables support for variable length headers and vectorized packet header operations. This is accomplished through pre-parsing of the network packet to determine the presence and position of various packet headers (e.g., ethernet, IPv4). The disclosed system can be subsequently configured with a header selector defining a set of target packet headers and target fields within the packet headers. The disclosed system can then utilize the header offsets derived from parsing the packet to process the header selector. By utilizing vectorized operations to calculate field offsets and extract values encoded by the network packet, the disclosed system can match header fields across multiple packet headers. In contrast, many existing solutions are limited to matching a single packet header at a time.

Inventors

  • Matthew Ian Ronald WILLIAMS

Assignees

  • MICROSOFT TECHNOLOGY LICENSING, LLC

Dates

Publication Date
20260512
Application Date
20230531

Claims (20)

  1. 1 . A method for processing a network packet with a variable length header, the method performed by a packet processing function of a computing device operating in a computing network environment, the packet processing function configured to analyze a plurality of packet headers of the network packet based on a preconfigured header field selector, the computing device having a processor associated with a register and an instruction set, the method comprising: receiving the network packet with the variable length header containing a plurality of packet headers, each of the packet headers containing a corresponding plurality of header fields wherein each header field encodes a value; parsing the network packet to determine a plurality of header offsets, wherein each header offset corresponds to one of the plurality of packet headers, each header offset defining a byte position of an associated packet header within the network packet; accessing a preconfigured header selector defining a plurality of target packet headers and a corresponding plurality of target header fields; loading the preconfigured header selector into the register associated with the processor, wherein the preconfigured header selector is configured to fit within a size of the register; determining, based on the preconfigured header selector, a plurality of target field offsets, wherein each target field offset corresponds to one of the plurality of target header fields; extracting, for a given target header field of the plurality of target header fields, the value encoded by a header field that matches the given target header field based on the corresponding target field offset and header offset; generating a unique header value based on the extracted values for the plurality of target header fields; and executing an action on the network packet based on the unique header value, wherein the plurality of target header fields is matched to the plurality of header fields of the network packet as a vectorized process in the processor to enable parallel application of the preconfigured header selector across the plurality of packet headers of the network packet.
  2. 2 . The method of claim 1 , wherein: the register is a first register; the plurality of header offsets is loaded into a second register; the plurality of header offsets is configured to fit within a size of the second register; and the size of the second register is different from the size of the first register.
  3. 3 . The method of claim 1 , wherein determining the plurality of target field offsets comprises: calculating a plurality of updated header offsets based on the preconfigured header field selector and the plurality of header offsets; receiving a plurality of preconfigured field offsets defining a position of the plurality of target header fields within the plurality of target packet headers; and summing the plurality of updated header offsets and the plurality of preconfigured field offsets.
  4. 4 . The method of claim 1 , wherein extracting the value encoded by the header field that matches the given target header field comprises: generating a plurality of byte offsets based on the plurality of target field offsets; and applying the plurality of byte offsets to the network packet.
  5. 5 . The method of claim 1 further comprising: detecting an update to the network packet, the update causing a structural change to the plurality of packet headers of the network packet; and in response to detecting the update to the network packet, reparsing the network packet to determine a changed plurality of header offsets.
  6. 6 . The method of claim 1 , wherein the action is a forwarding match action of a packet classifier.
  7. 7 . The method of claim 1 , wherein the action is a data rewrite action.
  8. 8 . A system for processing a network packet with a variable length header, the system having a processor associated with a register and an instruction set, the system comprising: a processing unit; and a computer readable medium having encoded thereon computer readable instructions that when executed by the processing unit cause the system to: receive the network packet with the variable length header containing a plurality of packet headers, each of the packet headers containing a corresponding plurality of header fields wherein each header field encodes a value; parse the network packet to determine a plurality of header offsets, wherein each header offset corresponds to one of the plurality of packet headers, each header offset defining a byte position of an associated packet header within the network packet; receive a preconfigured header selector defining a plurality of target packet headers and a corresponding plurality of target header fields; load the preconfigured header selector into a register associated with the processor, wherein the preconfigured header selector is configured to fit within a size of the register; determine, based on the preconfigured header selector, a plurality of target field offsets, wherein each target field offset corresponds to one of the plurality of target header fields; extract, for a given target header field of the plurality of target header fields, the value encoded by a header field that matches the given target header field based on the corresponding target field offset and header offset; generate a unique header value based on the extracted values for the plurality of target header fields; and execute an action on the network packet based on the unique header value, wherein the plurality of target header fields is matched to the plurality of header fields of the network packet as a vectorized process in the processor to enable parallel application of the preconfigured header selector across the plurality of packet headers of the network packet.
  9. 9 . The system of claim 8 , wherein: the register is a first register; the plurality of header offsets is loaded into a second register; the plurality of header offsets is configured to fit within a size of the second register; and the size of the second register is different from the size of the first register.
  10. 10 . The system of claim 8 , wherein determining the plurality of target field offsets comprises: calculating a plurality of updated header offsets based on the preconfigured header selector and the plurality of header offsets; receiving a plurality of preconfigured field offsets defining a position of the plurality of target header fields within the plurality of target packet headers; and summing the plurality of updated header offsets and the plurality of preconfigured field offsets.
  11. 11 . The system of claim 8 , wherein extracting the value encoded by the header field that matches the given target header field comprises: generating a plurality of byte offsets based on the plurality of target field offsets; and applying the plurality of byte offsets to the network packet.
  12. 12 . The system of claim 8 , wherein the computer readable instructions further cause the system to: detect an update to the network packet, the update causing a structural change to the plurality of packet headers of the network packet; and in response to detecting the update to the network packet, reparse the network packet to determine a changed plurality of header offsets.
  13. 13 . The system of claim 8 , wherein the action is a forwarding match action of a packet classifier.
  14. 14 . The system of claim 8 , wherein the action is a data rewrite action.
  15. 15 . A non-transitory computer readable storage medium having encoded thereon computer readable instructions that when executed by a system cause the system to: receive a network packet with a variable length header containing a plurality of packet headers, each of the packet headers containing a corresponding plurality of header fields wherein each header field encodes a value; parse the network packet to determine a plurality of header offsets, wherein each header offset corresponds to one of the plurality of packet headers, each header offset defining a byte position of an associated packet header within the network packet; receive a preconfigured header selector defining a plurality of target packet headers and a corresponding plurality of target header fields; load the preconfigured header selector into a register associated with a processor, wherein the preconfigured header selector is configured to fit within a size of the register; determine, based on the preconfigured header selector, a plurality of target field offsets, wherein each target field offset corresponds to one of the plurality of target header fields; extract, for a given target header field of the plurality of target header fields, the value encoded by a header field that matches the given target header field based on the corresponding target field offset and header offset; generate a unique header value based on the extracted values for the plurality of target header fields; and execute an action on the network packet based on the unique header value, wherein the plurality of target header fields is matched to the plurality of header fields of the network packet as a vectorized process in the processor to enable parallel application of the preconfigured header selector across the plurality of packet headers of the network packet.
  16. 16 . The non-transitory computer readable storage medium of claim 15 , wherein: the register is a first register; the plurality of header offsets is loaded into a second register; the plurality of header offsets is configured to fit within a size of the second register; and the size of the second register is different from the size of the first register.
  17. 17 . The non-transitory computer readable storage medium of claim 15 , wherein determining the plurality of target field offsets comprises: calculating a plurality of updated header offsets based on the preconfigured header selector and the plurality of header offsets; receiving a plurality of preconfigured field offsets defining a position of the plurality of target header fields within the plurality of target packet headers; and summing the plurality of updated header offsets and the plurality of preconfigured field offsets.
  18. 18 . The non-transitory computer readable storage medium of claim 15 , wherein extracting the value encoded by the header field that matches the given target header field comprises: generating a plurality of byte offsets based on the plurality of target field offsets; and applying the plurality of byte offsets to the network packet.
  19. 19 . The non-transitory computer readable storage medium of claim 15 , wherein the computer readable instructions further cause the system to: detect an update to the network packet, the update causing a structural change to the plurality of packet headers of the network packet; and in response to detecting the update to the network packet, reparse the network packet to determine a changed plurality of header offsets.
  20. 20 . The non-transitory computer readable storage medium of claim 15 , wherein the action is a forwarding match action of a packet classifier.

Description

BACKGROUND As more data and services are stored and provided online via network connections, providing high performance and an optimal and reliable user experience is an important consideration for network providers and computer networking device manufacturers. In various examples, computer networking devices can include electronic devices that communicate and interact over a computer network via network packets such as gateways, routers, and switches. A network packets can be a formatted unit of data containing control information and user data. Such computer networking devices can implement software programs that process and execute network operations such as packet routing, rewriting, filtering and so forth. To control how a network packet is processed by a computer network device, the network packet can include a packet header comprising fields that encode values defining characteristics of the network packet. Such packet headers can be formatted for compatibility with standard networking protocols such as the internet protocol (IPv4, IPv6), ethernet protocol, GPRS Tunnelling Protocol (GTP), Transmission Control Protocol (TCP), User Datagram Protocol (UDP), and so forth. For instance, an ethernet header can include information identifying a destination hardware device and a source hardware device. In another example, an IPv4 header can include information identifying destination network address and a source network address. In many scenarios, an individual network packet can include several packet headers to enable processing by different layers of a computing network (e.g., internet layer, transport layer). Moreover, some standard protocols can also include optional extension headers that may or may not be utilized to encode additional information. Consequently, the flexibility of networking protocols can result in packet headers that vary in length. For example, a packet header that includes an ethernet header and an IPv4 header can be a different length from another packet header that includes an ethernet header and an IPv6 header with additional extension headers. As such, modern computer networking devices must include functionality to accommodate variable length packet headers. Unfortunately, many existing solutions assume a fixed length packet header wherein individual header fields occupy a predetermined offset within the packet header and can fail to process network packets that do not conform to the assumed fixed length. Some existing solutions may simply drop packets with variable length headers leading to poor service quality. Other methods may defer such network packets to a “slow path” for processing to avoid dropping packets but consequently incurs increased latency, reduced throughput increased resource consumption, and reduced efficiency. It is with respect to these and other considerations that the disclosure made herein is presented. SUMMARY The techniques described herein enhance the functionality of computer networking devices by implementing a packet header analysis algorithm to enable support for variable length packet headers in a performant manner. While the present disclosure is applicable to all types of computing network operations, many of examples described herein are illustrated in the context of packet classification and/or packet rewrite operations. Packet classification can refer to a process which differentiates network packets based on various characteristics such as source address, destination address (e.g., an IP address), protocol type, and the like. Differentiating network packets in this way enables a computing network to implement different services and advanced functionality beyond simple destination-based routing. In addition, rewriting can refer to operations that modify information within the network packet such as a destination address. In contrast to existing solutions which assume a fixed header length and position, the disclosed techniques can parse a network packet to determine the presence and position (e.g., offsets) of various packet headers within the network packet. These offsets can be utilized by the disclosed system to analyze relevant information within the various packet headers such as device identifiers, IP addresses, and so forth. For example, the disclosed system can be configured to perform packet classification and receive a header selector that identifies a set of target headers from among the plurality of packet headers within the network packet. In a specific example, the network packet can contain an ethernet header, an IPv4 header, and a GTP header while the header selector can target the ethernet header and the IPv4 header. Moreover, the header selector can include target fields within the target headers. For instance, within the IPv4 header, the header selector can target the source IP address of the network packet while also targeting the source media access control (MAC) address of the ethernet header. In accordance with the hea