Traffic forwarding module, traffic forwarding method, storage medium and intelligent network card
Through the combination of counters and state machines, the forwarding status of the smart network card is dynamically adjusted, which solves the problem that priority service traffic cannot be forwarded first in the smart network card, and realizes the priority utilization of bus bandwidth.
Patent Information
- Application Number
- CN202410228675.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-29
- Publication Date
- 2025-08-29
AI Technical Summary
Existing smart network cards cannot effectively realize priority forwarding of priority service traffic in FPGA design, resulting in uneven bus bandwidth utilization.
Using a combination of counters and state machines, the output traffic and idle time of priority queues and normal queues are counted, and the forwarding status is dynamically adjusted to ensure that the priority queue takes more time on the bus than the normal queues within a certain period of time.
The priority forwarding of priority service traffic is realized, ensuring that the bus occupies priority service traffic more than ordinary service traffic within a certain period of time, and solving the problem of unbalanced bus bandwidth utilization.
Smart Images

Figure CN120567792A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of network communication technology, and in particular to a traffic forwarding module, a traffic forwarding method, a storage medium, and a smart network card. Background Art
[0002] Currently, in the FPGA (Field Programmable Gate Array) design used in smart network cards or DPUs (Data Processing Units), there is often a demand for preferential forwarding of certain service flows.
[0003] In the existing technology, the smart network card can distinguish the received business traffic and put the priority business traffic that needs to be forwarded first and the ordinary business traffic that does not need to be forwarded first into the priority queue and the ordinary queue respectively. When forwarding, as long as the priority queue is not empty, only the priority business traffic in the priority queue is forwarded. When the priority queue is empty, the ordinary business traffic in the ordinary queue is forwarded.
[0004] However, since the bus bandwidth of the smart network card when forwarding business traffic is greater than the bandwidth of the smart network card when receiving business traffic, for example, the bus bandwidth of the smart network card when forwarding business traffic is three times the bandwidth of the smart network card when receiving business traffic, the business traffic will be sent out directly after arriving at the queue. On this basis, there is often no obvious difference in the forwarding priority of priority business traffic and ordinary business traffic, so priority forwarding of priority business traffic cannot be achieved. Summary of the Invention
[0005] In view of this, the purpose of this application is to provide a traffic forwarding module, a traffic forwarding method, a storage medium and a smart network card to solve the problem in the prior art that priority forwarding of priority service traffic cannot be achieved.
[0006] In order to achieve the above objectives, the technical solutions adopted in the embodiments of the present application are as follows:
[0007] In a first aspect, the present application provides a traffic forwarding module, comprising a counter and a state machine, wherein the counter comprises a first counter and a second counter, and the first counter and the second counter are respectively connected to the state machine;
[0008] The first counter is used to count the number of output flows of the priority queue and the length of time the priority queue is empty to obtain a priority occupancy count value when the state machine is in the priority sending state; wherein the priority queue is used to store priority forwarding service flows;
[0009] The second counter is used to count the number of output flows of the common queue and the length of time the common queue is empty to obtain a common occupancy count value when the state machine is in the common sending state; wherein the common queue is used to store service flows that do not require priority forwarding;
[0010] The state machine is configured to, when in the priority sending state and the priority occupation count value output by the first counter reaches a preset priority threshold, switch the priority sending state to a normal sending state and clear the priority occupation count value to zero, so that the traffic forwarding module forwards the service traffic in the normal queue;
[0011] The state machine is further configured to, when in the normal sending state and the normal occupancy count value output by the second counter reaches a preset normal threshold, switch the normal sending state to a priority sending state and clear the normal occupancy count value so that the traffic forwarding module forwards the service traffic in the priority queue; wherein the preset priority threshold is greater than the preset normal threshold.
[0012] In an optional implementation manner, the first counter is specifically used to:
[0013] Counting a priority traffic pulse generated each time the priority queue outputs a service flow, and counting a priority idle pulse generated each time the priority queue is empty for a preset time period;
[0014] The priority occupied count value is a total count of the number of the priority traffic pulses and the priority idle pulses.
[0015] In an optional embodiment, the traffic forwarding module further includes a first idle counter;
[0016] The first idle counter is used to count a priority idle pulse generated each time the priority queue is empty reaches a preset time, obtain a priority idle pulse count value, and clear the priority idle pulse count value when the priority queue is not empty.
[0017] In an optional embodiment, the first idle counter is further connected to the state machine;
[0018] The state machine is also used to determine whether the priority idle pulse count value in the first idle counter is zero when it is in the normal sending state and the normal occupancy count value reaches a preset normal threshold, and to switch the normal sending state to the priority sending state when the priority idle pulse count value is zero.
[0019] In an optional implementation manner, the second counter is specifically configured to:
[0020] Counting a common traffic pulse generated each time the common queue outputs a service flow, and counting a common idle pulse generated each time the common queue is empty for a preset time period;
[0021] The normal occupied count value is a total count of the number of the normal traffic pulses and the normal idle pulses.
[0022] In an optional embodiment, the traffic forwarding module further includes a second idle counter;
[0023] The second idle counter is used to count an ordinary idle pulse generated each time the ordinary queue is empty reaches a preset time length, obtain an ordinary idle pulse count value, and clear the ordinary idle pulse value count when the ordinary queue is not empty.
[0024] In an optional embodiment, the second idle counter is further connected to the state machine;
[0025] The state machine is also used to determine whether the normal idle pulse count value is zero when it is in the priority sending state and the priority occupancy count value reaches a preset priority threshold, and switch the priority sending state to the normal sending state when the normal idle pulse count value is zero.
[0026] In a second aspect, the present application provides a traffic forwarding method, applied to the traffic forwarding module described in any of the aforementioned embodiments, the method comprising:
[0027] When the state machine is in a priority sending state, forwarding the service traffic in the priority queue;
[0028] When the state machine is in the normal sending state, the service traffic in the normal queue is forwarded.
[0029] In a third aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the traffic forwarding method described in the aforementioned embodiment.
[0030] In a fourth aspect, the present application provides a smart network card, in which the traffic forwarding module described in any of the aforementioned implementation methods is provided.
[0031] The traffic forwarding module, traffic forwarding method, storage medium and smart network card provided by the embodiments of the present application, the first counter can count the output traffic of the priority queue and the duration of time when the priority queue is empty to obtain the priority occupancy count value when the state machine is in the priority sending state, and the second counter can count the output traffic of the ordinary queue and the duration of time when the ordinary queue is empty to obtain the ordinary occupancy count value when the state machine is in the ordinary sending state, then the state machine can switch the priority sending state to the ordinary sending state and clear the priority occupancy count value when it is in the priority sending state and the priority occupancy technology output by the first counter reaches the preset priority threshold, then the traffic forwarding module can forward the business traffic in the ordinary queue, and at the same time, the state machine can also When the system is in a normal sending state and the normal occupancy count value output by the second counter reaches a preset normal threshold, the normal sending state can be switched to a priority sending state, and the normal occupancy count value can be cleared. Then, the traffic forwarding module can forward the business traffic in the priority queue. Since only the business traffic that needs to be forwarded in the priority queue is forwarded in the priority sending state, the occupancy of the bus by the business traffic that needs to be forwarded in the priority sending state can be guaranteed. At the same time, since the preset priority threshold is greater than the preset normal threshold, the occupancy time of the bus by the business traffic that needs to be forwarded in priority within a certain period of time will be greater than the occupancy time of the bus by the business traffic that does not need to be forwarded in priority, thereby realizing priority forwarding of the business traffic that needs to be forwarded in priority.
[0032] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without creative work.
[0034] Figure 1 A block diagram of a traffic forwarding module provided in an embodiment of the present application is shown;
[0035] Figure 2 An example diagram of a traffic forwarding module is shown;
[0036] Figure 3 Another example diagram of a traffic forwarding module is shown;
[0037] Figure 4 Another example diagram of a traffic forwarding module is shown;
[0038] Figure 5 Another example diagram of a traffic forwarding module is shown.
[0039] Icons: 100-first counter; 101-priority traffic pulse generation module; 102-priority idle pulse generation module; 110-second counter; 111-normal traffic pulse generation module; 112-normal idle pulse generation module; 20-state machine; 30-first idle counter; 40-second idle counter. DETAILED DESCRIPTION
[0040] The following will be combined with the accompanying drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Generally, the components of the embodiments of the present application described and shown in the drawings herein can be arranged and designed in various different configurations.
[0041] Therefore, the following detailed description of the embodiments of the present application provided in the accompanying drawings is not intended to limit the scope of the present application for protection, but merely represents selected embodiments of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without making any creative efforts shall fall within the scope of protection of the present application.
[0042] It should be noted that relational terms such as "first" and "second" are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or apparatus comprising the element.
[0043] Figure 1 A block diagram of a traffic forwarding module provided in an embodiment of the present application is shown in FIG. Figure 1 The traffic forwarding module includes a counter and a state machine 20 , wherein the counter includes a first counter 100 and a second counter 110 , and the first counter 100 and the second counter 110 are respectively connected to the state machine 20 .
[0044] In this embodiment, the first counter can be used to count the number of output flows of the priority queue and the duration that the priority queue is empty when the state machine is in the priority sending state to obtain a priority occupancy count value.
[0045] The priority queue is used to store service traffic that is forwarded with priority.
[0046] Optionally, the priority queue being empty refers to a situation where there is no service traffic in the queue.
[0047] Optionally, when the state machine is in the priority sending state, the traffic forwarding module only outputs the business traffic in the priority queue. On this basis, the priority occupancy count value can characterize the occupancy of the bus by the priority queue, that is, the situation where the priority queue occupies the bus to output traffic and the situation where the priority queue occupies the bus but is in an idle state because there is no business traffic in the queue.
[0048] In this embodiment, the second counter can be used to count the number of output flows of the common queue and the duration that the common queue is empty when the state machine is in the common sending state to obtain a common occupancy count value.
[0049] Among them, the common queue is used to store service traffic that does not need to be forwarded with priority.
[0050] Optionally, the common queue being empty refers to a situation where there is no service traffic in the queue.
[0051] Optionally, when the state machine is in the normal sending state, the traffic forwarding module only outputs the business traffic in the normal queue. On this basis, the normal occupancy count value can represent the occupancy of the bus by the normal queue, that is, the situation where the normal queue occupies the bus to output traffic and the situation where the normal queue occupies the bus but is in an idle state because there is no business traffic in the queue.
[0052] Optionally, the traffic forwarding module can obtain the business traffic to be sent, and classify the business traffic to be forwarded into business traffic that needs priority forwarding and business traffic that does not need priority forwarding according to the pre-set traffic forwarding attributes, and store them in the priority queue and the ordinary queue respectively.
[0053] Optionally, the priority forwarding attribute can be set according to actual application requirements, such as the service type to which the service traffic belongs.
[0054] In this embodiment, the state machine can be used to switch the priority sending state to the normal sending state and clear the priority occupancy count value when it is in the priority sending state and the priority occupancy count value output by the first counter reaches a preset priority threshold, so that the traffic forwarding module can forward the service traffic in the normal queue.
[0055] Optionally, if the state machine is in the normal sending state, the traffic forwarding module only forwards the service traffic in the normal queue.
[0056] Optionally, the preset priority threshold may be pre-set according to business requirements and stored in the traffic forwarding module.
[0057] Optionally, when in the priority sending state, the state machine may obtain the priority occupation count value in the first counter in real time, and determine whether the priority occupation count value reaches a preset priority threshold.
[0058] Optionally, the state machine may clear the priority occupancy count value after switching to the normal sending state. It is understandable that the first counter only counts when the state machine is in the priority sending state.
[0059] In this embodiment, the state machine can also be used to switch the normal sending state to the priority sending state and clear the normal occupancy count value when it is in the normal sending state and the normal occupancy count value output by the second counter reaches a preset normal threshold, so that the traffic forwarding module can forward the service traffic in the priority queue.
[0060] The preset priority threshold is greater than the preset normal threshold.
[0061] Optionally, if the state machine is in the priority sending state, the traffic forwarding module only forwards the service traffic in the priority queue.
[0062] Optionally, the preset common threshold may be pre-set according to business requirements and stored in the traffic forwarding module.
[0063] Optionally, when in the normal sending state, the state machine may obtain the normal occupancy count value in the second counter in real time, and determine whether the normal occupancy count value reaches a preset normal threshold.
[0064] Optionally, the state machine may clear the normal occupancy count value after switching to the normal sending state. It can be understood that the second counter only calculates the normal occupancy count value when the state machine is in the normal sending state.
[0065] In this embodiment, in order to ensure the priority forwarding of the service traffic that needs to be forwarded first, the preset priority threshold needs to be greater than the preset normal threshold.
[0066] In a possible implementation, the preset priority threshold may be set to 10, and the preset normal threshold may be set to 2.
[0067] In the traffic forwarding module provided by the embodiment of the present application, the first counter can count the output traffic of the priority queue and the duration that the priority queue is empty to obtain the priority occupancy count value when the state machine is in the priority sending state, and the second counter can count the output traffic of the ordinary queue and the duration that the ordinary queue is empty to obtain the ordinary occupancy count value when the state machine is in the ordinary sending state. The state machine can switch the priority sending state to the ordinary sending state and clear the priority occupancy count value when it is in the priority sending state and the priority occupancy value output by the first counter reaches the preset priority threshold. The traffic forwarding module can forward the business traffic in the ordinary queue. At the same time, the state machine can also switch the priority sending state to the ordinary sending state and clear the priority occupancy count value when it is in the priority sending state and the priority occupancy value output by the first counter reaches the preset priority threshold. When the normal sending state is reached and the normal occupancy count value output by the second counter reaches the preset normal threshold, the normal sending state is switched to the priority sending state, and the normal occupancy count value is cleared to zero. The traffic forwarding module can forward the business traffic in the priority queue. Since only the business traffic that needs to be forwarded with priority in the priority queue is forwarded in the priority sending state, the occupancy of the bus by the business traffic that needs to be forwarded with priority in the priority sending state can be guaranteed. At the same time, since the preset priority threshold is greater than the preset normal threshold, the occupancy time of the bus by the business traffic that needs to be forwarded with priority within a certain period of time will be greater than the occupancy time of the bus by the business traffic that does not need to be forwarded with priority, thereby realizing priority forwarding of the business traffic that needs to be forwarded with priority.
[0068] In this embodiment, the first counter is specifically used to count a priority traffic pulse generated each time the priority queue outputs a service flow, and to count a priority idle pulse generated each time the priority queue is empty for a preset time.
[0069] It can be understood that the priority occupancy count value is the total count of the number of priority traffic pulses and priority idle pulses.
[0070] It is understandable that the priority traffic pulse and the priority idle pulse do not appear at the same time.
[0071] Optionally, the preset duration can be set in advance according to the application situation. In a possible implementation, the preset duration can be 1 microsecond.
[0072] The first counter counts the number of priority traffic pulses and the number of priority idle pulses respectively, that is, the sum of the number of priority traffic pulses and the number of priority idle pulses is the priority occupancy count value.
[0073] In this embodiment, when the state machine is in the normal sending state, it is obvious that no priority traffic pulse will be generated. However, since the priority queue may be empty, a priority idle pulse may still be generated. At this time, the first counter will not count the priority idle pulse. That is to say, the first counter only generates a priority occupancy count value when the state machine is in the priority sending state.
[0074] In a possible implementation, the traffic forwarding module may further include a pulse generating module to generate corresponding pulses according to the actual situation of the priority queue.
[0075] In an example, see Figure 2 The traffic forwarding module is provided with a priority traffic pulse generating module 101 and a priority idle pulse generating module 102, and the priority traffic pulse generating module 101 and the priority idle pulse generating module 102 are respectively connected to the first counter 100.
[0076] In this example, the priority traffic pulse generating module 101 is used to output a priority traffic pulse each time the priority queue outputs a service flow; the priority idle pulse generating module 102 is used to output a priority idle pulse each time the priority queue is empty for a preset time.
[0077] It is understandable that the priority traffic pulse generating module and the priority idle pulse generating module will not output pulses at the same time.
[0078] In this example, the priority idle pulse generation module can monitor the idle signal emitted by the priority queue. Since the idle signal indicates that the priority queue is empty, the priority idle pulse generation module can output a priority idle pulse when it detects that the idle signal emitted by the priority queue lasts for a preset time.
[0079] In this example, in order to facilitate the priority idle pulse generating module to determine whether the time duration during which the priority queue is empty reaches a preset time duration, a timer may be set to be connected to the priority idle pulse generating module.
[0080] In this example, the timer can be used to output a time pulse every preset time period, and the priority idle pulse generation module can determine whether the time period when the priority queue is empty reaches the preset time period based on the time pulse, and generate a priority idle pulse when the time period when the priority queue is empty reaches the preset time period.
[0081] Optionally, the traffic forwarding module may set an idle counter to count priority idle pulses, thereby counting continuous idle conditions of the priority queue.
[0082] Specifically, the traffic forwarding module may also include a first idle counter, which can be used to count a priority idle pulse generated each time the priority queue is empty reaches a preset time length, obtain a priority idle pulse count value, and clear the priority idle pulse count value when the priority queue is not empty.
[0083] Optionally, the first idle counter may monitor a non-empty signal sent by the priority queue. Since the non-empty signal indicates that the priority queue is not empty, the first idle counter may clear the priority idle pulse count when monitoring the non-empty signal sent by the priority queue.
[0084] It can be understood that, since the first idle counter clears the priority idle pulse count value when the priority queue is not empty, the priority idle pulse count value represents a situation where the priority queue is continuously idle.
[0085] In an example, if a priority idle pulse is generated every time the priority queue is empty for 1 microsecond, the priority idle pulse count value obtained by the first idle counter represents how many microseconds the priority queue has been idle continuously.
[0086] In an example, see Figure 3 The traffic forwarding module is provided with a first idle counter 30, and the first idle counter 30 is connected to the priority idle pulse generating module 102 so as to count the priority idle pulses generated by the priority idle pulse generating module.
[0087] Furthermore, considering that the priority queue may be empty when switching from the normal sending state to the priority sending state, even if it is switched to the priority sending state, the sending performance may be affected due to the inability to send business traffic. Therefore, the state machine also needs to consider whether the priority queue is empty when switching from the normal sending state to the priority sending state.
[0088] Specifically, the first idle counter is connected to a state machine, which is also used to determine whether the priority idle pulse count value in the first idle counter is zero when it is in a normal sending state and the normal occupancy count value reaches a preset normal threshold, and to switch the normal sending state to the priority sending state when the priority idle pulse count value is zero.
[0089] It can be understood that if the priority idle pulse is zero, it can be determined that the priority queue is not empty, so the normal sending state can be switched to the priority sending state, thereby ensuring better sending performance.
[0090] In this embodiment, the second counter is specifically used to count a normal traffic pulse generated each time the normal queue outputs a service flow, and to count a normal idle pulse generated each time the normal queue is empty for a preset time.
[0091] It can be understood that the normal occupancy count value is the total count of the number of normal traffic pulses and normal idle pulses.
[0092] It is understandable that normal traffic pulses and normal idle pulses do not occur at the same time.
[0093] Optionally, the preset duration can be set in advance according to the application. In one possible implementation, the preset duration can be 1 microsecond. In this embodiment, the preset duration in the second counter needs to be consistent with the preset duration in the first counter.
[0094] Optionally, the second counter counts the number of normal traffic pulses and the number of normal idle pulses respectively, that is, the sum of the number of normal traffic pulses and the number of normal idle pulses is the normal occupancy count value.
[0095] In this embodiment, when the state machine is in the priority sending state, it is obvious that no normal traffic pulse will be generated. However, since the normal queue may be empty, a normal idle pulse may still be generated. At this time, the second counter will not count the normal idle pulse. That is to say, the second counter will only generate a normal occupancy count value when the state machine is in the normal sending state.
[0096] In a possible implementation, the traffic forwarding module may further include a pulse generating module to generate corresponding pulses according to the actual situation of the priority queue.
[0097] In an example, see Figure 4 The traffic forwarding module is provided with a normal traffic pulse generating module 111 and a normal idle pulse generating module 112, and the normal traffic pulse generating module 111 and the normal idle pulse generating module 112 are respectively connected to the second counter.
[0098] In this example, the normal traffic pulse generating module can be used to output a normal traffic pulse each time the normal queue outputs a service flow; the normal idle pulse generating module can be used to output a normal idle pulse each time the normal queue is empty for a preset time.
[0099] It is understandable that the normal traffic pulse generating module and the normal idle pulse generating module will not output pulses at the same time.
[0100] In this example, the normal idle pulse generation module can monitor the idle signal emitted by the normal queue. Since the idle signal indicates that the normal queue is empty, the normal idle pulse generation module can output a normal idle pulse when it monitors that the idle signal emitted by the normal queue lasts for a preset time.
[0101] In this example, in order to facilitate the common idle pulse generating module to determine whether the duration for which the common queue is empty reaches a preset duration, a timer may be set to be connected to the common idle pulse generating module.
[0102] In this example, the timer can be used to output a time pulse every preset time period, and the normal idle pulse generation module can determine whether the time period when the normal queue is empty reaches the preset time period based on the time pulse, and generate a normal idle pulse when the time period when the normal queue is empty reaches the preset time period.
[0103] Optionally, the traffic forwarding module may further set an idle counter to count common idle pulses.
[0104] Specifically, the traffic forwarding module can also include a second idle counter, which can be used to count an ordinary idle pulse generated every time the ordinary queue is empty and reaches a preset time, to obtain an ordinary idle pulse count value, and to clear the ordinary idle pulse value count when the ordinary queue is not empty.
[0105] Optionally, the second idle counter may monitor a non-empty signal sent by the common queue. Since the non-empty signal indicates that the common queue is not empty, the second idle counter may clear the common idle pulse count value when monitoring the non-empty signal sent by the common queue.
[0106] It can be understood that, since the second idle counter clears the ordinary idle pulse count value when the ordinary queue is not empty, the ordinary idle pulse count value represents the situation that the ordinary queue is continuously idle.
[0107] In an example, if a normal idle pulse is output every time the normal queue is empty for 1 microsecond, the normal idle pulse count value obtained by the second idle counter indicates how many microseconds the normal queue has been idle continuously.
[0108] In an example, see Figure 5 A second idle counter 40 is provided in the traffic forwarding module, and the second idle counter 40 is connected to the normal idle pulse generating module 112 so as to count the normal idle pulses generated by the normal idle pulse generating module.
[0109] Furthermore, considering that when the priority sending state is switched to the normal sending state, the normal queue may be empty, even if it is switched to the normal sending state, the sending performance may be affected due to the inability to send business traffic. Therefore, the state machine also needs to consider whether the normal queue is empty when switching the priority sending state to the normal sending state.
[0110] Specifically, the second idle counter is also connected to the state machine, which can also be used to determine whether the normal idle pulse count value in the second idle counter is zero when it is in the priority sending state and the priority occupancy count value reaches the preset priority threshold, and switch the priority sending state to the normal sending state when the normal idle pulse count value is zero.
[0111] In this embodiment, when the state machine determines that the priority transmission state can be switched to the normal transmission state, it must first determine whether the normal queue is empty. It is understood that if the normal idle pulse is zero, it can be determined that the normal queue is not empty, and therefore the priority transmission state can be switched to the normal transmission state, thereby ensuring better transmission performance.
[0112] An embodiment of the present application also provides a traffic forwarding method, which is applied to the above-mentioned traffic forwarding module. The method includes: when the state machine is in a priority sending state, forwarding the business traffic in the priority queue; when the state machine is in a normal sending state, forwarding the business traffic in the normal queue.
[0113] It can be understood that the traffic forwarding module can determine, according to the state of the state machine, only the service traffic in which queue should be forwarded.
[0114] The present application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, can implement the traffic forwarding method provided in the present application. Furthermore, the present application also provides a smart network card (SNIC) having the aforementioned traffic forwarding module disposed therein.
[0115] In one possible implementation, the traffic forwarding module may be provided on a smart network card in an FPGA design manner.
[0116] The above are merely preferred embodiments of the present application and are not intended to limit the present application. Those skilled in the art will readily appreciate that various modifications and variations are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present application shall be included within the scope of protection of the present application.
Claims
1. A traffic forwarding module, characterized in that: comprising a counter and a state machine, wherein the counter comprises a first counter and a second counter, and the first counter and the second counter are respectively connected to the state machine; The first counter is used to count the number of output flows of the priority queue and the length of time the priority queue is empty to obtain a priority occupancy count value when the state machine is in the priority sending state; wherein the priority queue is used to store priority forwarding service flows; The second counter is used to count the number of output flows of the common queue and the length of time the common queue is empty to obtain a common occupancy count value when the state machine is in the common sending state; wherein the common queue is used to store service flows that do not require priority forwarding; The state machine is configured to, when in the priority sending state and the priority occupation count value output by the first counter reaches a preset priority threshold, switch the priority sending state to a normal sending state and clear the priority occupation count value to zero, so that the traffic forwarding module forwards the service traffic in the normal queue; The state machine is further configured to, when in the normal sending state and the normal occupancy count value output by the second counter reaches a preset normal threshold, switch the normal sending state to a priority sending state and clear the normal occupancy count value so that the traffic forwarding module forwards the service traffic in the priority queue; wherein the preset priority threshold is greater than the preset normal threshold.
2. The traffic forwarding module according to claim 1, characterized in that: The first counter is specifically used for: Counting a priority traffic pulse generated each time the priority queue outputs a service flow, and counting a priority idle pulse generated each time the priority queue is empty for a preset time period; The priority occupied count value is a total count of the number of the priority traffic pulses and the priority idle pulses.
3. The traffic forwarding module according to claim 2, characterized in that: The traffic forwarding module also includes a first idle counter; The first idle counter is used to count a priority idle pulse generated each time the priority queue is empty reaches a preset time, obtain a priority idle pulse count value, and clear the priority idle pulse count value when the priority queue is not empty.
4. The traffic forwarding module according to claim 3, characterized in that: The first idle counter is also connected to the state machine; The state machine is also used to determine whether the priority idle pulse count value in the first idle counter is zero when it is in the normal sending state and the normal occupancy count value reaches a preset normal threshold, and to switch the normal sending state to the priority sending state when the priority idle pulse count value is zero.
5. The traffic forwarding module according to claim 1, characterized in that: The second counter is specifically used for: Counting a common traffic pulse generated each time the common queue outputs a service flow, and counting a common idle pulse generated each time the common queue is empty for a preset time period; The normal occupied count value is a total count of the number of the normal traffic pulses and the normal idle pulses.
6. The traffic forwarding module according to claim 5, characterized in that: The traffic forwarding module also includes a second idle counter; The second idle counter is used to count an ordinary idle pulse generated each time the ordinary queue is empty reaches a preset time length, obtain an ordinary idle pulse count value, and clear the ordinary idle pulse value count when the ordinary queue is not empty.
7. The traffic forwarding module according to claim 6, characterized in that: The second idle counter is also connected to the state machine; The state machine is also used to determine whether the normal idle pulse count value is zero when it is in the priority sending state and the priority occupancy count value reaches a preset priority threshold, and switch the priority sending state to the normal sending state when the normal idle pulse count value is zero.
8. A traffic forwarding method, characterized in that: Applied to the traffic forwarding module according to any one of claims 1 to 7, the method comprising: When the state machine is in a priority sending state, forwarding the service traffic in the priority queue; When the state machine is in the normal sending state, the service traffic in the normal queue is forwarded.
9. A computer-readable storage medium, characterized in that A computer program is stored thereon, characterized in that when the computer program is executed by a processor, the traffic forwarding method according to claim 8 is implemented.
10. A smart network card, characterized in that: The smart network card is provided with the traffic forwarding module according to any one of claims 1 to 8.
Citation Information
Patent Citations
Service scheduling method and device
CN105915468A
Flow control method and device
CN109818879A
Deficit fair priority queuing
US20070183320A1
Process for automatic detection of and quality of service adjustment for bulk data transfers
WO2000060819A1