A method for dual-time precision traffic shaping of Ethernet routing and switching chips
Patent Information
- Application Number
- CN202611306153.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-26
- Publication Date
- 2026-09-29
AI Technical Summary
[0006]有鉴于此,本发明的目的在于提出一种以太网路由交换芯片的双时间精度流量整形方法,以解决以太网路由交换芯片在对不同端口和业务队列进行比特率限速和包率限速差异化配置时,因采用单一时间精度配置令牌桶、时钟分频链路重复部署及存储位宽统一配置而导致的硬件设计冗余与存储资源浪费的技术问题
[0030]一、硬件定时器采用级联分频结构,系统时钟经第一计数器产生微秒级基准信号后,该信号直接作为毫秒计数器的输入驱动,累加生成毫秒级基准信号。与独立部署两个大位宽计数器的方案相比,第一计数器与毫秒计数器共用时钟分频链路,省去额外的时钟树分支和高位宽比较逻辑,减少门电路数量。
Smart Images

Figure CN122845522A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of router and switch communication technology, and in particular to a dual-time-precision traffic shaping method for Ethernet routing and switching chips. Background Technology
[0002] In traffic management of Ethernet routing and switching chips, the token bucket algorithm is a common mechanism for port and queue rate limiting. This algorithm achieves smooth control of the output rate by periodically adding tokens to the bucket and deducting tokens when sending packets. Network services typically employ two rate limiting dimensions: bit rate limiting (Bps mode), which uses bytes as the unit of measurement and is geared towards bandwidth-intensive services; and packet rate limiting (Pps mode), which uses data packets as the unit of measurement and is geared towards processing-intensive services.
[0003] Due to variations in Ethernet packet length, at a 1Gbps line rate, the packet rate is approximately 1.488 Mpps with a minimum frame length of 64 bytes, approximately 450 Kpps with an average frame length of 256 bytes, and approximately 81 Kpps with a maximum frame length of 1518 bytes. The units of measurement and numerical ranges for Bps and Pps modes differ by orders of magnitude.
[0004] Existing hardware implementations typically use a single time precision to drive the token bucket. When using microsecond-level precision, Pps mode (e.g., 1Kpps~10Kpps) requires a very large token accumulation interval or a high-bit-width counter, resulting in high gate circuit overhead. When using millisecond-level precision, Bps mode (e.g., 1Gbps~10Gbps) has coarse burst metering granularity, making it difficult to accurately control bandwidth. Furthermore, existing solutions often deploy counters independently per port or per queue, leading to redundant clock division links. In storage design, Bps and Pps modes typically share the same bucket depth and bit width; Pps mode only requires a small burst absorption capacity, and the uniform bit width causes redundancy in storage entries. As the number of ports and queues increases, the chip area and clock routing congestion increase.
[0005] Some existing solutions deduct tokens after message output and then determine the remaining capacity in the next cycle. This introduces a clock delay between sending and rate limiting determination, which may cause instantaneous rate spikes in the hardware pipeline. Therefore, it is necessary to provide a traffic shaping method with dual time precision to adapt to the differentiated metering requirements of Bps and Pps modes, while reducing hardware resource overhead. Summary of the Invention
[0006] In view of this, the purpose of this invention is to propose a dual-time-precision traffic shaping method for Ethernet routing and switching chips, so as to solve the technical problems of hardware design redundancy and storage resource waste caused by using single-time-precision configuration of token bucket, repeated deployment of clock frequency division links and uniform configuration of storage bit width when Ethernet routing and switching chips perform differentiated configuration of bit rate limiting and packet rate limiting for different ports and service queues.
[0007] To achieve the above objectives, the present invention provides a dual-time-precision traffic shaping method for Ethernet routing and switching chips, comprising the following steps:
[0008] S1. Obtain the system clock and the preset shaping rate limiting mode, which includes bit rate limiting mode and packet rate limiting mode; obtain the configuration parameters corresponding to the shaping rate limiting mode, which include: a first counting threshold for defining microsecond-level time precision, a multiple threshold for defining millisecond-level time precision, a token configuration value, and a maximum bucket depth configuration.
[0009] S2. Count the system clock. When the count value reaches the first count threshold, generate a first reference signal with microsecond-level time accuracy. Use a millisecond counter to count the first reference signal as a cascaded input signal. When the count value reaches a multiple threshold, generate a second reference signal with millisecond-level time accuracy.
[0010] S3. Select the corresponding reference signal to trigger the token addition operation based on the shaping speed limiting mode:
[0011] When in bit rate limiting mode, the first reference signal is used to trigger the reading of the current token count value from the token storage unit and the number of bytes of tokens equal to the token configuration value is added to it;
[0012] When in packet rate limiting mode, the second reference signal is used to trigger the reading of the current token count value from the token storage unit and add the number of data packet tokens equal to the token configuration value.
[0013] The token count value after adding the token is compared with the maximum bucket depth configuration. If it is greater than the maximum bucket depth configuration, it is limited to the maximum bucket depth configuration. The token count value after periodic updates is obtained and written to the token storage unit.
[0014] S4. Before the message is scheduled to be output, read the periodically updated token count value from the token storage unit and determine whether it meets the token requirements of the message to be sent. If it does, the message output is allowed, and the number of tokens corresponding to the actual consumption of the message is deducted from the periodically updated token count value to obtain the event-updated token count value and written to the token storage unit. If it does not meet the requirements, the message output is prohibited, the token count value in the token storage unit remains unchanged, and the corresponding port or queue status is set to the paused sending state.
[0015] Preferably, the configuration parameters also include an initial bucket token value, which is written to the token storage unit when the system is reset or the queue is enabled to initialize the token count value.
[0016] Preferably, in step S1, the first counting threshold is determined according to the frequency of the system clock, and its value is the number of clock cycles required to generate a 1 microsecond time base, and the multiplier threshold is set to 1000.
[0017] Preferably, step S1 further includes obtaining a multiplier parameter, which includes a bit rate multiplier parameter and a packet rate multiplier parameter. Let the bit rate multiplier parameter be N and the packet rate multiplier parameter be M, and both N and M are integers greater than or equal to 1.
[0018] In step S3, when the bit rate limiting mode is in operation, a token-adding operation is triggered once for every N first reference signals received. When the packet rate limiting mode is in operation, a token-adding operation is triggered once for every M second reference signals received.
[0019] Preferably, when in bit rate limiting mode, the token configuration value satisfies: token configuration value = (target bit rate limit value × first counting threshold × bit rate multiplier parameter) / system clock frequency;
[0020] The target bit rate limit is measured in bytes per second, and the system clock frequency is measured in Hz.
[0021] When in packet rate limiting mode, the token configuration value satisfies: token configuration value = (target packet rate limiting value × first counting threshold × multiplier threshold × packet rate multiplier parameter) / system clock frequency;
[0022] The target packet rate limit is measured in packets per second, and the system clock frequency is measured in Hz.
[0023] Preferably, in the maximum bucket depth configuration, a storage space of a first preset bit width is allocated for the maximum bucket depth configuration of the bit rate limiting mode, and a storage space of a second preset bit width is allocated for the maximum bucket depth configuration of the packet rate limiting mode, wherein the second preset bit width is smaller than the first preset bit width.
[0024] Preferably, the first preset bit width is 24 bits and the second preset bit width is 12 bits.
[0025] Preferably, in step S2, a microsecond counter is used to count the system clock. When the count value reaches a first counting threshold, a first reference signal is output. Then, the microsecond counter is cleared. A millisecond counter is used to accumulate the number of pulses of the first reference signal. When the count value reaches a multiple threshold, a second reference signal is output.
[0026] Preferably, the first reference signal and the second reference signal are shared by all ports and service queues as a global clock reference; the token storage unit includes an independent storage sub-unit corresponding to each port or service queue, and each port or service queue independently selects the first reference signal or the second reference signal as the local token update trigger source according to its own shaping rate limiting mode, and independently maintains its own token count value and maximum bucket depth configuration.
[0027] Preferably, in step S4, under bit rate limiting mode, it is determined whether the token count value after the periodic update is greater than or equal to the actual byte length of the current message to be sent. If it is satisfied, the message output is allowed, and the number of tokens equal to the actual byte length of the message is deducted from it to obtain the token count value after the event update and write it into the token storage unit.
[0028] In packet rate limiting mode, it is determined whether the token count value after the periodic update is greater than or equal to 1. If it is satisfied, the message output is allowed, and the number of tokens with a fixed value of 1 is deducted from it to obtain the token count value after the event update and write it into the token storage unit.
[0029] The beneficial effects of this invention are as follows:
[0030] 1. The hardware timer adopts a cascaded frequency divider structure. After the system clock generates a microsecond-level reference signal through the first counter, this signal is directly used as the input driver for the millisecond counter, accumulating to generate a millisecond-level reference signal. Compared with the scheme of independently deploying two large-bit-width counters, the first counter and the millisecond counter share a clock frequency divider link, eliminating the need for additional clock tree branches and high-bit-width comparison logic, and reducing the number of gate circuits.
[0031] 2. The cascaded double-precision reference signals drive token updates in both bit rate limiting (Bps mode) and packet rate limiting (Pps mode) modes. Bps mode uses a microsecond-level reference signal as the tick mark, accumulating tokens granularly by byte; Pps mode uses a millisecond-level reference signal as the tick mark, accumulating tokens granularly by packet count. Both modes share the same adder / subtractor hardware, differing only in the unit of measurement and trigger tick mark. The configuration process for bandwidth limiting and packet rate limiting is consistent, avoiding the need for separate computational paths for the two limiting types.
[0032] III. Different maximum bucket depth bit widths are configured for different rate-limiting modes. Bps mode allocates 24 bits of storage space, supporting burst absorption on the order of 16MB, suitable for high-volume, long packets like video and downloads; Pps mode allocates 12 bits of storage space, limiting the number of burst packets to within 4KB, suitable for high-frequency, small packets like ARP and ICMP. After the token addition operation is completed, the hardware immediately compares the token count with the maximum bucket depth of the corresponding mode and applies the upper limit to prevent token overflow within the bucket.
[0033] IV. Maximum Bucket Depth Configuration: Asymmetric Bit Width Allocation by Mode: 24 bits for Bps mode and 12 bits for Pps mode. Token configuration values are uniformly stored using 14 bits, and both modes share the same register address space. Dual time precision expands the update cycle of Pps mode from microseconds to milliseconds, narrowing the range of token configuration values in Pps mode. The 14-bit width can cover typical levels from 10Kpps to 15Mpps when M=1, and since both modes share the same 14-bit register group, there is no need to separately expand the register width for Pps mode. Attached Figure Description
[0034] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0035] Figure 1 This is a flowchart of the steps of the present invention;
[0036] Figure 2 This is a flowchart of the present invention. Detailed Implementation
[0037] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to specific embodiments.
[0038] like Figures 1-2 As shown, a dual-time-precision traffic shaping method for an Ethernet routing and switching chip is described. After the chip is reset, the hardware completes the initialization configuration based on the traffic shaping requirements of each port and service queue. The system's total clock frequency is 125MHz, and a single clock cycle is 8ns. The shaping rate limiting modes include bit rate limiting mode (Bps mode) and packet rate limiting mode (Pps mode), targeting bandwidth-intensive and processing-intensive services respectively, and include the following steps:
[0039] S1. Obtain the system clock (including its frequency information) and the preset shaping rate limiting mode. The shaping rate limiting mode includes the bit rate limiting mode and the packet rate limiting mode. Obtain the configuration parameters corresponding to the shaping rate limiting mode. The configuration parameters include: the first counting threshold for defining microsecond-level time precision, the multiple threshold for defining millisecond-level time precision, the token configuration value, and the maximum bucket depth configuration.
[0040] In step S1, the first counting threshold is determined based on the frequency of the system clock. Its value is the number of clock cycles required to generate a 1 microsecond time reference. At a 125MHz clock, it is configured to be 125, meaning that a microsecond-level reference is generated every 125 clock cycles.
[0041] The multiplier threshold is fixed at 1000, representing the cumulative multiplier of millisecond-level time precision relative to microsecond-level time precision.
[0042] In the maximum bucket depth configuration, a first preset bit width of storage space is allocated for the maximum bucket depth configuration of the bit rate limiting mode, and a second preset bit width of storage space is allocated for the maximum bucket depth configuration of the packet rate limiting mode. The second preset bit width is less than the first preset bit width. The first preset bit width is 24 bits and the second preset bit width is 12 bits.
[0043] The configuration parameters also include the initial token value in the bucket. When the system is reset or the queue is enabled, the initial token value in the bucket is written to the token storage unit to initialize the token count value. The hardware reads the current token count value from the token storage unit as the initial state for subsequent addition and subtraction operations.
[0044] S2. Count the system clock. When the count value reaches the first count threshold, generate a first reference signal with microsecond-level time accuracy. Use a millisecond counter to count the first reference signal as a cascaded input signal. When the count value reaches a multiple threshold, generate a second reference signal with millisecond-level time accuracy.
[0045] In step S2, a microsecond counter is used to count the system clock. The counter starts accumulating from 0, and when the count value reaches the first counting threshold of 125, the microsecond counter outputs a pulse signal as the first reference signal, and then performs a clearing operation on the microsecond counter.
[0046] A millisecond counter is used to accumulate the first reference signal as a cascaded input signal. Each time a pulse of the first reference signal is generated, the millisecond counter increments by 1; when the count value reaches a multiple threshold of 1000, the millisecond counter outputs a pulse signal as the second reference signal, representing a 1ms time accuracy.
[0047] The first and second reference signals serve as a global clock reference and are shared by all ports and service queues, eliminating the need for each queue to independently deploy clock divider links.
[0048] S3. Select the corresponding reference signal to trigger the token addition operation based on the shaping speed limiting mode:
[0049] When in bit rate limiting mode, the first reference signal is used to trigger the reading of the current token count value from the token storage unit, and the number of bytes of tokens equal to the token configuration value is added to it to obtain the token count value after adding tokens.
[0050] When in packet rate limiting mode, the second reference signal is used to trigger the current token count value from the token storage unit, and the number of data packet tokens equal to the token configuration value is added to it to obtain the token count value after adding tokens;
[0051] Step S1 also includes obtaining the multiplier parameters, which include the bit rate multiplier parameter and the packet rate multiplier parameter. Let the bit rate multiplier parameter be N and the packet rate multiplier parameter be M, and both N and M are integers greater than or equal to 1.
[0052] In step S3, when the bit rate limiting mode is in operation, a token-adding operation is triggered once for every N first reference signals received. When the packet rate limiting mode is in operation, a token-adding operation is triggered once for every M second reference signals received.
[0053] When in bit rate limiting mode, the token configuration value satisfies: Token configuration value = (target bit rate limit value × first counting threshold × bit rate multiplier parameter) / system clock frequency;
[0054] The target bit rate limit is measured in bytes per second, and the system clock frequency is measured in Hz.
[0055] The first reference signal is used as the trigger source. If N=1 is configured, a token addition operation is triggered once for each first reference signal received, and the number of byte tokens is increased to the token count value by the same number of bytes as the token configuration value.
[0056] For example, the target speed limit for a certain port is 1Gbps (125×10). 6 (bytes / s), system clock frequency is 125×10 6 Hz, the first counting threshold is 125, N=1, then:
[0057] Token configuration value = (125 × 10) 6 (×125×1) / 125×10 6 =125 bytes;
[0058] That is, 125 bytes of tokens are added to the token bucket every 1μs, with an equivalent rate of 125 bytes / μs = 125MB / s = 1Gbps.
[0059] If N=2 is configured, an addition is triggered every 2μs, the token configuration value is 250 bytes, and the equivalent rate is still 1Gbps.
[0060] When in packet rate limiting mode, the token configuration value satisfies: Token configuration value = (Target packet rate limiting value × First counting threshold × Multiplier threshold × Packet rate multiplier parameter) / System clock frequency;
[0061] The target packet rate limit is measured in packets per second, and the system clock frequency is measured in Hz.
[0062] The second reference signal is used as the trigger source. If M=1 is configured, a token addition operation is triggered once for each second reference signal received, increasing the token count by the number of data packet tokens equal to the token configuration value.
[0063] For example, the target rate limit for a certain port is 10Kpps (10×10). 3 (packets / s), the first counting threshold is 125, the multiple threshold is 1000, M=1, then:
[0064] Token configuration value = (10 × 10) 3 (×125×1000×1) / 125×10 6 =10 packets;
[0065] That is, 10 packet tokens are added to the token bucket every 1ms, with an equivalent rate of 10 packets / ms = 10Kpps.
[0066] The token count value after adding the token is compared with the maximum bucket depth configuration. If the token count value is greater than the maximum bucket depth configuration, it is restricted to the maximum bucket depth configuration, and the periodically updated token count value is obtained and written to the token storage unit.
[0067] The token storage unit adopts a read-write separation structure. The write-back operation of S3 and the read operation of S4 are isolated by the clock edge to ensure data consistency within the same processing cycle.
[0068] S4. Before the message is scheduled to be output, read the periodically updated token count value from the token storage unit, determine whether it meets the token requirements of the message to be sent, if it does, allow the message to be output, and deduct the number of tokens corresponding to the actual consumption of the message from the periodically updated token count value to obtain the event-updated token count value and write it into the token storage unit.
[0069] In step S4, under bit rate limiting mode, it is determined whether the token count value after the periodic update is greater than or equal to the actual byte length of the current message to be sent. If it is satisfied, the message output is allowed, and the number of tokens equal to the actual byte length of the message is deducted from it to obtain the token count value after the event update and write it into the token storage unit.
[0070] In packet rate limiting mode, it is determined whether the token count value after the periodic update is greater than or equal to 1. If it is satisfied, the message output is allowed, and the number of tokens with a fixed value of 1 is deducted from it to obtain the token count value after the event update and write it into the token storage unit.
[0071] If the conditions are not met, message output is prohibited, the token count in the token storage unit remains unchanged, and the corresponding port or queue status is set to pause sending.
[0072] The token storage unit includes independent storage sub-units corresponding to each port or service queue. Each port or service queue independently selects the first reference signal or the second reference signal as the local token update trigger source according to its own shaping rate limiting mode, and independently maintains its own token count value and maximum bucket depth configuration. This structure avoids deploying clock divider links independently for each port or each queue, reducing clock tree branches and cabling congestion.
[0073] The token configuration value is uniformly stored using a 14-bit width, and the Bps mode and Pps mode share the same configuration register group address space.
[0074] The token configuration value is stored using a 14-bit width, representing a range from 0 to 16383. In a typical configuration, a token configuration value of 1250 corresponds to 10Gbps in Bps mode (N=1), and a token configuration value of 15000 corresponds to 15Mpps in Pps mode (M=1), both within the 14-bit range. If the multiplier parameter is too large and causes the value to exceed the range, it can be adjusted by decreasing N or M.
[0075] Maximum bucket depth configuration allocates asymmetric bit width according to mode:
[0076] For BPS mode, if a burst bucket depth of up to 16 MByte is required, 2 24 =16777216, therefore 24 bits are allocated. For Pps mode, if a burst bucket depth of up to 4096 packets is required, 2 12 =4096, therefore 12 bits are allocated.
[0077] Those skilled in the art should understand that the discussion of any of the above embodiments is merely exemplary and is not intended to imply that the scope of the invention is limited to these examples; within the framework of the invention, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of the different aspects of the invention as described above, which are not provided in detail for the sake of brevity.
Claims
1. A method for dual-time-precision traffic shaping of an Ethernet routing and switching chip, characterized in that, Includes the following steps: S1. Obtain the system clock and preset shaping rate limiting modes, including bit rate limiting mode and packet rate limiting mode. Obtain the configuration parameters corresponding to the shaping rate limiting mode. The configuration parameters include: a first counting threshold for defining microsecond-level time precision, a multiple threshold for defining millisecond-level time precision, a token configuration value, and a maximum bucket depth configuration. S2. Count the system clock. When the count value reaches the first counting threshold, generate a first reference signal with microsecond-level time accuracy. Use a millisecond counter to count the first reference signal as a cascaded input signal. When the count value reaches a multiple threshold, generate a second reference signal with millisecond-level time accuracy. S3. Select the corresponding reference signal to trigger the token addition operation based on the shaping speed limiting mode: When in bit rate limiting mode, the first reference signal is used to trigger the reading of the current token count value from the token storage unit and the number of bytes of tokens equal to the token configuration value is added to it; When in packet rate limiting mode, the second reference signal is used to trigger the reading of the current token count value from the token storage unit and add the number of data packet tokens equal to the token configuration value. The token count value after adding the token is compared with the maximum bucket depth configuration. If it is greater than the maximum bucket depth configuration, it is limited to the maximum bucket depth configuration. The token count value after periodic updates is obtained and written to the token storage unit. S4. Before the message is scheduled to be output, read the periodically updated token count value from the token storage unit and determine whether it meets the token requirements of the message to be sent. If it does, the message output is allowed, and the number of tokens corresponding to the actual consumption of the message is deducted from the periodically updated token count value to obtain the event-updated token count value and written to the token storage unit. If it does not meet the requirements, the message output is prohibited, the token count value in the token storage unit remains unchanged, and the corresponding port or queue status is set to the paused sending state.
2. The dual-time-precision traffic shaping method for an Ethernet routing and switching chip according to claim 1, characterized in that, The configuration parameters also include an initial bucket token value, which is written to the token storage unit to initialize the token count value when the system is reset or the queue is enabled.
3. The dual-time-precision traffic shaping method for an Ethernet routing and switching chip according to claim 1, characterized in that, In step S1, the first counting threshold is determined based on the frequency of the system clock, and its value is the number of clock cycles required to generate a 1 microsecond time base. The multiplier threshold is set to 1000.
4. The dual-time-precision traffic shaping method for an Ethernet routing and switching chip according to claim 1, characterized in that, Step S1 also includes obtaining the multiplier parameters, which include the bit rate multiplier parameter and the packet rate multiplier parameter, wherein the bit rate multiplier parameter is N and the packet rate multiplier parameter is M, and both N and M are integers greater than or equal to 1; In step S3, when the bit rate limiting mode is in operation, a token-adding operation is triggered once for every N first reference signals received. When the packet rate limiting mode is in operation, a token-adding operation is triggered once for every M second reference signals received.
5. The dual-time-precision traffic shaping method for an Ethernet routing and switching chip according to claim 4, characterized in that, When in bit rate limiting mode, the token configuration value satisfies: token configuration value = (target bit rate limit value × first counting threshold × bit rate multiplier parameter) / system clock frequency; The target bit rate limit is measured in bytes per second, and the system clock frequency is measured in Hz. When the packet rate limiting mode is in operation, the token configuration value satisfies the following condition: Token configuration value = (Target packet rate limiting value × First counting threshold × Multiplier threshold × Packet rate multiplier parameter) / System clock frequency; The target packet rate limit is measured in packets per second, and the system clock frequency is measured in Hz.
6. The dual-time-precision traffic shaping method for an Ethernet routing and switching chip according to claim 1, characterized in that, In the maximum bucket depth configuration, a storage space with a first preset bit width is allocated for the maximum bucket depth configuration of the bit rate limiting mode, and a storage space with a second preset bit width is allocated for the maximum bucket depth configuration of the packet rate limiting mode. The second preset bit width is smaller than the first preset bit width.
7. The dual-time-precision traffic shaping method for an Ethernet routing and switching chip according to claim 6, characterized in that, The first preset bit width is 24 bits, and the second preset bit width is 12 bits.
8. The dual-time-precision traffic shaping method for an Ethernet routing and switching chip according to claim 1, characterized in that, In step S2, a microsecond counter is used to count the system clock. When the count value reaches the first counting threshold, the first reference signal is output. Then, the microsecond counter is cleared. A millisecond counter is used to accumulate the number of pulses of the first reference signal. When the count value reaches the multiple threshold, the second reference signal is output.
9. A dual-time-precision traffic shaping method for an Ethernet routing and switching chip according to claim 8, characterized in that, The first and second reference signals are shared by all ports and service queues as a global clock reference; the token storage unit includes independent storage sub-units corresponding to each port or service queue, and each port or service queue independently selects the first or second reference signal as the local token update trigger source according to its own shaping rate limiting mode, and independently maintains its own token count value and maximum bucket depth configuration.
10. A dual-time-precision traffic shaping method for an Ethernet routing and switching chip according to claim 1, characterized in that, In step S4, under bit rate limiting mode, it is determined whether the token count value after the periodic update is greater than or equal to the actual byte length of the current message to be sent. If it is satisfied, the message output is allowed, and the number of tokens equal to the actual byte length of the message is deducted from it to obtain the token count value after the event update and write it into the token storage unit. In packet rate limiting mode, it is determined whether the token count value after the periodic update is greater than or equal to 1. If it is satisfied, the message output is allowed, and the number of tokens with a fixed value of 1 is deducted from it to obtain the token count value after the event update and write it into the token storage unit.