A flow arbitration device and method
By introducing an output queue structure consisting of an emergency queue, a satisfied queue, and an unsatisfied queue into the DWRR arbitrator, and prioritizing the processing of queues with high credit values and quickly refilling credit values, the performance degradation and overflow issues of DWRR when facing sudden large traffic flows are resolved, achieving accurate arbitration ratios and improving robustness.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-10
- Publication Date
- 2026-04-03
AI Technical Summary
In existing technologies, DWRR arbitrators suffer from performance degradation due to excessive credit value refills when faced with sudden surges in traffic. This can also lead to issues such as credit value counter overflow and inaccurate arbitration ratios.
An output queue structure including an emergency queue, a satisfied queue, and an unsatisfied queue is adopted. Arbitration request queue identifiers are added to different queues according to the current credit value threshold range, and the emergency queue with higher credit values is output first. By quickly refilling credit values, the risk of overflow is reduced and the arbitration performance is improved.
This effectively avoids the overflow problem caused by the accumulation of credit value errors, ensures the accuracy and robustness of the arbitration ratio, and improves the performance of the arbitrator.
Smart Images

Figure CN120238506B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of flow arbitration technology, and specifically relates to a flow arbitration device and method. Background Technology
[0002] Currently, the traffic arbitration part of the chip uses different arbitrators depending on the application scenario, such as RR (Round Robin), WRR (Weight Round Robin), DRR (Deficit Round Robin), and DWRR (Deficit Weight Round Robin). Summary of the Invention
[0003] The purpose of this application is to provide a flow arbitration device and method, which aims to solve the problems in related technologies such as the cumulative error caused by credit value refilling leading to overflow of the credit counter, and the degradation of arbitration performance due to excessive credit value refilling.
[0004] According to a first aspect of this application, a traffic arbitration device is provided, comprising: a credit value counter, a credit value management module, a queue processing module, and a polling arbitration module;
[0005] The credit value counter is used to record the current credit value corresponding to each arbitration request queue; the arbitration request queue is used to store data packets waiting to be sent.
[0006] The credit score management module is used to add the corresponding arbitration request queue identifier to the output queue according to the credit score threshold range where the current credit score is located when an arbitration request is triggered. The output queue includes an emergency queue, a satisfied queue, and an unsatisfied queue, and the credit score threshold range corresponding to the output queue is in the following order from high to low: emergency queue, satisfied queue, unsatisfied queue.
[0007] The queue processing module is configured to output the arbitration request queue identifier in one of the emergency queue and the satisfaction queue to the polling arbitration module when the emergency queue and / or the satisfaction queue are not empty, and the priority of outputting the arbitration request queue identifier in the emergency queue is higher than that of the satisfaction queue;
[0008] The polling arbitration module is used to poll the arbitration request queue corresponding to the arbitration request queue identifier received by the arbitration.
[0009] Compared to DWRR in related technologies, the traffic arbitration device in this application sets up an output queue including an emergency queue, a satisfied queue, and an unsatisfied queue. Based on the current credit value threshold range, the arbitration request queue identifier is added to different output queues. Furthermore, the arbitration request queue identifier in the emergency queue, which has a higher current credit value threshold range, is prioritized for output to the polling arbitration module. This allows the polling arbitration module to prioritize polling and arbitrating arbitration request queues with higher current credit values, thereby quickly reducing the credit value of these queues. This reduces the risk of overflowing the credit value counter due to high accumulated credit value errors, ensuring the correct DWRR arbitration ratio function.
[0010] In an optional implementation, the queue processing module is further configured to reset the current credit value of all arbitration request queues when both the emergency queue and the satisfied queue are empty, and the unsatisfied queue is not empty.
[0011] This approach ensures that when there are arbitration request queues with credit scores that meet the requirements, the queue with the higher credit score is prioritized for arbitration. Meanwhile, the queues with credit scores that do not meet the requirements are quickly polled for arbitration by refilling the credit scores.
[0012] In an optional implementation, the queue processing module resets the current credit value of the arbitration request queue to the current credit value of the arbitration request queue plus N times the weight value of the arbitration request queue; wherein, N is a natural number greater than or equal to 1, and N is determined based on the current credit value and weight value of the arbitration request queue with the largest current credit value in the queue that does not meet the requirement; the weight value corresponding to the arbitration request queue is preset.
[0013] The fast refill method adopted in this application determines in advance whether a sudden traffic surge has caused the credit value to be reduced to a smaller value. If this occurs, a weight value greater than 1 is directly refilled, thereby quickly restoring the credit value to a positive number and obtaining an arbitration result. This saves credit value refill time and improves arbitration performance.
[0014] In an optional implementation, when the difference between the maximum value corresponding to the credit value counter bit width and the current credit value is less than or equal to a set threshold, the current credit value is within the credit value threshold range corresponding to the emergency queue; when the difference between the maximum value corresponding to the credit value counter bit width and the current credit value is greater than the set threshold, and the current credit value is greater than 0, the current credit value is within the credit value threshold range corresponding to the satisfied queue; when the current credit value is less than or equal to 0, the current credit value is within the credit value threshold range of the unsatisfied queue.
[0015] The traffic arbitration device of this application dynamically adjusts the priority of the arbitration request queue internally, prioritizing the arbitration of queues whose credit values are about to overflow, thereby achieving the effect of rapid credit value reduction. This effectively avoids the problem of accumulated errors from multiple pre-fillings, which could lead to credit value overflow, thus ensuring the accuracy of the arbitration ratio and improving the robustness of arbitration.
[0016] In an optional implementation, the set thresholds corresponding to different arbitration request queues are calculated based on the weight values corresponding to the arbitration request queues;
[0017] After the polling arbitration module arbitrates the winning arbitration request queue, the credit value management module triggers the credit value counter corresponding to the winning arbitration request queue to subtract the data length of the currently dequeued data packet in the winning arbitration request queue from the current credit value.
[0018] This application accelerates the refilling of credit values to positive numbers by refilling the credit values of different arbitration request queues with corresponding multiples of the weight values, thereby reducing the credit value refilling time and improving arbitration performance when there is a surge in traffic.
[0019] According to a second aspect of this application, a traffic arbitration method is provided, comprising:
[0020] When an arbitration request is triggered, the credit value management module adds the corresponding arbitration request queue identifier to the output queue according to the credit value threshold range of the current credit value recorded by the credit value counter. The arbitration request queue is used to store data packets waiting to be sent, and each arbitration request queue corresponds to a credit counter. The output queue includes an emergency queue, a satisfied queue, and an unsatisfied queue, and the credit value threshold range corresponding to the output queue is in the following order from high to low: emergency queue, satisfied queue, unsatisfied queue.
[0021] When the emergency queue and / or the satisfaction queue are not empty, the queue processing module outputs the arbitration request queue identifier in one of the emergency queue and the satisfaction queue to the polling arbitration module, and the priority of outputting the arbitration request queue identifier in the emergency queue is higher than that of the satisfaction queue;
[0022] The polling arbitration module polls the arbitration request queue received by the arbitration system to identify the corresponding arbitration request queue.
[0023] In an optional implementation, the method further includes:
[0024] When the emergency queue and the satisfied queue are both empty, and the unsatisfied queue is not empty, the queue processing module resets the current credit value of all arbitration request queues.
[0025] In an optional implementation, resetting the current credit value of all arbitration request queues includes:
[0026] The queue processing module resets the current credit value of the arbitration request queue to the current credit value of the arbitration request queue plus N times the weight value of the arbitration request queue; wherein, N is a natural number greater than or equal to 1, and N is determined based on the current credit value and weight value of the arbitration request queue with the largest current credit value in the queue that does not meet the requirements; the weight value corresponding to the arbitration request queue is preset.
[0027] In an optional implementation, when the difference between the maximum value corresponding to the credit value counter bit width and the current credit value is less than or equal to a set threshold, the current credit value is within the credit value threshold range corresponding to the emergency queue; when the difference between the maximum value corresponding to the credit value counter bit width and the current credit value is greater than the set threshold, and the current credit value is greater than 0, the current credit value is within the credit value threshold range corresponding to the satisfied queue; when the current credit value is less than or equal to 0, the current credit value is within the credit value threshold range of the unsatisfied queue.
[0028] In an optional implementation, the set thresholds corresponding to different arbitration request queues are calculated based on the weight values corresponding to the arbitration request queues;
[0029] The method further includes:
[0030] After the polling arbitration module arbitrates the winning arbitration request queue, the credit value management module triggers the credit value counter corresponding to the winning arbitration request queue to subtract the data length of the currently dequeued data packet in the winning arbitration request queue from the current credit value.
[0031] Other features and advantages of this application will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the application. The objectives and other advantages of this application may be realized and obtained by means of the structures and processes shown in the description and the accompanying drawings. Attached Figure Description
[0032] To more clearly illustrate the technical solutions in the embodiments or related technologies of this application, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0033] Figure 1 This is a schematic diagram of the arbitration process based on the relevant technology of DWRR.
[0034] Figure 2This is a structural block diagram of a flow arbitration device according to an exemplary embodiment of this application.
[0035] Figure 3 This is a schematic diagram illustrating the effect of a traffic arbitration example according to an exemplary embodiment of this application.
[0036] Figure 4 This is a flowchart illustrating a traffic arbitration method according to an exemplary embodiment of this application. Detailed Implementation
[0037] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0038] The background technology mentions DWRR, which can implement RR, WRR, and DRR functions according to configuration, and combines the advantages of DRR and WRR. It supports setting weights for each queue and uses bytes as the arbitration unit. In the logical design, a credit value counter is set for each queue. When a queue is polled for dequeueing, its credit value counter is reduced by the dequeue message length. When the credit value counter is less than or equal to 0, the queue will no longer participate in the current arbitration. Each arbitration starts from the next queue after the last successfully dequeued queue. When at least one queue has a request, but the credit value counters of all requesting queues are less than or equal to 0, the credit value counters of all queues will be refilled with the weight value of the current queue, that is, the credit value is reset to the current credit value plus the weight value, and a new arbitration begins.
[0039] Due to the advantages of the algorithm, the traffic using DWRR arbitration will be more fair and uniform than DRR and WRR. Therefore, DWRR arbitrators are currently widely used in the field of chip design for traffic arbitration.
[0040] The flowchart of the DWRR arbitrator is as follows: Figure 1As shown, the DWRR arbitrator is generally implemented using a state machine, divided into three states: IDLE, REFILL, and ARB (arbitration), with an RR arbitrator (round-robin arbitrator) nested within each state. If a queue has a request and the credit value counter is greater than 0, the request for that queue is used as the input to the RR arbitrator. The result of the nested RR arbitrator is then the result of this DWRR arbitration. As mentioned earlier, if the credit value counters of all requesting queues are less than or equal to 0, the queue enters the REFILL state. The current credit value of all queues is added to the weight value of this queue until at least one requesting queue has a credit value greater than 0. The credit value counter of the queue dequeued in this arbitration is then reduced by the length of the dequeued message.
[0041] The aforementioned technologies have the following problems:
[0042] When a sudden surge in packet traffic occurs, the credit value of each queue in the arbitrator will be reduced to a very small negative number. If the weight value configured for the queue is small, the credit value needs to be refilled multiple times to change it from a very small negative number to a positive number. Each time the hardware circuit refills the credit value, it requires one clock cycle. Multiple refills will significantly degrade the arbitrator's performance. For example, if the current credit value is 100 and the weight value is 500, and a sudden surge in packet traffic of 9600 bytes occurs, the credit value will be reduced to -9500. Therefore, at least 19 hardware logic clock cycles are needed to refill the credit value to a positive number and obtain the arbitration result.
[0043] Furthermore, in the hardware circuitry, the arbitrator's requests may occur sequentially, making it impossible to guarantee that all queues will have requests simultaneously each time arbitration is initiated. If, at the start of arbitration, queues with positive credit values have no requests, while queues with requests have negative credit values, then according to the DWRR algorithm, all queues will undergo a credit value refill until the credit value of a requesting queue becomes positive. To address this situation—where some queues have positive credit values but are incorrectly refilled prematurely—the relevant technology uses a method where the credit value's bit width is two bits wider than the weight value's bit width. Therefore, an occasional premature credit value refill will not affect the overall DWRR arbitration function. However, if multiple premature credit value refills occur, cumulative errors will arise, causing the credit counter of a certain queue to overflow, ultimately resulting in inaccurate DWRR ratios and erroneous arbitration functionality.
[0044] Based on the above analysis, see Figure 2 As shown, this application provides an exemplary traffic arbitration device, including: a credit value counter, a credit value management module, a queue processing module, and a polling arbitration module;
[0045] A credit value counter is used to record the current credit value corresponding to each arbitration request queue; the arbitration request queue is used to store data packets waiting to be sent.
[0046] The credit score management module is used to add the corresponding arbitration request queue identifier to the output queue based on the current credit score threshold range when an arbitration request is triggered. The output queue includes an emergency queue, a satisfied queue, and an unsatisfied queue, and the credit score threshold ranges corresponding to the output queues are ordered from high to low as follows: emergency queue, satisfied queue, unsatisfied queue.
[0047] The queue processing module is used to output the arbitration request queue identifier in one of the emergency queue and the satisfaction queue to the polling arbitration module when the emergency queue and / or the satisfaction queue are not empty, and the priority of outputting the arbitration request queue identifier in the emergency queue is higher than that of the satisfaction queue.
[0048] The polling arbitration module is used to poll the arbitration request queue corresponding to the received arbitration request queue identifier.
[0049] For example, the traffic arbitration device has M arbitration request queues, where M is a natural number greater than 1. Each arbitration request queue stores data packets waiting to be sent. These data packets need to be arbitrated by the traffic arbitration device, and the data packets in the winning arbitration request queue are sent out. A weight value can be pre-set for each arbitration request queue. Initially, the credit value of the arbitration request queue is 0. After one credit value refill, the credit value equals the weight value. After each arbitration, the current credit value of the winning arbitration request queue is reduced by the length of the outgoing data packet. Therefore, each arbitration request queue has a corresponding credit value counter; that is, the traffic arbitration device sets up M credit value counters for the M arbitration request queues. Whenever arbitration is required, the credit value management module receives the arbitration request from the outside, then sequentially reads the current credit value of each credit value counter, and adds the corresponding arbitration request queue identifier to the output queue according to the credit value threshold range of the current credit value. The output queue includes an urgent queue, a satisfied queue, and an unsatisfied queue. In other words, three credit value threshold ranges can be preset, corresponding to an emergency queue, a satisfied queue, and an unsatisfied queue, respectively. Based on the current credit value's threshold range, the corresponding arbitration request queue identifier is placed into the emergency queue, satisfied queue, or unsatisfied queue. It should be noted that the credit value threshold ranges for these three queues, from highest to lowest, are: emergency queue, satisfied queue, or unsatisfied queue, and the credit value threshold ranges for these three queues do not overlap.
[0050] For example, upon receiving an external arbitration request, one scenario is that each of the M arbitration request queues contains data packets waiting to be sent; another scenario is that some arbitration request queues are empty, meaning there are no data packets waiting to be sent. In the latter case, the credit value management module can process only the arbitration request queues where the waiting data packets are not empty.
[0051] For example, after the credit score management module adds the arbitration request queues with arbitration requests to the corresponding output queues, the queue processing module outputs the arbitration request queue identifiers from the emergency queue or the satisfied queue to the polling arbitration module. If the emergency queue is not empty, all arbitration request queue identifiers in the emergency queue are output to the polling arbitration module first. If the emergency queue is empty but the satisfied queue is not empty, all arbitration request queue identifiers in the emergency queue are output to the polling arbitration module first. The polling arbitration module then polls and arbitrates the arbitration request queues corresponding to the received arbitration request queue identifiers. It should be noted that the current credit score of the arbitration request queues in the emergency queue is higher than that in the satisfied queue, and the current credit score of the arbitration request queues in the satisfied queue is higher than that in the unsatisfied queue. The purpose of setting up these three output queues in this application is to prioritize outputting arbitration request queues with higher current credit scores that are close to the maximum count range of the credit score counter to the polling arbitration module for participation in this round of arbitration, thus avoiding errors caused by credit score counter overflow in subsequent processes. In addition, the queue of unmet arbitration requests is filled with those whose current credit value has not met the arbitration conditions, while other arbitration request queues are placed in the queue of satisfied arbitration requests. When there are no arbitration request queues with credit values about to overflow, the arbitration request queues in the queue of satisfied arbitration requests participate in this round of arbitration.
[0052] Compared to DWRR in related technologies, the traffic arbitration device in this application sets up an output queue including an emergency queue, a satisfied queue, and an unsatisfied queue. Based on the current credit value threshold range, the arbitration request queue identifier is added to different output queues. Furthermore, the arbitration request queue identifier in the emergency queue, which has a higher current credit value threshold range, is prioritized for output to the polling arbitration module. This allows the polling arbitration module to prioritize polling and arbitrating arbitration request queues with higher current credit values, thereby quickly reducing the credit value of these queues. This reduces the risk of overflowing the credit value counter due to high accumulated credit value errors, ensuring the correct DWRR arbitration ratio function.
[0053] In some optional embodiments, the queue processing module is further configured to reset the current credit value of all arbitration request queues when both the emergency queue and the satisfied queue are empty, and the unsatisfied queue is not empty.
[0054] For example, the queue processing module also resets the current credit value corresponding to all arbitration request queues when both the emergency queue and the satisfaction queue are empty, but the non-satisfaction queue is not empty. In this application, the queue processing module first determines whether a fast refill of the current credit value is needed, and then resets the current credit value of each arbitration request queue using different refill methods based on the determination result. If a fast refill is not needed, the current credit value is refilled normally; if a fast refill is needed, a higher value is refilled for the current credit value, thereby reducing the number of times the current credit value is refilled and ensuring that the current credit value is refilled as a positive number. For example, when refilling the current credit value normally, a certain value is added to the current credit value, while during a fast refill, the value is increased by one or more times.
[0055] This approach ensures that when there are arbitration request queues with credit scores that meet the requirements, the queue with the higher credit score is prioritized for arbitration. Meanwhile, the queues with credit scores that do not meet the requirements are quickly polled for arbitration by refilling the credit scores.
[0056] In some optional embodiments, the queue processing module resets the current credit value of the arbitration request queue to the current credit value of the arbitration request queue plus N times the weight value of the arbitration request queue; where N is a natural number greater than or equal to 1, and N is determined based on the current credit value and weight value of the arbitration request queue with the largest current credit value in the queue; the weight value corresponding to the arbitration request queue is preset.
[0057] For example, the reset current credit value is the current credit value of the corresponding arbitration request queue plus N times the weight value. In other words, the current credit value is refilled with N times the weight value of the arbitration request queue, where N is a natural number greater than or equal to 1, and the value of N is related to the current credit value and the weight. As mentioned above, when it is determined that a fast refill is not needed, N can be 1, meaning a refill with 1 times the weight value. When it is determined that a fast refill of the current credit value is needed, N can be greater than 1, meaning a refill with more than 1 times the weight value.
[0058] For example, N can be 1, 2, or 4. The queue processing module can first calculate the first sum of the current credit value and twice the weight value of the arbitration request queue with the largest current credit value, and the second sum of the current credit value and four times the weight value, and determine the value of N based on the relationship between the first and second sums and 0.
[0059] For example, suppose the current credit value of the queue with the highest current credit value is A, and the weight of the queue is R. Then calculate the sum of the queue's credit value plus twice the weight value as Y (Y = A + 2R), and similarly calculate the sum of the queue's credit value plus four times the weight value as Z (Z = A + 4R). Finally, make the following judgment.
[0060] If Y > 0, then the current credit value of all queues in this round is refilled with the weight value (R) of that queue. That is, after refilling, the current credit value is equal to the current credit value plus 1 times the weight value. In this case, N is 1.
[0061] If Y < 0 and Z > 0, then the current credit value of all queues in this round is refilled with twice the weight value of that queue. That is, after refilling, the current credit value is equal to the current credit value plus twice the weight value of that queue (2R). In this case, N is 2.
[0062] If Z < 0, then the current credit value of all queues in this round is refilled with 4 times the weight value of that queue. That is, after refilling, the current credit value is equal to the current credit value plus 4 times the weight value of that queue (4R). In this case, N is 4.
[0063] When Y > 0, it means that all queues will have their weight values reset at most twice. This ensures that at least one queue's current credit value will be reset to a positive number, indicating that no large-scale traffic surge has occurred. In cases where a queue has an extremely low credit value, the weight value R can be reset based on the current credit value.
[0064] When Y < 0 and Z > 0, it means that all queues need to be refilled at least twice, but at most four times, so that at least one queue can have a positive credit value. Therefore, this time we directly refill the weight value by 2 times, which saves one unit of hardware time compared to related technologies, thus improving performance by 2 times.
[0065] When Z < 0, it indicates that the highest credit value in all queues is still negative after four refills. Therefore, this time we directly refill the value with four times the weight, which saves three times the hardware time of refilling the current credit value compared to related technologies, improving performance by four times.
[0066] The fast refill method adopted in this application determines in advance whether a sudden traffic surge has caused the credit value to be reduced to a smaller value. If this occurs, a weight value greater than 1 is directly refilled, thereby quickly restoring the credit value to a positive number and obtaining an arbitration result. This saves credit value refill time and improves arbitration performance.
[0067] In some optional embodiments, when the difference between the maximum value corresponding to the credit value counter bit width and the current credit value is less than or equal to a set threshold, the current credit value is within the credit value threshold range corresponding to the emergency queue; when the difference between the maximum value corresponding to the credit value counter bit width and the current credit value is greater than a set threshold, and the current credit value is greater than 0, the current credit value is within the credit value threshold range corresponding to the satisfied queue; when the current credit value is less than or equal to 0, the current credit value is within the credit value threshold range of the unsatisfied queue.
[0068] For example, in this application, if the current credit value is about to overflow, the arbitration request queue identifier is placed in the emergency queue; if the current credit value is not about to overflow and is greater than 0, the arbitration request queue identifier is placed in the satisfied queue; if the credit value is less than or equal to 0, the arbitration request queue identifier is placed in the unsatisfied queue.
[0069] For example, whether the current credit value is about to overflow is related to the bit width of the credit value counter. If the current credit value is close to the maximum value of the credit value counter's bit width, the corresponding arbitration request queue's credit value counter is more likely to overflow during the next round of credit value refilling. Therefore, this arbitration request queue can be placed in the emergency queue. If the current credit value differs significantly from the maximum value of the credit value counter's bit width, the corresponding arbitration request queue's credit value counter is less likely to overflow during the next round of credit value refilling. Therefore, this arbitration request queue is not placed in the emergency queue, but rather in the satisfied queue when the current credit value is greater than 0, and in the unsatisfied queue when it is less than or equal to 0. Therefore, a preset threshold can be set to determine whether the current credit value is close to the maximum value of the credit value counter's bit width.
[0070] For example, due to occasional asynchronous inputs in the hardware circuit of the DWRR in related technologies (i.e., input requests between queues occur sequentially), the DWRR prematurely refills weight values. Multiple accumulations of this can lead to credit value overflow in a certain queue (i.e., the actual credit value exceeds the bit width of the credit value counter), resulting in errors. Compared to the DWRR in related technologies, the flow arbitration device of this application adds an emergency queue. Whenever a request to start arbitration is received, assuming the credit value of a queue that meets the arbitration conditions (a request and a current credit value greater than 0) is P, the weight value of that queue is R, and the maximum bit width of the credit value counter is M. If P+2R>=M, the queue's identifier is added to the emergency queue; if P>0 and P+2R<M, the queue's identifier is added to the satisfied queue; if P<0, the queue's identifier is added to the unsatisfied queue.
[0071] The condition for the emergency queue, P+2R>M, indicates that if the current credit value P is re-filled with weight values twice, the current credit value of the queue will overflow. Therefore, the priority of this queue needs to be increased to prioritize arbitration requests, causing the credit value of the queue to drop rapidly and reducing the risk of credit value overflow. Once the credit value of the queue drops below a set threshold (M-2R), the requests are added to the satisfied queue. When the credit value P of the queue is less than or equal to 0, the requests are added to the unsatisfied queue.
[0072] The traffic arbitration device of this application dynamically adjusts the priority of the arbitration request queue internally, prioritizing the arbitration of queues whose credit values are about to overflow, thereby achieving the effect of rapid credit value reduction. This effectively avoids the problem of accumulated errors from multiple pre-fillings, which could lead to credit value overflow, thus ensuring the accuracy of the arbitration ratio and improving the robustness of arbitration.
[0073] In some optional embodiments, the set thresholds corresponding to different arbitration request queues are calculated based on the weight values corresponding to the arbitration request queues;
[0074] After the polling arbitration module arbitrates the winning arbitration request queue, the credit value management module triggers the credit value counter corresponding to the winning arbitration request queue to subtract the data length of the currently dequeued data packet in the winning arbitration request queue from the current credit value.
[0075] For example, as mentioned above, the criterion for determining whether the current credit value will overflow is whether the difference between the maximum value of the credit counter bit width and the current credit value is less than a set threshold. Since this application assigns a weight of N times to the current credit value refill value, especially when rapid refilling is required, the risk of credit value overflow is likely to occur when N is greater than 1. Therefore, the set threshold can be set according to the weight value, especially when N is greater than 1, such as the set threshold being 2 times the weight value.
[0076] This application accelerates the refilling of credit values to positive numbers by refilling the credit values of different arbitration request queues with corresponding multiples of the weight values, thereby reducing the credit value refilling time and improving arbitration performance when there is a surge in traffic.
[0077] The following specific examples illustrate how this application can reduce credit score refill time and improve arbitration performance compared to related technologies.
[0078] For example, see Figure 3 As shown, there are two arbitration request queues: Queue 1 (weight value 300) and Queue 2 (weight value 200). In Round 1 (the first round of arbitration), upon receiving an arbitration request, the arbitration module polls the queues sequentially. The first queue to win is Queue 1, with a credit value of 300 (initially equal to the weight value). The length of the first data packet to be sent in Queue 1 is 500. After this packet is sent, the credit value of Queue 1 is 300 - 500 = -200. Upon receiving another arbitration request, the arbitration module polls the queues sequentially. This time, Queue 2 wins, with a credit value of 200. The length of the first data packet to be sent in Queue 2 is 300. After this packet is sent, the credit value of Queue 2 is 200 - 300 = -100. Round 1 is then complete.
[0079] In Round 2, since the credit values of both Queues 1 and 2 are less than 0, the credit values need to be refilled. Queues 2 have the higher credit value; its credit value of -100 plus twice the weight value of 400 (Queues 2's weight is 200) equals 300, which is greater than 0. Therefore, this time, the refilling is performed in the usual way, that is, the current credit values of Queues 1 and 2 are both increased by their respective weight values. The refilled current credit value of Queues 1 is -200 + 300 = 100, and the refilled current credit value of Queues 2 is -100 + 200 = 100. Next, the polling arbitration module first arbitrates queue 1 as the winning queue, and then sends a second data packet of length 2500 from queue 1. The current credit value of queue 1 is updated to 100-2500=-2400. Then, queue 2 is arbitrated as the winning queue, and then sends a second data packet of length 3200 from queue 2. The current credit value of queue 2 is updated to 100-3200=-3100. In Round 2, the traffic of the second data packet of queues 1 and 2 is relatively large, with queue 1 having a length of 2500 and queue 2 having a length of 3200. This can be considered as a traffic burst, which causes the current credit values of both queues to become extremely small.
[0080] Therefore, in Round 3, since the current credit value of queue 1 with the larger current credit value plus 4 times the weight value is less than 0, that is, -2400 + 1200 = -1200, the current credit value needs to be quickly refilled. Thus, the current credit value of queues 1 and 2 is increased by 4 times the weight value respectively. The current credit values of queues 1 and 2 after refilling are -1200 and -2300 respectively. In Round 4, the current credit values of queues 1 and 2 are still negative, so the current credit value is quickly refilled again. This time, the weight value is also quickly refilled by 4 times. The current credit values of queues 1 and 2 after refilling are 0 and -1500 respectively. In Round 5, the credit value of queue 1 is 0, and the credit value of queue 2 is still negative. Therefore, the current credit value is refilled. Since the current credit value of queue 1 becomes a number greater than 0 after being refilled with 1 times the weight value, queues 1 and 2 can each be refilled with 1 times the weight value. After refilling, the current credit values are 300 and -1300 respectively. Then, the polling arbitration module can correctly arbitrate the third data packet of queue 1 in Round 5.
[0081] However, if using an arbitrator in related technologies, the third data packet in queue 1 needs to be arbitrated in Round 11. Therefore, when facing large-volume bursts, the traffic arbitration device of this application can improve hardware performance by 4 times compared to arbitrators in related technologies. If even higher performance is required in the hardware, the maximum multiplier for fast refill can be increased to 8, 16, etc., ultimately achieving the effect of restoring the credit value to a greater than 0 in one pass. The hardware logic implementation only requires shifting the weight value to the left, eliminating the need for complex multipliers and significantly saving hardware resources.
[0082] Accordingly, see Figure 4 As shown, this application also provides an exemplary traffic arbitration method, including:
[0083] Step S401: Upon triggering an arbitration request, the credit value management module adds the corresponding arbitration request queue identifier to the output queue according to the credit value threshold range of the current credit value recorded by the credit value counter. The arbitration request queue is used to store data packets waiting to be sent, and each arbitration request queue corresponds to a credit counter. The output queue includes an emergency queue, a satisfied queue, and an unsatisfied queue, and the credit value threshold ranges corresponding to the output queues are ordered from high to low as follows: emergency queue, satisfied queue, unsatisfied queue.
[0084] Step S402: When the emergency queue and / or the satisfaction queue are not empty, the queue processing module outputs the arbitration request queue identifier in one of the emergency queue and the satisfaction queue to the polling arbitration module, and the priority of outputting the arbitration request queue identifier in the emergency queue is higher than that of the satisfaction queue.
[0085] Step S403: The polling arbitration module polls the arbitration request queue corresponding to the arbitration request queue identifier received by the arbitration.
[0086] In some optional embodiments, the method further includes:
[0087] When both the emergency queue and the satisfied queue are empty, and the unsatisfied queue is not empty, the queue processing module resets the current credit value of all arbitration request queues.
[0088] In some optional embodiments, the current credit value of all arbitration request queues is reset, including:
[0089] The queue processing module resets the current credit value of the arbitration request queue to the current credit value of the arbitration request queue plus N times the weight value of the arbitration request queue; where N is a natural number greater than or equal to 1, and N is determined based on the current credit value and weight value of the arbitration request queue with the largest current credit value in the queue; the weight value corresponding to the arbitration request queue is preset.
[0090] In some optional embodiments, when the difference between the maximum value corresponding to the credit value counter bit width and the current credit value is less than or equal to a set threshold, the current credit value is within the credit value threshold range corresponding to the emergency queue; when the difference between the maximum value corresponding to the credit value counter bit width and the current credit value is greater than a set threshold, and the current credit value is greater than 0, the current credit value is within the credit value threshold range corresponding to the satisfied queue; when the current credit value is less than or equal to 0, the current credit value is within the credit value threshold range of the unsatisfied queue.
[0091] In some optional embodiments, the set thresholds corresponding to different arbitration request queues are calculated based on the weight values corresponding to the arbitration request queues;
[0092] The method also includes:
[0093] After the polling arbitration module arbitrates the winning arbitration request queue, the credit value management module triggers the credit value counter corresponding to the winning arbitration request queue to subtract the data length of the currently dequeued data packet in the winning arbitration request queue from the current credit value.
[0094] The above method can be implemented by the traffic arbitration device provided in the above embodiments. For the specific implementation method, please refer to the description of the traffic arbitration device in the above embodiments, which will not be repeated here.
[0095] It is understood that the circuit structures, names, and parameters described in the above embodiments are merely examples. Those skilled in the art can also make readily conceived combinations and adjustments to the structural features of the above embodiments according to their needs, and the concept of this application should not be limited to the specific details of the above examples.
[0096] Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A flow arbitration device, characterized in that, include: Credit score counter, credit score management module, queue processing module, and polling arbitration module; The credit value counter is used to record the current credit value corresponding to each arbitration request queue; The arbitration request queue is used to store data packets waiting to be sent; The credit score management module is used to add the corresponding arbitration request queue identifier to the output queue according to the credit score threshold range where the current credit score is located when an arbitration request is triggered. The output queue includes an emergency queue, a satisfied queue, and an unsatisfied queue, and the credit score threshold range corresponding to the output queue is in the following order from high to low: emergency queue, satisfied queue, unsatisfied queue. The queue processing module is configured to output the arbitration request queue identifier in one of the emergency queue and the satisfaction queue to the polling arbitration module when the emergency queue and / or the satisfaction queue are not empty, and the priority of outputting the arbitration request queue identifier in the emergency queue is higher than that of the satisfaction queue. The polling arbitration module is used to poll the arbitration request queue corresponding to the arbitration request queue identifier received by the arbitration; The queue processing module is further configured to reset the current credit value of all arbitration request queues when both the emergency queue and the satisfied queue are empty, and the unsatisfied queue is not empty. The queue processing module resets the current credit value of the arbitration request queue to the current credit value of the arbitration request queue plus N times the weight value of the arbitration request queue; wherein, N is a natural number greater than or equal to 1, and N is determined based on the current credit value and weight value of the arbitration request queue with the largest current credit value in the queue that does not meet the requirement. The weight values corresponding to the arbitration request queue are preset.
2. The flow arbitration device according to claim 1, characterized in that, When the difference between the maximum value corresponding to the width of the credit value counter and the current credit value is less than or equal to a set threshold, the current credit value is within the credit value threshold range corresponding to the emergency queue; when the difference between the maximum value corresponding to the width of the credit value counter and the current credit value is greater than the set threshold, and the current credit value is greater than 0, the current credit value is within the credit value threshold range corresponding to the satisfied queue; when the current credit value is less than or equal to 0, the current credit value is within the credit value threshold range of the unsatisfied queue.
3. The flow arbitration device according to claim 2, characterized in that, The set thresholds corresponding to different arbitration request queues are calculated based on the weight values corresponding to the arbitration request queues; After the polling arbitration module arbitrates the winning arbitration request queue, the credit value management module triggers the credit value counter corresponding to the winning arbitration request queue to subtract the data length of the currently dequeued data packet in the winning arbitration request queue from the current credit value.
4. A flow arbitration method, characterized in that, include: When an arbitration request is triggered, the credit score management module adds the corresponding arbitration request queue identifier to the output queue based on the credit score threshold range of the current credit score recorded by the credit score counter. The arbitration request queue is used to store data packets waiting to be sent, and each arbitration request queue corresponds to a credit counter; the output queue includes an emergency queue, a satisfied queue, and an unsatisfied queue, and the credit value threshold range corresponding to the output queue is in the following order from high to low: emergency queue, satisfied queue, unsatisfied queue; When the emergency queue and / or the satisfaction queue are not empty, the queue processing module outputs the arbitration request queue identifier in one of the emergency queue and the satisfaction queue to the polling arbitration module, and the priority of outputting the arbitration request queue identifier in the emergency queue is higher than that of the satisfaction queue. The polling arbitration module polls the arbitration request queue received by the arbitration system to identify the corresponding arbitration request queue. The method further includes: When the emergency queue and the satisfied queue are both empty, and the unsatisfied queue is not empty, the queue processing module resets the current credit value of all arbitration request queues. The resetting of the current credit value of all arbitration request queues includes: The queue processing module resets the current credit value of the arbitration request queue to the current credit value of the arbitration request queue plus N times the weight value of the arbitration request queue; wherein, N is a natural number greater than or equal to 1, and N is determined based on the current credit value and weight value of the arbitration request queue with the largest current credit value in the queue that does not meet the requirements; the weight value corresponding to the arbitration request queue is preset.
5. The flow arbitration method according to claim 4, characterized in that, When the difference between the maximum value corresponding to the width of the credit value counter and the current credit value is less than or equal to a set threshold, the current credit value is within the credit value threshold range corresponding to the emergency queue; when the difference between the maximum value corresponding to the width of the credit value counter and the current credit value is greater than the set threshold, and the current credit value is greater than 0, the current credit value is within the credit value threshold range corresponding to the satisfied queue; when the current credit value is less than or equal to 0, the current credit value is within the credit value threshold range of the unsatisfied queue.
6. The flow arbitration method according to claim 5, characterized in that, The set thresholds corresponding to different arbitration request queues are calculated based on the weight values corresponding to the arbitration request queues; The method further includes: After the polling arbitration module arbitrates the winning arbitration request queue, the credit value management module triggers the credit value counter corresponding to the winning arbitration request queue to subtract the data length of the currently dequeued data packet in the winning arbitration request queue from the current credit value.
Citation Information
Patent Citations
Multi-port access arbitration method and device, equipment and storage medium
CN117312199A
Methods and systems that manage fetching of commands by a controller from queues of a host
US20190303309A1