Traffic shaping bucket filling processing method, control module, network chip and device

By using memory to store traffic shaping configuration data and token data in network equipment chips, and using ring signals and bucket filling frequencies to perform bucket filling calculations, the problem of wasted register resources in multi-port multi-queue designs is solved, and efficient traffic is achieved. Shaping and flexible clock adjustment.

CN118138537BActive Publication Date: 2024-09-10NANJING JINZHEN MICROELECTRONICS TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410426321.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-10
Publication Date
2024-09-10
Estimated Expiration
2044-04-10

AI Technical Summary

Technical Problem

In the multi-port multi-queue design of existing network equipment chips, the traffic shaping and bucket-filling logic occupies a large amount of register resources, resulting in resource waste and low efficiency.

Method used

The memory is used to store the traffic shaping configuration data and token data of the port and queue, and bucket filling calculation is performed through the ring signal and bucket filling frequency to reduce the use of registers and realize flexible adjustment of multiple bucket filling rates and clock offsets.

Benefits of technology

It effectively saves chip resources, realizes personalized traffic shaping requirements for each port and queue, improves the accuracy and flexibility of traffic shaping, and reduces resource occupation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118138537B
    Figure CN118138537B
Patent Text Reader

Abstract

The present invention discloses a traffic shaping bucket filling processing method, a control module, a network chip and a device. The present invention is applied to a memory used for network traffic shaping. The traffic shaping bucket filling processing method of the present invention includes a ringing signal that is preset to correspond to the bucket filling frequency one by one. Each ringing signal has a preset ringing signal identifier. When any ringing signal is valid, the memory is traversed to perform the following operations: read the ringing signal identifier in the configuration data. If the ringing signal identifier is consistent with the current ringing signal, a bucket filling calculation is performed, and the new token data is stored in the current storage address. The present invention solves the problem of large register storage resources by changing the storage method and realizing the correct reading of configuration data and token data. Moreover, the present invention can provide a variety of bucket filling rates, which can not only meet the shaping requirements of all ports and queues in a personalized manner, but also flexibly adjust the clock offset problem to improve accuracy, while saving resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of network communication technology, and specifically relates to a traffic shaping bucket filling processing method, a control module, a network chip and a device. Background Art

[0002] Traffic shaping is often used to adjust the bandwidth rate of ports and queues to limit the traffic and bursts flowing out of a certain connection in a certain network, so that messages are sent at a relatively uniform speed. Traffic shaping uses a token bucket, which is filled with tokens by timed bucket filling. When the tokens are exhausted but the filling time has not yet arrived, the sending of messages is suspended to limit the speed until the next bucket filling.

[0003] In the multi-port multi-queue design of existing network equipment chips, registers are used to implement bucket filling logic. The traffic shaping bucket filling logic of each port and queue is independent. The traffic that needs to be shaped is different, the bucket filling time point is also different, and the packet output time is also arbitrary. In order to achieve the purpose of precise traffic control, if a time slot controller is assigned to each queue in the design, a large number of registers will be used to generate the time slot controllers of each queue when there are many queues. If these queues use the same time slot controller in the design, there will be a problem of solving the problem of filling buckets for an uncertain number of queues in the same time slot. To solve this problem, the token bucket must be implemented with a large number of registers. Therefore, both of these conventional implementation methods use a large number of registers. When the number of ports and queues increases, the use of registers will inevitably cause the traffic shaping bucket filling logic to occupy a large amount of chip resources. Summary of the invention

[0004] The purpose of the present invention is to solve the problem of large resource usage of traffic shaping logic in existing network device chips, so as to solve the problems existing in the background technology.

[0005] To achieve the above-mentioned purpose, in a first aspect, the present invention provides a traffic shaping bucket filling processing method, which is applied to a memory used for network traffic shaping, wherein port traffic shaping and queue traffic shaping have respective corresponding memories, storing configuration data and token data required for traffic shaping of each port and queue, and traffic shaping of each port and traffic shaping of each queue have corresponding storage addresses, and the method comprises:

[0006] The preset bucket filling frequency is N, and at least N ringing signals are set, where N is a natural number;

[0007] The ringing signal corresponds to the bucket filling frequency one by one, and each ringing signal is outputted at a fixed time according to the corresponding bucket filling frequency. Each ringing signal has a preset ringing signal identifier, which is selected by the traffic shaping of each port and queue and is used as part of the configuration data;

[0008] When any ring signal is valid, the storage addresses of all ports of the memory and the storage addresses of all queues are traversed to perform the following operations: read the ring signal identifier in the configuration data from the current storage address, and determine whether the ring signal identifier is consistent with the current ring signal; if so, read other configuration data and token data from the current storage address to perform bucket filling calculation, obtain new token data from the bucket filling calculation and store it in the current storage address.

[0009] In some embodiments of the present invention, port traffic shaping and queue traffic shaping each use a pair of memories to store configuration data and token data respectively. In each pair of memories, the first memory stores configuration data and the second memory stores token data. The storage address depth of the configuration data and the token data is the same.

[0010] In some embodiments of the present invention, the first memory and the second memory are single-port memories.

[0011] In some embodiments of the present invention, the ringing signal identifier adopts the bucket filling frequency, or the index value of the bucket filling frequency.

[0012] In some embodiments of the present invention, the configuration data stored in the memory also includes bucket filling granularity, which is the number of tokens filled each time. The bucket filling granularity is calculated using the formula grty_mul=grty / F, where grty_mul represents the bucket filling granularity, grty is the bucket filling rate, and F is the bucket filling frequency.

[0013] In some embodiments of the present invention, the configuration data stored in the memory also includes bucket filling granularity and bucket filling granularity fine-tuning value. In each bucket filling cycle, the bucket filling granularity is used as the bucket filling token value to fill the bucket F-1 times, and the bucket filling granularity fine-tuning value is used as the bucket filling token value to fill the bucket 1 time. The bucket filling granularity and the bucket filling granularity fine-tuning value satisfy the formula grty = (F-1) × grty_mul + grty_delt, grty is the bucket filling rate, F is the bucket filling frequency, grty_mul represents the bucket filling granularity, and grty_delt represents the bucket filling granularity fine-tuning value.

[0014] In some embodiments of the present invention, the bucket filling granularity is equal to the integer part of grty / (F-1).

[0015] In some embodiments of the present invention, there are F ringing signals in each bucket filling cycle, and one of the ringing signals is selected to be valid and the fine-tuning signal is output at the same time; when only the ringing signal is valid, the bucket filling granularity is used as the bucket filling token value to fill the bucket; when the fine-tuning signal and the ringing signal are valid at the same time, the bucket filling granularity fine-tuning value is used as the bucket filling token value to fill the bucket.

[0016] In some embodiments of the present invention, the configuration data stored in the memory further includes bucket depth.

[0017] In some embodiments of the present invention, the bucket depth is stored by storing a bucket depth factor cbs_mul and a bucket depth index cbs_exp representing the bucket depth CBS, where CBS=cbs_mul×2 cbs_exp .

[0018] In some embodiments of the present invention, the effective durations of all ringing signals are the same.

[0019] In some embodiments of the present invention, the effective durations of all ringing signals are aligned.

[0020] In some embodiments of the present invention, in the order of bucket filling frequencies from high to low, of two adjacent ringing signals, the ringing signal with a lower frequency is generated by dividing the ringing signal with a higher frequency.

[0021] In some embodiments of the present invention, the number of the ringing signals is 4.

[0022] In some embodiments of the present invention, the bucket filling frequencies corresponding to the four ringing signals are 250 times, 50 times, 25 times and 5 times in each bucket filling cycle from high to low.

[0023] In some embodiments of the present invention, when any ring signal is valid, and the storage addresses of all ports of the memory and the storage addresses of all queues are traversed, a traversal completion signal is output, and when the ring signal and the traversal completion signal are valid at the same time, the memory is no longer read.

[0024] In a second aspect, the present invention provides a traffic shaping control module of a network chip, including a memory and a bucket filling processing unit, wherein:

[0025] Port traffic shaping and queue traffic shaping have their own corresponding memories, which store the configuration data and token data required for traffic shaping of each port and queue. The traffic shaping of each port and the traffic shaping of each queue have corresponding storage addresses.

[0026] The bucket filling processing unit fills buckets using the traffic shaping bucket filling processing method.

[0027] In a third aspect, the present invention provides a network chip, comprising the traffic shaping control module.

[0028] In a fourth aspect, the present invention provides a network device, comprising the network chip.

[0029] In some embodiments of the present invention, the network device is an Ethernet switch.

[0030] The present invention has the following beneficial effects:

[0031] The present invention stores configuration data and token data in a memory, and solves the problem of large register storage resources by changing the storage method and realizing correct reading of the configuration data and token data. Moreover, the present invention can provide a variety of bucket filling rates, which can not only meet the shaping requirements of all ports and queues in a personalized manner, but also flexibly adjust the clock offset problem to improve accuracy, and save resources at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] Figure 1 It is a schematic diagram of a memory storing configuration data and token data in one embodiment of the present invention.

[0033] Figure 2 It is a schematic diagram of a memory storing configuration data and token data in another embodiment of the present invention.

[0034] Figure 3 FIG. 4 is a timing diagram of a ringing signal in an embodiment of the present invention.

[0035] Figure 4 The figure is a composition principle diagram of a network chip traffic shaping control module in one embodiment of the present invention.

[0036] Figure 5 4 is a composition principle diagram of a network chip traffic shaping control module in another embodiment of the present invention.

[0037] Reference numerals

[0038] 10(10') memory

[0039] 20(20') channels

[0040] 101(101') First Memory

[0041] 102 (102') second memory

[0042] 201 First Channel

[0043] 202(202') Second Channel

[0044] 203(203') Third Channel

[0045] 30 Bucket handling unit

[0046] 40 Token Calculation Unit DETAILED DESCRIPTION

[0047] The following describes the embodiments of the present invention by specific examples, and those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.

[0048] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present invention, and thus the drawings only show components related to the present invention rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.

[0049] The present invention is used to control the quality of service (QoS) of a network, and specifically, to adjust the bandwidth rate of ports and queues of a network device by using traffic shaping. One of the existing solutions for traffic shaping is to use a token bucket mechanism in a network chip to control the rate of ports and queues. However, since the solution uses registers to implement the storage of configuration data and token calculation data, when the number of ports or queues increases, more chip resources are used. To solve this problem, a memory is used in the traffic shaping design to complete the traffic shaping token bucket configuration and data storage during the calculation process.

[0050] Example 1

[0051] This embodiment is used to explain in detail the traffic shaping bucket filling processing method of the present invention.

[0052] When the number of bits used by the data exceeds a certain amount, the area occupied by the chip resources used by the register with the same number of bits is larger than that of the memory. The more bits there are, the more obvious the area advantage of the memory is. In addition, during multi-port and multi-queue traffic shaping, after the egress scheduling takes effect, only one port will be scheduled at any time, and only one queue will be output under the port at that time. Therefore, the present invention separates the chip resources for port traffic shaping and queue traffic shaping, uses a memory to store the configuration data of port traffic shaping and queue traffic shaping respectively, and realizes the reading and storage of token data before and after the traffic shaping token bucket filling calculation.

[0053] The present invention processes the bucket filling time points of all queues by queuing and checking tickets. At one moment, at most one port or queue will be filled, so that all ports or queues can share a computing logic, and configuration data and token data can be concentrated in the memory, thus saving a lot of storage resources and logical computing resources.

[0054] Figure 1 FIG. 1 is a schematic diagram of the memory storing configuration data and token data in the present embodiment of the present invention. The method of the present invention is applied to Figure 1 The memory shown. Among them, the port traffic shaping and queue traffic shaping have their own corresponding memories 10 and 10', which store the configuration data and token data required for port and queue traffic shaping, and the traffic shaping of each port and each queue has a corresponding storage address. Figure 1 As shown, address Ai corresponds to port i, i=1, 2, ..., n; address Bj corresponds to queue j, j=1, 2, ..., m. Address Ai stores configuration data Ai and token data Ai of port i; address Bj stores configuration data Bj and token data Bj of queue j.

[0055] The traffic shaping bucket filling processing method in this embodiment includes:

[0056] The preset bucket filling frequency is N, and at least N ringing signals are set, where N is a natural number;

[0057] The ringing signal corresponds to the bucket filling frequency one by one. Each ringing signal is output at a timed interval according to the corresponding bucket filling frequency. Each ringing signal has a preset ringing signal identifier, which is selected for traffic shaping of each port and queue and is used as part of the configuration data. The ringing signal identifier is an identifier used to determine the bucket filling frequency.

[0058] When any ring signal is valid, the storage addresses of all ports of the memory and the storage addresses of all queues are traversed to perform the following operations: read the ring signal identifier in the configuration data from the current storage address, and determine whether the ring signal identifier is consistent with the current ring signal; if so, read other configuration data and token data from the current storage address to perform bucket filling calculation, obtain new token data from the bucket filling calculation and store it in the current storage address.

[0059] The present invention stores the configuration data and token data of port traffic shaping and queue traffic shaping in a memory, and solves the problem of large chip resource occupation by using registers by changing the storage mode and realizing orderly reading of the configuration data and token data when filling buckets.

[0060] Example 2

[0061] This embodiment further describes in detail the specific method of the traffic shaping bucket filling processing method of the present invention and the advantages brought by the memory-based implementation.

[0062] In this embodiment, in addition to separating the chip resources for port traffic shaping and queue traffic shaping, the chip resources for ports or queues are further separated according to configuration data and token data. Figure 2The schematic diagram of the memory storing configuration data and token data in the present embodiment of the present invention. Specifically, port traffic shaping and queue traffic shaping each use a pair of memories to store configuration data and token data respectively; in each pair of memories, the first memory 101 stores configuration data, and the second memory 102 stores token data; the storage address depth of configuration data and token data is the same; each port and queue configuration data and token data have corresponding storage addresses. Specifically, Figure 2 As shown, address 1 corresponds to port 1 or queue 1, address 2 corresponds to port 2 or queue 2, ..., address n corresponds to port n or queue n.

[0063] In some specific examples of the present invention, when any ringing signal is valid, all addresses will be traversed starting from the port number or queue number from the bottom to the largest, and information will be read from the memory one by one. If the current valid ringing signal is consistent with the ringing signal identifier in the configuration data, it means that the port or queue needs to fill the bucket, and the number of tokens stored in the memory needs to be obtained, and then the new number of tokens is calculated and placed back to the original position of the memory, otherwise no processing is performed.

[0064] Furthermore, configuration data is usually accessed and set from outside the chip by the manufacturer or user as needed, while token data only needs to be accessed internally when calculating the bucket filling and reducing of traffic shaping. Therefore, the reading and writing of configuration data implemented for configuration uses a different data channel from that of token data, such as Figure 2 As shown, the first memory is connected to the first channel 201 and the second channel 202 , and the second memory is connected to the third channel 203 .

[0065] In some specific embodiments of the present invention, in order to meet the access function and efficiency requirements and further reduce the occupation of chip resources, the first channel uses the system bus of the chip or module; the second channel and the third channel use the hardware logic line directly connected to the bucket filling and reducing calculation circuit in the network chip. Furthermore, for the first memory storing configuration data, the system bus can read and write to it, and the hardware logic can only read it; for the second memory storing the calculated token value, the hardware logic can read and write to it, but the system bus cannot perform any operation on it.

[0066] A single-port memory of the same width and depth saves more resources than a dual-port memory. Therefore, in some other specific implementations of the present invention, the first memory and the second memory use single-port memories, and the memories are generally RAM memories.

[0067] In this embodiment, the chip resources for port traffic shaping and queue traffic shaping are first separated, and the chip resources of the port or queue are also separated according to configuration data and token data. Different data channels are set to access the configuration data and token data respectively, so as to realize dynamic change of configuration data and efficient reading and writing of data when filling buckets. What is more advantageous is that the occupied chip resources are further reduced on the basis of Example 1.

[0068] In addition, in this embodiment and some other embodiments of the present invention, when any ring signal is valid and the storage addresses of all ports of the memory and the storage addresses of all queues are traversed, a traversal completion signal will be output, and when the ring signal and the traversal completion signal are valid at the same time, the memory will no longer be read.

[0069] Example 3

[0070] This embodiment further illustrates in detail how to reduce chip resource occupancy by streamlining configuration data in the traffic shaping bucket filling processing method of the present invention based on Embodiment 1 and Embodiment 2.

[0071] The bucket filling rate is the number of tokens filled into the token bucket per unit time. In some specific embodiments of the present invention, the bucket filling rate is determined by the total number of bytes that need to be filled into the bucket within 1000 microseconds. Generally, the minimum shaping rate is 8kbps (kilobits per second), which means that 1 byte is filled into the bucket within 1000 microseconds. The step is also 8kbps, that is, the supported shaping rate is a multiple of 8kbps. When the traffic shaping rate is known, the total number of bytes that need to be filled into the bucket within 1000 microseconds can be calculated by Formula 1, which is as follows: grty=rate*0.001 / 8. Among them, grty represents the bucket filling rate, and rate represents the shaping rate.

[0072] The bucket filling frequency is the number of times the bucket is filled per unit time, and the bucket filling granularity is the number of tokens filled each time. Therefore, the bucket filling rate is equal to the product of the bucket filling granularity and the bucket filling frequency. Based on this relationship, the configuration data stored in the storage unit of each port and queue of the memory in this embodiment also includes the bucket filling granularity. Specifically, the bucket filling granularity is calculated using the formula grty_mul=grty / F, where grty_mul represents the bucket filling granularity, grty is the bucket filling rate, and F is the bucket filling frequency.

[0073] Since the ringing signal is output according to the bucket filling frequency, the ringing signal identifier is used to uniquely identify the ringing signal. In some embodiments of the present invention, a data storage location is configured in the memory, and the ringing signal identifier can directly store the bucket filling frequency. In other embodiments of the present invention, in order to reduce the occupation of chip resources, the bucket filling frequency is generally selected to be a limited number, and 1-bit, 2-bit, 3-bit, and 4-bit index values ​​are used to correspond to the bucket filling frequency, so that 2, 4, 8, 16, etc. bucket filling frequencies can be identified.

[0074] By storing the bucket filling granularity in the configuration data, this embodiment can achieve more bucket filling rates and traffic shaping rates based on a limited bucket filling frequency compared to a solution using a unified bucket filling granularity. In addition, without increasing too many chip resources, a separate rate configuration is performed for traffic shaping of each port or queue, thereby improving the flexibility and adaptability of traffic shaping.

[0075] Example 4

[0076] This embodiment further illustrates the flow shaping bucket filling processing method of the present invention in detail based on the third embodiment.

[0077] The clock frequency deviation in the chip circuit is inevitable, and the clock frequency deviation will cause the rate to be slightly larger or smaller, affecting the accuracy of traffic shaping. Therefore, in this embodiment, the value of the bucket filling granularity grty_mul is slightly increased or decreased to achieve the purpose of accurately limiting the rate to the rate required for traffic shaping.

[0078] Specifically, in this embodiment, the configuration data stored in the memory also includes bucket filling granularity and bucket filling granularity fine-tuning value. In each bucket filling cycle, the bucket filling granularity is used as the bucket filling token value to fill the bucket F-1 times, and the bucket filling granularity fine-tuning value is used as the bucket filling token value to fill the bucket 1 time. The bucket filling granularity and the bucket filling granularity fine-tuning value satisfy the formula grty = (F-1) × grty_mul + grty_delt, grty is the bucket filling rate, F is the bucket filling frequency, grty_mul represents the bucket filling granularity, and grty_delt represents the bucket filling granularity fine-tuning value.

[0079] In some embodiments of the present invention, the bucket filling granularity fine-tuning value grty_delt is increased or decreased by 1 based on grty_mul=grty / F. If the bucket filling rate is 8kbps (kilobits per second), it means that the rate increases or decreases by 8kbps every 1 millisecond.

[0080] In some other embodiments of the present invention, the bucket filling granularity grty_mul is equal to the integer part of grty / (F-1), and the bucket filling granularity fine-tuning value grty_delt=grty-(F-1)×grty_mul.

[0081] In some other embodiments of the present invention, other calculation methods of the bucket filling granularity grty_mul and the bucket filling granularity fine-tuning value grty_delt may also be adopted, as long as the formula grty=(F-1)×grty_mul+grty_delt is satisfied.

[0082] Although the configuration data includes the bucket filling granularity and the fine-tuning value of the bucket filling granularity, in this embodiment, the ringing signal identifier can adopt the stored bucket filling frequency, or adopt the index values of 1 bit, 2 bits, 3 bits, and 4 bits that correspond one-to-one with the bucket filling frequency.

[0083] To conveniently overcome the error caused by clock offset, one ringing signal is specifically selected from F ringing signals for fine-tuning. In this embodiment and some other embodiments of the present invention, there are F ringing signals in each bucket filling cycle, and one of the ringing signals is selected and a fine-tuning signal is output while it is valid; only when the ringing signal is valid, the bucket filling granularity is used as the bucket filling token value for bucket filling; when the fine-tuning signal and the ringing signal are both valid, the bucket filling granularity fine-tuning value is used as the bucket filling token value for bucket filling.

[0084] Further, in some embodiments of the present invention, the effective durations of the ringing signals can also be set to be the same, and the effective duration should at least ensure that all ports and queues are traversed and bucket filling processing can be completed when bucket filling is required.

[0085] Still further, in some embodiments of the present invention, on the basis of setting the effective durations of the ringing signals to be the same, the effective durations of all the ringing signals are also aligned. On this basis, for ports and queues with the same bucket filling rate, the bucket filling cycles are the same, and a fine-tuning signal can be output while the last ringing signal in the bucket filling cycle of each port and queue is valid. Only one fine-tuning signal is required to achieve the fine-tuning of multiple ports and queues.

[0086] A specific implementation method for aligning the effective durations of the ringing signals of the present invention is that, in the order from high to low of the bucket filling frequency, among two adjacent ringing signals, the ringing signal with a lower frequency is generated by dividing the frequency of the ringing signal with a higher frequency.

[0087] In this embodiment and some other embodiments of the present invention, the bucket depths of each port and queue can be configured separately. Therefore, the configuration data stored in the memory of the present invention also includes the bucket depth.

[0088] The way to store the bucket depth is to store the bucket depth factor cbs_mul and the bucket depth exponent cbs_exp representing the bucket depth CBS, where CBS = cbs_mul × 2 cbs_exp . They generate discrete bucket depth CBS values. If the bit width of the bucket depth CBS is 15 bits and the maximum value is 32767, only 8 bits can be used to represent the bucket depth by adopting this scheme, which saves chip resources compared with directly storing the bucket depth value. Moreover, when calculating, a left shift shift register is used for calculation, that is, the bucket depth CBS = cbs_mul << cbs_exp, and << represents left shift.

[0089] Embodiment 5

[0090] This embodiment further illustrates in detail the specific implementation of the traffic shaping bucket filling processing method of the present invention on the basis of Embodiment 4.

[0091] In this embodiment, the method of the present invention is used to fill buckets for all ports and queues. In this embodiment, five ringing signals are output at different intervals.

[0092] The shaping rate of each port and each queue determines which ringing signal is used as the standard, and is stored in the memory address with the same number as the port or queue together with the bucket filling granularity and bucket filling granularity compensation value. Whenever any ringing signal is heard, all ports or queues start to check one by one whether the ringing signal corresponding to the ringing signal identifier in their own memory address is ringing. If it is a ringing signal, the token data is read to fill the bucket, otherwise the next port or queue is checked.

[0093] like Figure 3 As shown, the ringing signal in this embodiment is 5 periodic level signals, which are used as the timer tick signals for filling the bucket, named tick0~tick5. Among them, tick0 is high level every 400 clock cycles and low level every 100 clock cycles; tick1 is high level every 400 clock cycles and low level every 2100 clock cycles; tick2 is high level every 400 clock cycles and low level every 4600 clock cycles; tick3 is high level every 400 clock cycles and low level every 24600 clock cycles; tick4 is high level every 400 clock cycles and low level every 74600 clock cycles. The high levels of these 5 ticks are aligned (width alignment and period alignment). If tick4 is high level, then tick0~tick4 must all be high level.

[0094] In this embodiment, the clock frequency is 125Mhz. First, a high level of 400 clock cycles of tick0 is generated, and then tick1 is generated by dividing tick0 by 5. Similarly, tick2 is generated by dividing tick1 by 10, and tick3 is generated by dividing tick2 by 5. The high levels of these ticks are maintained for 400 cycles. The 5 tick signals are shown in the following table:

[0095] name cycle High level valid time tick_sel Tick0 4us 3.2us 2‘b00 Tick1 20us 3.2us 2’b01 Tick2 40us 3.2us 2‘b10 Tick3 102us 3.2us 2’b11 Tick4 1010us 3.2us For compensation

[0096] Tick4 is used to fine-tune the shaping rate, supporting a compensation opportunity every 1000us. For example, if there is a frequency deviation, if you want to increase or decrease the rate a little to compensate for the impact of the frequency. The bucket filling granularity compensation value and other rate configuration data such as bucket filling granularity are stored in the memory together.

[0097] In this embodiment, all ports and queues are numbered, and all ports and queues share all ringing signals (tick0 to tick4). The configuration data required for traffic shaping of all ports or all queues is placed in one memory, and the token data of the token buckets related to all ports or all queues is placed in another memory. The memory address is the port number or queue number. The more queues there are in the system, the more resources will be saved when using the memory. When any ringing signal is valid, all queues will be traversed from the bottom to the largest queue number, and information will be read from the two memories one by one. If the current valid ringing signal (tick number) is consistent with the ringing signal in the configuration data, it means that the port or queue needs to fill the bucket and needs to collect the token data stored in the memory. Then, the new token data will be placed back to the original position of the memory after calculation, otherwise no processing will be performed.

[0098] In this embodiment, each port and each queue needs to first determine the bucket filling frequency (ring signal identifier), bucket filling granularity and bucket filling granularity compensation value according to the traffic shaping rate. This information will be written into the memory by the system bus together, and the address of the memory can be used as the port number and queue number. The configuration information in this embodiment supports flow change configuration. In one embodiment of the present invention, the specific method of using 32-bit storage is shown in the following table:

[0099] [31:30] [29:0] Ring signal flag Tick_sel Rate Shaping Configuration Other Information

[0100] It can be seen from the above detailed description that the present invention supports each port and queue with traffic shaping enabled. For those ports and queues that are not enabled, their token data will not be read, so there will be no calculation and bucket filling actions, which can save power consumption.

[0101] In this embodiment, when tick4 is valid, tick0 to tick3 must all be valid. Therefore, when tick4 is valid, all enabled queues will be compensated. If the bucket filling granularity compensation value in the memory is 0, it means that the queue does not need compensation.

[0102] Although different ports and queues may use different ringing signals, the port number and queue number (storage address) are fixed. Even if flow control is not enabled, the same time is required to check the port or queue. Therefore, from the perspective of a port or queue, the adjacent time for each bucket filling is fixed, and the subsequent ports or queues will not be affected by the closure of flow control on some ports or queues.

[0103] Since the traffic shaping targets of each port and each queue are different, the configuration information will be different. Because the token data of all ports or all queues are placed in the same memory, in order to prevent conflicts between different ports or different queues accessing the memory at different shaping rates, as long as one of tick0 / tick1 / tick2 / tick3 is valid, the two memories will be traversed from address 0. If the tick mapped by the ring signal identifier in the configuration information of the read port or queue is pulled high, it means that the port or queue needs to fill the bucket.

[0104] 1) If the ring signal identifier tick_sel in the returned data corresponds to the current ring signal number tick, the new token value is calculated based on the information in the token bucket and written back to the original memory address.

[0105] 2) If the ring signal identifier tick_sel in the returned data does not correspond to the current ring signal number tick, it means that the queue does not need to fill the bucket under the current tick, and no calculation or write back is performed.

[0106] In addition, when all queues are judged, a traversal completion signal refill_done is generated. When the ringing signal tick and the traversal completion signal refill_done are valid at the same time, the memory will not be read any more.

[0107] In this embodiment, each port or queue token data is placed in the second memory, with a bit width of 16 bits. For the second memory (RAM2) storing the calculated token data, the contents stored in each address are shown in the following table:

[0108] [15:0] token_count

[0109] token_count indicates the number of tokens currently remaining in bytes. The highest bit is used as a sign bit. When the bucket needs to be filled, the bucket filling granularity grty_mul and the bucket filling granularity compensation value grty_delt are determined by reading the ring signal identifier tick_sel in the first memory RAM1. In some embodiments of the present invention, if the bucket depth is configured separately, the bucket depth must also be read. Specifically, if it is not the last bucket filling within 1000us, token_count = token_count + grty_mul, otherwise token_count = token_count + grty_delt, and the maximum token_count is the bucket depth CBS.

[0110] Example 6

[0111] This embodiment is used to describe in detail the product implementation of the present invention applied to a network chip. Figure 4As shown, a traffic shaping control module of a network chip includes a memory and a bucket filling processing unit 30, wherein port traffic shaping and queue traffic shaping have their own corresponding memories, storing configuration data and token data required for traffic shaping of each port and queue, and traffic shaping of each port and traffic shaping of each queue have corresponding storage addresses. The bucket filling processing unit 30 uses the traffic shaping bucket filling processing method of the present invention to fill the data in the memory.

[0112] The network chip in this embodiment further includes a token calculation unit 40, which at least completes bucket filling calculation. The token calculation unit 40 is electrically connected to the memory 10 (10') through the channel 20 (20').

[0113] Example 7

[0114] This embodiment is also used to explain in detail the product implementation of the present invention applied to a network chip. Figure 5 As shown, a traffic shaping control module of a network chip includes a memory and a bucket filling processing unit 30; wherein, port traffic shaping and queue traffic shaping each use a pair of memories to store configuration data and token data respectively; in each pair of memories, the first memory stores configuration data and is connected to the first channel and the second channel, and the second memory stores token data and is connected to the third channel; the storage address depth of the configuration data and the token data is the same; the configuration data and token data of each port and queue have corresponding storage addresses; the bucket filling processing unit 30 uses the traffic shaping bucket filling processing method of the present invention to bucket the data in the memory

[0115] The network chip in this embodiment further includes a token calculation unit 40, which at least completes bucket filling calculation. The token calculation unit 40 is electrically connected to the first memory 101 (101') through the second channel 202 (202'), and is electrically connected to the second storage module 102 (102') through the third channel 203 (203').

[0116] In this embodiment, the first memory and the second memory are single-port memories.

[0117] In this embodiment, the first channel is a system bus of a network chip, and the second channel and the third channel are hardware logic lines connecting the token calculation unit.

[0118] Example 8

[0119] This embodiment is used to explain in detail the implementation of the method of the present invention in a network chip product. This embodiment provides a network chip, including the traffic shaping control module described in Embodiment 6 or Embodiment 8.

[0120] Example 9

[0121] This embodiment is used to explain in detail the implementation of the method of the present invention on a network device product. This embodiment provides a network device, including the network chip described in Embodiment 8. In some embodiments of the present invention, the network device is an Ethernet switch.

[0122] The descriptions of the processes or structures corresponding to the above-mentioned figures have different emphases. For parts that are not described in detail in a certain process or structure, please refer to the relevant descriptions of other processes or structures.

[0123] The above embodiments are merely illustrative of the principles and effects of the present application and are not intended to limit the present application. Anyone familiar with the technology may modify or change the above embodiments without violating the spirit and scope of the present application. Therefore, all equivalent modifications or changes made by a person of ordinary skill in the art without departing from the spirit and technical ideas disclosed in the present application shall still be covered by the claims of the present application.

Claims

1. A traffic shaping bucket filling processing method, characterized in that: The method is applied to a memory used for network traffic shaping, wherein port traffic shaping and queue traffic shaping have respective corresponding memories, storing configuration data and token data required for traffic shaping of each port and queue, and traffic shaping of each port and traffic shaping of each queue have corresponding storage addresses, and the method comprises: Preset N bucket filling frequencies and set at least N ringing signals, where N is a natural number; The ringing signal corresponds to the bucket filling frequency one by one, and each ringing signal is outputted at a fixed time according to the corresponding bucket filling frequency. Each ringing signal has a preset ringing signal identifier, which is selected by the traffic shaping of each port and queue and is used as part of the configuration data; When any ringing signal is valid, the storage addresses of all ports of the memory and the storage addresses of all queues are checked one by one, and the checking performs the following operations: the ringing signal identifier in the configuration data is read from the checked storage address, and it is determined whether the ringing signal identifier is consistent with the current ringing signal; if so, other configuration data and token data are read from the checked storage address to perform bucket filling calculation, and new token data is obtained by the bucket filling calculation and stored in the checked storage address.

2. The traffic shaping bucket filling processing method according to claim 1, wherein: Port traffic shaping and queue traffic shaping each use a pair of memories to store configuration data and token data respectively. In each pair of memories, the first memory stores configuration data and the second memory stores token data. The storage address depths of the configuration data and token data are the same.

3. The traffic shaping bucket filling processing method according to claim 1, wherein: The configuration data stored in the memory also includes bucket filling granularity, which is the number of tokens filled in each bucket. The bucket filling granularity is calculated using the formula grty_mul=grty / F, where grty_mul represents the bucket filling granularity, grty is the bucket filling rate, and F is the bucket filling frequency.

4. The method for processing traffic shaping bucket filling according to claim 1, wherein: The configuration data stored in the memory also includes bucket filling granularity and bucket filling granularity fine-tuning value. In each bucket filling cycle, the bucket filling granularity is used as the bucket filling token value to fill the bucket F-1 times, and the bucket filling granularity fine-tuning value is used as the bucket filling token value to fill the bucket 1 time. The bucket filling granularity and the bucket filling granularity fine-tuning value satisfy the formula grty=(F-1)×grty_mul+grty_delt, grty is the bucket filling rate, F is the bucket filling frequency, grty_mul represents the bucket filling granularity, and grty_delt represents the bucket filling granularity fine-tuning value.

5. The traffic shaping bucket filling processing method according to claim 4, wherein: There are F ringing signals in each bucket filling cycle. One of the ringing signals is selected to be valid and the fine-tuning signal is output at the same time. When only the ringing signal is valid, the bucket is filled with the bucket filling granularity as the bucket filling token value. When the fine-tuning signal and the ringing signal are valid at the same time, the bucket is filled with the bucket filling granularity fine-tuning value as the bucket filling token value.

6. The traffic shaping bucket filling processing method according to claim 1, comprising: According to the order of bucket filling frequency from high to low, of two adjacent ringing signals, the ringing signal with a lower frequency is generated by dividing the ringing signal with a higher frequency.

7. The traffic shaping bucket filling processing method according to any one of claims 1 to 6, wherein: The configuration data stored in the memory also includes a bucket depth. The bucket depth is stored by storing a bucket depth factor cbs_mul and a bucket depth index cbs_exp representing a bucket depth CBS, wherein CBS=cbs_mul×2 cbs_exp .

8. A traffic shaping control module for a network chip, comprising a memory and a bucket filling processing unit, wherein: Port traffic shaping and queue traffic shaping have their own corresponding memories, which store the configuration data and token data required for traffic shaping of each port and queue. The traffic shaping of each port and the traffic shaping of each queue have corresponding storage addresses. The bucket filling processing unit fills buckets using the traffic shaping bucket filling processing method according to any one of claims 1 to 7.

9. A network chip, comprising the traffic shaping control module as claimed in claim 8.

10. A network device, comprising the network chip according to claim 9.

Citation Information

Patent Citations

  • Timing counter frequency measurement system and method

    CN103424619A