Resource allocation method and device of network chip, network chip and electronic equipment

By adjusting the dynamic weights according to the load status of the nodes in the network chip, the problem of traffic fluctuation in the weighted polling scheduling method is solved, and a fairer and more stable resource allocation is achieved.

CN120750867APending Publication Date: 2025-10-03T-HEAD (SHANGHAI) SEMICON CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510927407.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-04
Publication Date
2025-10-03

AI Technical Summary

Technical Problem

When the amount of node data is unstable, the existing weighted round-robin scheduling method causes some nodes to occupy resources for a long time, resulting in traffic fluctuations and unfairness.

Method used

By reducing the dynamic weight of the target node when the amount of data is low, the resource allocation strategy of the network chip is adjusted to ensure the fairness and stability of traffic.

Benefits of technology

It effectively alleviates traffic fluctuations, improves the fairness of resource allocation, reduces conflicts between nodes, and ensures the responsiveness of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120750867A_ABST
    Figure CN120750867A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a resource allocation method and device for a network chip, the network chip and electronic equipment. According to the embodiment of the invention, the load state of the target node in the current cycle is determined according to the data frequency parameter of the target node connected with the network chip in the current cycle and the data quantity of the target node in the current cycle of the current cycle, and when the load state of the target node in the current cycle is determined to be low load, the dynamic weight corresponding to the target node is reduced. In the embodiment of the invention, the dynamic weight represents the remaining number of times that the target node can be scheduled in the current round, so that the possibility that part of nodes occupy resources for a long time is reduced in a manner of reducing the dynamic weight of the target node when the data quantity of the target node in the current round is relatively low; therefore, the flow fluctuation condition is relieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of semiconductor technology, and more particularly, to a resource allocation method and device for a network chip, a network chip, and an electronic device. Background Art

[0002] To ensure fair resource use among nodes connected to the network chip and improve the system's Quality of Service (QoS), the network chip can employ various traffic distribution methods. For example, weighted round-robin scheduling performs round-robin scheduling based on the dynamic weight of each node until the dynamic weight of each node drops to 0. However, if nodes have similar configuration weights but significantly different dynamic weights, nodes with higher dynamic weights will continue to occupy resources, while nodes with a dynamic weight of 0 will be unable to use resources, causing traffic fluctuations. Summary of the Invention

[0003] In view of this, an embodiment of the present invention provides a resource allocation method, device, network chip and electronic device for a network chip, so as to reduce the possibility of some nodes occupying resources for a long time by lowering the dynamic weight of the target node when the amount of data in the current round of the target node is low, thereby alleviating traffic fluctuations.

[0004] In a first aspect, an embodiment of the present invention provides a resource allocation method for a network chip, the method comprising:

[0005] Determining a load state of a target node in a current cycle of a current round, where the load state is determined based on a data frequency parameter of the target node in the current round and a first data quantity, where the first data quantity is the amount of data of the target node in the current cycle;

[0006] In response to the load status characterizing that the target node is low-loaded, the dynamic weight corresponding to the target node is reduced, and the dynamic weight is used to characterize the remaining number of times the target node can be scheduled in the current round. The low load characterizes that the amount of data of the target node in the current round is lower than a first quantity threshold.

[0007] Optionally, the data frequency parameter is represented by the number of tokens corresponding to the target node;

[0008] Determining the load status of the target node in the current cycle of the current round includes:

[0009] Read the token bucket of the target node to determine the number of tokens;

[0010] In response to the number of tokens reaching a second number threshold and the first data number being 0, it is determined that the load state is low load.

[0011] Optionally, the data frequency parameter is represented by an idle cycle count corresponding to the target node;

[0012] Determining the load status of the target node in the current cycle of the current round includes:

[0013] In response to the idle cycle count reaching a third quantity threshold and the first data quantity being 0, the load state is determined to be low load.

[0014] Optionally, the idle cycle count is determined by:

[0015] Acquire the second data quantity corresponding to the target node in each cycle;

[0016] In response to the second data quantity being 0, accumulating the idle cycle count;

[0017] In response to the second data quantity being not 0, resetting the idle cycle count to an initial value, where the initial value is 0.

[0018] Optionally, the method further includes:

[0019] Determine a weight storage device corresponding to the network chip according to the number of the target nodes, where the weight storage device is a register or a memory;

[0020] Storing the configuration weight and the dynamic weight of each target node in the weight storage device;

[0021] Determining the load status of the target node in the current cycle of the current round includes:

[0022] In response to the weight storage device being a memory, the load state is determined according to a preset scanning period.

[0023] Optionally, the minimum value of the dynamic weight is a preset value.

[0024] In a second aspect, an embodiment of the present invention provides a resource allocation device for a network chip, the device comprising:

[0025] a state determining unit, configured to determine a load state of the target node in a current cycle of a current round, wherein the load state is determined based on a data frequency parameter of the target node in the current round and a first data quantity, where the first data quantity is the amount of data of the target node in the current cycle;

[0026] A weight updating unit is used to reduce the dynamic weight corresponding to the target node in response to the load state characterizing that the target node is low-loaded, until the dynamic weight reaches a preset weight threshold, the dynamic weight is used to characterize the remaining number of times the target node can be scheduled in the current round, and the low load characterizes that the amount of data of the target node in the current round is lower than a first quantity threshold.

[0027] In a third aspect, an embodiment of the present invention provides a network chip, comprising:

[0028] a parameter counter configured to determine a data frequency parameter of a corresponding node in a current round;

[0029] A scheduling unit is configured to determine a load state of a target node in a current cycle of a current round, wherein the load state is determined based on the data frequency parameter and a first data quantity corresponding to the target node, wherein the first data quantity is the amount of data of the target node in the current cycle, and in response to the load state characterizing that the target node is low-loaded, reduce a dynamic weight corresponding to the target node, wherein the dynamic weight is used to characterize the remaining number of times the target node can be scheduled in the current round, and wherein the low load characterizes that the amount of data of the target node in the current round is lower than a first quantity threshold.

[0030] Optionally, the parameter counter is a traffic shaper, the traffic shaper is configured to store the number of tokens of the corresponding node, and the tokens are stored in a token bucket of the corresponding node;

[0031] The scheduling unit is further configured to:

[0032] In response to the number of tokens reaching a second number threshold and the first data number being 0, it is determined that the load state is low load.

[0033] Optionally, the parameter counter is a cycle counter, and the cycle counter is configured to determine an idle cycle count of a corresponding node;

[0034] The scheduling unit is further configured to:

[0035] In response to the idle cycle count reaching a third quantity threshold and the first data quantity being 0, the load state is determined to be low load.

[0036] In a fourth aspect, an embodiment of the present invention provides an electronic device comprising a memory and a processor, wherein the memory is used to store one or more computer program instructions, and the processor comprises a network chip, wherein the one or more computer program instructions are executed by the network chip to implement a method as described in any one of the first aspects.

[0037] In a fifth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method as described in any one of the first aspects is implemented.

[0038] In a sixth aspect, an embodiment of the present invention provides a computer program product, comprising a computer program / instruction, which implements the method as described in any one of the first aspects when executed by a processor.

[0039] The embodiment of the present invention determines the load state of the target node in the current cycle based on the data frequency parameters of the target node connected to the network chip in the current round and the amount of data in the current cycle of the current round, and reduces the dynamic weight corresponding to the target node when it is determined that the load state of the target node in the current cycle is low. In the embodiment of the present invention, the dynamic weight represents the remaining number of times the target node can be scheduled in the current round. Therefore, this embodiment reduces the possibility of some nodes occupying resources for a long time by reducing the dynamic weight of the target node when the amount of data in the current round is low, thereby alleviating traffic fluctuations. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The above and other objects, features and advantages of the present invention will become more apparent through the following description of the embodiments of the present invention with reference to the accompanying drawings, in which:

[0041] Figure 1 is a flow chart of a resource allocation method for a network chip according to an embodiment of the present invention;

[0042] Figure 2 is a flow chart of a resource allocation method for a network chip according to an embodiment of the present invention;

[0043] Figure 3 is a flow chart of a resource allocation method for a network chip according to an embodiment of the present invention;

[0044] Figure 4 is a schematic diagram of a resource allocation device for a network chip according to an embodiment of the present invention;

[0045] Figure 5 is a schematic diagram of a network chip according to an embodiment of the present invention;

[0046] Figure 6 is a schematic diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0047] The present application is described below based on the following embodiments, but the present application is not limited to these embodiments. In the detailed description of the present application below, certain specific details are described in detail. Those skilled in the art can fully understand the present application without the description of these details. To avoid obscuring the essence of the present application, well-known methods, processes, procedures, components, and circuits are not described in detail.

[0048] Furthermore, persons of ordinary skill in the art will appreciate that the figures provided herein are for illustration purposes only and are not necessarily drawn to scale.

[0049] Unless the context clearly requires otherwise, words like “include”, “comprising” and the like throughout this application should be interpreted as including rather than exclusive or exhaustive; that is, as meaning “including but not limited to”.

[0050] In the description of this application, it should be understood that the terms "first", "second", etc. are used for descriptive purposes only and should not be understood to indicate or imply relative importance. In addition, in the description of this application, unless otherwise specified, "plurality" means two or more.

[0051] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0052] A network chip is an integrated circuit (IC) that handles network data transmission, switching, routing, and other functions. It is a core component of network infrastructure and is widely used in devices such as routers, switches, firewalls, and service network cards, providing key services such as data forwarding, protocol processing, and traffic management. Based on their functional scenarios, network chips can be categorized as switch chips, router chips, network card chips, network processors, and smart network cards.

[0053] In a network architecture, each node (or device) communicates with each other through a network chip. Therefore, when multiple non-current nodes attempt to communicate with the current node, the current node's network chip must differentiate between traffic of different priorities to ensure bandwidth and latency requirements for critical services (such as voice and video). Network chips can use various traffic distribution methods. For example, weighted round-robin (WRR), also known as the weighted round-robin scheduling algorithm, is a scheduling mechanism with high local fairness. The scheduling unit determines the configuration weight of each node as the remaining number of times each node can be scheduled in the current round, i.e., the initial value of the dynamic weight. Starting from the first node, each node is designated as a schedulable node in each cycle in a round-robin manner. Each time a node is designated as a schedulable node, its dynamic weight is reduced by 1. If the dynamic weights of all nodes in the current round drop to 0, the network chip resets the dynamic weights of all nodes to their initial values ​​to redistribute traffic in the next round.

[0054] However, if the amount of data on some nodes is unstable, that is, there is no data in some time periods, and a large amount of data to be transmitted is generated in some time periods, it will lead to a situation where the configuration weights between the nodes are close but the dynamic weights are quite different. After the dynamic weights of some nodes drop to 0, the network chip will continue to schedule nodes with larger dynamic weights, so that nodes with larger dynamic weights will occupy resources for a long time. For example, the nodes connected to the network chip include node A and node B, and the configuration weight of node A is 254, and the configuration weight of node B is 255. When both nodes generate data to be transmitted, the scheduling unit will schedule them in the order of ABAB...ABB; when node A has no data, the scheduling unit will continue to schedule node B and reduce the dynamic weight of node B, while keeping the dynamic weight of node A unchanged. If node A generates data to be transmitted when the dynamic weight of node B is large, such as when the dynamic weight of node A is 254 and the dynamic weight of node B is 230, the traffic between nodes A and B is still relatively even; however, if node A generates data to be transmitted when the dynamic weight of node B is small, such as when the dynamic weight of node A is 254 and the dynamic weight of node B is 1, then after scheduling node B once, the dynamic weight of node B drops to 0, and the scheduling unit will continue to schedule node A until the dynamic weight of node A also drops to 0. Before the dynamic weight of node A drops to 0, node B cannot be scheduled. Therefore, the existing weighted round-robin scheduling algorithm is prone to traffic fluctuations.

[0055] In order to solve the above problems, the embodiments of the present invention propose a resource allocation method, device, network chip and electronic device for a network chip, so as to reduce the possibility of some nodes occupying resources for a long time by lowering the dynamic weight of the target node when the amount of data at the target node in the current round is low, thereby alleviating traffic fluctuations.

[0056] Figure 1 FIG. 1 is a flow chart of a resource allocation method for a network chip according to an embodiment of the present invention. Figure 1 As shown, the method of this embodiment may include the following steps:

[0057] Step S101: Determine the load status of the target node in the current cycle of the current round.

[0058] In order to ensure the responsiveness of the system, reduce the situation where some nodes occupy resources for a long time and cause conflicts between nodes, and ensure the fairness of traffic distribution, a scheduling unit can be set in the network chip. The scheduling unit can schedule each node in rounds so that the scheduled nodes can transmit data. A round can include multiple cycles, and the maximum number of cycles in each round can be determined according to the configuration weight of each node. For example, if the number of nodes connected to the network chip is 2, and the configuration weights of each node are 100 and 200 respectively, the maximum number of cycles can be determined to be 300.

[0059] In actual applications, some nodes may experience significant fluctuations in the amount of data, and unstable data volume can easily cause traffic fluctuations, and may even lead to service interruptions and aging of network equipment hardware. This embodiment can make improvements based on the weighted round-robin scheduling algorithm, so that the scheduling unit can adjust the dynamic weight of each node according to the load status of each node, reducing the possibility of traffic fluctuations caused by some nodes occupying resources for a long time due to a sudden increase in data volume and a large dynamic weight.

[0060] In this step, the scheduling unit periodically determines the load status of the node (ie, the target node) connected to the network chip. The load status of the target node can be determined based on the data frequency parameter in the current round and the amount of data in the current cycle.

[0061] A traffic shaper can be provided in the network chip, and the traffic shaper is used to control the traffic distribution of each node. The traffic shaper can implement traffic shaping based on a traffic shaping algorithm. Common traffic shaping algorithms include the token bucket algorithm. The token bucket algorithm generates a certain number of fill tokens according to a pre-set fill cycle and fills these tokens into a token bucket. If the token bucket is full, the excess tokens are discarded. When a node transmits data, it needs to consume a corresponding number of tokens from the token bucket based on the amount of data to be transmitted, for example, one token is consumed for each data unit. If the number of tokens in the token bucket corresponding to any node is large, it means that the node has consumed fewer tokens, that is, the amount of data transmitted by the node in the current round is low. Conversely, it means that the amount of data transmitted by the node in the current round is high. Therefore, in an optional implementation of this embodiment, the number of tokens in the token bucket can reflect the load status of the node. Specifically, the data frequency parameter of this embodiment can be represented by the number of tokens corresponding to the target node.

[0062] In this optional implementation, the scheduling unit may read the target node's token bucket to determine the number of tokens in the token bucket for the current cycle. If the target node's token number for the current cycle reaches a second threshold and the target node's data quantity for the current cycle is zero, meaning there is no data to be transmitted in the data queue, the scheduling unit may determine that the target node's load state for the current cycle is low. To facilitate traffic shaping, a traffic shaper typically maintains the target node's token quantity. Therefore, the scheduling unit may directly read the target node's token quantity from the traffic shaper.

[0063] Optionally, if a traffic shaper corresponding to the target node is configured in the network chip but is not enabled, the scheduling unit may enable the traffic shaper so that it generates a certain number of tokens according to a preset fill period. The target node's load status in each period is determined based on the number of tokens generated by the target node in each period. To facilitate monitoring of the target node's traffic, the token fill period may be increased.

[0064] It is easy to understand that if the number of tokens of the target node does not reach the second number threshold, and / or the number of data of the target node in the current cycle is not zero, the scheduling unit may determine that the load state of the target node in the current cycle is high. At the same time, the scheduling unit may reduce the dynamic weight of the target node when the target node is scheduled, and maintain the dynamic weight of the target node unchanged when the target node is not scheduled.

[0065] The network chip may be provided with a cycle counter. The cycle counter may count the idle cycles corresponding to the target node. Therefore, in another optional implementation of this embodiment, the idle cycle count may be used to reflect the load status of the node. Specifically, the data frequency parameter of this embodiment may be represented by the idle cycle count corresponding to the target node.

[0066] In this optional implementation, the scheduling unit can read the idle cycle count of the target node in the current cycle from the cycle counter, and when the idle cycle count of the target node in the current cycle reaches a third quantity threshold and the amount of data of the target node in the current cycle is 0, determine that the load state of the target node in the current cycle is low load.

[0067] Optionally, the scheduling unit may determine whether a traffic shaper corresponding to the target node is configured in the network chip. If not, the scheduling unit may add a software-based cycle counter for the target node and directly read the idle cycle count of the target node from the cycle counter. Optionally, the cycle counter may also be implemented in hardware.

[0068] In this embodiment, the idle cycle count may be the number of consecutive cycles in which the target node has no data. Figure 2 FIG. 1 is a flow chart of a resource allocation method for a network chip according to an embodiment of the present invention. Figure 2 As shown, in an optional implementation of this embodiment, the idle cycle count can be determined by the following steps:

[0069] Step S201: Obtain the second data quantity corresponding to the target node in each cycle.

[0070] Starting from the first cycle of the current round, the cycle counter can obtain the data quantity of the target node (i.e., the second data quantity) in each cycle. In order to perform data transmission, the data to be transmitted will be stored in a data queue. Therefore, in this step, the cycle counter can check the data queue of the target node in each cycle to determine the second data quantity of the target node.

[0071] Step S202: Determine whether the second data quantity is 0.

[0072] In this step, the cycle counter can determine whether the second data quantity of the target node is 0. If so, step S203 can be executed; if not, step S204 can be executed.

[0073] Step S203: accumulating the idle cycle count.

[0074] If the second data quantity is 0, it means that the target node has no data to be transmitted in the corresponding cycle. Therefore, in this step, the cycle counter can accumulate the idle cycle count. The single accumulated value of the idle cycle count can be set to 1.

[0075] Step S204: reset the idle cycle count to an initial value.

[0076] If the second data quantity is not 0, it indicates that the target node has data to be transmitted in the corresponding cycle, so in this step, the cycle counter can reset the idle cycle count of the target node to an initial value. In this embodiment, the initial value of the idle cycle count is 0.

[0077] For example, if the target node is node N1 and node N1 has no data to be transmitted in the first cycle, the cycle counter may accumulate the idle cycle count from the initial value and determine that the idle cycle count of node N1 in the first cycle is 1. Node N1 also has no data to be transmitted in the second cycle, and the cycle counter may accumulate the idle cycle count and determine that the idle cycle count of node N1 in the second cycle is 2. Node N1 has data to be transmitted in the third cycle, and the cycle counter may reset the idle cycle count of node N1 in the third cycle to the initial value, i.e., 0.

[0078] It is easy to understand that if the idle cycle count of the target node does not reach the third number threshold, and / or the amount of data of the target node in the current cycle is not zero, the scheduling unit can determine that the load state of the target node in the current cycle is high. At the same time, the scheduling unit can reduce the dynamic weight of the target node when the target node is scheduled, and maintain the dynamic weight of the target node unchanged when the target node is not scheduled.

[0079] Figure 3 FIG. 1 is a flow chart of a resource allocation method for a network chip according to an embodiment of the present invention. Figure 3 As shown, in an optional implementation, the method of this embodiment may further include the following steps:

[0080] Step S301: Determine the weight storage device corresponding to the network chip according to the number of target nodes.

[0081] The configuration weight and dynamic weight of each target node will occupy a certain amount of storage space. Therefore, in order to ensure the reading speed of the configuration weight and dynamic weight while avoiding a negative impact on the data processing performance of the network chip, in an optional implementation of this embodiment, the weight storage device corresponding to the network chip can be determined according to the number of target nodes. The weight storage device, that is, the storage device for storing the configuration weight and dynamic weight, can include the register of the network chip and the memory of the device corresponding to the network chip.

[0082] In this step, if the number of target nodes is small, for example, lower than the fourth number threshold, the consumption of storage space is limited, so the scheduling unit can determine that the weight storage device is a register; if the number of target nodes is large, for example, higher than the fourth number threshold, it will occupy more storage space, so the scheduling unit can determine that the weight storage device is a memory.

[0083] Step S302: Store the configuration weight and dynamic weight of each target node in a weight storage device.

[0084] After determining the configuration weight and dynamic weight of each target node, in this step, the scheduling unit may write the configuration weight and dynamic weight of each target node into a corresponding weight storage device.

[0085] Therefore, in step S101, if the weight storage device corresponding to the network chip is a memory, when reading the configuration weights and dynamic weights of each target node from the memory, there is an access bandwidth limitation, and the scheduling unit can determine the load status of the target node according to the preset scanning period. The preset scanning period is usually greater than the scheduling period of the weighted polling scheduling algorithm, and can be set according to actual needs, such as 3 times the scheduling period, 5 times the scheduling period, etc. This embodiment does not limit this. For example, if the scheduling period of the weighted polling scheduling algorithm is 100 milliseconds, the preset scanning period can be set to 300 milliseconds.

[0086] Step S102 : In response to the load status indicating that the target node is underloaded, reducing the dynamic weight corresponding to the target node.

[0087] In this embodiment, low load is used to indicate that the amount of data for the target node in the current round is lower than a first threshold. In other words, the target node has no data to transmit or only a small amount of data to transmit during most cycles. Therefore, to prevent any target node from suddenly resuming traffic but significantly differing from other target nodes in weight, causing the node to occupy resources for a long time, in this step, the scheduling unit may reduce the dynamic weight corresponding to any target node when the load status of the target node is low.

[0088] The reduction value of the dynamic weight can be determined based on the update period of the load status. For example, if the update period of the dynamic weight of the target node by the scheduling unit (that is, the preset scanning period) is close to or consistent with the scheduling period of the weighted polling scheduling algorithm, the reduction value of the dynamic weight can be set to a smaller value, such as 1; if the update period of the dynamic weight is significantly different from the scheduling period of the weighted polling angle algorithm, the reduction value of the dynamic weight can be set to a larger value, specifically, it can be set to the product of the ratio of the update period of the dynamic weight to the scheduling period of the weighted polling angle algorithm and the benchmark reduction value. For example, if the scheduling period of the weighted polling scheduling algorithm is 100 milliseconds, the update period of the load status is 300 milliseconds, and the benchmark reduction value is 1, then the ratio of the update period of the load status to the scheduling period of the weighted polling angle algorithm can be determined to be 3, and then the reduction value of the dynamic weight can be determined to be the product of 3 and 1, that is, 3.

[0089] Optionally, in order to avoid the situation where the target node suddenly resumes traffic but the dynamic weight is reset to zero, resulting in the target node being unable to be scheduled in the current round, a minimum value can be set for the dynamic weight. When the dynamic weight of any target node reaches the minimum value, even if the load state of the target node is low load, the scheduling unit will no longer update the dynamic weight of the target node until the target node is scheduled, and the dynamic weight of the target node will be reduced. The minimum value of the dynamic weight can be set to a preset value, and the preset value can be set according to actual needs, and this embodiment does not impose any restrictions on this.

[0090] For example, the nodes connected to the network chip include node A and node B, and the configuration weight of node A is 254, and the configuration weight of node B is 255. When both nodes generate data to be transmitted, the scheduling unit will schedule them in the order of ABAB...ABB; when node A has no data, the scheduling unit will always schedule node B and reduce the dynamic weight of node B. At the same time, the scheduling unit can determine the load status of node A and node B in each cycle. If it is determined that the load status of node A is low load, the scheduling unit can reduce the dynamic weight of node A. If node A generates data to be transmitted when the dynamic weight of node B is small, such as the dynamic weight of node A is reduced to the minimum value of the dynamic weight of 5, and the dynamic weight of node B is 1, then after scheduling node B once, the dynamic weight of node B is reduced to 0. After the scheduling unit continuously schedules node A 5 times, the dynamic weight of node A is also reduced to 0.

[0091] The embodiment of the present invention determines the load state of the target node in the current cycle based on the data frequency parameters of the target node connected to the network chip in the current round and the amount of data in the current cycle of the current round, and reduces the dynamic weight corresponding to the target node when it is determined that the load state of the target node in the current cycle is low. In the embodiment of the present invention, the dynamic weight represents the remaining number of times the target node can be scheduled in the current round. Therefore, this embodiment reduces the possibility of some nodes occupying resources for a long time by reducing the dynamic weight of the target node when the amount of data in the current round is low, thereby alleviating traffic fluctuations.

[0092] Figure 4 FIG. 1 is a schematic diagram of a resource allocation device for a network chip according to an embodiment of the present invention. Figure 4 As shown, the resource allocation device of the network chip of this embodiment includes a state determination unit 401 and a weight updating unit 402 .

[0093] Among them, the state determination unit 401 is used to determine the load state of the target node in the current cycle of the current round, and the load state is determined based on the data frequency parameter and the first data quantity of the target node in the current round, and the first data quantity is the data quantity of the target node in the current cycle; the weight update unit 402 is used to respond to the load state characterizing that the target node is low-loaded, and reduce the dynamic weight corresponding to the target node until the dynamic weight reaches a preset weight threshold, and the dynamic weight is used to characterize the remaining number of times the target node can be scheduled in the current round, and the low load characterizes that the data quantity of the target node in the current round is lower than the first quantity threshold.

[0094] Furthermore, the data frequency parameter represents the number of tokens corresponding to the target node;

[0095] The state determination unit 401 includes a token reading subunit and a first load determination subunit.

[0096] Among them, the token reading subunit is used to read the token bucket of the target node and determine the number of tokens; the first load determination subunit is used to determine that the load state is low load in response to the number of tokens reaching a second number threshold and the first data number is 0.

[0097] Furthermore, the data frequency parameter represents an idle cycle count corresponding to the target node;

[0098] The state determination unit 401 includes a second load determination subunit.

[0099] The second load determination subunit is configured to determine that the load state is low load in response to the idle cycle count reaching a third quantity threshold and the first data quantity being 0.

[0100] Furthermore, the idle cycle count is determined by a quantity determining unit, an accumulating unit and a resetting unit.

[0101] Among them, the quantity determination unit is used to obtain the second data quantity corresponding to the target node in each cycle; the accumulation unit is used to accumulate the idle cycle count in response to the second data quantity being 0; the reset unit is used to reset the idle cycle count to an initial value in response to the second data quantity being not 0, and the initial value is 0.

[0102] Furthermore, the apparatus further includes a device determining unit and a storage unit.

[0103] Among them, the device determination unit is used to determine the weight storage device corresponding to the network chip according to the number of the target nodes, and the weight storage device is a register or a memory; the storage unit is used to store the configuration weight and the dynamic weight of each target node in the weight storage device;

[0104] The state determining unit 401 includes a third load determining subunit.

[0105] The third load determination subunit is configured to determine the load state according to a preset scanning period in response to the weight storage device being a memory.

[0106] Furthermore, the minimum value of the dynamic weight is a preset value.

[0107] The embodiment of the present invention determines the load state of the target node in the current cycle based on the data frequency parameters of the target node connected to the network chip in the current round and the amount of data in the current cycle of the current round, and reduces the dynamic weight corresponding to the target node when it is determined that the load state of the target node in the current cycle is low. In the embodiment of the present invention, the dynamic weight represents the remaining number of times the target node can be scheduled in the current round. Therefore, this embodiment reduces the possibility of some nodes occupying resources for a long time by reducing the dynamic weight of the target node when the amount of data in the current round is low, thereby alleviating traffic fluctuations.

[0108] Figure 5 FIG is a schematic diagram of a network chip according to an embodiment of the present invention. Figure 5 As shown, the network chip of this embodiment includes a parameter counter 501 and a scheduling unit 502. Each channel of the network chip can be provided with a parameter counter 501, so the number of parameter counters 501 of this embodiment can be determined according to the number of nodes connected to the network chip. Figure 5The following description is made by taking a parameter counter 501 and a scheduling unit 502 as an example. The parameter counter 501 and the scheduling unit 502 can establish a communication connection via a bus or various existing communication methods.

[0109] In an embodiment of the present invention, the parameter counter 501 is configured to determine the data frequency parameter of the corresponding node in the current round. The scheduling unit 502 is configured to determine the load state of the target node in the current cycle of the current round, wherein the load state of the target node is determined according to the data frequency parameter corresponding to the target node and the first data quantity, the first data quantity is the amount of data of the target node in the current cycle, and in response to the load state of the target node characterizing that the target node is low-loaded, reducing the dynamic weight corresponding to the target node, wherein the dynamic weight is used to characterize the remaining number of times the target node can be scheduled in the current round, and the low load characterizes that the amount of data of the target node in the current round is lower than the first quantity threshold.

[0110] In an optional implementation of the embodiment of the present invention, parameter counter 501 may be a traffic shaper. The traffic shaper is configured to store the number of tokens of the corresponding node, and the tokens are stored in the token bucket of the corresponding node. Scheduling unit 502 is further configured to determine that the load state of the target node is low load in response to the number of tokens of the target node reaching a second number threshold and the first data quantity of the target node being 0.

[0111] In an optional implementation of the embodiment of the present invention, the parameter counter 501 may be a cycle counter. The cycle counter is configured to determine the number of idle cycles of the corresponding node. The scheduling unit 502 is further configured to determine that the load state of the target node is low load in response to the idle cycle count of the target node reaching a third number threshold and the first data quantity of the target node being 0.

[0112] In the embodiment of the present invention, the parameter counter 501 may be implemented in the form of software or hardware, which is not limited in this embodiment.

[0113] The embodiment of the present invention determines the load state of the target node in the current cycle based on the data frequency parameters of the target node connected to the network chip in the current round and the amount of data in the current cycle of the current round, and reduces the dynamic weight corresponding to the target node when it is determined that the load state of the target node in the current cycle is low. In the embodiment of the present invention, the dynamic weight represents the remaining number of times the target node can be scheduled in the current round. Therefore, this embodiment reduces the possibility of some nodes occupying resources for a long time by reducing the dynamic weight of the target node when the amount of data in the current round is low, thereby alleviating traffic fluctuations.

[0114] Figure 6Schematic diagram of an electronic device according to an embodiment of the present invention. In this embodiment, the electronic device 6 includes a server, a terminal, etc. Figure 6 As shown, the electronic device 6: includes at least one processor 601; and a memory 602 communicatively connected to at least one processor 601; and a communication component 603 communicatively connected to a scanning device, the communication component 603 receiving and sending data under the control of the processor 601; wherein the memory 602 stores instructions that can be executed by at least one processor 601, the processor 601 includes a network chip, and the instructions are executed by at least one network chip to implement the resource allocation method of the above-mentioned network chip.

[0115] Specifically, the electronic device includes: one or more processors 601 and a memory 602, Figure 6 A processor 601 is used as an example. The processor 601 and the memory 602 may be connected via a bus or other means. Figure 6 The example of a bus connection is shown. Memory 602, as a non-volatile computer-readable storage medium, can be used to store non-volatile software programs, non-volatile computer executable programs, and modules. Processor 601 includes a network chip. The network chip executes the non-volatile software programs, instructions, and modules stored in memory 602 to execute various functional applications and data processing of the device, thereby implementing the aforementioned network chip resource allocation method.

[0116] The memory 602 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and application programs required for at least one function; the data storage area may store a list of options, etc. In addition, the memory 602 may include a high-speed random access memory and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some embodiments, the memory 602 may optionally include a memory remotely located relative to the processor 601, and these remote memories may be connected to an external device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0117] One or more modules are stored in the memory 602 , and when executed by one or more network chips, the resource allocation method for the network chip in any of the above method embodiments is executed.

[0118] The above-mentioned product can execute the method provided in the embodiment of this application, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not fully described in this embodiment, please refer to the method provided in the embodiment of this application.

[0119] The embodiment of the present invention determines the load state of the target node in the current cycle based on the data frequency parameters of the target node connected to the network chip in the current round and the amount of data in the current cycle of the current round, and reduces the dynamic weight corresponding to the target node when it is determined that the load state of the target node in the current cycle is low. In the embodiment of the present invention, the dynamic weight represents the remaining number of times the target node can be scheduled in the current round. Therefore, this embodiment reduces the possibility of some nodes occupying resources for a long time by reducing the dynamic weight of the target node when the amount of data in the current round is low, thereby alleviating traffic fluctuations.

[0120] Another embodiment of the present invention relates to a non-volatile storage medium for storing a computer-readable program, wherein the computer-readable program is used to enable a computer to execute part or all of the above method embodiments.

[0121] That is, those skilled in the art will understand that all or part of the steps in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a program, which is stored in a storage medium and includes a number of instructions for causing a device (which may be a single-chip microcomputer, chip, etc.) or a processor to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc., various media that can store program code.

[0122] The foregoing is merely a preferred embodiment of the present application and is not intended to limit the present application. Persons skilled in the art will readily appreciate that the present application is susceptible to various modifications and variations. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present application shall be included within the scope of protection of the present application.

Claims

1. A resource allocation method for a network chip, characterized in that: The method comprises: Determining a load state of a target node in a current cycle of a current round, where the load state is determined based on a data frequency parameter of the target node in the current round and a first data quantity, where the first data quantity is the amount of data of the target node in the current cycle; In response to the load status characterizing that the target node is low-loaded, the dynamic weight corresponding to the target node is reduced, and the dynamic weight is used to characterize the remaining number of times the target node can be scheduled in the current round. The low load characterizes that the amount of data of the target node in the current round is lower than a first quantity threshold.

2. The method according to claim 1, characterized in that The data frequency parameter is represented by the number of tokens corresponding to the target node; Determining the load status of the target node in the current cycle of the current round includes: Read the token bucket of the target node to determine the number of tokens; In response to the number of tokens reaching a second number threshold and the first data number being 0, it is determined that the load state is low load.

3. The method according to claim 1, characterized in that The data frequency parameter is represented by the idle cycle count corresponding to the target node; Determining the load status of the target node in the current cycle of the current round includes: In response to the idle cycle count reaching a third quantity threshold and the first data quantity being 0, the load state is determined to be low load.

4. The method according to claim 3, characterized in that The idle cycle count is determined as follows: Acquire the second data quantity corresponding to the target node in each cycle; In response to the second data quantity being 0, accumulating the idle cycle count; In response to the second data quantity being not 0, resetting the idle cycle count to an initial value, where the initial value is 0.

5. The method according to claim 1, wherein The method further comprises: Determine a weight storage device corresponding to the network chip according to the number of the target nodes, where the weight storage device is a register or a memory; Storing the configuration weight and the dynamic weight of each target node in the weight storage device; Determining the load status of the target node in the current cycle of the current round includes: In response to the weight storage device being a memory, the load state is determined according to a preset scanning period.

6. The method according to claim 1, characterized in that The minimum value of the dynamic weight is a preset value.

7. A resource allocation device for a network chip, characterized in that: The device comprises: a state determining unit, configured to determine a load state of the target node in a current cycle of a current round, wherein the load state is determined based on a data frequency parameter of the target node in the current round and a first data quantity, where the first data quantity is the amount of data of the target node in the current cycle; A weight updating unit is used to reduce the dynamic weight corresponding to the target node in response to the load state characterizing that the target node is low-loaded, until the dynamic weight reaches a preset weight threshold, the dynamic weight is used to characterize the remaining number of times the target node can be scheduled in the current round, and the low load characterizes that the amount of data of the target node in the current round is lower than a first quantity threshold.

8. A network chip, characterized in that: The network chip includes: a parameter counter configured to determine a data frequency parameter of a corresponding node in a current round; A scheduling unit is configured to determine a load state of a target node in a current cycle of a current round, wherein the load state is determined based on the data frequency parameter and a first data quantity corresponding to the target node, wherein the first data quantity is the amount of data of the target node in the current cycle, and in response to the load state characterizing that the target node is low-loaded, reduce a dynamic weight corresponding to the target node, wherein the dynamic weight is used to characterize the remaining number of times the target node can be scheduled in the current round, and wherein the low load characterizes that the amount of data of the target node in the current round is lower than a first quantity threshold.

9. The network chip according to claim 8, characterized in that: The parameter counter is a traffic shaper, the traffic shaper is configured to store the number of tokens of the corresponding node, the tokens being stored in a token bucket of the corresponding node; The scheduling unit is further configured to: In response to the number of tokens reaching a second number threshold and the first data number being 0, it is determined that the load state is low load.

10. The network chip according to claim 8, characterized in that: The parameter counter is a cycle counter configured to determine an idle cycle count of a corresponding node; The scheduling unit is further configured to: In response to the idle cycle count reaching a third quantity threshold and the first data quantity being 0, the load state is determined to be low load.

11. An electronic device comprising a memory and a processor, characterized in that: The memory is used to store one or more computer program instructions, and the processor includes a network chip, wherein the one or more computer program instructions are executed by the network chip to implement the method according to any one of claims 1 to 6.

12. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

13. A computer program product, characterized in that The computer program product comprises a computer program / instructions, which implement the method according to any one of claims 1 to 6 when executed by a processor.