Method and system for packet processing according to a table lookup
11711305 · 2023-07-25
Inventors
Cpc classification
H04L47/24
ELECTRICITY
International classification
Abstract
The present invention provides a method for packet processing according to a lookup table, comprising: receiving a packet, wherein the packet includes a packet header, and the packet header consists of control information; providing a lookup table with M entries, wherein each entry includes N conditions and a result/action indicator, and the M entries are sorted in a priority order; matching the information with the N conditions; and applying the result/action indicator in the matched entry with the highest priority on the packet.
Claims
1. A method for packet processing according to a lookup table, comprising: receiving a packet, wherein the packet includes a packet header information, and the packet header includes control information; providing a lookup table with M entries, wherein each entry includes N conditions and a result/action indicator, and the M entries are sorted in a priority order; matching the information with the N conditions; and applying the result/action indicator in the matched entry with the highest priority on the packet, wherein for each information in the packet header, a bit map array is given after the matching.
2. The method for packet processing according to a lookup table according to claim 1, wherein the bit map arrays from each information in the packet header are processed with a logic OR procedure to generate an aggregated bit map array.
3. The method for packet processing according to a lookup table according to claim 2, wherein the aggregated bit map arrays are processed with a logic AND procedure to generate a final aggregated bit map array with the priority order.
4. The method for packet processing according to a lookup table according to claim 1, wherein the result/action indicator indicates to let the packet pass, drop the packet, forward the packet, or modify the contents of the packet headers.
5. The method for packet processing according to a lookup table according to claim 1, wherein the information of the packet header includes an IP version, a source/destination IP address, a time-to-live count, a source/destination MAC address, a VLAN tag, a TCP/UDP source/destination port number.
6. The method for packet processing according to a lookup table according to claim 1, wherein the priority order is sorted by a software.
7. A system for packet processing according to a lookup table, comprising: a receiver for receiving a packet, wherein the packet includes a packet header, and the packet header consists of control information; a memory, storing a lookup tablewith M entries, wherein each entry includes N conditions and a result/action indicator, and the M entries are sorted in a priority order; and a processor, wherein the processor matches the information with the N conditions, and applies the result/action indicator in the matched entry with the highest priority on the packet, wherein for each information in the packet header, a bit map array is given after the matching.
8. The system for packet processing according to a lookup table according to claim 7, wherein the bit map arrays from each information in the packet header are processed with a logic OR procedure to generate an aggregated bit map array.
9. The system for packet processing according to a lookup table according to claim 7, wherein the aggregated bit map arrays are processed with a logic AND procedure to generate a final aggregated bit map array with the priority order.
10. The system for packet processing according to a lookup table according to claim 7, wherein the result/action indicator indicates to let the packet pass, drop the packet, forward the packet, or modify the contents of the packet headers.
11. The system for packet processing according to a lookup table according to claim 7, wherein the information of the packet header includes an IP version, a source/destination IP address, a time-to-live count, a source/destination MAC address, a VLAN tag, a TCP/UDP source/destination port number.
12. The system for packet processing according to a lookup table according to claim 7, wherein the priority order is sorted by a software.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
(1)
(2)
DETAILED DESCRIPTION
(3) Unless defined otherwise, all technical and scientific terms used herein have the same meanings as commonly understood by one of skill in the art to which this disclosure belongs. It will be further understood that terms, such as those defined in commonly used dictionaries, should be interpreted as having a meaning that is consistent with their meaning in the context of the relevant art and the present disclosure, and will not be interpreted in an idealized or overly formal sense unless expressly so defined herein.
(4) Reference throughout this specification to “one embodiment” or “an embodiment” means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment. Thus, the appearances of the phrases “in one embodiment” or “in an embodiment” in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.
(5) Reference is made to
(6) It should be noted that the number of entries is not limited to only four, and the number of conditions is not limited to only two. The number of entries and conditions in the present embodiment is mainly for exemplary purpose, and thus should not limit the scope of the present invention.
(7) In the present embodiment, Condition 1 stands for source IP (hereinafter, “Src IP”) and Condition 2 stands for destination IP (hereinafter, “Dst IP”). As can be seen in
(8) In Condition 1 of Entry 3, the condition is “Src IP: Any Value”, such condition means no matter what value comes in, the matching will always be true. Alternatively, it can also be understood that no matter what value comes in, the matching will always be established (or always match). The Any Value can also be referred to as wildcard, as can be seen in Lookup table for Condition 1 Src IP 101 and Lookup table for Condition 2 Dst IP 102.
(9) Reference is next made to
(10) Reference is next made to
(11) Further referring to the bit map array of Lookup table for Condition 1 Src IP 101, for Entry 1, there's no match, therefore the bit map array may be expressed as 0.0.0.0. For Entry 2, there's a match, therefore the bit map array may be expressed as 0.0.1.0. For Entry 4, there's no match, therefore the bit map array may be expressed as 0.0.0.0. For Entry 3, there a match, therefore the bit map array may be expressed as 0.1.0.0. The four bit map arrays are then computed through an OR logic gate. Therefore, For IP header's Src IP 3.3.3.3, it matches Entry 2 and Entry 3, and this result can be reduced to an aggregated bit map array as 0.1.1.0.
(12) Further referring to the bit map array of Lookup table for Condition 2 Dst IP 101, for Entry 1, there's no match, therefore the bit map array may be expressed as 0.0.0.0. For Entry 2, there's a match, therefore the bit map array may be expressed as 0.0.1.0. For Entry 3, there's no match, therefore the bit map array may be expressed as 0.0.0.0. For Entry 4, there a match, therefore the bit map array may be expressed as 1.0.0.0. The four bit map arrays are then computed through an OR logic gate. Therefore, For IP header's Dst IP 4.4.4.4, it matches Entry 2 and Entry 4, and this result can be reduced to an aggregated bit map array as 1.0.1.0.
(13) Furthermore, the two aggregated bit map arrays, bit map array 0.1.1.0, and bit map array 1.0.1.0 are next processed through an AND logic gate 110, to implement the priority condition, as shown in
(14) Reference is next made to
(15) According to the lookup table and the matching, the packet will be dropped, since the result/action of the matched entry is to drop the packet.
(16) It should be noted that, if multiple entries match all conditions, only the one with the highest priority is selected and its corresponding result/action will be applied to the packet.
(17) Moreover, the result/action is not limited to only “let packet pass” and “drop packet.” The result/action may also be “modify the contents of the packet headers.” People with ordinary skill in the art may modify or have other implementation with respect to such result/action.
(18) It should also be noted that, a bit map index is generated after the lookup. Further, for each bit map index, it points to a bit map array (also known as bit map vector) stored in a memory space.
(19) Reference is next made to
(20) The number of the entry is not limited. For example, the number of entry may be 20. Further, the number of condition is not limited. For example, the number of condition may be 30. People with ordinary skill in the art may change those numbers according to their requirements.
(21) One of the general purposes of the present invention may be, to find out the corresponding result/action (i.e., how to deal with a packet) against combined search conditions. For one instance, to distinguish different kinds of network packets against combined fields of different kinds of packet headers and apply the corresponding action on the packets. For another instance, to find out the corresponding output port/queue for a packet against combined conditions. For a further instance, to design an event trigger mechanism where an event is triggered while multiple conditions assert.
(22) Reference is next made to
(23) Reference is next made to
(24) As shown in
(25) Reference is finally made to
(26) Moreover, for a match condition, combine (bitwise or) all match values' bit map arrays and the wildcard bit map array to obtain a single-condition resulting bit map array that tells which table entries are satisfied with the match condition.
(27) For all match conditions, combine (bitwise and) all single-condition resulting bit may arrays to obtain the final multi-condition resulting bit map array that tells which table entries are satisfied with all match conditions.
(28) The sequence of a bit map array represents the priority of each table entry. Check the final multi-condition resulting bit map array to find out the matched entry with the highest priority.
(29) For a table lookup operation, it is to find the matched entry that satisfies multiple conditions and is with the highest priority.
(30) The priority order is defined in the bit map array after logic AND operation. The priority order can be either from MSB to LSB or from LSB to MSB, depending on the hardware implementation method. The priority order depends on the application requirement and the software is able to rearrange the order.
(31) In sum, the present invention divides one large lookup table (logical) into several small lookup tables (physical), each of which is associated with a match condition of the table entry. Further, the so-called small lookup tables result from limited number of legitimate match values, and that is enough for some lookup applications. Thus, no CAM or hash solution is required for lookup operations.
(32) In sum, the most suitable lookup algorithm is able to be applied on each table respectively for best performance, depending on each table's matching condition.
(33) Further, the present invention may be applied to all sorts of communication and networking equipment. Further, the present invention may also be applied to all hardware designs that require table lookup operation with prioritized, multi-condition and wildcard-inclusive entries.
(34) In sum, the present invention provides a scalable hardware table lookup method to search prioritized, multi-condition and wildcard-inclusive table entries, in which the prioritized table entries are sorted by software, and such design reduces hardware complexity and increases hardware performance.
(35) Further, multiple conditions' match process are conducted concurrently to reduce table lookup response time, in the present invention.
(36) Moreover, the wildcard-inclusive design provides the flexibility to specify a match value and hence increases the table utilization.
(37) It also should be noted that, a packet header's control information may consist of MAC header, VLAN tag, IP header, TCP header, UDP header, etc. And the packet header is considered well-known to people with ordinary skill in the art.