A metering method and device for a TSN network, a switch and a chip
Patent Information
- Application Number
- CN202310464613.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-26
- Publication Date
- 2026-09-18
- Estimated Expiration
- 2043-04-26
AI Technical Summary
现有技术中都定时更新令牌桶的深度,定时周期太长时无法及时更新,定时周期太小又导致计算量增大,如何低成本且满足多种场景实现这个功能的要求是TSN网络需要解决的问题
Smart Images

Figure CN116455829B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of TCP / IP Internet and communications, and in particular to a metering method, metering device, switch and chip for a TSN network. Background Technology
[0002] Figure 1 The 802.1QCI protocol (Per-Stream Filtering and Policing) is illustrated, including determining stream filters for each TSN stream, gating using stream gates, and metering using flow meters. The embodiments of this invention are primarily applied to metering functions.
[0003] Metering functions use Meter IDs as an index to look up metering tables. The range of Meter IDs is (1 to Q), corresponding to metering tables 1 to Q. Each metering table contains the depth of each token bucket. When performing metering on a message, the message is metered according to the depth of the token bucket and the message length, and then output from the corresponding token bucket or discarded.
[0004] 802.1QCI lists the metering functionality but not the specific implementation method. Existing technologies update the token bucket depth periodically; however, too long a period prevents timely updates, while too short a period increases computational complexity. How to implement this functionality cost-effectively and in a variety of scenarios is a problem that TSN networks need to solve. Summary of the Invention
[0005] In view of this, the present invention provides a metering method, metering device, switch, and chip for a TSN network. During each traversal bucket filling time, when the time difference between the previous bucket filling time and the current time of a token bucket of a first metering ID is greater than the corresponding traversal bucket filling interval, the depth and bucket filling time of that token bucket of the first metering ID are updated according to the bandwidth configuration parameters of the first metering ID, where the first metering ID is the ID of any metering table. During each packet processing time, the depth and bucket filling time of each token bucket of the second metering ID are updated according to the bandwidth configuration parameters of the second metering ID and the current time. The traversal bucket filling time and packet processing time alternate and are periodically distributed, where the second metering ID is the ID of any metering table corresponding to an arriving packet. During each packet processing time, the packet is also metered according to the depth of each token bucket of the second metering ID. The technical solution of the present invention implements the metering function of the 802.1QCI protocol and performs timely bucket filling during packet processing, improving packet throughput and the real-time performance of the TSN network.
[0006] In a first aspect, embodiments of the present invention provide a metering method for a TSN network, comprising:
[0007] During each bucket filling time, when the time difference between the last bucket filling time and the current time of a token bucket of the first metering ID is greater than the corresponding bucket filling interval, the depth and filling time of that token bucket of the first metering ID are updated according to the bandwidth configuration parameters of the first metering ID, where the first metering ID is the ID of any metering table; during each message processing time, the depth and filling time of each token bucket of the second metering ID are updated according to the bandwidth configuration parameters of the second metering ID and the current time, with the bucket filling time and message processing time alternating and periodically distributed, where the second metering ID is the ID of any metering table corresponding to an arriving message; during each message processing time, the message is also metered according to the depth of each token bucket of the second metering ID.
[0008] As shown above, the 802.1QCI protocol bucket filling function is implemented during bucket traversal, and bucket filling is also performed in a timely manner during message processing, which improves the message throughput and the real-time performance of the TSN network.
[0009] In one possible implementation of the first aspect, the bandwidth configuration parameters of each meter ID include the number of bytes filled by each token bucket of the meter ID and the traversal filling interval. The step of updating the depth and filling time of the token bucket of the first meter ID according to the bandwidth configuration parameters of the first meter ID includes: superimposing the number of bytes filled by the token bucket of the first meter ID on the depth of the token bucket of the first meter ID as the updated depth of the token bucket of the first meter ID, wherein the number of bytes filled by the token bucket is the number of bytes converted from the product of the committed information rate of the token bucket of the first meter ID and its traversal filling interval; and superimposing the traversal filling interval on the last filling time of the token bucket of the first meter ID as the filling time of the token bucket of the first meter ID.
[0010] As described above, by including the number of bytes to fill each token bucket in the bandwidth configuration parameters of each meter ID, the depth and filling time of each token bucket are updated by using the fixed number of bytes to fill each token bucket and the filling interval during the filling process. This reduces the computational load of filling the bucket and allows for filling more meter IDs during the filling process, thereby improving the packet throughput and the real-time performance of the TSN network.
[0011] In one possible implementation of the first aspect, the bandwidth configuration parameters of each meter ID further include at least the packet filling reference for each of its token buckets. The step of updating the depth and filling time of each token bucket of the second meter ID according to the bandwidth configuration parameters of the second meter ID and the current time includes: updating the depth and filling time of each token bucket of the second meter ID using an adder based on the packet filling reference of each token bucket of the second meter ID and the time difference between its last filling time and the current time. The packet filling reference for each token bucket of the second meter ID is the number of bytes converted from the product of its committed information rate and the packet filling reference duration. The packet filling reference duration is set according to the sum of a traversal filling time and a packet processing time and is a power of 2.
[0012] As described above, by including the packet filling baseline of each token bucket in the bandwidth configuration parameters of each metering ID, an adder is used to calculate the number of bytes to be filled in each token bucket during packet filling, thereby reducing the computational load of packet filling and filling more metering IDs during packet filling, further improving the packet throughput and the real-time performance of the TSN network.
[0013] In one possible implementation of the first aspect, based on the message filling reference of the token bucket q of the second metering ID and the time difference between its last filling time and the current time, an adder is used to update the depth and filling time of the token bucket q of the second metering ID, where the token bucket q is any token bucket of the second metering ID. This includes: obtaining the number of bytes filled by the token bucket q of the second metering ID using an adder based on the message filling reference of the token bucket q of the second metering ID and the time difference, and adding the number of bytes filled to the depth of the token bucket q of the second metering ID as the depth of the token bucket q of the second metering ID; obtaining the message filling duration of the token bucket q of the second metering ID based on the time difference and the message filling reference, and adding the message filling duration to the last filling time of the token bucket q of the second metering ID as the filling time of the token bucket of the second metering ID, wherein the number of bytes converted from the product of the time difference minus the message filling duration and the committed information rate of the token bucket q of the second metering ID is less than 1.
[0014] Therefore, by using the above adder for packet bucketing, the efficiency of packet bucketing is improved, more time is used for packet metering, and the packet throughput and real-time performance of the TSN network are further improved.
[0015] In one possible implementation of the first aspect, it further includes: setting a first metering function table and a second metering function table, wherein the first metering function table configures the bandwidth configuration parameters of each metering ID through software, and the second metering function table includes the token bucket depth and latest bucket filling time of each metering ID updated through hardware.
[0016] As described above, by updating the token bucket depth and latest bucket filling time for each meter ID through hardware updates, bucket filling efficiency is improved.
[0017] In one possible implementation of the first aspect, the traversal bucket filling interval of each token bucket for each meter ID is matched with any integer multiple of the sum of a traversal bucket filling time and a message processing time.
[0018] Therefore, by setting the traversal bucket filling interval to match an integer multiple of the sum of a traversal bucket filling time and a message processing time, the traversal bucket filling and message bucket filling can be distinguished.
[0019] Secondly, embodiments of the present invention provide a metering device for a TSN network, comprising: a traversal bucket filling module, configured to update the depth and filling time of the token bucket of a first metering ID according to the bandwidth configuration parameters of the first metering ID when the time difference between the last filling time and the current time of a token bucket of a first metering ID is greater than the corresponding traversal bucket filling interval during each traversal bucket filling time; the first metering ID being the ID of any metering table; a packet bucket filling module, configured to update the depth and filling time of each token bucket of a second metering ID according to the bandwidth configuration parameters of a second metering ID and the current time during each packet processing time; the traversal bucket filling time and the packet processing time alternating and periodically distributed; the second metering ID being the ID of any metering table corresponding to an arriving packet; and a packet metering module, configured to further meter the packet according to the depth of each token bucket of the second metering ID during each packet processing time.
[0020] As shown above, the 802.1QCI protocol bucket filling function is implemented during bucket traversal, and bucket filling is also performed in a timely manner during message processing, which improves the message throughput and the real-time performance of the TSN network.
[0021] In one possible implementation of the second aspect, the bandwidth configuration parameters for each meter ID include the number of bytes filled by each token bucket of the meter ID and the traversal filling interval. The traversal filling module is specifically used to include: superimposing the number of bytes filled by the token bucket of the first meter ID on the token bucket depth of the first meter ID as the update depth of the token bucket of the first meter ID, wherein the number of bytes filled by the token bucket is the number of bytes converted from the product of the committed information rate of the token bucket of the first meter ID and its traversal filling interval; and superimposing the traversal filling interval on the last filling time of the token bucket of the first meter ID as the filling time of the token bucket of the first meter ID.
[0022] As described above, by including the number of bytes to fill each token bucket in the bandwidth configuration parameters of each meter ID, the depth and filling time of each token bucket are updated by using the fixed number of bytes to fill each token bucket and the filling interval during the filling process. This reduces the computational load of filling the bucket and allows for filling more meter IDs during the filling process, thereby improving the packet throughput and the real-time performance of the TSN network.
[0023] In one possible implementation of the second aspect, the bandwidth configuration parameters of each meter ID further include at least the message filling reference for each of its token buckets. The message filling module is specifically used to include: updating the depth and filling time of each token bucket of the second meter ID using an adder based on the message filling reference of each token bucket of the second meter ID and the time difference between its last filling time and the current time. The message filling reference for each token bucket of the second meter ID is the number of bytes converted from the product of its committed information rate and the message filling reference duration. The message filling reference duration is set according to the sum of a traversal filling time and a message processing time and is a power of 2.
[0024] As described above, by including the packet filling baseline of each token bucket in the bandwidth configuration parameters of each metering ID, an adder is used to calculate the number of bytes to be filled in each token bucket during packet filling, thereby reducing the computational load of packet filling and filling more metering IDs during packet filling, further improving the packet throughput and the real-time performance of the TSN network.
[0025] In one possible implementation of the second aspect, the message filling module specifically updates the depth and filling time of the token bucket q of the second metering ID using an adder, based on the message filling reference of the token bucket q of the second metering ID and the time difference between its last filling time and the current time. The token bucket q can be any token bucket of the second metering ID. This includes: obtaining the number of message filling bytes of the token bucket q of the second metering ID using an adder based on the message filling reference of the token bucket q of the second metering ID and the time difference, and adding the number of message filling bytes to the depth of the token bucket q of the second metering ID as the depth of the token bucket q of the second metering ID; obtaining the message filling duration of the token bucket q of the second metering ID based on the time difference and the message filling reference, and adding the message filling duration to the last filling time of the token bucket q of the second metering ID as the filling time of the token bucket of the second metering ID, wherein the number of bytes converted by the product of the time difference minus the message filling duration and the committed information rate of the token bucket q of the second metering ID is less than 1.
[0026] Therefore, by using the above adder for packet bucketing, the efficiency of packet bucketing is improved, more time is used for packet metering, and the packet throughput and real-time performance of the TSN network are further improved.
[0027] In one possible implementation of the second aspect, it further includes: a meter setting module for setting a first metering function table and a second metering function table, wherein the first metering function table configures the bandwidth configuration parameters of each metering ID through software, and the second metering function table includes the token bucket depth and latest bucket filling time of each metering ID updated through hardware.
[0028] As described above, by updating the token bucket depth and latest bucket filling time for each meter ID through hardware updates, bucket filling efficiency is improved.
[0029] In one possible implementation of the second aspect, the traversal bucket filling interval for each token bucket of each meter ID is matched with any integer multiple of the sum of a traversal bucket filling time and a message processing time.
[0030] Therefore, by setting the traversal bucket filling interval to match an integer multiple of the sum of a traversal bucket filling time and a message processing time, the traversal bucket filling and message bucket filling can be distinguished.
[0031] Thirdly, embodiments of the present invention provide a chip for a TSN network, including the apparatus described in any embodiment of the second aspect.
[0032] Fourthly, embodiments of the present invention provide a switch for a TSN network, including the apparatus described in any embodiment of the second aspect.
[0033] Fifthly, embodiments of the present invention provide a computing device, including,
[0034] bus;
[0035] A communication interface, which is connected to the bus;
[0036] At least one processor connected to the bus; and
[0037] At least one memory is connected to the bus and stores program instructions that, when executed by the at least one processor, cause the at least one processor to perform any of the embodiments of the second aspect of the invention.
[0038] In a sixth aspect, embodiments of the present invention provide a computer-readable storage medium having program instructions stored thereon, which, when executed by a computer, cause the computer to perform any of the embodiments described in the second aspect of the application. Attached Figure Description
[0039] Figure 1 This is a schematic diagram of the metering function structure of the 802.1QCI protocol in a TSN network.
[0040] Figure 2 This is a flowchart illustrating a first embodiment of a metering method for a TSN network according to the present invention.
[0041] Figure 3 This is a schematic diagram of the working timing of a metering method for a TSN network according to an embodiment of the present invention;
[0042] Figure 4 This is a schematic flowchart of a second embodiment of a metering device for a TSN network according to the present invention;
[0043] Figure 5A This is a schematic diagram of the structure of the first and second metering function tables in a second embodiment of the metering method for a TSN network according to the present invention.
[0044] Figure 5B This is a schematic diagram of the bucket filling process in a second embodiment of the metering method for a TSN network according to the present invention.
[0045] Figure 5C This is a schematic diagram of the message bucketing process in a second embodiment of the metering method for a TSN network according to the present invention.
[0046] Figure 5D This is a schematic diagram of the message metering process in Embodiment 2 of the metering method for a TSN network according to the present invention;
[0047] Figure 6 This is a schematic diagram of the structure of a metering device for a TSN network according to a first embodiment of the present invention;
[0048] Figure 7 This is a schematic diagram of a second embodiment of a metering device for a TSN network according to the present invention;
[0049] Figure 8 This is a schematic diagram of the structure of a computing device according to various embodiments of the present invention. Detailed Implementation
[0050] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0051] In the following description, the terms “first, second, third, etc.” or module A, module B, module C, etc. are used only to distinguish similar objects or different embodiments and do not represent a specific ordering of objects. It is understood that a specific order or sequence may be interchanged where permitted so that the embodiments of the invention described herein can be implemented in an order other than that illustrated or described herein.
[0052] In the following description, the labels of the steps, such as S110, S120, etc., do not necessarily mean that the steps will be executed in this way. The order of the steps can be interchanged or executed simultaneously if permitted.
[0053] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein is for the purpose of describing embodiments of the invention only and is not intended to limit the scope of the invention.
[0054] This invention provides a metering method, metering device, switch, and chip for a TSN network. During each bucket filling cycle, when the time difference between the previous bucket filling time and the current time of a token bucket for a first metering ID is greater than the corresponding bucket filling interval, the depth and filling time of that token bucket for that first metering ID are updated according to the bandwidth configuration parameters of that first metering ID. The first metering ID is the ID of any metering table. During each packet processing cycle, the depth and filling time of each token bucket for a second metering ID are updated according to the bandwidth configuration parameters of that second metering ID and the current time. The bucket filling cycle and packet processing cycles alternate and are periodically distributed. The second metering ID is the ID of any metering table corresponding to an arriving packet. During each packet processing cycle, the packets are also metered according to the depth of each token bucket of the second metering ID. This invention implements the metering function of the 802.1QCI protocol and performs timely bucket filling during packet processing, improving packet throughput and the real-time performance of the TSN network.
[0055] The following is a brief introduction to the metering function table used in this invention.
[0056] Each entry in the metering function table corresponds to a metering table, represented by a metering ID. Metering of each flow in the TSN network is implemented by its corresponding metering table. Each entry in the metering function table includes the bandwidth configuration parameters of its corresponding metering table, the depth of each token bucket in its corresponding metering table, and the update time.
[0057] The following describes various embodiments of a metering method for a TSN network according to the present invention.
[0058] In an embodiment of a metering method for a TSN network, during each bucket filling time, when the time difference between the last bucket filling time and the current time of a token bucket of a first metering ID is greater than the corresponding bucket filling interval, the depth and filling time of that token bucket of the first metering ID are updated according to the bandwidth configuration parameters of the first metering ID, where the first metering ID is the ID of any metering table; during each packet processing time, the depth and filling time of each token bucket of the second metering ID are updated according to the bandwidth configuration parameters of the second metering ID and the current time, with the bucket filling time and packet processing time alternating and periodically distributed, where the second metering ID is the ID of any metering table corresponding to an arriving packet; during each packet processing time, the packet is also metered according to the depth of each token bucket of the second metering ID.
[0059] Figure 2 The flowchart of a metering method for a TSN network is shown in Embodiment 1, including steps S110 to S130.
[0060] S110: During each traversal bucket filling time, when the time difference between the last bucket filling time and the current time of a token bucket of the first meter ID is greater than the corresponding traversal bucket filling interval, update the depth and bucket filling time of the token bucket of the first meter ID according to the bandwidth configuration parameters of the first meter ID.
[0061] Wherein, the first meter ID is the ID of any meter. In some embodiments, the token bucket of a meter includes a green bucket and a yellow bucket. During each bucket filling time, the depth and filling time of the green and yellow buckets are updated respectively.
[0062] In this context, the traversal filling interval for each token bucket of each meter can be equal or unequal, but it must match an integer multiple of the metering period of the TSN network. Here, "matched" means approximately equal to one metering period, which includes one traversal filling time and one packet processing time. In some embodiments, the bandwidth configuration parameters for each meter ID also include at least the traversal filling interval for each of its token buckets.
[0063] In some real-time examples, the bandwidth configuration parameters for each meter ID include the number of bytes filled per token bucket for that meter ID and the filling interval.
[0064] In some real-time examples, updating the depth and filling time of the token bucket of the first meter ID according to the bandwidth configuration parameters of the first meter ID includes: adding the number of bytes filled during the traversal of the token bucket of the first meter ID to the depth of the token bucket of the first meter ID, wherein the number of bytes filled during the traversal is the number of bytes converted from the product of the committed information rate of the token bucket of the first meter ID and its traversal filling interval; and adding the traversal filling interval to the previous filling time of the token bucket of the first meter ID as the filling time of the token bucket of the first meter ID.
[0065] In some real-time examples, the bandwidth configuration parameters for each meter ID also include the committed rate (CIR of the green bucket and EIR of the yellow bucket) of that meter ID. Based on the committed rate of the corresponding token bucket in the bandwidth configuration parameters of the first meter ID and the time difference between the current time and the last filling time of the corresponding token bucket, the number of bytes filled in the corresponding token bucket of the first meter ID is obtained, and the depth of the corresponding token bucket of the first meter ID is updated accordingly, with the current time as the filling time of each token bucket of the first meter ID.
[0066] S120: During each message processing time, based on the bandwidth configuration parameters of the second metering ID and the current time, update the depth and filling time of each token bucket of the second metering ID.
[0067] The second meter ID is the ID of the meter corresponding to any arriving message. In some embodiments, a meter's token bucket includes a green bucket and a yellow bucket. During each message processing time, the depth and filling time of the green and yellow buckets are updated respectively.
[0068] In some embodiments, the bandwidth configuration parameters for each meter ID further include at least the packet filling reference for each of its token buckets. Based on the packet filling reference for each token bucket of the second meter ID and the time difference between its last filling time and the current time, an adder is used to update the depth and filling time of each token bucket of the second meter ID. The packet filling reference for each token bucket of the second meter ID is the number of bytes converted from the product of its committed information rate and the packet filling reference duration. The packet filling reference duration is set based on the sum of a traversal filling time and a packet processing time and is a power of 2. For example, the packet filling reference duration is a power of 2 that is closest to the sum of a traversal filling time and a packet processing time.
[0069] In some embodiments, based on the message filling reference of the token bucket q of the second metering ID and the time difference between its last filling time and the current time, an adder is used to update the depth and filling time of the token bucket q of the second metering ID, where the token bucket q is any token bucket of the second metering ID. This includes: obtaining the number of message filling bytes of the token bucket q of the second metering ID using an adder based on the message filling reference of the token bucket q of the second metering ID and the time difference, and adding the number of message filling bytes to the depth of the token bucket q of the second metering ID as the depth of the token bucket q of the second metering ID; obtaining the message filling duration of the token bucket q of the second metering ID based on the time difference and the message filling reference, and adding the message filling duration to the last filling time of the token bucket q of the second metering ID as the filling time of the token bucket of the second metering ID, wherein the number of bytes converted by the product of the time difference minus the message filling duration and the committed information rate of the token bucket q of the second metering ID is less than 1.
[0070] In some real-time examples, the bandwidth configuration parameters for each meter ID include the committed rate (CIR of the green bucket and EIR of the yellow bucket) of each token bucket of that meter ID. Based on the committed rate of the corresponding token bucket in the bandwidth configuration parameters of the second meter ID and the time difference between the current time and the last filling time of the corresponding token bucket, the number of bytes filled in the corresponding token bucket of the second meter ID is obtained, and the depth of the corresponding token bucket of the second meter ID is updated accordingly, with the current time as the filling time of each token bucket of the second meter ID.
[0071] S130: During each message processing time, the message is metered according to the message length and the token bucket depth corresponding to the second metering ID.
[0072] Specifically, based on the comparison between the message length and the token bucket depths of the second meter ID, when the message is less than the corresponding token bucket depth, the message passes through the corresponding token bucket depth, and the message transmission length is subtracted from the corresponding token bucket depth.
[0073] In some embodiments, the token bucket of the corresponding color is selected according to the color parameter in the arriving message to measure the first message. If the green bucket is used for measurement first, and the measurement fails, the yellow bucket is used for measurement. If the measurement fails, the message is discarded.
[0074] The bucket filling time and message processing time alternate and are periodically distributed.
[0075] Figure 3 The working timing of this embodiment is shown, which includes a first number of clock cycles SYS_CLK for each bucket filling time and a second number of clock cycles SYS_CLK for each message processing time, which together constitute the metering period SOC_CLK.
[0076] For example, Figure 3 The first and second numbers each contain one clock cycle SYS_CLK, and the metering cycle SOC_CLK contains two clock cycles SYS_CLK. The first and second numbers can also be other non-zero integers.
[0077] In summary, the first embodiment of the metering method for a TSN network performs bucket filling during the traversal bucket filling time and also fills each token bucket in the metering table corresponding to the message during message processing. This not only realizes the metering function of the 802.1QCI protocol, but also improves the message throughput and the real-time performance of the TSN network by filling the buckets in a timely manner during message processing.
[0078] The second embodiment of the metering method for a TSN network inherits all the methods of the first embodiment of the metering method for a TSN network and has all its advantages. In addition, it uses an adder to fill each token bucket of each meter during message bucketing, thereby reducing the amount of computation for bucketing, achieving low-cost, high-efficiency and timely bucketing, and further improving the real-time performance of the TSN network.
[0079] Figure 4 The flowchart of a second embodiment of a metering method for a TSN network is shown, including steps S210 to S240. Steps S220 to S240 are executed in hardware.
[0080] S210: Set the first metering function table and the second metering function table.
[0081] The first metering function table is located in RAM1. The bandwidth configuration parameters of each meter are configured by software. The bandwidth configuration parameters of each meter are generated according to the scheduling policy of the TSN network and remain unchanged after configuration. The method of generating bandwidth configuration parameters is not limited in this embodiment.
[0082] The second metering function table is located in RAM2 and includes the token bucket depth and latest bucket filling time of each metering table, which are updated via hardware.
[0083] The first and second measurement function tables have the same number of entries and the same entry index. The first RAM and the second RAM can be two different RAMs, or two regions of a single RAM.
[0084] Figure 5A The structure of the first and second metering function tables in this embodiment is shown.
[0085] For example, the depth of the first metering function table and the second metering function table is 2048, corresponding to 2048 metering IDs.
[0086] The token bucket includes green and yellow buckets. The first metering function table stores the bandwidth configuration parameters for the green and yellow buckets of each metering table, including:
[0087] The green bucket promises burst capacity CBS, and the maximum green bucket depth Bc is the green bucket promises burst capacity CBS.
[0088] The green bucket filling interval TimeC is matched with any integer multiple of the sum of the traversal period and the message processing time. In other words, it can be around any integer multiple of the sum of the traversal period and the message processing time. For example, when the sum of a traversal processing time and a message processing time is 8.192us, the green bucket filling interval TimeC can be any time greater than or equal to 8us. TimeC can be 8us, 16us, 24us, etc. However, when the base message filling time is 8.192us and ByteC2! = 0, 8us is recommended.
[0089] The number of bytes filled during the green bucket traversal (ByteC) is the number of bytes converted from the product of the green bucket committed information rate (CIR) and the green bucket traversal filling interval (TimeC).
[0090] The green bucket filling baseline ByteC2 is the number of bytes converted from the product of the Green Bucket Committed Information Rate (CIR) and the filling baseline duration. This filling baseline duration is set based on the sum of a traversal filling time and a message processing time, and is a power of 2. In some embodiments, this filling baseline duration is the power of 2 closest to the sum of the traversal filling time and the message processing time. For example, when the sum of the traversal period and the message processing time is 8.192 µs, the filling baseline duration is 8192 ns. The filling baseline duration and the time difference between the current time and the filling time of each token bucket have the same dimension; for example, both are in ns.
[0091] The Yellow Bucket promises a burst capacity of EBS, and the maximum Yellow Bucket depth Be is EBS;
[0092] The yellow bucket traversal filling interval TimeE is matched with any integer multiple of the sum of the traversal period and the message processing time. For example, when the sum of a traversal processing time and a message processing time is 8.192us, the yellow bucket traversal filling interval TimeE can be any time greater than or equal to 8us. TimeE can be 8us, 16us, 24us, etc. Among them, when the base message filling time is 8.192us and ByteE2! = 0, the recommended yellow bucket traversal filling interval TimeE is 8us.
[0093] The number of bytes filled during the yellow bucket traversal (ByteE) is the number of bytes converted from the product of the yellow bucket's committed information rate (EIR) and the yellow bucket traversal filling interval (TimeE).
[0094] The yellow bucket message filling baseline ByteE2 is the number of bytes converted from the product of the yellow bucket committed information rate EIR and the message filling baseline duration. The message filling baseline duration is the same as the message filling baseline duration in the green bucket message filling baseline ByteC2.
[0095] Can the remaining tokens in the green bucket be used to send CF tokens to the yellow bucket?
[0096] Color mode CM: When a message has color parameters and the meter is configured with color mode CM, the token bucket of the corresponding color is selected according to the color parameters in the arriving message to measure the first message.
[0097] The second metering function table stores the depth and filling time of the token bucket for each meter, including: green bucket depth Bc, yellow bucket depth Be, green bucket filling time StampC, and yellow bucket filling time StampE.
[0098] S220: During the traversal of the bucket filling time, when the time difference between the last bucket filling time and the current time of a token bucket of the first meter ID is greater than the corresponding traversal bucket filling interval, update the depth and bucket filling time of the token bucket of the first meter ID according to the traversal bucket filling interval and the number of bytes filled during the traversal.
[0099] The first measurement ID is the ID of any measurement meter.
[0100] Figure 5B The following is a flowchart of the bucket filling process of a second embodiment of the metering method for a TSN network, including steps S2210 to S2250.
[0101] The following example uses the current time as Stamp1 and the first meter ID to illustrate this process. The bandwidth configuration parameters, token bucket depth, and latest bucket filling time are all from the metering table corresponding to the first meter ID.
[0102] S2210: Determine whether the time difference between the current time Stamp1 and the latest filling time StampC of the green bucket is equal to or greater than the filling interval TimeC of the green bucket traversal.
[0103] If the condition is met, then step S2220 is executed; otherwise, step S2230 is executed.
[0104] S2220: Update the green bucket depth Bc and the filling time StampC based on the number of bytes filled during the green bucket traversal (ByteC) and the filling interval (TimeC).
[0105] In this method, the sum of the number of bytes filled by the green bucket (ByteC) and the green bucket depth (Bc) is used as the updated green bucket depth (Bc). In some embodiments, the updated green bucket depth (Bc) is also compared with the green bucket committed burst capacity (CBS), and the smaller value is taken as the final updated green bucket depth (Bc).
[0106] For example, use equation (1) to calculate the depth Bc of the green buckets during the traversal of the buckets.
[0107] Bc(Stamp1)=min{Bc(StampC)+ByteC, CBS}(1)
[0108] The sum of the original green bucket filling time StampC and the traversal filling interval TimeC is used as the updated green bucket filling time StampC.
[0109] S2230: Determine whether the time difference between the current time Stamp1 and the latest filling time StampE of the yellow bucket is equal to or greater than the filling interval TimeE of the yellow bucket traversal.
[0110] If the condition is met, then step S2240 is executed; otherwise, step S2250 is executed.
[0111] S2240: Update the depth Be and filling time StampE of the yellow bucket based on the number of bytes filled during the yellow bucket traversal (ByteE) and the filling interval (TimeE).
[0112] In this process, the sum of the number of bytes filled by the yellow bucket and the yellow bucket depth Be is used as the updated yellow bucket depth Be. In some embodiments, the number of bytes of green bucket remaining tokens allocated to the yellow bucket is added to the updated yellow bucket depth Be based on whether the green bucket remaining tokens can be used for CF. In some embodiments, the yellow bucket depth Be with the number of bytes of green bucket remaining tokens added to the yellow bucket is compared with the yellow bucket committed burst capacity EBS, and the smaller of the two is the final updated yellow bucket depth Be.
[0113] For example, use equation (2) to calculate the depth Be of the yellow bucket during the traversal and filling process, where Oc is the number of bytes of remaining tokens in the green bucket that can be used in the yellow bucket, and Bc(StampC) is the depth Bc of the green bucket before the update.
[0114]
[0115] The sum of the yellow-green bucket filling time StampE and the traversal filling interval TimeE is used as the updated yellow bucket filling time StampE.
[0116] S2250: Write the new Bc, StampC, Be, and StampE into the metering table corresponding to the first metering ID in the second metering function table of RAM2.
[0117] S230: During each message processing time, based on the message filling baseline of each token bucket of the second meter ID and the time difference between the current time and the last filling time of each token bucket of the second meter ID, update the depth and filling time of each token bucket of the second meter ID using an adder.
[0118] The second meter ID is the ID of the meter corresponding to any arriving message.
[0119] Figure 5C The following is a flowchart of message bucket filling in a second embodiment of a metering method for a TSN network, including steps S2310 to S2350.
[0120] The following example uses the current time as Stamp1 and the second metering ID to illustrate this process. The bandwidth configuration parameters, token bucket depth, and latest bucket filling time are all from the metering table corresponding to the second metering ID.
[0121] S2310: Based on the green bucket's message filling reference ByteC2 and the time difference between the current time Stamp1 and the green bucket filling time StampC, use an adder to obtain the number of green bucket message filling bytes, and add the number of green bucket message filling bytes to the original green bucket depth Bc to obtain the green bucket depth Bc.
[0122] This step includes the following steps.
[0123] (i) Obtain the binary code of the time difference between the current time Stamp1 and the green bucket filling time StampC (a n- 1a n-2 …a0)2, where n-1 is the highest bit of the binary code.
[0124] For example, the time difference between the current time Stamp 1 and the last time the green bucket was filled, Stamp C, is 4200ns, which in binary is (0001 0000 0110 1000)2, n-1 = 12.
[0125] (ii) When a i When the value is not equal to 0, shift the binary code of the green bucket's message filling reference ByteC2 to the right by mi bits to obtain b. i Let i = n-1, n-2, ..., 0, and set each b... i The sum of the values is used as the number of bytes filled in the green bucket, and the base duration for filling the second meter ID is 2 to the power of m.
[0126] For example, the ByteC2 of the green bucket message filling baseline is 329 bytes, which is 0x149, and in binary it is (00010100 1001)2. The message filling baseline duration of the second meter ID is 2 to the power of 13. The time difference between the current time Stamp 1 and the green bucket filling time StampC is (0001 0000 0110 1000)2 in binary. Shifting 0x149 one bit to the right gives 0xa5, shifting it seven bits to the right gives 0x2, shifting it eight bits to the right gives 0x1, and shifting it ten bits to the right gives 0x0. Adding 0xa5, 0x2, 0x1, and 0x0 gives 168, meaning the green bucket filling bytes are 168 bytes.
[0127] (iii) The number of packets filling the green bucket is added to the original green bucket depth Bc to obtain the green bucket depth Bc.
[0128] In some embodiments, the sum of the number of bytes filled in the green bucket and the original green bucket depth Bc, and the smaller of the green bucket's committed burst capacity CBS, are used as the final updated green bucket depth Bc.
[0129] For example, the green bucket depth Bc of the message bucket is calculated using equation (3), and TC2 is the message bucket base duration of the second meter ID.
[0130]
[0131] The number of bytes filled into the green bucket is obtained through the adder.
[0132] In some embodiments, it is further determined whether the time difference between the current time Stamp1 and the green bucket filling time StampC is greater than or equal to the minimum green bucket message filling time. Only when it is greater than or equal to the minimum green bucket message filling time will this step S2310 and the next step S2320 be executed. The number of bytes converted from the product of the minimum green bucket message filling time and the green bucket committed information rate CIR is equal to 1.
[0133] S2320: Obtain the green bucket filling time based on the time difference between the current time Stamp1 and the green bucket filling time StampC and the green bucket message filling reference, and use the sum of the original green bucket filling time StampC and the green bucket message filling time as the latest green bucket filling time StampC.
[0134] In some embodiments, the remainder of binary division is obtained by XOR modulo operation. The remainder of the time difference between the current time Stamp1 and the green bucket filling time StampC is divided by the green bucket message filling time. The difference between the time difference and the remainder is the green bucket message filling time. The number of bytes converted from the product of the remainder and the green bucket committed information rate CIR is less than 1.
[0135] S2330: Based on the message filling reference ByteE2 of the yellow bucket and the time difference between the current time Stamp1 and the yellow bucket filling time StampE, use an adder to obtain the number of message filling bytes of the yellow bucket, and add the number of message filling bytes of the yellow bucket to the original yellow bucket depth Be, as the yellow bucket depth Be.
[0136] The method for obtaining the number of bytes filled by the message in the yellow bucket using an adder is the same as the method for obtaining the number of bytes filled by the message in the green bucket using an adder in step S231, except that the parameters of the green bucket are replaced with the parameters of the yellow bucket.
[0137] Specifically, after adding the number of bytes of messages filling the yellow bucket to the original yellow bucket depth Be, and then adding the number of bytes of the remaining green bucket tokens that can be lent to the yellow bucket when the CF value is 1, the yellow bucket depth Be is updated again. Finally, the updated yellow bucket depth Be is compared with the yellow bucket's committed burst capacity EBS, and the smaller value is taken as the final updated yellow bucket depth Be.
[0138] For example, use equation (4) to calculate the depth Be of the yellow bucket for message filling, where Oc is the number of bytes of remaining tokens in the green bucket that can be used in the yellow bucket, and StampC is the original filling time of the green bucket.
[0139]
[0140] Specifically, the number of bytes filled in the yellow bucket by the message that obtains the second meter ID through the adder.
[0141] In some embodiments, it is further determined whether the time difference between the current time Stamp1 and the yellow bucket filling time StampE is greater than or equal to the minimum filling time of the yellow bucket message. Only when it is greater than or equal to the minimum filling time of the yellow bucket message will this step S2330 and the next step S2340 be executed. The number of bytes converted from the product of the minimum filling time of the yellow bucket message and the committed information rate EIR of the yellow bucket is equal to 1.
[0142] S2340: Obtain the yellow bucket message filling duration based on the time difference between the current time Stamp1 and the yellow bucket filling time StampE and the yellow bucket message filling reference, and use the sum of the original yellow bucket filling time StampE and the yellow bucket message filling duration as the latest yellow bucket filling time StampE.
[0143] In some embodiments, the remainder of binary division is obtained by XOR modulo operation. The remainder of the time difference between the current time Stamp1 and the yellow bucket filling time StampE is divided by the yellow bucket message filling duration. The difference between the time difference and the remainder is the yellow bucket message filling duration. The number of bytes converted from the product of the remainder and the yellow bucket commitment information rate EIR is less than 1.
[0144] S2250: Write the new Bc, StampC, Be, and StampE into the metering table corresponding to the second metering ID in the second metering function table of RAM2.
[0145] S240: During each message processing time, the message is metered according to the message length and the token bucket depth corresponding to the second metering ID, and when the message metering is successful, the message transmission length is subtracted from the corresponding token bucket depth.
[0146] Figure 5D The metering process of this embodiment includes steps S2410 to S2460.
[0147] S2410: Obtain the meter ID, color parameter Service Frame Color, and length corresponding to the latest arrival message.
[0148] Among them, the latest arrival message is the earliest message that has reached the arrival time but has not yet been metered.
[0149] S2420: Determine whether the length of the message is less than or equal to the current green token bucket depth Bc of the second meter ID and meets one of the following conditions: the message color parameter is no color (no Service Frame Color) or green; the color mode CM of the second meter ID is blind mode (Color-Blind), i.e., the message color is not determined.
[0150] If so, proceed to step S2430 to measure using the green bucket of the second metering ID; otherwise, proceed to step S2440.
[0151] Specifically, this step is performed according to equation (5).
[0152]
[0153] Where Lstmap1 is the message length at the current time Stamp1.
[0154] S2430: The message passes through the green bucket of the second meter ID, the message color is set to green, and the green bucket of the second meter ID is deducted.
[0155] The depth Bc of the green bucket after the bucket is closed is the difference between the depth Bc before the bucket is closed and the message length.
[0156] S2440: Determine whether the length of the message is less than or equal to the current yellow bucket depth Be of the second meter ID.
[0157] If so, proceed to step S2450 to measure using the yellow bucket of the second metering ID; otherwise, proceed to step S2460 to discard the message.
[0158] S2450: The message passes through the yellow bucket of the second meter ID, the message color is set to yellow, and the yellow bucket of the second meter ID is deducted.
[0159] The depth Be of the yellow bucket after it is closed is the difference between the depth Be before the bucket is closed and the message length.
[0160] S2460: Discard the message and set its color to red.
[0161] In summary, the second embodiment of the metering method for a TSN network utilizes an adder to fill each token bucket of each meter during message bucketing, thereby reducing the computational load of bucketing, achieving low-cost, efficient, and timely bucketing, and further improving the real-time performance of the TSN network.
[0162] The following is based on Figure 6 and Figure 7 This invention introduces various embodiments of a metering device for a TSN network.
[0163] A metering device embodiment for a TSN network operates a metering method embodiment for a TSN network, and the method described in embodiment one has all the advantages of a metering method embodiment one for a TSN network.
[0164] Figure 6 The structure of a metering device embodiment 1 for a TSN network is shown, including: a traversal bucket filling module 610, a message bucket filling module 620, and a message metering module 630.
[0165] The bucket filling module 610 is used to update the depth and filling time of each token bucket of the first metering ID according to the bandwidth configuration parameters of the token bucket of the first metering ID during each bucket filling time. When the time difference between the last filling time and the current time of a token bucket of the first metering ID is greater than the corresponding bucket filling interval, the module updates the depth and filling time of each token bucket of the first metering ID. For its working principle and advantages, please refer to step S110 of Embodiment 1 of a metering method for a TSN network.
[0166] The message bucketing module 620 is used to update the depth and filling time of each token bucket of the second metering ID according to the bandwidth configuration parameters of the second metering ID and the current time during each message processing time. For its working principle and advantages, please refer to step S120 of Embodiment 1 of a metering method for a TSN network.
[0167] The message metering module 630 is used to meter messages based on their length and the token bucket depth corresponding to the second metering ID during each message processing time. For its working principle and advantages, please refer to step S130 of Embodiment 1 of a metering method for a TSN network.
[0168] A second embodiment of a metering device for a TSN network operates a second embodiment of a metering method for a TSN network, and has all the advantages of the second embodiment of a metering method for a TSN network.
[0169] Figure 7 The structure of a metering device according to a second embodiment of a TSN network is shown, including: meter setting module 710, traversal bucket filling module 720, message bucket filling module 730, and message metering module 740.
[0170] The meter setting module 710 is used to set the first metering function table and the second metering function table. For its working principle and advantages, please refer to step S210 of Embodiment 2 of a metering method for a TSN network.
[0171] The bucket filling module 720 is used to update the depth and filling time of each token bucket of the first metering ID according to the bucket filling interval and the number of bytes filled during the bucket filling process, when the time difference between the last filling time and the current time of a token bucket of the first metering ID is greater than the corresponding bucket filling interval. For its working principle and advantages, please refer to step S220 of Embodiment 2 of a metering method for a TSN network.
[0172] The message bucketing module 730 is used to update the token bucket depth and bucketing time of the second metering ID in each message processing time, based on the message bucketing reference of each token bucket of the second metering ID and the time difference between the current time and the last bucketing of the second metering ID, using an adder. For its working principle and advantages, please refer to step S230 of Embodiment 2 of a metering method for a TSN network.
[0173] The message metering module 740 is used to meter the message according to its length and the token bucket depth corresponding to the second metering ID during each message processing time, and to subtract the message's transmission length from the corresponding token bucket depth when the message metering is successful. For its working principle and advantages, please refer to step S240 of Embodiment 2 of a metering method for a TSN network.
[0174] This invention also provides a TSN network chip, which includes: the device described in Embodiment 1 or Embodiment 2 of the TSN network metering device of this invention.
[0175] This invention also provides a switch for a TSN network, comprising: the device described in Embodiment 1 or Embodiment 2 of the metering device for a TSN network of this invention.
[0176] This invention also provides a computing device, which will be described below in conjunction with... Figure 8 Detailed introduction.
[0177] The computing device 800 includes a processor 810, a memory 820, a communication interface 830, and a bus 840.
[0178] It should be understood that the communication interface 830 in the computing device 800 shown in the figure can be used to communicate with other devices.
[0179] The processor 810 can be connected to the memory 820. The memory 820 can be used to store the program code and data. Therefore, the memory 820 can be a storage unit inside the processor 810, an external storage unit independent of the processor 810, or a component that includes both the storage unit inside the processor 810 and the external storage unit independent of the processor 810.
[0180] Optionally, the computing device 800 may also include a bus 840. The memory 820 and communication interface 830 can be connected to the processor 810 via the bus 840. The bus 840 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus 840 can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one line is used in this figure, but this does not mean that there is only one bus or one type of bus.
[0181] It should be understood that in this embodiment of the invention, the processor 810 may be a central processing unit (CPU). The processor may also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor. Alternatively, the processor 810 may employ one or more integrated circuits to execute relevant programs to implement the technical solutions provided in this embodiment of the invention.
[0182] The memory 820 may include read-only memory and random access memory, and provides instructions and data to the processor 810. A portion of the processor 810 may also include non-volatile random access memory. For example, the processor 810 may also store device type information.
[0183] When the computing device 1000 is running, the processor 810 executes computer execution instructions stored in the memory 820 to perform the operation steps of each method embodiment.
[0184] It should be understood that the computing device 800 according to the embodiments of the present invention can correspond to the corresponding subject in executing the methods according to the various embodiments of the present invention, and the above and other operations and / or functions of each module in the computing device 800 are respectively for implementing the corresponding processes of the methods of this embodiment. For the sake of brevity, they will not be described in detail here.
[0185] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.
[0186] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0187] In the embodiments provided by this invention, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0188] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0189] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0190] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0191] This invention also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, is used to perform the operation steps of the various method embodiments.
[0192] The computer storage medium of this invention can be any combination of one or more computer-readable media. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. For example, a computer-readable storage medium can be, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable storage media include electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0193] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0194] The program code contained on a computer-readable medium may be transmitted using any suitable medium, including, but not limited to, wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0195] Computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as "C" or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0196] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, all of which fall within the scope of protection of the present invention.
Claims
1. A metering method for a TSN network, characterized in that, include: During each traversal bucket filling time, when the time difference between the last bucket filling time and the current time of a token bucket of the first meter ID is greater than the corresponding traversal bucket filling interval, the depth and bucket filling time of the token bucket of the first meter ID are updated according to the bandwidth configuration parameters of the first meter ID. The first meter ID is the ID of any meter table. During each message processing time, the depth and filling time of each token bucket of the second metering ID are updated according to the bandwidth configuration parameters of the second metering ID and the current time. The filling time and message processing time are alternated and periodically distributed. The second metering ID is the ID of the metering table corresponding to any arriving message. During each message processing time, the message is also metered according to the token bucket depth of the second metering ID; The bandwidth configuration parameters for each meter ID include the number of bytes filled in each token bucket for that meter ID and the filling interval. Updating the token bucket depth and filling time for the first meter ID based on its bandwidth configuration parameters includes: The number of bytes filled during the traversal of the token bucket for the first meter ID is superimposed on the token bucket depth of the first meter ID to serve as the update depth of the token bucket for the first meter ID. The number of bytes filled during the traversal is the number of bytes converted from the product of the commitment information rate of the token bucket for the first meter ID and its traversal filling interval. The traversal filling interval is superimposed on the last filling time of the token bucket for the first meter ID to serve as the filling time of the token bucket for the first meter ID. The bandwidth configuration parameters for each meter ID also include at least the packet filling baseline for each of its token buckets. The process of updating the depth and filling time of each token bucket of the second meter ID based on its bandwidth configuration parameters and the current time includes: Based on the message filling reference of each token bucket of the second meter ID and the time difference between its last filling time and the current time, the depth and filling time of each token bucket of the second meter ID are updated using an adder. The message filling reference of each token bucket of the second meter ID is the number of bytes converted from the product of its committed information rate and the message filling reference duration. The message filling reference duration is set according to the sum of a traversal filling time and a message processing time and is a power of 2.
2. The method according to claim 1, characterized in that, Based on the message filling reference of the token bucket q of the second meter ID and the time difference between its last filling time and the current time, the depth and filling time of the token bucket q of the second meter ID are updated using an adder, including: Based on the message filling reference of the token bucket q of the second meter ID and the time difference, the number of message filling bytes of the token bucket q of the second meter ID is obtained by using an adder, and the number of message filling bytes is superimposed on the depth of the token bucket q of the second meter ID as the depth of the token bucket q of the second meter ID. The message filling time of the token bucket q of the second metering ID is obtained based on the time difference and the message filling reference. The message filling time is then added to the previous filling time of the token bucket q of the second metering ID as the filling time of the token bucket of the second metering ID. The number of bytes converted by the product of the time difference minus the message filling time and the committed information rate of the token bucket q of the second metering ID is less than 1.
3. The method according to any one of claims 1 to 2, characterized in that, The system sets up a first metering function table and a second metering function table. The first metering function table configures the bandwidth configuration parameters of each metering ID through software, while the second metering function table includes the token bucket depth and latest bucket filling time of each metering ID updated through hardware.
4. The method according to any one of claims 1 to 2, characterized in that, The traversal bucket filling interval for each token bucket of each meter ID matches any integer multiple of the sum of a traversal bucket filling time and a message processing time.
5. A metering device for a TSN network, characterized in that, include: The bucket filling module is used to update the depth and filling time of the token bucket of the first meter ID according to the bandwidth configuration parameters of the first meter ID when the time difference between the last filling time and the current time of the first meter ID is greater than the corresponding bucket filling interval during each bucket filling time. The first meter ID is the ID of any meter table. The message bucketing module is used to update the depth and bucketing time of each token bucket of the second metering ID according to the bandwidth configuration parameters of the second metering ID and the current time during each message processing time. The bucketing time and message processing time are alternated and periodically distributed. The second metering ID is the ID of the metering table corresponding to any arriving message. The message metering module is used to meter the message based on the token bucket depth of the second metering ID during each message processing time. The bandwidth configuration parameters for each meter ID include the number of bytes filled in each token bucket for that meter ID and the filling interval. The filling module specifically includes: The number of bytes filled during the traversal of the token bucket for the first meter ID is superimposed on the token bucket depth of the first meter ID to serve as the update depth of the token bucket for the first meter ID. The number of bytes filled during the traversal is the number of bytes converted from the product of the commitment information rate of the token bucket for the first meter ID and its traversal filling interval. The traversal filling interval is superimposed on the last filling time of the token bucket for the first meter ID to serve as the filling time of the token bucket for the first meter ID. The bandwidth configuration parameters for each meter ID also include at least the packet filling baseline for each of its token buckets. The packet filling module is specifically used for: Based on the message filling reference of each token bucket of the second meter ID and the time difference between its last filling time and the current time, the depth and filling time of each token bucket of the second meter ID are updated using an adder. The message filling reference of each token bucket of the second meter ID is the number of bytes converted from the product of its committed information rate and the message filling reference duration. The message filling reference duration is set according to the sum of a traversal filling time and a message processing time and is a power of 2.
6. A chip for a TSN network, characterized in that, include: The apparatus of claim 5.
7. A switch for a TSN network, characterized in that, include: The apparatus of claim 5.
Citation Information
Patent Citations
Meter-based method for calculating flow rate of messages
CN101771606A
Metering device, metering method and chip of TSN network
CN115348213A