[go: up one dir, main page]

CN108206787A - A kind of congestion-preventing approach and device - Google Patents

A kind of congestion-preventing approach and device Download PDF

Info

Publication number
CN108206787A
CN108206787A CN201611171554.3A CN201611171554A CN108206787A CN 108206787 A CN108206787 A CN 108206787A CN 201611171554 A CN201611171554 A CN 201611171554A CN 108206787 A CN108206787 A CN 108206787A
Authority
CN
China
Prior art keywords
data packet
time
time stamp
value
type
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN201611171554.3A
Other languages
Chinese (zh)
Inventor
王晓明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Huawei Digital Technologies Co Ltd
Original Assignee
Beijing Huawei Digital Technologies Co Ltd
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 Beijing Huawei Digital Technologies Co Ltd filed Critical Beijing Huawei Digital Technologies Co Ltd
Priority to CN201611171554.3A priority Critical patent/CN108206787A/en
Publication of CN108206787A publication Critical patent/CN108206787A/en
Pending legal-status Critical Current

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/12Avoiding congestion; Recovering from congestion
    • 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/23Bit dropping
    • 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/29Flow control; Congestion control using a combination of thresholds
    • 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/32Flow control; Congestion control by discarding or delaying data units, e.g. packets or frames

Landscapes

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

Abstract

The invention discloses a kind of congestion-preventing approach and devices, belong to field of communication technology.The method includes:Data packet to receive sets the time to mark;The data packet is stored in buffer queue;It is whether overtime according to data packet described in the time marker for judgment of the data packet;When the data packet time-out, the data packet is abandoned from the buffer queue.The present invention passes through when receiving data packet, the time is set to mark for it, then the data packet marked there is provided the time is stored in buffer queue, when going out time time-out of the data packet in buffer queue according to time marker for judgment, data packet is abandoned from buffer queue, do so avoid the data packet in buffer queue can not go out team always due to system performance reasons caused by time delay it is excessive, while reduce data packet to system performance occupy.

Description

一种拥塞避免方法和装置A congestion avoidance method and device

技术领域technical field

本发明涉及通信技术领域,特别涉及一种拥塞避免方法和装置。The invention relates to the field of communication technology, in particular to a congestion avoidance method and device.

背景技术Background technique

随着网络的普及,信息交流与信息共享成为人们日常生活中必不可少的一部分。而网络中信息(数据包)的不断增长,必然引起网络拥塞。于是,拥塞避免显得尤为重要,目前使用得比较广泛的拥塞避免机制包括尾丢弃(英文:Tail-Drop)、随机先期检测(英文:Random Early Detection,简称:RED)、加权随机先期检测(英文:Weighted Random EarlyDetection,简称:WRED)等。With the popularity of the Internet, information exchange and information sharing have become an indispensable part of people's daily life. The continuous growth of information (data packets) in the network will inevitably cause network congestion. Therefore, congestion avoidance is particularly important. The currently widely used congestion avoidance mechanisms include tail drop (English: Tail-Drop), random early detection (English: Random Early Detection, referred to as: RED), weighted random early detection (English: Weighted Random Early Detection, referred to as: WRED) and so on.

其中,尾丢弃、RED和WRED都是在队列的长度达到设定阈值时,将等待入队的数据包全部丢弃、部分丢弃或者按照优先级将低优先级的数据包丢弃。Among them, tail drop, RED and WRED all discard all or part of the data packets waiting to enter the queue when the length of the queue reaches the set threshold, or discard low-priority data packets according to the priority.

在上述拥塞避免方案中,对于已经进入队列的数据包,可能由于系统性能原因而一直无法出队,这些缓存在队列中的数据包可能会时延过大,达不到时延的要求,另外,数据包长时间缓存在队列也占用了系统的性能。In the above congestion avoidance scheme, for the data packets that have entered the queue, they may not be able to leave the queue due to system performance reasons. , The data packets are cached in the queue for a long time, which also takes up the performance of the system.

发明内容Contents of the invention

为了解决现有技术中缓存在队列中的数据包可能会时延过大,占用了系统的性能的问题,本发明实施例提供了一种拥塞避免方法和装置。所述技术方案如下:In order to solve the problem in the prior art that the data packets buffered in the queue may have too long delay and occupy the performance of the system, the embodiments of the present invention provide a congestion avoidance method and device. Described technical scheme is as follows:

第一方面,本发明实施例提供了一种拥塞避免方法,所述方法包括:为接收到的数据包设置时间标记,所述时间标记用于判断所述数据包在缓存中的时间是否超时;将所述数据包存入缓存队列中;根据所述数据包的时间标记判断所述数据包是否超时;当所述数据包超时时,将所述数据包从所述缓存队列中丢弃。In a first aspect, an embodiment of the present invention provides a congestion avoidance method, the method comprising: setting a time stamp for a received data packet, and the time stamp is used to determine whether the time of the data packet in the buffer has expired; storing the data packet in a cache queue; judging whether the data packet times out according to the time stamp of the data packet; when the data packet times out, discarding the data packet from the cache queue.

本发明通过在接收到数据包时,为其设置时间标记,然后将设置了时间标记的数据包存入缓存队列中,在根据时间标记判断出数据包在缓存队列中的时间超时时,将数据包从缓存队列中丢弃,这样做避免缓存队列中的数据包由于系统性能原因一直无法出队造成的时延过大,同时减小了数据包对系统性能占用。The present invention sets a time stamp for the data packet when it is received, and then stores the data packet with the time stamp in the cache queue, and when it is judged that the time of the data packet in the cache queue is overtime according to the time stamp, the data packet is stored in the cache queue. Packets are discarded from the cache queue. This avoids the excessive delay caused by the fact that the data packets in the cache queue cannot be dequeued due to system performance reasons, and at the same time reduces the occupation of the system performance by the data packets.

结合第一方面,在第一方面的第一种实现方式中,所述为接收到的数据包设置时间标记,包括:判断所述数据包的类型;当所述数据包的类型为设定类型时,为所述数据包设置时间标记。在该实现方式中,在设置时间标记前,先判断数据包的类型,只有在数据包为设定类型时,才为其设置时间标记,从而实现了对时延要求不同的业务差异化处理。With reference to the first aspect, in the first implementation manner of the first aspect, setting the time stamp for the received data packet includes: judging the type of the data packet; when the type of the data packet is the set type , set a timestamp for the data packet. In this implementation, before setting the time stamp, the type of the data packet is judged first, and only when the data packet is of the set type, the time stamp is set for it, thereby realizing differentiated processing of services with different delay requirements.

结合第一方面的第一种实现方式,在第一方面的第二种实现方式中,所述判断所述数据包的类型,包括:根据所述数据包包头中的字段判断所述数据包的类型;或者,根据所述数据包的大小判断所述数据包的类型。在该实现方式中,通过数据包包头的字段或者数据包的大小,判断所述数据包的类型,判断方式简单,判断结果准确。With reference to the first implementation of the first aspect, in the second implementation of the first aspect, the judging the type of the data packet includes: judging the type of the data packet according to the field in the header of the data packet type; or, judging the type of the data packet according to the size of the data packet. In this implementation manner, the type of the data packet is judged by the field of the header of the data packet or the size of the data packet, the judgment method is simple, and the judgment result is accurate.

其中,数据包的类型可以是业务类型,也可以是长度类型(数据包长度)。其中,业务类型可以是语音数据包、IPTV数据包等。长度类型可以为小于1500字节、1500-9600字节等。根据数据包包头中的字段可以判断出数据包的业务类型,根据数据包的大小可以判断出数据包的长度类型。Wherein, the type of the data packet may be a service type or a length type (data packet length). Wherein, the service type may be a voice data packet, an IPTV data packet, and the like. The length type can be less than 1500 bytes, 1500-9600 bytes, etc. The service type of the data packet can be judged according to the fields in the header of the data packet, and the length type of the data packet can be judged according to the size of the data packet.

结合第一方面的第一种实现方式,在第一方面的第三种实现方式中,所述为所述数据包设置时间标记,包括:存储所述数据包的标识及其对应的时间标记。With reference to the first implementation manner of the first aspect, in a third implementation manner of the first aspect, setting a time stamp for the data packet includes: storing an identifier of the data packet and a corresponding time stamp.

例如,可以采用链表等存储结构存储所述数据包的标识及其对应的时间标记。For example, a storage structure such as a linked list may be used to store the identifier of the data packet and its corresponding time stamp.

其中,数据包的标识可以是所述数据包的编号。Wherein, the identifier of the data packet may be the number of the data packet.

结合第一方面或第一方面的第一种实现方式至第三种实现方式中的任一项,在第一方面的第四种实现方式中,所述时间标记的初始值为0,且所述时间标记随时间逐渐增大;或者,所述时间标记的初始值为时间阈值,且所述时间标记随时间逐渐减小;或者,所述时间标记为设置所述时间标记时的时间值。In combination with the first aspect or any one of the first to third implementations of the first aspect, in the fourth implementation of the first aspect, the initial value of the time stamp is 0, and the The time stamp gradually increases with time; or, the initial value of the time stamp is a time threshold, and the time stamp gradually decreases with time; or, the time stamp is a time value when the time stamp is set.

在该实现方式中,时间标记包括三种实现方式,对于时间标记随时间逐渐增大或逐渐减小的方式,判断是否超时时较为简单;对于采用当前时间值作为时间标记的方式,时间标记设置较为简单。In this implementation, the time stamp includes three implementations. For the way that the time stamp gradually increases or decreases with time, it is relatively simple to judge whether it is timed out; for the way that uses the current time value as the time stamp, the time stamp setting Simpler.

结合第一方面的第四种实现方式,在第一方面的第五种实现方式中,所述根据所述数据包的时间标记判断所述数据包是否超时,包括:判断所述时间标记的值是否达到所述时间阈值,当所述时间标记的值达到所述时间阈值时,判断所述数据包超时;或者,判断所述时间标记的值是否减小到0,当所述时间标记的值减小到0时,判断所述数据包超时;或者,判断当前时间值与所述时间标记中设置所述时间标记时的时间值的差值是否大于或等于所述时间阈值,当所述差值大于或等于所述时间阈值时,判断所述数据包超时。With reference to the fourth implementation of the first aspect, in the fifth implementation of the first aspect, the judging whether the data packet times out according to the time stamp of the data packet includes: judging the value of the time stamp Whether the time threshold is reached, when the value of the time stamp reaches the time threshold, it is judged that the data packet has timed out; or, it is judged whether the value of the time stamp is reduced to 0, when the value of the time stamp When it decreases to 0, it is judged that the data packet has timed out; or, it is judged whether the difference between the current time value and the time value when the time stamp is set in the time stamp is greater than or equal to the time threshold, when the difference When the value is greater than or equal to the time threshold, it is determined that the data packet times out.

在该实现方式中,提供了三种时间标记的实现方式所对应的判断超时方法。In this implementation manner, methods for judging timeout corresponding to three implementation manners of time stamps are provided.

进一步地,对于不同类型的数据包,时间阈值设置可以不同,从而实现运营商对不同业务的灵活配置,提高网络带宽利用率,减少不必要的缓存占用。Furthermore, for different types of data packets, the time threshold can be set differently, so as to realize the flexible configuration of different services by the operator, improve the utilization rate of network bandwidth, and reduce unnecessary cache occupation.

结合第一方面或第一方面的第一种实现方式至第三种实现方式中的任一项,在第一方面的第六种实现方式中,所述方法还包括:删除所述数据包后的一个或连续至少两个数据包,所述数据包后的一个或连续至少两个数据包与所述数据包的类型相同。例如,数据包1、2和3为队列中连续的三个数据包,数据包1处在最前,这三个数据包的类型相同,此时,如果判断出数据包1超时,则将数据包1、2和3一起丢弃。这样做减少了对数据包2和3的超时判断,减小了处理量。In combination with the first aspect or any one of the first to third implementations of the first aspect, in the sixth implementation of the first aspect, the method further includes: after deleting the data packet One or at least two consecutive data packets, and one or at least two consecutive data packets following the data packet are of the same type as the data packet. For example, data packets 1, 2 and 3 are three consecutive data packets in the queue, and data packet 1 is at the front, and the types of these three data packets are the same. At this time, if it is judged that data packet 1 times out, the data packet 1, 2 and 3 are discarded together. Doing so reduces the timeout judgment on data packets 2 and 3 and reduces the amount of processing.

第二方面,本发明实施例提供了一种拥塞避免装置,所述装置包括用于实现上述第一方面所述的方法的单元,例如设置单元、缓存单元、判断单元和处理单元。In a second aspect, an embodiment of the present invention provides a congestion avoidance device, which includes units for implementing the method described in the first aspect, such as a setting unit, a cache unit, a judging unit, and a processing unit.

第三方面,本发明实施例提供了一种拥塞避免装置,所述拥塞避免装置包括处理器、存储器以及通信接口;所述处理器、存储器以及通信接口通过总线耦合;所述存储器用于存储程序指令,所述处理器通过执行存储在所述存储器内的程序指令使得所述拥塞避免装置能够执行第一方面所述的方法。In a third aspect, an embodiment of the present invention provides a congestion avoidance device, the congestion avoidance device includes a processor, a memory, and a communication interface; the processor, the memory, and the communication interface are coupled through a bus; the memory is used to store programs Instructions, the processor enables the congestion avoidance device to execute the method described in the first aspect by executing program instructions stored in the memory.

第四方面,本发明实施例还提供了一种计算机可读介质,用于存储供拥塞避免装置执行的程序代码,所述程序代码包括执行第一方面所述的方法的指令。In a fourth aspect, an embodiment of the present invention further provides a computer-readable medium, which is used to store program codes for execution by a congestion avoidance device, where the program codes include instructions for executing the method described in the first aspect.

第五方面,本发明实施例还提供了一种通信芯片,应用在通信系统设备中,所述通信芯片包括:处理器、存储器以及通信接口;所述处理器、存储器以及通信接口通过总线耦合,所述存储器用于存储程序指令,所述处理器通过执行存储在所述存储器内的程序指令使得装载有所述通信芯片的通信系统设备能够执行如上述第一方面中任意一种可能的实施方式提供的方法。In the fifth aspect, the embodiment of the present invention also provides a communication chip, which is applied in communication system equipment, and the communication chip includes: a processor, a memory, and a communication interface; the processor, the memory, and the communication interface are coupled through a bus, The memory is used to store program instructions, and the processor executes the program instructions stored in the memory so that the communication system equipment loaded with the communication chip can execute any possible implementation manner in the first aspect above provided method.

附图说明Description of drawings

图1是本发明实施例提供的数据包存储示意图;FIG. 1 is a schematic diagram of data packet storage provided by an embodiment of the present invention;

图2是本发明实施例提供的一种拥塞避免装置的硬件结构示意图;FIG. 2 is a schematic diagram of a hardware structure of a congestion avoidance device provided by an embodiment of the present invention;

图3是本发明实施例提供的一种拥塞避免方法流程图;FIG. 3 is a flowchart of a congestion avoidance method provided by an embodiment of the present invention;

图4是本发明实施例提供的另一种拥塞避免方法流程图;FIG. 4 is a flowchart of another congestion avoidance method provided by an embodiment of the present invention;

图4A是本发明实施例提供的数据包处理过程图;FIG. 4A is a diagram of a data packet processing process provided by an embodiment of the present invention;

图5是本发明实施例提供的一种通信装置的结构示意图;FIG. 5 is a schematic structural diagram of a communication device provided by an embodiment of the present invention;

图6是本发明实施例提供的一种通信芯片的结构示意图。Fig. 6 is a schematic structural diagram of a communication chip provided by an embodiment of the present invention.

具体实施方式Detailed ways

为使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本发明实施方式作进一步地详细描述。In order to make the object, technical solution and advantages of the present invention clearer, the implementation manner of the present invention will be further described in detail below in conjunction with the accompanying drawings.

为了便于实施例的描述,下面先对拥塞避免的场景进行简单说明:In order to facilitate the description of the embodiment, the following briefly describes the congestion avoidance scenario:

图1是本发明实施例提供的数据包缓存示意图,如图1所示,路由器或者计算机的读取模块用于从缓存队列中取数据包,数据包采用先进先出(英文:First Input FirstOutput,简称:FIFO)的形式存储在缓存队列中,数据包1先入队则会先出队。数据包进入队列的过程,和读取模块从缓存队列中取数据包的速度通常并不相等。比如说,在非拥塞的系统中,很少有机会把数据包保留在缓存队列中,每个数据包都被读取模块及时处理了,只有当读取模块性能不足或发生故障时,进入缓存队列的数据包,才会迟迟得不到出队机会,当数据包读取模块恢复正常时,缓存的数据包很可能对于网络来说已经时延过大,没有必要再耗费性能来处理,所以主动丢弃时延过大数据包,对于系统性能是有益处的。本发明正是基于丢弃队列中时延过大数据包的思路实现的,具体参见后文。Fig. 1 is the schematic diagram of data packet cache that the embodiment of the present invention provides, as shown in Fig. 1, the reading module of router or computer is used for getting data packet from cache queue, and data packet adopts first in first out (English: First Input First Output, Abbreviation: FIFO) is stored in the cache queue, and data packet 1 enters the queue first and then leaves the queue first. The process of data packets entering the queue is usually not equal to the speed at which the reading module fetches data packets from the cache queue. For example, in a non-congested system, there is little opportunity to keep packets in the cache queue, each packet is processed by the reading module in a timely manner, and only enters the cache when the reading module performance is insufficient or fails The data packets in the queue will not get the opportunity to leave the queue for a long time. When the data packet reading module returns to normal, the cached data packets are likely to have too much delay for the network, and there is no need to consume performance to process them. Therefore, it is beneficial to system performance to actively discard data packets with excessive delay. The present invention is realized based on the idea of discarding the data packets with too long delay in the queue, see the following for details.

本发明实施例提出的拥塞避免方案既可以应用在固网技术中,也可以应用在Linux消息通信和计算机任务处理中。具体可以应用在路由器、计算机等设备中。The congestion avoidance scheme proposed by the embodiment of the present invention can be applied not only in fixed network technology, but also in Linux message communication and computer task processing. Specifically, it can be applied to devices such as routers and computers.

下面结合具体的硬件结构对实现本发明实施例提供的拥塞避免装置进行说明。The implementation of the congestion avoidance device provided by the embodiment of the present invention will be described below in combination with a specific hardware structure.

图2示出了实现本发明实施例提供的一种拥塞避免装置120的硬件结构,该拥塞避免装置120可以为路由器、计算机等。如图2所示,该拥塞避免装置120包括:处理器21、通信接口22、存储器23。FIG. 2 shows a hardware structure for implementing a congestion avoidance device 120 provided by an embodiment of the present invention. The congestion avoidance device 120 may be a router, a computer, or the like. As shown in FIG. 2 , the congestion avoidance device 120 includes: a processor 21 , a communication interface 22 , and a memory 23 .

处理器21包括一个或者一个以上处理核心,处理器21通过运行软件程序以及模块,从而执行各种功能应用以及信息处理。The processor 21 includes one or more processing cores, and the processor 21 executes various functional applications and information processing by running software programs and modules.

通信接口22、存储器23以及处理器21通过总线耦合。存储器23可用于存储软件程序以及模块。存储器可存储操作系统24、至少一个功能所述的应用程序模块25。The communication interface 22, the memory 23 and the processor 21 are coupled through a bus. The memory 23 can be used to store software programs as well as modules. The memory can store an operating system 24 and an application program module 25 for at least one function.

应用程序模块25至少包括:用于设置时间标记的设置模块250、用于存入数据包的缓存模块251、用于判断是否超时的判断模块252和用于删除数据包的处理模块253。设置模块250用于为接收到的数据包设置时间标记,所述时间标记用于判断所述数据包在缓存中的时间是否超时;缓存模块251,用于将所述数据包存入缓存队列中;判断模块252,用于根据所述数据包的时间标记判断所述数据包是否超时;处理模块253,用于当所述数据包超时时,将所述数据包从所述缓存队列中丢弃。The application program module 25 at least includes: a setting module 250 for setting a time stamp, a cache module 251 for storing data packets, a judging module 252 for judging whether to timeout, and a processing module 253 for deleting data packets. The setting module 250 is used to set the time stamp for the received data packet, and the time stamp is used to judge whether the time of the data packet in the cache is overtime; the cache module 251 is used to store the data packet in the cache queue The judging module 252 is used to judge whether the data packet times out according to the time stamp of the data packet; the processing module 253 is used to discard the data packet from the cache queue when the data packet times out.

可选地,处理器21用于执行应用程序模块25中的各个模块,实现如图3和图4中由拥塞避免装置所需要执行的步骤。Optionally, the processor 21 is configured to execute various modules in the application program module 25 to implement the steps required by the congestion avoidance device as shown in FIG. 3 and FIG. 4 .

此外,存储器23是一种计算机可读存储介质,可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随时存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。In addition, the memory 23 is a computer-readable storage medium, which can be implemented by any type of volatile or non-volatile storage devices or their combination, such as static anytime access memory (SRAM), electrically erasable and programmable Read Only Memory (EEPROM), Erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Magnetic Memory, Flash Memory, Magnetic or Optical Disk.

本领域技术人员可以理解,图2中所示出的拥塞避免装置120的结构并不构成对拥塞避免装置的限定,可以包括比图示更多或更少的部件或组合某些部件,或者不同的部件布置。Those skilled in the art can understand that the structure of the congestion avoidance device 120 shown in FIG. layout of the components.

参见图3,其示出了本发明实施例提供的一种拥塞避免方法,由图2示出的拥塞避免装置120执行,该方法包括:Referring to FIG. 3 , it shows a congestion avoidance method provided by an embodiment of the present invention, executed by the congestion avoidance device 120 shown in FIG. 2 , the method includes:

S101:为接收到的数据包设置时间标记,所述时间标记用于判断所述数据包在缓存中的时间是否超时。S101: Set a time stamp for the received data packet, where the time stamp is used to determine whether the time in the cache of the data packet has expired.

在本发明实施例中,时间标记用于判断数据包在缓存队列中停留的时间是否超时。时间标记具体可以是静态时间,例如设置时间标记的时间;也可以是动态时间,例如从0开始逐渐增大,或者从某一时间值开始逐渐减小。In the embodiment of the present invention, the time stamp is used to judge whether the time for the data packet to stay in the cache queue has expired. Specifically, the time mark may be a static time, such as the time when the time mark is set; it may also be a dynamic time, such as gradually increasing from 0, or gradually decreasing from a certain time value.

在本发明实施例中,时间标记可以采用链表等存储结构进行存储。In the embodiment of the present invention, the time stamp may be stored using a storage structure such as a linked list.

S102:将所述数据包存入缓存队列中。S102: Store the data packet in a buffer queue.

在设置时间标记后,将数据包放入缓存队列中。当时间标记是动态时间时,随着数据包在缓存队列中存储的时间增加,可以对上述时间标记的数值进行更改。After setting the timestamp, put the packet into the buffer queue. When the time stamp is a dynamic time, the value of the above time stamp can be changed as the storage time of the data packet in the cache queue increases.

S103:根据所述数据包的时间标记判断所述数据包是否超时。S103: Determine whether the data packet times out according to the time stamp of the data packet.

具体地判断方法根据时间标记类型不同而有所不同,例如当所述时间标记的初始值为0,且所述时间标记随时间逐渐增大时,判断所述时间标记的值是否达到所述时间阈值,当所述时间标记的值达到所述时间阈值时,判断所述数据包超时;当所述时间标记的初始值为时间阈值,且所述时间标记随时间逐渐减小时,判断所述时间标记的值是否减小到0,当所述时间标记的值减小到0时,判断所述数据包超时;当所述时间标记为设置所述时间标记时的时间值(设置时间标记的时间)时,判断当前时间值与所述时间标记中设置所述时间标记时的时间值的差值是否大于或等于所述时间阈值,当所述差值大于或等于所述时间阈值时,判断所述数据包超时。The specific judging method is different according to the type of time stamp. For example, when the initial value of the time stamp is 0 and the time stamp gradually increases with time, it is judged whether the value of the time stamp reaches the time Threshold, when the value of the time stamp reaches the time threshold, it is judged that the data packet has timed out; when the initial value of the time stamp is a time threshold, and the time stamp gradually decreases with time, the time is judged Whether the value of mark is reduced to 0, when the value of described time mark is reduced to 0, judge described packet overtime; When described time mark is the time value when setting described time mark (time mark of setting time ), determine whether the difference between the current time value and the time value when the time stamp is set in the time stamp is greater than or equal to the time threshold, and when the difference is greater than or equal to the time threshold, determine whether the The above packet timed out.

S104:当所述数据包超时时,将所述数据包从所述缓存队列中丢弃。S104: When the data packet times out, discard the data packet from the buffer queue.

在本发明实施例中,在将数据包从缓存队列中删除后,将队列中后续数据包向前移动,填补被删除的数据包的位置。In the embodiment of the present invention, after the data packet is deleted from the cache queue, subsequent data packets in the queue are moved forward to fill the position of the deleted data packet.

参见图4,其示出了本发明实施例提供的另一种拥塞避免方法,由图2示出的拥塞避免装置120执行,该方法包括:Referring to FIG. 4 , it shows another congestion avoidance method provided by an embodiment of the present invention, executed by the congestion avoidance device 120 shown in FIG. 2 , the method includes:

S201:接收数据包。S201: Receive a data packet.

在不同的应用场景中,接收到的数据包也可能不同。例如,在固网中,路由器可以接收其他网络节点发送的业务数据包;在Linux消息通信中,计算机中一个进程可以接收其他进程发送的消息数据包。在计算机任务处理中,计算机的中央处理器(英文:CentralProcessing Unit,简称:CPU)可以接收到任务请求数据包。In different application scenarios, the received data packets may also be different. For example, in a fixed network, a router can receive service data packets sent by other network nodes; in Linux message communication, a process in a computer can receive message data packets sent by other processes. In computer task processing, a central processing unit (English: Central Processing Unit, CPU for short) of the computer may receive a task request data packet.

S202:判断所述数据包的类型。S202: Determine the type of the data packet.

在本发明实施例中,对于不同的类型,有不同的时延要求。因而,对不同的类型的数据包的处理方法也就不同。对于时延要求严格的,需要对其设置时间标记,并周期性判断数据包存留时间是否超时,当存留时间超时时,及时删除。而对于另外一些对时延要求较低的业务,可以不对其设置时间标志,也无需执行后续处理。在有时延要求的业务中,对于不同的业务,时延要求也不尽相同,因此,对于不同的业务超时判断的时间阈值可能也就不同。In the embodiment of the present invention, there are different delay requirements for different types. Therefore, different types of data packets are processed in different ways. For those with strict delay requirements, it is necessary to set a time stamp for it, and periodically judge whether the data packet retention time exceeds, and delete it in time when the retention time exceeds. For other services with lower requirements on delay, no time mark may be set for them, and no follow-up processing needs to be performed. In services with time-delay requirements, different services have different time-delay requirements, so the time thresholds for time-out judgment may be different for different services.

其中,数据包的类型可以是业务类型,也可以是长度类型(数据包长度)。其中,业务类型可以是语音数据包、网路协定电视(英文:Internet Protocol Television,简称:IPTV)数据包等。长度类型可以为小于1500字节、1500-9600字节等。Wherein, the type of the data packet may be a service type or a length type (data packet length). Wherein, the service type may be a voice data packet, an Internet Protocol Television (English: Internet Protocol Television, IPTV for short) data packet, and the like. The length type can be less than 1500 bytes, 1500-9600 bytes, etc.

不同的场景可以使用不同的类型进行分类,例如在固网中,可以通过业务类型对数据包进行分类,而在Linux消息通信中,则可以通过长度类型对数据包进行分类。Different scenarios can use different types for classification. For example, in a fixed network, data packets can be classified by service type, while in Linux message communication, data packets can be classified by length type.

在一种可能的实现方式中,判断所述数据包的类型可以包括:In a possible implementation manner, judging the type of the data packet may include:

根据所述数据包包头中的字段判断所述数据包的类型(业务类型);或者,根据所述数据包的大小判断所述数据包的类型(长度类型)。The type of the data packet (service type) is judged according to the field in the header of the data packet; or, the type of the data packet (length type) is judged according to the size of the data packet.

例如,根据所述数据包包头中的标签类型、英特网协议(英文:InternetProtocol,简称:IP)地址或媒体访问控制(英文:Media Access Control,简称:MAC)地址等字段判断数据包的业务类型。其中,数据包包头中的IP地址或MAC地址是和某一个用户或某一条业务流对应的,而某一个用户或某一条业务流是与具体业务对应的,因此根据IP地址或MAC地址即可判断数据包的业务类型。For example, the business of the data packet is judged according to fields such as the label type in the header of the data packet, the Internet Protocol (English: Internet Protocol, referred to as: IP) address or the media access control (English: Media Access Control, referred to as: MAC) address, etc. type. Among them, the IP address or MAC address in the header of the data packet corresponds to a certain user or a certain service flow, and a certain user or a certain service flow corresponds to a specific service, so according to the IP address or MAC address can be Determine the service type of the data packet.

或者,在接收到数据包后通过检测数据包长度确定其长度类型。这种方式可以针对某种长度的数据包进行拥塞避免,例如希望针对长包1500-9600字节的数据包进行拥塞避免的配置。Or, after receiving the data packet, determine its length type by detecting the length of the data packet. This method can perform congestion avoidance for data packets of a certain length, for example, it is desired to perform congestion avoidance configuration for data packets with a length of 1500-9600 bytes.

在本发明实施例中,可以按照需求实现对需要进行拥塞避免的业务进行配置。例如,用户希望针对IPTV业务进行拥塞避免配置,此时,路由器在收到数据包时,判断数据包是否为IPTV数据包。In the embodiment of the present invention, it is possible to implement the configuration of services requiring congestion avoidance according to requirements. For example, the user wishes to configure congestion avoidance for the IPTV service. At this time, when the router receives the data packet, it determines whether the data packet is an IPTV data packet.

S203:当所述数据包的类型为设定类型时,为所述数据包设置时间标记,所述时间标记用于判断所述数据包在缓存中的时间是否超时。S203: When the type of the data packet is a set type, set a time stamp for the data packet, where the time stamp is used to determine whether the time in the cache of the data packet has expired.

其中,所述为所述数据包设置时间标记,包括:Wherein, the setting time stamp for the data packet includes:

存储所述数据包的标识及其对应的时间标记。The identifier of the data packet and its corresponding time stamp are stored.

例如,可以采用链表等存储结构存储所述数据包的标识及其对应的时间标记。For example, a storage structure such as a linked list may be used to store the identifier of the data packet and its corresponding time stamp.

其中,数据包的标识可以是所述数据包的编号。Wherein, the identifier of the data packet may be the number of the data packet.

如图4A所示,在接收到数据包后,先判断数据包的类型,然后为不同的数据包设置不同的时间标记T。As shown in FIG. 4A , after receiving a data packet, the type of the data packet is judged first, and then different time stamps T are set for different data packets.

其中,所述时间标记的初始值为0,且所述时间标记随时间逐渐增大;或者,所述时间标记的初始值为时间阈值,且所述时间标记随时间逐渐减小;或者,所述时间标记为设置所述时间标记时的时间值。Wherein, the initial value of the time stamp is 0, and the time stamp gradually increases with time; or, the initial value of the time stamp is a time threshold, and the time stamp gradually decreases with time; or, the The time stamp is the time value when the time stamp is set.

以图4A为例,图中数据包1、2和3设置的时间标记T分别为NA、X和NA,其中T=X表示该数据包设置有时间标记,T=NA表示该数据包没有设置时间标记。Taking Figure 4A as an example, the time stamps T set for data packets 1, 2, and 3 in the figure are NA, X, and NA respectively, wherein T=X indicates that the data packet is set with a time stamp, and T=NA indicates that the data packet is not set time stamp.

在本发明实施例中,时间阈值按照可以为秒、毫秒设置纳秒。In the embodiment of the present invention, the time threshold can be set as nanoseconds in seconds or milliseconds.

S204:将所述数据包存入缓存队列中。S204: Store the data packet into a buffer queue.

在设置时间标记后,将数据包放入缓存队列中。当时间标记是动态时间时,随着数据包在缓存队列中存储的时间增加,可以对上述时间标记的数值进行更改。After setting the timestamp, put the packet into the buffer queue. When the time stamp is a dynamic time, the value of the above time stamp can be changed as the storage time of the data packet in the cache queue increases.

如果时间标记初始值为T=X,则T会随着时间逐渐减小,依次变化为X-1,X-2……直到0。例如,X=3ms,则从初始值开始经过3ms后,T=0。If the initial value of the time stamp is T=X, then T will gradually decrease with time, changing to X-1, X-2... until 0. For example, if X=3ms, T=0 after 3ms from the initial value.

如果时间标记初始值为T=0,则T会随着时间逐渐增大,依次变化为1,2……直到X。例如,X=3ms,则从初始值开始经过3ms后,T=3ms。If the initial value of the time stamp is T=0, then T will gradually increase with time, changing to 1, 2... until X in sequence. For example, if X=3ms, T=3ms after 3ms from the initial value.

S205:根据所述数据包的时间标记判断所述数据包是否超时。S205: Determine whether the data packet times out according to the time stamp of the data packet.

在本发明实施例中,周期性地根据所述数据包的时间标记判断数据包是否超时。其中,周期具体可以按需配置,最小为1ms。周期设置过大,则会导致处理量过大,周期设置过小,不能满足时延要求较高业务的需求。In the embodiment of the present invention, it is periodically judged whether the data packet times out according to the time stamp of the data packet. Wherein, the period can be specifically configured as required, and the minimum is 1 ms. If the period is set too large, the processing volume will be too large, and if the period is set too small, it cannot meet the needs of services with high latency requirements.

具体的判断方法根据时间标记类型不同而有所不同,例如当所述时间标记的初始值为0,且时间标记随时间逐渐增大时,判断所述时间标记的值是否达到所述时间阈值,当所述时间标记的值达到所述时间阈值时,判断所述数据包超时;当所述时间标记的初始值为时间阈值,且所述时间标记随时间逐渐减小时,判断所述时间标记的值是否减小到0,当所述时间标记的值减小到0时,判断所述数据包超时;当所述时间标记为设置所述时间标记时的时间值(设置时间标记的时间)时,判断当前时间值与所述时间标记中设置所述时间标记时的时间值的差值是否大于或等于所述时间阈值,当所述差值大于或等于所述时间阈值时,判断所述数据包超时。The specific judging method varies according to the type of time stamp, for example, when the initial value of the time stamp is 0 and the time stamp gradually increases with time, it is judged whether the value of the time stamp reaches the time threshold, When the value of the time stamp reaches the time threshold, it is judged that the data packet has timed out; when the initial value of the time stamp is a time threshold, and the time stamp gradually decreases with time, it is judged that the time stamp is Whether the value is reduced to 0, when the value of the time stamp is reduced to 0, it is judged that the data packet is overtime; when the time stamp is the time value when the time stamp is set (the time of setting the time stamp) , judging whether the difference between the current time value and the time value when the time stamp is set in the time stamp is greater than or equal to the time threshold, and when the difference is greater than or equal to the time threshold, it is judged that the data Packet timed out.

对于第三种方式,由于所述时间阈值的大小是与数据包的类型对应的,因此在计算出所述差值后,根据所述数据包的类型确定时间阈值,然后比较差值与时间阈值的大小。例如设置时间标记的时间为T1,当前时间值为T2,根据数据包的类型确定出时间阈值为X,如果T2-T1≥X,则判断所述数据包超时。其中,各个类型对应的时间阈值大小按需配置,因为各个设备商或运营商对时延的要求不统一。For the third method, since the size of the time threshold corresponds to the type of the data packet, after calculating the difference, determine the time threshold according to the type of the data packet, and then compare the difference with the time threshold the size of. For example, the time to set the time stamp is T1, the current time value is T2, and the time threshold is determined to be X according to the type of the data packet. If T2-T1≥X, it is judged that the data packet times out. Among them, the time thresholds corresponding to each type are configured as needed, because each equipment manufacturer or operator has different requirements for time delay.

对于第三种方式而言,在记录所述数据包的编号及其对应的时间标记时,还可以存储其类型,从而方便在比较差值与时间阈值的大小时,便于获取对应的时间阈值。For the third method, when recording the number of the data packet and its corresponding time stamp, its type can also be stored, so that it is convenient to obtain the corresponding time threshold when comparing the difference with the time threshold.

S206:当所述数据包超时时,将所述数据包从所述缓存队列中丢弃。S206: When the data packet times out, discard the data packet from the buffer queue.

可选地,所述方法还包括:Optionally, the method also includes:

删除所述数据包后的一个或连续至少两个数据包,所述数据包后的一个或连续至少两个数据包与所述数据包的类型相同。One or at least two consecutive data packets after the data packet are deleted, and the type of the one or at least two consecutive data packets after the data packet is the same as the data packet.

例如,数据包1、2和3为队列中连续的三个数据包,数据包1处在最前,这三个数据包的类型相同,此时,如果判断出数据包1超时,则将数据包1、2和3一起丢弃。这样做减少了对数据包2和3的超时判断,减小了处理量。For example, data packets 1, 2 and 3 are three consecutive data packets in the queue, and data packet 1 is at the front, and the types of these three data packets are the same. At this time, if it is judged that data packet 1 times out, the data packet 1, 2 and 3 are discarded together. Doing so reduces the timeout judgment on data packets 2 and 3 and reduces the amount of processing.

在本发明实施例中,当存在连续的相同类型的多个数据包进入缓存队列时,既可以为多个数据包都设置时间标记,也可以只对其中部分数据包设置时间标记,例如第一个和最后一个。In the embodiment of the present invention, when there are multiple consecutive data packets of the same type entering the cache queue, time stamps can be set for multiple data packets, or time stamps can only be set for some of the data packets, for example, the first and the last.

在本发明实施例中,当存在连续的相同类型的多个数据包时,当第一个数据包超时时,既可以删除多个数据包中的全部数据包,也可以只删除多个数据包中的部分数据包。例如,缓存队列中连续存储了某个业务的数据包共x个,当首个数据包超时时,后续数据包超时的可能也很大,但不是所有数据包都同一时刻进入缓存,因此,可以只删除设定数量的数据包。这里设定数量需要根据实际需要设置。下面通过例子说明设定数量的大小,对本方案的影响:如多个数据包中前10个数据包同时进入缓存队列,在这10个数据包即将超时的时刻,又有1个相同类型的数据包进入缓存队列,此时如果设定数量大于10时,刚进入缓存的最后一个数据包就被提前丢弃了,但这样能够减少硬件的处理量。In the embodiment of the present invention, when there are multiple consecutive data packets of the same type, when the first data packet times out, all the data packets in the multiple data packets can be deleted, or only multiple data packets can be deleted Some packets in the . For example, a total of x data packets of a certain service are continuously stored in the cache queue. When the first data packet times out, the subsequent data packets may also time out, but not all data packets enter the cache at the same time. Therefore, you can Only delete a set number of packets. The number set here needs to be set according to actual needs. The following is an example to illustrate the impact of the set number on this scheme: if the first 10 data packets among multiple data packets enter the cache queue at the same time, when these 10 data packets are about to time out, there is another data of the same type The packets enter the cache queue. If the set number is greater than 10, the last data packet that just entered the cache will be discarded in advance, but this can reduce the processing capacity of the hardware.

在本发明实施例中,在将数据包从缓存队列中删除后,将队列中后续数据包向前移动,填补被删除的数据包的位置。In the embodiment of the present invention, after the data packet is deleted from the cache queue, subsequent data packets in the queue are moved forward to fill the position of the deleted data packet.

可选地,该方法还包括:当在设定时间内连续丢弃超过预定数量的数据包时,输出告警信息,从而提示当前丢包较大。Optionally, the method further includes: when more than a predetermined number of data packets are continuously discarded within a set time, outputting an alarm message, thereby prompting that the current packet loss is relatively large.

根据预定数量的不同设置可以实现不同告警,例如预定数量为0,则只要有数据包丢弃则进行告警;当预定数量大于0时,则可以通过告警提示当前丢包大。Different alarms can be realized according to the different settings of the predetermined number. For example, if the predetermined number is 0, an alarm will be issued as long as there is data packet discarding; when the predetermined number is greater than 0, an alarm can be used to prompt that the current packet loss is large.

另外,上述告警信息由拥塞避免装置产生,该告警信息还可以包括对应的设备信息(如路由器标识),该告警信息可以传输到其他管理控制设备,从而能够及时通知网络管理员发送拥塞的设备,从而可以即使解决拥塞。In addition, the above-mentioned warning information is generated by the congestion avoidance device, and the warning information may also include corresponding equipment information (such as a router identifier), and the warning information may be transmitted to other management and control equipment, so that the network administrator can be notified in time of the equipment sending the congestion, Thus, congestion can be solved even if it is.

本发明提供的上述拥塞避免方法可以与传统的拥塞避免策略(如尾丢弃、RED、WRED等)一起使用。例如,对于队列中的数据包采用本实施例提供的方法处理,而对于未进入队列的数据包可以采用尾丢弃、RED或WRED机制进行处理。The above congestion avoidance method provided by the present invention can be used together with traditional congestion avoidance strategies (such as tail drop, RED, WRED, etc.). For example, the method provided by this embodiment is used to process the data packets in the queue, while the tail discard, RED or WRED mechanism can be used to process the data packets not entering the queue.

以下为本发明实施例的装置实施例,对于装置实施例中未详细描述的细节,请参考上述对应的方法实施例。The following is the device embodiment of the embodiment of the present invention. For the details not described in detail in the device embodiment, please refer to the above corresponding method embodiment.

图5示出了本发明一个实施例提供的通信装置的框图。该通信装置可以通过专用硬件电路,或者,软硬件的结合实现成为拥塞避免装置的全部或一部分。该拥塞避免装置包括:设置单元301、缓存单元302、判断单元303和处理单元304。其中,设置单元301,用于为接收到的数据包设置时间标记,所述时间标记用于判断所述数据包在缓存中的时间是否超时;缓存单元302,用于将所述数据包存入缓存队列中;判断单元303,用于根据所述数据包的时间标记判断所述数据包是否超时;处理单元304,用于当所述数据包超时时,将所述数据包从所述缓存队列中丢弃。Fig. 5 shows a block diagram of a communication device provided by an embodiment of the present invention. The communication device can be implemented as all or a part of the congestion avoidance device through a dedicated hardware circuit, or a combination of software and hardware. The congestion avoidance device includes: a setting unit 301 , a cache unit 302 , a judging unit 303 and a processing unit 304 . Wherein, the setting unit 301 is used to set a time stamp for the received data packet, and the time stamp is used to judge whether the time of the data packet in the cache is overtime; the cache unit 302 is used to store the data packet into In the cache queue; the judging unit 303 is used to judge whether the data packet has timed out according to the time stamp of the data packet; the processing unit 304 is used to remove the data packet from the cache queue when the data packet times out discarded.

其中,所述设置单元301,用于:判断所述数据包的类型;当所述数据包的类型为设定类型时,为所述数据包设置时间标记。Wherein, the setting unit 301 is configured to: determine the type of the data packet; when the type of the data packet is a set type, set a time stamp for the data packet.

其中,所述设置单元301,用于:根据所述数据包包头中的字段判断所述数据包的类型;或者,根据所述数据包的大小判断所述数据包的类型。Wherein, the setting unit 301 is configured to: judge the type of the data packet according to the fields in the header of the data packet; or judge the type of the data packet according to the size of the data packet.

其中,所述设置单元301,用于:存储所述数据包的标识及其对应的时间标记。Wherein, the setting unit 301 is configured to: store the identifier of the data packet and its corresponding time stamp.

其中,所述时间标记的初始值为0,且所述时间标记随时间逐渐增大;或者,所述时间标记的初始值为时间阈值,且所述时间标记随时间逐渐减小;或者,所述时间标记为设置所述时间标记时的时间值。Wherein, the initial value of the time stamp is 0, and the time stamp gradually increases with time; or, the initial value of the time stamp is a time threshold, and the time stamp gradually decreases with time; or, the The time stamp is the time value when the time stamp is set.

其中,所述判断单元303,用于:判断所述时间标记的值是否达到所述时间阈值,当所述时间标记的值达到所述时间阈值时,判断所述数据包超时;或者,判断所述时间标记的值是否减小到0,当所述时间标记的值减小到0时,判断所述数据包超时;或者,判断当前时间值与所述时间标记中设置所述时间标记时的时间值的差值是否大于或等于所述时间阈值,当所述差值大于或等于所述时间阈值时,判断所述数据包超时。Wherein, the judging unit 303 is configured to: judge whether the value of the time stamp reaches the time threshold, and when the value of the time stamp reaches the time threshold, judge that the data packet times out; Whether the value of the time stamp is reduced to 0, when the value of the time stamp is reduced to 0, it is judged that the data packet is timed out; Whether the difference of the time values is greater than or equal to the time threshold, and when the difference is greater than or equal to the time threshold, it is judged that the data packet times out.

可选地,所述处理单元304,还用于:删除所述数据包后的一个或连续至少两个数据包,所述数据包后的一个或连续至少两个数据包与所述数据包的类型相同。Optionally, the processing unit 304 is further configured to: delete one or at least two consecutive data packets after the data packet, and the one or at least two consecutive data packets after the data packet are the same as the same type.

相关细节可结合参考图3和图4所述的方法实施例。Relevant details may be combined with the method embodiments described with reference to FIG. 3 and FIG. 4 .

需要说明的是,上述设置单元301、缓存单元302、判断单元303和处理单元304可以由处理器实现或者,处理器执行存储器中的程序指令来实现。It should be noted that the above-mentioned setting unit 301 , cache unit 302 , judging unit 303 and processing unit 304 may be implemented by a processor or implemented by the processor executing program instructions in the memory.

图6示出了本发明一个实施例提供的通信芯片的结构图,应用在前述拥塞避免装置中。该通信芯片包括:处理器410、存储器420和通信接口430。处理器410通过总线分别与存储器420和通信接口430相连。FIG. 6 shows a structural diagram of a communication chip provided by an embodiment of the present invention, which is applied in the foregoing congestion avoidance device. The communication chip includes: a processor 410 , a memory 420 and a communication interface 430 . The processor 410 is respectively connected to the memory 420 and the communication interface 430 through a bus.

通信接口430用于与实现其它通信设备之间的通信。The communication interface 430 is used to communicate with other communication devices.

处理器410包括一个或一个以上处理核心。处理器410通过运行操作系统或应用程序模块。Processor 410 includes one or more processing cores. The processor 410 runs an operating system or application program modules.

可选地,存储器420可存储操作系统422、至少一个功能所需的应用程序模块424。可选地,应用程序模块424包括:接收模块424a、处理模块424b和发送模块424c。其中,接收模块424a用于实现数据包接收有关的步骤;处理模块424b用于实现时间标记设置、超时判断和数据包丢弃等有关计算或处理的步骤;发送模块424c用于实现有关发送的步骤。Optionally, the memory 420 can store an operating system 422 and an application program module 424 required by at least one function. Optionally, the application module 424 includes: a receiving module 424a, a processing module 424b and a sending module 424c. Among them, the receiving module 424a is used to implement steps related to data packet reception; the processing module 424b is used to implement steps related to calculation or processing such as time stamp setting, timeout judgment, and data packet discarding; the sending module 424c is used to implement steps related to sending.

此外,存储器420可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。In addition, the memory 420 can be implemented by any type of volatile or non-volatile storage devices or their combination, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable In addition to programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

本领域技术人员可以理解,图6中所示出的结构并不构成上述通信芯片的限定,可以包括比图示更多或更少的部件或组合某些部件,或者不同的部件布置。Those skilled in the art can understand that the structure shown in FIG. 6 does not constitute a limitation of the above-mentioned communication chip, and may include more or less components than shown in the figure, or combine certain components, or arrange different components.

以上所述仅为本发明的较佳实施例,并不用以限制本发明,凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included in the protection of the present invention. within range.

Claims (14)

1.一种拥塞避免方法,其特征在于,所述方法包括:1. A congestion avoidance method, characterized in that the method comprises: 为接收到的数据包设置时间标记;Set timestamps for received packets; 将所述数据包存入缓存队列中;storing the data packet in a cache queue; 根据所述数据包的时间标记判断所述数据包是否超时;judging whether the data packet times out according to the time stamp of the data packet; 当所述数据包超时时,将所述数据包从所述缓存队列中丢弃。When the data packet times out, the data packet is discarded from the buffer queue. 2.根据权利要求1所述的方法,其特征在于,所述为接收到的数据包设置时间标记,包括:2. The method according to claim 1, wherein said setting a time stamp for the received data packet comprises: 判断所述数据包的类型;Determine the type of the data packet; 当所述数据包的类型为设定类型时,为所述数据包设置时间标记。When the type of the data packet is a set type, a time stamp is set for the data packet. 3.根据权利要求2所述的方法,其特征在于,所述判断所述数据包的类型,包括:3. The method according to claim 2, wherein said judging the type of said data packet comprises: 根据所述数据包包头中的字段判断所述数据包的类型;或者,Judging the type of the data packet according to the field in the header of the data packet; or, 根据所述数据包的大小判断所述数据包的类型。The type of the data packet is judged according to the size of the data packet. 4.根据权利要求2所述的方法,其特征在于,所述为所述数据包设置时间标记,包括:4. The method according to claim 2, wherein said setting a time stamp for said data packet comprises: 存储所述数据包的标识及其对应的时间标记。The identifier of the data packet and its corresponding time stamp are stored. 5.根据权利要求1至4任一项所述的方法,其特征在于,所述时间标记的初始值为0,且所述时间标记随时间逐渐增大;或者,所述时间标记的初始值为时间阈值,且所述时间标记随时间逐渐减小;或者,所述时间标记为设置所述时间标记时的时间值。5. The method according to any one of claims 1 to 4, wherein the initial value of the time stamp is 0, and the time stamp gradually increases with time; or, the initial value of the time stamp is a time threshold, and the time stamp gradually decreases with time; or, the time stamp is a time value when the time stamp is set. 6.根据权利要求5所述的方法,其特征在于,所述根据所述数据包的时间标记判断所述数据包是否超时,包括:6. The method according to claim 5, wherein said judging whether the data packet is timed out according to the time stamp of the data packet comprises: 判断所述时间标记的值是否达到所述时间阈值,当所述时间标记的值达到所述时间阈值时,判断所述数据包超时;或者,judging whether the value of the time stamp reaches the time threshold, and when the value of the time stamp reaches the time threshold, judging that the data packet times out; or, 判断所述时间标记的值是否减小到0,当所述时间标记的值减小到0时,判断所述数据包超时;或者,judging whether the value of the time stamp decreases to 0, and when the value of the time stamp decreases to 0, it is judged that the data packet times out; or, 判断当前时间值与所述时间标记中设置所述时间标记时的时间值的差值是否大于或等于所述时间阈值,当所述差值大于或等于所述时间阈值时,判断所述数据包超时。judging whether the difference between the current time value and the time value when the time stamp is set in the time stamp is greater than or equal to the time threshold, and when the difference is greater than or equal to the time threshold, determine whether the data packet time out. 7.根据权利要求1至4任一项所述的方法,其特征在于,所述方法还包括:7. The method according to any one of claims 1 to 4, wherein the method further comprises: 删除所述数据包后的一个或连续至少两个数据包,所述数据包后的一个或连续至少两个数据包与所述数据包的类型相同。One or at least two consecutive data packets after the data packet are deleted, and the type of the one or at least two consecutive data packets after the data packet is the same as the data packet. 8.一种拥塞避免装置,其特征在于,所述装置包括:8. A congestion avoidance device, characterized in that the device comprises: 设置单元,用于为接收到的数据包设置时间标记,所述时间标记用于判断所述数据包在缓存中的时间是否超时;A setting unit, configured to set a time stamp for the received data packet, and the time stamp is used to judge whether the time of the data packet in the buffer is overtime; 缓存单元,用于将所述数据包存入缓存队列中;a cache unit, configured to store the data packet in a cache queue; 判断单元,用于根据所述数据包的时间标记判断所述数据包是否超时;a judging unit, configured to judge whether the data packet times out according to the time stamp of the data packet; 处理单元,用于当所述数据包超时时,将所述数据包从所述缓存队列中丢弃。A processing unit, configured to discard the data packet from the buffer queue when the data packet times out. 9.根据权利要求8所述的装置,其特征在于,所述设置单元,用于:9. The device according to claim 8, wherein the setting unit is configured to: 判断所述数据包的类型;当所述数据包的类型为设定类型时,为所述数据包设置时间标记。Judging the type of the data packet; when the type of the data packet is a set type, setting a time stamp for the data packet. 10.根据权利要求9所述的装置,其特征在于,所述设置单元,用于:10. The device according to claim 9, wherein the setting unit is configured to: 根据所述数据包包头中的字段判断所述数据包的类型;或者,根据所述数据包的大小判断所述数据包的类型。The type of the data packet is judged according to the field in the header of the data packet; or, the type of the data packet is judged according to the size of the data packet. 11.根据权利要求9所述的装置,其特征在于,所述设置单元,用于:11. The device according to claim 9, wherein the setting unit is used for: 存储所述数据包的标识及其对应的时间标记。The identifier of the data packet and its corresponding time stamp are stored. 12.根据权利要求8至11任一项所述的装置,其特征在于,所述时间标记的初始值为0,且所述时间标记随时间逐渐增大;或者,所述时间标记的初始值为时间阈值,且所述时间标记随时间逐渐减小;或者,所述时间标记为设置所述时间标记时的时间值。12. The device according to any one of claims 8 to 11, wherein the initial value of the time stamp is 0, and the time stamp gradually increases with time; or, the initial value of the time stamp is a time threshold, and the time stamp gradually decreases with time; or, the time stamp is a time value when the time stamp is set. 13.根据权利要求12所述的装置,其特征在于,所述判断单元,用于:13. The device according to claim 12, wherein the judging unit is configured to: 判断所述时间标记的值是否达到所述时间阈值,当所述时间标记的值达到所述时间阈值时,判断所述数据包超时;或者,判断所述时间标记的值是否减小到0,当所述时间标记的值减小到0时,判断所述数据包超时;或者,判断当前时间值与所述时间标记中设置所述时间标记时的时间值的差值是否大于或等于所述时间阈值,当所述差值大于或等于所述时间阈值时,判断所述数据包超时。judging whether the value of the time stamp reaches the time threshold, and when the value of the time stamp reaches the time threshold, judging that the data packet times out; or, judging whether the value of the time stamp decreases to 0, When the value of the time stamp decreases to 0, it is judged that the data packet has timed out; or, it is judged whether the difference between the current time value and the time value when the time stamp is set in the time stamp is greater than or equal to the A time threshold, when the difference is greater than or equal to the time threshold, it is judged that the data packet times out. 14.根据权利要求8至11任一项所述的装置,其特征在于,所述处理单元,还用于:14. The device according to any one of claims 8 to 11, wherein the processing unit is further configured to: 删除所述数据包后的一个或连续至少两个数据包,所述数据包后的一个或连续至少两个数据包与所述数据包的类型相同。One or at least two consecutive data packets after the data packet are deleted, and the type of the one or at least two consecutive data packets after the data packet is the same as the data packet.
CN201611171554.3A 2016-12-17 2016-12-17 A kind of congestion-preventing approach and device Pending CN108206787A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201611171554.3A CN108206787A (en) 2016-12-17 2016-12-17 A kind of congestion-preventing approach and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201611171554.3A CN108206787A (en) 2016-12-17 2016-12-17 A kind of congestion-preventing approach and device

Publications (1)

Publication Number Publication Date
CN108206787A true CN108206787A (en) 2018-06-26

Family

ID=62602562

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201611171554.3A Pending CN108206787A (en) 2016-12-17 2016-12-17 A kind of congestion-preventing approach and device

Country Status (1)

Country Link
CN (1) CN108206787A (en)

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109361616A (en) * 2018-10-31 2019-02-19 晶晨半导体(上海)股份有限公司 A kind of control method improving network performance
CN111224820A (en) * 2019-12-30 2020-06-02 视联动力信息技术股份有限公司 A method and device for calculating bandwidth
CN112491871A (en) * 2020-11-25 2021-03-12 北京宝兰德软件股份有限公司 TCP (Transmission control protocol) recombination method and device, electronic equipment and storage medium
WO2022016889A1 (en) * 2020-07-22 2022-01-27 华为技术有限公司 Congestion control method and device
CN114765585A (en) * 2020-12-30 2022-07-19 北京华为数字技术有限公司 Service quality detection method, message processing method and device
WO2023045551A1 (en) * 2021-09-26 2023-03-30 中兴通讯股份有限公司 Camera control method and system, electronic device and storage medium
CN116347229A (en) * 2022-12-21 2023-06-27 荣耀终端有限公司 Image shooting method and electronic equipment
CN112449228B (en) * 2019-08-30 2024-05-31 青岛海信宽带多媒体技术有限公司 Method and equipment for synchronizing states of player and page

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101009847A (en) * 2006-01-23 2007-08-01 美国阿尔卡特资源有限合伙公司 Video aware traffic management
CN201444641U (en) * 2007-10-01 2010-04-28 交互数字专利控股公司 Wireless Transmitter/Receiver Unit
CN101904197A (en) * 2007-12-20 2010-12-01 株式会社Ntt都科摩 Mobile station, base station device, communication control method, and mobile communication system
CN102170663A (en) * 2011-05-23 2011-08-31 迈普通信技术股份有限公司 3G (The Third Generation Telecommunication)-based method and equipment for guaranteeing service quality in real-time transmission service
CN104702531A (en) * 2013-12-10 2015-06-10 华为技术有限公司 Network equipment congestion avoidance method and network equipment
CN105897365A (en) * 2016-03-23 2016-08-24 京信通信技术(广州)有限公司 Anti-impact processing method and apparatus for processor

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101009847A (en) * 2006-01-23 2007-08-01 美国阿尔卡特资源有限合伙公司 Video aware traffic management
CN201444641U (en) * 2007-10-01 2010-04-28 交互数字专利控股公司 Wireless Transmitter/Receiver Unit
CN101904197A (en) * 2007-12-20 2010-12-01 株式会社Ntt都科摩 Mobile station, base station device, communication control method, and mobile communication system
CN102170663A (en) * 2011-05-23 2011-08-31 迈普通信技术股份有限公司 3G (The Third Generation Telecommunication)-based method and equipment for guaranteeing service quality in real-time transmission service
CN104702531A (en) * 2013-12-10 2015-06-10 华为技术有限公司 Network equipment congestion avoidance method and network equipment
CN105897365A (en) * 2016-03-23 2016-08-24 京信通信技术(广州)有限公司 Anti-impact processing method and apparatus for processor

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109361616A (en) * 2018-10-31 2019-02-19 晶晨半导体(上海)股份有限公司 A kind of control method improving network performance
CN109361616B (en) * 2018-10-31 2022-05-31 晶晨半导体(上海)股份有限公司 Control method for improving network performance
CN112449228B (en) * 2019-08-30 2024-05-31 青岛海信宽带多媒体技术有限公司 Method and equipment for synchronizing states of player and page
CN111224820A (en) * 2019-12-30 2020-06-02 视联动力信息技术股份有限公司 A method and device for calculating bandwidth
CN111224820B (en) * 2019-12-30 2023-10-13 视联动力信息技术股份有限公司 A method and device for bandwidth calculation
WO2022016889A1 (en) * 2020-07-22 2022-01-27 华为技术有限公司 Congestion control method and device
CN112491871A (en) * 2020-11-25 2021-03-12 北京宝兰德软件股份有限公司 TCP (Transmission control protocol) recombination method and device, electronic equipment and storage medium
CN114765585A (en) * 2020-12-30 2022-07-19 北京华为数字技术有限公司 Service quality detection method, message processing method and device
CN114765585B (en) * 2020-12-30 2024-03-01 北京华为数字技术有限公司 Service quality detection method, message processing method and device
WO2023045551A1 (en) * 2021-09-26 2023-03-30 中兴通讯股份有限公司 Camera control method and system, electronic device and storage medium
CN116347229A (en) * 2022-12-21 2023-06-27 荣耀终端有限公司 Image shooting method and electronic equipment
CN116347229B (en) * 2022-12-21 2024-03-15 荣耀终端有限公司 Image capturing methods and electronic equipment

Similar Documents

Publication Publication Date Title
CN108206787A (en) A kind of congestion-preventing approach and device
US20220303217A1 (en) Data Forwarding Method, Data Buffering Method, Apparatus, and Related Device
US11032205B2 (en) Flow control method and switching device
CN108390820B (en) Load balancing method, equipment and system
WO2019033857A1 (en) Packet control method and network device
US8248930B2 (en) Method and apparatus for a network queuing engine and congestion management gateway
US9705808B2 (en) Flow aware buffer management for data center switches
US11290388B2 (en) Flow control method and apparatus
CN109088829B (en) Data scheduling method, device, storage medium and equipment
EP4175232A1 (en) Congestion control method and device
CN112511325B (en) Network congestion control method, node, system and storage medium
US11223568B2 (en) Packet processing method and apparatus
US11165705B2 (en) Data transmission method, device, and computer storage medium
CN107347198A (en) A kind of method for limiting speed, Control for Speed Limitation node and speed limiting device
US20230283578A1 (en) Method for forwarding data packet, electronic device, and storage medium for the same
CN112054964A (en) Queue congestion control method, device, equipment and storage medium
US12206591B2 (en) Managing data traffic congestion in network nodes
CN104869077B (en) Token transfer control method and system
WO2023280004A1 (en) Network configuration method, device and system
WO2022152230A1 (en) Information flow identification method, network chip, and network device
CN112737940A (en) A method and device for data transmission
US20240064109A1 (en) Method and system for dynamic quota-based congestion management
US11108697B2 (en) Technologies for controlling jitter at network packet egress
CN114301852A (en) Message transmission control, generation, transmission method and configuration method, device and medium
CN117749726A (en) Method and device for mixed scheduling of output port priority queues of TSN switch

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20180626

RJ01 Rejection of invention patent application after publication