WO2014071636A1 - Packet transmission method and device - Google Patents

Packet transmission method and device Download PDF

Info

Publication number
WO2014071636A1
WO2014071636A1 PCT/CN2012/084474 CN2012084474W WO2014071636A1 WO 2014071636 A1 WO2014071636 A1 WO 2014071636A1 CN 2012084474 W CN2012084474 W CN 2012084474W WO 2014071636 A1 WO2014071636 A1 WO 2014071636A1
Authority
WO
WIPO (PCT)
Prior art keywords
token
tokens
message
time
add
Prior art date
Application number
PCT/CN2012/084474
Other languages
French (fr)
Chinese (zh)
Inventor
孙艳平
王运富
黄雪峰
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2012/084474 priority Critical patent/WO2014071636A1/en
Priority to CN201280002899XA priority patent/CN103229465A/en
Publication of WO2014071636A1 publication Critical patent/WO2014071636A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/43Assembling or disassembling of packets, e.g. segmentation and reassembly [SAR]
    • H04L47/431Assembling or disassembling of packets, e.g. segmentation and reassembly [SAR] using padding or de-padding

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The present invention relates to the field of communications. Disclosed are a packet transmission method and device, capable of reducing the number of calculations of required tokens during the packet transmission process. The method comprises: receiving a packet, and calculating according to the packet length the number of tokens TL used for transmitting the packet (101); acquiring the number of currently available tokens Tadd in a token bucket (102); if the number of the currently available tokens Tadd is smaller than the number of tokens TL used for transmitting the packet, then calculating the delay time Tdelay and starting to keep the time, the delay time being Tdelay = (TL-Tadd)/V, wherein V represents the token filling rate (103); and transmitting the packet when the delay time expires (104). The present invention is applicable to network packet transmission.

Description

一种发送报文的方法和设备  Method and device for transmitting messages
技术领域 本发明涉及通信领域, 尤其涉及一种发送报文的方法和设备。 背景技术 The present invention relates to the field of communications, and in particular, to a method and an apparatus for transmitting a message. Background technique
令牌桶算法是最常见的一种用于网络流量整形 ( Traffic Shaping ) 和 速率限制 ( Rate Limiting ) 的算法。 其中令牌桶算法也可用来控制发送到 网络上的数据的数目, 并允许突发数据的发送。  The token bucket algorithm is the most common algorithm used for traffic shaping (Traffic Shaping) and rate limiting ( Rate Limiting). The token bucket algorithm can also be used to control the number of data sent to the network and allow the transmission of bursty data.
令牌桶算法根据用户实际需求按照用户设定的速度向桶中放置令 牌, 令牌数达到桶容量时则令牌数量不再增加; 在发送报文时, 如果令 牌数量足够发送报文则正常发送, 同时令牌数在发送过程中也在不断减 少, 如果令牌数少到不能发送报文则将报文丟弃。 令牌桶也是一种控制数据流量的工具, 当令牌桶没有令牌的时候, 报文则不被发送, 只有等到桶中生成新的令牌才可以发送, 这就可以限 制报文的流量只能小于等于令牌生成的速度, 达到限制流量的目的。 但 是现有技术中, 令牌桶填充令牌的方法是定时填充, 这种填充方法实现 简单, 可是操作频繁, 当发送长度较长的报文且在速率较高的情况下, 会出现多次填充之后才允许报文通过的情况, 这样会增加系统在报文发 送过程中对令牌需求的计算次数。 发明内容  The token bucket algorithm places tokens in the bucket according to the user's actual needs according to the speed set by the user. When the number of tokens reaches the bucket capacity, the number of tokens does not increase. When sending packets, if the number of tokens is sufficient to send packets. The packet is sent normally, and the number of tokens is also reduced during the sending process. If the number of tokens is too small to send a packet, the packet is discarded. A token bucket is also a tool for controlling data traffic. When a token bucket has no token, the packet is not sent. It can be sent only after a new token is generated in the bucket. This limits the traffic of the packet. It can only be less than or equal to the speed at which tokens are generated, and the purpose of limiting traffic is achieved. However, in the prior art, the method of filling a token by a token bucket is a timed padding. The padding method is simple to implement, but the operation is frequent. When a packet with a long length is sent and the rate is high, multiple times occur. After the padding is enabled, the packet is allowed to pass. This increases the number of times the system needs to calculate the token during the packet sending process. Summary of the invention
本发明的实施例提供一种发送报文的方法和设备, 能够减少报文发 送过程中对令牌需求的计算次数。  The embodiment of the invention provides a method and a device for transmitting a message, which can reduce the number of calculations of the token requirement in the message sending process.
为达到上述目的, 本发明的实施例采用如下技术方案: 第一方面, 提供一种发送报文的方法, 包括: 接收报文, 根据所述报文的长度计算发送所述报文需要的令牌数 TL; 获取令牌桶中的当前可用令牌数 Tadd; 若所述当前可用令牌数 TADD小于发送所述报文需要的令牌数 TL, 则计 算延时时间 Tdelay并开始计时, 所述延时时间为:!^^ ^ -丁^)^, 其中 V表示令牌的填充速率; In order to achieve the above objective, the embodiment of the present invention adopts the following technical solutions: The first aspect provides a method for sending a packet, including: receiving a packet, and calculating, according to the length of the packet, a request for sending the packet Number of cards TL; Get the number of currently available tokens in the token bucket T add ; If the currently available number of tokens T ADD is less than the number of tokens TL required to send the message, calculate the delay time T delay and start Timing, the delay time is:! ^^ ^ - Ding ^)^, where V represents the filling rate of the token;
当所述延时时间结束时, 发送所述 4艮文。 在第一种可能的实现方式中, 结合第一方面, 所述获取令牌桶中的 当前可用令牌数 ^, 具体包括:  When the delay time ends, the message is sent. In a first possible implementation manner, in combination with the first aspect, the acquiring the number of currently available tokens in the token bucket, specifically includes:
从令牌信息表中获取令牌数 Tc和填充时刻 Tflll, 其中 Tc表示发送完上 一报文所述令牌桶中剩余的令牌数, Tflll表示发送完上一报文的时刻; 计算接收所述报文的时刻 1^与所述填充时刻 Tflll的时间间隔 dT; 将所述时间间隔 dT乘以所述令牌的填充速率 V, 然后向下取整, 再加 上所述令牌数 Tc, 得到所述当前可用令牌数 Tadd, 即丁^二丁 LdT*Vj。 Obtaining the number of tokens T c and the filling time T flll from the token information table, where T c indicates that the number of tokens remaining in the token bucket of the previous message is sent, and T flll indicates that the last packet is sent. a time interval dT at which the time 1^ of the received message is received and the filling time T flll is calculated ; the time interval dT is multiplied by the filling rate V of the token, and then rounded down, plus The number of tokens T c is obtained as the number of currently available tokens T add , that is, D2, LdT*Vj.
在第二种可能的实现方式中, 结合第一种可能的实现方式, 所述方 法还包括:  In a second possible implementation, in combination with the first possible implementation, the method further includes:
从令牌信息表中获取令牌标志, 当所述令牌标志为正时, 执行所述 计算延时时间的步骤。  The token flag is obtained from the token information table, and when the token flag is positive, the step of calculating the delay time is performed.
在第三种可能的实现方式中, 结合第二种可能的实现方式, 具体包 括: 若所述当前可用令牌数 TADD小于发送所述报文需要的令牌数 TL, 则将 所述令牌标志修改为负, 以表示不处理后续的报文; 在所述延时时间结 束时将所述令牌标志修改为正, 以表示继续处理后续报文。 在第四种可能的实现方式中, 结合第一种可能的实现方式、 第二种 可能的实现方式或第三种可能的实现方式, 所述方法还包括: In a third possible implementation manner, combining the second possible implementation manner, the method specifically includes: if the current available number of tokens T ADD is smaller than a number of tokens TL required to send the packet, The card flag is modified to be negative to indicate that the subsequent message is not processed; the token flag is modified to be positive at the end of the delay time to indicate that the subsequent message is processed. In a fourth possible implementation, in combination with the first possible implementation manner, the second possible implementation manner, or the third possible implementation manner, the method further includes:
以 Tn+Tdelay更新所述令牌信息表中的填充时刻 Tflll , 以 L Tadd+ V*Updating the padding time T flll in the token information table with T n +T delay to LT add + V*
Tdelay-TjJ更新所述令牌信息表的令牌数 Te, 此时, Tflll表示发送所述报文 T delay -TjJ updates the number of tokens T e of the token information table, at which time T flll indicates that the message is sent
在第五种可能的实现方式中, 结合第一种可能的实现方式, 所述方 法还包括: In a fifth possible implementation, in combination with the first possible implementation, the method further includes:
若所述当前可用令牌数 Tadd大于或等于发送所述报文需要的令牌数 TL, 则以接收所述报文的时刻 Tn更新所述令牌信息表的填充时刻 Tflll, 以 Tadd-TL更新所述令牌信息表的令牌数 Te, 并发送所述报文。 第二方面, 提供一种发送报文的设备, 包括: 令牌处理器和延时器, 其巾: 所述令牌处理器, 用于接收报文, 根据所述报文的长度计算发送所 述报文需要的令牌数 TL; 并获取令牌桶中的当前可用令牌数 TADD; If the currently available number of tokens T add is greater than or equal to the number of tokens T L required to send the message, the padding time T flll of the token information table is updated at the time T n when the message is received. The token number T e of the token information table is updated with T add -TL, and the message is transmitted. The second aspect provides a device for sending a message, including: a token processor and a delay device, wherein: the token processor is configured to receive a packet, and calculate a sending station according to the length of the packet. The number of tokens TL required for the message; and the number of currently available tokens T ADD in the token bucket;
所述延时器, 用于若所述令牌处理器获取的所述当前可用令牌数 Tadd 小于发送所述报文需要的令牌数 TL , 则计算延时时间 Tdelay并开始计时, 所述延时时间为: Tdelay = ( TL - Tadd)/V , 其中 V表示令牌的填充速率; 所述令牌处理器, 还用于当所述延时时间结束时, 发送所述报文。 在第一种可能的实现方式中, 结合第二方面, 所述令牌处理器还包 括: The delay, if the token processor for the acquired current is less than the number of available tokens T add the packet transmission required number of tokens T L, the calculated delay time T delay and start timing The delay time is: T delay = ( T L - T add ) / V , where V represents the filling rate of the token; the token processor is further configured to send when the delay time ends The message. In a first possible implementation, in combination with the second aspect, the token processor further includes:
令牌信息获取单元, 用于从令牌信息表中获取令牌数 Tc和填充时刻 Tfm, 其中 Tc表示发送完上一报文所述令牌桶中剩余的令牌数, Tflll表示发 送完上一报文的时刻; 计时单元, 用于计算接收所述报文的时刻 Tn与所述填充时刻 Tflll的时 间间隔 dT; The token information obtaining unit is configured to obtain the number of tokens T c and the filling time T fm from the token information table, where T c represents the number of tokens remaining in the token bucket after the last packet is sent, T flll After the transmission time indicates a packet; timing unit, for calculating the packet receiving time T n T flll with the filling time interval dT;
令牌计算单元, 用于将所述时间间隔 dT乘以所述令牌的填充速率 V, 然后向下取整, 再加上所述令牌数 Tc, 得到所述当前可用令牌数 Tadd, 即 Tadd =TC+ LdT *VJ。 a token calculation unit, configured to multiply the time interval dT by the filling rate V of the token, and then round down, and add the number of tokens T c to obtain the currently available number of tokens T Add , ie T add =T C + LdT *VJ.
在第二种可能的实现方式中, 结合第一种可能实现的方式, 所述延 时器, 还用于从令牌信息表中获取令牌标志, 当所述令牌标志为正时, 则用于计算所述延时时间 Tdelay。 在第三种可能的实现方式中, 结合第二种可能的实现方式中, 所述 令牌处理器, 还用于若所述当前可用令牌数 Tadd小于发送所述报文需要的 令牌数 TL时, 则将所述令牌标志修改为负, 以表示不处理后续的报文; 在所述延时时间结束时将所述令牌标志修改为正, 以表示继续处理后续 报文。 In a second possible implementation manner, in combination with the first possible implementation manner, the delay device is further configured to obtain a token flag from the token information table, when the token flag is positive, Used to calculate the delay time Tdelay . In a third possible implementation, in combination with the second possible implementation, the token processor is further configured to: if the currently available number of tokens T add is smaller than a token required to send the packet When the number T L is set, the token flag is modified to be negative to indicate that the subsequent message is not processed; and the token flag is modified to be positive at the end of the delay time to indicate that the subsequent message is processed continuously. .
在第四种可能的实现方式中, 结合第一种可能实现的方式、 第二种 可能实现的方式或第三种可能的实现方式, 所述令牌处理器, 还用于以 TN+TDELAY更新所述令牌信息表中的填充时刻 TFLLL, 以 LTADD+ V *TDELAY -TLJ 更新所述令牌信息表的令牌数 Tc , 此时, Tflll表示发送所述报文的时刻, In a fourth possible implementation, in combination with the first possible implementation manner, the second possible implementation manner, or the third possible implementation manner, the token processor is further configured to use T N +T DELAY updates the fill time T FLLL in the token information table to LT ADD + V *T DELAY -T L J Updating the number of tokens T c of the token information table, at which time T flll indicates the time at which the message is sent,
在第五种可能的实现方式中, 结合第一种可能的实现方式, 所述令 牌处理器, 还用于若所述当前可用令牌数 Tadd大于或等于发送所述报文需 要的令牌数 TL,则以接收所述报文的时刻 TN更新所述令牌信息表的填充时 刻 TFLLL , 以 TADD-TL更新所述令牌信息表的令牌数 TC , 然后发送所述报文。 In a fifth possible implementation, in combination with the first possible implementation manner, the token processor is further configured to: if the currently available number of tokens T add is greater than or equal to an order required to send the packet The number of cards TL, the filling time T FLLL of the token information table is updated at the time T N of receiving the message, the number of tokens T C of the token information table is updated by T ADD -TL , and then the sending place Said message.
第三方面, 提供一种发送报文的设备, 包括: 至少一个处理器、 存 储器、 通信接口和总线, 该至少一个处理器、 存储器和通信接口通过总 线连接并完成相互间的通信; 其中:  In a third aspect, an apparatus for transmitting a message is provided, comprising: at least one processor, a memory, a communication interface, and a bus, wherein the at least one processor, the memory, and the communication interface are connected by a bus and complete communication with each other;
所述处理器用于通过所述通信接口接收报文, 根据所述报文的长度 计算发送所述报文需要的令牌数 TL; 所述处理器还用于获取令牌桶中的 当前可用令牌数 Tadd; 所述处理器还用于若所述当前可用令牌数 Tadd小于 发送所述报文需要的令牌数 TL, 则计算延时时间 TDELAY并开始计时, 所述 延时时间为: Tdelay = ( TL - Tadd)/V, 其中 V表示令牌的填充速率; 所述处理 器还用于当所述延时时间结束时, 通过所述通信接口发送所述报文。 The processor is configured to receive a packet by using the communication interface, and calculate a number of tokens T L required to send the packet according to the length of the packet; the processor is further configured to obtain a current available in the token bucket. The number of tokens T add ; the processor is further configured to calculate a delay time T DELAY and start timing if the currently available number of tokens T add is less than a number of tokens TL required to send the message, the delay The time is: T delay = ( T L - T add ) / V, where V represents the filling rate of the token; the processor is further configured to: when the delay time ends, send the Message.
在第一种可能的实现方式中, 结合第三方面, 所述处理器还用于从 令牌信息表中获取令牌数 Tc和填充时刻 Tflll, 其中 Tc表示发送完上一报文 令牌桶中剩余的令牌数, Tflll表示发送完上一报文的时刻; 还用于计算接 收所述 ^艮文的时刻 Tn与所述填充时刻 Tflll的时间间隔 dT; 还用于将所述时 间间隔 dT乘以所述令牌的填充速率 V, 然后向下取整, 再加上所述令牌数 Tc , 得到所述当前可用令牌数 Tadd, 即 Tadd =Tc+ L dT*Vj。 In a first possible implementation, in combination with the third aspect, the processor is further configured to obtain the token number T c and the filling time T fl11 from the token information table, where T c indicates that the last message is sent. The number of tokens remaining in the token bucket, T flll indicates the time when the last message is sent; and is also used to calculate the time interval dT between the time T n of receiving the message and the padding time T flll ; Multiplying the time interval dT by the filling rate V of the token, and then rounding down, plus the number of tokens T c , to obtain the current available number of tokens T add , that is, T add = T c + L dT*Vj.
在第二种可能的实现方式中, 结合第一种可能的实现方式, 所述处 理器还用于从所述令牌信息表中获取令牌标志, 当所述令牌标志为正时, 用于计算所述延时时间 Tdelay。 在第三种可能的实现方式中, 结合第二种可能的实现方式, 所述处 理器还用于若所述当前可用令牌数 Tadd小于发送所述报文需要的令牌数 TL , 则将所述令牌标志修改为负, 以表示不处理后续的报文; 在所述延 时时间结束时将所述令牌标志修改为正, 以表示继续处理后续报文。 在第四种可能的实现方式中, 结合第一种可能的实现方式、 第二种 可能的实现方式或第三种可能的实现方式, 所述处理器还用于以 Tn+Tdelay 更新所述令牌信息表中的填充时刻 Tflll, 以 LTadd+v* Tdelay-Tjj更新所述令 牌信息表的令牌数 Tc , 此时, TFLLL表示发送所述报文的时刻, Tc表示发送 所述报文后所述令牌桶中剩余的令牌数。 In a second possible implementation, in combination with the first possible implementation, the processor is further configured to obtain a token identifier from the token information table, and when the token identifier is positive, The delay time Tdelay is calculated. In a third possible implementation manner, in combination with the second possible implementation manner, the processor is further configured to: if the currently available number of tokens T add is smaller than a number of tokens T L required to send the packet, Then, the token flag is modified to be negative to indicate that the subsequent message is not processed; and the token flag is modified to be positive at the end of the delay time to indicate that the subsequent message is processed. In a fourth possible implementation, in combination with the first possible implementation manner, the second possible implementation manner, or the third possible implementation manner, the processor is further configured to use T n +T delay Updating the padding time T flll in the token information table, and updating the token number T c of the token information table by LT add +v* T delay -Tjj. At this time, T FLLL indicates that the message is sent. At time, T c represents the number of tokens remaining in the token bucket after the message is sent.
在第五种可能的实现方式中, 结合第一种可能的实现方式, 所述处 理器还用于若所述当前可用令牌数 TADD大于或等于发送所述报文需要的 令牌数 TL, 则以接收所述报文的时刻 TN更新所述令牌信息表的填充时刻 TFM , 以 TADD-TL更新所述令牌信息表的令牌数 TC , 并发送所述报文。 本发明的实施例提供的发送报文的方法和设备, 通过延时处理可以 使得报文在延时时间段内至多经过一次令牌填充后就可以实现放行发 送, 避免了报文经过多次填充之后才允许通过的情况出现, 这样通过延 时处理能够减少报文发送过程中对令牌需求的计算次数。 附图说明 In a fifth possible implementation, in combination with the first possible implementation manner, the processor is further configured to: if the currently available number of tokens T ADD is greater than or equal to the number of tokens required to send the packet, TL And updating the filling time T FM of the token information table at the time T N of receiving the message, updating the number of tokens T C of the token information table by T ADD -TL, and transmitting the message . The method and device for sending a message provided by the embodiment of the present invention can enable the release of the message after the token is filled in at least one time in the delay period, and the message is prevented from being filled for a plurality of times. After the permission is allowed to occur, the delay processing can reduce the number of calculations of the token requirement during the message transmission. DRAWINGS
对实施例或现有技术描述中所需要使用的附图作简单地介绍, 显而易见 地, 下面描述中的附图仅仅是本发明的一些实施例, 对于本领域普通技 术人员来讲, 在不付出创造性劳动的前提下, 还可以根据这些附图获得 其他的附图。 图 1为本发明的实施例提供的一种发送报文的方法的流程示意图; 图 2 为本发明的另一实施例提供的一种发送报文的方法的流程示意 图; BRIEF DESCRIPTION OF THE DRAWINGS The accompanying drawings, which are set forth in the description of the claims Other drawings can also be obtained from these drawings on the premise of creative labor. FIG. 1 is a schematic flowchart of a method for sending a message according to an embodiment of the present invention; FIG. 2 is a schematic flowchart of a method for sending a message according to another embodiment of the present invention;
图 3为本发明的实施例提供的一种发送报文的设备的结构示意图; 图 4 为本发明的另一实施例提供的一种发送报文的设备的结构示意 图;  FIG. 3 is a schematic structural diagram of an apparatus for sending a message according to an embodiment of the present invention; FIG. 4 is a schematic structural diagram of an apparatus for sending a message according to another embodiment of the present invention;
图 5 为本发明的又一实施例提供的一种发送报文的设备的结构示意 图。  FIG. 5 is a schematic structural diagram of an apparatus for transmitting a message according to another embodiment of the present invention.
具体实施方式  detailed description
下面将结合本发明实施例中的附图, 对本发明实施例中的技术方案 进行清楚、 完整地描述, 显然, 所描述的实施例仅仅是本发明一部分实 施例, 而不是全部的实施例。 基于本发明中的实施例, 本领域普通技术 人员在没有做出创造性劳动前提下所获得的所有其他实施例, 都属于本 发明保护的范围。 The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are only a part of the embodiments of the present invention, but not all of the embodiments. General techniques in the art based on embodiments in the present invention All other embodiments obtained by a person without creative efforts are within the scope of the present invention.
在通讯领域中令牌桶算法是网络流量整形 (Traffic Shaping ) 和速 率限制 (Rate Limiting ) 中最常使用的一种算法。 典型情况下, 令牌桶 算法用来控制发送到网络上的数据的数目, 并可以允许突发数据的发送。 因此需要采取一些限制网络流量的方法来避免突发流量给网络带来的诸 多问题。 本发明基于网络处理器或者相关的软件 (例如现场可编程门阵列 ( Field - Programmable Gate Array, 简称 FPGA) 等可以编程器件) , 在报文处理过程中通过控制令牌桶采取延时处理的方法,减轻了系统因 为多次运算带来的压力, 本发明提供的发送报文的方法, 参照图 1所示, 包括以下流程:  The token bucket algorithm is one of the most commonly used algorithms in traffic shaping and rate limiting (Rate Limiting) in the communications field. Typically, the token bucket algorithm is used to control the amount of data sent to the network and to allow the transmission of bursty data. Therefore, some methods to limit network traffic need to be taken to avoid the problems that burst traffic brings to the network. The invention is based on a network processor or related software (for example, a programmable device such as a Field-Programmable Gate Array (FPGA)), and a method for delay processing by controlling a token bucket in a message processing process The method for sending a message, which is provided by the present invention, as shown in FIG. 1 , includes the following processes:
101、 接收报文, 根据报文的长度计算发送报文需要的令牌数 TL。 当前报文需要消耗的令牌数对应于报文本身长度, 即报文长度 L对应 的需要消耗的令牌数为 TL, 这里当报文长度对应的所需的令牌数正好为 整数时, 则取报文所需的令牌数为 TL; 当报文长度对应的所需的令牌数 为小数时, 为了满足报文的发送需求, 则向上取整得到所需令牌数「TJ , 以保证后续令牌填充过程中能够提供满足报文发送最低要求的令牌数。 101. Receive a packet, and calculate a number of tokens TL required to send the packet according to the length of the packet. The number of tokens to be consumed in the current packet corresponds to the length of the text body. That is, the number of tokens to be consumed corresponding to the length L of the packet is T L , where the number of tokens corresponding to the length of the packet is exactly an integer. The number of tokens required to obtain a packet is TL. When the number of tokens required for the packet length is a decimal number, the number of tokens required to be received is rounded up to obtain the required number of tokens. To ensure that the number of tokens that meet the minimum requirements for message delivery can be provided during the subsequent token filling process.
102、 获取令牌桶中当前可用令牌数! ^。 具体的, 可以通过查询令牌信息表, 获取令牌桶中发送完上一报文 令牌桶中剩余的令牌数 TC。 这里令牌信息表示例如表 1所示:
Figure imgf000007_0001
102. Obtain the number of currently available tokens in the token bucket! ^. Specifically, the number of tokens T C remaining in the token bucket of the previous packet is obtained in the token bucket by querying the token information table. Here the token information is represented as shown in Table 1:
Figure imgf000007_0001
表 1  Table 1
令牌信息表包含令牌标志 TPs、 令牌数 TE和填充时刻 TFLLL; 其中 TE表示 发送完上一报文令牌桶中剩余的令牌数, TFLLL表示发送完上一报文的时刻。 如表 1所示, 表示令牌标志 TPs为正, 发送完上一报文令牌桶中剩余 的令牌数 TC为 100个,发送完上一报文的时刻 TFLLL为 50秒,当然这里 TFLLL的 单位只是以秒为例进行说明, 在该实施例中还可以采用微秒、 毫秒或 F P G A系统中的周期个数为单位。 其中, 步骤 102具体包括: The token information table contains the token flag T P . s , the number of tokens T E and the padding time T FLLL ; where T E represents the number of tokens remaining in the token bucket of the previous message, and T FLLL represents the time of transmitting the last message. As shown in Table 1, the token flag T P is indicated . s is positive. The number of tokens remaining in the token bucket of the previous message is T C. The time at which the last message is sent is T FLLL is 50 seconds. Of course, the unit of T FLLL is only in seconds. To illustrate, in this embodiment, microseconds, milliseconds, or The number of cycles in the FPGA system is in units. The step 102 specifically includes:
102a, 从令牌信息表中获取令牌数 TC和填充时刻 TFLLL ; 102a, obtaining the number of tokens T C and the filling time T FLLL from the token information table;
其中 TC表示发送完上一报文令牌桶中剩余的令牌数, TFLLL表示发送完 上一报文的时刻。 Where T C indicates the number of tokens remaining in the token bucket of the previous message, and T FLLL indicates the time when the last packet was sent.
102b、 计算接收报文的时刻 Tn与填充时刻 Tfill的时间间隔 dT; 具体为, 当前令牌标志 Tp。s为正( " 1 " )时, 当前填充时刻 τη可以理解 为与当前报文到来时刻 Ta„—致, 其中 Ta„为当前报文到来时刻, τη为当前 填充时刻; 上次补充令牌结束时刻可以理解为填充完上一报文所需令牌 数的时刻, 假如以 Tfill表示; 假如以 dT表示所述时间间隔, 则所述时间间 隔为: 102b, the calculation time of the received packets with time T n T fill filling time interval dT; Specifically, the current token flag Tp. When s is positive ("1"), the current filling time τ η can be understood as the current message arrival time T a „, where T a „ is the current message arrival time, τ η is the current filling time; The end time of the supplementary token can be understood as the time when the number of tokens required for the previous message is filled, if it is represented by T fill ; if the time interval is represented by dT, the time interval is:
dT= Tn -TfilldT= T n -T fill .
102c , 将时间间隔 dT乘以令牌的填充速率 V , 然后向下取整, 再加上 令牌数 Tc , 得到当前可用令牌数 Tadd, 即丁^ ^ LdT*Vj。 102c, multiply the time interval dT by the filling rate V of the token, and then round down, and add the number of tokens T c to obtain the currently available number of tokens T add , that is, D ^ LdT * Vj.
其中, 在该时间间隔里填充的令牌数为: dT 与填充速率 V相乘得到 的, 令牌桶中的原有令牌数为 TC (即令牌信息表中记录的上一报文传输后 更新的令牌数 TJ , 则当前可用令牌数 TADD为: The number of tokens filled in the time interval is: dT is multiplied by the filling rate V, and the original number of tokens in the token bucket is T C (that is, the last message recorded in the token information table) The number of tokens TJ updated after transmission, then the current number of available tokens T ADD is:
Tadd=Tc+ LdT *VJ ; 其中 dT * V的乘积可以不是整数。 假如不是整数的情况下, 可以采用 向下取整 (比如, 3.8则向下取整数为 3 ) 计算得到丁^。 T add = T c + LdT * VJ ; where the product of dT * V may not be an integer. If it is not an integer, you can use rounding down (for example, 3.8 to take an integer down to 3) to calculate the D.
103、 若当前可用令牌数 TADD小于发送报文需要的令牌数 TL, 则计算 延时时间 Tdelay并开始计时。 其中,延时时间为: Tdelay = ( TL - Tadd)/V ,这里 V表示令牌的填充速率。 这里的延时时间实际情况中可以是携带小数的, 如当计算延时时间 的单位为以秒或 秒进行计算时, 延时时间为小数也是可以的, 但是在 在以 FPGA为计算环境时, 由于在 FPGA的计算环境中, 时间值一般是以脉 冲的形式出现, 即以时间周期的个数进行计算, 当出现不完整的时间周 期时, FP GA计算环境中实现起来有时候会比较困难, 因此在 FPGA计算环 境中延时时间一般采用向上取整的策略, 同时采用向上取整策略保证了 延时时间内能够为报文的发送提供最低要求的令牌数, 具体的, 在 FPGA 计算环境中延时时间的计算公式可以调整为: TDELAY =「( TL - TADD)/V 1 , 这 里 V表示令牌的填充速率, 「1表示向上取整。 103. If the currently available number of tokens T ADD is smaller than the number of tokens TL required to send the message, calculate the delay time T dela y and start timing. The delay time is: T delay = ( T L - T add ) / V , where V represents the filling rate of the token. The delay time here can be carried in decimals. For example, when the unit of calculating the delay time is calculated in seconds or seconds, the delay time is also a decimal, but when using FPGA as the computing environment, Since in the computing environment of the FPGA, the time value is generally in the form of a pulse, that is, the number of time periods is calculated. When an incomplete time period occurs, it is sometimes difficult to implement in the FP GA computing environment. So in the FPGA computing loop The delay time in the environment generally adopts the upward rounding strategy, and the upward rounding strategy ensures that the minimum number of tokens can be provided for the transmission of the message within the delay time. Specifically, the delay time in the FPGA computing environment The calculation formula can be adjusted to: T DELAY = "( T L - T ADD ) / V 1 , where V represents the filling rate of the token, and "1 represents the rounding up.
104、 当延时时间结束时, 发送才艮文。 本发明的实施例提供的发送报文的方法, 通过延时处理可以使得报 文在延时时间段内至多经过一次令牌填充后就可以实现放行发送, 避免 了报文经过多次填充之后才允许通过的情况出现, 这样通过延时处理能 够减少报文发送过程中对令牌需求的计算次数。  104. When the delay time ends, the message is sent. The method for sending a message provided by the embodiment of the present invention can enable the release of the message after the token is filled in at least one time in the delay time period, and the message is prevented from being filled after being filled for a plurality of times. The case of allowing the passage occurs, so that the delay processing can reduce the number of calculations of the token requirement during the message transmission.
具体的, 参照图 2 所示, 本发明的实施例提供的发送报文的方法包 括如下流程:  Specifically, as shown in FIG. 2, the method for sending a message provided by the embodiment of the present invention includes the following process:
201、 接收报文, 根据报文的长度计算发送报文需要的令牌数 TL。 当前报文需要消耗的令牌数对应于报文本身长度, 即报文长度 L对应 的需要消耗的令牌数为 TL。 这里当报文所需的令牌数正好为整数时, 则 取报文所需的令牌数为 TL; 当报文所需的令牌数为小数时, 为了满足报 文的发送需求, 则向上取整得到所需令牌数「TL1。 因此报文需要的令牌 数可以通过向上取整得到。 201. Receive a packet, and calculate a number of tokens TL required to send the packet according to the length of the packet. The number of tokens that need to be consumed in the current packet corresponds to the length of the text body. That is, the number of tokens that need to be consumed corresponding to the length L of the packet is T L . Here, when the number of tokens required for the packet is an integer, the number of tokens required to obtain the packet is TL; when the number of tokens required for the packet is a decimal, in order to meet the transmission requirement of the packet, Round up to get the required number of tokens "TL1. Therefore, the number of tokens required for the message can be obtained by rounding up.
202、 从令牌信息表获取令牌标志, 当令牌标志为正时, 则执行步骤 202. Obtain a token flag from the token information table. When the token flag is positive, perform steps.
203。 203.
203、 从令牌信息表中获取令牌数 TC和填充时刻 TFLLL , 其中 TC表示发送 完上一报文令牌桶中剩余的令牌数, TFLLL表示发送完上一报文的时刻; 具体的, 可以通过查询令牌信息表, 获取令牌桶中当前可用令牌数; 这里令牌信息表示例如表 2所示: 203. Obtain a token number T C and a padding time T FLLL from the token information table, where T C indicates that the number of tokens remaining in the token bucket of the previous message is sent, and T FLLL indicates that the last packet is sent. Specifically, the number of currently available tokens in the token bucket can be obtained by querying the token information table; where the token information is represented by, for example, Table 2:
Figure imgf000009_0001
Figure imgf000009_0001
表 2 令牌信息表包含令牌标志 TPs、 令牌数 TE和填充时刻 T 如表 2所示, 表示令牌标志 Tps为正, 发送完上一报文令牌桶中剩余 的令牌数 Tc为 100个,发送完上一报文的时刻 Tflll为 50秒,当然这里 Tflll的 单位只是以秒为例进行说明, 在该实施例中还可以采用微秒、 毫秒或 F P G A系统中的周期个数为单位。 Table 2 The token information table contains the token flag T P . s , number of tokens T E and filling time T As shown in Table 2, the token flag T p is represented. s is positive, sending the packet on a token remaining in the token bucket number T c is 100, the time to transmit a complete packet T flll 50 seconds, of course, where T flll unit only seconds Example To illustrate, in this embodiment, microseconds, milliseconds, or the number of cycles in the FPGA system can also be used.
204、 计算接收报文的时刻 Tn与填充时刻 Tfill的时间间隔 dT; 204, the received message is calculated time T n and the filling time interval dT T fill;
具体为, 当前令牌标志 Tp。s为正( " 1 " )时, 当前填充时刻 Tn可以理解 为与当前报文到来时刻 Ta„—致, 其中 Ta„为当前报文到来时刻, Tn为当前 填充时刻; 上次补充令牌结束时刻可以理解为填充完上一报文所需令牌 数的时刻, 假如以 Tfill表示; 假如以 dT表示所述时间间隔, 则所述时间间 隔为: Specifically, the current token flag Tp. s is positive ( "1"), the current fill time T n will be appreciated that with the current packet arrival time T a "- induced, where T a" packet arrival time of the current, the current fill time T n; Last The end time of the supplementary token can be understood as the time when the number of tokens required for the previous message is filled, if it is represented by T fill ; if the time interval is represented by dT, the time interval is:
dT= Tn -Tim„ dT= T n -Tim„
205、 将时间间隔 dT乘以令牌的填充速率 V , 然后向下取整, 再加上 令牌数 Tc , 得到当前可用令牌数 Tadd, 即 Tadd =Tc+ Ld T*Vj。 205. Multiply the time interval dT by the filling rate V of the token, and then round down, and add the number of tokens T c to obtain the currently available number of tokens T add , that is, T add =T c + Ld T*Vj .
其中,在该时间间隔里填充的令牌数为 dT 与填充速率 V相乘得到的, 令牌桶中的原有令牌数为 Tc(即令牌信息表中记录的上一报文传输后更新 的令牌数 Tc ) , 则当前可用令牌数 Tadd为: The number of tokens filled in the time interval is obtained by multiplying the number of tokens by the filling rate V, and the number of original tokens in the token bucket is T c (that is, the last packet transmission recorded in the token information table) After the number of tokens updated T c ) , the current number of available tokens T add is:
Tadd=Tc+ LdT *Vj ; 其中 dT * V的乘积可以不是整数, 因此可以采用向下取整(比如, 3.8 则向下取整数为 3 ) 计算得到丁^。 T add =T c + LdT *Vj ; where the product of dT * V may not be an integer, so it can be calculated by rounding down (for example, 3.8 is down to an integer of 3).
206、 若当前可用令牌数 TADD小于发送报文需要的令牌数 TL, 则计算 延时时间 Tdelay并开始计时。 其中,延时时间为: Tdelay = ( TL - Tadd)/V,这里 V表示令牌的填充速率。 这里延时时间也可以不取整, 实际情况中延时时间也可以是携带小 数的,这里只是为了本发明实施例在以 FPGA这类计算环境中的需要为例, 当计算延时时间的单位为秒, 秒时, 延时时间为小数也是可以进行计 算的。 但是当在以 FPGA这类计算环境中, 延时时间会以脉冲的形式, 如 果取小数则实现起来会可能会很比较困难, 而且当延时时间上取整时, 施例以向上取整的方式为例, 但不限于只存在向上取整的这一实现方式。 其中, 延时时间为: Tdelay =「(TL - Tadd)/V l , 这里 V表示令牌的填充速 率, 「1表示向上取整, 以保证有足够的令牌数发送当前报文。 206. If the currently available number of tokens T ADD is less than the number of tokens TL required to send the message, calculate the delay time T dela y and start timing. The delay time is: T delay = ( T L - T add ) / V, where V represents the filling rate of the token. The delay time may not be rounded. In actual situations, the delay time may also be a decimal number. The reason for calculating the delay time is as an example in the computing environment of the embodiment of the present invention. For seconds, seconds, the delay time is also decimal and can be calculated. However, in a computing environment such as FPGA, the delay time will be in the form of a pulse. If the decimal is taken, it may be difficult to implement, and when the delay time is rounded, the application is rounded up. The mode is an example, but it is not limited to the implementation that only rounds up. The delay time is: T delay = "(T L - T add ) / V l , where V represents the filling rate of the token, and "1 represents rounding up to ensure that there are enough tokens to send the current message. .
207、 将令牌标志修改为负, 以表示不处理后续的报文。  207. Modify the token flag to be negative to indicate that the subsequent message is not processed.
如果当前可用令牌数 TADD< TL , 将 TPs设为 " 0" (前面已提到, 0代 表负 ) 。 If the current number of available tokens T ADD < T L , T P will be. s is set to "0" (previously mentioned, 0 means negative).
208、 当延时时间结束时, 发送才艮文。  208. When the delay time ends, the message is sent.
209、 将令牌标志修改为正, 以表示继续处理后续报文。 209. Modify the token flag to be positive to indicate that the subsequent message is processed.
延时时间指将剩余令牌数补充至满足本次令牌消耗的最小时间, 当 延时时间结束令牌数补充至满足本次令牌消耗的最小时间时, 将令牌信 息表信息中的令牌标志设为 " 1 " , 其中 1代表正。  The delay time refers to adding the remaining number of tokens to the minimum time for satisfying the token consumption. When the delay time end token number is added to meet the minimum time for the token consumption, the token information in the token information table is The token flag is set to "1", where 1 is positive.
210、 以 TN+Tdelay更新令牌信息表的填充时刻 TFLLL , 以 L TADD+ V*210. Update the padding time T FLLL of the token information table by T N +T dela y to LT ADD + V*
TDELAY-TL j更新令牌信息表的令牌数 Tc , U表示向下取整。 T DELAY -T L j updates the token number T c of the token information table, U indicates rounding down.
更新令牌表信息: Tfll尸 Tfm +dT +Tdelay; 即 Tfll尸 Tn+Tdelay; Update the token table information: T fll corpse T fm +dT + T delay ; that is T fll corpse T n + T delay ;
Tc= L Tadd+ V* Tdelay-TLJ ; T c = LT a dd + V* Tdelay-T L J ;
T = 1  T = 1
i pos 丄  i pos 丄
更新后的令牌表中, TFLLL表示发送报文的时刻; TC表示发送报文后令 牌桶中剩余的令牌数; TPS表示令牌信息表更新后的令牌标志为正, 以表 示可以继续处理后续 4艮文。 这里, 步骤 210的顺序不做限制, 本发明中在步骤 206结束后便可 获取用于更新填充时刻 Tfll TN+Tdelay , 以及更新令牌信息表的令牌数 TC 的 TADD +V *Tdelay - TL , 因此步骤 210可以在 206之后至报文发送出去之 间的任一步骤进行。 可选的, 该方法还包括: In the updated token table, T FLLL indicates the time at which the message is sent; T C indicates the number of tokens remaining in the token bucket after the message is sent; T P . S indicates that the updated token flag of the token information table is positive, indicating that the subsequent four messages can be processed. Here, not limited in the sequence of steps 210, the present invention can be acquired at the end of step 206 for updating T ADD filling time T fll T N + T dela y , and the number of tokens T C token update information table +V *T dela y - T L , so step 210 can be performed at any step between 206 and the time the message is sent. Optionally, the method further includes:
21 1、 若当前可用令牌数 TADD大于或等于发送报文需要的令牌数 TL , 则发送报文。 21 1. If the currently available number of tokens T ADD is greater than or equal to the number of tokens TL required to send a message, a message is sent.
212、 以接收报文的时刻 TN更新令牌信息表的填充时刻 TFLLL , 以 TADD-TL 更新令牌信息表的令牌数 Tc。 具体为: 如果当前可用令牌数 TADD 大于或等于报文消耗的令牌数 TL, 则计算 出剩余令牌数 Tc, 并更新令牌信息表中的填充时间 Tflll, 放行该报文。 212. Update the padding time T FLLL of the token information table at the time T N of receiving the message, and update the token number Tc of the token information table by T ADD -TL . Specifically: If the currently available number of tokens T ADD is greater than or equal to the number of tokens TL consumed by the message, the remaining number of tokens T c is calculated, and the padding time T fl11 in the token information table is updated to release the message.
其中剩余令牌数 Tc为: The remaining number of tokens T c is:
Tc=Tadd - min((Tadd-L):H), 即 Tadd-L与令牌桶深度 H取最小值。 这里 H是 令牌桶深度, 表示当前可用令牌数 Tadd 大于或等于报文消耗的令牌数丁 其中,令牌桶的深度 H可以根据容忍的突发数据量自行设置 ,长时间来看 , 当令牌桶深度 H设置越大时通过的报文速率越接近设置速率,从而令牌桶 可容忍的突发数据量也就越大, 即令牌桶中的令牌数可以完全满足报文 的发送需求, 进而通过令牌数的填充速率 (令报文的流量只能是小于或 等于令牌的填充速率) 达到了限制报文流量的目的。 T c =T add - min((T add -L):H), that is, T add -L and the token bucket depth H take the minimum value. Here, H is the depth of the token bucket, indicating that the currently available number of tokens T add is greater than or equal to the number of tokens consumed by the packet. The depth H of the token bucket can be set according to the amount of burst data tolerated. When the token bucket depth H is set to be larger, the packet rate that is passed is closer to the set rate, so that the amount of burst data that the token bucket can tolerate is larger, that is, the number of tokens in the token bucket can fully satisfy the report. The request for sending packets, and thus the rate of filling the tokens (so that the traffic of the packets can only be less than or equal to the filling rate of the tokens), achieves the purpose of limiting packet traffic.
Tflll=Tflll+dT (因为这里的处理方案都是以数值为整数确定的, 所以 当 dT*V取整时, 实际情况中更新的填充时间: Tflll=Tflll+ ( LdT*V_| /V ) ; 其中等式左边的 Tflll表示更新后的 Tflll, 即发送所述报文的时刻; 等式 右边的 Tflll表示更新前的 Tflll , 即发送完上一 4艮文的时刻。 T flll =T flll +dT (because the processing scheme here is determined by the value as an integer, so when dT*V is rounded, the updated fill time in the actual situation: T flll =T flll + ( LdT*V_| / V); wherein T flll represents the left side of equation T flll updated, i.e., the packet transmission time; T flll RHS represents T flll before update, i.e. sending the packets over a time Gen 4 .
Tps= " 1 " ( 1表示令牌桶标志为正, 0表示负, 以下同) 。 T p . s = " 1 " (1 means the token bucket flag is positive, 0 means negative, the same below).
这里具体的, 例如: 在 FPGA环境中, 系统时钟 elk为 10MHz, V = 1Mbps, Tfill = 100, Tarr = 205 , 则: Specifically, for example: In an FPGA environment, the system clock elk is 10MHz, V = 1Mbps, T fill = 100, T arr = 205, then:
Tn = 205 dT = Tn - Tfill = \Q5 dT * V = 105 * {\ I \0M) * \M = 10.5 这种情况下补充的令牌数会出现小数, 然而补充的令牌数是以整数 计的, 即在出现小数的情况下理论上是令牌桶中只能补充到该带小数值 的整数位令牌数, 但是这里如果只将令牌数向下取整, 则会在计算形成 了令牌数的损失, 而时间上不进行相应的调整则连续进行几次报文发送 后会发生系统计时与令牌数计算的紊乱, 因此这里对 Tn也做相应的处理 即向下取整 Tn=200, 后面的步骤中全部按照 Τη=200计算, 这样计算得 到的令牌数也是对应向下取整的。 由步骤 204得知: 所述时间间隔 dT为: T n = 205 dT = T n - T fill = \Q5 dT * V = 105 * {\ I \0M) * \M = 10.5 In this case, the number of tokens added will be decimal, but the number of tokens added It is in integer, that is, in the case of a decimal, the token bucket can theoretically only add the number of integer-bit tokens with a decimal value, but if only the number of tokens is rounded down, In the calculation, the loss of the number of tokens is formed, and the corresponding adjustment is not performed in time. After several consecutive message transmissions, the system timing and the number of tokens are disordered. Therefore, the Tn is also processed accordingly. The whole Tn=200 is taken down, and all the subsequent steps are calculated according to Τη=200, and the number of tokens thus calculated is also rounded down correspondingly. Obtained by step 204: the time interval dT is:
dT= Tn -Tfill, 故 的计算方法更新为: , = dT + Tfill = L llll + Tfill = 100 + 100 = 200, dT= T n -T fill , so the calculation method is updated as: , = dT + T fill = L llll + Tfill = 100 + 100 = 200,
其中,
Figure imgf000013_0001
, 这里的 dT是在时间间隔这段
among them,
Figure imgf000013_0001
, where dT is during the interval
这里, 填充时间是按照丁^ 。。 更新的, 但是由于计算过程是在同一 个时钟系统下进行的, 因此原计算值忽略的时钟周期及由于忽略的时钟 周期多出来的小数点后的令牌数会整体在计算下一次报文到来时的计算 过程中得到补偿, 因此长期来看时间并没有浪费, 令牌桶的令牌也没有 白白消耗。 本发明的实施例提供的发送报文的方法, 通过延时处理可以使得报 文在延时时间段内至多经过一次令牌填充后就可以实现放行发送, 避免 了报文经过多次填充之后才允许通过的情况出现, 这样通过延时处理能 够减少报文发送过程中对令牌需求的计算次数。 Here, the fill time is in accordance with D. . Updated, but since the calculation process is performed under the same clock system, the clock period that is ignored by the original calculation value and the number of tokens after the decimal point due to the ignored clock cycle will be calculated when the next message arrives. The calculation process is compensated, so in the long run, the time is not wasted, and the token bucket token is not consumed. The method for sending a message provided by the embodiment of the present invention can enable the release of the message after the token is filled in at least one time in the delay time period, and the message is prevented from being filled after being filled for a plurality of times. The case of allowing the passage occurs, so that the delay processing can reduce the number of calculations of the token requirement during the message transmission.
本发明实施例提供一种发送报文的设备 3 , 参照图 3 所示, 包括: 令牌处理器 31和延时器 32 , 其中: 令牌处理器 31 , 用于接收报文, 根据报文的长度计算发送报文需要 的令牌数 TL; 并获取令牌桶中的当前可用令牌数 TADD; An embodiment of the present invention provides a device 3 for transmitting a message. Referring to FIG. 3, the method includes: a token processor 31 and a delay unit 32. The token processor 31 is configured to receive a packet according to the packet. The length of the token is TL; and the number of currently available tokens T ADD in the token bucket is obtained;
延时器 32 , 用于若当前可用令牌数 Tadd小于发送报文需要的令牌数 TL , 则计算延时时间 Tdelay并开始计时, 延时时间为: Tdelay = ( TL - Tadd)/V , 其中 V表示令牌的填充速率; The delay device 32 is configured to calculate the delay time Tdelay and start timing if the currently available number of tokens Tadd is less than the number of tokens TL required to send the message, and the delay time is: Tdelay = (T L - T add ) / V , where V represents the fill rate of the token;
令牌处理器 31 , 还用于当延时时间结束时, 发送报文。 本发明的实施例提供的发送报文的设备, 通过延时处理可以使得报 文在延时时间段内至多经过一次令牌填充后就可以实现放行发送, 避免 了报文经过多次填充之后才允许通过的情况出现, 这样通过延时处理能 够减少报文发送过程中对令牌需求的计算次数。 The token processor 31 is further configured to send a message when the delay time ends. The device for sending a message according to the embodiment of the present invention can enable the release of the message after the token is filled in the delay time period by using the delay processing, thereby avoiding the release of the message. The case that the message is allowed to pass after being filled for a plurality of times occurs, so that the delay processing can reduce the number of calculations of the token requirement during the message sending process.
进一步的, 参照图 4所示, 令牌处理器 31还包括: 令牌信息获取单 元 31 1、 计时单元 312和令牌计算单元 313 , 其中:  Further, referring to FIG. 4, the token processor 31 further includes: a token information acquiring unit 31 1 , a timing unit 312, and a token calculating unit 313, where:
令牌信息获取单元 31 1 , 用于从令牌信息表中获取令牌数 Tc和填充时 刻 Tflll, 其中 Tc表示发送完上一报文令牌桶中剩余的令牌数, Tflll表示发送 完上一 文的时刻; The token information obtaining unit 31 1 is configured to obtain the number of tokens T c and the filling time T fl11 from the token information table, where T c represents the number of tokens remaining in the token bucket of the previous message, T flll Indicates the time at which the last article was sent;
计时单元 312 , 用于计算接收 文的时刻 Tn与填充时刻 Tfill的时间间 隔 dT; 令牌计算单元 313 , 用于将时间间隔 dT乘以令牌的填充速率 V , 然后 向下取整, 再加上令牌数 Tc , 得到当前可用令牌数 Tadd, 即丁^二丁 LdT *VJ。 可选的, 参照图 4所示, 令牌处理器 31 , 还用于若当前可用令牌数 TADD大于或等于发送报文需要的令牌数 TL , 则以接收报文的时刻 TN更新令 牌信息表的填充时刻 TFLLL , 以 TADD-TL更新令牌信息表的令牌数 TC , 并发送 报文。 The timing unit 312 is configured to calculate a time interval dT between the time T n of the received text and the filling time T fill ; the token calculating unit 313 is configured to multiply the time interval dT by the filling rate V of the token, and then round down, Together with the number of tokens T c , the current number of available tokens T add is obtained , that is, D2, LdT *VJ. Optionally, as shown in FIG. 4, the token processor 31 is further configured to update the time T N of receiving the message if the currently available number of tokens T ADD is greater than or equal to the number of tokens TL required to send the message. The padding time T FLLL of the token information table updates the token number T C of the token information table with T ADD -TL and transmits the message.
这里因为当前可用令牌数大于或等于报文发送需要消耗的令牌数, 以此本发明的实施例提供的设备支持将报文以正常处理方式发送。 可选的, 延时器 32 , 还用于从令牌信息表中获取令牌标志, 当令牌 标志为正时, 则用于计算所述延时时间 Tdelay。 The device provided by the embodiment of the present invention supports sending the packet in a normal processing manner, because the number of currently available tokens is greater than or equal to the number of tokens that are required to be sent by the packet. Optionally, the delay device 32 is further configured to obtain a token flag from the token information table, and when the token flag is positive, to calculate the delay time T dela y.
进一步的, 令牌处理器 31 , 还用于若当前可用令牌数 Tadd小于发送报 文需要的令牌数 TL , 则将令牌标志修改为负, 以表示不处理后续的报文; 在延时时间结束时将令牌标志修改为正, 以表示继续处理后续报文。 进一步的, 令牌处理器 31 , 还用于 Tn+Tdelay更新令牌信息表中的填 充时刻 Tflll, 以 LTadd+ V *Tdelay - TLj更新令牌信息表的令牌数 Tc , 此时, Tflll表示发送报文的时刻, Tc表示发送报文后令牌桶中剩余的令牌数。 本发明的实施例提供的发送报文的设备, 通过延时处理可以使得报 文在延时时间段内至多经过一次令牌填充后就可以实现放行发送, 避免 了报文经过多次填充之后才允许通过的情况出现, 这样通过延时处理能 够减少报文发送过程中对令牌需求的计算次数。 Further, the token processor 31 is further configured to: if the currently available number of tokens T add is smaller than the number of tokens T L required to send the packet, modify the token flag to be negative to indicate that the subsequent packet is not processed; The token flag is modified to be positive at the end of the delay time to indicate that the subsequent message continues to be processed. Further, the token processor 31 is further configured to update the token time T flll in the T n +T delay update token information table, and update the token of the token information table with LT add + V *T dela y - T L j The number T c , at this time, T flll represents the time at which the message is sent, and T c represents the number of remaining tokens in the token bucket after the message is sent. The device for sending a message, which is provided by the embodiment of the present invention, can enable the release of the message after the token is filled in at least one time in the delay period, so as to avoid the message being filled after multiple times. Allow the passage of the situation, so that it can be processed by delay It is enough to reduce the number of calculations of the token demand during the message sending process.
本发明的实施例提供一种发送报文的设备 5 , 参照图 5所示, 该发送 报文的设备 5包括: 至少一个处理器 51、 存储器 52、 通信接口 53和总线 54 , 该至少一个处理器 51、 存储器 52和通信接口 53通过总线 54连接并 完成相互间的通信。  An embodiment of the present invention provides a device 5 for transmitting a message. Referring to FIG. 5, the device 5 for transmitting a message includes: at least one processor 51, a memory 52, a communication interface 53, and a bus 54, the at least one processing The device 51, the memory 52 and the communication interface 53 are connected by a bus 54 and complete communication with each other.
该总线 54可以是工业标准体系结构 ( Industry Standard Architecture , 简称为 ISA ) 总线、 外部设备互连 ( Peripheral Component, 简称为 PCI ) 总线或扩展工业标准体系结构 ( Extended Industry Standard Architecture , 简称为 EISA ) 总线等。 该总线 54可以分为地址总线、 数据总线、 控制总 线等。 为便于表示, 图 5中仅用一条粗线表示, 但并不表示仅有一根总线 或一种类型的总线。 其中:  The bus 54 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. Wait. The bus 54 can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one thick line is shown in Figure 5, but it does not mean that there is only one bus or one type of bus. among them:
存储器 52用于存储可执行程序代码, 该程序代码包括计算机操作指 令。 存储器 52可能包含高速 RAM存储器, 也可能还包括非易失性存储 器 ( non- volatile memory ), 例 口至少一个磁盘存 4诸器。  Memory 52 is for storing executable program code, including computer operating instructions. The memory 52 may include a high speed RAM memory and may also include a non-volatile memory, for example at least one disk memory.
处理器 51可能是一个中央处理器 ( Central Processing Unit, 简称为 CPU ), 或者是特定集成电路 ( Application Specific Integrated Circuit, 简 称为 ASIC ), 或者是被配置成实施本发明实施例的一个或多个集成电路。 通信接口 53 , 主要用于实现本实施例中的装置之间的通信。 其中, 处理器 52用于通过通信接口 53接收报文, 根据报文的长度 计算发送报文需要的令牌数 TL; 处理器 52还用于获取令牌桶中当前可用 令牌数 Tadd; 处理器 52还用于若当前可用令牌数 Tadd小于发送报文需要的 令牌数 TL, 则计算延时时间 Tdelay并开始计时, 延时时间为: TDELAY = ( TL - Tadd)/V;处理器 52还用于当延时时间结束时 ,通过通信接口 54发送报文, 其中 V表示令牌的填充速率。 本发明的实施例提供的发送报文的设备, 通过延时处理可以使得报 文在延时时间段内至多经过一次令牌填充后就可以实现放行发送, 避免 了报文经过多次填充之后才允许通过的情况出现, 这样通过延时处理能 够减少报文发送过程中对令牌需求的计算次数。 The processor 51 may be a Central Processing Unit (CPU), or an Application Specific Integrated Circuit (ASIC), or one or more configured to implement the embodiments of the present invention. integrated circuit. The communication interface 53 is mainly used to implement communication between devices in this embodiment. The processor 52 is configured to receive the packet TL by the communication interface 53 and calculate the number of tokens TL required to send the packet according to the length of the packet. The processor 52 is further configured to obtain the currently available token number T add in the token bucket. The processor 52 is further configured to calculate the delay time T dela y and start timing if the currently available number of tokens T add is less than the number of tokens TL required to send the message, and the delay time is: T DELAY = ( T L - T Add ) / V; The processor 52 is further configured to send a message through the communication interface 54 when the delay time ends, where V represents the filling rate of the token. The device for sending a message, which is provided by the embodiment of the present invention, can enable the release of the message after the token is filled in at least one time in the delay period, so as to avoid the message being filled after multiple times. The case of allowing the passage occurs, so that the delay processing can reduce the number of calculations of the token requirement during the message transmission.
进一步的, 处理器 52 , 还用于从令牌信息表中获取令牌数 Tc和填充 时刻 Tflll, 其中 Tc表示发送完上一报文令牌桶中剩余的令牌数, Tflll表示发 送完上一报文的时刻; 还用于计算接收报文的时刻 1^与填充时刻 Tflll的时 间间隔 dT; 还用于将时间间隔 dT乘以令牌的填充速率 V, 然后向下取整, 再加上令牌数 Tc, 得到当前可用令牌数 Tadd, 即丁^ ^ L dT *VJ。 可选的, 处理器 52, 还用于若当前可用令牌数 Tadd大于或等于发送报 文需要的令牌数 TL , 则以接收报文的时刻 TN更新令牌信息表的填充时刻 Tfm, 以 Tadd-Tj^更新令牌信息表的令牌数 Tc, 并发送报文。 这里因为当前可用令牌数大于或等于报文发送需要消耗的令牌数, 以此本发明的实施例提供的设备支持将报文以正常处理方式发送。 Further, the processor 52 is further configured to obtain the token number T c and the padding from the token information table. Time T flll , where T c indicates the number of tokens remaining in the token bucket of the previous message, T flll indicates the time when the last message was sent; and is also used to calculate the time 1^ and the padding time of the received message. T flll interval dT; is also used to multiply the time interval dT by the token filling rate V, and then round down, plus the number of tokens T c , to obtain the current available number of tokens T add , ie D ^ L dT *VJ. Optionally, the processor 52 is further configured to: if the currently available number of tokens T add is greater than or equal to the number of tokens TL required to send the message, update the padding time T of the token information table at the time T N of receiving the message. fm, in order to update the token T add -Tj ^ token information table number T c, and message transmission. The device provided by the embodiment of the present invention supports sending the packet in a normal processing manner, because the number of currently available tokens is greater than or equal to the number of tokens that are required to be sent by the packet.
可选的, 处理器 52还用于从令牌信息表中获取令牌标志, 当令牌标 志为正时, 用于计算所述延时时间 TdelayOptionally, the processor 52 is further configured to obtain a token flag from the token information table, and when the token flag is positive, used to calculate the delay time Tdelay .
处理器 52,还用于若当前可用令牌数 Tadd小于发送报文需要的令牌数 TL时, 则将令牌标志修改为负, 以表示不处理后续的报文; 在延时时间 结束时将令牌标志修改为正, 以表示继续处理后续报文。 处理器 52 , 还用于以 Tn+Tdelay更新令牌信息表的填充时刻 Tflll , 以 LTadd+ V* Tdelay-TjJ更新令牌信息表的令牌数 Tc, 此时, Tflll表示发送报文 的时刻, Tc表示发送报文后令牌桶中剩余的令牌数。 本发明的实施例提供的发送报文的设备, 通过延时处理可以使得报 文在延时时间段内至多经过一次令牌填充后就可以实现放行发送, 避免 了报文经过多次填充之后才允许通过的情况出现, 这样通过延时处理能 够减少报文发送过程中对令牌需求的计算次数。 The processor 52 is further configured to: if the currently available number of tokens T add is less than the number of tokens T L required to send the message, modify the token flag to be negative to indicate that the subsequent packet is not processed; At the end, the token flag is modified to be positive to indicate that the subsequent message continues to be processed. The processor 52 is further configured to update the padding time T flll of the token information table with T n +T dela y, and update the token number T c of the token information table by LT add + V* T delay -TjJ. T flll indicates the time at which the packet is sent, and T c indicates the number of tokens remaining in the token bucket after the packet is sent. The device for sending a message, which is provided by the embodiment of the present invention, can enable the release of the message after the token is filled in at least one time in the delay period, so as to avoid the message being filled after multiple times. The case of allowing the passage occurs, so that the delay processing can reduce the number of calculations of the token requirement during the message transmission.
上述各实施例提供的发送报文的设备, 可以用于对应执行如图 1和图 2 所示实施例的方法, 对于图 1和图 2所示实施例已经描述的细节, 此处不再贅 述。  The device for sending a message, which is provided in the foregoing embodiments, may be used to perform the method corresponding to the embodiment shown in FIG. 1 and FIG. 2, and the details already described in the embodiment shown in FIG. 1 and FIG. 2 are not described herein. .
本领域普通技术人员可以理解: 实现上述方法实施例的全部或部分 步骤可以通过程序指令相关的硬件来完成, 前述的程序可以存储于一计 算机可读取存储介质中, 该程序在执行时, 执行包括上述方法实施例的 步骤; 而前述的存储介质包括: ROM、 RAM, 磁碟或者光盘等各种可以 存储程序代码的介质。 以上所述, 仅为本发明的具体实施方式, 但本发明的保护范围并不 局限于此, 任何熟悉本技术领域的技术人员在本发明揭露的技术范围内, 可轻易想到变化或替换, 都应涵盖在本发明的保护范围之内。 因此, 本 发明的保护范围应以所述权利要求的保护范围为准。 A person skilled in the art can understand that all or part of the steps of implementing the above method embodiments may be completed by using hardware related to program instructions, and the foregoing program may be stored in a computer readable storage medium, and the program is executed when executed. The foregoing steps include the steps of the foregoing method embodiments; and the foregoing storage medium includes: a medium that can store program codes, such as a ROM, a RAM, a magnetic disk, or an optical disk. The above is only the specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily think of changes or substitutions within the technical scope of the present invention. It should be covered by the scope of the present invention. Therefore, the scope of the invention should be determined by the scope of the appended claims.

Claims

权 利 要 求 书 Claim
1、 一种发送报文的方法, 其特征在于, 包括: 接收报文, 根据所述报文的长度计算发送所述报文需要的令牌数 TL; 获取令牌桶中的当前可用令牌数 Tadd; 若所述当前可用令牌数 TADD小于发送所述报文需要的令牌数 TL, 则计 算延时时间 Tdelay并开始计时, 所述延时时间为:丁(1 = ( ^ -丁£1(1(1)/¥ , 其中 V表示令牌的填充速率; A method for sending a message, comprising: receiving a message, calculating a number of tokens TL required to send the message according to the length of the packet; acquiring a currently available token in the token bucket The number T add ; if the currently available number of tokens T ADD is smaller than the number of tokens TL required to send the message, calculate the delay time T delay and start timing, the delay time is: D (1 = ( ^ -丁£1(1(1 )/¥ , where V represents the fill rate of the token;
当所述延时时间结束时, 发送所述 ^艮文。  When the delay time ends, the message is sent.
2、 根据权利要求 1所述的方法, 其特征在于, 所述获取令牌桶中的 当前可用令牌数! ^, 具体包括: 从令牌信息表中获取令牌数 Tc和填充时刻 Tflll, 其中 Tc表示发送完上 一报文所述令牌桶中剩余的令牌数, Tflll表示发送完上一报文的时刻; 计算接收所述报文的时刻 1^与所述填充时刻 Tflll的时间间隔 dT; 将所述时间间隔 dT乘以所述令牌的填充速率 V, 然后向下取整, 再加 上所述令牌数 Tc , 得到所述当前可用令牌数 Tadd, 即丁^二丁 LdT*Vj。 2. The method according to claim 1, wherein the obtaining the number of currently available tokens in the token bucket! ^, specifically comprising: obtaining the number of tokens T c and the filling time T flll from the token information table, where T c represents the number of tokens remaining in the token bucket after the last message is sent, and T flll indicates that the transmission is completed. a time interval of the previous message; calculating a time interval dT of the time 1^ of receiving the message and the filling time T flll ; multiplying the time interval dT by the filling rate V of the token, and then taking down In addition, the number of tokens T c is added , and the currently available number of tokens T add is obtained , that is, the number of tokens TdT*Vj.
3、 根据权利要求 2所述的方法, 其特征在于, 所述方法还包括: 从所述令牌信息表中获取令牌标志, 当所述令牌标志为正时, 执行 所述计算延时时间的步骤。  The method according to claim 2, wherein the method further comprises: acquiring a token flag from the token information table, and performing the calculation delay when the token flag is positive The steps of time.
4、 根据权利要求 3所述的方法, 其特征在于, 所述方法还包括: 若 所述当前可用令牌数 TADD小于发送所述报文需要的令牌数 TL, 则将所述令 牌标志修改为负, 以表示不处理后续的报文; 在所述延时时间结束时将 所述令牌标志修改为正, 以表示继续处理后续报文。 The method according to claim 3, wherein the method further comprises: if the currently available number of tokens T ADD is smaller than a number of tokens TL required to send the message, the token is The flag is modified to be negative to indicate that the subsequent message is not processed; the token flag is modified to be positive at the end of the delay time to indicate that the subsequent message is processed.
5、 根据权利要求 2至 4任一所述的方法, 其特征在于, 所述方法还 包括:  The method according to any one of claims 2 to 4, wherein the method further comprises:
以 Tn+Tdelay更新所述令牌信息表中的填充时刻 Tflll , 以 L Tadd+ V* Tdelay-TjJ更新所述令牌信息表的令牌数 Te , 此时, Tflll表示发送所述报文 Updating the padding time T flll in the token information table with T n +T delay, and updating the token number T e of the token information table by LT add + V* T delay -TjJ, at this time, T flll represents Send the message
6、 根据权利要求 2所述的方法, 其特征在于, 所述方法还包括: 若所述当前可用令牌数 Tadd大于或等于发送所述报文需要的令牌数 TL, 则以接收所述报文的时刻 Tn更新所述令牌信息表的填充时刻 Tflll, 以The method according to claim 2, wherein the method further comprises: If the currently available number of tokens T add is greater than or equal to the number of tokens T L required to send the message, the padding time T flll of the token information table is updated at the time T n when the message is received. Take
TADD-TL更新所述令牌信息表的令牌数^ , 并发送所述报文。 T ADD -TL updates the token number ^ of the token information table and transmits the message.
7、 一种发送报文的设备, 其特征在于, 包括: 令牌处理器和延时器, 其巾: 所述令牌处理器, 用于接收报文, 根据所述报文的长度计算发送所 述报文需要的令牌数 TL; 并获取令牌桶中的当前可用令牌数 TADD; A device for transmitting a message, comprising: a token processor and a delay device, wherein: the token processor is configured to receive a message, and calculate and send according to the length of the packet The number of tokens required by the packet is TL; and the number of currently available tokens T ADD in the token bucket is obtained;
所述延时器, 用于若所述令牌处理器获取的所述当前可用令牌数 Tadd 小于发送所述报文需要的令牌数 TL , 则计算延时时间 TDELAY并开始计时, 所述延时时间为: Tdelay = ( TL - Tadd)/V , 其中 V表示令牌的填充速率; 所述令牌处理器, 还用于当所述延时时间结束时, 发送所述报文。The delay device is configured to calculate a delay time T DELAY and start timing if the current available token number T add obtained by the token processor is smaller than a token number TL required to send the packet, The delay time is: T delay = ( T L - T add ) / V , where V represents the filling rate of the token; the token processor is further configured to send the location when the delay time ends. Said message.
8、 根据权利要求 7所述的设备, 所述令牌处理器还包括: 8. The device of claim 7, the token processor further comprising:
令牌信息获取单元, 用于从令牌信息表中获取令牌数 Tc和填充时刻 Tfm, 其中 Tc表示发送完上一报文所述令牌桶中剩余的令牌数, Tflll表示发 送完上一报文的时刻; 计时单元, 用于计算接收所述报文的时刻 Tn与所述填充时刻 Tflll的时 间间隔 dT; The token information obtaining unit is configured to obtain the number of tokens T c and the filling time T fm from the token information table, where T c represents the number of tokens remaining in the token bucket after the last packet is sent, T flll After the transmission time indicates a packet; timing unit, for calculating the packet receiving time T n T flll with the filling time interval dT;
令牌计算单元, 用于将所述时间间隔 dT乘以所述令牌的填充速率 V, 然后向下取整, 再加上所述令牌数 Tc , 得到所述当前可用令牌数 Tadd, 即 Tadd =TC+ LdT *VJ。 a token calculation unit, configured to multiply the time interval dT by the filling rate V of the token, and then round down, and add the number of tokens T c to obtain the currently available number of tokens T Add , ie T add =T C + LdT *VJ.
9、 根据权利要求 8所述的设备, 其特征在于, 所述延时器, 还用于 从所述令牌信息表中获取令牌标志, 当所述令牌标志为正时, 则用于计 算所述延时时间 TdelayThe device according to claim 8, wherein the delay device is further configured to acquire a token flag from the token information table, and when the token flag is positive, The delay time Tdelay is calculated.
10、 根据权利要求 9 所述的设备, 其特征在于, 所述令牌处理器, 还用于若所述当前可用令牌数 TADD小于发送所述报文需要的令牌数 TL时, 则将所述令牌标志修改为负, 以表示不处理后续的报文; 在所述延时时 间结束时将所述令牌标志修改为正, 以表示继续处理后续报文。 The device according to claim 9, wherein the token processor is further configured to: if the currently available number of tokens T ADD is smaller than a number of tokens TL required to send the packet, The token flag is modified to be negative to indicate that the subsequent message is not processed; the token flag is modified to be positive at the end of the delay time to indicate that the subsequent message is processed.
1 1、 根据权利要求 8至 10任一所述的设备, 其特征在于, 所述令牌 处理器, 还用于以 Tn+Tdelay更新所述令牌信息表中的填充时刻 Tflll , 以 LTadd+ v *Tdelay -Tjj更新所述令牌信息表的令牌数 Tc, 此时, Tflll表示发 The device according to any one of claims 8 to 10, wherein the token processor is further configured to update a filling time T flll in the token information table with T n +T delay , Take LT add + v *T delay -Tjj updates the token number T c of the token information table, at which time T flll indicates
12、 根据权利要求 8 所述的设备, 其特征在于, 所述令牌处理器, 还用于若所述当前可用令牌数 Tadd大于或等于发送所述报文需要的令牌 数 TL , 则以接收所述报文的时刻 TN更新所述令牌信息表的填充时刻 TFLLL , 以 Tadd-TL更新所述令牌信息表的令牌数 Tc , 然后发送所述报文。 The device according to claim 8, wherein the token processor is further configured to: if the currently available number of tokens T add is greater than or equal to the number of tokens TL required to send the packet, Then , the padding time T FLLL of the token information table is updated at the time T N when the message is received, the number of tokens T c of the token information table is updated by T add -TL , and then the message is transmitted.
13、 一种发送报文的设备, 其特征在于, 包括: 至少一个处理器、 存储器、 通信接口和总线, 该至少一个处理器、 存储器和通信接口通过 所述总线连接并完成相互间的通信, 其中: 13. A device for transmitting a message, comprising: at least one processor, a memory, a communication interface, and a bus, wherein the at least one processor, the memory, and the communication interface are connected by the bus and complete communication with each other, among them:
所述处理器用于通过所述通信接口接收报文, 根据所述报文的长度 计算发送所述报文需要的令牌数 TL; 用于获取令牌桶中的当前可用令牌 数丁^, 若所述当前可用令牌数 TADD小于发送所述报文需要的令牌数 TL , 则计算延时时间 Tdelay并开始计时, 所述延时时间为: Tdelay = ( TL - Tadd)/V, 其中 V表示令牌的填充速率; The processor is configured to receive a packet by using the communication interface, and calculate a number of tokens TL required to send the packet according to the length of the packet; If the currently available number of tokens T ADD is smaller than the number of tokens TL required to send the message, the delay time T delay is calculated and started, and the delay time is: T delay = ( T L - T add ) /V, where V represents the fill rate of the token;
所述处理器还用于当所述延时时间结束时, 通过所述通信接口发送 所述报文。  The processor is further configured to send the message through the communication interface when the delay time ends.
14、 根据权利要求 13所述的设备, 所述处理器还用于从令牌信息表 中获取令牌数 Tc和填充时刻 Tflll, 其中 Tc表示发送完上一报文令牌桶中剩 余的令牌数, Tflll表示发送完上一报文的时刻; 还用于计算接收所述报文 的时刻 Tn与所述填充时刻 Tfill的时间间隔 dT; 还用于将所述时间间隔 dT乘 以所述令牌的填充速率 V, 然后向下取整, 再加上所述令牌数 Tc , 得到所 述当前可用令牌数 Tadd, 即 Tadd =Tc+ L dT *VJ。 The device according to claim 13, wherein the processor is further configured to obtain the number of tokens T c and the filling time T fl11 from the token information table, where T c indicates that the last packet is sent in the token bucket. The remaining number of tokens, T flll represents the time when the last message was sent; and is also used to calculate the time interval dT between the time T n of receiving the message and the filling time T fill ; The interval dT is multiplied by the filling rate V of the token, and then rounded down, and the number of tokens T c is added to obtain the currently available number of tokens T add , that is, T add =T c + L dT *VJ.
15、 根据权利要求 14所述的设备, 其特征在于, 所述处理器还用于 从所述令牌信息表中获取令牌标志, 当所述令牌标志为正时, 用于计算 所述延时时间 TdelayThe device according to claim 14, wherein the processor is further configured to acquire a token flag from the token information table, and when the token flag is positive, used to calculate the Delay time T delay .
16、 根据权利要求 15所述的设备, 其特征在于, 所述处理器还用于 若所述当前可用令牌数 TADD小于发送所述报文需要的令牌数 TL, 则将所述 令牌标志修改为负, 以表示不处理后续的报文; 在所述延时时间结束时 将所述令牌标志修改为正, 以表示继续处理后续报文。 The device according to claim 15, wherein the processor is further configured to: if the current available number of tokens T ADD is smaller than a number of tokens TL required to send the message, The card flag is modified to be negative to indicate that the subsequent message is not processed; the token flag is modified to be positive at the end of the delay time to indicate that the subsequent message is processed.
17、 根据权利要求 14至 16任一所述的设备, 其特征在于, 所述处 理器还用于以 Tn+Tdelay更新所述令牌信息表中的填充时刻 Tflll,以 LTadd+v* Tdelay-TjJ更新所述令牌信息表的令牌数 Te, 此时, Tflll表示发送所述报文 17. Apparatus according to any one of claims 14 to 16 wherein said The processor is further configured to update the padding time T flll in the token information table with T n +T delay, and update the token number T e of the token information table by LT add +v* T delay -TjJ , T flll indicates that the message is sent.
18、 根据权利要求 14所述的设备, 其特征在于, 所述处理器还用于 若所述当前可用令牌数 TADD大于或等于发送所述报文需要的令牌数 TL, 则 以接收所述报文的时刻 Tn更新所述令牌信息表的填充时刻 Tflll , 以 Tadd-TL 更新所述令牌信息表的令牌数 Te , 并发送所述报文。 The device according to claim 14, wherein the processor is further configured to: if the currently available number of tokens T ADD is greater than or equal to the number of tokens TL required to send the message, receive the message updating the time T n is the time of filling the token information table T flll, the number of tokens T add -T L updating the token information table T e, and transmits the packet.
PCT/CN2012/084474 2012-11-12 2012-11-12 Packet transmission method and device WO2014071636A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2012/084474 WO2014071636A1 (en) 2012-11-12 2012-11-12 Packet transmission method and device
CN201280002899XA CN103229465A (en) 2012-11-12 2012-11-12 Message sending method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2012/084474 WO2014071636A1 (en) 2012-11-12 2012-11-12 Packet transmission method and device

Publications (1)

Publication Number Publication Date
WO2014071636A1 true WO2014071636A1 (en) 2014-05-15

Family

ID=48838350

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2012/084474 WO2014071636A1 (en) 2012-11-12 2012-11-12 Packet transmission method and device

Country Status (2)

Country Link
CN (1) CN103229465A (en)
WO (1) WO2014071636A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114338434A (en) * 2020-09-25 2022-04-12 深圳市中兴微电子技术有限公司 Excitation message sending method and device, electronic equipment and storage medium

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104580004B (en) * 2014-12-24 2017-12-01 盛科网络(苏州)有限公司 The device and method of traffic shaping is realized using non-integer token
US20180212885A1 (en) * 2017-01-20 2018-07-26 Google Inc. Device and method for scalable traffic shaping at a receiver with a time-indexed data structure
CN108768572B (en) * 2018-04-13 2019-11-08 烽火通信科技股份有限公司 A kind of timestamp generation system and method based on token
CN114979012A (en) * 2022-05-31 2022-08-30 济南浪潮数据技术有限公司 Network flow current limiting method, system, device and computer storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1601963A (en) * 2003-09-26 2005-03-30 华为技术有限公司 Access rate limiting method based on token pail algorithm
CN1852227A (en) * 2005-08-25 2006-10-25 华为技术有限公司 Method for effectively preventing attack of network apparatus
CN101026561A (en) * 2007-02-09 2007-08-29 中兴通讯股份有限公司 Token bucket fill rate configuration method and device
US7457313B2 (en) * 2000-09-25 2008-11-25 General Instrument Corporation Hierarchical prioritized round robin (HPRR) scheduling

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100471176C (en) * 2006-09-12 2009-03-18 华为技术有限公司 Queue dispatch method and equipment
CN102413042A (en) * 2011-11-14 2012-04-11 盛科网络(苏州)有限公司 Timestamp-updating-token-bucket-based traffic policing method and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7457313B2 (en) * 2000-09-25 2008-11-25 General Instrument Corporation Hierarchical prioritized round robin (HPRR) scheduling
CN1601963A (en) * 2003-09-26 2005-03-30 华为技术有限公司 Access rate limiting method based on token pail algorithm
CN1852227A (en) * 2005-08-25 2006-10-25 华为技术有限公司 Method for effectively preventing attack of network apparatus
CN101026561A (en) * 2007-02-09 2007-08-29 中兴通讯股份有限公司 Token bucket fill rate configuration method and device

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114338434A (en) * 2020-09-25 2022-04-12 深圳市中兴微电子技术有限公司 Excitation message sending method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN103229465A (en) 2013-07-31

Similar Documents

Publication Publication Date Title
TWI336576B (en) A scheduler system and method thereof
WO2014071636A1 (en) Packet transmission method and device
JP5275466B2 (en) Method and apparatus for providing a modified timestamp in a communication system
CN102932920B (en) Radio resource scheduling request (SR) configuration method and device
CN104168081B (en) A kind of document transmission method and device
CN102932919B (en) The resource allocation method and device of uplink sounding reference signal
WO2011023068A1 (en) Device, method and related device for obtaining service content for personal network equipment
CN107342848A (en) A kind of adaptive code stream transmission method, device and equipment
JP2011192068A5 (en) Programmable controller and master communication circuit
WO2017161967A1 (en) Method of monitoring data traffic in packets per second, device, and computer storage medium
CN106559735A (en) Blue-teeth data sending control method and device
WO2013114157A1 (en) Method and apparatus for preserving physical uplink control channel resources
CN109314630B (en) Link processing method, device and storage medium
WO2011026281A1 (en) Method for resending short message and short message service center
WO2021063191A1 (en) Packet forwarding method, device and system
JP2017163316A (en) Information processor
CN107710810A (en) The inactive process of the equipment of business with delay-tolerant
WO2021119675A2 (en) Guaranteed latency based forwarding
WO2014131335A1 (en) Data transmission method and data forwarding apparatus
CN107517167B (en) Data transmission control method and device and SoC chip
WO2014067322A1 (en) Method for sending message and device thereof
WO2015127717A1 (en) Traffic control method and device, and computer storage medium
JP2007243239A (en) Communication apparatus and communication method
CN115550173A (en) Dynamic calculation communication scheduling method based on WFBP and link characteristics
CN111385219B (en) Method for realizing high-performance high-precision software TCP speed limit by hardware interrupt

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 12887893

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 12887893

Country of ref document: EP

Kind code of ref document: A1