Network card speed limiting method and device, readable storage medium and computer program product

By isolating the calculation and cache paths from the processing paths, the hardware resource occupation and delay problems caused by data packet caching in the prior art are solved, and low-latency and high-precision network card speed limit processing is achieved.

CN119728576AActive Publication Date: 2025-03-28CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD +1
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202411857963.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2025-03-28
Estimated Expiration
2044-12-17

AI Technical Summary

Technical Problem

Excessive data packet caching in the prior art will lead to increased hardware resource utilization and excessive waiting will lead to increased delay.

Method used

By inputting the packet data stream to be processed in two independent paths for processing, the first path is used to calculate and cache the packet speed limit results, and the second path directly performs the speed limit process based on the cache results, avoiding the delay impact of the calculation path on the processing path.

Benefits of technology

It reduces network path delay, reduces resource usage, improves speed limit accuracy, reduces module dependence and coupling, and improves system robustness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119728576A_ABST
    Figure CN119728576A_ABST
Patent Text Reader

Abstract

The invention provides a network card speed limiting method and device, a readable storage medium and a computer program product. The method comprises the following steps: acquiring packet data streams to be subjected to speed limiting processing, and respectively inputting the packet data streams into a first path and a second path; in the first path, calculating a grouping speed limiting result corresponding to the grouping data flow, and caching the grouping speed limiting result to form a speed limiting caching result set; the packet speed limiting result is a result of discarding the packet data or a result of retaining the packet data; and in the second path, executing corresponding speed limiting processing according to the cache result corresponding to the current grouped data in the speed limiting cache result set. According to the scheme of the invention, the calculation path and the processing path are isolated, the calculation path does not affect the processing path delay, and the reduction of the network path delay is very considerable.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of network communication technology, and in particular to a network card speed limiting method, device, readable storage medium and computer program product. Background Art

[0002] In current cloud computing services, in order to ensure the service quality of multiple tenants, it is usually necessary to limit the network bandwidth and forwarding rate of a single cloud host. At present, smart network cards such as data processing units (DPUs) have unloaded the speed limit function to dedicated chips or field-programmable gate arrays (FPGAs) and other hardware processing. Because many network application scenarios are very sensitive to delays, reducing the network card data packet processing delay is also an important goal for network traffic processing. In order to provide customers with a better user experience, the speed limit accuracy of network traffic must also be guaranteed to be within a certain error range.

[0003] The current network speed limit demand mainly focuses on reasonably planning the sending sequence according to the network speed limit value and the length of the data packet to be forwarded, so that the bandwidth in each unit transmission time is utilized to the maximum extent without exceeding the bandwidth specified by the network speed limit value, avoiding network jitter, and making network traffic transmission smooth. Common speed limit processing functions have large cache modules for traffic caching and realizing traffic shaping and balancing at the same time. Therefore, they also have the following disadvantages: Disadvantage 1: Too much caching and processing during the processing will cause large network delays; Disadvantage 2: Too much caching will occupy system storage resources; Disadvantage 3: In many cases, network data packets need to be processed related to the packet length, such as stripping or adding the outer virtual extended local area network (VXLAN) protocol. If the data packet is not statistically limited at the data outlet, the error will be ignored, resulting in a decrease in speed limit accuracy. Summary of the invention

[0004] At least one embodiment of the present application provides a network card speed limiting method, device, readable storage medium and computer program product, which are used to solve the problem in the prior art that too much data packet caching will lead to increased hardware resource usage, and too much waiting will also lead to increased latency.

[0005] In order to solve the above technical problems, this application is implemented as follows:

[0006] In a first aspect, an embodiment of the present application provides a network card speed limiting method, including:

[0007] Acquire a packet data flow to be processed by rate limiting, and input the packet data flow into a first path and a second path respectively;

[0008] In the first path, a packet speed limit result corresponding to the packet data flow is calculated, and the packet speed limit result is cached to form a speed limit cache result set; the packet speed limit result is a result of discarding the packet data or a result of retaining the packet data;

[0009] In the second path, corresponding speed limit processing is performed according to the cache result corresponding to the current packet data in the speed limit cache result set.

[0010] Optionally, in the first path, calculating a packet rate limiting result corresponding to the packet data flow, and caching the packet rate limiting result to form a rate limiting cache result set, including:

[0011] In the first path, performing packet data statistics on the packet data in the packet data flow to determine a statistical result;

[0012] Calculate the packet rate limit result corresponding to each group of data packets in the statistical result;

[0013] Each group of the group speed limit results is cached to form a speed limit cache result set.

[0014] Optionally, after caching the group speed limit result to form a speed limit cache result set, the method further includes:

[0015] Setting a timed clearing for all the grouped speed limit results or the target grouped speed limit results in the speed limit cache result set; the timed clearing is used to set the current result as the result of retaining the grouped data; the target grouped speed limit result is one of the grouped speed limit results among all the grouped speed limit results;

[0016] After the timed clearing, the corresponding group speed limit result is updated in the speed limit cache result set.

[0017] Optionally, performing group data statistics on the second group data to determine a statistical result includes:

[0018] According to the output rate, performing packet data statistics on the packet data in the packet data stream according to the packet data and the packet length, and determining the statistical result; the statistical result includes a real-time output result or a preset time output result;

[0019] Among them, the real-time output result is used to represent the statistical result containing the number of packets and the actual packet length; the preset time output result is used to represent the statistical result of the grouped data within the preset time, and does not contain the actual data packet.

[0020] Optionally, calculating the group rate limit result corresponding to each group of data packets in the statistical result includes:

[0021] Calculate whether the rate and bandwidth of each group of data packets exceeds the preset configuration speed limit;

[0022] When the preset configured speed limit value is exceeded, determining that the packet speed limit result of the current data packet is a result of discarding the packet data;

[0023] When the preset configured speed limit value is not exceeded, the packet speed limit result of the current data packet is determined to be a result of retaining the packet data.

[0024] Optionally, obtaining a packet data flow to be rate-limited and inputting the packet data flow into a first path and a second path respectively includes:

[0025] Obtain the packet data stream to be processed by rate limiting;

[0026] Mapping is performed according to the network device number to which each group of data in the packet data flow to be processed by speed limit, and the mapped group information is obtained; the group information includes the group number and the group data corresponding to the group number;

[0027] The grouping information is input into the first path and the second path respectively.

[0028] Optionally, in the second path, performing corresponding speed limit processing according to the cache result corresponding to the current packet data in the speed limit cache result set includes:

[0029] In the second path, if the current packet data is the first group of data, determining that the first cache result corresponding to the current packet data is a result of retaining the packet data, and performing an operation of outputting the current packet data; or,

[0030] In the second path, if the current group data is not the first group data, determining a second cache result corresponding to the current group data according to the speed limit cache result set;

[0031] When the second cache result indicates a result of discarding the packet data, performing an operation of discarding the current packet data corresponding to the second cache result;

[0032] When the second cache result indicates that the group data is retained, an operation of outputting the current group data corresponding to the first cache result is performed.

[0033] In a second aspect, an embodiment of the present application further provides a network card speed limiting device, including:

[0034] A first acquisition module, used for acquiring a packet data flow to be processed by speed limiting, and inputting the packet data flow into a first path and a second path respectively;

[0035] A first processing module is used to calculate, in the first path, a packet speed limit result corresponding to the packet data flow, cache the packet speed limit result, and form a speed limit cache result set; the packet speed limit result is a result of discarding packet data or a result of retaining packet data;

[0036] The second processing module is used to perform corresponding speed limit processing in the second path according to the cache result corresponding to the current packet data in the speed limit cache result set.

[0037] In a third aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the network card speed limiting method as described above are implemented.

[0038] In a fourth aspect, an embodiment of the present application further provides a computer program product, comprising computer instructions, which, when executed by a processor, implement the steps of the network card speed limiting method as described above.

[0039] Compared with the prior art, the network card speed limiting method, device, readable storage medium and computer program product provided by the embodiments of the present application include obtaining a packet data stream to be speed limited, inputting the packet data stream into a first path and a second path respectively, in the first path, calculating the packet speed limiting result corresponding to the packet data stream, and caching the packet speed limiting result to form a speed limit cache result set, in the second path, according to the cache result corresponding to the current packet data in the speed limit cache result set, performing corresponding speed limiting processing, the present application isolates the calculation path from the processing path, the first path is the calculation path, and the second path is the processing path, both paths are processed independently, the calculation path does not affect the processing path delay, which is very significant for reducing network path delay. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present application. Also, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:

[0041] Figure 1 A flowchart of a network card speed limiting method provided in an embodiment of the present application;

[0042] Figure 2 A schematic diagram of the location of the network card speed limit function in the smart network card provided in the embodiment of the present application;

[0043] Figure 3 A structural diagram of the network card speed limiting system provided in an embodiment of the present application;

[0044] Figure 4 A flowchart of a calculation path provided for an embodiment of the present application;

[0045] Figure 5 A flowchart of a processing path provided for an embodiment of the present application;

[0046] Figure 6 This is a structural diagram of the network card speed limiting device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0047] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.

[0048] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and need not be used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable in appropriate circumstances, so that the embodiments of the present application described herein can be implemented in a sequence other than those illustrated or described herein, for example. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, the process, method, system, product or equipment comprising a series of steps or units need not be limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or equipment. "And / or" in the specification and claims represents at least one of the connected objects.

[0049] The embodiments of the present application provide a network card speed limiting method, device, readable storage medium and computer program product. The method and device are based on the same application concept. Since the method and device solve the problem in a similar principle, the implementation of the device and the method can refer to each other, and the repeated parts will not be repeated.

[0050] Please refer to Figure 1 , a network card speed limiting method provided in an embodiment of the present application includes:

[0051] Step 11, obtaining a packet data flow to be rate-limited, and inputting the packet data flow into a first path and a second path respectively;

[0052] Step 12: in the first path, calculating the packet speed limit result corresponding to the packet data flow, and caching the packet speed limit result to form a speed limit cache result set; the packet speed limit result is a result of discarding the packet data or a result of retaining the packet data;

[0053] Step 13: In the second path, corresponding speed limit processing is performed according to the cache result corresponding to the current packet data in the speed limit cache result set.

[0054] In an embodiment of the present application, the first path and the second path are two paths that are processed separately. The first path is used to calculate the packet data flow to be speed-limited, determine the calculation process of the packet speed-limit result corresponding to the packet data flow, and cache the packet speed-limit result to form a speed-limit cache result set, in which multiple packet speed-limit results are stored. The second path is used to match the packet data flow in the speed-limit cache result set with the cache result corresponding to the current packet data, and execute the corresponding speed-limit processing process. The second path only needs to match the corresponding cache result, eliminating the calculation process. The present application isolates the calculation path from the processing path, reduces module dependency and coupling, and improves system robustness. The calculation path does not affect the delay of the processing path.

[0055] It should be noted that hardware processing is sensitive to resource usage, and too much cache will also increase hardware costs. Figure 2 As shown, the speed limit processing function involved in this application is shown in the position of the smart network card data flow, which is closely located at the exit of the network data flow. The statistical data is the final data to be sent, and it is also the application layer data packet closest to the reception of the opposite device. The statistical data before the exit is more accurate than the processing at the position of the traditional scheduling module, because the data packet processing module usually includes data packet operations, in which network data packet processing often involves changes in packet length, such as the addition and deletion of data packet headers of the vxlan protocol. For a 64-byte packet, if a 50-byte vxlan header is added or deleted, it will bring about a bandwidth error of about 78% (50 / 64). Therefore, after all packet processing actions are completed, performing data packet statistical speed limit before the data is about to be output from this network card is one of the means to improve the accuracy of speed limit.

[0056] Common QoS (Quality of Service) functions combine rate limiting processing with data packet processing and scheduling modules. The main purpose is to achieve network traffic shaping. However, the processed data is not the final processing result of the data packet, so it contains certain errors.

[0057] In an optional embodiment, the above step 13 includes:

[0058] In the second path, if the current packet data is the first group of data, determining that the first cache result corresponding to the current packet data is a result of retaining the packet data, and performing an operation of outputting the current packet data; or,

[0059] In the second path, if the current group data is not the first group data, determining a second cache result corresponding to the current group data according to the speed limit cache result set;

[0060] When the second cache result indicates a result of discarding the packet data, performing an operation of discarding the current packet data corresponding to the second cache result;

[0061] When the second cache result indicates that the group data is retained, an operation of outputting the current group data corresponding to the first cache result is performed.

[0062] In an embodiment of the present application, since the packet data stream to be speed limited is input into the second path, the cache results corresponding to the current packet data are all calculated in the previous cycle and saved in the speed limit cache result set. Therefore, in order to avoid the need for the first group of data in the packet data stream to be speed limited to wait for the calculation process, the present application is designed that if the current packet data is the first group of data, the first cache result corresponding to the current packet data is determined to be the result of the retained packet data, and the operation of outputting the current packet data is executed, thereby further reducing the waiting time.

[0063] In the second path, if the current packet data is not the first group of data, a second cache result corresponding to the current packet data is queried in the speed limit cache result set to determine; when the second cache result indicates a result of discarding the packet data, an operation of discarding the current packet data corresponding to the second cache result is performed; when the second cache result indicates a result of retaining the packet data, an operation of outputting the current packet data corresponding to the first cache result is performed.

[0064] Alternatively, the drop command can be used to indicate discarding, and the keep command can be used to indicate keeping.

[0065] Optionally, the above step 12 includes:

[0066] In the first path, performing packet data statistics on the packet data in the packet data flow to determine a statistical result;

[0067] Calculate the packet rate limit result corresponding to each group of data packets in the statistical result;

[0068] Each group of the group speed limit results is cached to form a speed limit cache result set.

[0069] In an embodiment of the present application, the packet data in the packet data stream is input into the input interface of the packet configuration information, the packet data statistics are performed, and the statistical results are determined; the output statistical results are the packet results corresponding to the data packets and the original input data packets, and there is no actual delay time in this logical processing process. The packet speed limit results corresponding to each group of data packets in the statistical results are calculated, and then each group of the packet speed limit results is cached to form a speed limit cache result set, which can be used to directly match the corresponding speed limit cache results when the data packet is input next time. The present application can directly match the corresponding speed limit cache results when the data is input next time through the speed limit cache result set, saving the calculation time of the current data packet.

[0070] Specifically, performing group data statistics on the second group data to determine the statistical result includes:

[0071] According to the output rate, performing packet data statistics on the packet data in the packet data stream according to the packet data and the packet length, and determining the statistical result; the statistical result includes a real-time output result or a preset time output result;

[0072] Among them, the real-time output result is used to represent the statistical result containing the number of packets and the actual packet length; the preset time output result is used to represent the statistical result of the grouped data within the preset time, and does not contain the actual data packet.

[0073] In an embodiment of the present application, preliminary statistics are performed on the packet data in the input packet data stream, and the statistical results include the statistical results of the number of packets and the statistical results of the packet length. The output rate can be set, and can be set to real-time output or fixed-time output. The real-time output is the statistical result of the packet data (for example, the statistical result indicates that the number of packets is 1, and the packet length is the actual packet length), and the fixed-time output is the statistical result of the packet data within the configured time period. By performing preliminary statistics on the packet data, only the statistical results are saved without saving the actual data packets, while saving cache resources, the performance requirements for the subsequent speed limit calculation module can be reduced. The delay in determining the statistical results in the present application is determined by the configuration time (the configuration time is generally in the ms level).

[0074] Optionally, after the above step 12, the method further includes:

[0075] Setting a timed clearing for all the grouped speed limit results or the target grouped speed limit results in the speed limit cache result set; the timed clearing is used to set the current result as the result of retaining the grouped data; the target grouped speed limit result is one of the grouped speed limit results among all the grouped speed limit results;

[0076] After the timed clearing, the corresponding group speed limit result is updated in the speed limit cache result set.

[0077] In the embodiment of the present application, in order to avoid a single packet data without data packet input for a long time, but when the last packet data processing result is discarded, the data packet should not be discarded in theory, so a group speed limit information timing clearing function is designed, that is, all the group speed limit results or target group speed limit results of the speed limit cache result set are set to be cleared regularly. The group speed limit information clearing function can be configured to clear all groups uniformly, or clear a single group regularly. In order to save resources, all groups in the present application share a timer to realize the timing clearing mark.

[0078] Optionally, calculating the packet rate limit result corresponding to each group of data packets in the statistical result includes:

[0079] Calculate whether the rate and bandwidth of each group of data packets exceeds the preset configuration speed limit;

[0080] When the preset configured speed limit value is exceeded, determining that the packet speed limit result of the current data packet is a result of discarding the packet data;

[0081] When the preset configured speed limit value is not exceeded, the packet speed limit result of the current data packet is determined to be a result of retaining the packet data.

[0082] In the embodiment of the present application, there are multiple implementation methods for speed limit calculation. The common algorithm is token bucket implementation, and the delays of different algorithms are different. The general processing time is dozens of clocks ("clock" usually refers to the basic time unit in a processor or system, which controls the rhythm of the operation, resulting in a delay of several microseconds (us). The present application calculates whether the rate and bandwidth of each group of data packets exceed the preset configuration speed limit value, and the results are whether the group data packets exceed the preset configuration speed limit value. If it exceeds the preset configuration speed limit value, the output speed limit result is drop, otherwise it is keep.

[0083] This application provides a specific embodiment, referring to Figure 3 The disclosure discloses a network card speed limit system, including: a group configuration mapping module 1, a data packet statistics module 2, a speed limit calculation module 3, a speed limit result cache module 4 and a speed limit result processing module 5. The group configuration mapping module 1 of the present application is used to process the above step 11; the data packet statistics module 2, the speed limit calculation module 3 and the speed limit result cache module 4 jointly implement the above step 12; the speed limit result cache module 4 and the speed limit result processing module 5 jointly implement the above step 13.

[0084] Specifically, the group configuration mapping module 1: the input of this module is the input interface of the data packet to be processed by the speed limit, and the input interface of the group configuration information, and the output is the group result corresponding to the data packet and the original input data packet. This module is a combination logic processing without actual delay time. This module is responsible for saving the group information configured by the management layer, and when the data packet passes through this module, the network device number in the user interface information carried by the data packet (there are usually many users in cloud computing, and usually a single user is set as a group. A single user or a single group may have multiple network devices. The speed limit result is statistically processed for all network devices of a single group, and different speed limit information can be configured for groups belonging to different users) is mapped to the corresponding group result.

[0085] Data packet statistics module 2: Perform preliminary statistics on the input packet data. The statistical results include the number of packets and the length of packets. The output rate can be set. It can be set to real-time output or fixed-time output. The real-time output is the statistical result of the packet data (for example, the statistical result indicates that the number of packets is 1 and the packet length is the actual packet length). The fixed-time output is the statistical result of the packet data within the configured time period. By performing preliminary statistics on the packet data, only the statistical results are saved instead of the actual data packets, which saves cache resources and reduces the performance requirements for the subsequent speed limit calculation module. The delay of this module is determined by the configuration time (the configuration time is generally in ms).

[0086] Speed ​​limit calculation module 3: There are many ways to implement speed limit calculation. The common algorithm is token bucket implementation, and the delay of different algorithms is different (generally the processing time is dozens of clocks, resulting in a delay of several us microseconds). The result is whether the packet exceeds the configured speed limit value. If it exceeds the speed limit value, the output speed limit result is drop, otherwise it is keep.

[0087] Speed ​​limit result cache module 4: The corresponding group speed limit result output by the speed limit calculation module 3 is input into this module. This module will cache the latest speed limit results of all groups. When the group configuration mapping module 1 outputs the group information to this module, the latest speed limit result of the corresponding group is read to obtain the processing result of the original data packet (discard or allow to pass). The module reads the RAM delay of 2clock. In order to avoid a single packet data without data packet input for a long time, but when the last packet data processing result is discarded, the data packet should not be discarded in theory. Therefore, this module is designed with a group speed limit information timed clearing function. The group speed limit information clearing function can be configured to clear all groups uniformly or clear a single group regularly. In order to save resources, all groups share a timer to realize the timed clearing mark. The timed clearing function does not affect the delay of this module.

[0088] Speed ​​limit result processing module 5: Process the current original data packet according to the speed limit result output by the speed limit result cache module 4. If the speed limit result is to discard, the data packet is directly discarded without outputting it. If the speed limit result is to allow it to pass, the original data packet is directly output. The processing delay of this module is 1 clock (clock is the system processing clock. If the system clock is 200MHz, the single clock is 5ns).

[0089] In summary, compared with the conventional processing process in the prior art, the present application innovatively processes the step with the largest delay independently, and the actual data packet processing process can be implemented through the group configuration mapping module 1, the speed limit result cache module 4 and the speed limit result processing module 5, thereby reducing the millisecond delay of the traditional speed limit function to the nanosecond level. At the same time, there is no data packet cache design, thereby significantly reducing resource usage.

[0090] This application defines the path of the processing process of the group configuration mapping module 1, the data packet statistics module 2, the speed limit calculation module 3, and the speed limit result cache module 4 as the above-mentioned first path, that is, the calculation path; and defines the path of the processing process of the group configuration mapping module 1, the speed limit result cache module 4, and the speed limit result processing module 5 as the above-mentioned second path, that is, the processing path. The calculation path and the processing path are processed independently and are not affected by the delay of each other.

[0091] Optionally, the above step 11 includes:

[0092] Obtain the packet data stream to be processed by rate limiting;

[0093] Mapping is performed according to the network device number to which each group of data in the packet data flow to be processed by speed limit, and the mapped group information is obtained; the group information includes the group number and the group data corresponding to the group number;

[0094] The grouping information is input into the first path and the second path respectively.

[0095] In the embodiment of the present application, after obtaining the packet data flow to be processed by speed limiting, mapping is performed according to the network device number to which each group of data in the packet data flow to be processed by speed limiting, for example, using queue number / network card number / PF / VF and other information to map the group, and obtaining the mapped group information, the group information includes the group number and the group data corresponding to the group number. Further, the group information is respectively input into the first path and the second path, so as to realize subsequent independent calculation or processing in the two paths.

[0096] For details, please refer to the specific processing process in the first path. Figure 4 As shown, the specific process includes:

[0097] The data is synchronously input into the group configuration mapping array module and the length statistics module, and the group configuration mapping array module and the length statistics module perform synchronous processing. The group configuration mapping array module maps the network device number (queue number / network card number / PF / VF and other information) to which the data packet belongs to the group information. The length statistics module counts the length of the data packet. After being processed by the group configuration mapping array module and the length statistics module, the statistical results of the corresponding group data packet can be obtained immediately in the real-time output mode. In the fixed time output mode, the statistical results within a certain time can be output after the configured time. The statistical results include the packet count and packet length statistics in the group.

[0098] The statistical results are input into the speed limit result calculation module. The speed limit result calculation generally includes two calculations: pps packet rate and bps bandwidth. The calculation method is implemented by multi-level token bucket. After calculation, the statistical output is keep or drop result.

[0099] The group information and its speed limit results are input to the speed limit result cache module for caching, and the pending path uses the result to process the data packet. At the same time, the speed limit result cache module contains a timed clearing module, which will clear the speed limit results according to the set time, and all group speed limit results will be cleared to keep, avoiding the first packet data being discarded when the speed limit results have not been updated for a long time.

[0100] Further, refer to Figure 5 As shown, the processing process of the second path of the present application specifically includes:

[0101] The obtained packet data stream to be processed by speed limit is input into the packet configuration mapping array, the packet number output by the packet configuration mapping array is obtained, the packet number is input into the second path, and after the speed limit result cache is read, the cache result corresponding to the current packet data is read, and the corresponding keep or drop result is obtained. The speed limit result is input into the speed limit result data packet processing module, and the keep or drop operation is processed. The processed data packet is output to the speed limit result data packet processing module to complete the speed limit processing.

[0102] In summary, this application isolates the calculation path from the processing path, reduces module dependence and coupling, and improves system robustness. The calculation path does not affect the processing path delay; the low-latency design method of the processing path is extremely effective in reducing the network path delay, from the common millisecond delay to the nanosecond delay; the calculation path is designed to be cleared regularly to avoid abnormal discarding of the first packet data; the statistical module is designed without cache, and the calculation path and processing path are designed without data packet cache, which has lower resource usage in hardware acceleration scenarios; the speed limit processing module is located at the front end of the data export, which can improve the speed limit accuracy.

[0103] Reference Figure 6As shown, the present application also provides a network card speed limiting device, including:

[0104] A first acquisition module 61 is used to acquire a packet data flow to be processed by speed limiting, and input the packet data flow into a first path and a second path respectively;

[0105] A first processing module 62 is used to calculate the packet speed limit result corresponding to the packet data flow in the first path, cache the packet speed limit result, and form a speed limit cache result set; the packet speed limit result is a result of discarding the packet data or a result of retaining the packet data;

[0106] The second processing module 63 is used to perform corresponding speed limit processing in the second path according to the cache result corresponding to the current packet data in the speed limit cache result set.

[0107] Optionally, the first processing module 62 includes:

[0108] A first determining unit, configured to perform packet data statistics on the packet data in the packet data flow in the first path, and determine a statistical result;

[0109] A first calculation unit, used to calculate the packet rate limit result corresponding to each group of data packets in the statistical result;

[0110] The first processing unit is used to cache each group of the grouped speed limit results to form a speed limit cache result set.

[0111] Optionally, the network card speed limiting device of the present application further includes:

[0112] The third processing module is used to set a timed clearing of all the grouped speed limit results or the target grouped speed limit results in the speed limit cache result set; the timed clearing is used to set the current result as the result of retaining the grouped data; the target grouped speed limit result is a grouped result in all the grouped speed limit results;

[0113] The fourth processing module is used to update the corresponding group speed limit result in the speed limit cache result set after the scheduled clearing.

[0114] Optionally, the first determining unit is specifically configured to:

[0115] According to the output rate, performing packet data statistics on the packet data in the packet data stream according to the packet data and the packet length, and determining the statistical result; the statistical result includes a real-time output result or a preset time output result;

[0116] Among them, the real-time output result is used to represent the statistical result containing the number of packets and the actual packet length; the preset time output result is used to represent the statistical result of the grouped data within the preset time, and does not contain the actual data packet.

[0117] Optionally, the first computing unit is specifically configured to:

[0118] Calculate whether the rate and bandwidth of each group of data packets exceeds the preset configuration speed limit;

[0119] When the preset configured speed limit value is exceeded, determining that the packet speed limit result of the current data packet is a result of discarding the packet data;

[0120] When the preset configured speed limit value is not exceeded, the packet speed limit result of the current data packet is determined to be a result of retaining the packet data.

[0121] Optionally, the first acquisition module 61 includes:

[0122] An acquisition unit, used for acquiring a packet data stream to be processed by rate limiting;

[0123] A second processing unit is used to map according to the network device number to which each group of data in the packet data flow to be processed by speed limit, and obtain the mapped group information; the group information includes the group number and the group data corresponding to the group number;

[0124] The third processing unit is used to input the grouping information into the first path and the second path respectively.

[0125] Optionally, the second processing module 63 includes:

[0126] a fourth processing unit, configured to, in the second path, if the current packet data is the first group of data, determine that the first cache result corresponding to the current packet data is a result of retaining the packet data, and execute an operation of outputting the current packet data; or

[0127] a fifth processing unit, configured to, in the second path, if the current group data is not the first group data, determine a second cache result corresponding to the current group data according to the speed limit cache result set;

[0128] A sixth processing unit, configured to, when the second cache result indicates a result of discarding the packet data, execute an operation of discarding the current packet data corresponding to the second cache result;

[0129] The seventh processing unit is configured to, when the second cache result indicates a result of retaining the packet data, execute an operation of outputting the current packet data corresponding to the first cache result.

[0130] It should be noted that the device in this embodiment is a device corresponding to the above-mentioned method for limiting the speed of the network card, and the implementation methods in the above-mentioned embodiments are all applicable to the embodiments of the device, and can also achieve the same technical effect. The above-mentioned device provided in the embodiment of the present application can implement all the method steps implemented in the above-mentioned method embodiment, and can achieve the same technical effect. The parts and beneficial effects that are the same as those in the method embodiment in this embodiment will not be specifically repeated here.

[0131] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, each process of the above-mentioned network card speed limiting method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0132] The present application also provides a computer program product, including computer instructions, which, when executed by a processor, implement the above Figure 1 The various processes of the method embodiment shown can achieve the same technical effect, and will not be described again here to avoid repetition.

[0133] It should be noted that, in this article, the terms "include", "include" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0134] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0135] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A network card speed limiting method, characterized in that: include: Acquire a packet data flow to be processed by rate limiting, and input the packet data flow into a first path and a second path respectively; In the first path, a packet speed limit result corresponding to the packet data flow is calculated, and the packet speed limit result is cached to form a speed limit cache result set; The packet rate limiting result is a result of discarding packet data or a result of retaining packet data; In the second path, corresponding speed limit processing is performed according to the cache result corresponding to the current packet data in the speed limit cache result set.

2. The method according to claim 1, characterized in that In the first path, calculating the packet rate limit result corresponding to the packet data flow, and caching the packet rate limit result to form a rate limit cache result set, including: In the first path, performing packet data statistics on the packet data in the packet data flow to determine a statistical result; Calculate the group rate limit result corresponding to each group of data packets in the statistical result; Each group of the group speed limit results is cached to form a speed limit cache result set.

3. The method according to claim 1, characterized in that After caching the group speed limit results to form a speed limit cache result set, the method further includes: Setting a timed clearing for all the grouped speed limit results or the target grouped speed limit results in the speed limit cache result set; the timed clearing is used to set the current result as the result of retaining the grouped data; the target grouped speed limit result is one of the grouped speed limit results among all the grouped speed limit results; After the timed clearing, the corresponding group speed limit result is updated in the speed limit cache result set.

4. The method according to claim 2, characterized in that: In the first path, performing packet data statistics on the packet data in the packet data flow and determining a statistical result includes: According to the output rate, performing packet data statistics on the packet data in the packet data stream according to the packet data and the packet length, and determining the statistical result; the statistical result includes a real-time output result or a preset time output result; Among them, the real-time output result is used to represent the statistical result containing the number of packets and the actual packet length; the preset time output result is used to represent the statistical result of the grouped data within the preset time, and does not contain the actual data packet.

5. The method according to claim 2, characterized in that: Calculating the group rate limit result corresponding to each group of data packets in the statistical result, including: Calculate whether the rate and bandwidth of each group of data packets exceeds the preset configuration speed limit; When the preset configured speed limit value is exceeded, determining that the packet speed limit result of the current data packet is a result of discarding the packet data; When the preset configured speed limit value is not exceeded, the packet speed limit result of the current data packet is determined to be a result of retaining the packet data.

6. The method according to claim 1, characterized in that Acquiring a packet data flow to be rate-limited, and inputting the packet data flow into a first path and a second path respectively, comprising: Obtain the packet data stream to be processed by rate limiting; Mapping is performed according to the network device number to which each group of data in the packet data flow to be processed by speed limit, and the mapped group information is obtained; the group information includes the group number and the group data corresponding to the group number; The grouping information is input into the first path and the second path respectively.

7. The method according to claim 1, characterized in that In the second path, according to the cache result corresponding to the current packet data in the speed limit cache result set, corresponding speed limit processing is performed, including: In the second path, if the current packet data is the first group data, determining that the first cache result corresponding to the current packet data is a result of retaining the packet data, and performing an operation of outputting the current packet data; or, In the second path, if the current group data is not the first group data, determining a second cache result corresponding to the current group data according to the speed limit cache result set; When the second cache result indicates a result of discarding the packet data, performing an operation of discarding the current packet data corresponding to the second cache result; When the second cache result indicates that the group data is retained, an operation of outputting the current group data corresponding to the first cache result is performed.

8. A network card speed limiting device, characterized in that: include: A first acquisition module, used for acquiring a packet data flow to be processed by speed limiting, and inputting the packet data flow into a first path and a second path respectively; A first processing module, configured to calculate, in the first path, a packet rate limiting result corresponding to the packet data flow, and cache the packet rate limiting result to form a rate limiting cache result set; The packet rate limiting result is a result of discarding packet data or a result of retaining packet data; The second processing module is used to perform corresponding speed limit processing in the second path according to the cache result corresponding to the current packet data in the speed limit cache result set.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the network card speed limiting method according to any one of claims 1 to 7 are implemented.

10. A computer program product, characterized in that The method comprises computer instructions, which, when executed by a processor, implement the steps of the network card speed limiting method as claimed in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Multi-path cross-protocol transmission data packet scheduling method and system

    CN110662256A

  • Data packet transmission control method and device

    CN116055415A

  • Encrypted message speed limiting method and device based on DPU

    CN117255061A

  • Network congestion detection-based intelligent speed limiting method and apparatus, and storage medium

    WO2020143180A1