Hardware offloading method, device and medium for flow statistics and flow limiting statistics

By implementing the hardware offload method on the message forwarding hardware, the problems of low efficiency of flow statistics and current limit statistics and large hardware resource occupation in the existing technology are solved, efficient message forwarding and flow table offloading are realized, and hardware resources are reduced. Occupancy.

CN119232620BActive Publication Date: 2025-02-25ZHUHAI XINGYUN ZHILIAN TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411718195.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-28
Publication Date
2025-02-25
Estimated Expiration
2044-11-28

AI Technical Summary

Technical Problem

When implementing flow statistics and current limit statistics, it is difficult to improve packet forwarding efficiency and flow table unloading efficiency in the prior art. At the same time, hardware resources occupy a large amount and have high complexity.

Method used

By implementing the hardware offload method on the message forwarding hardware, the forwarding module and the current limiting module perform hard forwarding and current limiting operations, and stream statistics and current limiting statistics are performed through the message statistics register and the current limiting discarding statistics register, simplifying the Query complexity and save hardware resources.

Benefits of technology

It realizes efficient packet forwarding and flow table offloading, reduces the use of hardware resources, simplifies query complexity, and improves traffic forwarding efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure 00000000_0000_ABST
    Figure 00000000_0000_ABST
Patent Text Reader

Abstract

The present application relates to the field of computer technology and provides a hardware offloading method, device and medium for flow statistics and flow limiting statistics. The hardware offloading method can not only maintain a high message forwarding efficiency and flow table offloading efficiency, but also simplify the query complexity and save hardware resources by optimizing the statistical process and hardware design.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a hardware offloading method, device and medium for flow statistics and flow limiting statistics. Background Art

[0002] In cloud computing, data centers, artificial intelligence and other technical fields, flow statistics and flow limiting statistics are widely used. Flow statistics are used to monitor data traffic in the network and help network administrators understand network usage and performance. Through flow statistics, information such as data transmission volume, number of packets, and traffic patterns in the network can be collected and analyzed to identify bottlenecks in the network, optimize network configuration, and plan network expansion. Flow limiting statistics are used to control and manage the data transmission rate in the network to ensure the reasonable allocation of network resources and avoid network congestion. Through flow limiting statistics, an upper limit on the data transmission rate can be set to prevent certain applications or users from occupying too much bandwidth and ensure the normal operation of other important applications. At the same time, flow limiting statistics also help to comply with the network usage policies set by network service providers or organizations. Flow statistics and flow limiting statistics play complementary roles in network management: flow statistics help monitor and optimize network performance, while flow limiting statistics are used to control and manage the allocation of network resources. Through these two statistical methods, network managers can better understand and control network traffic and improve network efficiency and reliability.

[0003] In the prior art, there are generally two implementation schemes for flow statistics and flow limiting statistics. One is to perform packet forwarding and flow statistics and flow limiting statistics at the software level, but this is not conducive to improving packet forwarding efficiency; the other is to unload the flow table configuration to a dedicated hardware device through network function virtualization and hardware offload acceleration technology, use the hardware device for table lookup and packet forwarding, and also unload the flow statistics and flow limiting statistics to the hardware device, and then query the hardware device for statistical data at the software level. However, this will occupy limited physical resources on the hardware device and is not conducive to improving the flow table offloading efficiency and traffic forwarding efficiency.

[0004] To this end, the present invention provides a hardware unloading method, device and medium for flow statistics and flow limiting statistics, which can not only maintain a high message forwarding efficiency and flow table unloading efficiency, but also simplify the query complexity and save hardware resources by optimizing the statistical process and hardware design. Summary of the invention

[0005] In the first aspect, the present application provides a hardware unloading method for flow statistics and current limiting statistics. The hardware unloading method includes: performing hard message conversion based on the forwarding configuration table unloaded to the message forwarding hardware through the forwarding module of the message forwarding hardware, and, based on the current limiting configuration unloaded to the current limiting module through the current limiting module connected to the forwarding module of the message forwarding hardware, performing current limiting operations on the messages transmitted from the forwarding module to discard the messages that reach the current limiting threshold; accumulating statistics on the number of messages and bytes that have been hard-converted by the forwarding module through the message statistics register connected to the forwarding module of the message forwarding hardware to obtain flow statistics results, and accumulating statistics on the number of messages and bytes discarded by the current limiting module through the current limiting discard statistics register connected to the current limiting module of the message forwarding hardware to obtain current limiting statistics results; The flow table module on the software side that interacts with the hardware manages the forwarding configuration table used to unload to the message forwarding hardware, manages the relationship between multiple flow identifiers, multiple flow statistics identifiers and multiple current limiting statistics identifiers, and manages the relationship between multiple current limiting configuration identifiers, the multiple current limiting statistics identifiers and multiple current limiting strategies; through the command queue on the software side, stores and manages the read and write commands from the software side to the message forwarding hardware and the return results of the read and write commands; through the statistics module on the software side, periodically queries the message statistics register and the current limiting discard statistics register of the message forwarding hardware through the command queue, thereby generating the number of messages and the number of bytes of each of the multiple flow statistics identifiers, and the total number of messages, the total number of bytes, the number of discarded messages and the number of discarded bytes of each of the multiple current limiting statistics identifiers.

[0006] Through the first aspect of the present application, not only can a high message forwarding efficiency and flow table unloading efficiency be maintained, but also the query complexity is simplified and hardware resources are saved by optimizing the statistical process and optimizing the hardware design.

[0007] In a possible implementation of the first aspect of the present application, the flow statistics results recorded by the message statistics register include the number of messages and the number of bytes of each of the multiple flow statistics identifiers, and the flow limiting statistics results recorded by the flow limiting discard statistics register include the number of discarded messages and the number of discarded bytes of each of the multiple flow limiting statistics identifiers.

[0008] In a possible implementation of the first aspect of the present application, the relationship between the multiple flow identifiers, the multiple flow statistics identifiers and the multiple flow limiting statistics identifiers managed by the flow table module includes: each of the multiple flow identifiers corresponds to a valid flow statistics identifier among the multiple flow statistics identifiers, and whether each of the multiple flow identifiers has a valid flow limiting statistics identifier among the multiple flow limiting statistics identifiers, wherein each of the multiple flow identifiers corresponds to one or more valid flow statistics identifiers among the multiple flow statistics identifiers.

[0009] In a possible implementation of the first aspect of the present application, the statistical module calculates the total number of messages and the total number of bytes of each of the multiple current limiting statistical identifiers based on the number of messages and the number of bytes of each of the valid flow statistical identifiers in the multiple flow statistical identifiers corresponding to each of the multiple current limiting statistical identifiers.

[0010] In a possible implementation of the first aspect of the present application, when a first flow identifier among the multiple flow identifiers does not have a valid flow limiting statistical identifier among the multiple flow limiting statistical identifiers, the first flow identifier has no flow limiting strategy, and the flow limiting module does not perform a flow limiting operation on the message matching the first flow identifier transmitted from the forwarding module.

[0011] In a possible implementation of the first aspect of the present application, the relationship between the multiple flow identifiers, the multiple flow statistics identifiers, and the multiple current limiting statistics identifiers managed by the flow table module is expressed in the data format of flow identifier-flow statistics identifier-valid current limiting statistics identifier / invalid current limiting statistics identifier, and the relationship between the multiple current limiting configuration identifiers, the multiple current limiting statistics identifiers, and the multiple current limiting strategies managed by the flow table module is expressed in the data format of current limiting configuration identifier-current limiting statistics identifier-current limiting strategy.

[0012] In a possible implementation of the first aspect of the present application, the hardware unloading method also includes: in response to a current limiting policy configuration operation, through the flow table module, allocating a current limiting statistical identifier for the current limiting configuration identifier and the current limiting policy specified by the current limiting policy configuration operation, and then updating the relationship between the multiple current limiting configuration identifiers, the multiple current limiting statistical identifiers and the multiple current limiting policies managed by the flow table module, and then updating the current limiting configuration unloaded to the current limiting module.

[0013] In a possible implementation of the first aspect of the present application, the hardware unloading method also includes: adding the initialization action command of the current limiting discard statistics register to the command queue, obtaining the initialization action command of the current limiting discard statistics register from the command queue through the message forwarding hardware, and then performing an initialization operation on the current limiting discard statistics register.

[0014] In a possible implementation of the first aspect of the present application, the hardware unloading method also includes: in response to a first packet sending operation from the forwarding module, through the flow table module, assigning a flow statistics identifier to the first packet specified by the first packet sending operation and obtaining a flow limiting statistics identifier associated with the first packet, and then updating the multiple flow identifiers managed by the flow table module, the multiple flow statistics identifiers, and the relationship between the multiple flow limiting statistics identifiers.

[0015] In a possible implementation of the first aspect of the present application, the hardware unloading method also includes: adding the initialization action command of the message statistics register to the command queue, obtaining the initialization action command of the message statistics register from the command queue through the message forwarding hardware, and then performing the initialization operation on the message statistics register.

[0016] In a possible implementation method of the first aspect of the present application, the statistical module on the software side periodically queries the message statistics register and the current limiting and discarding statistics register of the message forwarding hardware through the command queue, thereby generating the number of messages and bytes of each of the multiple flow statistics identifiers, the total number of messages, the total number of bytes, the number of discarded messages and the number of discarded bytes of each of the multiple current limiting statistics identifiers, including: obtaining the multiple flow statistics identifiers through the statistical module, and then obtaining the number of messages and bytes of each of the multiple flow statistics identifiers in batches through the command queue, and then, using the obtained number of messages and bytes of each of the multiple flow statistics identifiers to update the internal flow statistics results of the statistical module, and based on the relationship between the multiple current limiting configuration identifiers, the multiple current limiting statistics identifiers and the multiple current limiting policies managed by the flow table module, updating the internal current limiting statistics results of the statistical module.

[0017] In a possible implementation method of the first aspect of the present application, the statistical module on the software side periodically queries the message statistical register and the current limiting and discarding statistical register of the message forwarding hardware through the command queue, thereby generating the number of messages and the number of bytes of each of the multiple flow statistical identifiers, the total number of messages, the total number of bytes, the number of discarded messages and the number of discarded bytes of each of the multiple current limiting statistical identifiers, and also includes: obtaining the multiple current limiting statistical identifiers through the statistical module, and then obtaining the number of discarded messages and the number of discarded bytes of each of the multiple current limiting statistical identifiers in batches through the command queue, and then, using the obtained number of discarded messages and the number of discarded bytes of each of the multiple current limiting statistical identifiers, based on the relationship between the multiple current limiting configuration identifiers managed by the flow table module, the multiple current limiting statistical identifiers and the multiple current limiting policies, updating the internal current limiting statistical results of the statistical module.

[0018] In a possible implementation of the first aspect of the present application, the statistical module is used to provide statistical values ​​associated with the query request, including: querying the flow table module based on the flow identifier indicated by the query request to determine the flow statistical identifier corresponding to the flow identifier indicated by the query request, thereby providing the number of packets and bytes associated with the query request.

[0019] In a possible implementation of the first aspect of the present application, the statistical module is used to provide statistical values ​​associated with the query request, and also includes: querying the flow table module based on the current limiting configuration identifier indicated by the query request to determine the current limiting statistical identifier corresponding to the current limiting configuration identifier indicated by the query request, thereby providing the total number of packets, total number of bytes, number of discarded packets and number of discarded bytes associated with the query request.

[0020] In a possible implementation manner of the first aspect of the present application, the flow statistics result indicates a cumulative count of hard-converted flow table matches passing through the forwarding module, and the flow limiting statistics result indicates a cumulative count of discarded packets.

[0021] In a possible implementation manner of the first aspect of the present application, the current limiting configuration is based on a dual-rate three-color bucket algorithm.

[0022] In a possible implementation manner of the first aspect of the present application, the message forwarding hardware is an intelligent network interface card.

[0023] In a possible implementation manner of the first aspect of the present application, the software side is a virtual switch and data plane development tool set.

[0024] In a second aspect, an embodiment of the present application further provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements a method according to any one of the implementation modes of any of the above aspects when executing the computer program.

[0025] In a third aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores computer instructions. When the computer instructions are executed on a computer device, the computer device executes a method according to any one of the implementation methods of any of the above aspects.

[0026] In a fourth aspect, an embodiment of the present application further provides a computer program product, which includes instructions stored on a computer-readable storage medium, and when the instructions are executed on a computer device, the computer device executes a method according to any one of the implementation methods of any of the above aspects. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. 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.

[0028] Figure 1 A flowchart of a hardware offloading method for flow statistics and flow limiting statistics provided in an embodiment of the present application;

[0029] Figure 2 A method based on the embodiment of the present application is provided Figure 1 A schematic diagram of the statistical service of the hardware offloading method shown;

[0030] Figure 3 A schematic diagram of the structure of a computing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0031] The embodiments of the present application will be further described in detail below in conjunction with the accompanying drawings.

[0032] It should be understood that, in the description of this application, "at least one" means one or more, and "a plurality of" means two or more. In addition, unless otherwise specified, the words "first", "second", etc. are only used for the purpose of distinguishing descriptions, and cannot be understood as indicating or implying relative importance, nor can they be understood as indicating or implying an order.

[0033] Figure 1A flowchart of a hardware offloading method for flow statistics and flow limiting statistics provided by an embodiment of the present application. Figure 1 As shown, the hardware uninstallation method includes the following steps.

[0034] Step S101: Execute hard message forwarding through the forwarding module of the message forwarding hardware based on the forwarding configuration table unloaded to the message forwarding hardware, and perform current limiting operation on the message transmitted from the forwarding module based on the current limiting configuration unloaded to the current limiting module through the current limiting module of the message forwarding hardware, thereby discarding the message that reaches the current limiting threshold.

[0035] Step S103: Accumulate and count the number of messages and bytes that have been hard-forwarded by the forwarding module through the message statistics register of the message forwarding hardware connected to the forwarding module to obtain flow statistics results, and accumulate and count the number of messages and bytes discarded by the current limiting module through the current limiting discard statistics register of the message forwarding hardware connected to the current limiting module to obtain current limiting statistics results.

[0036] Step S105: Through the flow table module on the software side that interacts with the message forwarding hardware, manage the forwarding configuration table used to unload to the message forwarding hardware, manage the relationship between multiple flow identifiers, multiple flow statistics identifiers, and multiple current limiting statistics identifiers, and manage the relationship between multiple current limiting configuration identifiers, the multiple current limiting statistics identifiers, and multiple current limiting policies.

[0037] Step S107: storing and managing the read and write commands from the software side to the message forwarding hardware and the return results of the read and write commands through the command queue of the software side.

[0038] Step S109: Through the statistics module on the software side, the message statistics register and the current limiting and discarding statistics register of the message forwarding hardware are periodically queried through the command queue, thereby generating the number of messages and the number of bytes of each of the multiple flow statistics identifiers, and the total number of messages, the total number of bytes, the number of discarded messages and the number of discarded bytes of each of the multiple current limiting statistics identifiers.

[0039] Figure 1The hardware offloading method for flow statistics and flow limiting statistics shown in the figure, through network function virtualization and hardware offloading acceleration technology, unloads the forwarding configuration table and flow limiting configuration to the message forwarding hardware, so that the message forwarding hardware can perform flow table lookup, message forwarding, flow limiting operations, and message discarding. It can also perform flow statistics to collect and analyze information such as data transmission volume, number of data packets, traffic patterns, etc. in the network, which helps to identify bottlenecks in the network, optimize network configuration and plan network expansion. It can also perform flow limiting statistics to set an upper limit on the data transmission rate and set an upper limit on the bandwidth usage, which helps to ensure the normal operation of various services and comply with the network usage policies set by network service providers or organizations. Furthermore, through the collaboration between the software layer and the message forwarding hardware, the redundant characteristics of the flow statistics data and the current limiting statistics data are utilized, and the message statistics register is used to accumulate the number of messages and the number of bytes that are hard-forwarded by the forwarding module to obtain the flow statistics result, and the current limiting discard statistics register is used to accumulate the number of messages and the number of bytes discarded by the current limiting module to obtain the current limiting statistics result. Then, through the statistics module, the message statistics register and the current limiting discard statistics register of the message forwarding hardware are periodically queried through the command queue, thereby generating the number of messages and the number of bytes of each of the multiple flow statistics identifiers, and the total number of messages, the total number of bytes, the number of discarded messages and the number of discarded bytes of each of the multiple current limiting statistics identifiers. In this way, by superimposing and calculating the flow statistics that reference the current limiting configuration to obtain the statistics data related to the current limiting configuration, the number of statistics registers can be reduced, hardware resources can be saved, and the number of queries for the statistics data can also be reduced. Combined with the method of batch periodic query of the command queue, the efficiency of the statistics data query can be improved, which is helpful to provide the upper layer application with the correct flow statistics results and current limiting statistics results. In this way, not only can the packet forwarding efficiency and flow table unloading efficiency be maintained at a high level, but also the query complexity can be simplified and hardware resources can be saved by optimizing the statistical process and hardware design.

[0040] Figure 2 A method based on the embodiment of the present application is provided Figure 1 Schematic diagram of the statistics service of the hardware offloading method shown. Figure 2 As shown, a flow table module 211 and a statistics module 213 are deployed in the software side 201, and a command queue 215. A forwarding module 221, a current limiting module 223, a message statistics register 225, and a current limiting discard statistics register 227 are deployed in the message forwarding hardware 203. Figure 2The hardware unloading method of the statistical service shown includes the following steps: performing hard transfer of messages through the forwarding module 221 of the message forwarding hardware 203 based on the forwarding configuration table unloaded to the message forwarding hardware 203, and performing current limiting operation on the messages transmitted from the forwarding module 221 based on the current limiting configuration unloaded to the current limiting module 223 through the current limiting module 223 of the message forwarding hardware 203, thereby discarding the messages reaching the current limiting threshold; accumulating statistics on the number of messages and bytes that have been hard transferred through the forwarding module 221 through the message statistics register 225 of the message forwarding hardware 203 connected to the forwarding module 221 to obtain flow statistics results, and accumulating statistics on the number of messages and bytes discarded by the current limiting module 223 through the current limiting discard statistics register 227 of the message forwarding hardware 203 connected to the current limiting module 223 to obtain current limiting statistics results; Through the flow table module 211 of the software side 201 that interacts with the message forwarding hardware 203, the forwarding configuration table for unloading to the message forwarding hardware 203 is managed, and the relationship between multiple flow identifiers, multiple flow statistics identifiers and multiple current limiting statistics identifiers, as well as the relationship between multiple current limiting configuration identifiers, the multiple current limiting statistics identifiers and multiple current limiting strategies are managed; through the command queue 215 of the software side 201, the read and write commands of the software side 201 to the message forwarding hardware 203 and the return results of the read and write commands are stored and managed; through the statistics module 213 of the software side 201, the message statistics register 225 and the current limiting discard statistics register 227 of the message forwarding hardware 203 are periodically queried through the command queue 215, thereby generating the number of messages and bytes of each of the multiple flow statistics identifiers, and the total number of messages, total number of bytes, number of discarded messages and number of discarded bytes of each of the multiple current limiting statistics identifiers. In this way, Figure 2 The statistical service shown can not only maintain high packet forwarding efficiency and flow table unloading efficiency, but also simplify query complexity and save hardware resources by optimizing the statistical process and hardware design.

[0041] See also Figure 1 and Figure 2, for flow statistics, a message statistics register is deployed on the message forwarding hardware to count the number of messages and bytes, so that the flow table hard-converted by the forwarding module on the message forwarding hardware will be accumulated to the flow statistics result of the message statistics register. Then, the forwarding module also transmits the message to the current limiting module on the message forwarding hardware, which is used to perform current limiting configuration and update the discarded message to the current limiting discard statistics register, which is used to provide current limiting statistics results. Therefore, the message statistics register performs cumulative counting of hard-converted flow table matches, and the current limiting discard statistics register performs cumulative counting of discarded messages. Based on the optimization of the above-mentioned hardware design, in terms of software design, two types of identifiers are provided through the statistics module on the software side, one is a flow statistics identifier and the other is a current limiting statistics identifier. The flow statistics identifier corresponds to the flow statistics result, and the current limiting statistics identifier corresponds to the current limiting statistics result. Each message data flow can be distinguished by the flow identifier, that is, the message data packets with the same flow identifier belong to the same message data flow. Each flow ID must have a valid flow statistics ID to provide the corresponding flow statistics results. However, each flow ID may not have a valid current limiting statistics ID. When a flow ID does not have a valid current limiting statistics ID, it means that the message data flow corresponding to the flow ID has no current limiting strategy, and there is no need for the current limiting module to perform current limiting operations. The statistics module on the software side, on the one hand, counts the number of messages and bytes collected by the message statistics register and matched by the hardware flow table. A feasible data format is "flow statistics ID-message number-byte number"; on the other hand, it counts the number of messages and bytes collected by the current limiting discard statistics register and matched by the hardware flow table and then discarded by the current limiting operation. A feasible data format is "current limiting statistics ID-total number of messages-total number of bytes-discarded number of messages-discarded number of bytes". Therefore, the statistics module is mainly responsible for storing and maintaining two data models, one is "flow statistics identifier-number of packets-number of bytes", which is used to perform superposition calculations on flow statistics that reference the current limiting configuration, and the other is "current limiting statistics identifier-total number of packets-total number of bytes-number of discarded packets-number of discarded bytes", which is used to count the number of packets and bytes discarded by the current limiting configuration due to the current limiting rules, and also count the total number of packets and total bytes that have passed the current limiting configuration. It can be seen that the internal logical relationship between these data models is established through the flow statistics identifier, the current limiting statistics identifier, and the correspondence between the flow statistics identifier and the current limiting statistics identifier, which helps to utilize the redundant characteristics of flow statistics data and current limiting statistics data, reduce the number of statistics registers, save hardware resources, and also reduce the number of statistical data queries. Combined with the command queue batch periodic query method, the efficiency of statistical data query can be improved, which helps to provide correct flow statistics results and current limiting statistics results for upper-layer applications.

[0042] Continue reading Figure 1 and Figure 2The flow table module is also responsible for managing the relationship between multiple flow statistics identifiers and current limiting statistics identifiers, that is, managing the relationship between multiple flow identifiers, multiple flow statistics identifiers and multiple current limiting statistics identifiers. Here, one current limiting statistics identifier can correspond to multiple flow statistics identifiers, so that the number of discarded packets and the number of discarded bytes of each of the multiple flow statistics identifiers will be counted into the number of discarded packets and the number of discarded bytes of the current limiting statistics identifier. The flow table module is also responsible for managing the relationship between multiple current limiting configuration identifiers, the multiple current limiting statistics identifiers and multiple current limiting strategies, for example, through the data format of "current limiting configuration identifier-current limiting statistics identifier-current limiting strategy", so that the current limiting configuration specified by the user can be distinguished through the current limiting configuration identifier, and the current limiting statistics identifier can be used to meet the internal allocation needs and statistical needs, and the current limiting strategy can be used to unload the current limiting module on the network to the message forwarding hardware to execute the corresponding current limiting strategy and current limiting operation. The timing and process of flow statistics unloading and current limiting statistics unloading are different. Through the optimization of the above-mentioned hardware design and software design, the different processes of flow statistics unloading and current limiting statistics unloading can be well handled. Among them, flow statistics unloading is started when the first packet of the message is sent, and current limiting statistics unloading is started when the user configures the current limiting policy, that is, the current limiting policy takes effect. The process of starting flow statistics unloading includes that the flow table module on the software side allocates a flow statistics identifier for the first packet and tries to obtain the corresponding current limiting statistics identifier. If the corresponding current limiting policy is not effective, there is no current limiting statistics identifier. If there is, the flow statistics identifier and the current limiting statistics identifier are unloaded together to the forwarding module of the message forwarding hardware. The process of starting current limiting statistics unloading means allocating corresponding current limiting statistics identifiers to one or more existing flow statistics identifiers, so it is necessary to initialize the hardware current limiting discard statistics register and configure the current limiting algorithm on the current limiting module, such as various algorithms such as single-color bucket, two-color bucket, and three-color bucket. The message statistics register and current limiting discard statistics register on the message forwarding hardware provide hardware statistics results, which are periodically obtained by the software side through a specific mechanism. Specifically, the statistics module on the software side reads the hardware statistics results in a command queue manner. The combination of the flow statistics identifier and the current limiting statistics identifier to be queried is combined with the read action to generate a read command, thereby reading the statistical value of the corresponding register.

[0043] Continue reading Figure 1 and Figure 2, through the above-mentioned software and hardware combination design, the forwarding module on the message forwarding hardware is only responsible for hard transfer and cooperates with the message statistics register to provide flow statistics results, the current limiting module is only responsible for current limiting configuration and cooperates with the current limiting discard statistics register to provide current limiting statistics results, then, the flow table module on the software side is responsible for soft transfer and unloading of hard transfer flow tables, and is also responsible for managing the relationship between flow statistics identifiers and current limiting statistics identifiers, while the statistics module is responsible for periodically obtaining statistical values ​​based on the command queue to meet the statistical needs of upper-layer services. In this way, the decoupled design of flow table forwarding and current limiting management is realized, the complexity of software and hardware is simplified, the hard transfer flow table can be updated at any time, and flow statistics can be started or terminated, and the current limiting configuration can be updated at any time, and current limiting statistics can be started or terminated. There is no conflict between the two because of the decoupled design. In addition, the statistics module can obtain real-time hardware statistics through various possible command combinations in the command queue to provide statistical basis for the decision-making of upper-layer services. The following is further explained in detail in conjunction with Table 1:

[0044] Table 1

[0045]

[0046] Refer to Table 1 above. Here, Flow1, Flow2, Flow3 and Flow4 represent multiple flow identifiers. Each message data flow can be distinguished by the flow identifier, that is, the message data packets with the same flow identifier belong to the same message data flow. Flow statistics ID1, flow statistics ID2, flow statistics ID3, and flow statistics ID4 represent multiple flow statistics identifiers. The flow statistics identifiers correspond to the flow statistics results. Each flow identifier must have a valid flow statistics identifier to provide the corresponding flow statistics results. Current limiting ID1 and current limiting ID3 represent multiple current limiting statistics identifiers. The current limiting statistics identifiers correspond to the current limiting statistics results. Each flow identifier must have a valid flow statistics identifier to provide the corresponding flow statistics results. However, each flow identifier does not necessarily have a valid current limiting statistics identifier. Because when a certain flow identifier does not have a valid current limiting statistics identifier, it means that the message data flow corresponding to the flow identifier has no current limiting strategy, and there is no need for the current limiting module to perform current limiting operations. Meter1 and Meter3 represent current limiting configuration identifiers. The current limiting configuration identifiers are used to distinguish the user-specified current limiting configurations. Reference Figure 1 , Figure 2As shown in Table 1, the flow table module is also responsible for managing the relationship between multiple flow statistics identifiers and current limiting statistics identifiers, that is, managing the relationship between multiple flow identifiers, multiple flow statistics identifiers and multiple current limiting statistics identifiers, which can be achieved through the data format of "flow identifier-flow statistics identifier-current limiting statistics identifier". Table 1 exemplifies "Flow1-Flow Statistics ID1-Current Limiting ID1". The flow table module is also responsible for managing the relationship between multiple current limiting configuration identifiers, the multiple current limiting statistics identifiers and multiple current limiting strategies, for example, through the data format of "current limiting configuration identifier-current limiting statistics identifier-current limiting strategy". In this way, the current limiting configuration identifier can be used to distinguish the user-specified current limiting configuration, and the current limiting statistics identifier can be used to meet the internal allocation needs and statistical needs, while the current limiting strategy can be used to unload the network to the current limiting module on the message forwarding hardware to execute the corresponding current limiting strategy and current limiting operation. Table 1 exemplifies "Meter1-Current Limiting ID1-Current Limiting Strategy 1". The statistics module is mainly responsible for storing and maintaining two data models. One is "flow statistics identifier-number of packets-number of bytes", which is used to perform superposition calculations on flow statistics that reference the current limiting configuration. Table 1 shows an example of "flow statistics ID1-number of packets C1-number of bytes B1"; the other is "current limiting statistics identifier-total number of packets-total number of bytes-number of discarded packets-number of discarded bytes", which is used to count the number of packets and bytes discarded by the current limiting configuration due to the current limiting rules, and also count the total number of packets and total bytes that have passed the current limiting configuration. Table 1 shows an example of "current limiting ID1-total number of packets C5-total number of bytes B5-number of discarded packets C6-number of discarded bytes B6".

[0047] Continuing to refer to Table 1, the internal logical relationship between these data models is established through the flow statistics identifier, the current limiting statistics identifier, and the corresponding relationship between the flow statistics identifier and the current limiting statistics identifier, which helps to utilize the redundant characteristics of flow statistics data and current limiting statistics data, reduce the number of statistics registers, save hardware resources, and also reduce the number of statistical data query times. Combined with the command queue batch periodic query method, the efficiency of statistical data query can be improved, which helps to provide correct flow statistics results and current limiting statistics results for upper-layer applications. For example, flow statistics identifier 3 (flow statistics ID3 in Table 1) and flow statistics identifier 4 (flow statistics ID4 in Table 1) correspond to current limiting statistics identifier 3 (current limiting ID3 in Table 1). Based on the message statistics register, the number of messages C3 of flow statistics identifier 3 (flow statistics ID3 in Table 1) and the number of messages C4 of flow statistics identifier 4 (flow statistics ID4 in Table 1) are used to calculate the total number of messages C7 of current limiting statistics identifier 3 (current limiting ID3 in Table 1). Table 1 shows with arrows and boxes that the number of messages C3 and the number of messages C4 are used to calculate the total number of messages C7. Similarly, because the flow statistics identifier 3 (flow statistics ID3 in Table 1) and the flow statistics identifier 4 (flow statistics ID4 in Table 1) correspond to the current limiting statistics identifier 3 (current limiting ID3 in Table 1), based on the packet statistics register, the byte number B3 of the flow statistics identifier 3 (flow statistics ID3 in Table 1) and the byte number B4 of the flow statistics identifier 4 (flow statistics ID4 in Table 1) are used to calculate the total byte number B7 of the current limiting statistics identifier 3 (current limiting ID3 in Table 1), as shown by arrows and boxes in Table 1, and the byte number B3 and the byte number B4 are used to calculate the total byte number B7. On the other hand, the number C8 of discarded packets of the current limiting statistics identifier 3 (current limiting ID3 in Table 1) is obtained by obtaining the record of the current limiting statistics identifier 3 (current limiting ID3 in Table 1) in the current limiting discard statistics register, as shown by the arrow in Table 1. In addition, the discarded byte number B8 of the current limiting statistic identifier 3 (current limiting ID3 in Table 1) is obtained by obtaining the record of the current limiting statistic identifier 3 (current limiting ID3 in Table 1) in the current limiting discard statistics register, as shown by the arrow in Table 1. In addition, Table 1 also schematically shows that because "Meter3-current limiting ID3-current limiting strategy 3" is recorded in the flow table module, the current limiting module on the message transceiver hardware performs current limiting operation on the flow corresponding to the flow system ID corresponding to the current limiting ID3 according to the current limiting strategy 3, that is, according to the current limiting strategy 3, the flow corresponding to the flow system ID3 corresponding to the current limiting ID3 and the flow corresponding to the flow system ID4 are limited.In this way, through the relationship between multiple flow identifiers, multiple flow statistics identifiers and multiple current limiting statistics identifiers managed by the flow table module, as well as the relationship between multiple current limiting configuration identifiers, the multiple current limiting statistics identifiers and multiple current limiting strategies managed by the flow table module, an internal logical relationship between these data models is established. This helps to utilize the redundant characteristics of flow statistics data and current limiting statistics data, reduce the number of statistical registers, save hardware resources, and utilize the internal logical relationship to improve the efficiency of statistical data query, for example, by determining the current limiting statistics identifier corresponding to the current limiting strategy and then determining the corresponding flow statistics identifier and the corresponding flow identifier, and then executing the corresponding current limiting strategy and current limiting operation.

[0048] Continuing to refer to Table 1, the decoupled design of flow table forwarding and current limiting management simplifies the complexity of software and hardware. The hard-converted flow table can be updated at any time and flow statistics can be started or terminated, and the current limiting configuration can be updated at any time and current limiting statistics can be started or terminated. The two do not conflict because of the decoupled design. For example, the hard-converted flow table can be updated at any time, so that flow system ID3 and flow system ID4 in Table 1 correspond to different flows, and the speed limit configuration is not affected. For another example, assuming that at a certain moment, the user changes the speed limit configuration, and flow system ID3 and flow system ID4 originally correspond to current limiting ID3, and current limiting ID3 corresponds to current limiting strategy 3 based on Meter3, that is, current limiting configuration identifier 3, then the corresponding current limiting strategy can be updated through the flow table module, and then the current limiting configuration of the current limiting module on the message forwarding hardware can be updated. In this way, the current limiting module can perform current limiting operations on Flow3 corresponding to flow system ID3 and Flow4 corresponding to flow system ID4 according to the updated current limiting configuration. In addition, by starting from the time point of starting the new current limiting configuration, the current limiting discard statistics register of the message receiving and sending hardware is initialized, so that the hardware statistics result includes the number of discarded messages and the number of discarded bytes under the latest current limiting configuration. As for the message statistics register, the number of messages and bytes of flow system ID3 and flow system ID4 are still being collected. This is because the update and modification of the current limiting configuration does not affect the flow table forwarding result. In other words, by utilizing the decoupled design of flow table forwarding and current limiting management, it is possible to update the current limiting configuration in a timely manner and send the updated current limiting configuration to the message forwarding hardware. At the same time, the current limiting discard statistics register is initialized to provide the current limiting statistics result based on the updated current limiting configuration. Moreover, the update of the current limiting configuration does not affect the flow table forwarding or the flow statistics result. The current limiting configuration can be flexibly applied and released, and the software side can obtain the latest statistical results under the current limiting configuration, because the total number of messages and the total number of bytes are calculated by the cumulative count of the message statistics register based on the hard-transfer flow table match, thus simplifying the register complexity, and can provide the corresponding current limiting statistics according to the latest current limiting configuration, that is, the statistical result of the cumulative count of discarded messages through the current limiting discard statistics register. In this way, it is conducive to adapting various current limiting configurations, reducing the resource occupation of hardware, while retaining the hard-transfer function, which is conducive to improving the efficiency of message forwarding.

[0049] Additionally, the number of bits of hardware statistics data can be smaller than the number of bits of software statistics data, so that the extra space can be used to record the hardware statistics results read previously, which is conducive to providing policy references. Additionally, in order to utilize limited register resources, the message statistics register and the current limiting discard statistics register on the hardware can be designed to automatically clear after reading the register, so that what is read is an increment, and the software statistics module can accumulate the increment to the corresponding flow statistics identifier and the record of the current limiting statistics identifier. In summary, the specific embodiment of the present application provides a hardware unloading method, device and medium for flow statistics and current limiting statistics, realizes the decoupling design of flow table forwarding and current limiting management, simplifies the complexity of software and hardware, can update the hard transfer flow table at any time, and start or terminate flow statistics, and can update the current limiting configuration at any time and start or terminate current limiting statistics, which do not conflict with each other. The statistics module can obtain real-time hardware statistics results to make decisions through command combination. In this way, not only can a high message forwarding efficiency and flow table unloading efficiency be maintained, but also the query complexity is simplified and hardware resources are saved through the optimization of the statistical process and the optimization of hardware design.

[0050] See also Figure 1 , Figure 2 As shown in Table 1, in a possible implementation, the flow statistics result recorded by the message statistics register includes the number of messages and bytes of each of the multiple flow statistics identifiers, and the flow limiting statistics result recorded by the flow limiting discard statistics register includes the number of discarded messages and the number of discarded bytes of each of the multiple flow limiting statistics identifiers. In this way, the decoupled design of flow table forwarding and flow limiting management is realized, the complexity of software and hardware is simplified, and the hard-converted flow table can be updated at any time and the flow statistics can be started or terminated, and the flow limiting configuration can be updated at any time and the flow limiting statistics can be started or terminated, and the two do not conflict. The statistical module can obtain real-time hardware statistical results to make decisions through command combinations. In this way, not only can a high message forwarding efficiency and flow table unloading efficiency be maintained, but also the query complexity is simplified and hardware resources are saved through the optimization of the statistical process and the optimization of hardware design.

[0051] In a possible implementation, the relationship between the multiple flow identifiers, the multiple flow statistics identifiers and the multiple current limiting statistics identifiers managed by the flow table module includes: each of the multiple flow identifiers corresponds to a valid flow statistics identifier among the multiple flow statistics identifiers, and whether each of the multiple flow identifiers has a valid current limiting statistics identifier among the multiple current limiting statistics identifiers, wherein each of the multiple current limiting statistics identifiers corresponds to one or more valid flow statistics identifiers among the multiple flow statistics identifiers. In this way, the decoupled design of flow table forwarding and current limiting management is realized, the complexity of software and hardware is simplified, and the hard-converted flow table can be updated at any time and flow statistics can be started or terminated, and the current limiting configuration can be updated at any time and current limiting statistics can be started or terminated, and the two do not conflict. The statistics module can obtain real-time hardware statistics results to make decisions through command combination. In this way, not only can a high message forwarding efficiency and flow table unloading efficiency be maintained, but also the query complexity is simplified and hardware resources are saved through the optimization of the statistical process and the optimization of hardware design.

[0052] In a possible implementation, the statistical module calculates the total number of messages and the total number of bytes of each of the multiple current limiting statistical identifiers based on the number of messages and the number of bytes of each of the valid flow statistical identifiers in the multiple flow statistical identifiers corresponding to each of the multiple current limiting statistical identifiers. In this way, the relationship between the multiple flow identifiers, multiple flow statistical identifiers and multiple current limiting statistical identifiers managed by the flow table module, and the relationship between the multiple current limiting configuration identifiers, the multiple current limiting statistical identifiers and multiple current limiting strategies managed by the flow table module, establishes an internal logical relationship between these data models, which helps to utilize the redundant characteristics of flow statistical data and current limiting statistical data, reduce the number of statistical registers, save hardware resources, and utilize the internal logical relationship to improve the efficiency of statistical data query, for example, by determining the current limiting statistical identifier corresponding to the current limiting strategy and then determining the corresponding flow statistical identifier and the corresponding flow identifier, and then executing the corresponding current limiting strategy and current limiting operation.

[0053] In a possible implementation, when a first flow identifier among the multiple flow identifiers does not have a valid flow limiting statistical identifier among the multiple flow limiting statistical identifiers, the first flow identifier has no flow limiting strategy, and the flow limiting module does not perform flow limiting operations on the message matching the first flow identifier transmitted from the forwarding module. In this way, the decoupled design of flow table forwarding and flow limiting management is utilized to simplify the complexity of software and hardware, and the hard-converted flow table can be updated at any time and flow statistics can be started or terminated, and the flow limiting configuration can be updated at any time and flow limiting statistics can be started or terminated, and there is no conflict between the two due to the decoupled design.

[0054] In a possible implementation, the relationship between the multiple flow identifiers, the multiple flow statistics identifiers, and the multiple current limiting statistics identifiers managed by the flow table module is expressed in the data format of flow identifier-flow statistics identifier-valid current limiting statistics identifier / invalid current limiting statistics identifier, and the relationship between the multiple current limiting configuration identifiers, the multiple current limiting statistics identifiers, and the multiple current limiting strategies managed by the flow table module is expressed in the data format of current limiting configuration identifier-current limiting statistics identifier-current limiting strategy. In this way, the decoupled design of flow table forwarding and current limiting management is realized, the complexity of software and hardware is simplified, and the hard-converted flow table can be updated at any time and the flow statistics can be started or terminated, and the current limiting configuration can be updated at any time and the current limiting statistics can be started or terminated, and the two do not conflict. The statistics module can obtain real-time hardware statistics results to make decisions through command combination. In this way, not only can a high message forwarding efficiency and flow table unloading efficiency be maintained, but also the query complexity is simplified and hardware resources are saved through the optimization of the statistical process and the optimization of hardware design.

[0055] In a possible implementation, the hardware unloading method further includes: in response to the current limiting policy configuration operation, through the flow table module, allocating a current limiting statistical identifier for the current limiting configuration identifier and the current limiting policy specified by the current limiting policy configuration operation, then updating the relationship between the multiple current limiting configuration identifiers, the multiple current limiting statistical identifiers and the multiple current limiting policies managed by the flow table module, and then updating the current limiting configuration unloaded to the current limiting module. In this way, the optimization of current limiting statistical unloading is achieved, and the user configures the current limiting policy (for example, specifies the current limiting configuration identifier and the current limiting policy), which is passed to the flow table module after numerical conversion; the flow table module allocates the current limiting statistical identifier to the converted current limiting policy, then stores the corresponding information, and unloads the current limiting table. The current limiting table unloading is mainly divided into two parts: one part is to initialize the current limiting discard statistical register corresponding to the current limiting statistical identifier, and the other part is to configure the current limiting module with, for example, a dual-speed three-color current limiting bucket algorithm. In this way, not only can a high message forwarding efficiency and flow table unloading efficiency be maintained, but also the query complexity is simplified and hardware resources are saved by optimizing the statistical process and hardware design.

[0056] In some embodiments, the hardware unloading method further includes: adding the initialization action command of the current limiting discard statistics register to the command queue, obtaining the initialization action command of the current limiting discard statistics register from the command queue through the message forwarding hardware, and then performing the initialization operation on the current limiting discard statistics register. In this way, the initialization operation of the optimization aspect of the current limiting statistics unloading is realized. Steps for initializing the current limiting discard statistics register: the statistics module composes a command with the address of the current limiting discard statistics register to be initialized and the initialization action, and puts it into the command queue; the statistics module notifies the hardware to execute the command; the hardware obtains the command to be executed through, for example, direct memory access; the hardware initializes the current limiting discard statistics register. In this way, not only can a high message forwarding efficiency and flow table unloading efficiency be maintained, but also the query complexity is simplified and hardware resources are saved through the optimization of the statistical process and the optimization of the hardware design.

[0057] In a possible implementation, the hardware unloading method further includes: in response to the first packet of the message being sent up from the forwarding module, through the flow table module, allocating a flow statistics identifier for the first packet of the message specified by the first packet of the message being sent up and obtaining a flow limiting statistics identifier associated with the first packet of the message, and then updating the relationship between the multiple flow identifiers, the multiple flow statistics identifiers, and the multiple flow limiting statistics identifiers managed by the flow table module. In this way, the forwarding of the first packet in the flow statistics unloading process is achieved. When the hardware receives the first packet of the message, the forwarding module matches and searches for the message; when the forwarding module cannot hit the flow table configuration to be unloaded, the forwarding module sends the message to the flow table module on the software side; the flow table module queries its own soft-conversion flow table configuration, calculates the execution action, allocates a flow statistics identifier, and obtains the corresponding flow limiting statistics identifier, and sends the flow statistics identifier and the flow limiting statistics identifier together with the flow table configuration to the forwarding module to perform flow table unloading. During the unloading process, the flow statistics also need to be unloaded, which mainly involves two operations: one is to initialize the packet statistics register corresponding to the flow statistics identifier, and the other is to carry the flow statistics identifier to the unloaded flow table. In this way, not only can the high packet forwarding efficiency and flow table unloading efficiency be maintained, but also the query complexity is simplified and hardware resources are saved by optimizing the statistical process and hardware design.

[0058] In some embodiments, the hardware unloading method further includes: adding the initialization action command of the message statistics register to the command queue, obtaining the initialization action command of the message statistics register from the command queue through the message forwarding hardware, and then performing the initialization operation on the message statistics register. The step of initializing the message statistics register includes: the statistics module composes a command with the address of the message statistics register to be initialized and the initialization action, and puts it into the command queue; the statistics module notifies the hardware to execute the command; the hardware obtains the command to be executed by, for example, direct memory access; the hardware initializes the message statistics register. Here, the unloading of flow statistics has been completed. Then, how to forward the first packet after it is sent up can be processed. Specifically, the message is soft-transferred by the flow table module and sent to the forwarding module; the forwarding module will skip the flow table configuration matching, and the message is passed to the current limiting module; after passing the current limiting module, if it is not discarded by the current limiting, it is forwarded. In this way, not only can a high message forwarding efficiency and flow table unloading efficiency be maintained, but also the query complexity is simplified and hardware resources are saved by optimizing the statistical process and hardware design.

[0059] In a possible implementation, the statistical module on the software side periodically queries the message statistics register and the current limiting and discarding statistics register of the message forwarding hardware through the command queue, thereby generating the message count and byte count of each of the multiple flow statistics identifiers, the total message count, the total byte count, the discarded message count and the discarded byte count of each of the multiple current limiting statistics identifiers, including: obtaining the multiple flow statistics identifiers through the statistical module, and then obtaining the message count and byte count of each of the multiple flow statistics identifiers in batches through the command queue, and then using the obtained message count and byte count of each of the multiple flow statistics identifiers to update the internal flow statistics results of the statistical module, and based on the relationship between the multiple current limiting configuration identifiers managed by the flow table module, the multiple current limiting statistics identifiers and the multiple current limiting policies, updating the internal current limiting statistics results of the statistical module. Here, the process of updating the message statistics register and the current limiting discard statistics register is generally as follows: the forwarding module receives the message; the forwarding module matches the message and finds the corresponding execution action, which carries the flow statistics identifier and the current limiting statistics identifier; the forwarding module accumulates the number of messages and bytes in the message statistics register according to the flow statistics identifier; the forwarding module passes the message and the current limiting statistics identifier to the current limiting module; in the current limiting module, if a current limiting discard action occurs, the current limiting module accumulates the number of messages and bytes in the current limiting discard statistics register according to the current limiting statistics identifier, and the message is discarded and no longer forwarded; the message that does not undergo current limiting discard is forwarded. In this way, after the hardware statistics are updated, they are finally used to read the software statistics. The statistics module has a periodic timing task. When the task is triggered, the statistics module reads the statistical data of the hardware through the command queue. Specifically: the flow statistics identifier or current limiting statistics identifier to be queried and the read action are combined into a command and placed in the command queue; the statistics module notifies the hardware to execute the command; the hardware reads the command in the command queue; the hardware reads the message statistics register or current limiting statistics register according to the identifier and writes the data back to the command queue; the statistics module parses the returned data in the command queue to obtain statistical data. The above can be referred to as reading statistical values ​​through the collaboration between the command queue and the hardware. In this way, not only can a high message forwarding efficiency and flow table unloading efficiency be maintained, but also the query complexity is simplified and hardware resources are saved through the optimization of the statistical process and the optimization of hardware design.

[0060] In a possible implementation, the statistical module on the software side periodically queries the message statistical register and the current limiting discard statistical register of the message forwarding hardware through the command queue, thereby generating the message number and byte number of each of the multiple flow statistical identifiers, the total message number, total byte number, discarded message number and discarded byte number of each of the multiple current limiting statistical identifiers, and further includes: obtaining the multiple current limiting statistical identifiers through the statistical module, and then obtaining the discarded message number and discarded byte number of each of the multiple current limiting statistical identifiers in batches through the command queue, and then, using the obtained discarded message number and discarded byte number of each of the multiple current limiting statistical identifiers, based on the relationship between the multiple current limiting configuration identifiers, the multiple current limiting statistical identifiers and the multiple current limiting strategies managed by the flow table module, the internal current limiting statistical results of the statistical module are updated. In this way, the software periodically updates the statistical value, which can not only maintain a high message forwarding efficiency and flow table unloading efficiency, but also simplify the query complexity and save hardware resources through the optimization of the statistical process and the optimization of hardware design.

[0061] In a possible implementation, the statistical module is used to provide statistical values ​​associated with the query request, including: querying the flow table module based on the flow identifier indicated by the query request to determine the flow statistical identifier corresponding to the flow identifier indicated by the query request, thereby providing the number of messages and bytes associated with the query request. In this way, not only can a high message forwarding efficiency and flow table unloading efficiency be maintained, but also the query complexity is simplified and hardware resources are saved by optimizing the statistical process and optimizing the hardware design.

[0062] In some embodiments, the statistical module is used to provide statistical values ​​associated with the query request, and further includes: querying the flow table module based on the current limiting configuration identifier indicated by the query request to determine the current limiting statistical identifier corresponding to the current limiting configuration identifier indicated by the query request, thereby providing the total number of messages, total number of bytes, number of discarded messages, and number of discarded bytes associated with the query request. In this way, not only can a high message forwarding efficiency and flow table unloading efficiency be maintained, but also the query complexity is simplified and hardware resources are saved by optimizing the statistical process and hardware design.

[0063] In a possible implementation, the flow statistics result indicates the cumulative count of hard-forwarded flow table matches passing through the forwarding module, and the current limiting statistics result indicates the cumulative count of discarded packets. In this way, not only can a high packet forwarding efficiency and flow table unloading efficiency be maintained, but also query complexity is simplified and hardware resources are saved by optimizing the statistical process and hardware design.

[0064] In a possible implementation, the current limiting configuration is based on a dual-rate three-color bucket algorithm, so that various current limiting strategies and algorithms can be adapted.

[0065] In a possible implementation manner, the message forwarding hardware is a Smart Network Interface Card (SNIC), so that various dedicated hardware can be adapted.

[0066] In a possible implementation, the software side is a virtual switch (Openvswitch, OVS) and a data plane development tool set (Data Plane Development Kit, DPDK). In this way, various virtualization products and services can be adapted.

[0067] Figure 3 3 is a schematic diagram of the structure of a computing device provided in an embodiment of the present application, and the computing device 300 includes: one or more processors 310, a communication interface 320 and a memory 330. The processor 310, the communication interface 320 and the memory 330 are interconnected via a bus 340. Optionally, the computing device 300 may also include an input / output interface 350, and the input / output interface 350 is connected to an input / output device for receiving parameters set by a user, etc. The computing device 300 can be used to implement some or all of the functions of the device embodiment or system embodiment in the above-mentioned embodiment of the present application; the processor 310 can also be used to implement some or all of the operating steps of the method embodiment in the above-mentioned embodiment of the present application. For example, the specific implementation of the various operations performed by the computing device 300 can refer to the specific details in the above-mentioned embodiments, such as the processor 310 is used to perform some or all of the steps in the above-mentioned method embodiment or some or all of the operations in the above-mentioned method embodiment. For another example, in an embodiment of the present application, the computing device 300 may be used to implement part or all of the functions of one or more components in the above-mentioned apparatus embodiment. In addition, the communication interface 320 may be specifically used to perform the communication functions necessary to implement the functions of these apparatuses and components, and the processor 310 may be specifically used to perform the processing functions necessary to implement the functions of these apparatuses and components.

[0068] It should be understood that Figure 3 The computing device 300 may include one or more processors 310, and the multiple processors 310 may provide processing capabilities in a parallel connection mode, a serial connection mode, a serial-parallel connection mode, or any connection mode, or the multiple processors 310 may form a processor sequence or a processor array, or the multiple processors 310 may be divided into a main processor and an auxiliary processor, or the multiple processors 310 may have different architectures such as a heterogeneous computing architecture. In addition, Figure 3The computing device 300 shown in the figure, and the related structural description and functional description are exemplary and non-limiting. In some exemplary embodiments, the computing device 300 may include Figure 3 More or fewer components may be shown, or some components may be combined or separated, or may have a different arrangement of components.

[0069] The processor 310 may have a variety of specific implementation forms. For example, the processor 310 may include a central processing unit (CPU), a graphic processing unit (GPU), a neural-network processing unit (NPU), a tensor processing unit (TPU) or a data processing unit (DPU), etc., and the embodiment of the present application does not specifically limit it. The processor 310 may also be a single-core processor or a multi-core processor. The processor 310 may be a combination of a CPU and a hardware chip. The above-mentioned hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD) or a combination thereof. The above-mentioned PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof. The processor 310 may also be implemented using a logic device with built-in processing logic alone, such as an FPGA or a digital signal processor (DSP). The communication interface 320 may be a wired interface or a wireless interface for communicating with other modules or devices. The wired interface may be an Ethernet interface, a local interconnect network (LIN), etc., and the wireless interface may be a cellular network interface or a wireless local area network interface, etc.

[0070] The memory 330 may be a non-volatile memory, such as a read-only memory (ROM), a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The memory 330 may also be a volatile memory, which may be a random access memory (RAM) used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate synchronous DRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), and direct rambus RAM (DR RAM). The memory 330 may also be used to store program codes and data, so that the processor 310 calls the program codes stored in the memory 330 to execute some or all of the operation steps in the above method embodiment, or to execute the corresponding functions in the above device embodiment. Figure 3 Show more or fewer components, or have different component configurations.

[0071] The bus 340 may be a peripheral component interconnect express (PCIe) bus, an extended industry standard architecture (EISA) bus, a unified bus (Ubus or UB), a compute express link (CXL), a cache coherent interconnect for accelerators (CCIX), etc. The bus 340 may be divided into an address bus, a data bus, a control bus, etc. In addition to the data bus, the bus 340 may also include a power bus, a control bus, and a status signal bus, etc. However, for the sake of clarity, Figure 3 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0072] The method and device provided in the embodiments of the present application are based on the same inventive concept. Since the principles of solving the problems in the methods and devices are similar, the embodiments, implementation methods, examples or implementation methods of the methods and devices can refer to each other, and the repeated parts will not be repeated. The embodiments of the present application also provide a system, which includes multiple computing devices, and the structure of each computing device can refer to the structure of the computing device described above. The functions or operations that can be implemented by the system can refer to the specific implementation steps in the above method embodiments and / or the specific functions described in the above device embodiments, which will not be repeated here.

[0073] The present application also provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on a computer device (such as one or more processors), the method steps in the above method embodiment can be implemented. The specific implementation of the processor of the computer-readable storage medium in executing the above method steps can refer to the specific operations described in the above method embodiment and / or the specific functions described in the above device embodiment, which will not be repeated here.

[0074] It should be understood by those skilled in the art that the embodiments of the present application may be provided as methods, systems, or computer program products. The present application may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. The embodiments of the present application may be implemented in whole or in part by software, hardware, firmware, or any other combination. When implemented using software, the above embodiments may be implemented in whole or in part in the form of a computer program product. The present application may take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program codes. The computer program product includes one or more computer instructions. When the computer program instructions are loaded or executed on a computer, the process or function described in the embodiments of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. 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, computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. Computer-readable storage media can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that contains one or more available media. Available media can be magnetic media (such as floppy disks, hard disks, tapes), optical media, or semiconductor media. Semiconductor media can be solid-state hard disks, random access memory, flash memory, read-only memory, erasable programmable read-only memory, electrically erasable programmable read-only memory, registers, or any other form of suitable storage media.

[0075] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. Each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including an instruction device, which implements the functions specified in the process. Figure 1A process or multiple processes and / or boxes Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0076] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. Obviously, those skilled in the art can make various changes and modifications to the embodiments of the present application without departing from the spirit and scope of the embodiments of the present application. The steps in the method of the embodiment of the present application can be adjusted in order, merged or deleted according to actual needs; the modules in the system of the embodiment of the present application can be divided, merged or deleted according to actual needs. If these modifications and variations of the embodiments of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application is also intended to include these modifications and variations.

Claims

1. A hardware offloading method for flow statistics and flow limiting statistics, characterized in that: The hardware uninstallation method comprises: By means of a forwarding module of the message forwarding hardware, based on a forwarding configuration table unloaded to the message forwarding hardware, hard forwarding of messages is performed; and by means of a current limiting module of the message forwarding hardware connected to the forwarding module, based on a current limiting configuration unloaded to the current limiting module, a current limiting operation is performed on messages transmitted from the forwarding module, thereby discarding messages that reach a current limiting threshold; By means of a message statistics register of the message forwarding hardware connected to the forwarding module, the number of messages and the number of bytes that have been hard-forwarded by the forwarding module are accumulated and counted to obtain a flow statistics result; and, by means of a current limiting discard statistics register of the message forwarding hardware connected to the current limiting module, the number of messages and the number of bytes discarded by the current limiting module are accumulated and counted to obtain a current limiting statistics result; Through a flow table module on the software side that interacts with the message forwarding hardware, manage the forwarding configuration table for unloading to the message forwarding hardware, manage the relationship between multiple flow identifiers, multiple flow statistics identifiers, and multiple current limiting statistics identifiers, and manage the relationship between multiple current limiting configuration identifiers, the multiple current limiting statistics identifiers, and multiple current limiting strategies; The command queue of the software side is used to store and manage the read and write commands from the software side to the message forwarding hardware and the return results of the read and write commands; By means of the statistics module on the software side, the message statistics register and the current limiting and discarding statistics register of the message forwarding hardware are periodically queried through the command queue, thereby generating the number of messages and the number of bytes of each of the multiple flow statistics identifiers, the total number of messages, the total number of bytes, the number of discarded messages, and the number of discarded bytes of each of the multiple current limiting statistics identifiers, The flow statistics result recorded by the message statistics register includes the number of messages and the number of bytes of each of the multiple flow statistics identifiers, and the current limiting statistics result recorded by the current limiting and discarding statistics register includes the number of discarded messages and the number of discarded bytes of each of the multiple current limiting statistics identifiers. The relationship between the multiple flow identifiers, the multiple flow statistics identifiers and the multiple current limiting statistics identifiers managed by the flow table module includes: each of the multiple flow identifiers corresponds to a valid flow statistics identifier among the multiple flow statistics identifiers, and whether each of the multiple flow identifiers has a valid current limiting statistics identifier among the multiple current limiting statistics identifiers, wherein each of the multiple current limiting statistics identifiers corresponds to one or more valid flow statistics identifiers among the multiple flow statistics identifiers, The statistical module calculates the total number of packets and the total number of bytes of each of the multiple current limiting statistical identifiers based on the number of packets and the number of bytes of each of the valid flow statistical identifiers in the multiple flow statistical identifiers corresponding to each of the multiple current limiting statistical identifiers, The hardware unloading method also includes: in response to the current limiting policy configuration operation, through the flow table module, allocating a current limiting statistical identifier for the current limiting configuration identifier and the current limiting policy specified by the current limiting policy configuration operation, and then updating the relationship between the multiple current limiting configuration identifiers, the multiple current limiting statistical identifiers and the multiple current limiting policies managed by the flow table module, and then, updating the current limiting configuration unloaded to the current limiting module.

2. The hardware uninstallation method according to claim 1, characterized in that: When a first flow identifier among the multiple flow identifiers does not have a valid flow limiting statistical identifier among the multiple flow limiting statistical identifiers, the first flow identifier has no flow limiting strategy, and the flow limiting module does not perform a flow limiting operation on the message matching the first flow identifier transmitted from the forwarding module.

3. The hardware uninstallation method according to claim 1, characterized in that: The relationship between the multiple flow identifiers, the multiple flow statistics identifiers and the multiple current limiting statistics identifiers managed by the flow table module is expressed in the data format of flow identifier-flow statistics identifier-valid current limiting statistics identifier / invalid current limiting statistics identifier, and the relationship between the multiple current limiting configuration identifiers, the multiple current limiting statistics identifiers and the multiple current limiting strategies managed by the flow table module is expressed in the data format of current limiting configuration identifier-current limiting statistics identifier-current limiting strategy.

4. The hardware uninstallation method according to claim 1, characterized in that: The hardware uninstallation method further includes: Adding the initialization action command of the current limiting discard statistics register to the command queue, The initialization action command of the current limiting discarding statistics register is obtained from the command queue through the message forwarding hardware, and then the initialization operation is performed on the current limiting discarding statistics register.

5. The hardware uninstallation method according to claim 1, characterized in that: The hardware uninstallation method further includes: In response to the first packet sending operation from the forwarding module, the flow table module assigns a flow statistics identifier to the first packet specified by the first packet sending operation and obtains the flow limiting statistics identifier associated with the first packet, and then updates the relationship between the multiple flow identifiers, the multiple flow statistics identifiers and the multiple flow limiting statistics identifiers managed by the flow table module.

6. The hardware uninstallation method according to claim 5, characterized in that: The hardware uninstallation method further includes: Adding the initialization action command of the message statistics register to the command queue, The initialization action command of the message statistics register is obtained from the command queue through the message forwarding hardware, and then the initialization operation is performed on the message statistics register.

7. The hardware uninstallation method according to claim 1, characterized in that: By means of the statistics module on the software side, the message statistics register and the current limiting and discarding statistics register of the message forwarding hardware are periodically queried through the command queue, thereby generating the number of messages and the number of bytes of each of the multiple flow statistics identifiers, the total number of messages, the total number of bytes, the number of discarded messages, and the number of discarded bytes of each of the multiple current limiting statistics identifiers, including: The multiple flow statistics identifiers are obtained through the statistics module, and then the number of packets and the number of bytes of each of the multiple flow statistics identifiers are obtained in batches through the command queue. Then, the internal flow statistics results of the statistics module are updated using the obtained number of packets and the number of bytes of each of the multiple flow statistics identifiers, and the internal flow limiting statistics results of the statistics module are updated based on the relationship between the multiple flow limiting configuration identifiers managed by the flow table module, the multiple flow limiting statistics identifiers and the multiple flow limiting strategies.

8. The hardware uninstallation method according to claim 7, characterized in that: By means of the statistics module on the software side, the message statistics register and the current limiting and discarding statistics register of the message forwarding hardware are periodically queried through the command queue, thereby generating the number of messages and the number of bytes of each of the multiple flow statistics identifiers, the total number of messages, the total number of bytes, the number of discarded messages, and the number of discarded bytes of each of the multiple current limiting statistics identifiers, and further comprising: The multiple current limiting statistical identifiers are obtained through the statistical module, and then the number of discarded packets and the number of discarded bytes of each of the multiple current limiting statistical identifiers are obtained in batches through the command queue. Then, based on the multiple current limiting configuration identifiers managed by the flow table module, the multiple current limiting statistical identifiers and the relationship between the multiple current limiting strategies, the internal current limiting statistical results of the statistical module are updated using the obtained number of discarded packets and the number of discarded bytes of each of the multiple current limiting statistical identifiers.

9. The hardware uninstallation method according to claim 1, characterized in that: The statistical module is used to provide statistical values ​​associated with the query request, including: querying the flow table module based on the flow identifier indicated by the query request to determine the flow statistical identifier corresponding to the flow identifier indicated by the query request, thereby providing the number of messages and bytes associated with the query request.

10. The hardware uninstallation method according to claim 9, characterized in that: The statistical module is used to provide statistical values ​​associated with the query request, and also includes: querying the flow table module based on the current limiting configuration identifier indicated by the query request to determine the current limiting statistical identifier corresponding to the current limiting configuration identifier indicated by the query request, thereby providing the total number of messages, total number of bytes, number of discarded messages and number of discarded bytes associated with the query request.

11. The hardware uninstallation method according to claim 1, characterized in that: The flow statistics result indicates the accumulated count of hard-converted flow table matches passing through the forwarding module, and the flow limiting statistics result indicates the accumulated count of discarded packets.

12. The hardware uninstallation method according to claim 1, characterized in that: The current limiting configuration is based on a dual-speed three-color bucket algorithm.

13. The hardware uninstallation method according to claim 1, characterized in that: The message forwarding hardware is an intelligent network interface card.

14. The hardware uninstallation method according to claim 1, characterized in that: The software side is a virtual switching switch and data plane development toolset.

15. A device, characterized in that The device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 14 when executing the computer program.

16. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, which, when executed on a computer device, cause the computer device to perform the method according to any one of claims 1 to 14.

Citation Information

Patent Citations

  • Network card device for supporting complex flow statistic and related complex flow statistic method

    CN102404151A

  • Statistical method and device for realizing data stream discard types based on hardware

    CN110855574A