A flow table statistics method and device
By using the first reference identifier in flow table statistics to unload the flow table to the hardware area and perform cumulative statistics, the problem of excessive resource occupation in the prior art is solved, the performance of flow statistics is improved and management is simplified.
Patent Information
- Application Number
- CN202310923513.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-25
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2043-07-25
AI Technical Summary
The flow table statistics method in the existing technology requires a large amount of software resources and hardware resources, resulting in poor traffic statistics performance.
By allocating a first reference identifier, multiple flow tables are unloaded to the first area of the hardware, and statistical operations are added to the operation set of each flow table that requires traffic statistics. The first reference identifier is used for cumulative statistics to reduce the occupation of software and hardware resources.
This reduces the software and hardware resources occupied by traffic statistics, improves traffic statistics performance, and simplifies software maintenance and management.
Smart Images

Figure CN116723135B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a flow table statistics method and device. Background Art
[0002] With the rapid development of Internet technology, network traffic is increasing, and network structures are becoming increasingly complex. Software-defined networking (SDN) is a new type of network architecture whose core technology is to achieve flexible control of network traffic by separating the control plane and data plane of network devices. In order to fully understand business operations and maintenance, traffic statistics are very necessary. Hardware offload technology can be used to improve throughput. Flow tables generated by software are offloaded to hardware before traffic statistics are performed. A hardware resource with a reference identifier is allocated to each flow table for which traffic statistics are required. If the statistical sum of multiple flow tables needs to be queried, the software needs to traverse the query interface multiple times, query the statistical values of each flow table, and then accumulate all the statistical values. This flow table statistical method requires a large amount of software and hardware resources, and the performance of traffic statistics is poor. Summary of the Invention
[0003] The embodiments of the present application provide a flow table statistics method and device, which can realize cumulative statistics of multiple flow tables by querying the first reference identifier, thereby reducing the software resources and hardware resources occupied by flow statistics and improving the performance of flow statistics.
[0004] In a first aspect, an embodiment of the present application provides a flow table statistics method, applied to a controller, the method comprising:
[0005] Acquire multiple flow tables, each of which includes multiple packets;
[0006] Allocating a first reference identifier by software, the first reference identifier being used to identify a first area of hardware;
[0007] Determine at least one flow table among the multiple flow tables for which traffic statistics need to be performed, and add a statistical operation to an operation set of each flow table in the at least one flow table, where the statistical operation corresponds to the first reference identifier;
[0008] offloading a plurality of flow tables to a first region of hardware;
[0009] According to the first reference identifier, statistics are collected on at least one flow table among the multiple flow tables to determine a first statistic, where the first statistic includes a hit count of packets of the at least one flow table.
[0010] The first reference identifier is allocated by software, and statistical operations are added to the operation set of each flow table that needs to perform traffic statistics in multiple flow tables. After the multiple flow tables are unloaded to the hardware, the first statistical value of the flow table that needs to perform traffic statistics in the multiple flow tables can be determined by querying the first reference identifier. Cumulative statistics can be achieved without querying each flow table one by one, which can reduce the software and hardware resources occupied by traffic statistics and improve the performance of traffic statistics of software and hardware. In addition, only one first reference identifier needs to be maintained, making software maintenance and management simpler.
[0011] In one possible design, a flow table including a statistical operation in an operation set of multiple flow tables is queried through a first reference identifier; the number of packets in the flow table including the statistical operation in the operation set of multiple flow tables is added to obtain a first statistic.
[0012] By querying the first reference identifier, the first statistic of the flow table that needs to be counted among multiple flow tables can be determined. Cumulative statistics can be achieved without querying each flow table one by one, which can reduce the software and hardware resources occupied by traffic statistics and improve the performance of traffic statistics of software and hardware.
[0013] In another possible design, a second reference identifier is assigned to the driver through software, and the driver includes resource information of the hardware; based on the resource information of the hardware, the driver determines whether the second reference identifier is used to identify the first area of the hardware; if the second reference identifier is used to identify the first area of the hardware, the second reference identifier is used as the first reference identifier.
[0014] By allocating a reference identifier to implement cumulative statistics of multiple flow tables, the software and hardware resources occupied by traffic statistics can be reduced. In addition, only one first reference identifier needs to be maintained, making software maintenance and management simpler.
[0015] In another possible design, the message of each flow table in the multiple flow tables corresponds to a destination Internet Protocol IP address, and it is determined whether the destination IP address corresponding to the message of each flow table in the multiple flow tables is the same as the first destination IP address, and the message corresponding to the first destination IP address needs to be subjected to traffic statistics; if the destination IP address corresponding to the message of the first flow table in the multiple flow tables is the same as the first destination IP address, the first flow table is taken as one of at least one flow table.
[0016] By adding statistical operations to the operations of each flow table that needs to perform traffic statistics in multiple flow tables, cumulative statistics can be achieved without querying each flow table one by one. This can reduce the software and hardware resources occupied by traffic statistics and improve the performance of software and hardware traffic statistics.
[0017] In another possible design, the first statistic is sent to the terminal device.
[0018] In a second aspect, an embodiment of the present application provides a flow table statistics device, which is applied to a controller. The device includes:
[0019] An acquisition module, configured to acquire a plurality of flow tables, each of the plurality of flow tables including a plurality of packets;
[0020] A processing module, configured to allocate a first reference identifier through software, where the first reference identifier is used to identify a first area of hardware;
[0021] The processing module is further configured to determine at least one flow table among the multiple flow tables for which traffic statistics need to be performed, and to add a statistical operation to an operation set of each flow table in the at least one flow table, where the statistical operation corresponds to the first reference identifier;
[0022] The processing module is further configured to offload the plurality of flow tables to the first region of the hardware;
[0023] The processing module is further configured to perform statistics on at least one flow table among the multiple flow tables according to the first reference identifier to determine a first statistic, where the first statistic includes a hit count of packets of the at least one flow table.
[0024] In one possible design, the processing module is further used to query the flow table containing the statistical operation in the operation set of multiple flow tables through the first reference identifier; add the number of packets of the flow table containing the statistical operation in the operation set of multiple flow tables to obtain a first statistic.
[0025] In another possible design, the processing module is also used to assign a second reference identifier to the driver through software, and the driver includes resource information of the hardware; based on the resource information of the hardware, the driver determines whether the second reference identifier is used to identify the first area of the hardware; if the second reference identifier is used to identify the first area of the hardware, the second reference identifier is used as the first reference identifier.
[0026] In another possible design, the message of each flow table in the multiple flow tables corresponds to a destination Internet Protocol IP address, and the processing module is also used to determine whether the destination IP address corresponding to the message of each flow table in the multiple flow tables is the same as the first destination IP address, and the message corresponding to the first destination IP address needs to be subjected to traffic statistics; if the destination IP address corresponding to the message of the first flow table in the multiple flow tables is the same as the first destination IP address, the first flow table is used as one of at least one flow table.
[0027] In another possible design, the processing module is further used to send the first statistic to the terminal device.
[0028] The operations and beneficial effects performed by the flow table statistics device can refer to the method and beneficial effects described in the first aspect above, and the repeated parts will not be repeated.
[0029] In a third aspect, the present application provides a flow table statistics device, which can be a controller, a device in a controller, or a device that can be used in conjunction with a controller. The flow table statistics device can also be a chip system. The flow table statistics device can execute the method described in the first aspect. The functions of the flow table statistics device can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions. The module can be software and / or hardware. The operations and beneficial effects performed by the flow table statistics device can refer to the methods and beneficial effects described in the first aspect above, and repeated parts will not be repeated.
[0030] In a fourth aspect, the present application provides a computing device comprising a processor and a memory, wherein the memory is used to store a computer program, and when the processor calls the computer program in the memory, the method described in any one of the first aspects is executed.
[0031] In a fifth aspect, the present application provides a computer-readable storage medium for storing a computer program, which, when executed, enables the method described in any one of the first aspects to be implemented.
[0032] In a sixth aspect, the present application provides a computer program product comprising a computer program, which, when executed, enables the method described in any one of the first aspects to be implemented. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the background technology, the drawings required for use in the embodiments of the present application or the background technology will be described below.
[0034] Figure 1 This is a flow chart of flow table statistics;
[0035] Figure 2 This is an example diagram using flow table statistics;
[0036] Figure 3 This is a flow chart of a flow table statistics method provided in an embodiment of the present application;
[0037] Figure 4 This is an example diagram of a flow table statistics method provided in an embodiment of the present application;
[0038] Figure 5 This is a schematic diagram of the structure of a flow table statistics device provided in an embodiment of the present application;
[0039] Figure 6It is a structural diagram of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0040] The embodiments of the present application are described below in conjunction with the drawings in the embodiments of the present application.
[0041] It should be understood that, in the description of this application, "at least one" means one or more, and "a plurality" means two or more. In addition, unless otherwise specified, the terms "first" and "second" are used only for descriptive purposes and are not to be construed as indicating or implying relative importance or order.
[0042] Flow table statistics methods include hardware offload technology, which offloads software-generated flow tables to hardware, allowing packet traffic statistics to be calculated on the hardware. In cloud computing and data center applications, flow table offload technology can be applied to virtual switches and network cards. One multi-layer virtual switch architecture is called the Open VSwitch architecture, or OVS. The OVS architecture uses a unified controller at the control layer to determine the transmission path for all data packets within the network. The OVS architecture supports both user mode and kernel mode, also known as user space and kernel space. Data exchange between kernel and user space, or switching between kernel and user mode, typically results in latency and loss. To address this, the OVS architecture utilizes the Data Plane Development Kit (DPDK) technology, enabling user mode data to be forwarded directly to the network card without passing through the operating system. Specific network functions or interfaces on the network card correspond to one or more data paths, and flow table matching directs data flows to the corresponding data paths. Specifically, User-mode OVS offloads flow tables to hardware, such as network cards, through DPDK's flow table offload channel, or the interface DPDK opens to User-mode OVS for invocation. This enables user-mode operations, eliminating data exchange between kernel and user space, as well as operating system intervention, thereby improving performance. Generally speaking, there can be multiple flow tables, and User-mode OVS stores them in hardware caches, such as random access memory (RAM) that supports traffic statistics. These hardware caches cache flow tables to implement traffic statistics for user-mode data, allowing users on the operations side to fully understand the business operations.
[0043] In existing technical solutions, after offloading the flow tables that require traffic statistics to the hardware, the statistical values of each flow table are queried one by one through the query interface based on the reference identifier corresponding to each flow table, and the statistics are accumulated to obtain the total traffic statistics. For example, if there are 1000 flow tables that require traffic statistics, the software needs to allocate 1000 reference identifiers. After offloading 1000 flow tables to the hardware, 1000 hardware resources will be occupied, and 1000 queries will be required to determine the total traffic statistics.
[0044] like Figure 1 As shown, Figure 1 This is a flow table statistics flow diagram. The flow table statistics mainly include the following steps: S101, obtaining the current flow table set. S102, selecting multiple flow tables for which traffic statistics need to be calculated from the current flow table set. S103, assigning a reference identifier to each of the multiple flow tables. S104, offloading the multiple flow tables to hardware. S105, performing statistics on each flow table based on the reference identifier corresponding to each flow table, and determining the statistical value of each flow table. S106, summing the statistical values of each flow table to obtain the total traffic statistics.
[0045] Figure 2 This is an example diagram using flow table statistics, such as Figure 2 As shown in the figure, the controller queries the current OVS flow table for traffic statistics related to how many destination IP addresses are 192.168.0.0 / 16. The specific statistical process includes: the controller obtains 65535 flow tables in the current OVS flow table whose destination IP addresses are in the 192.168.0.0 / 16 network segment, then unloads 65535 flow tables to the hardware traffic statistics RAM, and then uses software to traverse and query 65535 times to obtain 65535 statistical values, and then accumulates 65535 to obtain the total traffic statistics.
[0046] However, the above flow table statistics process has the following disadvantages: a flow table needs to occupy a hardware resource of a reference identifier. If you need to query the statistics of "Class A flow", for example, the destination IP address of "Class A flow" is 192.1.0.0 / 16, then the software needs to query the statistics of each flow table one by one through the query interface, and then accumulate all the statistical values. As a result, the more flow tables there are, the more complicated the software maintenance is, the more hardware resources are occupied, and the traffic statistics performance of the software and hardware is worse.
[0047] In order to solve the above technical problems, the embodiments of the present application provide the following solutions.
[0048] like Figure 3 As shown, Figure 3 This is a flow chart of a flow table statistics method provided in an embodiment of the present application. The method includes but is not limited to the following steps:
[0049] Step S301: Acquire multiple flow tables, each of which includes multiple packets.
[0050] Specifically, the software generates multiple flow tables, each of which corresponds to a flow transmitted on the network. A flow is a set of packets with the same attributes that are sent in sequence over a period of time through the same network. In other words, each flow table in the multiple flow tables includes multiple packets. Furthermore, each flow table has multiple flow entries, each of which has multiple match fields. The match fields include information about the packet itself, such as the source media access control (MAC) address, destination MAC address, source Internet Protocol (IP) address, destination IP address, etc. Each entry includes a mapping between a match item (key) and an action set (action). The key is offloaded to the hardware to guide the hardware matching, and the action is offloaded to the hardware to guide the hardware in performing statistical operations. For example, when offloading a 1KB flow table, 1KB of key and action entries need to be stored in RAM.
[0051] In an embodiment of the present application, a controller obtains multiple flow tables generated by software, wherein the multiple flow tables include at least one flow table for which traffic statistics need to be performed.
[0052] Step S302: allocating a first reference identifier through software, where the first reference identifier is used to identify a first area of hardware.
[0053] Specifically, the software assigns a second reference identifier to the driver, and the driver includes resource information of the hardware; the driver determines whether the second reference identifier is used to identify the first area of the hardware based on the resource information of the hardware; if the second reference identifier is used to identify the first area of the hardware, the second reference identifier is used as the first reference identifier.
[0054] In an embodiment of the present application, the controller assigns a second reference identifier to the driver through software, and all resources are managed by the driver. The driver understands the resource information of the hardware, for example, the first area that supports traffic statistics. At the same time, the driver provides the software with an interface for the reference identifier. The driver determines whether the second reference identifier is used to identify the first area of the hardware based on the resource information of the hardware and the interface of the reference identifier. If the second reference identifier is used to identify the first area of the hardware, the driver returns an allocation success message to the controller and uses the second reference identifier as the first reference identifier.
[0055] The first area of the hardware may be a RAM that supports traffic statistics.
[0056] It should be noted that if the first area of the hardware is regarded as an array, then for the hardware, the first reference identifier is equivalent to the index number for accessing the array; for the driver, the first reference identifier is the reference identifier of the actual hardware; for the software, the first reference identifier can be consistent with the reference identifier of the hardware, or it can have a mapping relationship with the reference identifier of the hardware.
[0057] Step S303: determining at least one flow table among the multiple flow tables for which traffic statistics need to be performed, and adding a statistical operation to an operation set of each flow table in the at least one flow table, where the statistical operation corresponds to the first reference identifier.
[0058] In an embodiment of the present application, the controller obtains multiple flow tables generated by software, each flow table in the multiple flow tables includes multiple messages, each message corresponds to a destination IP address, and determines whether the destination IP address corresponding to the message of each flow table in the multiple flow tables is the same as the first destination IP address. If the destination IP address corresponding to the message of the first flow table in the multiple flow tables is the same as the first destination IP address, the first flow table is used as the flow table that needs to perform traffic statistics, and a statistical operation is added to the operation set of each flow table that needs to perform traffic statistics, and the statistical operation corresponds to the first reference identifier.
[0059] The packets corresponding to the first destination IP address need to be counted for traffic.
[0060] Optionally, it may also be determined whether the flow table needs to perform traffic statistics based on other features corresponding to the message, such as source IP address, port, protocol, etc.
[0061] Optionally, if the flow table needs to perform both reference flow statistics and precise flow statistics, two statistical operations need to be added to the operation set of the flow table.
[0062] Among them, reference flow statistics refers to the flow table statistics method provided in the embodiment of the present application, which can obtain the statistical total of multiple flow tables by querying a reference identifier; precise flow statistics refers to the traditional flow table statistics method, which requires querying the statistical values of each flow table one by one and accumulating them to obtain the statistical total.
[0063] Step S304: Unload multiple flow tables to the first area of the hardware.
[0064] Specifically, the multiple flow tables are unloaded to the first area of the hardware through a flow table unloading channel or an interface callable by software.
[0065] Step S305: performing statistics on at least one flow table among the multiple flow tables according to the first reference identifier to determine a first statistic, where the first statistic includes a hit count of packets of the at least one flow table.
[0066] Specifically, the flow table including the statistical operation in the operation set of the multiple flow tables is searched through the first reference identifier, and the number of packets of the flow table including the statistical operation in the operation set of the multiple flow tables is added to obtain the first statistic.
[0067] In an embodiment of the present application, multiple flow tables are unloaded to a first area of hardware and cached, and an operation set of each flow table in the multiple flow tables is queried through a first reference identifier. If the operation set of a second flow table in the multiple flow tables includes a statistical operation, then the second flow table is determined as a flow table that requires traffic statistics. At the same time, the number of hits of the flow table is increased by 1, and the number of packets of at least one flow table in the multiple flow tables that requires traffic statistics and each flow table in at least one flow table are determined. The number of packets is accumulated to obtain the number of hits of the packets of at least one flow table.
[0068] Optionally, the first statistic may further include the message length corresponding to each hit message.
[0069] Furthermore, the controller obtains a first statistic by querying the first reference identifier, and then sends the first statistic to a terminal device of a user at the operation and maintenance end. The first statistic is used by the user at the operation and maintenance end to analyze actual business traffic conditions.
[0070] In one embodiment, the controller queries traffic statistics related to the destination IP address 192.168.0.0 / 16, such as Figure 4 As shown, Figure 4 This is an example diagram of a flow table statistics method provided by an embodiment of the present application. Specifically, the controller obtains 65535 flow tables, allocates a first reference identifier available to the hardware traffic statistics RAM through software, and adds a statistical operation to the operation set of each flow table in the 65535 flow tables whose destination IP address is under the 192.168.0.0 / 16 network segment. The statistical operation corresponds to the first reference identifier, and then the 65535 flow tables are unloaded to the hardware traffic statistics RAM. By querying the first reference identifier, it is determined that the flow table containing the statistical operation in the 65535 flow tables is flow table 2. At the same time, the number of hits of the flow table is increased by 1, and the number of hits of the message with the destination IP address of 192.168.0.0 / 16 is determined based on the number of messages in flow table 2.
[0071] According to an embodiment of the present application, a first reference identifier is allocated by software, and statistical operations are added to the operation set of each flow table that needs to perform traffic statistics in multiple flow tables. After the multiple flow tables are unloaded to the hardware, the first statistic of the flow table that needs to perform traffic statistics in the multiple flow tables can be determined by querying the first reference identifier. Cumulative statistics can be achieved without querying each flow table one by one, which can reduce the software and hardware resources occupied by traffic statistics and improve the performance of traffic statistics of software and hardware. In addition, only one first reference identifier needs to be maintained, making software maintenance and management simpler.
[0072] like Figure 5 As shown, Figure 5 5 is a schematic diagram of the structure of a flow table statistics device provided in an embodiment of the present application. The flow table statistics device can be used to implement any method and function related to the controller in any of the aforementioned embodiments. The device includes an acquisition module 501 and a processing module 502. The detailed description of each unit is as follows.
[0073] The acquisition module 501 is configured to acquire a plurality of flow tables, each of which includes a plurality of packets.
[0074] The processing module 502 is configured to allocate a first reference identifier through software, where the first reference identifier is used to identify a first area of hardware.
[0075] Optionally, the processing module 502 is also used to assign a second reference identifier to the driver through software, and the driver includes resource information of the hardware; based on the resource information of the hardware, the driver determines whether the second reference identifier is used to identify the first area of the hardware; if the second reference identifier is used to identify the first area of the hardware, the second reference identifier is used as the first reference identifier.
[0076] The processing module 502 is further configured to determine at least one flow table among the multiple flow tables for which traffic statistics need to be performed, and add a statistical operation to the operation set of each flow table in the at least one flow table, where the statistical operation corresponds to the first reference identifier.
[0077] Optionally, the processing module 502 is also used to correspond a destination Internet Protocol IP address to the message of each flow table in multiple flow tables, determine whether the destination IP address corresponding to the message of each flow table in the multiple flow tables is the same as the first destination IP address, and the message corresponding to the first destination IP address needs to be subjected to traffic statistics; if the destination IP address corresponding to the message of the first flow table in multiple flow tables is the same as the first destination IP address, then the first flow table is used as one of at least one flow table.
[0078] The processing module 502 is further configured to offload the multiple flow tables to the first area of the hardware.
[0079] The processing module 502 is further configured to perform statistics on at least one flow table among the multiple flow tables according to the first reference identifier to determine a first statistic, where the first statistic includes a hit count of packets in the at least one flow table.
[0080] Optionally, the processing module 502 is further configured to query the operation set of the multiple flow tables including the flow table with the statistical operation through the first reference identifier; and add the number of packets of the flow table including the flow table with the statistical operation in the operation set of the multiple flow tables to obtain a first statistic.
[0081] Optionally, the processing module 502 is further configured to send the first statistic to the terminal device.
[0082] Figure 6 1 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application. The computing device can be applied to a controller, or implement the steps or processes executed by the controller in the above method embodiment.
[0083] like Figure 6 As shown, the computing device includes a processor 601 and a transceiver 602. Optionally, the computing device also includes a memory 603. The processor 601, transceiver 602, and memory 603 can communicate with each other via internal connection paths to transmit control and / or data signals. The memory 603 is used to store computer programs, and the processor 601 is used to call and execute the computer programs from the memory 603 to control the transceiver 602 to transmit and receive signals. Optionally, the computing device may also include an antenna for transmitting uplink data or uplink control signaling output by the transceiver 602 via wireless signals.
[0084] The processor 601 can be used with Figure 5 The processing module 502 in the embodiment of the present invention corresponds to the processing module 502 in the embodiment of the present invention, and the memory 603 can be combined into a processing device, and the processor 601 is used to execute the program code stored in the memory 603 to implement the above functions. In specific implementation, the memory 603 can also be integrated into the processor 601, or be independent of the processor 601.
[0085] The transceiver 602 may also be referred to as a transceiver unit or a transceiver module. The transceiver 602 may include a receiver (or receiver, receiving circuit) and a transmitter (or transmitter, transmitting circuit). The receiver is used to receive signals, and the transmitter is used to transmit signals.
[0086] It should be understood that Figure 6 The computing device shown is capable of implementing Figure 3The illustrated method embodiments involve various processes of the controller. The operations and / or functions of the various modules in the computing device are respectively for implementing the corresponding processes in the aforementioned method embodiments. For details, please refer to the description of the aforementioned method embodiments. To avoid repetition, detailed descriptions are omitted here.
[0087] The processor 601 can be used to execute the actions implemented by the controller described in the previous method embodiment, and the transceiver 602 can be used to execute the sending or receiving actions. Please refer to the description in the previous method embodiment for details, which will not be repeated here.
[0088] Among them, the processor 601 can be a central processing unit, a general-purpose processor, a digital signal processor, an application-specific integrated circuit, a field programmable gate array or other programmable logic device, a transistor logic device, a hardware component or any combination thereof. It can implement or execute the various exemplary logic blocks, modules and circuits described in conjunction with the disclosure of this application. The processor 601 can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a digital signal processor and a microprocessor, and so on. The communication bus 604 can be a peripheral component interconnect standard PCI bus or an extended industry standard architecture EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6Only one thick line is used to represent it, but it does not mean that there is only one bus or one type of bus. The communication bus 604 is used to realize the connection and communication between these components. Among them, the transceiver 602 in the embodiment of the present application is used to communicate signaling or data with other node devices. The memory 603 may include volatile memory, such as non-volatile dynamic random access memory (NVRAM), phase change random access memory (PRAM), magnetoresistive random access memory (MRAM), etc., and may also include non-volatile memory, such as at least one disk storage device, electrically erasable programmable read-only memory (EEPROM), flash memory devices, such as NOR flash memory or NAND flash memory, semiconductor devices, such as solid state disk (SSD), etc. The memory 603 may optionally be at least one storage device located away from the aforementioned processor 601. The memory 603 may also optionally store a set of computer program code or configuration information. Optionally, the processor 601 may also execute a program stored in the memory 603. The processor 601 may cooperate with the transceiver 602 and the memory 603 to execute any one of the methods and functions of the computing device in the above-mentioned application embodiments.
[0089] An embodiment of the present application also provides a chip system, which includes a processor for supporting a computing device to implement the functions involved in any of the above embodiments, such as generating or processing the flow table statistics involved in the above method. In one possible design, the chip system may also include a memory, which is used for the necessary program instructions and data for the computing device. The chip system can be composed of a chip, or it can include a chip and other discrete devices. Among them, the input and output of the chip system correspond to the receiving and sending operations of the computing device of the method embodiment, respectively.
[0090] The present application also provides a flow table statistics device, comprising a processor and a memory, wherein the memory is used to store computer programs, and the processor is used to execute the method in the above method embodiment.
[0091] According to the method provided in the embodiment of the present application, the present application also provides a computer program product, which includes: a computer program, when the computer program is run on a computer, causes the computer to execute Figure 3 A method according to any one of the embodiments shown.
[0092] According to the method provided in the embodiment of the present application, the present application also provides a computer readable medium, which stores a computer program, which, when executed on a computer, causes the computer to execute Figure 3 A method according to any one of the embodiments shown.
[0093] In the above embodiments, all or part of the embodiments may be implemented by software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments may be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated therein. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a high-density digital video disc (DVD)), or a semiconductor medium (eg, a solid state disc (SSD)).
[0094] It should be understood that the "and / or" appearing in the embodiments of the present application is merely a description of the association relationship between associated objects, indicating that three relationships may exist. For example, A and / or B can represent three situations: A exists alone, A and B exist at the same time, and B exists alone.
[0095] The above description is merely a specific embodiment of the present application, but the scope of protection of the present application is not limited thereto. Any changes or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in this application should be included in the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.
Claims
1. A flow table statistics method, characterized in that: Applied to a controller, the method includes: Acquire multiple flow tables, each of the multiple flow tables including multiple packets; allocating a first reference identifier by software, wherein the first reference identifier is used to identify a first area of hardware; Determine at least one flow table among the multiple flow tables for which traffic statistics need to be performed, and add a statistical operation to an operation set of each flow table in the at least one flow table, where the statistical operation corresponds to the first reference identifier; offloading the plurality of flow tables to a first region of the hardware; According to the first reference identifier, statistics are collected on the at least one flow table among the multiple flow tables to determine a first statistic, where the first statistic includes a hit count of packets of the at least one flow table.
2. The method according to claim 1, wherein The performing statistics on the at least one flow table among the plurality of flow tables according to the first reference identifier to determine a first statistic includes: querying, using the first reference identifier, the flow table in the operation set of the plurality of flow tables that includes the statistical operation; The number of packets of the flow tables including the statistical operation in the operation sets of the multiple flow tables is added to obtain the first statistic.
3. The method according to claim 1, wherein The allocating the first reference identifier by software includes: assigning a second reference identifier to a driver by the software, the driver including resource information of the hardware; determining, by the driver, based on resource information of the hardware, whether the second reference identifier is used to identify the first area of the hardware; If the second reference identifier is used to identify the first area of the hardware, the second reference identifier is used as the first reference identifier.
4. The method according to claim 1, wherein A message of each flow table in the plurality of flow tables corresponds to a destination Internet Protocol IP address, and determining at least one flow table in the plurality of flow tables for which traffic statistics need to be performed includes: Determine whether a destination IP address corresponding to a message in each flow table of the plurality of flow tables is the same as a first destination IP address, where traffic statistics need to be performed on messages corresponding to the first destination IP address; If the destination IP address corresponding to the message of the first flow table among the multiple flow tables is the same as the first destination IP address, the first flow table is used as one of the at least one flow table.
5. The method according to any one of claims 1 to 4, characterized in that The method further comprises: Send the first statistic to the terminal device.
6. A flow table statistics device, characterized in that: Applied to a controller, the device comprises: An acquisition module, configured to acquire a plurality of flow tables, each of the plurality of flow tables including a plurality of packets; A processing module, configured to allocate a first reference identifier through software, wherein the first reference identifier is used to identify a first area of hardware; The processing module is further configured to determine at least one flow table among the multiple flow tables for which traffic statistics need to be performed, and add a statistical operation to an operation set of each flow table in the at least one flow table, wherein the statistical operation corresponds to the first reference identifier; The processing module is further configured to offload the plurality of flow tables to the first area of the hardware; The processing module is further configured to perform statistics on the at least one flow table among the multiple flow tables according to the first reference identifier to determine a first statistic, where the first statistic includes a hit count of packets of the at least one flow table.
7. The device according to claim 6, characterized in that The processing module is further configured to query the operation set of the plurality of flow tables for a flow table including the statistical operation through the first reference identifier; The processing module is further configured to add the number of packets of the flow tables including the statistical operation in the operation sets of the multiple flow tables to obtain the first statistic.
8. The device according to claim 6, wherein The processing module is further configured to allocate a second reference identifier to a driver through the software, wherein the driver includes resource information of the hardware; The processing module is further configured to determine, through the driver, based on the resource information of the hardware, whether the second reference identifier is used to identify the first area of the hardware; The processing module is further configured to use the second reference identifier as the first reference identifier if the second reference identifier is used to identify the first area of the hardware.
9. The device according to claim 6, wherein A message in each flow table of the plurality of flow tables corresponds to a destination Internet Protocol IP address; The processing module is further configured to determine whether a destination IP address corresponding to a message in each flow table in the plurality of flow tables is the same as a first destination IP address, and traffic statistics need to be performed on the message corresponding to the first destination IP address; The processing module is further configured to use a first flow table among the multiple flow tables as one of the at least one flow table if the destination IP address corresponding to the message of the first flow table is the same as the first destination IP address.
10. A computing device, characterized in that The device comprises a memory and a processor, wherein the memory is used to store a computer program, and the processor runs the computer program to enable the computing device to perform the method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Message processing method, message processing device and related equipment
CN112910792A
Traffic analysis of data flows
US8005012B1