The present invention relates to switching network data packets. More particularly, the invention relates to switching network data packets by enumerating a set of unique paths in a parse tree.
A variety of techniques exist for switching data packets from an input port to an output port. The first action required for a switching device is to identify the type of packet it has received and locate and extract data fields from the packet. This process is known as parsing a packet.
Parsing involves a formal analysis by a computer of a string of bytes into its constituents, resulting in a parse tree showing their syntactic relation to each other, which may also contain semantic and other information. Thus, a parse tree is an ordered, rooted tree that represents the syntactic structure of a string according to some formal grammar. Parse trees are commonly constructed in terms of the dependency relation of dependency grammars. Parse trees are distinct from abstract syntax trees (also known simply as syntax trees), in that their structure and elements more concretely reflect the syntax of the input language.
Over the last decade computer networking has converged from a wide variety of special-purpose network protocols and specifications such as Asynchronous Transfer Mode (ATM), Token ring, Fiber channel, and Infiniband into the use of Ethernet as a universal physical layer and protocol. In addition to these legacy network protocols oriented at specific features such as call handling, disk access and processor interconnect, new technologies such as virtual machines, distributed computing and cloud computing have also imposed new and varied requirements on Ethernet and Transmission Control Protocol (TCP)/Internet Protocol (IP).
This convergence has lead to an explosion of new protocols, algorithms and tags, which provide the same features as special-purpose network protocols did but, use Ethernet as a transport layer. As the rate of change of new protocols, features and technologies increases there is a corresponding need to deploy these technologies to the field more quickly.
Traditionally new protocols have been provisioned by means of a change to the hardware, specifically a physical change to the Application Specific Integrated Circuit (ASIC), which implements the switching function. This limits the rate of deployment of new protocols to the speed at which these changes can be implemented and fabricated.
In recent years the industry has moved towards the technique of providing programmable parsers as a way to mitigate the impact of changes. Programmable parsers work by means of constructing a tree of possible packet types based on the headers found during parsing. Current parsers keep track of the types of headers they have seen during parsing by setting a bit for each header found, known as a flag.
The use of flags to track the type of headers found is insufficient in some cases, as it does not record the order in which the headers were found. Consequently, existing parsers must use extra flag bits to keep track of order where it is important, and must know the cases in which order information needs to be preserved.
In view of the foregoing, it would be desirable to provide an improved technique for resolving paths through a parse tree.
A method includes constructing a graph characterizing a set of packet headers associated with network traffic. The graph has a unique identifier for each possible combination of packet headers forming a path in the graph. A received packet is associated with a unique identifier in the graph. Characteristics of the received packet are reconstructed based upon the unique identifier.
A processor includes an associative memory storing a graph characterizing a set of packet headers associated with network traffic. The graph has a unique identifier for each possible combination of packet headers forming a path in the graph. The associative memory matches attributes of a received packet with a unique identifier. An index memory reconstructs characteristics of the received packet based upon the unique identifier.
A method includes forming unique assigned values to arcs in a graph, constraining paths in the graph, forming calculated paths through the graph based upon the assigned values, constructing a path table with the calculated paths and determining whether any of the calculated paths have an identical value, and if so, repeating the forming and constructing operations.
The invention is more fully appreciated in connection with the following detailed description taken in conjunction with the accompanying drawings, in which:
Like reference numerals refer to corresponding parts throughout the several views of the drawings.
The invention assigns a unique identifier to each possible combination of headers traversed in a parse tree. Advantageously, the unique combination can be efficiently computed in hardware.
Constraints are then placed on paths in the graph 412. For example, a directed cyclic graph, as shown in
Next, paths are calculated in the graph 414.
Next, a path table is constructed 416. That is, a table from the results of the possible paths enumerated is constructed. Next, the table is evaluated for common values, termed collisions. No two paths may have the same value, otherwise a collision exists. If a collision does not exist (418—No), then processing is completed 420. Otherwise (418—Yes), processing returns to block 414. If a collision has occurred, then a new set of arc assignments and/or a new formula is applied and the processing of blocks 414-418 is repeated. This cycle is repeated until a collision-free table is created or the algorithm reaches some arbitrary limit and reports failure.
Using the formula described above by function8, we show that path hash calculations for two packets which contain identical header types but arranged in a different order result in two different path hash calculations.
On the parse path for the first packet, using the enumerated path values shown in
Each path hash computation begins in the same way, by initializing a state variable cstate to a constant value (in this case zero). For each arc that is traversed by the parser, a new incremental state value cstate is computed by calling formula8( ) with the value of the cstate as well as the arc value for each arc. The pseudocode above supplies the value of cstate and arcValue as it computes each new cstate value. In one embodiment, only the final value would be retained and passed on for subsequent processing. In the foregoing example, the formula8( ) calculation yields incremental path hash calculations of 1, 132, 86, 58. Only the last incremental path hash calculation of 58 may be passed as the final path hash value for the first packet.
On the parse path for the second packet, the resulting sequence of path values is 3, 20, 17, 1, resulting in incremental path hash values of 3, 150, 90, 44, where 44 is the final path hash used for subsequent processing. These values are shown in
For a correctly chosen function and set of arc values, every valid path through a parse tree will result in a unique identifier, which can then later be used to reconstruct both the path which was taken and which headers were present. Storing this single value is significantly more compact than storing all intermediate values.
The results of the Next State Table 502 are used to update the current state and perform the incremental Path Value calculation in block 503. In the prior art, flags are set at this point, but that operation can be omitted because each path has a unique identity. Therefore, that identity can be used to specify path components and order. If the actions indicate that parsing is complete, the final path value is forwarded to the Path Value Table 505. Otherwise the current State and Path Values are sent back to Key Generation 501 where additional searches are performed until parsing is complete.
Packet Data from Incoming Data and Actions from the Next State Table 502 are used to extract the data fields of interest from the packet, which are then sent to the Extracted Data Structure 506. At the end of parsing, the results of the Path Value Table 505 are added to this structure, which is then sent to the control path which will determine how the packet will be forwarded.
Some advanced parsers use a multiple simultaneous match parser (sometimes referred to as Kangaroo parsing), in which the Next State Table 502 is capable of matching multiple arcs in the parse tree during a single lookup. In the case of
In a Kangaroo-type parser, the Path Value formula incorporates some information for each possible path taken, rather than simply the node identifier.
There are other values which could be used to compute the Path Value and are still likely to produce a unique enumeration for each path. For example, the Ethernet type values used to determine the next state, as well as the key values which are sent to the Next State Lookup, are both viable candidates, as is a combination of data from the packet used to determine the state along with internal state such as node numbers or arc numbers.
The foregoing description, for purposes of explanation, used specific nomenclature to provide a thorough understanding of the invention. However, it will be apparent to one skilled in the art that specific details are not required in order to practice the invention. Thus, the foregoing descriptions of specific embodiments of the invention are presented for purposes of illustration and description. They are not intended to be exhaustive or to limit the invention to the precise forms disclosed; obviously, many modifications and variations are possible in view of the above teachings. The embodiments were chosen and described in order to best explain the principles of the invention and its practical applications, they thereby enable others skilled in the art to best utilize the invention and various embodiments with various modifications as are suited to the particular use contemplated. It is intended that the following claims and their equivalents define the scope of the invention.