A method and device for arranging network card traffic forwarding rule table items

By dividing the network card traffic forwarding rule table into multiple sub-tables and using hash operations to select the target sub-table, the problems of low switch table entry arrangement efficiency and high power consumption in the existing technology are solved, and efficient table lookup and high power consumption are achieved. utilization, reducing costs.

CN118075200BActive Publication Date: 2024-10-29WUXI STARS MICRO SYSTEM TECHNOLOGIES CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410338031.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-03-22
Publication Date
2024-10-29
Estimated Expiration
2044-03-22

AI Technical Summary

Technical Problem

The switch table entry arrangement method of the existing network card is not efficient. The table partitioning scheme is complex and the new table entry type involves the difficulty of redistributing table entries. The table lookup time is long and the power consumption is high, making it impossible to effectively control the area and cost.

Method used

Divide the network card traffic forwarding rule table evenly into multiple sub-tables, and use the last sub-table as an escape table. Use hash operations to randomly select the target sub-table to store and query table items, narrowing the table look-up range and reducing power consumption.

Benefits of technology

It improves table lookup efficiency and table item utilization, reaching a utilization rate close to 100%, reducing implementation costs, and supports new table item types.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118075200B_ABST
    Figure CN118075200B_ABST
Patent Text Reader

Abstract

The present invention provides a method and device for arranging items of a network card traffic forwarding rule table, the method comprising: evenly dividing a network card traffic forwarding rule table into a plurality of sub-tables, taking the last sub-table as an escape table, the network card traffic forwarding rule table comprising item type, item content and operations to be performed; when storing a new item, performing a hash operation on the item type and item content in the item, randomly selecting a target sub-table from the plurality of sub-tables according to the hash operation result, and storing the item in the target sub-table; in response to receiving an item query request, performing the hash operation on the item type and item content of the item to be queried, determining the target sub-table according to the hash operation result, so as to locate the item type and item content from the target sub-table, and returning the query result. The technical scheme of the present invention improves the efficiency of table lookup and the utilization rate of items.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the field of network card design, and in particular relates to a method and device for arranging network card flow forwarding rule table items. Background Art

[0002] The significant feature of the smart network card is that it can offload traffic forwarding. Traffic forwarding rules can be sent to the network card, and the corresponding network card is equipped with a virtual switch module. These traffic forwarding rule entries are also called switch entries of the network card.

[0003] When receiving and sending messages, the NIC can extract information such as source MAC, destination MAC, VLAN, Ethertype, source IP, destination IP, TCP / UDP type, source port, destination port, etc. from the message. The virtual switch module on the NIC uses the extracted information to query the switch table entry. After hitting the table entry, it can complete functions such as filtering, forwarding, mirroring, copying, and statistics of the message. Usually, the number of switch table entries of a NIC can be very large, such as 32768 entries. The arrangement of these different types of switch table entries will greatly affect the efficiency of the NIC chip table lookup.

[0004] One solution in the related art is Figure 1 As shown in the figure. According to these different table lookup types, the entire table is divided into different types of sub-tables, such as MAC table, VLAN table and EtherType table. The network card chip uses the MAC information of the message to look up the MAC table, and the network card chip uses the VLAN information of the message to look up the VLAN table, and so on. However, this table item arrangement method is not efficient in table item usage. There are more than ten common switch table item types, and the table item usage rate will be heavily dependent on the table sub-scheme. Due to the complexity of the table sub-scheme, adding a new table item type also involves difficulties such as the reallocation of table items.

[0005] Another solution in the related art is to arrange these different types of switch table entries in a complete master table, and the entries of the table entries contain information about the switch table entry type. This table arrangement solution has a large table entry, and each table lookup requires searching the entire table entry. If SRAM is used to implement the table entry, the table entry search time is long. If a dedicated BCAM logic is used to implement the table entry, the power consumption will be too high, and the area and cost cannot be controlled. Summary of the invention

[0006] The object of the present invention is to provide a method and device for arranging network card traffic forwarding rule table entries, aiming to improve table lookup efficiency and table entry utilization.

[0007] According to a first aspect of the present invention, a method for arranging network card traffic forwarding rule table entries is provided, comprising:

[0008] The network card traffic forwarding rule table is evenly divided into a plurality of sub-tables, and the last sub-table is used as an escape table, wherein the network card traffic forwarding rule table includes a table entry type, a table entry content, and an operation to be performed;

[0009] When storing a new table entry, performing a hash operation on the table entry type and the table entry content in the table entry, randomly selecting a target subtable from the multiple subtables according to the hash operation result, and storing the table entry in the target subtable;

[0010] In response to receiving a table entry query request, the hash operation is performed on the table entry type and the table entry content of the table entry to be queried, a target subtable is determined according to the hash operation result, the table entry type and the table entry content are located in the target subtable, and a query result is returned.

[0011] Preferably, the table entry types include a MAC table, a VLAN table and an EtherType table.

[0012] Preferably, storing the table entry in the target subtable further comprises:

[0013] First, check whether the table entry exists. If not, determine whether the target subtable is full. If the target subtable is not full, search for unused entries starting from the smallest sequence number and add the table entry to the entry in the target subtable.

[0014] If the target subtable is full, continue to query whether the escape table is full. If the escape table is not full, search for unused entries starting from the smallest sequence number and add the entry to the entry in the escape table. If the escape table is full, return failure.

[0015] Preferably, the method further comprises: in response to receiving the entry deletion request, first querying whether the entry to be deleted exists, if so, deleting the entry and returning success; if not, returning failure.

[0016] Preferably, the method further comprises: in response to receiving the table entry update request, first querying whether the table entry to be updated exists, if so, overwriting the original table entry with the new table entry and returning success; if not, returning failure.

[0017] According to a second aspect of the present invention, a device for arranging network card traffic forwarding rule entries is provided, comprising:

[0018] A division unit, used for evenly dividing the network card traffic forwarding rule table into a plurality of sub-tables, and using the last sub-table as an escape table, wherein the network card traffic forwarding rule table includes a table entry type, a table entry content, and an operation to be performed;

[0019] a configuration unit, configured to perform a hash operation on an entry type and an entry content in the entry when storing a new entry, randomly select a target subtable from the multiple subtables according to the hash operation result, and store the entry in the target subtable;

[0020] The query unit is used to perform the hash operation on the entry type and entry content of the queried entry in response to receiving the entry query request, determine the target subtable according to the hash operation result, locate the entry type and entry content from the target subtable, and return the query result.

[0021] Compared with the related art, the technical solution of the present invention has the following advantages:

[0022] By dividing the total table into sub-tables and mixed table items to implement the switch table item function of the network card chip, it can shorten the table lookup time, narrow the comparison range, reduce power consumption, and make the table item utilization rate close to the whole table solution, that is, close to 100%. Using SRAM to implement the table items reduces the implementation cost and supports new table item types.

[0023] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or be understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures and processes indicated in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or related technologies, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. It is obvious that the drawings described below are certain embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0025] Figure 1 The present invention is a schematic diagram of a switch table layout solution according to the related technology.

[0026] Figure 2 It is a flow chart of the method for arranging network card traffic forwarding rule table items according to the present invention.

[0027] Figure 3 Schematic diagram of the structure of table entries according to the present invention.

[0028] Figure 4 It is a schematic diagram of the table division and table layout scheme according to the present invention.

[0029] Figure 5 It is a flowchart of table item query according to the present invention.

[0030] Figure 6 is a flowchart of newly added table entries according to the present invention. DETAILED DESCRIPTION

[0031] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0032] Based on the above analysis, the present invention proposes a method and device for arranging table items of network card traffic forwarding rules. Based on the mixed table scheme, this scheme proposes a new table item arrangement scheme, which divides the entire total table into N sub-tables, and retains the last sub-table as an escape table. When configuring the table items, a sub-table is randomly selected from 1 to N-1 using a HASH operation, and the table item entry is configured to the sub-table. If the sub-table is full, the table item entry is configured to the escape table. When the network card chip looks up the table, the same HASH parameters are used, and a table lookup request is used to calculate, and a sub-table is selected for table lookup matching. At the same time, the escape table is looked up according to the table lookup request. If the table item is hit at any position, it is considered that the table item hits successfully.

[0033] See also Figure 2 The method for arranging network card traffic forwarding rule entries provided by the present invention comprises:

[0034] Step 101: Divide the network card traffic forwarding rule table into multiple sub-tables evenly, and use the last sub-table as an escape table. The network card traffic forwarding rule table includes a table entry type, a table entry content, and an operation to be performed.

[0035] The table structure is as follows Figure 3 As shown. Each table entry structure includes the table entry type, table entry content and the operation to be performed. When looking up the table, only when the table entry type and table entry content match at the same time, the table entry is considered to be hit, and the corresponding operation in the table entry is performed. When the field segment defining the table entry type is 0, the table entry is invalid.

[0036] The table item partitioning scheme is as follows Figure 4 As shown in the figure. The entire table is evenly divided into N sub-tables, where sub-tables 1 to N-1 are used to randomly select table layout, and the last sub-table is used as an escape table. Using mixed table items, all types of table items are arranged in the same table item, which improves the utilization of table items and naturally supports the addition of different switch table item types, such as MAC table, VLAN table, and EtherType table.

[0037] Step 102: when storing a new table entry, a hash operation is performed on the table entry type and the table entry content in the table entry, a target sub-table is randomly selected from the multiple sub-tables according to the hash operation result, and the table entry is stored in the target sub-table.

[0038] The random table selection process in HASH is as follows. Input the table item type and table item content. Use the HASH algorithm and HASH key to perform a hash operation on the input table item type and table item content, and output a random table selection result from 1 to N-1. If the target subtable is full, it means that there is a HASH conflict in the previous storage process, and too many subtables are occupied, so it is stored in the escape table.

[0039] Step 103: In response to receiving the table entry query request, perform the hash operation on the table entry type and the table entry content of the table entry to be queried, determine the target subtable according to the hash operation result, locate the table entry type and the table entry content from the target subtable, and return the query result.

[0040] The same HASH algorithm and HASH key value are used for table allocation and table lookup to ensure the same table item type and content, and the output table selection results are consistent. By narrowing the table lookup request to the sub-table area, the table lookup efficiency is improved. The use of random sub-table selection and the use of escape tables as a safeguard against HASH conflicts solves the problem of HASH conflicts.

[0041] See also Figure 5 In the query operation of the table item, first use HASH to generate the sub-table number to be searched according to the type and content of the table item to be queried, and then query whether the table item to be queried exists in the sub-table and the escape table respectively. If it exists, the hit table item information is returned, if it does not exist, it returns failure.

[0042] See also Figure 6 In the operation of adding a table entry, the table entry query operation is first performed to check whether the table entry exists. If it exists, a failure is returned; if it does not exist, it is determined whether the subtable is full. If the subtable is not full, an unused entry is searched from the smallest sequence number and the table entry is added to the entry of the target subtable. If the subtable is full, the escape table is continued to be queried to see if it is full. If the escape table is not full, an unused entry is searched from the smallest sequence number and the table entry is added to the escape table; if the escape table is full, a failure is returned.

[0043] In the table entry deletion operation, the table entry query operation is first performed to check whether the table entry exists. If it exists, the original table entry is deleted and success is returned; if it does not exist, failure is returned.

[0044] For the update operation of the table entry, the table entry query operation is first performed to check whether the table entry exists. If it exists, the new table entry is used to overwrite the original table entry and a success is returned; if it does not exist, a failure is returned.

[0045] It can be seen that the network card traffic forwarding rule table entry arrangement method proposed in the present invention has the following advantages compared with the related art:

[0046] By dividing the total table into sub-tables and mixed table items to implement the switch table item function of the network card chip, it can shorten the table lookup time, narrow the comparison range, reduce power consumption, and make the table item utilization rate close to the whole table solution, that is, close to 100%. Using SRAM to implement the table items reduces the implementation cost and supports new table item types.

[0047] Accordingly, the present invention provides a second aspect of a network card traffic forwarding rule table item arrangement device, comprising:

[0048] A division unit, used for evenly dividing the network card traffic forwarding rule table into a plurality of sub-tables, and using the last sub-table as an escape table, wherein the network card traffic forwarding rule table includes a table entry type, a table entry content, and an operation to be performed;

[0049] a configuration unit, configured to perform a hash operation on an entry type and an entry content in the entry when storing a new entry, randomly select a target subtable from the multiple subtables according to the hash operation result, and store the entry in the target subtable;

[0050] The query unit is used to perform the hash operation on the entry type and entry content of the queried entry in response to receiving the entry query request, determine the target subtable according to the hash operation result, locate the entry type and entry content from the target subtable, and return the query result.

[0051] The above-mentioned device can be implemented by the network card traffic forwarding rule table item arrangement method provided by the embodiment of the above-mentioned first aspect. The specific implementation method can be referred to the description in the embodiment of the first aspect, and will not be repeated here.

[0052] It is understood that the structures, names and parameters described in the above embodiments are only examples. Those skilled in the art can also easily combine and adjust the structural features of the above embodiments according to the use requirements, and should not limit the concept of the present invention to the specific details of the above examples.

[0053] Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent substitutions for some of the technical features therein; and these modifications or substitutions do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for arranging network card traffic forwarding rule entries, characterized in that: include: The network card traffic forwarding rule table is evenly divided into a plurality of sub-tables, and the last sub-table is used as an escape table, wherein the network card traffic forwarding rule table includes a table entry type, a table entry content, and an operation to be performed; When storing a new table entry, performing a hash operation on the table entry type and the table entry content in the table entry, randomly selecting a target subtable from the multiple subtables according to the hash operation result, and storing the table entry in the target subtable; In response to receiving a table item query request, performing the hash operation on the table item type and the table item content of the table item to be queried, determining a target subtable according to the hash operation result, locating the table item type and the table item content from the target subtable, and returning a query result; The storing the table entry in the target sub-table further comprises: First, check whether the table entry exists. If not, determine whether the target subtable is full. If the target subtable is not full, search for unused entries starting from the smallest sequence number and add the table entry to the entry in the target subtable. If the target subtable is full, continue to query whether the escape table is full. If the escape table is not full, search for unused entries starting from the smallest sequence number and add the entry to the entry in the escape table. If the escape table is full, return failure. When querying a table entry, first generate the subtable number to be searched through a hash operation based on the type and content of the table entry to be queried, and then query whether the table entry to be queried exists in the subtable and escape table respectively. If so, return the hit table entry information, if not, return failure.

2. The method for arranging network card traffic forwarding rule entries according to claim 1, characterized in that: The table entry types include MAC table, VLAN table and EtherType table.

3. The method for arranging network card traffic forwarding rule entries according to claim 1, characterized in that: The method further includes: In response to receiving a table entry deletion request, first check whether the table entry to be deleted exists. If so, delete the table entry and return success; if not, return failure.

4. The method for arranging network card traffic forwarding rule entries according to claim 1, characterized in that: The method further includes: In response to receiving a table entry update request, first check whether the table entry to be updated exists. If it exists, the new table entry is used to overwrite the original table entry and return success; if it does not exist, return failure.

5. A network card traffic forwarding rule table item arrangement device, characterized in that: include: A division unit, used for evenly dividing the network card traffic forwarding rule table into a plurality of sub-tables, and using the last sub-table as an escape table, wherein the network card traffic forwarding rule table includes a table entry type, a table entry content, and an operation to be performed; a configuration unit, configured to perform a hash operation on an entry type and an entry content in the entry when storing a new entry, randomly select a target subtable from the multiple subtables according to the hash operation result, and store the entry in the target subtable; A query unit, configured to, in response to receiving a table item query request, perform the hash operation on the table item type and the table item content of the table item to be queried, determine a target subtable according to the hash operation result, locate the table item type and the table item content from the target subtable, and return a query result; The configuration unit is further used to: First, check whether the table entry exists. If not, determine whether the target subtable is full. If the target subtable is not full, search for unused entries starting from the smallest sequence number and add the table entry to the entry in the target subtable. If the target sub-table is full, continue to query whether the escape table is full; if the escape table is not full, search for unused entries starting from the smallest sequence number and add the entry to the entry in the escape table; If the escape table is full, return failure.

6. The network card traffic forwarding rule table item arrangement device according to claim 5, characterized in that: The table entry types include MAC table, VLAN table and EtherType table.

7. The network card traffic forwarding rule table item arrangement device according to claim 5, characterized in that: Also includes: A deleting unit, configured to, in response to receiving a table entry deletion request, first query whether the table entry to be deleted exists, and if so, delete the table entry and return success; If it does not exist, it returns failure.

8. The network card traffic forwarding rule table item arrangement device according to claim 5, characterized in that: Also includes: An updating unit, configured to, in response to receiving a table entry update request, first query whether the table entry to be updated exists, and if so, overwrite the original table entry with the new table entry and return success; If it does not exist, it returns failure.

Citation Information

Patent Citations

  • Apparatus and method for hash table storage, searching

    CN101604337A