Method and device for realizing flow regulation single-speed three-color marking based on time

By replacing the token bucket in time, the problem of resource consumption and cost increase in traditional single-speed three-color marking scheme is solved, and more efficient and stable flow regulation is achieved.

CN120455406APending Publication Date: 2025-08-08KUNGAO XINXIN MICROELECTRONICS (JIANGSU) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202510540109.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-27
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

In the existing switch flow regulation methods, the traditional single-speed three-color marking scheme requires additional tasks and table entries to the chip, resulting in increased resource consumption and R&D costs.

Method used

The time replaces the token bucket is used to calculate the number of tokens by recording the time difference value, realize the color of the packet, configure the time range and ratio, initialize the current allowable packet through value, and mark it in combination with time and message length.

Benefits of technology

Simplifies chip design, reduces resource overhead and chipping costs, while achieving more efficient and stable flow regulation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120455406A_ABST
    Figure CN120455406A_ABST
Patent Text Reader

Abstract

The invention discloses a method and a device for realizing flow regulation single-speed three-color marking based on time. The method comprises the following steps: S1, enabling a color marking function; s2, when a message exists, recording time Tpacket, judging whether Tpacket-Tstart is greater than or equal to Transge1 or not, if yes, executing S4, and if not, executing S3; s3, multiplying the value of the Tpackage-Tstart by the Tate, adding currentnumber1, then comparing with Trans1 * Tate, if the Tpackage-Tstart is larger, executing S4, otherwise, executing S5, and if the Tpackage-Tstart is larger than the Trans1 * Tate, executing S5; s4, updating the value of Transge1 * Trate to currentnumber1, judging whether the value of Tpackt-Tstart-Transge1 is greater than or equal to Transge2 or not, if yes, executing the step S7, and if not, executing the step S6; s5, multiplying the value of the Tpacket-Tstart by the Tate, adding the product to the currentnumber1, then updating the product to the currentnumber1, and then executing the step S9; s6, multiplying the value of the Tpackt-Tstart-Transge1 by the Trate, adding a currentnumber2, comparing with Transge2 * Trate, if the value of the Tpackt-Tstart-Transge1 is larger, executing the step S7, otherwise, executing the step S8, and if the value of the Tpackt-Tstart-Transge1 is larger, executing the step S7; s7, the value of Transge2 * Trate is updated to the currentnumber2, and then the step S9 is carried out; s8, the value of the Tpackt-Tstart-Transge2 is multiplied by the Tate, the value of the Tpackt-Tstart-Transge2 is added with the currentnumber2, then the product is updated to the currentnumber2, and then the step S9 is carried out; and S9, by comparing the current number1 and the current number2 with the PacketLength, the color of the message is marked, and the color of the message is marked by comparing the current number1 with the PacketLength and comparing the current number2 with the PacketLength.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of network traffic evaluation, and in particular to a method and device for implementing traffic regulation single-speed three-color marking based on time. Background Art

[0002] The current industry's commonly used single-rate, three-color marking method for traffic shaping in switches is based on RFC2697. This method adds tokens to a token bucket and colors the two buckets a packet can pass through. If the number of tokens in both buckets is less than the packet length, the packet is marked red. This technology requires additional tasks and related table entries on the chip to maintain token additions to the token bucket, consuming significant chip resources and increasing R&D costs. Summary of the Invention

[0003] The present invention innovatively uses time to replace token buckets and tokens. Since time naturally increases forward, it is only necessary to record relevant time points and calculate the number of tokens in a similar bucket by using the time difference. This is then subtracted from the message to determine whether the message can pass through, thereby color-coding the message.

[0004] In order to achieve the above-mentioned object, the technical solution of the present invention provides a method for implementing single-rate three-color marking for traffic regulation based on time, which includes the following steps: S1: enabling the color marking function, configuring two time ranges Trange1 and Trange2, configuring the time ratio Trate, initializing and setting two currently allowed message passing values currentnumber1 and currentnumber2, and obtaining the time as Tstart, wherein the values of Trange1 and Trange2 are equal to the depths of the two token buckets, the value of Trate is equal to the rate at which tokens are added to the token buckets, and the values of currentnumber1 and currentnumber2 are equal to the current number of tokens in the two token buckets; S2: when a message enters the chip, recording the time at this time as Tpacket, and judging whether the value of Tpackt-Tstart is greater than or equal to Trange1, if so, proceeding to step S4, otherwise proceeding to step S3;

[0005] S3: Multiply the value of Tpackt-Tstart by Trate and add the result obtained by currentnumber1 and compare it with Trange1*Trate. If the former is greater than or equal to the latter, proceed to step S4, otherwise proceed to step S5; S4: Update the value of Trange1*Trate to currentnumber1, and then determine whether the value of Tpackt-Tstart-Trange1 is greater than or equal to Trange2. If so, proceed to step S7, otherwise proceed to step S6; S5: Multiply the value of Tpackt-Tstart by Trate and add the result obtained by currentnumber1 to currentnumber1, and then proceed to step S9; S6: Update Tpackt-Tstart by Trate and add the result obtained by currentnumber1 to currentnumber1. The value of rt-Trange1 is multiplied by Trate and added to the result obtained by currentnumber2, and the result is compared with Trange2*Trate. If the former is greater than or equal to the latter, proceed to step S7, otherwise proceed to step S8; S7: update the value of Trange2*Trate to currentnumber2, and then proceed to step S9; S8: update the result obtained by multiplying the value of Tpackt-Tstart-Trange2 by Trate and adding currentnumber2 to currentnumber2, and then proceed to step S9; S9: mark the message color by comparing currentnumber1 and currentnumber2 with the message length PacketLength.

[0006] Further, step S9 specifically includes: S91: determine whether the value after currentnumber1 minus PacketLength is greater than or equal to 0, if so, mark the message as green, otherwise proceed to step S92: S92: determine whether the value after currentnumber2 minus PacketLength is greater than or equal to 0, if so, mark the message as yellow, otherwise proceed to step S93; S93: mark the message as red.

[0007] Further, in step S91, when the message is marked as green, currentnumber1 is updated to the value minus the message length; in step S92, when the message is marked as yellow, currentnumber2 is updated to the value minus the message length, and the value of currentnumber1 remains unchanged; in step S93, when the message is marked as red, the values of currentnumber1 and currentnumber2 remain unchanged.

[0008] Furthermore, in step S9, after marking the color of the message, the value of Tstart is updated to the value of Tpacket.

[0009] Furthermore, the time unit and Trate value of Trange1 and Trange2 are specified by the user, the initial values of currentnumber1 and currentnumber2 are set to 0, and support counting based on the actual length of the message or specifying that the message be counted based on a fixed length.

[0010] The technical solution of the present invention also provides a device for realizing single-speed three-color marking of flow regulation based on time, which includes the following modules: a color marking function enabling module: used to enable the color marking function, configure two time ranges Trange1 and Trange2, configure the time ratio Trate, initialize and set two currently allowed message passing values currentnumber1 and currentnumber2, and obtain the time as Tstart, wherein the values of Trange1 and Trange2 are equal to the depth of the two token buckets, the value of Trate is equal to the rate of adding tokens to the token bucket, and the values of currentnumber1 and currentnumber2 are equal to the current number of tokens in the two token buckets; a message entry processing module: used to record the time as Tpack when a message enters the chip et, and judge whether the value of Tpackt-Tstart is greater than or equal to Trange1; a comparison module: for, when the value of Tpackt-Tstart is less than Trange1, comparing the result obtained by multiplying the value of Tpackt-Tstart by Trate and adding currentnumber1 with Trange1*Trate, and for comparing the value of Tpackt-Tstart-Trange1 with Trange2, and when the value of Tpackt-Tstart-Trange1 is less than Trange2, further comparing the result obtained by multiplying the value of Tpackt-Tstart-Trange1 by Trate and adding currentnumber2 with Trange2*Trate;Update module: used to update the value of Trange1*Trate to currentnumber1 when the value of Tpackt-Tstart is greater than or equal to Trange1 or the result obtained by multiplying the value of Tpackt-Tstart and Trate and adding currentnumber1 is greater than or equal to Trange1*Trate; when the result obtained by multiplying the value of Tpackt-Tstart and Trate and adding currentnumber1 is less than Trange1*Trate, update the result obtained by multiplying the value of Tpackt-Tstart and Trate and adding currentnumber1 to currentnumber1; when the value of Tpackt-Tstart-Trange1 is greater than or equal to Trange2 or Tpackt-Tstart- When the result of multiplying Trange1 by Trate and adding currentnumber2 is greater than or equal to Trange2*Trate, the value of Trange2*Trate is updated to currentnumber2. When the result of multiplying Tpackt-Tstart-Trange1 by Trate and adding currentnumber2 is less than Trange2*Trate, the result of multiplying Tpackt-Tstart-Trange2 by Trate and adding currentnumber2 is updated to currentnumber2. A message color marking module is used to mark the message color by comparing currentnumber1 and currentnumber2 with the message length (PacketLength).

[0011] Furthermore, the message color marking module performs color marking through the following steps: S91: Determine whether the value after subtracting PacketLength from currentnumber1 is greater than or equal to 0. If so, mark the message as green, otherwise proceed to step S92: S92: Determine whether the value after subtracting PacketLength from currentnumber2 is greater than or equal to 0. If so, mark the message as yellow, otherwise proceed to step S93; S93: Mark the message as red.

[0012] Further, in step S91, when the message is marked as green, currentnumber1 is updated to the value minus the message length; in step S92, when the message is marked as yellow, currentnumber2 is updated to the value minus the message length, and the value of currentnumber1 remains unchanged; in step S93, when the message is marked as red, the values of currentnumber1 and currentnumber2 remain unchanged.

[0013] Furthermore, in the message color marking module, after the message color is marked, the value of Tstart is updated to the value of Tpacket.

[0014] Furthermore, the time unit and Trate value of Trange1 and Trange2 are specified by the user, the initial values of currentnumber1 and currentnumber2 are set to 0, and support counting based on the actual length of the message or specifying that the message be counted based on a fixed length.

[0015] Compared with token bucket rate limiting, the present invention has similar logic, but is simpler in design and has finer calculation granularity, which can be calculated in nanoseconds. It also saves a lot of chip design costs, reduces chip area and tape-out costs, and is more reliable and stable in function. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments. It should be understood that the following drawings only illustrate certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other relevant drawings can be obtained based on these drawings without paying any creative work.

[0017] Figure 1 This is an example diagram of the principle of implementing single-speed three-color marking based on time in the present invention. DETAILED DESCRIPTION

[0018] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making any creative efforts shall fall within the scope of protection of the present invention.

[0019] The key to this invention is that it utilizes the natural increment of time to replace the traditional token addition method for message color coding, facilitating subsequent processing. The overall design is reliable and stable, with minimal resource overhead and low R&D costs. Furthermore, it can be used in combination. This invention can also implement all the functions of a token bucket in message processing.

[0020] This invention innovatively utilizes the natural growth property of time, replacing the traditional rate limiting method of adding tokens to the token bucket. It is more efficient and lightweight.

[0021] See also Figure 1 The present invention is specifically implemented as configuring two time ranges Trange1 and Trange2, with units of seconds or milliseconds, which can also be specified by the user. This value is equivalent to the depth of the token bucket. The time ratio is configured as Trate, which represents how many bytes or bits per nanosecond. The user can also specify other time units. This value is equivalent to the rate of adding tokens to the token bucket. When the color marking function is enabled, the recording time is Tstart. When the message enters the chip, the time Tpacket is recorded. Set currentnumber1 and currentnumber2 to record the number of bytes or bits of the message that can currently pass, which is equivalent to the current number of tokens in the token bucket. Generally, the initial value is configured as 0. It also supports counting with the actual length of the message, or specifying that the message is counted with a certain fixed length.

[0022] Enable color coding, set the acquisition time to Tstart, and record the time when the packet enters the chip as Tpacket. Take the smaller of Tpacket-Tstart and Trange1, and multiply it by Trate. Add the resulting value to currentnumber1 and compare it again with Trange1*Trate. Take the smaller value and update it into currentnumber1.

[0023] If Tpackt - Tstart >= Trange1, take the smaller of Tpackt - Tstart - Trange1 and Trage2 and multiply it by Trate. Add the resulting value to currentnumber2 and compare it again with Trange2 * Trate. Take the smaller value and update the result into currentnumber2.

[0024] If the value of currentnumber1 minus the message length is greater than or equal to 0, the message is marked green and currentnumber1 is updated to the value minus the message length.

[0025] If the value of currentnumber1 minus the message length is less than 0, and the value of currentnumber2 minus the message length is greater than or equal to 0, the message is marked yellow. Currentnumber2 is updated to the value after subtracting the message length, and the value of currentnumber1 remains unchanged.

[0026] If the value of currentnumber1 minus the message length is less than 0, and the value of currentnumber2 minus the message length is also less than 0, the message is marked red. The values of currentnumber1 and currentnumber2 remain unchanged.

[0027] Finally, the value of Tstart is updated to the value of Tpacket, and the subsequent processing flow is processed according to the color of the message. Since the chip design is all pipelined, the value of Tstart can be updated to the value of Tpacket just after Tpacket is recorded.

[0028] In an embodiment of the present invention, a method for implementing single-rate three-color marking for traffic regulation based on time is provided, which includes the following steps: S1: enabling the color marking function, configuring two time ranges Trange1 and Trange2, configuring the time ratio Trate, initializing and setting two currently allowed message passing values currentnumber1 and currentnumber2, and obtaining the time as Tstart, wherein the values of Trange1 and Trange2 are equal to the depths of the two token buckets, the value of Trate is equal to the rate at which tokens are added to the token buckets, and the values of currentnumber1 and currentnumber2 are equal to the current number of tokens in the two token buckets; S2: when a message enters the chip, recording the time at this time as Tpacket, and judging whether the value of Tpackt-Tstart is greater than or equal to Trange1, if so, proceeding to step S4, otherwise proceeding to step S3; S3: multiplying the value of Tpackt-Tstart by Trate and adding the result obtained by currentnumber1 with Trange1*Trate, if the former is greater than or equal to the latter, proceeding to step S4, otherwise proceeding to step S5; S4: updating the value of Trange1*Trate to currentn umber1, then determine whether the value of Tpackt-Tstart-Trange1 is greater than or equal to Trange2. If so, proceed to step S7, otherwise proceed to step S6; S5: update the result of multiplying the value of Tpackt-Tstart by Trate and adding currentnumber1 to currentnumber1, and then proceed to step S9; S6: compare the result of multiplying the value of Tpackt-Tstart-Trange1 by Trate and adding currentnumber2 with Trange2*Trate. If the former is greater than or equal to the latter, proceed to step S7, otherwise proceed to step S8; S7: update the value of Trange2*Trate to currentnumber2, and then proceed to step S9; S8: update the result of multiplying the value of Tpackt-Tstart-Trange2 by Trate and adding currentnumber2 to currentnumber2, and then proceed to step S9; S9: mark the message color by comparing currentnumber1 and currentnumber2 with the message length PacketLength.

[0029] Further, step S9 specifically includes: S91: determine whether the value after subtracting PacketLength from currentnumber1 is greater than 0, if so, mark the message as green, otherwise proceed to step S92: S92: determine whether the value after subtracting PacketLength from currentnumber2 is greater than 0, if so, mark the message as yellow, otherwise proceed to step S93; S93: mark the message as red.

[0030] Further, in step S91, when the message is marked as green, currentnumber1 is updated to the value minus the message length; in step S92, when the message is marked as yellow, currentnumber2 is updated to the value minus the message length, and the value of currentnumber1 remains unchanged; in step S93, when the message is marked as red, the values of currentnumber1 and currentnumber2 remain unchanged.

[0031] Furthermore, in step S9, after marking the color of the message, the value of Tstart is updated to the value of Tpacket.

[0032] Furthermore, the time unit and Trate value of Trange1 and Trange2 are specified by the user, the initial values of currentnumber1 and currentnumber2 are set to 0, and support counting based on the actual length of the message or specifying that the message be counted based on a fixed length.

[0033] In another embodiment of the present invention, a device for implementing single-speed three-color marking for flow regulation based on time is also provided, which includes the following modules: a color marking function enabling module: used to enable the color marking function, configure two time ranges Trange1 and Trange2, configure the time ratio Trate, initialize and set two currently allowed message passing values currentnumber1 and currentnumber2, and obtain the time as Tstart, wherein the values of Trange1 and Trange2 are equal to the depth of the token bucket, the value of Trate is equal to the rate at which the token bucket adds tokens, and the values of currentnumber1 and currentnumber2 are equal to the current number of tokens in the token bucket; a message entry processing module: used to record the time as Tpack when a message enters the chip et, and judge whether the value of Tpackt-Tstart is greater than or equal to Trange1; a comparison module: for, when the value of Tpackt-Tstart is less than Trange1, comparing the result obtained by multiplying the value of Tpackt-Tstart by Trate and adding currentnumber1 with Trange1*Trate, and for comparing the value of Tpackt-Tstart-Trange1 with Trange2, and when the value of Tpackt-Tstart-Trange1 is less than Trange2, further comparing the result obtained by multiplying the value of Tpackt-Tstart-Trange1 by Trate and adding currentnumber2 with Trange2*Trate;Update module: used to update the value of Trange1*Trate to currentnumber1 when the value of Tpackt-Tstart is greater than or equal to Trange1 or the result obtained by multiplying the value of Tpackt-Tstart and Trate and adding currentnumber1 is greater than or equal to Trange1*Trate; when the result obtained by multiplying the value of Tpackt-Tstart and Trate and adding currentnumber1 is less than Trange1*Trate, update the result obtained by multiplying the value of Tpackt-Tstart and Trate and adding currentnumber1 to currentnumber1; when the value of Tpackt-Tstart-Trange1 is greater than or equal to Trange2 or Tpackt-Tstart- When the result of multiplying Trange1 by Trate and adding currentnumber2 is greater than or equal to Trange2*Trate, the value of Trange2*Trate is updated to currentnumber2. When the result of multiplying Tpackt-Tstart-Trange1 by Trate and adding currentnumber2 is less than Trange2*Trate, the result of multiplying Tpackt-Tstart-Trange2 by Trate and adding currentnumber2 is updated to currentnumber2. A message color marking module is used to mark the message color by comparing currentnumber1 and currentnumber2 with the message length (PacketLength).

[0034] Furthermore, the message color marking module performs color marking through the following steps: S91: Determine whether the value after subtracting PacketLength from currentnumber1 is greater than 0. If so, mark the message as green, otherwise proceed to step S92: S92: Determine whether the value after subtracting PacketLength from currentnumber2 is greater than 0. If so, mark the message as yellow, otherwise proceed to step S93; S93: Mark the message as red.

[0035] Further, in step S91, when the message is marked as green, currentnumber1 is updated to the value minus the message length; in step S92, when the message is marked as yellow, currentnumber2 is updated to the value minus the message length, and the value of currentnumber1 remains unchanged; in step S93, when the message is marked as red, the values of currentnumber1 and currentnumber2 remain unchanged.

[0036] Furthermore, in the message color marking module, after the message color is marked, the value of Tstart is updated to the value of Tpacket.

[0037] Furthermore, the time unit and Trate value of Trange1 and Trange2 are specified by the user, the initial values of currentnumber1 and currentnumber2 are set to 0, and support counting based on the actual length of the message or specifying that the message be counted based on a fixed length.

[0038] The above description is only a preferred specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any technician familiar with the technical field, within the technical scope disclosed by the present invention, who makes equivalent replacements or changes based on the technical solution and inventive concept of the present invention, should be covered by the scope of protection of the present invention.

Claims

1. A method for realizing flow regulation single-speed three-color marking based on time, characterized in that: The steps include: S1: Enables color marking, configures two time ranges, Trange1 and Trange2, and the time ratio, Trate. Initializes two values for the number of packets allowed to pass, currentnumber1 and currentnumber2, and sets the time to Tstart. Trange1 and Trange2 are equal to the depths of the two token buckets, Trate is equal to the rate at which tokens are added to the token buckets, and currentnumber1 and currentnumber2 are equal to the current number of tokens in the two token buckets. S2: When a message enters the chip, the time at this time is recorded as Tpacket, and the value of Tpacket-Tstart is determined to be greater than or equal to Trange1. If so, the process proceeds to step S4; otherwise, the process proceeds to step S3. S3: Multiply the value of Tpackt-Tstart by Trate and add the result obtained by adding currentnumber1 to compare with Trange1*Trate. If the former is greater than or equal to the latter, proceed to step S4; otherwise, proceed to step S5. S4: Update the value of Trange1*Trate to currentnumber1, and then determine whether the value of Tpackt-Tstart-Trange1 is greater than or equal to Trange2. If so, proceed to step S7; otherwise, proceed to step S6; S5: Multiply the value of Tpackt-Tstart by Trate and add the result obtained by adding currentnumber1 to update currentnumber1, and then proceed to step S9; S6: Multiply the value of Tpackt-Tstart-Trange1 by Trate and add the result obtained by adding currentnumber2 to compare with Trange2*Trate. If the former is greater than or equal to the latter, proceed to step S7; otherwise, proceed to step S8; S7: Update the value of Trange2*Trate to currentnumber2, and then proceed to step S9; S8: Multiply the value of Tpackt-Tstart-Trange2 by Trate and add the result obtained by adding currentnumber2 to update currentnumber2, and then proceed to step S9; S9: Mark the packet color by comparing currentnumber1 and currentnumber2 with the packet length PacketLength.

2. The method according to claim 1, characterized in that Step S9 specifically includes: S91: Determine whether the value after subtracting PacketLength from currentnumber1 is greater than or equal to 0. If so, mark the message green. Otherwise, proceed to step S92: S92: Determine whether the value obtained by subtracting PacketLength from currentnumber2 is greater than or equal to 0. If so, mark the message in yellow; otherwise, proceed to step S93; S93: Mark the message in red.

3. The method according to claim 2, characterized in that In step S91, when the message is marked green, currentnumber1 is updated to the value after subtracting the message length; In step S92, when the message is marked as yellow, currentnumber2 is updated to the value after subtracting the message length, and the value of currentnumber1 remains unchanged; In step S93, when the message is marked in red, the values of currentnumber1 and currentnumber2 remain unchanged.

4. The method according to claim 1, wherein In step S9, after marking the color of the message, the value of Tstart is updated to the value of Tpacket.

5. The method according to claim 1, characterized in that The time unit and Trate value of Trange1 and Trange2 are specified by the user. The initial values of currentnumber1 and currentnumber2 are set to 0. Counting can be done based on the actual length of packets or by specifying a fixed length for packets.

6. A device for achieving flow regulation, single-speed, three-color marking based on time, characterized in that: Includes the following modules: The color marking function enable module is used to enable the color marking function, configure two time ranges Trange1 and Trange2, configure the time ratio Trate, initialize and set two currently allowed message passing values currentnumber1 and currentnumber2, and obtain the time as Tstart. The values of Trange1 and Trange2 are equal to the depths of the two token buckets, the value of Trate is equal to the rate at which tokens are added to the token bucket, and the values of currentnumber1 and currentnumber2 are equal to the current number of tokens in the two token buckets. Message entry processing module: When a message enters the chip, it records the time as Tpacket and determines whether the value of Tpackt-Tstart is greater than or equal to Trange1; Comparison module: used for, when the value of Tpackt-Tstart is less than Trange1, comparing the result obtained by multiplying the value of Tpackt-Tstart by Trate and adding currentnumber1 with Trange1*Trate, and for comparing the value of Tpackt-Tstart-Trange1 with Trange2, and further comparing the result obtained by multiplying the value of Tpackt-Tstart-Trange1 by Trate and adding currentnumber2 with Trange2*Trate when the value of Tpackt-Tstart-Trange1 is less than Trange2; Update module: used to update the value of Trange1*Trate to currentnumber1 when the value of Tpackt-Tstart is greater than or equal to Trange1 or the result obtained by multiplying the value of Tpackt-Tstart with Trate and adding currentnumber1 is greater than or equal to Trange1*Trate; when the result obtained by multiplying the value of Tpackt-Tstart with Trate and adding currentnumber1 is less than Trange1*Trate, update the result obtained by multiplying the value of Tpackt-Tstart with Trate and adding currentnumber1 to currentnumber1; when Tpackt-Tstart is greater than or equal to Trange1, update the value of Trange1*Trate ... When the value of t-Trange1 is greater than or equal to Trange2 or the result obtained by multiplying the value of Tpackt-Tstart-Trange1 by Trate and adding currentnumber2 is greater than or equal to Trange2*Trate, the value of Trange2*Trate is updated to currentnumber2, and when the result obtained by multiplying the value of Tpackt-Tstart-Trange1 by Trate and adding currentnumber2 is less than Trange2*Trate, the result obtained by multiplying the value of Tpackt-Tstart-Trange2 by Trate and adding currentnumber2 is updated to currentnumber2; Packet color marking module: used to mark the packet color by comparing currentnumber1 and currentnumber2 with the packet length PacketLength.

7. The device according to claim 6, characterized in that The message color marking module performs color marking through the following steps: S91: Determine whether the value after subtracting PacketLength from currentnumber1 is greater than or equal to 0. If so, mark the message green. Otherwise, proceed to step S92: S92: Determine whether the value obtained by subtracting PacketLength from currentnumber2 is greater than or equal to 0. If so, mark the message in yellow; otherwise, proceed to step S93; S93: Mark the message in red.

8. The device according to claim 7, characterized in that In step S91, when the message is marked green, currentnumber1 is updated to the value after subtracting the message length; In step S92, when the message is marked as yellow, currentnumber2 is updated to the value after subtracting the message length, and the value of currentnumber1 remains unchanged; In step S93, when the message is marked in red, the values of currentnumber1 and currentnumber2 remain unchanged.

9. The device according to claim 6, characterized in that In the message color marking module, after marking the message color, the value of Tstart is updated to the value of Tpacket.

10. The device according to claim 6, characterized in that The time unit and Trate value of Trange1 and Trange2 are specified by the user. The initial values of currentnumber1 and currentnumber2 are set to 0. Counting can be done based on the actual length of packets or by specifying a fixed length for packets.

Citation Information

Patent Citations

  • Timestamp-updating-token-bucket-based traffic policing method and system

    CN102413042A

  • Timestamp metering and rollover protection in a network device

    US20060187839A1

  • Apparatus and method for metering and marking data in a communication system

    US7664028B1