A low-resource consumption flow control method based on FPGA

By adopting the flow control methods of descriptor management, token flow control and rate calculation modules on the FPGA, the problem of excessive hardware resource consumption in the data center network is solved, and network traffic control with low resource consumption is achieved.

CN116389366BActive Publication Date: 2025-08-12XIDIAN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310335558.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-30
Publication Date
2025-08-12
Estimated Expiration
2043-03-30

AI Technical Summary

Technical Problem

In the data center network, hardware network cards need to maintain state machines and counters for thousands of send queues, resulting in excessive hardware resource overhead.

Method used

Using the FPGA-based flow control method, through the descriptor management module, token flow control module and rate calculation module, data packet information is parsed and flow control judgment results are generated, and the number of tokens is calculated periodically to reduce real-time tracking of the sending queue rate status.

Benefits of technology

It effectively reduces the hardware resource consumption on the FPGA and realizes network traffic control with low resource consumption.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116389366B_ABST
    Figure CN116389366B_ABST
Patent Text Reader

Abstract

The present invention discloses a low-resource flow control method based on an FPGA, which is applied to a network flow control system. The system includes: a descriptor management module, a token flow control module, and a rate calculation module. The method comprises: the descriptor management module parses the descriptor corresponding to a data packet to be sent, obtains a first queue number and the length of the data packet to be sent, and then sends a flow control query request to the token flow control module; the token flow control module queries the number of first tokens in the corresponding sending queue based on the first queue number and generates a flow control decision result; the token flow control module periodically sends a token injection request to the rate calculation module, the token injection request including the second queue number of any sending queue; and the rate calculation module calculates the number of second tokens to be injected into the token flow control module based on the sending rate corresponding to the second queue number. The present invention eliminates the need to track the sending rate status of each sending queue in real time, thereby reducing hardware resource consumption on the FPGA.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer technology, and in particular relates to a low resource consumption flow control method based on FPGA. Background Art

[0002] Network traffic control refers to controlling the sending rate of traffic-sending devices in the network according to the network protocol to avoid excessive traffic in the network and causing network congestion. In large-scale data center networks, the widely used traffic control protocol is the DCQCN protocol. This protocol controls the sending rate of each sending queue by maintaining a state machine for each sending queue. The state machine jumps as time goes by, so a counter needs to be added to each state machine. However, in data center networks, in order to reduce the overhead of the central processing unit (CPU), network protocols are usually implemented by hardware network cards. This requires maintaining a state machine and a counter for each sending queue in the network card. Considering the scale of the data center network, it may be necessary to maintain thousands of queues in a hardware network card. Correspondingly, it is necessary to maintain thousands of state machines and counters in the hardware network card, which will inevitably greatly increase the hardware resource overhead of the network card. Summary of the Invention

[0003] In order to solve the above problems existing in the prior art, the present invention provides a low-resource consumption flow control method based on FPGA. The technical problem to be solved by the present invention is achieved through the following technical solutions:

[0004] The present invention provides a low-resource consumption flow control method based on FPGA, which is applied to a network flow control system. The network flow control system includes: a descriptor management module, a token flow control module and a rate calculation module;

[0005] The FPGA-based low-resource consumption flow control method includes:

[0006] The descriptor management module parses the descriptor corresponding to the data packet to be sent, obtains the first queue number and the length information of the data packet to be sent in the descriptor, and then sends a flow control query request to the token flow control module, wherein the flow control query request includes the first queue number and the length information of the data packet to be sent;

[0007] The token flow control module queries the first token quantity of the corresponding sending queue according to the first queue number, and generates a flow control decision result according to the length information of the data packet to be sent and the first token quantity;

[0008] The token flow control module periodically sends a token injection request to the rate calculation module, where the token injection request includes the second queue number of any sending queue;

[0009] The rate calculation module calculates the second number of tokens that should be injected into the token flow control module based on the sending rate corresponding to the second queue number.

[0010] Compared with the prior art, the present invention has the following beneficial effects:

[0011] The present invention provides a low-power, queue-based network flow control method suitable for implementation on an FPGA. This method eliminates the need to track the send rate status of each send queue in real time. Instead, it maintains the latest rate status at each rate update. Each time a token bucket issues a token injection request, the difference in time and rate since the last token injection is calculated to determine the number of tokens required to be injected into the token bucket during that period. Network flow control is then achieved by limiting the number of tokens. Existing flow control methods require configuring a timer for each send queue on an FPGA, which consumes significant hardware resources and power. Therefore, the present invention effectively reduces hardware resource consumption on the FPGA.

[0012] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] Figure 1 This is a flow chart of a low-resource-consumption flow control method based on FPGA provided by an embodiment of the present invention;

[0014] Figure 2 This is a schematic diagram of RAM partitioning of token initial configuration information provided by an embodiment of the present invention;

[0015] Figure 3 This is a schematic diagram of the partitioning of the disposable token cache RAM provided by an embodiment of the present invention;

[0016] Figure 4 This is a schematic diagram of a simulation of key signals of the descriptor management module and the token flow control module provided in an embodiment of the present invention when a frame request successfully passes flow control;

[0017] Figure 5 This is a simulation diagram of key signals of the descriptor management module and the token flow control module when a frame request fails to pass flow control in an embodiment of the present invention;

[0018] Figure 6 This is another simulation diagram of key signals of the descriptor management module and the token flow control module when a frame request fails to pass flow control in an embodiment of the present invention;

[0019] Figure 7 This is a simulation diagram of key signals of the rate calculation module provided by an embodiment of the present invention when receiving a token injection request;

[0020] Figure 8 This is another simulation diagram of key signals when the rate calculation module provided by an embodiment of the present invention receives a token injection request;

[0021] Figure 9 This is a simulation diagram of a key signal when the byte counter of the rate calculation module provided by an embodiment of the present invention reaches a threshold;

[0022] Figure 10 This is a simulation diagram of key signals when the rate calculation module provided by an embodiment of the present invention receives a CNP frame;

[0023] Figure 11 2 is another simulation diagram of key signals when the rate calculation module provided by an embodiment of the present invention receives a CNP frame;

[0024] Figure 12 This is a simulation diagram of a key signal of the rate calculation module provided by an embodiment of the present invention when the time counter is full;

[0025] Figure 13 This is a simulation diagram of a key signal of the rate calculation module provided by an embodiment of the present invention when the time counter is full. DETAILED DESCRIPTION

[0026] The present invention will be further described in detail below with reference to specific examples, but the embodiments of the present invention are not limited thereto.

[0027] Figure 1 This is a flow chart of a low resource consumption flow control method based on FPGA provided by an embodiment of the present invention. Figure 1 As shown, an embodiment of the present invention provides a low-resource consumption flow control method based on FPGA, which is applied to a network flow control system. The network flow control system includes: a descriptor management module, a token flow control module and a rate calculation module;

[0028] The above-mentioned FPGA-based low-resource consumption flow control method includes:

[0029] S1. The descriptor management module parses the descriptor corresponding to the data packet to be sent, obtains the first queue number and the length information of the data packet to be sent in the descriptor, and then sends a flow control query request to the token flow control module, wherein the flow control query request includes the first queue number and the length information of the data packet to be sent;

[0030] S2. The token flow control module queries the first token quantity of the corresponding sending queue according to the first queue number, and generates a flow control decision result according to the length information of the data packet to be sent and the first token quantity;

[0031] S3. The token flow control module periodically sends a token injection request to the rate calculation module, where the token injection request includes the second queue number of any sending queue;

[0032] S4. The rate calculation module calculates the number of second tokens that should be injected into the token flow control module based on the sending rate corresponding to the second queue number.

[0033] In this embodiment, the token flow control module includes a disposable token cache RAM and a flow control decision module. The disposable token cache RAM is used to store the current number of disposable tokens of each sending queue;

[0034] In step S2, the token flow control module queries the first token quantity of the corresponding sending queue according to the first queue number, and generates a flow control decision result according to the length information of the data packet to be sent and the first token quantity, including:

[0035] S201, the disposable token cache RAM queries the current disposable token quantity of the corresponding sending queue according to the first queue number to obtain the first token quantity;

[0036] S202: The flow control decision module compares the length information represented by the first token quantity with the length information of the data packet to be sent, and generates a flow control decision result.

[0037] Specifically, the token flow control module uses the available token cache RAM to maintain the available token counts for all transmit queues. Typically, each transmit queue corresponds to a queue number, and the available token count represents the length of packets that can be sent from that transmit queue. Upon receiving a flow control query request from the descriptor management module, the token flow control module queries the first token count for the corresponding transmit queue based on the first queue number sent by the descriptor management module. It then compares the length of the packet to be sent with the first token count and issues a flow control decision.

[0038] Optionally, the token flow control module further includes a token injection control module and a token initial configuration information RAM. The token injection control module is used to continuously increase the number of tokens injected into the enable queue, and the token initial configuration information RAM stores initial configuration information of each sending queue.

[0039] Figure 2 Schematic diagram of RAM partitioning of token initial configuration information provided by an embodiment of the present invention. Figure 2As shown, the token initialization configuration information RAM 304 is 32 bits wide and 1024 bits deep. It is used to store the maximum token count for each transmit queue, i.e., the bucket capacity. The address is the corresponding queue number. If the number in the corresponding position is 0, token flow control is not enabled for that QP. The token initialization configuration information RAM 304 has two ports: port A is read by the rate injection module, and port B is connected to the CPU data for sending configurations.

[0040] Figure 3 Schematic diagram of the distribution of the available token cache RAM provided by the embodiment of the present invention. Figure 3 As shown, the available token buffer RAM 303 has a width of 32 bits and a depth of 1024, which is used to maintain the current number of tokens in each queue. It also contains a flag bit, which is the flag bit for starting flow control. When it is 1, it means starting flow control, and when it is 0, it means closing flow control. This flag bit can be used to control the opening and closing of the token bucket flow control.

[0041] Furthermore, after the token flow control module queries the first token quantity of the corresponding sending queue according to the first queue number and generates a flow control decision result according to the length information of the data packet to be sent and the first token quantity, the method further includes:

[0042] The descriptor management module temporarily stores or outputs the descriptor according to the flow control decision result; if the flow control decision result is failure, the descriptor management module temporarily stores the descriptor, and if the flow control decision result is success, the descriptor management module outputs the descriptor.

[0043] When the flow control decision result is successful, the token flow control module will send the length information of the data packet to be parsed to the rate calculation module. After receiving the length information and the first queue number, the rate calculation module will use the first queue number as the index to read the table content required for the byte count update from the rate related information RAM, and then call the byte count update logic to calculate BC new and b offset_ew , and finally write the updated content back to the rate-related information RAM.

[0044] Optionally, the rate calculation module includes a sent byte counter and a rate-related information RAM. It should be noted that the rate-related information RAM is used to store information related to the frame sending rate of the sending queue. Its depth corresponds to the number of queues, that is, each sending queue corresponds to one of the table entries. The specific contents of the table entries are shown in Table 1:

[0045] Table 1

[0046]

[0047]

[0048] When the flow control decision result is successful, after the step of generating the flow control decision result according to the length information of the data packet to be sent and the number of first tokens, the method further includes:

[0049] The rate calculation module updates the sent byte counter based on the length information b of the data packet to be sent;

[0050] Specifically, the rate calculation module updates the sent byte counter according to the following steps:

[0051] The rate calculation module receives the length information b of the data packet to be sent and the first queue number sent by the token flow control module, and obtains the sent byte counter from the rate related information RAM with the first queue number as the index to count to the threshold B. thr The number of times BC and the count value of the sent byte counter when it was last updated are equal to the threshold value B thr Modulo value b offset ;

[0052] Calculate the length information b and b offset The sum of the byte count and the current count value of the send byte counter is obtained;

[0053] Divide the current count value by threshold B thr Then add it to the number BC and get the sent byte counter count to threshold B thr The current number of BC new ;in,

[0054]

[0055] BC new As the sent bytes counter counts up to threshold B thr The number of times BC is calculated and written into the rate related information RAM;

[0056] Calculate the current count value of the sent byte counter relative to threshold B thr Modulo value b offset_new ;in,

[0057] b offset_new =od(b+b offset ,B thr );

[0058] b offset_new As the count value of the sent byte counter when it was last updated, the value of the threshold B thr Modulo value b offset , and write the rate related information into RAM.

[0059] Optionally, the rate calculation module includes a time counter, a ROM lookup table, and a rate related information RAM;

[0060] When the time counter is full, the rate calculation module updates the rate status information of all sending queues in a round-robin manner.

[0061] When the time counter is full, it can no longer be used to update the time record. Therefore, the new counter value must be used to update all entries in the rate-related information RAM, except for the byte counter. This embodiment uses a polling method to update each entry in the rate-related information RAM in sequence. Because the above traversal process is time-consuming, CNP frames may arrive during this period, so a FIFO is required to temporarily store the arriving CNP frames. The FIFO depth is: the rate-related information RAM depth × the number of clocks required to update each RAM entry × the clock cycle × the maximum number of frames that can be received per unit time.

[0062] Specifically, the rate calculation module updates the rate status information of all sending queues in a round-robin manner according to the following steps:

[0063] The rate calculation module enters the time counter full update state, takes the third queue number as the index, and reads the first rate status information from the rate related information RAM. The first rate status information includes the time counter counted to the threshold T when the sending queue corresponding to the third queue number is last updated. thr The number of times T, the count value t0 of the time counter when the rate status information is last updated, the count value t0 to the threshold value T thr Modulo value t offset1 , the rate reduction factor α of the most recent update, and the value t0 modulo K when the rate reduction factor α was last updated offset2 , where K represents the update period of the rate reduction factor, the third queue number is the queue number of any sending queue, and the third queue number is different from the second queue number;

[0064] Compare the current count value t of the time counter with the upper limit t max Add together to get the actual count value t of the time counter real ;

[0065] The actual count value t real With t offset1 Subtract the count value t0 of the time counter when the rate status information is most recently updated from the sum to obtain a first time interval;

[0066] Divide the first time interval by the threshold T thr The obtained quotient is rounded down and added to the number of times T to get the current count value of the time counter. thr The number of times T new ;in,

[0067]

[0068] T new When the time counter counts to the threshold value T as the last time the rate status information is updated thr The number of times T is written into the rate related information RAM;

[0069] The first time interval is set to the threshold value T thr Modulo, we get t offset1_new :

[0070] t offset1_new =Mod(t-t0+t offset1 ,T thr );

[0071] t offset1_new As t offset1 Write rate related information into RAM;

[0072] The actual count value t real With t offset2 After adding, the difference between the two values and the count value t0 is calculated to obtain a second time interval, and the address index address is calculated based on the second time interval; wherein,

[0073]

[0074] Query the ROM lookup table based on the address index address and obtain (1-g) address Value:

[0075] (1-g) address =ROM[address]

[0076] Wherein, the empirical parameter g = 1 / 256;

[0077] (1-g) address The value of is multiplied by the most recently updated rate reduction factor α to obtain the current rate reduction factor α new ;in,

[0078] α new =α*(1-g) address ;

[0079] α new Write rate-related information RAM as the rate reduction factor α of the most recently updated rate;

[0080] Take the first time interval modulo K to get t offset2_new :

[0081] t offset2_new =od(t-t0+t offset2 , K);

[0082] t offset2_new The value t modulo K of the count value of the time counter when the rate is reduced by factor α at the last update offset2 Write rate-related information into RAM.

[0083] In this embodiment, the ROM lookup table pre-stores (1-g) n The lookup table can be configured by software before the above flow control method is executed. It should be understood that the rate reduction factor α needs to be updated using (1-) n However, the calculation of powers in the FPGA can only be done by successive multiplication. That is, the calculation time is determined by the size of the power n, and the result cannot be obtained within a fixed time. Therefore, this embodiment precalculates each power of (1-) and stores it in a ROM lookup table using the power n as the address. In this way, the result can be directly queried from the ROM lookup table when the update rate decreases by a factor α.

[0084] In addition, since α, g and all powers of 1- are decimals, and FPGA cannot process decimals directly, we need to increase α, g and all powers of 1- by 2. 16 times, and α, g, and all powers of 1- are not zero, so the expanded value can be subtracted by 1 and represented by 16 bits. That is to say, if the initial value of α is 1, it is actually represented by 16'd65535.

[0085] In the above step S4, when the rate calculation module is in the time counter full update state, since the α update logic and rate calculation logic of the rate calculation module are already occupied, it is unable to serve the token injection request of the token flow control module. Therefore, the rate calculation module will use the second queue number in the token injection request as the index and directly read the corresponding table item from the rate-related information RAM, including: the sending rate of the sending queue corresponding to the second queue number at the time of the most recent token injection and the count value of the time counter, and use the sending rate at the time of the most recent token injection as the current rate to calculate the number N of tokens injected into the token flow control module.

[0086] Specifically, the rate calculation module calculates the number of second tokens to be injected into the token flow control module based on the sending rate corresponding to the second queue number, including:

[0087] S41, when the rate calculation module is in the time counter full update state, the second queue number in the token injection request is used as the index, and the sending rate R of the sending queue corresponding to the second queue number at the time of the most recent token injection is read from the rate related information RAM. C_last and the count value of the time counter at the last token injection t last ;

[0088] S42, R C_last As the current sending rate, calculate the current count value t of the time counter and t last the third time interval between;

[0089] S43, the third time interval and the current rate R C_last Multiply them together to get the second token number N that should be injected into the token flow control module:

[0090] N=R c_last (tt last );

[0091] S44, taking the current count value t of the time counter as the count value t of the time counter of the sending queue corresponding to the second queue number at the time of the most recent token injection last Then, the rate-related information is stored in RAM.

[0092] Furthermore, in the above step S4, when the rate calculation module is not in the counter full update state, the rate calculation module will use the second queue number in the token injection request as the index, read the table content of the rate-related information RAM, and calculate the latest current rate reduction factor and the new current sending rate, and calculate the number of tokens injected into the token flow control module. Finally, all updated variables need to be written back to the rate control information RAM.

[0093] Specifically, the rate calculation module calculates the number of second tokens to be injected into the token flow control module based on the sending rate corresponding to the second queue number, including:

[0094] S41′, when the rate calculation module is not in the time counter full update state, the rate calculation module uses the second queue number in the token injection request as an index to read the second rate status information from the rate related information RAM; the second rate status information includes: the time counter of the sending queue corresponding to the second queue number counts to the threshold value T when the rate status information is last updated. thr The number of times T, the count value t0 of the time counter when the rate status information is last updated, the count value t0 to the threshold value T thr Modulo value t offset1 , The sent byte counter counts to threshold B when it is last updated thr The number of times BC, the sending rate R before the last CNP frame arrives T_base , the sending rate R after the last CNP frame arrives C_bease , the sending rate R at the time of the most recent token injection C_last , the count value of the time counter at the last token injection t last, the rate reduction factor α of the most recent update, and the value t of the count value of the time counter modulo K when the rate reduction factor α was most recently updated offset2 ;

[0095] S42', compare the current count value t of the time counter with t offset1 The fourth time interval is obtained by summing the count value t0 and subtracting the count value t0;

[0096] S43′, dividing the fourth time interval by the threshold T thr Then round down and add it to the number T to get the number T of times the time counter counts to the threshold new ;in,

[0097]

[0098] S44', the number of times T new When the sending queue corresponding to the second queue number last updates the rate status information, the time counter counts to the threshold value T thr The number of times T is written into the rate related information RAM;

[0099] S44', compare the fourth time interval to the threshold value T thr Modulo, we get t offset1_new :

[0100] t offset1_new =od(t-t0+ offset1,thr );

[0101] S45'、 offset1_new The count value of the time counter of the sending queue corresponding to the second queue number when the rate status information is updated last time is equal to the threshold value T thr Modulo value t offset1 , and write the rate related information into RAM;

[0102] S46', take the number of times T new The sent byte counter reaches threshold B at the last update. thr The maximum value among the times BC is used as the stage where the current sending rate of the sending queue corresponding to the second queue number is located new :

[0103] stage new =Max(T new ,BC);

[0104] S47', judgment stage new Is it greater than or equal to 5? If not, set the current rate state to state newIf it is equal to 0, it means that the current sending rate is in the fast recovery state; if so, the current rate state is set to state new If it is equal to 1, it means that the current sending rate is in an actively increasing state;

[0105] S48', if state new is equal to 0, then according to R T_base 、R c_base and stage new Calculate the new current sending rate R according to the following formula C_new :

[0106] R C_new =R T_base -(R T_base- R C_base )>>stage new ;

[0107] S49', if state new is equal to 1, then according to R T_base , target rate increment parameter R AI and stage new Calculate the new current sending rate R according to the following formula c_new :

[0108]

[0109] S410', calculate the current count value t and t of the time counter last The fifth time interval between the c_new and R C_last The second token quantity N that should be injected into the token flow control module is obtained by multiplying the mean of

[0110]

[0111] S411', take the current count value t of the time counter as t last Write rate related information into RAM;

[0112] S412′, calculate the value t modulo the current count value t and the update period K of the time counter when the last update rate decrease factor α is taken. offset2 The sum of t and the difference between t and t0 is taken as the sixth time interval;

[0113] S413', calculate the address index address, and query the ROM query table based on the address index address to obtain (1-g) address The value of , where the empirical parameter g = 1 / 256:

[0114]

[0115] S414'、(1-g) address The value of is multiplied by the most recently updated rate reduction factor α to obtain the current rate reduction factor α new , and α new Write rate-related information to RAM as the rate reduction factor α for the most recent rate update:

[0116] α new =α*(1-g) address ;

[0117] S415′, take the sixth time interval modulo K to obtain t offset2_new :

[0118] t offset2_new =Mod(t-t0+t offset2 , K);

[0119] S416'、 offset2_new The value t modulo K of the count value of the time counter when the rate is reduced by factor α at the last update offset2 Write rate-related information into RAM.

[0120] The FPGA-based low-resource consumption flow control method provided by the present invention also includes:

[0121] When the rate calculation module receives a flow control frame CNP, it calculates the rate status information of the sending queue corresponding to the fourth queue number contained in the CNP frame.

[0122] When a CNP frame arrives, the rate calculation module uses the fourth queue number in the CNP frame as the index to read the table entry content of the rate-related information RAM to obtain the fourth rate status information, and then updates the rate reduction factor α, calculates α before the speed reduction, and calculates the sending rate before the speed reduction when the most recent CNP frame arrives, and then calculates the sending rate after the speed reduction when the most recent CNP frame arrives.

[0123] Specifically, when the rate calculation module receives a flow control frame CNP, the step of calculating the rate status information of the sending queue corresponding to the fourth queue number contained in the CNP frame includes:

[0124] The rate calculation module uses the fourth queue number as an index and reads the third rate status information from the rate-related information RAM; the third rate status information includes: the number of times T when the time counter of the sending queue corresponding to the fourth queue number counts to the threshold when the rate status information is last updated, the count value t0 of the time counter when the rate status information is last updated, and the value of the count value t0 relative to the threshold T. thr Modulo value toffset1 , The sent byte counter counts to threshold B when it is last updated thr The number of times BC, the sending rate R before the last CNP frame arrives T_base , the sending rate R after the last CNP frame arrives C_base , the rate reduction factor α of the most recent update and the value t of the count value of the time counter modulo K when the rate reduction factor α was most recently updated offset2 ;

[0125] The current count value t of the time counter is compared with t offset1 The seventh time interval is obtained by summing the count value t0 and subtracting it.

[0126] According to the seventh time interval, the threshold T tgr and times T, calculate the time counter counts to threshold T thr The number of times T new :

[0127]

[0128] Take the number of times T new The last time the sent byte counter was updated, the count reached threshold B. thr The maximum value of the number of BC is used as the stage where the current sending rate is located new :

[0129] stage new =Max(T new ,BC);

[0130] According to stage new 、R T_base 、R AI and R C_base Calculate the current sending rate R C_new ;

[0131] The current sending rate R C_new The sending rate R before the speed reduction when the latest CNP frame arrives T_base Write rate related information into RAM;

[0132] According to t offset2 , count value t0 and update cycle K to calculate address index address;

[0133] Query the ROM lookup table based on the address index address and obtain (1-g) address The value of and calculate the current rate reduction factor α new , where the empirical parameter g = 1 / 256;

[0134] After querying the ROM query table to obtain the value of parameter (1-g), according to R C_new , α new , the empirical parameter g and the value of (1-g) are used to calculate the transmission rate R′ after the speed reduction C_new and the rate reduction factor α′ after deceleration new :

[0135] R′ C_new =[R C_new *(16′d65535-α new >>1)]>>16;

[0136] α′ new =[(1-g)*α new ]》16;

[0137] R′ C_new The sending rate R after the last CNP frame arrives is reduced. C_base Write rate related information into RAM;

[0138] The rate reduction factor after deceleration is α′ new The rate reduction factor α as the most recently updated value is written into the rate-related information RAM;

[0139] The sending queue corresponding to the fourth queue number counts the time counter to the threshold value T when the sending rate is updated last time. thr The number of times T, t offset1 and t offset2 After clearing, write the rate-related information into RAM.

[0140] In this embodiment, the state machine included in the rate calculation module includes: IDLE state, PREPROCESS0 state, PREPROCESS1 state, UPDATA_PARAMETER_0 state, UPDATA_PARAMETER_1 state, UPDATA_PARAMETER_2 state, UPDATA_PARAMETER_3 state, and UPDATA_RAM state.

[0141] The IDLE state is used to wait for the start of the network flow control algorithm and the triggering of the rate state update event. When a data packet passes the flow control judgment and the byte counter count reaches the threshold, or when the time counter is full, or a CNP frame arrives, or a token injection request is received from the token flow control module, the state machine jumps to the PREPROCESS0 state;

[0142] The PREPROCESS0 state is used to read the information in the rate control information RAM, after which the state machine jumps to the PREPROCESS1 state;

[0143] The PREPROCESS1 state is used to calculate the number of time steps that the queue has experienced since the last rate update and rate reduction factor α, and then selects the next state machine jump according to the type of the current update operation. If the current operation type is an update operation caused by a data packet passing the flow control decision and the byte counter count reaching the threshold, the next state machine jumps to the UPDATA_PARAMETER_0 state. If the current operation type is an update operation caused by the time counter being full, the next state machine jumps to the UPDATA_PARAMETER_1 state. If the current operation type is an update operation caused by the arrival of a CNP frame, the next state machine jumps to the UPDATA_PARAMETER_2 state. If the current operation type is an update operation caused by receiving a token injection request from the token flow control module, the next state machine jumps to the UPDATA_PARAMETER_3 state.

[0144] The UPDATA_PARAMETER_0 state is used to calculate the latest byte step number, after which the state machine jumps to the UPDATA_RAM state;

[0145] The UPDATA_PARAMETER_1 state is used to calculate the latest rate, the latest rate reduction factor α, and other rate control information when the time counter is full. After that, the state machine jumps to the UPDATA_RAM state.

[0146] The UPDATA_PARAMETER_2 state is used to calculate the latest rate, the latest rate reduction factor α, and other rate control information when a CNP frame is received. After that, the state machine jumps to the UPDATA_RAM state.

[0147] The UPDATA_PARAMETER_3 state is used to calculate the latest rate, the latest rate reduction factor α, and other rate control information when receiving a token injection request from the token flow control module. After that, the state machine jumps to the UPDATA_RAM state.

[0148] The UPDATA_RAM state is used to update the latest rate, the latest rate reduction factor α and other rate control information into the rate control information RAM, after which the state machine jumps to the IDLE state.

[0149] Figure 4 This is a schematic diagram of the key signal simulation of the descriptor management module and token flow control module provided by the embodiment of the present invention when the frame request successfully passes the flow control. Figure 4As shown, s1_axis_local_cmd_* is an externally transmitted frame request descriptor signal. This request signal is first processed by the lookup table module (lookup_table) in the descriptor management module. In this embodiment, queue 0 has a frame request with a tag number marked as 0 and a frame payload length of 17'40 bytes. After receiving these signals, the lookup table module initiates a lookup table request (lookup_table_valid, lookup_table_addr, lookup_table_length) to the flow control decision module (qpflow_ctrl) in the token flow control module, using the queue number as the address. It should be noted that the frame length information in the lookup table request is the post-framing length information calculated based on the frame payload length and frame type. After the flow control decision module receives the table lookup request sent by the table lookup module, it will query the current token number RAM of the queue with the queue number as the address. It can be seen that the current token number (token_data_out) of queue 0 is 22'h10000 bytes, which is greater than the length of the request frame 17'h40 bytes, so the frame successfully passed the flow control decision. It should be noted that the 22nd bit of token_data_out does not represent the number of tokens, but indicates whether the queue corresponding to the address has the flow control mechanism enabled. After that, the flow control decision module writes the remaining token number (token_data_in) back to the current token number RAM, and returns the table lookup result signal (lookup_table_result_en, lookup_table_result) to the table lookup module. Since the frame sending request passed the table lookup successfully the first time, it does not need to enter the sub-descriptor management module for temporary storage.

[0150] Figure 5-6 This is a simulation diagram of the key signals of the descriptor management module and the token flow control module when the frame request fails to pass the flow control in the embodiment of the present invention. Figure 5 and Figure 6In this embodiment, the frame request descriptor of queue 0 is marked as tag 1. In the table lookup request sent by the table lookup module to the flow control decision module, the frame length information is 17'h10000, but the current token number obtained by the flow control decision module from the current token number RAM is 0, so the frame request fails to pass the flow control decision, and the flow control decision module then returns the decision failure result to the table lookup module. After receiving the flow control failure result, the table lookup module will temporarily store the frame request descriptor in the sub-description management module (des_management). After receiving the temporarily stored descriptor, the sub-descriptor management module will instruct the internal state machine (state) to enter a waiting state (state 2) and wait for a fixed time. During this period, the number of tokens in the token bucket gradually increases, and then the state machine will enter the polling state (state 4 and state 8), as shown in FIG. Figure 6 As shown, the state machine enters the polling state from the waiting state. At this time, the tag number currently polled is tag 1 that has not passed the flow control decision before. Then the sub-descriptor management module sends a frame request (m2_axis_local_cmd_*) with tag number 1 to the table lookup module. After receiving the request, the table lookup module will repeat the following steps: Figure 5 and Figure 6 The process shown sends a table lookup request to the flow control decision module, so it will not be repeated here.

[0151] Figure 7-8 FIG. 1 is a schematic diagram of a simulation of key signals when the rate calculation module according to an embodiment of the present invention receives a token injection request. Figure 7 As shown, in this embodiment, the rate calculation module receives a request (qp_speed_frd_en, qp_speed_faddr) from the token flow control module to inject tokens into queue 0. Then, the internal state machine (state) of the rate calculation module jumps from the IDLE state (state 001) to the PREPROCESS0 state (state 002) to read the rate control information (RAM_DATA signal group) of queue 0 stored in the rate control information RAM. Then, the state machine jumps to the PREPROCESS1 state (state 004) to calculate the number of time steps (quoeitnt_0 and quoeitnt_1) that the queue has experienced since the last rate update and rate reduction factor α update. Then, the state machine jumps to the UPDATA_PARAMETER_3 state (state 040), as shown in FIG. Figure 8As shown, in this state, the rate calculation logic and the rate reduction factor α update logic will be called to calculate the current rate and rate reduction factor α (current_rate and a), as well as other rate control information (rate_update signal group). At the same time, the latest rate (rate_new) and the rate at the time of the last token injection (last_rate), as well as the current update time (new_time) and the last update time (last_time) will be sent to the rate-token conversion logic to calculate the number of tokens that should be injected into the token bucket within the time from the last token injection. After that, the state machine jumps to the UPDATA_RAM state (state 080) to update the updated rate control information into the rate control information RAM. Finally, the state machine jumps back to the IDLE state.

[0152] Figure 9 This is a simulation diagram of a key signal when the byte counter of the rate calculation module provided by the embodiment of the present invention reaches the threshold. Figure 9 As shown, the token flow control module sends a signal (success_send_frame signal group) to the rate calculation module that queue 0 has successfully sent a frame. The length of the successfully sent frame is 17'h10000. After receiving the signal that the frame has been sent successfully, the rate calculation module adds the frame length to the byte counter corresponding to the queue. At this time, the byte counter corresponding to the queue just exceeds the threshold, so the byte counter full update flag (byte_counter_update_flag) is pulled high. It should be noted that the state machine is serving the token injection request at this time, so it is necessary to wait until the process is completed before serving the byte counter full update request.

[0153] Figure 10-11 FIG. 1 is a schematic diagram of a simulation of key signals when the rate calculation module according to an embodiment of the present invention receives a CNP frame. Figure 10 As shown in the figure, in this embodiment, the rate calculation module receives the CNP frame arrival signal corresponding to queue 1. It should be noted that at this time, the state machine is servicing the token injection request, so it has to wait until the process is completed before it can serve the rate update request caused by the arrival of the CNP frame. Figure 11 As shown, the rate calculation module will first calculate the rate before the speed reduction (current_rate_new) and use it as the new target rate R T_base (target_rate_base), then the rate calculation module will calculate the rate after the deceleration (current_rate) and use it as the new base rate R c_base .

[0154] Figure 12 and Figure 13: This is a simulation diagram of the key signal of the rate calculation module provided by the embodiment of the present invention when the time counter is full. In this embodiment, the counting threshold of the time counter is set to 32'h00000ffff for the convenience of simulation. Figure 12 As shown in the figure, the time counter full flag in the rate calculation module is pulled high when the time counter (sys_time) counts to 32'h00000fff. It should be noted that at this time, the state machine is servicing the token injection request, so it must wait until the process is completed before servicing the rate update request caused by the time counter full. Figure 13 As shown, when the rate calculation module serves the rate update request caused by the time counter being full, it can also serve the token injection request at the same time.

[0155] It can be seen from the above embodiments that the beneficial effects of the present invention are:

[0156] The present invention provides a low-power, queue-based network flow control method suitable for implementation on an FPGA. This method eliminates the need to track the send rate status of each send queue in real time. Instead, it maintains the latest rate status at each rate update. Each time a token bucket issues a token injection request, the difference in time and rate since the last token injection is calculated to determine the number of tokens required to be injected into the token bucket during that period. Network flow control is then achieved by limiting the number of tokens. Existing flow control methods require configuring a timer for each send queue on an FPGA, which consumes significant hardware resources and power. Therefore, the present invention effectively reduces hardware resource consumption on the FPGA.

[0157] In the description of the present invention, the terms "first" and "second" are used for descriptive purposes only and should not be understood to indicate or imply relative importance or implicitly specify the number of the technical features indicated. Therefore, a feature specified as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, "plurality" means two or more, unless otherwise specifically defined.

[0158] Descriptions with reference to the terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples" mean that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in any suitable manner in any one or more embodiments or examples. In addition, those skilled in the art can combine and combine different embodiments or examples described in this specification.

[0159] Although the present application is described herein in conjunction with various embodiments, in the process of implementing the claimed application, those skilled in the art can understand and implement other variations of the disclosed embodiments by reviewing the drawings, the disclosure, and the appended claims.

[0160] The above is a further detailed description of the present invention in conjunction with specific preferred embodiments, and the specific implementation of the present invention should not be considered to be limited to these descriptions. For those skilled in the art of the present invention, without departing from the concept of the present invention, several simple deductions or substitutions can be made, which should be considered to fall within the scope of protection of the present invention.

Claims

1. A low resource consumption flow control method based on FPGA, characterized in that: Applied to a network traffic control system, the network traffic control system comprises: a descriptor management module, a token flow control module and a rate calculation module; The FPGA-based low-resource consumption flow control method includes: The descriptor management module parses the descriptor corresponding to the data packet to be sent, obtains the first queue number and the length information of the data packet to be sent in the descriptor, and then sends a flow control query request to the token flow control module, wherein the flow control query request includes the first queue number and the length information of the data packet to be sent; The token flow control module queries the first token quantity of the corresponding sending queue according to the first queue number, and generates a flow control decision result according to the length information of the data packet to be sent and the first token quantity; The token flow control module periodically sends a token injection request to the rate calculation module, where the token injection request includes the second queue number of any sending queue; The rate calculation module calculates the number of second tokens that should be injected into the token flow control module based on the sending rate corresponding to the second queue number; The token flow control module includes a disposable token cache RAM and a flow control decision module, wherein the disposable token cache RAM is used to store the current disposable token quantity of each sending queue; The token flow control module queries the first token quantity of the corresponding sending queue according to the first queue number, and generates a flow control decision result according to the length information of the data packet to be sent and the first token quantity, including: The disposable token cache RAM queries the current disposable token quantity of the corresponding sending queue according to the first queue number to obtain the first token quantity; The flow control decision module generates a flow control decision result after comparing the length information represented by the first token quantity and the length information of the data packet to be sent; After the token flow control module queries the first token quantity of the corresponding sending queue according to the first queue number and generates a flow control decision result according to the length information of the data packet to be sent and the first token quantity, the method further includes: The descriptor management module temporarily stores or outputs the descriptor according to the flow control decision result; wherein, if the flow control decision result is failure, the descriptor management module temporarily stores the descriptor, and if the flow control decision result is success, the descriptor management module outputs the descriptor.

2. The FPGA-based low-resource consumption flow control method according to claim 1, characterized in that: The rate calculation module includes a sent byte counter and a rate related information RAM; When the flow control decision result is successful, after the step of generating the flow control decision result according to the length information of the data packet to be sent and the first token quantity, the method further includes: The rate calculation module updates the sent byte counter based on the length information b of the data packet to be sent; The rate calculation module updates the sent byte counter according to the following steps: The rate calculation module receives the length information b of the data packet to be sent and the first queue number sent by the token flow control module, and obtains the number of bytes sent from the rate related information RAM by taking the first queue number as the index. thr The number of times BC and the count value of the sent byte counter when it is last updated are relative to the threshold value B thr Modulo value b offset ; Calculate the length information b and b offset The sum of the sent bytes is obtained to obtain the current count value of the sent byte counter; Divide the current count value by threshold B thr Then add the number of times BC to get the number of bytes sent by the counter to the threshold B. thr The current number of BC new ;in, BC new As the sent bytes counter counts up to threshold B thr The number of times BC is written into the rate related information RAM; Calculate the current count value of the sent byte counter to the threshold value B thr Modulo value b offset_new ;in, b offset_new =Mod(b+b offset ,B thr ); b offset_new The count value of the sent byte counter when it is last updated is the threshold value B thr Modulo value b offset , and writes the rate related information into the RAM.

3. The FPGA-based low-resource consumption flow control method according to claim 2, characterized in that: The rate calculation module includes a time counter, a ROM lookup table and a rate related information RAM; When the time counter is full, the rate calculation module updates the rate status information of all sending queues in a round-robin manner; The rate calculation module updates the rate status information of all sending queues in a round-robin manner according to the following steps: The rate calculation module enters a time counter full update state, uses the third queue number as an index, and reads first rate status information from the rate-related information RAM. The first rate status information includes the time counter counted to the threshold T when the sending queue corresponding to the third queue number is last updated. thr The number of times T, the count value t0 of the time counter in the most recent rate state, the count value t0 to the threshold value T thr Modulo value t offset1 , the rate reduction factor α of the most recent update, and the value t0 modulo K when the rate reduction factor α was last updated offset2 , where K represents the update period of the rate reduction factor, the third queue number is the queue number of any sending queue, and the third queue number is different from the second queue number; The current count value t of the time counter is compared with the upper limit t max Add up to get the actual count value t of the time counter real ; The actual count value t real With t offset1 Subtracting the count value t0 of the time counter when the rate status information is most recently updated from the sum to obtain a first time interval; Divide the first time interval by the threshold value T thr The obtained quotient is rounded down and added to the number of times T to obtain the current count value of the time counter. thr The number of times T new ;in, T new When the time counter counts to the threshold value T as the last time the rate status information is updated thr times T and writes the rate-related information into the RAM; The first time interval is set to the threshold value T thr Modulo, we get t offset1_new : t offset1_new =Mod(t-t0+t offset1 ,T thr ); t offset1_new As t offset1 Writing the rate related information into the RAM; The actual count value t real With t offset2 After adding, the difference between the two values and the count value t0 is calculated to obtain a second time interval, and the address index address is calculated based on the second time interval; wherein, Based on the address index address, the ROM query table is searched to obtain (1-g) address Value: (1-g) address =ROM[address]; Wherein, the empirical parameter g = 1 / 256; The (1-g) address The value of is multiplied by the rate reduction factor α of the most recent update to obtain the current rate reduction factor α new ;in, α mew =α*(1-g) address ; α new Write rate-related information RAM as the rate reduction factor α of the most recently updated rate; The first time interval is modulo K to obtain t offset2_new : t offset2_new =Mod(t-t0+t offset2 ,K); t offset2_new The value t modulo K of the count value of the time counter when the rate is last updated by the factor α offset2 Write the rate related information into the RAM.

4. The FPGA-based low-resource consumption flow control method according to claim 3, characterized in that: The step of calculating, by the rate calculation module, the number of second tokens to be injected into the token flow control module based on the sending rate corresponding to the second queue number, includes: When the rate calculation module is in the time counter full update state, the second queue number in the token injection request is used as an index, and the sending rate R of the sending queue corresponding to the second queue number at the time of the most recent token injection is read from the rate related information RAM. C_last and the count value t of the time counter at the last token injection last ; R C_last As the current sending rate, calculate the current count value t of the time counter and t last the third time interval between; The third time interval is compared with the current rate R C_last Multiply them to obtain the second token quantity N that should be injected into the token flow control module: N=R C_last (t-t last ); The current count value t of the time counter is used as the count value t of the time counter of the sending queue corresponding to the second queue number at the time of the most recent token injection. last Then, the rate-related information is stored in the RAM.

5. The FPGA-based low-resource consumption flow control method according to claim 3, characterized in that: The step of calculating, by the rate calculation module, the number of second tokens to be injected into the token flow control module based on the sending rate corresponding to the second queue number, includes: When the rate calculation module is not in the time counter full update state, the rate calculation module uses the second queue number in the token injection request as an index to read the second rate status information from the rate-related information RAM; the second rate status information includes: the time counter of the sending queue corresponding to the second queue number counts to the threshold value T when the rate status information is last updated thr The number of times T, the count value t0 of the time counter when the rate status information is last updated, the count value t0 relative to the threshold value T thr Modulo value t offset1 , The sent byte counter counts to threshold B when it is last updated thr The number of times BC, the sending rate R before the last CNP frame arrives T_base , the sending rate R after the last CNP frame arrives C_base , the sending rate R at the time of the most recent token injection C_last , the count value t of the time counter at the last token injection last , the rate reduction factor α of the most recent update, and the value t of the count value of the time counter modulo K when the rate reduction factor α was most recently updated offset2 ; The current count value t of the time counter is compared with t offset1 The fourth time interval is obtained by summing the count value t0 and subtracting the count value t0; Divide the fourth time interval by the threshold value T thr Then round down and add it to the number T to get the number T of times the time counter counts to the threshold. new ;in, The number of times T new When the sending queue corresponding to the second queue number last updates the rate status information, the time counter counts to the threshold value T thr times T and writes the rate-related information into the RAM; The fourth time interval is set to the threshold value T thr Modulo, we get t offset1_new : t offset1_new =Mod(t-t0+t offset1 ,T thr ); t offset1_new The count value of the time counter of the sending queue corresponding to the second queue number when the rate status information is updated last time is equal to the threshold value T thr Modulo value t offset1 , and write the rate related information into the RAM; Take the number of times T new The sent byte counter reaches threshold B at the last update. thr The maximum value among the times BC is used as the stage where the current sending rate of the sending queue corresponding to the second queue number is located new : stage new =Max(T new ,BC); judgment stage new Is it greater than or equal to 5? If not, set the current rate state stage new If it is equal to 0, it means that the current sending rate is in the fast recovery state; if so, the current rate state stage new If it is equal to 1, it means that the current sending rate is in an actively increasing state; If state new is equal to 0, then according to R T_base 、R C_base and stage new Calculate the new current sending rate R according to the following formula C_new : R C_new =R T_base -(R T_base -R C_base )>>stage new ; If state new is equal to 1, then according to R T_base , target rate increment parameter R AI and stage new Calculate the new current sending rate R according to the following formula C_new : Calculate the current count value t and t of the time counter last and compare the fifth time interval with R C_new and R C_last The second token quantity N that should be injected into the token flow control module is obtained by multiplying the mean of The current count value t of the time counter is taken as t last Writing the rate related information into the RAM; Calculate the value t of the current count value t and the value t obtained by taking the modulo of the update period K of the time counter to the last update rate reduction factor α offset2 The sum of t and the difference between t and t0 is taken as the sixth time interval; Calculate the address index address, and query the ROM query table based on the address index address to obtain (1-g) address The value of , where the empirical parameter g = 1 / 256; The (1-g) address The value of is multiplied by the most recently updated rate reduction factor α to obtain the current rate reduction factor α new , and α new Write the rate-related information RAM as the rate reduction factor α of the most recent rate update; The sixth time interval is modulo K to obtain t offset2_new : t offset2_new =Mod(t-t0+t offset2 ,K); t offset2_new The value t modulo K of the count value of the time counter when the rate is last updated by the factor α offset2 Write the rate related information into the RAM.

6. The FPGA-based low-resource consumption flow control method according to claim 3, characterized in that: Also includes: When the rate calculation module receives a flow control frame CNP, it calculates the rate status information of the sending queue corresponding to the fourth queue number contained in the CNP frame.

7. The FPGA-based low-resource consumption flow control method according to claim 6, characterized in that: When the rate calculation module receives a flow control frame CNP, the step of calculating the rate status information of the sending queue corresponding to the fourth queue number contained in the CNP frame includes: The rate calculation module uses the fourth queue number as an index to read the third rate status information from the rate-related information RAM; the third rate status information includes: the number of times T when the time counter of the sending queue corresponding to the fourth queue number counts to the threshold when the rate status information is last updated, the count value t0 of the time counter when the rate status information is last updated, and the value of the count value t0 relative to the threshold T thr Modulo value t offset1 The sent byte counter counts to threshold B when it is last updated thr The number of times BC, the sending rate R before the last CNP frame arrives T_base , the sending rate R after the last CNP frame arrives C_base , the rate reduction factor α of the most recent update and the value t of the count value of the time counter modulo K when the rate reduction factor α is most recently updated offset2 ; The current count value t of the time counter is compared with t offset1 The seventh time interval is obtained by summing the count value t0 and subtracting it. According to the seventh time interval divided by the threshold T thr and the number of times T, calculate the time counter counts to the threshold T thr The number of times T new : Take the number of times T new The last time the sent byte counter was updated, it counted to threshold B. thr The maximum value of the number of BC is used as the stage where the current sending rate is located new ; According to stage new 、R T_base 、R AI and R C_base Calculate the current sending rate R C_new ; The current sending rate R C_new The sending rate R before the speed reduction when the latest CNP frame arrives T_base Writing the rate related information into the RAM; According to t offset2 , count value t0 and update cycle K to calculate address index address; Based on the address index address, the ROM query table is searched to obtain (1-g) address The value of and calculate the current rate reduction factor α new , where the empirical parameter g = 1 / 256; After querying the ROM query table to obtain the value of parameter (1-g), according to R C_new , α new , the empirical parameter g and the value of (1-g) are used to calculate the transmission rate R′ after the speed reduction C_new and the rate reduction factor α′ after deceleration new : R′ C_new =[R C_new *(16′d65535-a new >>1)]>>16; α′ new =[(1-g)*α new ]>>16; R′ C_new The sending rate R after the last CNP frame arrives is reduced. C_base Writing the rate related information into the RAM; The rate reduction factor after the deceleration is α′ new Writing the rate reduction factor α as the most recently updated one into the rate-related information RAM; The time counter of the sending queue corresponding to the fourth queue number counts to the threshold value T when the sending rate is updated last time. thr The number of times T, t offset1 and t offset2 After being cleared, the rate-related information is written into the RAM.

Citation Information

Patent Citations

  • Dynamic flow monitoring method

    CN105024942A

  • Satellite-borne equipment system for service traffic control and differentiated services

    CN107634913A