Flow Table Storage and Packet Forwarding Method, Device, Computing Device and Medium
By separating the address management of the flow table from the data, storing the second hash value using the first hash value and storing the keywords and data in different memories respectively, the hash conflict problem is solved, and more efficient flow table storage and message forwarding is achieved.
Patent Information
- Application Number
- CN202210295137.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-23
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2042-03-23
AI Technical Summary
In the prior art, when increasing the number of forwarded stream tables, hashing algorithms make address conflicts difficult to avoid, how to store more stream tables and reduce hash conflicts while ensuring bandwidth.
By obtaining the first hash value and the second hash value of the keywords of the stream table to be stored, the second hash value is stored in the first memory, and the keywords and data are stored in the second memory, the address management of the stream table and the data are realized.
While ensuring that the bandwidth is satisfied, the number of storage of the stream table is increased, the probability of hash collision is reduced, and the quality of message forwarding is improved.
Smart Images

Figure CN114780537B_ABST
Abstract
Description
Technical Field
[0001] One or more embodiments of this specification relate to the field of communication technologies, and in particular, to a flow table storage and packet forwarding method, apparatus, computing device, and medium. Background Art
[0002] With the rapid development of cloud computing, the status of intelligent network card chips in cloud networks has been continuously rising, and the core of intelligent network card chips lies in the effective management of flow tables. Increasing the number of forwarding flow tables is one of the most important means of flow table management. Since the HASH algorithm is usually used to calculate addresses and store them in corresponding address spaces, when the number of forwarding flow tables is increased, it is an unavoidable difficult problem that the HASH algorithm causes address conflicts. How to reduce hash conflicts while storing as many forwarding flow tables as possible is an urgent problem to be solved at present. Summary of the Invention
[0003] In view of this, one or more embodiments of this specification provide a flow table storage and packet forwarding method, apparatus, computing device, and medium.
[0004] To achieve the above object, one or more embodiments of this specification provide the following technical solutions:
[0005] According to a first aspect of one or more embodiments of this specification, a flow table storage method is proposed, and the method includes:
[0006] Obtain the key and data of the flow table to be stored;
[0007] Obtain a first hash value and a second hash value of the key;
[0008] According to the first hash value, store the second hash value of the flow table to be stored in a first memory;
[0009] Store the key and data of the flow table to be stored in a second memory.
[0010] In some embodiments, the flow table to be stored has identification information, and the storing the second hash value of the flow table to be stored in the first memory according to the first hash value includes:
[0011] According to the first hash value, obtain the address of the bucket corresponding to the flow table to be stored in the first memory;
[0012] Store the identification information of the flow table to be stored and the second hash value in the slot of the bucket.
[0013] In some embodiments, the storing the key and data of the flow table to be stored in the second memory includes:
[0014] Obtain the address of the bucket corresponding to the flow table to be stored in the second memory according to the identification information of the flow table to be stored;
[0015] Store the keyword and data of the flow table to be stored in the slot of the bucket.
[0016] According to a second aspect of one or more embodiments of the present specification, a packet forwarding method is provided, and the method includes:
[0017] Obtain the keyword of the packet to be forwarded, and obtain the third hash value and the fourth hash value of the keyword;
[0018] According to the third hash value, obtain the second hash value of the keyword of at least one flow table from the first memory, and determine the flow table matching the packet to be forwarded by comparing the fourth hash value with the second hash value of the keyword of the at least one flow table; wherein, the address storing the second hash value in the first memory is determined according to the first hash value of the keyword of the flow table;
[0019] Obtain the keyword of the flow table matching the packet to be forwarded from the second memory, wherein the second memory stores the keyword and data of the flow table;
[0020] When the keyword of the flow table matches the keyword of the packet to be forwarded, perform forwarding processing on the packet to be forwarded according to the data of the flow table.
[0021] In some embodiments, the determining the flow table matching the packet by comparing the fourth hash value of the keyword of the packet with the second hash value of the keyword of the at least one flow table includes:
[0022] Obtain the address of the corresponding bucket in the first memory according to the second hash value of the packet;
[0023] Compare the second hash value of the flow table stored in each slot of the bucket with the fourth hash value of the packet, and determine the flow table with the same hash value as the flow table matching the packet to be forwarded.
[0024] In some embodiments, the identification information of the flow table is further stored in each slot of the bucket; the obtaining the keyword of the flow table from the second memory includes:
[0025] Obtain the identification information of the flow table matching the packet to be forwarded;
[0026] Obtain the address of the corresponding bucket in the second memory according to the identification information;
[0027] Obtain the keyword and data of the flow table stored in the bucket;
[0028] When the keyword of the flow table matches the keyword of the packet to be forwarded, forward the packet to be forwarded according to the data of the flow table.
[0029] According to the third aspect of one or more embodiments of the present specification, a flow table storage device is provided, and the device includes:
[0030] A first acquisition unit, configured to acquire the keyword and data of the flow table to be stored;
[0031] A second acquisition unit, configured to acquire a first hash value and a second hash value of the keyword;
[0032] A first storage unit, configured to store the second hash value of the flow table to be stored in a first memory according to the first hash value;
[0033] A second storage unit, configured to store the keyword and data of the flow table to be stored in a second memory.
[0034] In some embodiments, the flow table to be stored has identification information, and the first storage unit is specifically configured to:
[0035] Obtain the address of the bucket corresponding to the flow table to be stored in the first memory according to the first hash value;
[0036] Store the identification information of the flow table to be stored and the second hash value in the slot of the bucket.
[0037] In some embodiments, the second storage unit is specifically configured to:
[0038] Obtain the address of the bucket corresponding to the flow table to be stored in the second memory according to the identification information of the flow table to be stored;
[0039] Store the keyword and data of the flow table to be stored in the slot of the bucket.
[0040] According to the fourth aspect of one or more embodiments of the present specification, a flow table storage device is provided, and the device includes:
[0041] A first acquisition unit, configured to acquire the keyword of the packet to be forwarded, and acquire a third hash value and a fourth hash value of the keyword;
[0042] A determining unit, configured to obtain, according to the third hash value, a second hash value of a keyword of at least one flow table from the first memory, and determine a flow table matching the packet to be forwarded by comparing the fourth hash value with the second hash value of the keyword of the at least one flow table; wherein, an address for storing the second hash value in the first memory is determined according to a first hash value of the keyword of the flow table.
[0043] A second obtaining unit, configured to obtain a keyword of a flow table matching the packet to be forwarded from a second memory, wherein the second memory stores keywords and data of flow tables.
[0044] A forwarding unit, configured to, when the keyword of the flow table matches the keyword of the packet to be forwarded, perform a forwarding process on the packet to be forwarded according to the data of the flow table.
[0045] In some embodiments, the determining unit is specifically configured to:
[0046] Obtain an address of a corresponding bucket in the first memory according to the second hash value of the packet;
[0047] Compare the second hash value of the flow table stored in each slot of the bucket with the fourth hash value of the packet, and determine the flow table with the same hash value as the flow table matching the packet to be forwarded.
[0048] In some embodiments, the forwarding unit is specifically configured to:
[0049] Obtain identification information of a flow table matching the packet to be forwarded;
[0050] Obtain an address of a corresponding bucket in the second memory according to the identification information;
[0051] Obtain the keyword and data of the flow table stored in the bucket;
[0052] When the keyword of the flow table matches the keyword of the packet to be forwarded, perform a forwarding process on the packet to be forwarded according to the data of the flow table.
[0053] According to a fifth aspect of one or more embodiments of this specification, a computing device is provided, and the computing device includes:
[0054] A processor;
[0055] A memory for storing instructions executable by the processor;
[0056] Wherein, the processor runs the executable instructions to implement the operations performed by the flow table storage method or the packet forwarding method provided in any of the above embodiments.
[0057] According to a sixth aspect of one or more embodiments of the present specification, a computer-readable storage medium is provided, on which computer instructions are stored. When the instructions are executed by a processor, the operations performed by the flow table storage method or the packet forwarding method provided in any of the embodiments are implemented.
[0058] According to a seventh aspect of one or more embodiments of the present specification, a computer program product is provided, including a computer program. When the program is executed by a processor, the operations performed by the flow table storage method or the packet forwarding method provided in any of the embodiments are implemented.
[0059] In the present application, by obtaining a first hash value and a second hash value of a keyword of a flow table to be stored, and storing the second hash value of the flow table to be stored in a first memory according to the first hash value; and storing the keyword and data of the flow table to be stored in a second memory, more flow tables can be stored while ensuring that the bandwidth is satisfied, and since the address management of the flow table is separated from the data of the flow table, hash conflicts are reduced. Description of the Drawings
[0060] Figure 1 It is a schematic diagram of flow table storage in the related art provided by an exemplary embodiment.
[0061] Figure 2 It is a flowchart of a flow table storage method provided by an exemplary embodiment.
[0062] Figure 3 It is a flowchart of a flow table storage method provided by an exemplary embodiment.
[0063] Figure 4 It is a flowchart of a packet forwarding provided by an exemplary embodiment.
[0064] Figure 5 It is a block diagram of a flow table storage device provided by an exemplary embodiment.
[0065] Figure 6 It is a block diagram of a packet forwarding device provided by an exemplary embodiment.
[0066] Figure 7 It is a schematic structural diagram of a computing device provided by an exemplary embodiment. Detailed Embodiments
[0067] Exemplary embodiments will be described in detail herein, and examples thereof are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with one or more embodiments of this specification. On the contrary, they are merely examples of devices and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.
[0068] It should be noted that: In other embodiments, the steps of the corresponding method are not necessarily executed in the order shown and described in this specification. In some other embodiments, the steps included in the method may be more or less than those described in this specification. In addition, a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may also be combined into a single step for description in other embodiments.
[0069] In the related art, the method of storing or inserting a flow table usually combines the address and data of the flow merge. The following combines Figure 1 to describe the method of storing a flow table commonly used in the related art.
[0070] The current intelligent network card system usually uses two dynamic random access memories (DRAMs) to store flow tables. As Figure 1 shown, in this example, the memories DDR0 and DDR1 are used to store the flow table. The flow table to be stored can be sent by the management and control platform, and usually includes the flag information (ID, that is, Figure 1 the flow_id in) of the flow table, the keyword (key), and the data (value) of the flow table. First, extract the exact key from the information of the flow table to be stored sent by the management and control platform, and determine the storage address of the flow table based on the hash value of the keyword. In this example, the address pointed to by the hash value of the keyword is addr_3, so the ID, keyword, and data of the flow table are stored in the bucket at address addr_3.
[0071] In the above solution, assuming that each slot stores 64 bytes, two DRAMs can store at most 4 slots. And if the storage capacity of the flow table is expanded by increasing the memory, it will not only increase the burden on the hardware, but also more easily cause the problem of hash conflicts.
[0072] In view of this, the present application provides a flow table storage method, which can be executed by a computer device. The computer device can be a server, such as a single server, multiple servers, a cloud computing platform, etc. Optionally, the computer device can also be other types of devices. The present application does not limit the device type of the computer device. The implementation manners of the present application are introduced below.
[0073] See Figure 2 , Figure 2 which is a flowchart of a flow table storage method provided by an exemplary embodiment. The method includes:
[0074] Step 201, obtain the keyword and data of the flow table to be stored.
[0075] Among them, the flow table to be stored can be sent by a management and control platform. The information sent by the management and control platform can include the keyword and data of the flow table to be stored, etc.
[0076] Step 202, obtain the first hash value and the second hash value of the keyword.
[0077] In one example, the keyword of the flow table to be stored can be processed by using hash function a to obtain the first hash value. This process can be expressed as hasha(key1), where key1 represents the keyword of the flow table to be stored, and hasha represents hash function a; at the same time, the keyword of the flow table to be stored can be processed by using hash function b to obtain the second hash value. This process can be expressed as hashb(key1), where key1 represents the keyword of the flow table to be stored, and hashb represents hash function b.
[0078] Step 203, store the second hash value of the flow table to be stored in the first memory according to the first hash value.
[0079] In this step, the second hash value of the flow table to be stored can be stored at the corresponding position of the first memory according to the address information indicated by the first hash value.
[0080] Step 204, store the keyword and data of the flow table to be stored in the second memory.
[0081] In an embodiment of the present disclosure, the address in the first memory indicated by the first hash value of the keyword of the flow table to be stored is used to store the second hash value of the keyword, while the keyword and data of the flow table to be stored are stored in the second memory. By associating the second hash value stored in the first memory with the address in the second memory used to store the keyword and data, the flow table information items stored in the first memory and the second memory can be jointly used to process the packet. Since the data stored in the address indicated by the first hash value is the second hash value, compared with storing the keyword and data, the amount of data stored in the address corresponding to the first hash value is reduced. On the one hand, more flow tables can be stored, and on the other hand, when the flow table is used for packet forwarding, a matching with the hash value can be added once, so the probability of hash conflict can be reduced.
[0082] This application obtains the first hash value and the second hash value of the keyword of the flow table to be stored, and according to the first hash value, stores the second hash value of the flow table to be stored in the first memory; according to the keyword and data of the flow table to be stored are stored in the second memory, more flow tables can be stored while ensuring that the bandwidth is satisfied, and since the address management of the flow table is separated from the data of the flow table, hash conflicts are reduced.
[0083] The above is an introduction to the basic implementation process of this application. Next, multiple optional implementation manners of this application will be introduced.
[0084] In an example, the flow table to be stored has identification information (ID), and according to this identification information, the flow table entries stored in the first memory can be associated with the flow table entries stored in the second memory.
[0085] Specifically, according to the first hash value, the address of the bucket corresponding to the flow table to be stored in the first memory can be obtained; the identification information and the second hash value of the flow table to be stored are stored in the slot of the bucket.
[0086] See Figure 3 The schematic diagram of the flow table storage shown. As Figure 3 shown, according to the first hash value hasha(key), it is determined that the address corresponding to the flow table to be stored in the first memory DDR0 is addr_3, that is, the bucket with the address addr_3. Each bucket in the first memory has several slots, and the ID (flow_id) and the second hash value hashb(key) of the flow table to be stored can be stored in the idle slot of the bucket with the address addr_3. Since the data volume of the ID of the flow table to be stored and hashb(key) is smaller than the keyword and data, more slots can be set in the bucket of addr_3 to store the flow table entries, thereby increasing the storage quantity of the flow table. TakeFigure 3 For example, when the ID of the flow table to be stored and the data volume of hashb(key) are 56 bits, each address (each bucket) of DDR0 can store 9 slots. Compared with the same configuration in the related art, the embodiments of the present disclosure improve the storage capacity of the flow table on the premise of ensuring the bandwidth.
[0087] When the flow table to be stored has identification information (ID), the keyword and data of the flow table can be stored by the following method: according to the identification information of the flow table to be stored, obtain the address of the corresponding bucket of the flow table to be stored in the second memory, and store the keyword and data of the flow table to be stored in the slot of the bucket.
[0088] See Figure 3 the schematic diagram of the flow table storage shown. As Figure 3 shown, according to the ID (flow_id) of the flow table to be stored, obtain the address of the bucket to be stored in the second memory of the flow table. Taking the ID of the flow table to be stored as m-6 as an example, according to the address of the bucket to be stored in the second memory indicated by this ID is flow_id_m-6, and store the keyword and data of the flow table to be stored in the slot of the bucket with the address of flow_id_m-6.
[0089] In the embodiments of the present disclosure, by using the identification information of the flow table to be stored, the storage position of the flow table to be stored in the first memory is associated with the storage position of the flow table in the second memory, which can separate the address management and data storage of the flow table and realize the normal processing of packets in the case of reducing hash conflicts.
[0090] The present application also provides a packet forwarding method, which processes the received packet based on the flow table stored by the flow table storage method proposed in the embodiments of the present disclosure. The above method can be applied to a packet forwarding device, and the packet forwarding device can be, for example, a computer device, such as a server, multiple servers, a cloud computing platform, etc. Optionally, the computer device can also be other types of devices, and the present application does not limit the device type of the computer device. The embodiments of the present application will be introduced below.
[0091] See Figure 4 , Figure 4 is a flowchart of a packet forwarding method provided by an exemplary embodiment, and the method includes:
[0092] Step 401, obtain the keyword of the packet to be forwarded, and obtain the third hash value and the fourth hash value of the keyword.
[0093] In response to receiving a packet, the packet forwarding device first obtains the keyword of the packet and obtains the third hash value and the fourth hash value of the keyword.
[0094] In one example, the hash function a can be used to process the keyword of the message to obtain a third hash value, and this process can be expressed as hasha(key_m), where key_m represents the keyword of the message, and hasha represents the hash function a; meanwhile, the hash function b can be used to process the keyword of the message to obtain a fourth hash value, and this process can be expressed as hashb(key_m), where hashb represents the hash function b.
[0095] Step 402: According to the third hash value, obtain the second hash value of the keyword of at least one flow table from the first memory, and determine the flow table that matches the message to be forwarded by comparing the fourth hash value with the second hash value of the keyword of at least one flow table.
[0096] Among them, the address storing the second hash value in the first memory is determined according to the first hash value of the keyword of the flow table.
[0097] In the embodiments of the present disclosure, the same hash processing is adopted for the keyword of the flow table and the keyword of the message. That is, the first hash value and the second hash value of the keyword of the flow table are also obtained by using the hash function a and the hash function b to process the keyword of the flow table respectively.
[0098] After obtaining the third hash value of the keyword of the message to be forwarded, determine the address pointed to by the third hash value in the first memory, so as to obtain at least one flow table entry stored in this address, that is, the second hash value of the keyword of at least one flow table. By comparing the fourth hash value of the keyword of the message to be forwarded with the second hash value of the keyword of at least one flow table, the flow table with the same fourth hash value is determined as the matching flow table.
[0099] Step 403: Obtain the keyword of the flow table that matches the message to be forwarded from the second memory, where the second memory stores the keyword and data of the flow table.
[0100] Step 404: When the keyword of the flow table matches the keyword of the message to be forwarded, perform forwarding processing on the message to be forwarded according to the data of the flow table.
[0101] After obtaining the keyword of the matching flow table, compare the keyword of the flow table with the keyword of the message to be forwarded. When the keyword of the flow table is the same as the keyword of the message to be forwarded, confirm the match, then read the data of the matching flow table, and perform forwarding processing on the message according to the action indicated by the data.
[0102] In the embodiments of the present disclosure, for the packet to be forwarded, first, the address pointed to in the first memory is determined according to the third hash value of the keyword of the packet, the second hash value of the keyword of at least one flow table stored in the address is read, and the matching flow table is determined according to the matching result between the fourth hash value of the packet and the second hash value of each flow table; then, the keyword of the matched flow table is read in the second memory, and when the keyword of the flow table matches the keyword of the packet, the data of the matched flow table is read to perform forwarding processing on the packet. By adding the matching between the second hash value of the flow table and the fourth hash value of the packet, the probability of hash collision is reduced, and the quality of packet forwarding is improved.
[0103] The above is an introduction to the basic implementation process of packet forwarding in this application. Next, multiple optional implementation manners of this application will be introduced.
[0104] In one example, the flow table matching the packet to be forwarded is determined according to the following method: According to the second hash value of the packet, the address of the corresponding bucket in the first memory is obtained; the second hash value of the flow table stored in each slot of the bucket is compared with the fourth hash value of the packet, and the flow table with the same hash value is determined as the flow table matching the packet to be forwarded.
[0105] In one example, the identification information of the flow table is further stored in each slot of the bucket; obtaining the keyword of the flow table from the second memory includes: obtaining the identification information of the flow table matching the packet to be forwarded; according to the identification information, obtaining the address of the corresponding bucket in the second memory; obtaining the keyword and data of the flow table stored in the bucket; when the keyword of the flow table matches the keyword of the packet to be forwarded, performing forwarding processing on the packet to be forwarded according to the data of the flow table.
[0106] Next, taking the packet forwarding device using the Figure 3 flow table storage method shown for storage to perform packet forwarding as an example, the packet forwarding method proposed in this application will be described in detail.
[0107] As Figure 3 shown, each bucket corresponding to each address of the first memory DDR0 has several slots, and the ID (flow_id) of the flow table and the second hash value hashb(key) of the keyword key of the flow table are stored in each slot, and each address of the flow table corresponds to the first hash value hasha(key) of the keyword key of the flow table. Each address of the second memory DDR1 corresponds to the ID of the flow table, and the keyword key and data value of the flow table are stored in the bucket corresponding to each address.
[0108] When receiving a packet to be forwarded and obtaining the texture information key_m of the packet, first obtain the third hash value hasha(key_m) and the fourth hash value hashb(key_m) of the texture information key_m.
[0109] Next, determine the address of the corresponding bucket in the first memory DDR0 according to the third hash value hasha(key_m). For example, if the address is addr_3, then extract the second hash value hashb(key) of each flow table stored in the bucket corresponding to addr_3. And compare the fourth hash value hashb(key_m) of the packet to be forwarded with the second hash values hashb(key) of the above-mentioned flow tables, and use the flow table with the same hash value as the flow table matching the packet to be forwarded.
[0110] After determining the matching flow table, the ID of the flow table can be obtained, and the flow table entry stored in the second memory DDR1 can be obtained using this ID. Taking the flow table ID matching the packet to be forwarded as m-6 as an example, determine the corresponding address in the second memory DDR1 corresponding to this flow table ID as flow_id_m-6, and obtain the keyword and data of the flow table with ID m-6 stored in the bucket at this address. Compare the keyword of the packet to be forwarded with the keyword of the flow table with ID m-6 obtained. In the case where the keywords are the same, that is, they match, perform corresponding forwarding processing on the packet to be forwarded according to the data corresponding to the keyword.
[0111] See Figure 5 , Figure 5 FIG. is a block diagram of a flow table storage device provided by an exemplary embodiment. The device includes:
[0112] A first acquisition unit 501, configured to acquire the keyword and data of the flow table to be stored;
[0113] A second acquisition unit 502, configured to acquire the first hash value and the second hash value of the keyword;
[0114] A first storage unit 503, configured to store the second hash value of the flow table to be stored in the first memory according to the first hash value;
[0115] A second storage unit 504, configured to store the keyword and data of the flow table to be stored in the second memory.
[0116] In some embodiments, the flow table to be stored has identification information, and the first storage unit is specifically configured to:
[0117] Obtain the address of the corresponding bucket of the flow table to be stored in the first memory according to the first hash value;
[0118] Store the identification information of the flow table to be stored and the second hash value in the slot of the bucket.
[0119] In some embodiments, the second storage unit is specifically configured to:
[0120] Obtain the address of the bucket corresponding to the flow table to be stored in the second memory according to the identification information of the flow table to be stored;
[0121] Store the keyword and data of the flow table to be stored in the slot of the bucket.
[0122] See Figure 6 , Figure 6 is a block diagram of a packet forwarding device provided by an exemplary embodiment. The device includes:
[0123] A first acquisition unit 601, configured to acquire the keyword of the packet to be forwarded, and acquire the third hash value and the fourth hash value of the keyword;
[0124] A determination unit 602, configured to acquire, according to the third hash value, the second hash value of the keyword of at least one flow table from the first memory, and determine the flow table matching the packet to be forwarded by comparing the fourth hash value with the second hash value of the keyword of the at least one flow table; wherein, the address storing the second hash value in the first memory is determined according to the first hash value of the keyword of the flow table;
[0125] A second acquisition unit 603, configured to acquire the keyword of the flow table matching the packet to be forwarded from the second memory, where the second memory stores the keyword and data of the flow table;
[0126] A forwarding unit 604, configured to, when the keyword of the flow table matches the keyword of the packet to be forwarded, perform a forwarding process on the packet to be forwarded according to the data of the flow table.
[0127] In some embodiments, the determination unit is specifically configured to:
[0128] Obtain the address of the corresponding bucket in the first memory according to the second hash value of the packet;
[0129] Compare the second hash value of the flow table stored in each slot of the bucket with the fourth hash value of the packet, and determine the flow table with the same hash value as the flow table matching the packet to be forwarded.
[0130] In some embodiments, the forwarding unit is specifically configured to:
[0131] Acquire the identification information of the flow table matching the packet to be forwarded;
[0132] Obtain the address of the corresponding bucket in the second memory according to the identification information;
[0133] Obtain the key and data of the flow table stored in the bucket;
[0134] When the key of the flow table matches the key of the packet to be forwarded, perform forwarding processing on the packet to be forwarded according to the data of the flow table.
[0135] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can be referred to the partial descriptions of the method embodiments. The device embodiments described above are only illustrative. The units described as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network modules. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution in this specification. Those of ordinary skill in the art can understand and implement it without creative efforts.
[0136] This application also provides a computing device. Refer to Figure 7 , Figure 7 which is a schematic structural diagram of a computing device provided by an exemplary embodiment. Please refer to Figure 7 , at the hardware level, the device includes a processor 702, an internal bus 704, a network interface 706, a memory 708, and a non-volatile memory 710. Of course, it may also include other hardware required to implement other functions. One or more embodiments of this specification can be implemented in a software manner. For example, the processor 702 reads the corresponding computer program from the non-volatile memory 710 into the memory 708 and then runs it. Of course, in addition to the software implementation, one or more embodiments of this specification do not exclude other implementation manners, such as logic devices or a combination of software and hardware. That is, the execution subject of the following processing flow is not limited to each logic unit, and can also be hardware or logic devices.
[0137] This application also provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the data transmission method provided by any embodiment of this application.
[0138] The systems, devices, modules or units illustrated in the above embodiments may be specifically implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, and the specific form of the computer may be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email receiving and sending device, a game console, a tablet computer, a wearable device, or a combination of any several of these devices.
[0139] In a typical configuration, a computer includes one or more processors (Central Processing Unit, CPU), an input / output interface, a network interface, and a memory.
[0140] The memory may include non-permanent memory in the computer-readable medium, in the form of random access memory (Random Access Memory, RAM) and / or non-volatile memory, such as read-only memory (Read-Only Memory, ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0141] The computer-readable medium includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. The information may be computer-readable instructions, data structures, program modules, or other data. Examples of the storage media of a computer include, but are not limited to, phase-change random access memory (Phase-change Random Access Memory, PRAM), static random access memory (Static Random-Access Memory, SRAM), dynamic random access memory (Dynamic Random Access Memory, DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read Only Memory, EEPROM), flash memory or other memory technologies, compact disc read-only memory (Compact Disc Read Only Memory, CD-ROM), digital versatile disc (Digital Video Disc, DVD) or other optical storage, magnetic cassette tapes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices, or any other non-transmission media that can be used to store information accessible by a computing device. As defined herein, computer-readable media do not include transitory computer-readable media, such as modulated data signals and carrier waves.
[0142] It should also be noted that the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, commodity or device comprising a series of elements not only includes those elements but also includes other elements not expressly listed, or elements inherent to such process, method, commodity or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, commodity or device comprising said element.
[0143] The specific embodiments of this specification have been described above. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve the desired result. Additionally, the processes depicted in the figures do not necessarily require the particular order or sequential order shown to achieve the desired result. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0144] The terms used in one or more embodiments of this specification are for the purpose of describing specific embodiments only and are not intended to limit one or more embodiments of this specification. The singular forms "a", "the" and "said" used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly dictates otherwise. It should also be understood that the term "and / or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
[0145] It should be understood that although the terms first, second, third, etc. may be used in one or more embodiments of this specification to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of one or more embodiments of this specification, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "when" or "upon" or "in response to determining".
[0146] The above description is only the preferred embodiments of one or more embodiments of this specification and is not intended to limit one or more embodiments of this specification. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of one or more embodiments of this specification shall be included within the scope of protection of one or more embodiments of this specification.
Claims
1. A flow table storage method, characterized in that, The method includes: Obtaining the keyword and data of the flow table to be stored; Obtaining a first hash value and a second hash value of the keyword; According to the first hash value, storing the second hash value of the flow table to be stored and the identification information therein in a first memory, where the second hash value is used to determine the flow table matched by the packet to be forwarded; Storing the keyword and data of the flow table to be stored in a second memory, including: Obtaining the address of the bucket corresponding to the flow table to be stored in the second memory according to the identification information of the flow table to be stored; Storing the keyword and data of the flow table to be stored in the slot of the bucket.
2. The method according to claim 1, characterized in that, The storing the second hash value of the flow table to be stored and the identification information therein in the first memory according to the first hash value includes: Obtaining the address of the bucket corresponding to the flow table to be stored in the first memory according to the first hash value; Storing the identification information of the flow table to be stored and the second hash value in the slot of the bucket.
3. A message forwarding method, characterized in that, The method includes: Obtaining the keyword of the packet to be forwarded, and obtaining a third hash value and a fourth hash value of the keyword; According to the third hash value, obtaining the second hash value of the keyword of at least one flow table from the first memory, and determining the flow table matched by the packet to be forwarded by comparing the fourth hash value with the second hash value of the keyword of the at least one flow table; wherein, the address of the identification information and the second hash value of the flow table stored in the first memory is determined according to the first hash value of the keyword of the flow table; Obtaining the keyword of the flow table matched by the packet to be forwarded from the second memory, where the second memory stores the keyword and data of the flow table; In the case where the keyword of the flow table matches the keyword of the packet to be forwarded, performing forwarding processing on the packet to be forwarded according to the data of the flow table; The obtaining the keyword of the flow table matched by the packet to be forwarded from the second memory includes: Obtaining the identification information of the flow table matched by the packet to be forwarded; According to the identification information, obtaining the address of the corresponding bucket in the second memory; Obtaining the keyword and data of the flow table stored in the bucket.
4. The method according to claim 3, wherein The determining the flow table matched by the packet by comparing the fourth hash value of the keyword of the packet with the second hash value of the keyword of the at least one flow table includes: Obtaining the address of the corresponding bucket in the first memory according to the second hash value of the packet; Comparing the second hash value of the flow table stored in each slot of the bucket with the fourth hash value of the packet, and determining the flow table with the same hash value as the flow table matched by the packet to be forwarded.
5. The method according to claim 4, wherein The identification information of the flow table is further stored in each slot of the bucket.
6. A flow table storage device, characterized in that, The apparatus includes: A first obtaining unit, configured to obtain the keyword and data of the flow table to be stored; A second obtaining unit, configured to obtain a first hash value and a second hash value of the keyword; A first storage unit, configured to store, according to the first hash value, the second hash value of the flow table to be stored and the identification information thereof in a first memory, where the second hash value is used to determine a flow table matched by a packet to be forwarded; A second storage unit, configured to store the key and data of the flow table to be stored in a second memory, including: obtaining an address of a bucket corresponding to the flow table to be stored in the second memory according to the identification information of the flow table to be stored; storing the key and data of the flow table to be stored in a slot of the bucket.
7. A message forwarding device, characterized in that, The apparatus includes: A first obtaining unit, configured to obtain a key of a packet to be forwarded, and obtain a third hash value and a fourth hash value of the key; A determining unit, configured to obtain, according to the third hash value, second hash values of keys of at least one flow table from a first memory, and determine a flow table matched by the packet to be forwarded by comparing the fourth hash value with the second hash values of the keys of the at least one flow table; where an address of the identification information and the second hash value of the flow table stored in the first memory is determined according to a first hash value of the key of the flow table; A second obtaining unit, configured to obtain a key of a flow table matched by the packet to be forwarded from a second memory, where the second memory stores keys and data of flow tables; The obtaining the key of the flow table matched by the packet to be forwarded from the second memory includes: obtaining identification information of a flow table matched by the packet to be forwarded; obtaining an address of a corresponding bucket in the second memory according to the identification information; obtaining keys and data of the flow table stored in the bucket; A forwarding unit, configured to, when the key of the flow table matches the key of the packet to be forwarded, perform a forwarding process on the packet to be forwarded according to the data of the flow table.
8. A computing device, characterized in that, including: a processor; a memory for storing processor-executable instructions; wherein, the processor runs the executable instructions to implement the method according to any one of claims 1 to 2 or any one of claims 3 to 5.
9. A computer-readable storage medium having computer instructions stored thereon, characterized in that, When the instruction is executed by the processor, the method according to any one of claims 1 to 2 or any one of claims 3 to 5 is implemented.
Citation Information
Patent Citations
Packet forwarding method and equipment
CN101247337A
Data packet processing method based on flow table, device and network system
CN101572670A