Flow table unloading method, device, electronic device and readable storage medium
By using the flow table pointer in computer equipment to obtain the flow table hit information and offload it to the smart network card hardware module, the problem of the flow table unloading method occupies a large amount of memory, achieving more efficient memory usage and reducing memory costs.
Patent Information
- Application Number
- CN202211733558.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-30
- Publication Date
- 2024-11-26
- Estimated Expiration
- 2042-12-30
AI Technical Summary
Existing flow table unloading methods take up a lot of memory, resulting in high memory costs.
By setting up a flow table cache area in a computer device, using the flow table pointer to obtain hit information based on the memory address of the target flow table, and offloading the specified flow table to the smart network card hardware module to reduce memory usage.
Reduces memory costs, improves the efficiency of flow table offloading, and reduces memory usage.
Smart Images

Figure CN116192740B_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of information technology, and in particular, relates to a flow table unloading method, device, electronic device and readable storage medium. Background Art
[0002] The virtual switch-data plane forwarding tool (Open VSwitch-Data Plane Development Kit, OVS-DPDK) matches messages through three levels of flow tables: Exact Match Classifier (EMC), Data Path Classifier (DPCLS) flow table, and Online Communication Protocol Database Flow Table (Ofproto Classifier, OFPROTO), and sends the flow table to the hardware of the smart network card, that is, unloading the flow table. Accordingly, the table lookup forwarding function can be performed by the hardware of the smart network card.
[0003] In the prior art, the hit information generated when OVS-DPDK queries the DPCLS flow table is cached through the intermediate cache layer of the virtual switch and the smart network card hardware. After the three-level flow table query is completed, OVS-DPDK sends the message flow table record generated by the table query to the unloading thread, and the unloading thread performs flow table unloading according to the message flow table record and the hit information generated when querying the DPCLS flow table.
[0004] However, due to the limited memory resources of computer devices, each time a message hits the DPCLS flow table, the hit information will be cached. The number of bytes of each hit information is large, so the method of caching the hit information generated when OVS-DPDK queries the DPCLS flow table for flow table unloading requires a large amount of memory, resulting in a high memory cost problem. Summary of the invention
[0005] The present application provides a flow table unloading method, device, electronic device and readable storage medium to solve the technical problem that the existing flow table unloading method needs to occupy a large amount of memory and has high memory cost.
[0006] In order to solve the above technical problems, this application is implemented as follows:
[0007] In a first aspect, the present application provides a flow table unloading method, which is applied to a computer device deployed with a virtual switch and an unloading thread, wherein a flow table cache area is provided in the computer device; the method comprises:
[0008] The target flow table is looked up by the virtual switch to obtain hit information of the target flow table; the hit information is stored in a specified location, and the specified location is determined according to the memory address of the target flow table;
[0009] Obtaining the hit information of the target flow table according to the predefined flow table pointer in the flow table cache area through the offloading thread; the flow table pointer is used to point to the target flow table, and the flow table pointer is set based on the memory address of the target flow table;
[0010] The designated flow table is generated according to the hit information of the target flow table by the offloading thread, and the designated flow table is offloaded to the hardware module of the intelligent network card.
[0011] Optionally, the virtual switch further includes a message queue, and the message queue is used to transmit data between the virtual switch and the flow table cache area; the obtaining the hit information of the target flow table according to the predefined flow table pointer in the flow table cache area by the offload thread includes:
[0012] Acquire a target address of the target flow table in the virtual switch according to the flow table pointer;
[0013] The hit information of the target flow table is obtained based on the message queue and the target address through the offloading thread, and the hit information is stored in the flow table cache area.
[0014] Optionally, the flow table pointer is obtained in the following manner:
[0015] Acquire a memory address of the target flow table based on the message queue;
[0016] A flow table pointer corresponding to the target flow table is generated according to the memory address of the target flow table, and the flow table pointer is stored in the flow table buffer area.
[0017] Optionally, the computer device is further provided with a merged flow table; the hit information of the target flow table includes hit information corresponding to multiple table lookups; and the generating of the designated flow table according to the hit information of the target flow table by the offloading thread includes:
[0018] Obtaining, by the offloading thread, hit information corresponding to multiple table lookups of the target flow table from the flow table cache area based on the merged flow table;
[0019] Based on the merged flow table, merging the hit information corresponding to the multiple table lookups of the target flow table to obtain the merged information corresponding to the target flow table;
[0020] A designated flow table is generated according to the merge information.
[0021] Optionally, after the offloading thread obtains the hit information of the target flow table according to the flow table pointer predefined in the flow table cache area, the method further includes:
[0022] Identify the hit data in the target flow table according to the flow table pointer and the hit information;
[0023] The predefined statistical parameters in the flow table buffer are updated according to the identified data in the target flow table.
[0024] Optionally, the virtual switch further includes a statistical thread, and the method further includes:
[0025] When a preset condition is met, the statistical parameters in the flow table cache are obtained through the statistical thread, so that the statistical thread can record the usage of the target flow table.
[0026] Optionally, the target flow table is a flow table of a fuzzy matching type, and the hit information of the target flow table is fuzzy matching information; and generating a designated flow table according to the hit information of the target flow table by the offloading thread includes:
[0027] Determining accurate matching information according to the hit information of the target flow table and preset conversion information by the offloading thread;
[0028] A designated flow table is generated according to the exact matching information, so that the designated flow table is a flow table of an exact matching type.
[0029] In a second aspect, the present application provides a flow table unloading device, which is applied to a computer device deployed with a virtual switch and an unloading thread, wherein a flow table cache area is provided in the computer device; the device comprises:
[0030] A table lookup module, used to look up the target flow table through the virtual switch to obtain hit information of the target flow table; the hit information is stored in a specified location, and the specified location is determined according to the memory address of the target flow table;
[0031] An acquisition module, used to acquire the hit information of the target flow table according to a flow table pointer predefined in the flow table cache area through the unloading thread; the flow table pointer is used to point to the target flow table, and the flow table pointer is set based on the memory address of the target flow table;
[0032] An execution module is used to generate a designated flow table according to the hit information of the target flow table through the unloading thread, and unload the designated flow table to the hardware module of the smart network card.
[0033] Optionally, the virtual switch further includes a message queue, and the message queue is used to transmit data between the virtual switch and the flow table buffer area; the acquisition module is specifically used to:
[0034] Acquire a target address of the target flow table in the virtual switch according to the flow table pointer;
[0035] The hit information of the target flow table is obtained based on the message queue and the target address through the offloading thread, and the hit information is stored in the flow table cache area.
[0036] Optionally, the flow table pointer is obtained in the following manner:
[0037] Acquire a memory address of the target flow table based on the message queue;
[0038] A flow table pointer corresponding to the target flow table is generated according to the memory address of the target flow table, and the flow table pointer is stored in the flow table buffer area.
[0039] Optionally, the computer device is further provided with a merged flow table; the hit information of the target flow table includes hit information corresponding to multiple table lookups; and the execution module is specifically used for:
[0040] Obtaining, by the offloading thread, hit information corresponding to multiple table lookups of the target flow table from the flow table cache area based on the merged flow table;
[0041] Based on the merged flow table, merging the hit information corresponding to the multiple table lookups of the target flow table to obtain the merged information corresponding to the target flow table;
[0042] A designated flow table is generated according to the merge information.
[0043] Optionally, the device further comprises:
[0044] an identification module, used for, after the acquisition module obtains the hit information of the target flow table through the unloading thread according to the flow table pointer predefined in the flow table cache area, to identify the hit data in the target flow table according to the flow table pointer and the hit information;
[0045] An updating module is used to update the predefined statistical parameters in the flow table buffer area according to the data identified in the target flow table.
[0046] Optionally, the virtual switch further includes a statistical thread, and the device further includes:
[0047] The statistics module is used to obtain the statistical parameters in the flow table cache area through the statistics thread when a preset condition is met, so that the statistics thread can record the usage of the target flow table.
[0048] Optionally, the target flow table is a flow table of a fuzzy matching type, and the hit information of the target flow table is fuzzy matching information; and the execution module is specifically used to:
[0049] Determining accurate matching information according to the fuzzy matching information and preset conversion information through the uninstall thread;
[0050] A designated flow table is generated according to the exact matching information, so that the designated flow table is a flow table of an exact matching type.
[0051] In a third aspect, the present application provides an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned flow table unloading method when executing the program.
[0052] In a fourth aspect, the present application provides a readable storage medium, when the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the above-mentioned flow table unloading method.
[0053] In an embodiment of the present application, the target flow table is looked up by the virtual switch to obtain the hit information of the target flow table; the hit information of the target flow table is obtained by the unloading thread according to the pre-defined flow table pointer in the flow table cache area; the designated flow table is generated by the unloading thread according to the hit information of the target flow table, and the designated flow table is unloaded to the hardware module of the smart network card. In this way, since the flow table pointer is set based on the memory address of the target flow table, and the designated location for storing the hit information is also determined according to the memory address of the target flow table, the hit information of the target flow table can be easily obtained according to the pre-defined flow table pointer in the flow table cache area. Compared with the method of unloading the flow table by caching the hit information generated when the OVS-DPDK looks up the DPCLS flow table in the prior art, since the flow table pointer occupies less memory, the flow table unloading method of the embodiment of the present application can reduce memory costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0055] Figure 1 It is a flowchart of a flow table unloading method provided by an embodiment of the present application;
[0056] Figure 2 It is a schematic diagram of the process of virtual switch table lookup in the prior art;
[0057] Figure 3 It is a schematic diagram of an application scenario of the flow table unloading method provided in an embodiment of the present application;
[0058] Figure 4 is a structural diagram of a flow table unloading device provided in an embodiment of the present application;
[0059] Figure 5 It is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0060] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0061] Figure 1 is a flow chart of a flow table unloading method provided by an embodiment of the present application, such as Figure 1 As shown, the flow table unloading method is applied to a computer device deployed with a virtual switch and an unloading thread, and a flow table cache area is set in the computer device; the method may include:
[0062] Step 101, querying the target flow table through the virtual switch to obtain hit information of the target flow table; the hit information is stored in a specified location, and the specified location is determined according to the memory address of the target flow table.
[0063] In an embodiment of the present application, the computer device may be a server, which includes a virtual switch, an offload thread, and a flow table cache. Among them, the virtual switch is a network platform with the function of a physical switch simulated by software, which provides network connections for virtual machines, device hosts, and external networks. The offload thread is used to control the data transmission between the virtual switch and the smart network card, and between the virtual switch and the flow table cache. The flow table cache is a memory area in the computer device, which serves as an intermediate cache layer between the virtual switch and the smart network card, and is used to cache relevant flow table data during the flow table offloading process. For example, the virtual switch can be a virtual switch-data plane forwarding tool OVS-DPDK, which is only used as an example here, and the embodiment of the present application does not limit this.
[0064] In the embodiment of the present application, the flow table contains the configuration information of each level of the network. After receiving the message, the virtual switch looks up the flow table according to the data in the message to obtain the network configuration information that matches the message data, that is, the hit information of the flow table, such as the Internet Protocol Address (IP address), the Media Access Control Address (MAC address), etc.
[0065] In an embodiment of the present application, the target flow table may be a DPCLS flow table, which is a fuzzy matching type of flow table. When OVS-DPDK searches the DPCLS table, a flow table hit will generate matching information and execution action information. The matching information includes field information of the flow, such as IP address, MAC address, network protocol, etc., mask information, etc. The execution action information includes actions that need to be performed after the flow table hits, such as packet forwarding.
[0066] In an embodiment of the present application, the hit information of the target flow table can be stored in a specified location, and the specified location is determined according to the memory address of the target flow table. Specifically, the memory address of the target flow table can be a memory address of a portion of the memory in the memory area of the computer device corresponding to the virtual switch. The specified location can be the same memory area as the memory corresponding to the target flow table, or it can be a memory that establishes an address mapping with the memory of the target flow table. The address mapping memory can be set in the memory area corresponding to the virtual switch, and the embodiment of the present application does not limit this.
[0067] Step 102, obtaining the hit information of the target flow table according to the predefined flow table pointer in the flow table cache area through the unloading thread; the flow table pointer is used to point to the target flow table, and the flow table pointer is set based on the memory address of the target flow table.
[0068] In the embodiment of the present application, the pointer is a memory address. The pointer is used to describe the location of data in the memory. The pointer stores the first address of the object it points to. The object pointed to can be an entity occupying storage space such as a variable, array, or function. The object pointed to by the flow table pointer is the target flow table, and what is stored is the first address of the target flow table in the memory. The flow table pointer can be generated according to the memory address of the target flow table and stored in the flow table buffer.
[0069] In an embodiment of the present application, the memory address of the target flow table can be obtained according to the flow table pointer pre-defined in the flow table cache area. The unloading thread can find the designated location where the hit information of the target flow table is stored according to the memory address of the target flow table, and then obtain the hit information of the target flow table stored in the designated location.
[0070] Step 103: Generate a designated flow table according to the hit information of the target flow table through the offload thread, and offload the designated flow table to the hardware module of the smart network card.
[0071] In an embodiment of the present application, the specified flow table may be a flow table that matches the flow table format supported by the hardware module of the smart network card, wherein the flow table format may include an exact match type or a fuzzy match type, as well as a register storage method, etc.
[0072] It should be noted that the hardware flow table of the smart network card does not have the multi-level configuration of the software flow table. The hardware flow table is generally flat, and the hardware flow table is full-keyword matching when looking up the table, so there is no need to jump the table when looking up the table like the software flow table. Among them, the virtual switch looks up the three-level software flow table, so there may be operations such as jumping the table and multiple circular table lookups during the table lookup process.
[0073] In the embodiment of the present application, the virtual switch-data plane forwarding tool OVS-DPDK matches messages through three levels of flow tables: Exact Match Classifier (EMC), Data Path Classifier (DPCLS) flow table, and online communication protocol database flow table (Ofproto Classifier, OFPROTO). For any message received by the virtual switch, the virtual switch may obtain hit information of one or more flow tables in the EMC flow table, DPCLS flow table, and OFPROTO flow table during the process of looking up the three-level flow table. After the table lookup is completed, the virtual switch will send the hit information generated when looking up the EMC flow table and OFPROTO flow table to the unloading thread.
[0074] In an embodiment of the present application, a designated flow table that uniquely matches the message received by the virtual switch can be generated by an unloading thread according to the hit information of the target flow table, such as the DPCLS flow table, and the hit information of the EMC flow table and the OFPROTO flow table. A hardware data interface corresponding to the data plane forwarding tool (Data Plane Development Kit, DPDK) is also included between the unloading thread and the hardware module of the smart network card. The designated flow table can be sent to the hardware module of the smart network card based on the hardware data interface of the DPDK by the unloading thread to realize the unloading of the designated flow table to the smart network card.
[0075] In an embodiment of the present application, the target flow table is looked up through a virtual switch to obtain the hit information of the target flow table; the hit information of the target flow table is obtained through an unloading thread according to a pre-defined flow table pointer in a flow table cache area; a designated flow table is generated according to the hit information of the target flow table through an unloading thread, and the designated flow table is unloaded to the hardware module of the smart network card. In this way, since the flow table pointer is set based on the memory address of the target flow table, and the designated location where the hit information is stored is determined according to the memory address of the target flow table, the hit information of the target flow table can be easily obtained according to the pre-defined flow table pointer in the flow table cache area. Compared with the method of unloading the flow table by caching the hit information generated when OVS-DPDK looks up the DPCLS flow table in the prior art, since the flow table pointer occupies less memory, the flow table unloading method of the embodiment of the present application can reduce memory costs.
[0076] Optionally, the virtual switch further includes a message queue, and the message queue is used to transmit data between the virtual switch and the flow table buffer area; step 102 may include the following steps:
[0077] Step 1021: Obtain a target address of the target flow table in the virtual switch according to the flow table pointer.
[0078] In the embodiment of the present application, the object pointed to by the flow table pointer is the target flow table, and what is stored is the first address of the target flow table in the memory. The flow table pointer is generated according to the memory address of the target flow table and is stored in the flow table buffer area. Further, the memory address of the target flow table stored in the flow table pointer can be obtained according to the flow table pointer predefined in the flow table buffer area, and the memory address of the target flow table is used as the target address.
[0079] Step 1022: Obtain hit information of the target flow table based on the message queue and the target address through the offload thread, and store the hit information in the flow table cache area.
[0080] In an embodiment of the present application, the unloading thread can find the designated location where the hit information of the target flow table is stored according to the target address, and then obtain the hit information of the target flow table stored at the designated location based on the message queue, and then store the hit information in the flow table cache area.
[0081] In the embodiment of the present application, the target address of the target flow table in the virtual switch can be easily obtained according to the flow table pointer; by unloading the thread, the hit information of the target flow table can be easily obtained based on the message queue and the target address.
[0082] Optionally, the flow table pointer is obtained in the following manner:
[0083] Step 201: Obtain the memory address of the target flow table based on the message queue.
[0084] Step 202: Generate a flow table pointer corresponding to the target flow table according to the memory address of the target flow table, and store the flow table pointer in the flow table buffer area.
[0085] In the embodiment of the present application, the storage location of the memory area corresponding to the target flow table in the virtual switch, that is, the memory address of the target flow table, can be obtained from the virtual switch based on the message queue. A pointer is generated according to the memory address of the target flow table, and the pointer stores the memory address of the target flow table, so that the pointer points to the target flow table, thereby obtaining the flow table pointer corresponding to the target flow table, and then the flow table pointer can be stored in the flow table buffer area.
[0086] In an embodiment of the present application, the memory address of the target flow table is obtained based on the message queue; a flow table pointer corresponding to the target flow table is generated according to the memory address of the target flow table, and the flow table pointer is stored in the flow table cache area. The flow table pointer corresponding to the target flow table can be conveniently cached in the flow table cache area.
[0087] Optionally, the computer device is further provided with a merged flow table; the hit information of the target flow table includes hit information corresponding to multiple table lookups; step 103 may include the following steps:
[0088] Step 1031: The unloading thread obtains hit information corresponding to multiple table lookups of the target flow table from the flow table cache based on the merged flow table.
[0089] Step 1032: Based on the merged flow table, the hit information corresponding to the multiple table lookups of the target flow table is merged to obtain the merged information corresponding to the target flow table.
[0090] Step 1033: Generate a designated flow table according to the merge information.
[0091] In an embodiment of the present application, the virtual switch further includes a tracking queue and an information storage unit. In the process of looking up the three-level flow table, the virtual switch stores the hit information of the EMC flow table, the DPCLS flow table, and the OFPROTO flow table in the information storage unit. For any message received by the virtual switch, after the table lookup is completed, the virtual switch sends the message flow table record corresponding to the message to the unloading thread through the tracking queue. Among them, the message flow table record includes the hit information of the EMC flow table and the OFPROTO flow table, and the hit information of the EMC flow table and the OFPROTO flow table may include the hit information corresponding to multiple table lookups.
[0092] In the embodiment of the present application, the hit information corresponding to the multiple table lookups of the target flow table can be obtained from the flow table cache area by the unloading thread based on the merged flow table, and then based on the merged flow table, the target flow table, such as the DPCLS flow table, and the EMC flow table and the OFPROTO flow table are respectively merged in the hit information corresponding to the multiple table lookups, so as to obtain the merged information corresponding to the target flow table, the EMC flow table, and the OFPROTO flow table. Finally, a designated flow table is generated according to the merged information corresponding to the target flow table, the EMC flow table, and the OFPROTO flow table, so as to obtain a designated flow table that uniquely matches the message received by the virtual switch.
[0093] In the embodiment of the present application, the hit information corresponding to the multiple table lookups of the target flow table is obtained from the flow table cache area by the unloading thread based on the merged flow table; based on the merged flow table, the hit information corresponding to the multiple table lookups of the target flow table is merged to obtain the merged information corresponding to the target flow table; and the designated flow table is generated according to the merged information. In this way, the hit information corresponding to the multiple table lookups of the target flow table can be merged based on the merged flow table to generate the designated flow table.
[0094] Optionally, after step 102, the method further includes:
[0095] Step 301: Identify the hit data in the target flow table according to the flow table pointer and the hit information.
[0096] In an embodiment of the present application, the hit data in the target flow table can be determined based on the hit information and the memory address corresponding to the data can be obtained, and the address stored in the flow table pointer can be updated based on the memory address of the hit data, so that the flow table pointer is pointed to the hit data in the target flow table to identify the hit data in the target flow table.
[0097] Step 302: Update predefined statistical parameters in the flow table buffer area according to the identified data in the target flow table.
[0098] In the embodiment of the present application, the statistical parameter is a variable used to record the number of times the data in the target flow table is hit, and the statistical parameter pre-set for the target flow table can be stored in the flow table buffer area. After the hit data in the target flow table is identified according to the flow table pointer and the hit information, the statistical parameter corresponding to the identified data in the flow table buffer area can be updated according to the identified data. Specifically, the number of times the identified data in the target flow table recorded by the statistical parameter is hit can be increased by one.
[0099] In the embodiment of the present application, the hit data in the target flow table is identified according to the flow table pointer and the hit information; and the predefined statistical parameters in the flow table cache are updated according to the identified data in the target flow table. Compared with the operation of feeding back statistical information through the hardware module of the smart network card after the flow table is unloaded in the prior art, the statistical parameters in the flow table cache can be updated immediately through the flow table pointer after the unloading thread obtains the hit information of the target flow table, thereby reducing the statistical processing time and improving the statistical efficiency.
[0100] Optionally, the virtual switch further includes a statistical thread, and the method further includes:
[0101] Step 401: When a preset condition is met, the statistical parameters in the flow table cache are obtained through the statistical thread, so that the statistical thread can record the usage of the target flow table.
[0102] In the embodiment of the present application, the preset condition may be a pre-set statistical cycle, or the statistical thread responds to a received statistical information viewing instruction, which is not limited in the embodiment of the present application. When the preset condition is met, the statistical parameters in the flow table cache can be obtained through the statistical thread, and the statistical thread records the usage of the target flow table according to the actual data of the statistical parameters, such as the number of times the data in the target flow table represented by the statistical parameters is hit, and records the hit status of the data in the target flow table. In addition, the statistical thread is also used to respond to the received statistical information viewing instruction and return the actual data of the statistical parameters to the sender of the statistical information viewing instruction.
[0103] In the embodiment of the present application, by obtaining statistical parameters in the flow table cache area through a statistical thread when preset conditions are met, the usage of the target flow table can be conveniently recorded according to the statistical parameters through the statistical thread.
[0104] Optionally, the target flow table is a flow table of fuzzy matching type, and the hit information of the target flow table is fuzzy matching information; step 103 may include the following steps:
[0105] Step 1034: Determine exact matching information according to the fuzzy matching information and preset conversion information through the offloading thread.
[0106] Step 1035: Generate a designated flow table according to the exact matching information, so that the designated flow table is a flow table of an exact matching type.
[0107] In an embodiment of the present application, the target flow table may be a DPCLS flow table. The DPCLS flow table is a fuzzy matching type of flow table. When OVS-DPDK searches the DPCLS flow table, a flow table hit will generate fuzzy matching information. The fuzzy matching information includes field information of the flow, such as IP address, MAC address, network protocol, etc., mask information, etc.
[0108] In the embodiment of the present application, when the flow table type supported by the hardware module of the smart network card is an exact match type, it is necessary to implement the conversion of the fuzzy match type flow table into an exact match type flow table at the intermediate cache layer between the virtual switch and the smart network card. The preset conversion information can be mask information, and the fuzzy match information and the preset conversion information can be combined as exact match information, and then a flow table is established, and the exact match information is added to the established flow table to generate a specified flow table, and the obtained specified flow table is an exact match type flow table.
[0109] In the embodiment of the present application, the unloading thread determines the exact matching information according to the hit information of the target flow table and the preset conversion information; and generates the specified flow table according to the exact matching information, so that the specified flow table of the exact matching type can be easily obtained.
[0110] It should be noted that software flow tables and hardware flow tables are generally quite different, and some smart network card hardware modules only support precise matching flow tables. Since the flow table unloading of the prior art is to copy each hit information generated by OVS-DPDK querying the DPCLS flow table as a cache, the prior art needs to support hardware precise matching flow tables. It is also necessary to first turn off the fuzzy matching function of OVS-DPDK, let OVS-DPDK generate a DPCLS flow table of the precise matching type, and then copy the hit information of the DPCLS flow table of the precise matching type in the cache. In this way, OVS-DPDK has no fuzzy matching function, and will generate a large number of precise flow tables in complex business situations, which will put a lot of pressure on the statistical thread reconciliation of OVS-DPDK, and its stability cannot be guaranteed, which easily leads to the problem of hardware flow tables being completely cleared.
[0111] The flow table unloading method of the embodiment of the present application does not need to disable the DPCLS flow table fuzzy matching function of OVS-DPDK. In the intermediate cache layer, the unloading thread can determine the precise matching information according to the fuzzy matching information and the preset conversion information, and generate a specified flow table according to the precise matching information, so that the specified flow table is a flow table of the precise matching type, thereby realizing the conversion from the fuzzy matching flow table to the precise matching flow table. Therefore, it can be applied to different scenarios of hardware flow table precise matching and hardware flow table fuzzy matching at the same time, improving the compatibility of the method.
[0112] In addition, compared to the prior art, the hit information generated when OVS-DPDK queries the DPCLS flow table is cached for flow table unloading, and after the flow table is unloaded, the statistical information feedback operation of the hardware module of the smart network card is obtained through the statistical thread. The flow table unloading method of the embodiment of the present application can directly update the statistical parameters at the software level by operating the flow table pointer and respond to the reading of the statistical thread. Since there is no need to disable the DPCLS flow table fuzzy matching function of OVS-DPDK, a large number of precise flow tables will not be generated even in complex business situations, and the statistical thread can directly obtain the statistical parameters in the flow table cache area to record the usage of the target flow table. Therefore, the hardware processing logic can be reduced, and the reconciliation pressure of the statistical thread can be reduced, thereby improving the stability of the statistical thread.
[0113] Figure 2 It is a schematic diagram of the process of virtual switch table lookup in the prior art, such as Figure 2 As shown in the figure, the RF module receives the message through the receiving antenna, and the virtual switch matches the message against the three-level flow tables, namely the EMC flow table, the DPCLS flow table, and the OFPROTO flow table. There may be table jumps or multiple circular table lookups during the table lookup process. After the flow table is hit, the execution action information is obtained, and the message is forwarded through the transmitting antenna of the RF module according to the execution action information.
[0114] Figure 3Schematic diagram of an application scenario of the flow table unloading method of the embodiment of the present application. Figure 3 As shown, after receiving the message, the virtual switch looks up the three-level flow tables of EMC flow table, DPCLS flow table and OFPROTO flow table according to the data in the message to obtain the hit information of the flow table and store the hit information in the information storage unit. After the lookup is completed, the virtual switch sends the hit information generated when looking up the EMC flow table and OFPROTO flow table to the unloading thread through the tracking queue, and the unloading thread obtains the hit information of the target flow table, such as the DPCLS flow table, based on the message queue according to the pre-defined flow table pointer in the flow table buffer area. The unloading thread obtains the hit information corresponding to the multiple lookups of the target flow table from the flow table buffer area based on the merged flow table, and then, based on the merged flow table, the target flow table, such as the DPCLS flow table, and the EMC flow table and the OFPROTO flow table are respectively merged in the hit information corresponding to the multiple lookups of the EMC flow table and the OFPROTO flow table to obtain the merged information corresponding to the target flow table, the EMC flow table, and the OFPROTO flow table. Finally, the specified flow table is generated according to the merged information corresponding to the target flow table, EMC flow table, and OFPROTO flow table, and the specified flow table is sent to the hardware module of the smart network card through the hardware data interface based on DPDK of the offload thread.
[0115] Figure 4 : is a structural diagram of a flow table unloading device provided in an embodiment of the present application, the flow table unloading device is applied to a computer device deployed with a virtual switch and an unloading thread, and a flow table cache area is provided in the computer device; the device 50 may include:
[0116] A table lookup module 501 is used to look up the target flow table through the virtual switch to obtain hit information of the target flow table; the hit information is stored in a specified location, and the specified location is determined according to the memory address of the target flow table;
[0117] An acquisition module 502 is used to acquire the hit information of the target flow table through the unloading thread according to the flow table pointer predefined in the flow table cache area; the flow table pointer is used to point to the target flow table, and the flow table pointer is set based on the memory address of the target flow table;
[0118] The execution module 503 is used to generate a designated flow table according to the hit information of the target flow table through the offload thread, and offload the designated flow table to the hardware module of the smart network card.
[0119] Optionally, the virtual switch further includes a message queue, and the message queue is used to transmit data between the virtual switch and the flow table buffer area; the acquisition module 502 is specifically used to:
[0120] Acquire a target address of the target flow table in the virtual switch according to the flow table pointer;
[0121] The hit information of the target flow table is obtained based on the message queue and the target address through the offloading thread, and the hit information is stored in the flow table cache area.
[0122] Optionally, the flow table pointer is obtained in the following manner:
[0123] Acquire a memory address of the target flow table based on the message queue;
[0124] A flow table pointer corresponding to the target flow table is generated according to the memory address of the target flow table, and the flow table pointer is stored in the flow table buffer area.
[0125] Optionally, the computer device is further provided with a merged flow table; the hit information of the target flow table includes hit information corresponding to multiple table lookups; the execution module 503 is specifically used for:
[0126] Obtaining, by the offloading thread, hit information corresponding to multiple table lookups of the target flow table from the flow table cache area based on the merged flow table;
[0127] Based on the merged flow table, merging the hit information corresponding to the multiple table lookups of the target flow table to obtain the merged information corresponding to the target flow table;
[0128] A designated flow table is generated according to the merge information.
[0129] Optionally, the device 50 further includes:
[0130] an identification module, used for, after the acquisition module obtains the hit information of the target flow table through the unloading thread according to the flow table pointer predefined in the flow table cache area, to identify the hit data in the target flow table according to the flow table pointer and the hit information;
[0131] An updating module is used to update the predefined statistical parameters in the flow table buffer area according to the data identified in the target flow table.
[0132] Optionally, the virtual switch further includes a statistical thread, and the device 50 further includes:
[0133] The statistics module is used to obtain the statistical parameters in the flow table cache area through the statistics thread when a preset condition is met, so that the statistics thread can record the usage of the target flow table.
[0134] Optionally, the target flow table is a flow table of a fuzzy matching type, and the hit information of the target flow table is fuzzy matching information; the execution module 503 is specifically used to:
[0135] Determining accurate matching information according to the fuzzy matching information and preset conversion information through the uninstall thread;
[0136] A designated flow table is generated according to the exact matching information, so that the designated flow table is a flow table of an exact matching type.
[0137] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0138] The flow table unloading device has the same advantages as the flow table unloading method described above over the prior art, which will not be described in detail here.
[0139] The present application also provides an electronic device, see Figure 5 , including: a processor 601, a memory 602, and a computer program 6021 stored in the memory 602 and executable on the processor 601, wherein the processor 601 implements the flow table unloading method of the aforementioned embodiment when executing the program.
[0140] The advantages of the electronic device and the flow table unloading method described above over the prior art are the same, which will not be described in detail here.
[0141] The present application also provides a readable storage medium. When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the flow table unloading method of the aforementioned embodiment.
[0142] The advantages of the readable storage medium and the flow table unloading method described above over the prior art are the same, and will not be repeated here.
[0143] It should be noted that all actions of acquiring signals, information or data in this application are carried out in compliance with the relevant data protection laws and policies of the country where they are located and with the authorization given by the owner of the corresponding device.
[0144] The algorithm and display provided herein are not inherently related to any particular computer, virtual system or other device. According to the above description, it is obvious that the structure required for constructing such a system is. In addition, the application is not directed to any specific programming language either. It should be understood that various programming languages can be utilized to realize the content of the application described herein, and the description of the specific language above is for the purpose of disclosing the best mode of implementation of the application.
[0145] In the description provided herein, a large number of specific details are described. However, it is understood that the embodiments of the present application can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.
[0146] Similarly, it should be understood that in order to streamline the present application and aid in understanding one or more of the various inventive aspects, in the above description of the exemplary embodiments of the present application, the various features of the present application are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting the following intention: the claimed application requires more features than the features explicitly recited in each claim. More specifically, as reflected in the claims below, the inventive aspects lie in less than all the features of the individual embodiments disclosed above. Therefore, the claims that follow the specific embodiment are hereby expressly incorporated into the specific embodiment, with each claim itself serving as a separate embodiment of the present application.
[0147] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.
[0148] The various component embodiments of the present application can be implemented in hardware, or in software modules running on one or more processors, or in a combination thereof. It should be understood by those skilled in the art that a microprocessor or digital signal processor (DSP) can be used in practice to implement some or all functions of some or all components in the sorting device according to the present application. The present application can also be implemented as a device or apparatus program for executing part or all of the methods described herein. Such a program implementing the present application can be stored on a computer-readable medium, or can have the form of one or more signals. Such a signal can be downloaded from an Internet website, or provided on a carrier signal, or provided in any other form.
[0149] It should be noted that the above embodiments illustrate the present application rather than limit the present application, and that those skilled in the art may design alternative embodiments without departing from the scope of the appended claims. In the claims, any reference symbol between brackets should not be constructed as a limitation to the claims. The word "comprising" does not exclude the presence of elements or steps not listed in the claims. The word "one" or "an" preceding an element does not exclude the presence of multiple such elements. The present application may be implemented by means of hardware including several different elements and by means of a suitably programmed computer. In a unit claim that lists several devices, several of these devices may be embodied by the same hardware item. The use of the words first, second, and third, etc. does not indicate any order. These words may be interpreted as names.
[0150] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0151] The above description is only a preferred embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present application shall be included in the protection scope of the present application.
[0152] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
[0153] It should be noted that the various data-related processes in the embodiments of the present application are all carried out in compliance with the corresponding data protection laws and policies of the country where the device is located, and with the authorization given by the owner of the corresponding device.
Claims
1. A flow table unloading method, characterized in that: The method is applied to a computer device deployed with a virtual switch and an offload thread, wherein a flow table cache area is provided in the computer device; the method comprises: The target flow table is looked up by the virtual switch to obtain hit information of the target flow table; the hit information is stored in a specified location, and the specified location is determined according to the memory address of the target flow table; Wherein, the memory address of the target flow table is the same memory area as the memory of the target flow table; Obtaining the hit information of the target flow table according to the predefined flow table pointer in the flow table cache area through the offloading thread; the flow table pointer is used to point to the target flow table, and the flow table pointer is set based on the memory address of the target flow table; Wherein, the flow table pointer stores the first address of the target flow table in the memory; The designated flow table is generated according to the hit information of the target flow table by the offloading thread, and the designated flow table is offloaded to the hardware module of the intelligent network card.
2. The method according to claim 1, characterized in that The virtual switch further includes a message queue, which is used to transmit data between the virtual switch and the flow table cache area; the step of obtaining the hit information of the target flow table according to the predefined flow table pointer in the flow table cache area through the offload thread includes: Acquire a target address of the target flow table in the virtual switch according to the flow table pointer; The hit information of the target flow table is obtained based on the message queue and the target address through the offloading thread, and the hit information is stored in the flow table cache area.
3. The method according to claim 2, characterized in that The flow table pointer is obtained in the following way: Acquire a memory address of the target flow table based on the message queue; A flow table pointer corresponding to the target flow table is generated according to the memory address of the target flow table, and the flow table pointer is stored in the flow table buffer area.
4. The method according to claim 2, characterized in that: The computer device is also provided with a merged flow table; the hit information of the target flow table includes hit information corresponding to multiple table lookups; the generating of the designated flow table according to the hit information of the target flow table by the offloading thread includes: Obtaining, by the offloading thread, hit information corresponding to multiple table lookups of the target flow table from the flow table cache area based on the merged flow table; Based on the merged flow table, merging the hit information corresponding to the multiple table lookups of the target flow table to obtain the merged information corresponding to the target flow table; A designated flow table is generated according to the merge information.
5. The method according to claim 1, characterized in that After obtaining the hit information of the target flow table according to the predefined flow table pointer in the flow table cache area by the offloading thread, the method further includes: Identify the hit data in the target flow table according to the flow table pointer and the hit information; The predefined statistical parameters in the flow table buffer are updated according to the identified data in the target flow table.
6. The method according to claim 5, characterized in that The virtual switch further includes a statistics thread, and the method further includes: When a preset condition is met, the statistical parameters in the flow table cache are obtained through the statistical thread, so that the statistical thread can record the usage of the target flow table.
7. The method according to claim 1, characterized in that The target flow table is a fuzzy matching type flow table, and the hit information of the target flow table is fuzzy matching information; and generating a designated flow table according to the hit information of the target flow table by the offloading thread includes: Determining accurate matching information according to the hit information of the target flow table and preset conversion information by the offloading thread; A designated flow table is generated according to the exact matching information, so that the designated flow table is a flow table of an exact matching type.
8. A flow meter unloading device, characterized in that: The device is applied to a computer device deployed with a virtual switch and an offload thread, wherein a flow table cache area is provided in the computer device; the device comprises: A table lookup module, used to look up the target flow table through the virtual switch to obtain hit information of the target flow table; the hit information is stored in a specified location, and the specified location is determined according to the memory address of the target flow table; wherein the memory address of the target flow table is the same memory area as the memory of the target flow table; An acquisition module, configured to acquire the hit information of the target flow table through the unloading thread according to a flow table pointer predefined in the flow table cache area; the flow table pointer is used to point to the target flow table, and the flow table pointer is set based on the memory address of the target flow table; wherein the flow table pointer stores the first address of the target flow table in the memory; An execution module is used to generate a designated flow table according to the hit information of the target flow table through the unloading thread, and unload the designated flow table to the hardware module of the smart network card.
9. The device according to claim 8, characterized in that The virtual switch further includes a message queue, which is used to transmit data between the virtual switch and the flow table buffer area; the acquisition module is specifically used to: Acquire a target address of the target flow table in the virtual switch according to the flow table pointer; The hit information of the target flow table is obtained based on the message queue and the target address through the offloading thread, and the hit information is stored in the flow table cache area.
10. The device according to claim 9, characterized in that The computer device is also provided with a merged flow table; the hit information of the target flow table includes hit information corresponding to multiple table lookups; the execution module is specifically used for: Obtaining, by the offloading thread, hit information corresponding to multiple table lookups of the target flow table from the flow table cache area based on the merged flow table; Based on the merged flow table, merging the hit information corresponding to the multiple table lookups of the target flow table to obtain the merged information corresponding to the target flow table; A designated flow table is generated according to the merge information.
11. The device according to claim 8, characterized in that The device also includes: an identification module, used for, after the acquisition module obtains the hit information of the target flow table through the unloading thread according to the flow table pointer predefined in the flow table cache area, to identify the hit data in the target flow table according to the flow table pointer and the hit information; An updating module is used to update the predefined statistical parameters in the flow table buffer area according to the data identified in the target flow table.
12. The device according to claim 11, characterized in that The virtual switch further includes a statistical thread, and the device further includes: The statistics module is used to obtain the statistical parameters in the flow table cache area through the statistics thread when a preset condition is met, so that the statistics thread can record the usage of the target flow table.
13. The device according to claim 8, characterized in that The target flow table is a fuzzy matching type flow table, and the hit information of the target flow table is fuzzy matching information; the execution module is specifically used for: Determining accurate matching information according to the fuzzy matching information and preset conversion information through the uninstall thread; A designated flow table is generated according to the exact matching information, so that the designated flow table is a flow table of an exact matching type.
14. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor implements the flow table unloading method as described in any one of claims 1 to 7 when executing the program.
15. A readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the flow table unloading method described in any one of claims 1 to 7.
Citation Information
Patent Citations
OpenFlow flow table energy-saving storage architecture supporting QoS (Quality of Service) and application thereof
CN110808910A
Software and hardware mixed flow table management method and device
CN113438168A
Flow table hardware unloading method, equipment and medium
CN115150328A
Network Virtualization Operations Using a Scalable Statistics Collection Framework
US20150312118A1
