[go: up one dir, main page]

CN115955440A - Anti-lost packet method and related device - Google Patents

Anti-lost packet method and related device Download PDF

Info

Publication number
CN115955440A
CN115955440A CN202211735122.6A CN202211735122A CN115955440A CN 115955440 A CN115955440 A CN 115955440A CN 202211735122 A CN202211735122 A CN 202211735122A CN 115955440 A CN115955440 A CN 115955440A
Authority
CN
China
Prior art keywords
port
mesh
chip
network
preset
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.)
Granted
Application number
CN202211735122.6A
Other languages
Chinese (zh)
Other versions
CN115955440B (en
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.)
Suzhou Centec Communications Co Ltd
Original Assignee
Suzhou Centec Communications 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 Suzhou Centec Communications Co Ltd filed Critical Suzhou Centec Communications Co Ltd
Priority to CN202211735122.6A priority Critical patent/CN115955440B/en
Publication of CN115955440A publication Critical patent/CN115955440A/en
Application granted granted Critical
Publication of CN115955440B publication Critical patent/CN115955440B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/50Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention provides a packet loss prevention method and a related device, and relates to the technical field of data networks. The packet loss prevention method is applied to a switching chip of a network card, and firstly, a flow control frame carrying a buffer congestion level of a port of a net piece is generated; and then, sending the flow control frame to an exchange chip of the line card so that the exchange chip of the line card adjusts the rate of sending the data message to the port of the net sheet according to the buffer congestion level of the port of the net sheet, thereby avoiding the occurrence of packet loss of the port of the network card due to congestion.

Description

防丢包方法及相关装置Anti-packet loss method and related device

技术领域technical field

本发明涉及数据网络技术领域,具体而言,涉及一种防丢包方法及相关装置。The present invention relates to the technical field of data network, in particular, to an anti-packet loss method and a related device.

背景技术Background technique

网络交换机机架由多块线卡以及网片组成,每块线卡以及网片上有交换芯片,用于交换数据报文。任何一个线卡的面板端口进来的数据报文可以通过本线卡转发,即从本线卡的任何一个端口出去,数据报文也可以通过线卡->网片->线卡的方式转发。The network switch rack is composed of multiple line cards and network chips, and each line card and network chip has a switching chip for exchanging data packets. The data packets coming in from the panel port of any line card can be forwarded through this line card, that is, go out from any port of this line card, and the data packets can also be forwarded through line card->network->line card.

由于线卡以及网片的面板端口的传输速率固定,因此,任意线卡或网片的接收带宽大于发送带宽时,会发生buffer(缓存)溢出,进而出现丢包情况。Since the transmission rate of the panel port of the line card and the network chip is fixed, when the receiving bandwidth of any line card or network chip is greater than the sending bandwidth, buffer (cache) overflow will occur, and then packet loss will occur.

目前的防丢包技术主要是针对线卡出现突发拥塞而提出的,而当线卡以及网片的面板端口传输速率相同时,突发拥塞则会发生在网片上,导致网片的缓存溢出,出现丢包。The current anti-packet loss technology is mainly proposed for the sudden congestion of the line card. When the transmission rate of the panel port of the line card and the network chip is the same, the sudden congestion will occur on the network chip, resulting in the buffer overflow of the network chip. , packet loss occurs.

发明内容Contents of the invention

为了克服现有技术的,本发明实施例提供了一种防丢包方法及相关装置。In order to overcome the disadvantages of the prior art, an embodiment of the present invention provides a packet loss prevention method and a related device.

本发明实施例的技术方案可以这样实现:The technical scheme of the embodiment of the present invention can be realized like this:

第一方面,本发明实施例提供一种防丢包方法,应用于网络交换机机架中的网片的交换芯片,所述网络交换机机架还包括线卡,所述线卡的交换芯片与所述网片的交换芯片通信连接,所述方法包括:In the first aspect, the embodiment of the present invention provides an anti-packet loss method, which is applied to the switch chip of the mesh in the network switch rack, and the network switch rack also includes a line card, and the switch chip of the line card is connected to the switch chip of the network switch rack. The exchange chip communication connection of above-mentioned mesh chip, described method comprises:

生成携带有所述网片的端口的buffer拥塞等级的流控帧;Generate a flow control frame carrying the buffer congestion level of the port of the mesh;

将所述流控帧发送给所述线卡的交换芯片,以使所述线卡的交换芯片根据所述网片的端口的buffer拥塞等级,调整向所述网片的端口发送数据报文的速率,避免所述网卡的端口因拥塞出现丢包。Send the flow control frame to the switch chip of the line card, so that the switch chip of the line card adjusts the number of data packets sent to the port of the network chip according to the buffer congestion level of the port of the network chip rate to avoid packet loss at the port of the network card due to congestion.

可选地,在所述生成携带有所述网片的端口的buffer拥塞等级的流控帧之前,所述方法还包括获取所述网片的端口的buffer拥塞等级的步骤,其包括:Optionally, before generating the flow control frame carrying the buffer congestion level of the port of the mesh, the method further includes the step of obtaining the buffer congestion level of the port of the mesh, which includes:

获取针对所述网片的端口的报文计数值,其中,所述报文计数值的变化表征所述网片的端口转入或转出数据报文;Obtaining a packet count value for a port of the network slice, wherein a change in the packet count value indicates that a port of the network slice is transferred into or out of a data packet;

根据所述报文计数值,确定所述网片的端口的buffer拥塞等级。Determine the buffer congestion level of the port of the network slice according to the packet count value.

可选地,所述根据所述报文计数值,确定所述网片的端口的buffer拥塞等级的步骤包括:Optionally, the step of determining the buffer congestion level of the port of the network slice according to the message count value includes:

若所述报文计数值小于第一预设值、且所述网片的端口处于轻度拥塞状态,则确定所述网片的端口的buffer拥塞等级为第一预设等级;If the packet count value is less than a first preset value and the port of the mesh is in a mildly congested state, then determine that the buffer congestion level of the port of the mesh is the first preset level;

若所述报文计数值小于第二预设值、且所述网片的端口处于中度拥塞状态,则确定所述网片的端口的buffer拥塞等级为第二预设等级;If the packet count value is less than a second preset value and the port of the mesh is in a moderately congested state, then determine that the buffer congestion level of the port of the mesh is a second preset level;

若所述报文计数值小于第三预设值、且所述网片的端口处于重度拥塞状态,则确定所述网片的端口的buffer拥塞等级为第三预设等级。If the packet count value is less than a third preset value and the port of the network slice is in a heavily congested state, then determine that the buffer congestion level of the port of the network slice is a third preset level.

可选地,所述根据所述报文计数值,确定所述网片的端口的buffer拥塞等级的步骤还包括:Optionally, the step of determining the buffer congestion level of the port of the network slice according to the packet count value further includes:

若所述报文计数值大于第二预设值、且所述网片的端口处于不拥塞状态,则确定所述网片的端口的buffer拥塞等级为第二预设等级;If the packet count value is greater than a second preset value and the port of the mesh is in an uncongested state, then determine that the buffer congestion level of the port of the mesh is a second preset level;

若所述报文计数值大于第三预设值、且所述网片的端口处于轻度拥塞状态,则确定所述网片的端口的buffer拥塞等级为第三预设等级;If the packet count value is greater than a third preset value and the port of the mesh is in a mildly congested state, then determine that the buffer congestion level of the port of the mesh is a third preset level;

若所述报文计数值大于第四预设值、且所述网片的端口处于中度拥塞状态,则确定所述网片的端口的buffer拥塞等级为第四预设等级。If the packet count value is greater than a fourth preset value and the port of the mesh is in a moderately congested state, determine that the buffer congestion level of the port of the mesh is a fourth preset level.

第二方面,本发明实施例提供一种防丢包方法,应用于网络交换机机架中的线卡的交换芯片,所述网络交换机机架还包括网片,所述网片的交换芯片与所述线卡的交换芯片通信连接,所述方法包括:In the second aspect, the embodiment of the present invention provides an anti-packet loss method, which is applied to the switching chip of the line card in the network switch rack. The network switch rack also includes a mesh, and the switching chip of the mesh is connected to the The switch chip communication connection of the line card, the method includes:

接收所述网片的交换芯片发送的流控帧,所述流控帧携带有所述网片的端口的buffer拥塞等级;receiving the flow control frame sent by the switch chip of the mesh, the flow control frame carrying the buffer congestion level of the port of the mesh;

根据所述网片的端口的buffer拥塞等级,调整向所述网片的端口发送数据报文的速率,以避免所述网卡的端口因拥塞出现丢包。According to the buffer congestion level of the port of the network chip, the rate of sending data packets to the port of the network chip is adjusted, so as to avoid packet loss at the port of the network card due to congestion.

可选地,所述根据所述网片的端口的buffer拥塞等级,调整向所述网片的端口发送数据报文的速率的步骤包括:Optionally, the step of adjusting the rate of sending data packets to the port of the mesh according to the buffer congestion level of the port of the mesh includes:

若所述网片的端口的buffer拥塞等级为第一预设等级,则将向所述网片的端口发送数据报文的速率提高至预设最大速率;If the buffer congestion level of the port of the mesh is the first preset level, the rate of sending data packets to the port of the mesh is increased to a preset maximum rate;

若所述网片的端口的buffer拥塞等级为第二预设等级,则将向所述网片的端口发送数据报文的速率按照第一预设降幅进行降低;If the buffer congestion level of the port of the mesh is the second preset level, the rate of sending data packets to the port of the mesh is reduced according to the first preset reduction rate;

若所述网片的端口的buffer拥塞等级为第三预设等级,则将向所述网片的端口发送数据报文的速率按照第二预设降幅进行降低,其中,所述第二预设降幅大于所述第一预设降幅;If the buffer congestion level of the port of the network slice is the third preset level, the rate of sending data packets to the port of the network slice is reduced according to the second preset reduction rate, wherein the second preset The drop rate is greater than the first preset drop rate;

若所述网片的端口的buffer拥塞等级为第四预设等级,则将向所述网片的端口发送数据报文的速率降低至预设最小速率。If the buffer congestion level of the port of the network slice is the fourth preset level, the rate of sending data packets to the port of the network slice is reduced to a preset minimum rate.

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

在将向所述网片的端口发送数据报文的速率降低后,控制所述线卡的计数器开始计数;After reducing the rate of sending data packets to the port of the network chip, the counter for controlling the line card starts counting;

若检测到所述计数器的值大于预设阈值,则将向所述网片的端口发送数据报文的速率在预设时间范围内逐步提高至所述预设最大速率。If it is detected that the value of the counter is greater than the preset threshold, the rate of sending data packets to the port of the network slice is gradually increased to the preset maximum rate within a preset time range.

第三方面,本发明实施例提供一种防丢包装置,应用于网络交换机机架中的网片的交换芯片,所述网络交换机机架还包括线卡,所述线卡的交换芯片与所述网片的交换芯片通信连接,所述装置包括:In a third aspect, an embodiment of the present invention provides an anti-packet loss device, which is applied to a switch chip of a mesh in a network switch rack, and the network switch rack further includes a line card, and the switch chip of the line card is connected to the switch chip of the network switch rack. The exchange chip communication connection of above-mentioned network chip, described device comprises:

生成模块,用于生成携带有所述网片的端口的buffer拥塞等级的流控帧;A generating module, configured to generate a flow control frame carrying the buffer congestion level of the port of the mesh;

发送模块,用于将所述流控帧发送给所述线卡的交换芯片,以使所述线卡的交换芯片根据所述网片的端口的buffer拥塞等级,调整向所述网片的端口发送数据报文的速率,避免所述网卡的端口因拥塞出现丢包。A sending module, configured to send the flow control frame to the switch chip of the line card, so that the switch chip of the line card adjusts the port to the network chip according to the buffer congestion level of the port of the network chip The rate at which data packets are sent to avoid packet loss at the port of the network card due to congestion.

第四方面,本发明实施例提供一种防丢包装置,应用于网络交换机机架中的线卡的交换芯片,所述网络交换机机架还包括网片,所述网片的交换芯片与所述线卡的交换芯片通信连接,所述装置包括:In a fourth aspect, an embodiment of the present invention provides an anti-packet loss device, which is applied to a switching chip of a line card in a network switch rack. The network switch rack further includes a mesh, and the switching chip of the mesh is connected to the The switch chip communication connection of the line card, the device includes:

接收模块,用于接收所述网片的交换芯片发送的流控帧,所述流控帧携带有所述网片的端口的buffer拥塞等级;A receiving module, configured to receive a flow control frame sent by the switch chip of the mesh, the flow control frame carrying the buffer congestion level of the port of the mesh;

调整模块,用于根据所述网片的端口的buffer拥塞等级,调整向所述网片的端口发送数据报文的速率,以避免所述网卡的端口因拥塞出现丢包。An adjustment module, configured to adjust the rate of sending data packets to the port of the mesh according to the buffer congestion level of the port of the mesh, so as to avoid packet loss at the port of the network card due to congestion.

第五方面,本发明实施例提供一种交换芯片,所述交换芯片存在逻辑器件,所述逻辑器件烧录有计算机程序,所述计算机程序被执行时实现如第一方面所述的防丢包方法。In the fifth aspect, an embodiment of the present invention provides a switch chip, the switch chip has a logic device, and the logic device is burned with a computer program, and when the computer program is executed, the anti-packet loss as described in the first aspect is realized method.

第六方面,本发明实施例提供一种交换芯片,所述交换芯片存在逻辑器件,所述逻辑器件烧录有计算机程序,所述计算机程序被执行时实现如第二方面所述的防丢包方法。In the sixth aspect, an embodiment of the present invention provides a switch chip, the switch chip has a logic device, and the logic device is burned with a computer program, and when the computer program is executed, the anti-packet loss as described in the second aspect is realized method.

第七方面,本发明实施例提供一种网络交换机机架,所述网络交换机机架包括多个网片和多个线卡,每个所述网片上均存在如第五方面所述的交换芯片,每个所述线卡上均存在如第六方面所述的交换芯片。In the seventh aspect, the embodiment of the present invention provides a network switch rack, the network switch rack includes a plurality of meshes and a plurality of line cards, each of the meshes has a switching chip as described in the fifth aspect , each of the line cards has the switch chip as described in the sixth aspect.

第三方面,本发明实施例提供一种计算机可读存储介质,其存储有计算机程序,所述计算机程序被执行时实现如第一方面所述的防丢包方法或如第二方面所述的防丢包方法。In a third aspect, an embodiment of the present invention provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed, implements the anti-packet loss method as described in the first aspect or the method as described in the second aspect Anti-packet loss method.

相较于现有技术,本发明实施例提供的应用于网络交换机机架中的网片的交换芯片的防丢包方法,首先,生成携带有网片的端口的buffer拥塞等级的流控帧;然后,将流控帧发送给线卡的交换芯片,以使线卡的交换芯片根据网片的端口的buffer拥塞等级,调整向网片的端口发送数据报文的速率。由于本发明实施例例通过向线卡的交换芯片发送携带有网片的端口的buffer拥塞等级的流控帧,使线卡的交换芯片根据网片的端口的buffer拥塞等级,调整向网片的端口发送数据报文的速率,从而避免网卡的端口因拥塞出现丢包。Compared with the prior art, the embodiment of the present invention provides an anti-packet loss method applied to a switch chip of a mesh in a network switch rack. First, a flow control frame carrying a buffer congestion level of a port of the mesh is generated; Then, the flow control frame is sent to the switch chip of the line card, so that the switch chip of the line card adjusts the rate of sending data packets to the port of the network chip according to the buffer congestion level of the port of the network chip. Because the embodiment of the present invention sends the flow control frame carrying the buffer congestion level of the port of the network chip to the switch chip of the line card, the switch chip of the line card is adjusted to the buffer congestion level of the port of the network chip according to the buffer congestion level of the port of the network chip. The rate at which the port sends data packets, so as to avoid packet loss due to congestion on the port of the network card.

附图说明Description of drawings

为了更清楚地说明本发明实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,应当理解,以下附图仅示出了本发明的某些实施例,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他相关的附图。In order to illustrate the technical solutions of the embodiments of the present invention more clearly, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention, and thus It should be regarded as a limitation on the scope, and those skilled in the art can also obtain other related drawings based on these drawings without creative work.

图1为本发明实施例提供的一种网络交换机机架的结构示意图;FIG. 1 is a schematic structural diagram of a network switch rack provided by an embodiment of the present invention;

图2为本发明实施例提供的一种数据报文转发过程的示例图一;FIG. 2 is an example diagram 1 of a data packet forwarding process provided by an embodiment of the present invention;

图3为本发明实施例提供的一种数据报文转发过程的示例图二;Fig. 3 is an example Fig. 2 of a data packet forwarding process provided by an embodiment of the present invention;

图4为本发明实施例提供的一种数据报文转发过程的示例图三;Fig. 4 is an example Fig. 3 of a data packet forwarding process provided by an embodiment of the present invention;

图5为本发明实施例提供的一种应用于网片的交换芯片的防丢包方法的流程示意图;5 is a schematic flow diagram of a method for preventing packet loss applied to a switch chip of a mesh provided by an embodiment of the present invention;

图6为本发明实施例提供的一种获取buffer拥塞等级的方法的流程示意图;FIG. 6 is a schematic flow diagram of a method for obtaining a buffer congestion level provided by an embodiment of the present invention;

图7为本发明实施例提供的一种部署在网卡的交换芯片中的端口资源管理装置的功能单元框图;FIG. 7 is a block diagram of functional units of a port resource management device deployed in a switch chip of a network card provided by an embodiment of the present invention;

图8为本发明实施例提供的一种应用于线卡的交换芯片的防丢包方法的流程示意图;FIG. 8 is a schematic flowchart of a packet loss prevention method applied to a switch chip of a line card provided by an embodiment of the present invention;

图9为本发明实施例提供的一种应用于网片的交换芯片的防丢包装置的功能单元框图;9 is a functional unit block diagram of an anti-packet loss device applied to a switch chip of a mesh provided by an embodiment of the present invention;

图10为本发明实施例提供的一种应用于线片的交换芯片的防丢包装置的功能单元框图。FIG. 10 is a block diagram of functional units of an anti-packet loss device applied to a switch chip of a line slice provided by an embodiment of the present invention.

图标:100-应用于网片的交换芯片的防丢包装置;101-生成模块;102-发送模块;103-获取模块;200-应用于线片的交换芯片的防丢包装置;201-接收模块;202-调整模块。Icon: 100-anti-packet loss device applied to the switch chip of the mesh; 101-generation module; 102-transmission module; 103-acquisition module; 200-anti-packet loss device applied to the switch chip of the line chip; 201-reception module; 202 - adjustment module.

具体实施方式Detailed ways

为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。通常在此处附图中描述和示出的本发明实施例的组件可以以各种不同的配置来布置和设计。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments It is a part of embodiments of the present invention, but not all embodiments. The components of the embodiments of the invention generally described and illustrated in the figures herein may be arranged and designed in a variety of different configurations.

因此,以下对在附图中提供的本发明的实施例的详细描述并非旨在限制要求保护的本发明的范围,而是仅仅表示本发明的选定实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。Accordingly, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely represents selected embodiments of the invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.

应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步定义和解释。It should be noted that like numerals and letters denote similar items in the following figures, therefore, once an item is defined in one figure, it does not require further definition and explanation in subsequent figures.

此外,若出现术语“第一”、“第二”等仅用于区分描述,而不能理解为指示或暗示相对重要性。In addition, terms such as "first" and "second" are used only for distinguishing descriptions, and should not be understood as indicating or implying relative importance.

需要说明的是,在不冲突的情况下,本发明的实施例中的特征可以相互结合。It should be noted that, in the case of no conflict, the features in the embodiments of the present invention may be combined with each other.

如图1所示,网络交换机机架由多块线卡以及网片组成,每块线卡以及网片上有交换芯片,用于交换数据报文。As shown in FIG. 1 , the network switch rack is composed of multiple line cards and network slices, and each line card and network slice has a switching chip for exchanging data packets.

任何一个线卡的面板端口进来的数据报文可以通过本线卡转发,即从本线卡的任何一个面板端口出去,同时也可以通过线卡->网片->线卡的方式转发,需要注意地是,数据报文的转发过程中不能丢包。The incoming data packets from the panel port of any line card can be forwarded through this line card, that is, go out from any panel port of this line card, and can also be forwarded in the way of line card->network->line card. It should be noted that packets cannot be lost during the forwarding of data packets.

通常线卡的每个面板端口传输速率固定,当其他线卡的端口同时往同一个线卡的某个面板端口发送数据报文时,由于该线卡的接收带宽比发送带宽高,导致该线卡来不及将数据报文发送出去,便会使该线卡的缓存溢出,进而出现丢包。Usually, the transmission rate of each panel port of a line card is fixed. When the ports of other line cards send data packets to a certain panel port of the same line card at the same time, because the receiving bandwidth of the line card is higher than the sending bandwidth, the line If the card does not have time to send the data packet, the buffer of the line card will overflow, resulting in packet loss.

示例性地,如图2所示,假设每个线卡的面板端口传输速率均为100Gbps,线卡2的面板端口P0和线卡3的面板端口P0同时往线卡1的面板端口P1发送数据报文,且均以100Gbps全速的方式发送,也就是说,线卡1会通过网片1接收200Gbps的数据包往P1发送,由于P1的端口速率只有100Gbps,那么必然会导致P1端口buffer溢出,进而出现丢包。For example, as shown in FIG. 2 , assuming that the transmission rate of the panel port of each line card is 100 Gbps, the panel port P0 of line card 2 and the panel port P0 of line card 3 simultaneously send data to the panel port P1 of line card 1 The packets are sent at full speed of 100Gbps, that is to say, line card 1 will receive 200Gbps data packets through network chip 1 and send them to P1. Since the port rate of P1 is only 100Gbps, it will inevitably cause P1 port buffer overflow. Then packet loss occurs.

传统解决方案是在线卡上通过分发令牌的方式,解决端口buffer溢出的问题,由于令牌来回响应与处理时间较长,端口buffer需要足够深才可以。The traditional solution is to distribute tokens on the line card to solve the problem of port buffer overflow. Since the tokens take a long time to respond and process, the port buffer needs to be deep enough.

示例性地,如图3所示,假设线卡1的面板端口P1的buffer有1000个单位(每个单位能最多能存储256字节),分发给线卡2,线卡3..线卡m各k个,其中k*m<1000,线卡2和3各自发送的数据报文如果已经占用了k个buffer,那么不再往线卡1的P1发送数据报文,直到线卡1的P1再给线卡2和线卡3发送新的令牌。也就是说,即使线卡2和线卡3加起来以200Gbps的速率往线卡1的P1发送,但是因为发送的报文占用buffer有限,即使P1来不及将数据报文转出,也不至于会超过P1的buffer数量,从而导致丢包。Exemplarily, as shown in FIG. 3 , it is assumed that the buffer of panel port P1 of line card 1 has 1000 units (each unit can store up to 256 bytes), which are distributed to line card 2, line card 3.. line card m each k, where k*m<1000, if the data packets sent by line cards 2 and 3 have already occupied k buffers, then no data packets will be sent to P1 of line card 1 until the data packets of line card 1 P1 then sends new tokens to line card 2 and line card 3. That is to say, even if the combined rate of line card 2 and line card 3 is sent to P1 of line card 1 at a rate of 200Gbps, but because the sent message occupies a limited buffer, even if P1 has no time to transfer the data message, it will not be lost. The number of buffers exceeding P1 will result in packet loss.

然而,传统解决方案只是解决了线卡与线卡之间的突发问题。如图4所示,如果网片1与线卡1的面板端口的传输速率是100Gbps,那么突发拥塞会发生在网片1,网片的端口的数据报文转出速率(100Gbps)小于转入速率(200Gbps),导致buffer溢出,进而出现丢包。However, traditional solutions only address burst issues from line card to line card. As shown in Figure 4, if the transmission rate of the panel port of network chip 1 and line card 1 is 100Gbps, then burst congestion will occur on network chip 1, and the data packet transfer rate (100Gbps) of the port of the network chip is lower than that of the network chip. Incoming rate (200Gbps), resulting in buffer overflow and packet loss.

为了解决因网片发生突发拥塞而使数据报文的转发过程出现丢包,本发明实施例提供了一种应用于网片的交换芯片的防丢包方法,下面将进行详细介绍。In order to solve the packet loss in the forwarding process of the data message due to the sudden congestion of the network chip, the embodiment of the present invention provides an anti-packet loss method applied to the switching chip of the network chip, which will be described in detail below.

请参照图5,该防丢包方法包括步骤S101~S102。Please refer to FIG. 5 , the packet loss prevention method includes steps S101-S102.

S101,生成携带有所述网片的端口的buffer拥塞等级的流控帧。S101. Generate a flow control frame carrying the buffer congestion level of the port of the network slice.

其中,流控帧包括但不限于chip id、port id、Priority和Congestion Level。Among them, the flow control frame includes but not limited to chip id, port id, Priority and Congestion Level.

在发送buffer拥塞时,网片的交换芯片将自身的chip id填入流控帧,线卡的交换芯片收到流控帧后,根据chip id便可获知是哪个网片出现了拥塞。When the sending buffer is congested, the switching chip of the network chip fills its own chip id into the flow control frame. After the switching chip of the line card receives the flow control frame, it can know which network chip is congested according to the chip id.

网片出现拥塞的端口可以是一个也可以是多个,在本发明实施例中,可以使用bitmap的方式来表示端口的port id,例如,bit0表示port 0,bit1表示port1,以此类推,可以根据需求做不同的设置。在发送拥塞时,网片的交换芯片将发生拥塞的端口的port id写入流控帧,线卡芯片收到流控帧后,根据port id可以获知是哪个网片的哪个端口出现了拥塞。There can be one or more ports where the network chip is congested. In the embodiment of the present invention, the port id of the port can be represented in the form of a bitmap, for example, bit0 represents port 0, bit1 represents port1, and so on. Make different settings according to your needs. When sending congestion, the switch chip of the network chip writes the port id of the congested port into the flow control frame. After the line card chip receives the flow control frame, it can know which port of which network chip is congested according to the port id.

Priority是用于表述出现拥塞的端口中具体是哪个优先级或者子通道出现拥塞,可以根据需求进行扩展或者取消。Priority is used to express which priority or sub-channel is congested in the congested port, and can be expanded or canceled according to requirements.

Congestion Level,即buffer拥塞等级,在本发明实施例中可以通过设置多个buffer拥塞等级,来使降速和提速相对比较平滑,不至于过渡浪费端口带宽。Congestion Level, that is, the buffer congestion level, in the embodiment of the present invention, multiple buffer congestion levels can be set to make the deceleration and speed up relatively smooth, so as not to waste port bandwidth during transition.

S102,将流控帧发送给线卡的交换芯片,以使线卡的交换芯片根据网片的端口的buffer拥塞等级,调整向网片的端口发送数据报文的速率,避免网卡的端口因拥塞出现丢包。S102, sending the flow control frame to the switch chip of the line card, so that the switch chip of the line card adjusts the rate of sending data packets to the port of the network chip according to the buffer congestion level of the port of the network chip, so as to avoid the port of the network card due to congestion There is packet loss.

其中,buffer拥塞等级表征端口的buffer拥塞程度。Among them, the buffer congestion level represents the buffer congestion degree of the port.

示例性地,假设存在4个buffer拥塞等级,分别为等级0、等级1、等级2和等级3,等级0,表示端口buffer未拥塞;等级1,表示端口buffer出现轻微拥塞;等级2,表示端口buffer出现中度拥塞;等级3,表示端口buffer出现严重拥塞。For example, assume that there are four levels of buffer congestion, namely level 0, level 1, level 2, and level 3. Level 0 indicates that the port buffer is not congested; level 1 indicates that the port buffer is slightly congested; level 2 indicates that the port The buffer is moderately congested; level 3 means that the port buffer is severely congested.

本发明实施例中,在执行步骤S101之前,需先获取所述网片的端口的buffer拥塞等级,如图6所示,其实现过程可以包括步骤S201~S202。In the embodiment of the present invention, before step S101 is executed, the buffer congestion level of the port of the network slice needs to be obtained first, as shown in FIG. 6 , the implementation process may include steps S201-S202.

S201,获取针对网片的端口的报文计数值。S201. Obtain a packet count value for a port of a network slice.

其中,报文计数值的变化表征网片的端口转入或转出数据报文。Wherein, the change of the message count value indicates that the port of the network chip transfers in or out the data message.

网片的交换芯片部署有端口资源管理装置,如图7所示,端口资源管理装置包括报文转入模块、报文转出模块和端口资源计数模块。The switching chip of the network chip is equipped with a port resource management device. As shown in FIG. 7 , the port resource management device includes a message transfer-in module, a message transfer-out module and a port resource counting module.

当数据报文被计划从某一个端口转发出去的时,报文转入模块完成数据报文的缓存操作,并且给端口资源计数模块发起计数请求,内容为增加报文个数或报文长度计数。When the data message is planned to be forwarded from a certain port, the message transfer module completes the buffer operation of the data message, and initiates a counting request to the port resource counting module, the content is to increase the number of messages or count the length of the message .

当数据报文完成处理并向端口进行转出行为的时,报文转出模块将数据报文从缓存中取出发送,并向端口资源计数模块发起计数请求,内容为减少报文个数或报文长度计数。When the data message is processed and transferred out to the port, the message forwarding module takes the data message out of the cache and sends it, and initiates a counting request to the port resource counting module, the content of which is to reduce the number of messages or Text length count.

在本发明实施例中,如果一个数据报文计划从某一个端口转发,但是由于端口暂时没有能力处理,那么这个数据报文就会留存在缓存中,也就是说,当一个突发流量产生时,如果端口没有足够的能力处理,那么这些突发流量的数据报文都会被暂存在缓存中,端口资源计数模块中的计数器就会维持一个比较高的数值。In the embodiment of the present invention, if a data message is planned to be forwarded from a certain port, but because the port is temporarily unable to process it, the data message will be kept in the cache, that is, when a burst traffic occurs , if the port does not have enough capacity to process, then the data packets of these burst traffic will be temporarily stored in the cache, and the counter in the port resource counting module will maintain a relatively high value.

当突发流量结束消失,之前缓存的报文仍然在继续从缓存中取出并转发,此时,端口资源计数模块中的计数器逐步减小,当计数器减小到一个比较小的值,说明突发流量的影响消失。When the burst traffic ends and disappears, the previously cached packets are still taken out from the cache and forwarded. At this time, the counter in the port resource counting module gradually decreases. When the counter decreases to a relatively small value, it indicates that the burst The effect of flow disappears.

可以理解地,报文计数值就是指端口资源计数模块中的计数器的值。Understandably, the packet count value refers to the value of the counter in the port resource counting module.

S202,根据报文计数值,确定网片的端口的buffer拥塞等级。S202. Determine the buffer congestion level of the port of the network slice according to the message count value.

在本发明实施例中,可以通过对报文计数值设置多个阈值,根据报文计数值与设置的阈值的比较结果,确定网片的端口的buffer拥塞等级,可以理解地,阈值的大小和个数可根据实际需要进行设置,相应地,buffer拥塞等级的个数可以根据实际需求进行设置。In the embodiment of the present invention, multiple thresholds can be set for the message count value, and the buffer congestion level of the port of the network slice can be determined according to the comparison result of the message count value and the set threshold value. It can be understood that the size of the threshold value and The number can be set according to actual needs, and correspondingly, the number of buffer congestion levels can be set according to actual needs.

在一种可能的实现方式中,buffer拥塞等级可以包括第一预设等级、第二预设等级、第三预设等级和第四预设等级,并且第一预设等级、第二预设等级、第三预设等级和第四预设等级表征端口的buffer拥塞程度逐步递增。In a possible implementation manner, the buffer congestion level may include a first preset level, a second preset level, a third preset level, and a fourth preset level, and the first preset level, the second preset level , the third preset level and the fourth preset level indicate that the buffer congestion degree of the port is gradually increasing.

可选地,步骤S202的实现过程存在以下六种情况:Optionally, there are the following six situations in the implementation process of step S202:

情况1,若报文计数值小于第一预设值、且网片的端口处于轻度拥塞状态,则确定网片的端口的buffer拥塞等级为第一预设等级;Case 1, if the message count value is less than the first preset value and the port of the mesh is in a mildly congested state, then determine that the buffer congestion level of the port of the mesh is the first preset level;

情况2,若报文计数值小于第二预设值、且网片的端口处于中度拥塞状态,则确定网片的端口的buffer拥塞等级为第二预设等级;Case 2, if the message count value is less than the second preset value and the port of the mesh is in a moderately congested state, then determine that the buffer congestion level of the port of the mesh is the second preset level;

情况3,若报文计数值小于第三预设值、且网片的端口处于重度拥塞状态,则确定网片的端口的buffer拥塞等级为第三预设等级;Case 3, if the message count value is less than the third preset value and the port of the mesh is in a heavily congested state, then determine that the buffer congestion level of the port of the mesh is the third preset level;

情况4,若报文计数值大于第二预设值、且所述网片的端口处于不拥塞状态,则确定网片的端口的buffer拥塞等级为第二预设等级;Case 4, if the packet count value is greater than the second preset value and the port of the mesh is not congested, then determine that the buffer congestion level of the port of the mesh is the second preset level;

情况5,若报文计数值大于第三预设值、且网片的端口处于轻度拥塞状态,则确定网片的端口的buffer拥塞等级为第三预设等级;Case 5, if the packet count value is greater than the third preset value and the port of the mesh is in a mildly congested state, then determine that the buffer congestion level of the port of the mesh is the third preset level;

情况6,若报文计数值大于第四预设值、且网片的端口处于中度拥塞状态,则确定网片的端口的buffer拥塞等级为第四预设等级。Case 6, if the packet count value is greater than the fourth preset value and the port of the mesh chip is in a moderately congested state, then determine that the buffer congestion level of the port of the mesh chip is the fourth preset level.

示例性地,假设第一预设值、第二预设值、第三预设值和第四预设值分别threshold0、threshold1、threshold2和threshold3。其中,它们的大小满足threshold0<threshold1<threshold2<threshold3。Exemplarily, it is assumed that the first preset value, the second preset value, the third preset value and the fourth preset value are threshold0, threshold1, threshold2 and threshold3 respectively. Wherein, their sizes satisfy threshold0<threshold1<threshold2<threshold3.

第一预设等级、第二预设等级、第三预设等级和第四预设等级分别用等级0、等级1、等级2和等级3表示。The first preset level, the second preset level, the third preset level and the fourth preset level are represented by level 0, level 1, level 2 and level 3 respectively.

利用threshold0、threshold1、threshold2和threshold3判断端口的buffer拥塞程度,即确定端口的buffer拥塞等级。Use threshold0, threshold1, threshold2, and threshold3 to determine the buffer congestion level of the port, that is, determine the buffer congestion level of the port.

可以理解地,当报文计数值小于threshold0时,并且当前端口处于轻度拥塞状态,那么端口将从轻度拥塞状态转变为不拥塞状态,对应的buffer拥塞等级为等级0。It can be understood that when the packet count value is less than threshold0 and the current port is in a mildly congested state, then the port will change from a lightly congested state to a non-congested state, and the corresponding buffer congestion level is level 0.

当报文计数值小于threshold1时,并且当前端口处于中度拥塞状态,那么端口将从中度拥塞状态转变为轻度拥塞状态,对应的buffer拥塞等级为等级1。When the packet count value is less than threshold1 and the current port is in the moderately congested state, the port will change from the moderately congested state to the lightly congested state, and the corresponding buffer congestion level is level 1.

当报文计数值小于threshold2时,并且当前端口处于重度拥塞状态,那么端口将从重度拥塞状态转变为中度拥塞状态,对应的buffer拥塞等级为等级2。When the packet count value is less than threshold2 and the current port is in a heavily congested state, the port will change from a heavily congested state to a moderately congested state, and the corresponding buffer congestion level is level 2.

当报文计数值大于threshold1时,并且当前端口处于不拥塞状态,那么端口将从不拥塞状态转变为轻度拥塞状态,对应的buffer拥塞等级为等级1。When the packet count value is greater than threshold1 and the current port is in the uncongested state, the port will change from the uncongested state to the lightly congested state, and the corresponding buffer congestion level is level 1.

当报文计数值大于threshold2时,并且当前端口处于轻度拥塞状态,那么端口将从轻度拥塞状态转变为中度拥塞状态,对应的buffer拥塞等级为等级2。When the packet count is greater than threshold2 and the current port is in a mildly congested state, the port will change from a lightly congested state to a moderately congested state, and the corresponding buffer congestion level is level 2.

当报文计数值大于threshold3时,并且当前端口处于中度拥塞状态,那么端口将从中度拥塞状态转变为重度拥塞状态,对应的buffer拥塞等级为等级3。When the packet count is greater than threshold3 and the current port is in a moderately congested state, the port will change from a moderately congested state to a severely congested state, and the corresponding buffer congestion level is level 3.

本发明实施例还提供了一种应用于线片的交换芯片的防丢包方法,下面将进行详细介绍。The embodiment of the present invention also provides an anti-packet loss method applied to a switch chip of a wire slice, which will be described in detail below.

请参照图8,该防丢包方法包括步骤S301~S302。Please refer to FIG. 8 , the packet loss prevention method includes steps S301-S302.

S301,接收网片的交换芯片发送的流控帧。S301. Receive a flow control frame sent by a switch chip of a mesh.

其中,流控帧携带有网片的端口的buffer拥塞等级。Among them, the flow control frame carries the buffer congestion level of the port with the mesh slice.

S302,根据网片的端口的buffer拥塞等级,调整向网片的端口发送数据报文的速率,以避免网卡的端口因拥塞出现丢包。S302. Adjust the rate of sending data packets to the port of the network chip according to the buffer congestion level of the port of the network chip, so as to avoid packet loss at the port of the network card due to congestion.

可选地,步骤S302的实现过程存在以下四种情况。Optionally, there are the following four situations in the implementation process of step S302.

情况1,若网片的端口的buffer拥塞等级为第一预设等级,则将向网片的端口发送数据报文的速率提高至预设最大速率。In case 1, if the buffer congestion level of the port of the network chip is the first preset level, the rate of sending data packets to the port of the network chip is increased to the preset maximum rate.

情况2,若网片的端口的buffer拥塞等级为第二预设等级,则将向网片的端口发送数据报文的速率按照第一预设降幅进行降低。In case 2, if the buffer congestion level of the port of the network chip is the second preset level, the rate of sending data packets to the port of the network chip is reduced according to the first preset reduction rate.

情况3,若网片的端口的buffer拥塞等级为第三预设等级,则将向网片的端口发送数据报文的速率按照第二预设降幅进行降低。In case 3, if the buffer congestion level of the port of the network chip is the third preset level, the rate of sending data packets to the port of the network chip is reduced according to the second preset reduction rate.

情况4,若网片的端口的buffer拥塞等级为第四预设等级,则将向网片的端口发送数据报文的速率降低至预设最小速率。In case 4, if the buffer congestion level of the port of the network chip is the fourth preset level, the rate of sending data packets to the port of the network chip is reduced to a preset minimum rate.

其中,预设最大速率、第一预设降幅、第二预设降幅以及预设最小速率可以根据实际需要进行设定。Wherein, the preset maximum rate, the first preset decrease rate, the second preset decrease rate and the preset minimum rate can be set according to actual needs.

示例性地,假设第一预设等级、第二预设等级、第三预设等级和第四预设等级分别用等级0、等级1、等级2和等级3表示,预设最大速率为100Gbps,预设最小速率为0Gbps,第一预设降幅为80%,第二预设降幅为20%。For example, assuming that the first preset level, the second preset level, the third preset level and the fourth preset level are represented by level 0, level 1, level 2 and level 3 respectively, and the preset maximum rate is 100Gbps, The preset minimum rate is 0Gbps, the first preset drop rate is 80%, and the second preset drop rate is 20%.

等级0,表示端口buffer未拥塞,线卡向网片的端口发送数据报文的速率可以提高到100Gbps;等级1,表示端口buffer出现轻微拥塞,线卡向网片的端口发送数据报文的速率需要少许降低,降至预设最大速率的80%,即100Gbps*80%=80Gbps;等级2,表示端口buffer出现中度拥塞,线卡向网片的端口发送数据报文的速率需要大幅降低降至预设最大速率的20%,即100Gbps*20%=20Gbps;等级3,表示端口buffer出现严重拥塞,线卡需要立即停止向网片的端口发送数据报文,即将线卡向网片的端口发送数据报文的速率降低至0Gbps。Level 0 means that the port buffer is not congested, and the rate at which the line card sends data packets to the port of the network chip can be increased to 100Gbps; level 1, indicates that the port buffer is slightly congested, and the rate at which the line card sends data packets to the port of the network chip A little reduction is required to reduce to 80% of the preset maximum rate, that is, 100Gbps*80%=80Gbps; level 2 means that the port buffer is moderately congested, and the rate at which the line card sends data packets to the port of the network chip needs to be greatly reduced. Up to 20% of the preset maximum rate, that is, 100Gbps*20%=20Gbps; level 3 means that the port buffer is seriously congested, and the line card needs to stop sending data packets to the port of the network chip immediately, that is, the line card sends data packets to the port of the network chip The rate of sending data packets is reduced to 0Gbps.

为了减轻网卡的交换芯片频繁向线卡的交换芯片发送流控帧,对于上述情况2~4,该防丢包方法还下述流程。In order to alleviate the frequent sending of flow control frames by the switching chip of the network card to the switching chip of the line card, for the above-mentioned cases 2-4, the packet loss prevention method also includes the following procedure.

首先,在将向网片的端口发送数据报文的速率降低后,控制线卡的计数器开始计数。First, after reducing the rate of sending data packets to the port of the network chip, the counter of the control line card starts counting.

然后,若检测到计数器的值大于预设阈值,则将向网片的端口发送数据报文的速率在预设时间范围内逐步提高至预设最大速率。Then, if it is detected that the value of the counter is greater than the preset threshold, the rate of sending data packets to the port of the network slice is gradually increased to the preset maximum rate within the preset time range.

其中,预设阈值可以根据实际需要进行设定。Wherein, the preset threshold can be set according to actual needs.

可以理解地,当网片端口的拥塞程度往更严重一级变化时,线卡的交换芯片收到流控帧后,根据流控帧中的buffer拥塞等级,将向网片的端口发送数据报文的速率降低,并且线卡的计数器开始计数,当计数器的值达到预设阈值时,开始逐步将向网片的端口发送数据报文的速率提高,直到达到预设最大速率,从而可以在多个端口存在buffer拥塞时,可以网卡的交换芯片频繁向线卡的交换芯片发送流控帧的情况。It is understandable that when the congestion level of the mesh port changes to a more serious level, the switching chip of the line card will send a datagram to the port of the mesh according to the buffer congestion level in the flow control frame after receiving the flow control frame. The rate of data packets decreases, and the counter of the line card starts counting. When the value of the counter reaches the preset threshold value, the rate of sending data packets to the port of the network chip is gradually increased until it reaches the preset maximum rate, so that it can be used in multiple When there is buffer congestion on a port, the switch chip of the network card may frequently send flow control frames to the switch chip of the line card.

为了执行上述方法实施例及各个可能的实施方式中的相应步骤,下面给出一种应用于网片的交换芯片的防丢包装置100的实现方式和一种应用于线卡的交换芯片的防丢包装置200。In order to execute the corresponding steps in the above method embodiments and various possible implementations, an implementation of an anti-packet loss device 100 applied to a switch chip of a network chip and an anti-packet loss device 100 applied to a switch chip of a line card are given below. Packet discarding device 200.

请参照图9,该应用于网片的交换芯片的防丢包装置100包括生成模块101、发送模块102和获取模块103。Referring to FIG. 9 , the anti-packet loss device 100 applied to a switch chip of a mesh includes a generation module 101 , a sending module 102 and an acquisition module 103 .

生成模块101,用于生成携带有网片的端口的buffer拥塞等级的流控帧。The generating module 101 is configured to generate a flow control frame carrying the buffer congestion level of the port of the mesh slice.

发送模块102,用于将流控帧发送给线卡的交换芯片,以使线卡的交换芯片根据网片的端口的buffer拥塞等级,调整向网片的端口发送数据报文的速率,避免网卡的端口因拥塞出现丢包。The sending module 102 is used to send the flow control frame to the switch chip of the line card, so that the switch chip of the line card adjusts the rate of sending data packets to the port of the network chip according to the buffer congestion level of the port of the network chip, so as to avoid network card Packet loss occurs on the port due to congestion.

可选地,获取模块103用于获取针对网片的端口的报文计数值,其中,报文计数值的变化表征网片的端口转入或转出数据报文;根据报文计数值,确定网片的端口的buffer拥塞等级。Optionally, the obtaining module 103 is used to obtain the packet count value for the port of the network slice, wherein the change of the packet count value represents that the port of the network slice is transferred into or out of the data packet; according to the packet count value, determine The buffer congestion level of the port on the mesh.

可选地,获取模块103具体用于若报文计数值小于第一预设值、且网片的端口处于轻度拥塞状态,则确定网片的端口的buffer拥塞等级为第一预设等级;若报文计数值小于第二预设值、且所述网片的端口处于中度拥塞状态,则确定网片的端口的buffer拥塞等级为第二预设等级;若报文计数值小于第三预设值、且网片的端口处于重度拥塞状态,则确定网片的端口的buffer拥塞等级为第三预设等级。Optionally, the obtaining module 103 is specifically configured to determine that the buffer congestion level of the port of the mesh is the first preset level if the packet count value is less than the first preset value and the port of the mesh is in a mildly congested state; If the message count value is less than the second preset value and the port of the network slice is in a moderately congested state, then determine that the buffer congestion level of the port of the network slice is the second preset level; if the message count value is less than the third preset value, and the port of the network chip is in a heavily congested state, then it is determined that the buffer congestion level of the port of the network chip is the third preset level.

可选地,获取模块103还具体用于若报文计数值大于第二预设值、且网片的端口处于不拥塞状态,则确定网片的端口的buffer拥塞等级为第二预设等级;若报文计数值大于第三预设值、且网片的端口处于轻度拥塞状态,则确定网片的端口的buffer拥塞等级为第三预设等级;若报文计数值大于第四预设值、且网片的端口处于中度拥塞状态,则确定网片的端口的buffer拥塞等级为第四预设等级。Optionally, the obtaining module 103 is also specifically configured to determine that the buffer congestion level of the port of the mesh is the second preset level if the packet count value is greater than the second preset value and the port of the mesh is in an uncongested state; If the message count value is greater than the third preset value, and the port of the network slice is in a mildly congested state, then determine that the buffer congestion level of the port of the network slice is the third preset level; if the message count value is greater than the fourth preset value, and the port of the mesh is in a moderately congested state, then determine that the buffer congestion level of the port of the mesh is the fourth preset level.

请参照图10,该应用于线卡的交换芯片的防丢包装置200包括接收模块201和调整模块202。Referring to FIG. 10 , the anti-packet loss device 200 applied to a switch chip of a line card includes a receiving module 201 and an adjusting module 202 .

接收模块201,用于接收网片的交换芯片发送的流控帧,流控帧携带有网片的端口的buffer拥塞等级。The receiving module 201 is configured to receive the flow control frame sent by the switch chip of the mesh, and the flow control frame carries the buffer congestion level of the port of the mesh.

调整模块202,用于根据网片的端口的buffer拥塞等级,调整向网片的端口发送数据报文的速率,以避免网卡的端口因拥塞出现丢包。The adjustment module 202 is configured to adjust the rate of sending data packets to the port of the network chip according to the buffer congestion level of the port of the network chip, so as to avoid packet loss at the port of the network card due to congestion.

可选地,调整模块202具体用于若网片的端口的buffer拥塞等级为第一预设等级,则将向网片的端口发送数据报文的速率提高至预设最大速率;若所述网片的端口的buffer拥塞等级为第二预设等级,则将向网片的端口发送数据报文的速率按照第一预设降幅进行降低;若网片的端口的buffer拥塞等级为第三预设等级,则将向网片的端口发送数据报文的速率按照第二预设降幅进行降低,其中,第二预设降幅大于第一预设降幅;若网片的端口的buffer拥塞等级为第四预设等级,则将向网片的端口发送数据报文的速率降低至预设最小速率。Optionally, the adjustment module 202 is specifically configured to increase the rate of sending data packets to the port of the mesh to a preset maximum rate if the buffer congestion level of the port of the mesh is the first preset level; If the buffer congestion level of the port of the mesh slice is the second preset level, the rate of sending data packets to the port of the mesh slice will be reduced according to the first preset reduction rate; if the buffer congestion level of the port of the mesh slice is the third preset level level, then the rate of sending data packets to the port of the network chip is reduced according to the second preset reduction rate, wherein the second preset reduction rate is greater than the first preset reduction rate; if the buffer congestion level of the port of the network chip is the fourth If the preset level is selected, the rate of sending data packets to the port of the network chip will be reduced to the preset minimum rate.

可选地,调整模块202还具体用于在将向网片的端口发送数据报文的速率降低后,控制线卡的计数器开始计数;若检测到计数器的值大于预设阈值,则将向网片的端口发送数据报文的速率在预设时间范围内逐步提高至所述预设最大速率。Optionally, the adjustment module 202 is also specifically configured to control the counter of the line card to start counting after reducing the rate of sending data packets to the ports of the network slice; The rate at which the ports of the slices send data packets is gradually increased to the preset maximum rate within a preset time range.

所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的应用于网片的交换芯片的防丢包装置100和应用于线卡的交换芯片的防丢包装置200的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific details of the above-described packet loss prevention device 100 applied to the switch chip of the network chip and the packet loss prevention device 200 applied to the switch chip of the line card For the working process, reference may be made to the corresponding process in the foregoing method embodiments, which will not be repeated here.

本发明实施例还提供一种安装在网片上的交换芯片,该交换芯片存在逻辑器件,逻辑器件烧录有计算机程序,计算机程序被执行时实现如上述的方法实施例提供的方法中的相关操作。The embodiment of the present invention also provides a switching chip installed on a mesh chip, the switching chip has a logic device, and the logic device is burned with a computer program, and when the computer program is executed, the relevant operations in the method provided by the above-mentioned method embodiment are implemented. .

本发明实施例还提供一种安装在线卡上的交换芯片,该交换芯片存在逻辑器件,逻辑器件烧录有计算机程序,计算机程序被执行时实现如上述的方法实施例提供的方法中的相关操作。The embodiment of the present invention also provides a switching chip installed on the line card, the switching chip has a logic device, and the logic device is burned with a computer program, and when the computer program is executed, the relevant operations in the method provided by the above-mentioned method embodiment are realized. .

本发明实施例还提供一种包含计算机程序的计算机可读存储介质,计算机程序在被执行时可以用于执行上述的方法实施例提供的方法中的相关操作。An embodiment of the present invention also provides a computer-readable storage medium containing a computer program. When executed, the computer program can be used to perform related operations in the method provided by the above-mentioned method embodiment.

综上,本发明实施例提供的防丢包方法及相关装置,首先,生成携带有网片的端口的buffer拥塞等级的流控帧;然后,将流控帧发送给线卡的交换芯片,以使线卡的交换芯片根据网片的端口的buffer拥塞等级,调整向网片的端口发送数据报文的速率。由于本发明实施例例通过向线卡的交换芯片发送携带有网片的端口的buffer拥塞等级的流控帧,使线卡的交换芯片根据网片的端口的buffer拥塞等级,调整向网片的端口发送数据报文的速率,从而避免网卡的端口因拥塞出现丢包。To sum up, the anti-packet loss method and related devices provided by the embodiments of the present invention first generate a flow control frame carrying the buffer congestion level of the port of the mesh; then, send the flow control frame to the switch chip of the line card to The switching chip of the line card adjusts the rate of sending data packets to the port of the network chip according to the buffer congestion level of the port of the network chip. Because the embodiment of the present invention sends the flow control frame carrying the buffer congestion level of the port of the network chip to the switch chip of the line card, the switch chip of the line card is adjusted to the buffer congestion level of the port of the network chip according to the buffer congestion level of the port of the network chip. The rate at which the port sends data packets, so as to avoid packet loss due to congestion on the port of the network card.

以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到的变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以所述权利要求的保护范围为准。The above is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Anyone skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present invention. All should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be determined by the protection scope of the claims.

Claims (13)

1.一种防丢包方法,其特征在于,应用于网络交换机机架中的网片的交换芯片,所述网络交换机机架还包括线卡,所述线卡的交换芯片与所述网片的交换芯片通信连接,所述方法包括:1. A method for preventing packet loss, characterized in that, it is applied to the switching chip of the mesh in the network switch frame, and the network switch frame also includes a line card, and the switching chip of the line card is connected to the mesh The communication connection of the switch chip, the method includes: 生成携带有所述网片的端口的buffer拥塞等级的流控帧;Generate a flow control frame carrying the buffer congestion level of the port of the mesh; 将所述流控帧发送给所述线卡的交换芯片,以使所述线卡的交换芯片根据所述网片的端口的buffer拥塞等级,调整向所述网片的端口发送数据报文的速率,避免所述网卡的端口因拥塞出现丢包。Send the flow control frame to the switch chip of the line card, so that the switch chip of the line card adjusts the number of data packets sent to the port of the network chip according to the buffer congestion level of the port of the network chip rate to avoid packet loss at the port of the network card due to congestion. 2.如权利要求1所述的方法,其特征在于,在所述生成携带有所述网片的端口的buffer拥塞等级的流控帧之前,所述方法还包括获取所述网片的端口的buffer拥塞等级的步骤,其包括:2. The method according to claim 1, wherein, before the generation of the flow control frame carrying the buffer congestion level of the port of the mesh, the method further comprises obtaining the port information of the mesh The steps of buffer congestion level include: 获取针对所述网片的端口的报文计数值,其中,所述报文计数值的变化表征所述网片的端口转入或转出数据报文;Obtaining a packet count value for a port of the network slice, wherein a change in the packet count value indicates that a port of the network slice is transferred into or out of a data packet; 根据所述报文计数值,确定所述网片的端口的buffer拥塞等级。Determine the buffer congestion level of the port of the network slice according to the packet count value. 3.如权利要求2所述的方法,其特征在于,所述根据所述报文计数值,确定所述网片的端口的buffer拥塞等级的步骤包括:3. The method according to claim 2, wherein, according to the message count value, the step of determining the buffer congestion level of the port of the mesh slice comprises: 若所述报文计数值小于第一预设值、且所述网片的端口处于轻度拥塞状态,则确定所述网片的端口的buffer拥塞等级为第一预设等级;If the packet count value is less than a first preset value and the port of the mesh is in a mildly congested state, then determine that the buffer congestion level of the port of the mesh is the first preset level; 若所述报文计数值小于第二预设值、且所述网片的端口处于中度拥塞状态,则确定所述网片的端口的buffer拥塞等级为第二预设等级;If the packet count value is less than a second preset value and the port of the mesh is in a moderately congested state, then determine that the buffer congestion level of the port of the mesh is a second preset level; 若所述报文计数值小于第三预设值、且所述网片的端口处于重度拥塞状态,则确定所述网片的端口的buffer拥塞等级为第三预设等级。If the packet count value is less than a third preset value and the port of the network slice is in a heavily congested state, then determine that the buffer congestion level of the port of the network slice is a third preset level. 4.如权利要求3所述的方法,其特征在于,所述根据所述报文计数值,确定所述网片的端口的buffer拥塞等级的步骤还包括:4. the method for claim 3, is characterized in that, described according to described message counter value, the step of determining the buffer congestion level of the port of described network slice also comprises: 若所述报文计数值大于第二预设值、且所述网片的端口处于不拥塞状态,则确定所述网片的端口的buffer拥塞等级为第二预设等级;If the packet count value is greater than a second preset value and the port of the mesh is in an uncongested state, then determine that the buffer congestion level of the port of the mesh is a second preset level; 若所述报文计数值大于第三预设值、且所述网片的端口处于轻度拥塞状态,则确定所述网片的端口的buffer拥塞等级为第三预设等级;If the packet count value is greater than a third preset value and the port of the mesh is in a mildly congested state, then determine that the buffer congestion level of the port of the mesh is a third preset level; 若所述报文计数值大于第四预设值、且所述网片的端口处于中度拥塞状态,则确定所述网片的端口的buffer拥塞等级为第四预设等级。If the packet count value is greater than a fourth preset value and the port of the mesh is in a moderately congested state, determine that the buffer congestion level of the port of the mesh is a fourth preset level. 5.一种防丢包方法,其特征在于,应用于网络交换机机架中的线卡的交换芯片,所述网络交换机机架还包括网片,所述网片的交换芯片与所述线卡的交换芯片通信连接,所述方法包括:5. A method for preventing packet loss, characterized in that, it is applied to the exchange chip of the line card in the network switch rack, and the network switch rack also includes a mesh, and the exchange chip of the mesh and the line card The communication connection of the switch chip, the method includes: 接收所述网片的交换芯片发送的流控帧,所述流控帧携带有所述网片的端口的buffer拥塞等级;receiving the flow control frame sent by the switch chip of the mesh, the flow control frame carrying the buffer congestion level of the port of the mesh; 根据所述网片的端口的buffer拥塞等级,调整向所述网片的端口发送数据报文的速率,以避免所述网卡的端口因拥塞出现丢包。According to the buffer congestion level of the port of the network chip, the rate of sending data packets to the port of the network chip is adjusted, so as to avoid packet loss at the port of the network card due to congestion. 6.如权利要求5所述的方法,其特征在于,所述根据所述网片的端口的buffer拥塞等级,调整向所述网片的端口发送数据报文的速率的步骤包括:6. The method according to claim 5, wherein, according to the buffer congestion level of the port of the mesh, the step of adjusting the rate of sending a data message to the port of the mesh comprises: 若所述网片的端口的buffer拥塞等级为第一预设等级,则将向所述网片的端口发送数据报文的速率提高至预设最大速率;If the buffer congestion level of the port of the mesh is the first preset level, the rate of sending data packets to the port of the mesh is increased to a preset maximum rate; 若所述网片的端口的buffer拥塞等级为第二预设等级,则将向所述网片的端口发送数据报文的速率按照第一预设降幅进行降低;If the buffer congestion level of the port of the mesh is the second preset level, the rate of sending data packets to the port of the mesh is reduced according to the first preset reduction rate; 若所述网片的端口的buffer拥塞等级为第三预设等级,则将向所述网片的端口发送数据报文的速率按照第二预设降幅进行降低,其中,所述第二预设降幅大于所述第一预设降幅;If the buffer congestion level of the port of the network slice is the third preset level, the rate of sending data packets to the port of the network slice is reduced according to the second preset reduction rate, wherein the second preset The drop rate is greater than the first preset drop rate; 若所述网片的端口的buffer拥塞等级为第四预设等级,则将向所述网片的端口发送数据报文的速率降低至预设最小速率。If the buffer congestion level of the port of the network slice is the fourth preset level, the rate of sending data packets to the port of the network slice is reduced to a preset minimum rate. 7.如权利要求6所述的方法,其特征在于,所述方法还包括:7. The method of claim 6, further comprising: 在将向所述网片的端口发送数据报文的速率降低后,控制所述线卡的计数器开始计数;After reducing the rate of sending data packets to the port of the network chip, the counter for controlling the line card starts counting; 若检测到所述计数器的值大于预设阈值,则将向所述网片的端口发送数据报文的速率在预设时间范围内逐步提高至所述预设最大速率。If it is detected that the value of the counter is greater than the preset threshold, the rate of sending data packets to the port of the network slice is gradually increased to the preset maximum rate within a preset time range. 8.一种防丢包装置,其特征在于,应用于网络交换机机架中的网片的交换芯片,所述网络交换机机架还包括线卡,所述线卡的交换芯片与所述网片的交换芯片通信连接,所述装置包括:8. An anti-packet loss device, characterized in that, it is applied to the switching chip of the mesh in the network switch frame, and the network switch frame also includes a line card, and the switching chip of the line card is connected to the mesh The communication connection of the switch chip, the device includes: 生成模块,用于生成携带有所述网片的端口的buffer拥塞等级的流控帧;A generating module, configured to generate a flow control frame carrying the buffer congestion level of the port of the mesh; 发送模块,用于将所述流控帧发送给所述线卡的交换芯片,以使所述线卡的交换芯片根据所述网片的端口的buffer拥塞等级,调整向所述网片的端口发送数据报文的速率,避免所述网卡的端口因拥塞出现丢包。A sending module, configured to send the flow control frame to the switch chip of the line card, so that the switch chip of the line card adjusts the port to the network chip according to the buffer congestion level of the port of the network chip The rate at which data packets are sent to avoid packet loss at the port of the network card due to congestion. 9.一种防丢包装置,其特征在于,应用于网络交换机机架中的线卡的交换芯片,所述网络交换机机架还包括网片,所述网片的交换芯片与所述线卡的交换芯片通信连接,所述装置包括:9. An anti-packet loss device, characterized in that it is applied to the switching chip of the line card in the network switch rack, and the network switch rack also includes a mesh, and the switching chip of the mesh and the line card The communication connection of the switch chip, the device includes: 接收模块,用于接收所述网片的交换芯片发送的流控帧,所述流控帧携带有所述网片的端口的buffer拥塞等级;A receiving module, configured to receive a flow control frame sent by the switch chip of the mesh, the flow control frame carrying the buffer congestion level of the port of the mesh; 调整模块,用于根据所述网片的端口的buffer拥塞等级,调整向所述网片的端口发送数据报文的速率,以避免所述网卡的端口因拥塞出现丢包。An adjustment module, configured to adjust the rate of sending data packets to the port of the mesh according to the buffer congestion level of the port of the mesh, so as to avoid packet loss at the port of the network card due to congestion. 10.一种交换芯片,其特征在于,所述交换芯片存在逻辑器件,所述逻辑器件烧录有计算机程序,所述计算机程序被执行时实现如权利要求1~4任一项所述的防丢包方法。10. A switch chip, characterized in that the switch chip has a logic device, and the logic device is programmed with a computer program, and when the computer program is executed, the anti-virus protection according to any one of claims 1 to 4 is realized. Packet drop method. 11.一种交换芯片,其特征在于,所述交换芯片存在逻辑器件,所述逻辑器件烧录有计算机程序,所述计算机程序被执行时实现如权利要求5~7任一项所述的防丢包方法。11. A switch chip, characterized in that the switch chip has a logic device, and the logic device is programmed with a computer program, and when the computer program is executed, the anti-virus protection according to any one of claims 5 to 7 is realized. Packet drop method. 12.一种网络交换机机架,其特征在于,所述网络交换机机架包括多个网片和多个线卡,每个所述网片上均存在如权利要求10所述的交换芯片,每个所述线卡上均存在如权利要求11所述的交换芯片。12. A network switch frame, characterized in that, the network switch frame includes a plurality of mesh sheets and a plurality of line cards, each of the mesh sheets has a switching chip as claimed in claim 10, each The switching chips as claimed in claim 11 all exist on the line cards. 13.一种计算机可读存储介质,其特征在于,其存储有计算机程序,所述计算机程序被执行时实现如权利要求1~4任一项所述的防丢包方法或如权利要求5~7任一项所述的防丢包方法。13. A computer-readable storage medium, characterized in that it stores a computer program, and when the computer program is executed, it implements the anti-packet loss method according to any one of claims 1 to 4 or the method according to any one of claims 5 to 5. 7. The anti-packet loss method described in any one.
CN202211735122.6A 2022-12-30 2022-12-30 Packet loss prevention method and related device Active CN115955440B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211735122.6A CN115955440B (en) 2022-12-30 2022-12-30 Packet loss prevention method and related device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211735122.6A CN115955440B (en) 2022-12-30 2022-12-30 Packet loss prevention method and related device

Publications (2)

Publication Number Publication Date
CN115955440A true CN115955440A (en) 2023-04-11
CN115955440B CN115955440B (en) 2025-07-08

Family

ID=87297061

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211735122.6A Active CN115955440B (en) 2022-12-30 2022-12-30 Packet loss prevention method and related device

Country Status (1)

Country Link
CN (1) CN115955440B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6118761A (en) * 1997-12-18 2000-09-12 Advanced Micro Devices, Inc. Apparatus and method for generating rate control frames in a workgroup switch based on traffic contribution from a network switch port
CN104092632A (en) * 2014-07-14 2014-10-08 杭州华三通信技术有限公司 Network equipment
CN106533962A (en) * 2017-01-10 2017-03-22 盛科网络(苏州)有限公司 Internal flow control method of distributed switch system
WO2021217641A1 (en) * 2020-04-30 2021-11-04 华为技术有限公司 Congestion control method, network device, and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6118761A (en) * 1997-12-18 2000-09-12 Advanced Micro Devices, Inc. Apparatus and method for generating rate control frames in a workgroup switch based on traffic contribution from a network switch port
CN104092632A (en) * 2014-07-14 2014-10-08 杭州华三通信技术有限公司 Network equipment
CN106533962A (en) * 2017-01-10 2017-03-22 盛科网络(苏州)有限公司 Internal flow control method of distributed switch system
WO2021217641A1 (en) * 2020-04-30 2021-11-04 华为技术有限公司 Congestion control method, network device, and system

Also Published As

Publication number Publication date
CN115955440B (en) 2025-07-08

Similar Documents

Publication Publication Date Title
CN110278157B (en) Congestion control method and network equipment
CN100574310C (en) A kind of credit flow control method
CN109417514B (en) Message sending method and device and storage equipment
CN101867511B (en) Pause frame sending method, associated equipment and system
CN112953848B (en) Traffic supervision method, system and equipment based on strict priority
US8576850B2 (en) Band control apparatus, band control method, and storage medium
US11258717B2 (en) Method for sending service packet, network device, and system
CN106789729A (en) Buffer memory management method and device in a kind of network equipment
CN113076280B (en) Data transmission method and related equipment
WO2020134425A1 (en) Data processing method, apparatus, and device, and storage medium
CN103685061B (en) cache data control method and device
CN113612696A (en) Congestion control metrics in multi-host network adapters
CN110830382A (en) Message processing method and device, communication device and switching circuit
CN115967687A (en) Method for fast forwarding message, network device, storage medium and computer program product
CN112003796B (en) Broadcast message processing method, system, equipment and computer storage medium
CN115022227B (en) Data transmission method and system based on circulation or rerouting in data center network
CN116233018A (en) Message processing method, device, electronic device and storage medium
JP6234236B2 (en) Communication device
CN114286447A (en) Method, device and storage medium for adjusting scheduling priority
CN115955440A (en) Anti-lost packet method and related device
CN109729014B (en) A message storage method and device
EP4344155A1 (en) Packet scheduling method and apparatus
CN114567566B (en) Message processing method, device, terminal equipment and storage medium
CN111371692B (en) Window control method and device based on TCP (Transmission control protocol) and electronic equipment
CN115174476B (en) A kind of ECN control method, device and medium

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
GR01 Patent grant