Packet Loss Prevention Method and Related Devices
By generating and sending flow control frames carrying the congestion level of the mesh port buffer, adjusting the data transmission rate of the line card to the mesh port, solving the packet loss problem caused by mesh cache overflow and improving the data transmission reliability of the network switch rack.
Patent Information
- Application Number
- CN202211735122.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-30
- Publication Date
- 2025-07-08
- Estimated Expiration
- 2042-12-30
AI Technical Summary
The prior art cannot effectively solve the packet loss problem caused by cache overflow of mesh chips in network switch racks, especially when the transmission rate of the online card and mesh chips is the same, the packet loss phenomenon caused by cache overflow of mesh chips.
By generating a flow control frame carrying the congestion level of the mesh port buffer and sending it to the line card's switching chip to adjust the rate at which the line card sends data packets to the mesh port, avoiding packet loss caused by congestion on the mesh port.
It effectively avoids packet loss caused by congestion on mesh ports, and improves the reliability and efficiency of data transmission.
Smart Images

Figure CN115955440B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data networks, and more particularly, to a method for preventing packet loss and related devices. Background Art
[0002] A network switch rack consists of multiple line cards and network chips. Each line card and network chip has a switching chip for exchanging data packets. A data packet entering through the panel port of any line card can be forwarded by this line card, that is, going out through any port of this line card. The data packet can also be forwarded in the way of line card -> network chip -> line card.
[0003] Since the transmission rate of the panel ports of the line cards and network chips is fixed, when the receiving bandwidth of any line card or network chip is greater than the sending bandwidth, buffer overflow will occur, and then packet loss will occur.
[0004] The current packet loss prevention technology is mainly proposed for sudden congestion of line cards. When the transmission rates of the panel ports of line cards and network chips are the same, sudden congestion will occur on the network chip, resulting in buffer overflow of the network chip and packet loss. Summary of the Invention
[0005] To overcome the deficiencies of the prior art, embodiments of the present invention provide a method for preventing packet loss and related devices.
[0006] The technical solution of the embodiments of the present invention can be implemented as follows:
[0007] In a first aspect, an embodiment of the present invention provides a method for preventing packet loss, which is applied to the switching chip of a network chip in a network switch rack. The network switch rack further includes line cards, and the switching chips of the line cards are communicatively connected to the switching chip of the network chip. The method includes:
[0008] Generating a flow control frame carrying the buffer congestion level of the port of the network chip;
[0009] Sending the flow control frame to the switching chip of the line card, so that 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, and avoids packet loss due to congestion at the port of the network card.
[0010] Optionally, before generating the flow control frame carrying the buffer congestion level of the port of the network chip, the method further includes the step of obtaining the buffer congestion level of the port of the network chip, which includes:
[0011] Obtaining the packet count value for the port of the network chip, where the change in the packet count value represents the transfer of data packets into or out of the port of the network chip;
[0012] Determine the buffer congestion level of the port of the network slice according to the packet count value.
[0013] Optionally, the step of determining the buffer congestion level of the port of the network slice according to the packet count value includes:
[0014] If the packet count value is less than the first preset value and the port of the network slice is in a mild congestion state, determine that the buffer congestion level of the port of the network slice is the first preset level;
[0015] If the packet count value is less than the second preset value and the port of the network slice is in a moderate congestion state, determine that the buffer congestion level of the port of the network slice is the second preset level;
[0016] If the packet count value is less than the third preset value and the port of the network slice is in a severe congestion state, determine that the buffer congestion level of the port of the network slice is the third preset level.
[0017] Optionally, the step of determining the buffer congestion level of the port of the network slice according to the packet count value further includes:
[0018] If the packet count value is greater than the second preset value and the port of the network slice is in an uncongested state, determine that the buffer congestion level of the port of the network slice is the second preset level;
[0019] If the packet count value is greater than the third preset value and the port of the network slice is in a mild congestion state, determine that the buffer congestion level of the port of the network slice is the third preset level;
[0020] If the packet count value is greater than the fourth preset value and the port of the network slice is in a moderate congestion state, determine that the buffer congestion level of the port of the network slice is the fourth preset level.
[0021] In a second aspect, an embodiment of the present invention provides a packet loss prevention method, which is applied to a switching chip of a line card in a network switch rack. The network switch rack further includes a network slice, and the switching chip of the network slice is communicatively connected to the switching chip of the line card. The method includes:
[0022] Receive a flow control frame sent by the switching chip of the network slice, where the flow control frame carries the buffer congestion level of the port of the network slice;
[0023] Adjust the rate of sending data packets to the port of the network slice according to the buffer congestion level of the port of the network slice, so as to avoid packet loss due to congestion at the port of the network card.
[0024] 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:
[0025] If the buffer congestion level of the port of the mesh is the first preset level, then increase the rate of sending data packets to the port of the mesh to the preset maximum rate;
[0026] If the buffer congestion level of the port of the mesh is the second preset level, then decrease the rate of sending data packets to the port of the mesh according to the first preset reduction;
[0027] If the buffer congestion level of the port of the mesh is the third preset level, then decrease the rate of sending data packets to the port of the mesh according to the second preset reduction, where the second preset reduction is greater than the first preset reduction;
[0028] If the buffer congestion level of the port of the mesh is the fourth preset level, then decrease the rate of sending data packets to the port of the mesh to the preset minimum rate.
[0029] Optionally, the method further includes:
[0030] After decreasing the rate of sending data packets to the port of the mesh, control the counter of the line card to start counting;
[0031] If it is detected that the value of the counter is greater than the preset threshold, then gradually increase the rate of sending data packets to the port of the mesh to the preset maximum rate within the preset time range.
[0032] In a third aspect, an embodiment of the present invention provides an anti-packet-loss device, which is applied to the switching chip of the mesh in a network switch rack. The network switch rack further includes a line card, and the switching chip of the line card is communicatively connected to the switching chip of the mesh. The device includes:
[0033] A generation module, configured to generate a flow control frame carrying the buffer congestion level of the port of the mesh;
[0034] A sending module, configured to send the flow control frame to the switching chip of the line card, so that the switching chip of the line card adjusts the rate of sending data packets to the port of the mesh according to the buffer congestion level of the port of the mesh, and avoid packet loss at the port of the network card due to congestion.
[0035] Fourth aspect, an embodiment of the present invention provides a packet loss prevention device, which is applied to a switching chip of a line card in a network switch rack. The network switch rack further includes a network slice. The switching chip of the network slice is communicatively connected to the switching chip of the line card. The device includes:
[0036] A receiving module, configured to receive a flow control frame sent by the switching chip of the network slice, where the flow control frame carries the buffer congestion level of the port of the network slice;
[0037] An adjustment module, configured to adjust the rate of sending data packets to the port of the network slice according to the buffer congestion level of the port of the network slice, so as to avoid packet loss due to congestion at the port of the network card.
[0038] Fifth aspect, an embodiment of the present invention provides a switching chip, where there is a logic device in the switching chip, and a computer program is burned in the logic device. When the computer program is executed, it implements the packet loss prevention method as described in the first aspect.
[0039] Sixth aspect, an embodiment of the present invention provides a switching chip, where there is a logic device in the switching chip, and a computer program is burned in the logic device. When the computer program is executed, it implements the packet loss prevention method as described in the second aspect.
[0040] Seventh aspect, an embodiment of the present invention provides a network switch rack, which includes a plurality of network slices and a plurality of line cards. There is a switching chip as described in the fifth aspect on each network slice, and there is a switching chip as described in the sixth aspect on each line card.
[0041] Third aspect, an embodiment of the present invention provides a computer-readable storage medium, which stores a computer program. When the computer program is executed, it implements the packet loss prevention method as described in the first aspect or the packet loss prevention method as described in the second aspect.
[0042] Compared with the prior art, for the packet loss prevention method applied to the switching chip of the network slice in the network switch rack provided by the embodiment of the present invention, first, a flow control frame carrying the buffer congestion level of the port of the network slice is generated; then, the flow control frame is sent to the switching chip of the line card, so that the switching chip of the line card adjusts the rate of sending data packets to the port of the network slice according to the buffer congestion level of the port of the network slice. Since the embodiment of the present invention sends a flow control frame carrying the buffer congestion level of the port of the network slice to the switching chip of the line card, the switching chip of the line card adjusts the rate of sending data packets to the port of the network slice according to the buffer congestion level of the port of the network slice, thereby avoiding packet loss due to congestion at the port of the network card. Description of the Drawings
[0043] To more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the accompanying drawings required in the embodiments. It should be understood that the following drawings only show some embodiments of the present invention, and thus should not be regarded as limiting the scope. For those of ordinary skill in the art, without creative efforts, other related drawings can also be obtained based on these drawings.
[0044] Figure 1 Schematic diagram of the structure of a network switch rack provided by an embodiment of the present invention;
[0045] Figure 2 Example of a data packet forwarding process provided by an embodiment of the present invention Figure 1 ;
[0046] Figure 3 Example of a data packet forwarding process provided by an embodiment of the present invention Figure 2 ;
[0047] Figure 4 Example of a data packet forwarding process provided by an embodiment of the present invention Figure 3 ;
[0048] Figure 5 Schematic flowchart of a method for preventing packet loss of a switching chip applied to a network slice provided by an embodiment of the present invention;
[0049] Figure 6 Schematic flowchart of a method for obtaining the buffer congestion level provided by an embodiment of the present invention;
[0050] Figure 7 Functional unit block diagram of a port resource management device deployed in a switching chip of a network card provided by an embodiment of the present invention;
[0051] Figure 8 Schematic flowchart of a method for preventing packet loss of a switching chip applied to a line card provided by an embodiment of the present invention;
[0052] Figure 9 Functional unit block diagram of a packet loss prevention device for a switching chip applied to a network slice provided by an embodiment of the present invention;
[0053] Figure 10 Functional unit block diagram of a packet loss prevention device for a switching chip applied to a line slice provided by an embodiment of the present invention.
[0054] Icons: 100 - Packet loss prevention device for a switching chip applied to a network slice; 101 - Generation module; 102 - Sending module; 103 - Acquisition module; 200 - Packet loss prevention device for a switching chip applied to a line slice; 201 - Receiving module; 202 - Adjustment module. Detailed Implementation Modes
[0055] To make the objectives, 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 with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some but not all of the embodiments of the present invention. Usually, the components of the embodiments of the present invention described and illustrated in the accompanying drawings herein can be arranged and designed in various different configurations.
[0056] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the claimed present invention, but merely represents selected embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts fall within the scope of protection of the present invention.
[0057] It should be noted that: Similar reference numerals and letters denote similar items in the following drawings. Therefore, once an item is defined in one drawing, it does not need to be further defined and explained in subsequent drawings.
[0058] In addition, terms such as "first" and "second" are used for descriptive purposes only and cannot be construed as indicating or implying relative importance.
[0059] It should be noted that, without conflict, the features in the embodiments of the present invention can be combined with each other.
[0060] As Figure 1 shown, a network switch rack is composed of multiple line cards and mesh sheets. Each line card and mesh sheet has a switching chip for exchanging data packets.
[0061] Data packets coming in through the panel port of any one line card can be forwarded through this line card, that is, go out through any one panel port of this line card. At the same time, they can also be forwarded in the way of line card -> mesh sheet -> line card. It should be noted that no packets can be lost during the forwarding process of data packets.
[0062] Usually, the transmission rate of each panel port of a line card is fixed. When ports of other line cards send data packets to a certain panel port of the same line card simultaneously, since the receiving bandwidth of this line card is higher than the sending bandwidth, it causes this line card to be unable to send the data packets in time, which will cause the buffer of this line card to overflow, and then packet loss occurs.
[0063] Exemplarily, as Figure 2As shown in the figure, assume that the transmission rate of each panel port of the 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 packets to the panel port P1 of line card 1, and both send at the full speed of 100 Gbps. That is to say, line card 1 will receive 200 Gbps of data packets through network chip 1 and send them to P1. Since the port rate of P1 is only 100 Gbps, it will inevitably cause the buffer of port P1 to overflow, and then packet loss will occur.
[0064] The traditional solution is to solve the problem of port buffer overflow by distributing tokens on the line card. Since the response and processing time of the tokens back and forth is relatively long, the port buffer needs to be deep enough.
[0065] Exemplarily, as Figure 3 shown, assume that the buffer of the panel port P1 of line card 1 has 1000 units (each unit can store up to 256 bytes at most), and k units are distributed to each of line cards 2, 3... m, where k * m < 1000. If the data packets sent by line cards 2 and 3 respectively have occupied k buffers, then they will no longer send data packets to P1 of line card 1 until P1 of line card 1 sends new tokens to line cards 2 and 3 again. That is to say, even if line cards 2 and 3 together send to P1 of line card 1 at a rate of 200 Gbps, but because the buffers occupied by the sent packets are limited, even if P1 is too late to transfer the data packets out, it will not exceed the number of buffers of P1, thus causing packet loss.
[0066] However, the traditional solution only solves the burst problem between line cards. As Figure 4 shown, if the transmission rate between network chip 1 and the panel port of line card 1 is 100 Gbps, then burst congestion will occur in network chip 1. The data packet transfer rate (100 Gbps) of the port of the network chip is less than the transfer rate (200 Gbps), resulting in buffer overflow and then packet loss.
[0067] To solve the packet loss problem in the data packet forwarding process due to burst congestion of the network chip, an embodiment of the present invention provides a packet loss prevention method for a switching chip applied to a network chip, which will be introduced in detail below.
[0068] Please refer to Figure 5 , this packet loss prevention method includes steps S101 to S102.
[0069] S101, generate a flow control frame carrying the buffer congestion level of the port of the network chip.
[0070] Among them, the flow control frame includes but is not limited to chip id, port id, Priority, and Congestion Level.
[0071] When the sending buffer is congested, the switching chip of the network slice 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 slice is congested according to the chip id.
[0072] The congested port(s) of the network slice can be one or more. In the embodiments 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. Different settings can be made according to requirements. When congestion occurs, the switching chip of the network slice 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 slice is congested according to the port id.
[0073] Priority is used to indicate which specific priority or sub-channel in the congested port is congested, and can be extended or cancelled according to requirements.
[0074] Congestion Level, that is, the buffer congestion level. In the embodiments of the present invention, multiple buffer congestion levels can be set to make the speed reduction and speed increase relatively smooth, so as not to waste the port bandwidth excessively.
[0075] S102. Send the flow control frame to the switching chip of the line card, so that the switching chip of the line card adjusts the rate of sending data packets to the port of the network slice according to the buffer congestion level of the port of the network slice, and avoid packet loss at the port of the network card due to congestion.
[0076] Among them, the buffer congestion level characterizes the degree of buffer congestion of the port.
[0077] Exemplarily, assume that there are 4 buffer congestion levels, 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 has slight congestion; level 2 indicates that the port buffer has moderate congestion; level 3 indicates that the port buffer has severe congestion.
[0078] In the embodiments of the present invention, before performing step S101, it is necessary to first obtain the buffer congestion level of the port of the network slice, as Figure 6 shown, and its implementation process may include steps S201 to S202.
[0079] S201, obtaining a message count value for a port of a network slice.
[0080] The change of the message count value represents the data message transferred into or out of the port of the network slice.
[0081] The switch chip of the network slice is deployed with a port resource management device, such as Figure 7 As shown, the port resource management device includes a message transfer-in module, a message transfer-out module and a port resource counting module.
[0082] When a data message is planned to be forwarded from a certain port, the message transfer module completes the cache operation of the data message and initiates a counting request to the port resource counting module, the content of which is to increase the message number or message length count.
[0083] When the data message is processed and forwarded 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 message number or message length count.
[0084] In an embodiment of the present invention, if a data message is planned to be forwarded from a certain port, but the port is temporarily unable to process it, then the data message will remain in the cache. That is to say, when a burst of traffic occurs, if the port is unable to process it, then the data messages of these bursts of traffic will be temporarily stored in the cache, and the counter in the port resource counting module will maintain a relatively high value.
[0085] When the burst traffic ends and disappears, the previously cached messages continue to be taken out of 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 impact of the burst traffic disappears.
[0086] It can be understood that the message count value refers to the value of the counter in the port resource counting module.
[0087] S202: Determine the buffer congestion level of the port of the mesh according to the message count value.
[0088] In an 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 based on the comparison result between the message count value and the set threshold value. It can be understood that the size and number of the threshold values can be set according to actual needs, and accordingly, the number of buffer congestion levels can be set according to actual needs.
[0089] In a possible implementation, 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 represent a gradually increasing buffer congestion degree of the port.
[0090] Optionally, there are the following six cases in the implementation process of step S202:
[0091] Case 1: If the packet count value is less than the first preset value and the port of the network chip is in a lightly congested state, it is determined that the buffer congestion level of the port of the network chip is the first preset level;
[0092] Case 2: If the packet count value is less than the second preset value and the port of the network chip is in a moderately congested state, it is determined that the buffer congestion level of the port of the network chip is the second preset level;
[0093] Case 3: If the packet count value is less than the third preset value and the port of the network chip is in a severely congested state, it is determined that the buffer congestion level of the port of the network chip is the third preset level;
[0094] Case 4: If the packet count value is greater than the second preset value and the port of the network chip is in an uncongested state, it is determined that the buffer congestion level of the port of the network chip is the second preset level;
[0095] Case 5: If the packet count value is greater than the third preset value and the port of the network chip is in a lightly congested state, it is determined that the buffer congestion level of the port of the network chip is the third preset level;
[0096] Case 6: If the packet count value is greater than the fourth preset value and the port of the network chip is in a moderately congested state, it is determined that the buffer congestion level of the port of the network chip is the fourth preset level.
[0097] Exemplarily, assume 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. Among them, their magnitudes satisfy threshold0 < threshold1 < threshold2 < threshold3.
[0098] 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.
[0099] Use threshold0, threshold1, threshold2, and threshold3 to determine the buffer congestion level of the port, that is, to determine the buffer congestion level of the port.
[0100] Understandably, when the packet count value is less than threshold0 and the current port is in a lightly congested state, then the port will change from a lightly congested state to an uncongested state, and the corresponding buffer congestion level is level 0.
[0101] When the packet count value is less than threshold1 and the current port is in a moderately congested state, then the port will change from a moderately congested state to a lightly congested state, and the corresponding buffer congestion level is level 1.
[0102] When the packet count value is less than threshold2 and the current port is in a severely congested state, then the port will change from a severely congested state to a moderately congested state, and the corresponding buffer congestion level is level 2.
[0103] When the packet count value is greater than threshold1 and the current port is in an uncongested state, then the port will change from an uncongested state to a lightly congested state, and the corresponding buffer congestion level is level 1.
[0104] When the packet count value is greater than threshold2 and the current port is in a lightly congested state, then the port will change from a lightly congested state to a moderately congested state, and the corresponding buffer congestion level is level 2.
[0105] When the packet count value is greater than threshold3 and the current port is in a moderately congested state, then the port will change from a moderately congested state to a severely congested state, and the corresponding buffer congestion level is level 3.
[0106] The embodiment of the present invention also provides a packet loss prevention method for a switching chip applied to a wire slice, which will be introduced in detail below.
[0107] Please refer to Figure 8 , and this packet loss prevention method includes steps S301 to S302.
[0108] S301, receive a flow control frame sent by a switching chip of a wire slice.
[0109] Among them, the flow control frame carries the buffer congestion level of the port of the wire slice.
[0110] S302, according to the buffer congestion level of the port of the wire slice, adjust the rate of sending data packets to the port of the wire slice to avoid packet loss due to congestion at the port of the network card.
[0111] Optionally, there are the following four cases in the implementation process of step S302.
[0112] Case 1: If the buffer congestion level of the port of the network slice is the first preset level, the rate of sending data packets to the port of the network slice is increased to the preset maximum rate.
[0113] Case 2: If the buffer congestion level of the port of the network slice is the second preset level, the rate of sending data packets to the port of the network slice is decreased according to the first preset reduction rate.
[0114] Case 3: 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 decreased according to the second preset reduction rate.
[0115] Case 4: 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 decreased to the preset minimum rate.
[0116] Among them, the preset maximum rate, the first preset reduction rate, the second preset reduction rate, and the preset minimum rate can be set according to actual needs.
[0117] Exemplarily, assume 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, the preset maximum rate is 100 Gbps, the preset minimum rate is 0 Gbps, the first preset reduction rate is 80%, and the second preset reduction rate is 20%.
[0118] Level 0 indicates that the port buffer is not congested, and the rate of the line card sending data packets to the port of the network slice can be increased to 100 Gbps; level 1 indicates that the port buffer has slight congestion, and the rate of the line card sending data packets to the port of the network slice needs to be slightly decreased to 80% of the preset maximum rate, that is, 100 Gbps * 80% = 80 Gbps; level 2 indicates that the port buffer has moderate congestion, and the rate of the line card sending data packets to the port of the network slice needs to be significantly decreased to 20% of the preset maximum rate, that is, 100 Gbps * 20% = 20 Gbps; level 3 indicates that the port buffer has severe congestion, and the line card needs to immediately stop sending data packets to the port of the network slice, that is, the rate of the line card sending data packets to the port of the network slice is decreased to 0 Gbps.
[0119] To reduce the situation where the switching chip of the network card frequently sends flow control frames to the switching chip of the line card, for the above cases 2-4, the packet loss prevention method further includes the following process.
[0120] First, after reducing the rate of sending data packets to the port of the network slice, the counter of the line card starts counting.
[0121] 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.
[0122] Among them, the preset threshold can be set according to actual needs.
[0123] Understandably, when the congestion level of the network slice port changes to a more serious level, after the switching chip of the line card receives the flow control frame, according to the buffer congestion level in the flow control frame, the rate of sending data packets to the port of the network slice is reduced, and the counter of the line card starts counting. When the value of the counter reaches the preset threshold, the rate of sending data packets to the port of the network slice is gradually increased until the preset maximum rate is reached, so that when there is buffer congestion in multiple ports, the switching chip of the network card can frequently send flow control frames to the switching chip of the line card.
[0124] To execute the corresponding steps in the above method embodiments and various possible implementation manners, the following gives an implementation manner of a packet loss prevention device 100 applied to the switching chip of the network slice and a packet loss prevention device 200 applied to the switching chip of the line card.
[0125] Please refer to Figure 9 , the packet loss prevention device 100 applied to the switching chip of the network slice includes a generation module 101, a sending module 102, and an acquisition module 103.
[0126] The generation module 101 is used to generate a flow control frame carrying the buffer congestion level of the port of the network slice.
[0127] The sending module 102 is used to send the flow control frame to the switching chip of the line card, so that the switching chip of the line card adjusts the rate of sending data packets to the port of the network slice according to the buffer congestion level of the port of the network slice, and avoids packet loss due to congestion at the port of the network card.
[0128] Optionally, the acquisition module 103 is used to acquire the packet count value for the port of the network slice, where the change in the packet count value represents the transfer in or out of data packets at the port of the network slice; according to the packet count value, determine the buffer congestion level of the port of the network slice.
[0129] Optionally, the obtaining module 103 is specifically configured to determine that the buffer congestion level of the port of the network chip is the first preset level if the packet count value is less than the first preset value and the port of the network chip is in a lightly congested state; determine that the buffer congestion level of the port of the network chip is the second preset level if the packet count value is less than the second preset value and the port of the network chip is in a moderately congested state; and determine that the buffer congestion level of the port of the network chip is the third preset level if the packet count value is less than the third preset value and the port of the network chip is in a severely congested state.
[0130] Optionally, the obtaining module 103 is further specifically configured to determine that the buffer congestion level of the port of the network chip is the second preset level if the packet count value is greater than the second preset value and the port of the network chip is in an uncongested state; determine that the buffer congestion level of the port of the network chip is the third preset level if the packet count value is greater than the third preset value and the port of the network chip is in a lightly congested state; and determine that the buffer congestion level of the port of the network chip is the fourth preset level if the packet count value is greater than the fourth preset value and the port of the network chip is in a moderately congested state.
[0131] Please refer to Figure 10 , the packet loss prevention device 200 for the switching chip applied to the line card includes a receiving module 201 and an adjustment module 202.
[0132] The receiving module 201 is configured to receive a flow control frame sent by the switching chip of the network chip, and the flow control frame carries the buffer congestion level of the port of the network chip.
[0133] 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 due to congestion at the port of the network card.
[0134] Optionally, the adjustment module 202 is specifically configured to increase the rate of sending data packets to the port of the network chip to the preset maximum rate if the buffer congestion level of the port of the network chip is the first preset level; reduce the rate of sending data packets to the port of the network chip by the first preset reduction if the buffer congestion level of the port of the network chip is the second preset level; reduce the rate of sending data packets to the port of the network chip by the second preset reduction if the buffer congestion level of the port of the network chip is the third preset level, where the second preset reduction is greater than the first preset reduction; and reduce the rate of sending data packets to the port of the network chip to the preset minimum rate if the buffer congestion level of the port of the network chip is the fourth preset level.
[0135] Optionally, the adjustment module 202 is further specifically configured to control the counter of the line card to start counting after reducing the rate of sending data packets to the port of the network slice; if it is detected that the value of the counter is greater than a 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.
[0136] Those skilled in the art can clearly understand that for the sake of convenience and brevity of description, the specific working processes of the packet loss prevention device 100 for the switching chip applied to the network slice and the packet loss prevention device 200 for the switching chip applied to the line card described above can refer to the corresponding processes in the foregoing method embodiments, and will not be elaborated herein.
[0137] An embodiment of the present invention further provides a switching chip installed on a network slice. The switching chip has logic devices, and a computer program is burned into the logic devices. When the computer program is executed, related operations in the method provided in the foregoing method embodiment are implemented.
[0138] An embodiment of the present invention further provides a switching chip installed on a line card. The switching chip has logic devices, and a computer program is burned into the logic devices. When the computer program is executed, related operations in the method provided in the foregoing method embodiment are implemented.
[0139] An embodiment of the present invention further provides a computer-readable storage medium containing a computer program. When the computer program is executed, it can be used to execute related operations in the method provided in the foregoing method embodiment.
[0140] In summary, for the packet loss prevention method and related device provided in the embodiments of the present invention, first, a flow control frame carrying the buffer congestion level of the port of the network slice is generated; then, the flow control frame is sent to the switching chip of the line card, so that the switching chip of the line card adjusts the rate of sending data packets to the port of the network slice according to the buffer congestion level of the port of the network slice. Since the embodiments of the present invention send a flow control frame carrying the buffer congestion level of the port of the network slice to the switching chip of the line card, the switching chip of the line card adjusts the rate of sending data packets to the port of the network slice according to the buffer congestion level of the port of the network slice, thereby avoiding packet loss at the port of the network card due to congestion.
[0141] The above is only the specific implementation manner of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by those skilled in the art within the technical scope disclosed by the present invention should be covered by the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.
Claims
1. A method for preventing packet loss, characterized in that, A switching chip applied to a mesh in a network switch rack. The network switch rack further includes a line card, and the switching chip of the line card is communicatively connected to the switching chip of the mesh. The method includes: Obtain a packet count value for a port of the mesh. Wherein, a change in the packet count value indicates that data packets are transferred into or out of the port of the mesh; If the packet count value is less than a first preset value and the port of the mesh is in a lightly congested state, determine that the buffer congestion level of the port of the mesh is a first preset level; If the packet count value is less than a second 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 second preset level; If the packet count value is less than a third preset value and the port of the mesh is in a severely congested state, determine that the buffer congestion level of the port of the mesh is a third 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, determine that the buffer congestion level of the port of the mesh is a second preset level; If the packet count value is greater than the third preset value and the port of the mesh is in a lightly congested state, determine that the buffer congestion level of the port of the mesh is a third preset level; 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; Generate a flow control frame carrying the buffer congestion level of the port of the mesh; Send the flow control frame to the switching chip of the line card, so that the switching chip of the line card adjusts the rate of sending data packets to the port of the mesh according to the buffer congestion level of the port of the mesh, and avoid packet loss at the port of the mesh due to congestion.
2. A packet loss prevention method, characterized in that, A switching chip applied to a line card in a network switch rack. The network switch rack further includes a mesh, and the switching chip of the mesh is communicatively connected to the switching chip of the line card. The method includes: Receive a flow control frame sent by the switching chip of the mesh, the flow control frame carrying the buffer congestion level of the port of the mesh; wherein, the buffer congestion level of the port of the mesh is obtained in the following manner: Obtain a packet count value for a port of the mesh. Wherein, a change in the packet count value indicates that data packets are transferred into or out of the port of the mesh; If the packet count value is less than a first preset value and the port of the mesh is in a lightly congested state, determine that the buffer congestion level of the port of the mesh is a first preset level; If the packet count value is less than a second 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 second preset level; If the packet count value is less than a third preset value and the port of the mesh is in a severely congested state, determine that the buffer congestion level of the port of the mesh is a third preset level; If the packet count value is greater than a second preset value and the port of the network slice is in an uncongested state, determine that the buffer congestion level of the port of the network slice is the second preset level; If the packet count value is greater than a third preset value and the port of the network slice is in a lightly congested state, determine that the buffer congestion level of the port of the network slice is the third preset level; If the packet count value is greater than a fourth preset value and the port of the network slice is in a moderately congested state, determine that the buffer congestion level of the port of the network slice is the fourth preset level; According to the buffer congestion level of the port of the network slice, adjust the rate of sending data packets to the port of the network slice to avoid packet loss due to congestion at the port of the network slice.
3. The method according to claim 2, wherein The step of adjusting the rate of sending data packets to the port of the network slice according to the buffer congestion level of the port of the network slice includes: If the buffer congestion level of the port of the network slice is the first preset level, increase the rate of sending data packets to the port of the network slice to the preset maximum rate; If the buffer congestion level of the port of the network slice is the second preset level, reduce the rate of sending data packets to the port of the network slice by a first preset reduction; If the buffer congestion level of the port of the network slice is the third preset level, reduce the rate of sending data packets to the port of the network slice by a second preset reduction, where the second preset reduction is greater than the first preset reduction; If the buffer congestion level of the port of the network slice is the fourth preset level, reduce the rate of sending data packets to the port of the network slice to the preset minimum rate.
4. The method according to claim 3, wherein The method further includes: After reducing the rate of sending data packets to the port of the network slice, control the counter of the line card to start counting; If it is detected that the value of the counter is greater than a preset threshold, gradually increase the rate of sending data packets to the port of the network slice to the preset maximum rate within a preset time range.
5. An anti-packet-loss device, characterized in that, Applied to the switching chip of the network slice in the network switch rack, the network switch rack further includes a line card, and the switching chip of the line card is communicatively connected to the switching chip of the network slice. The device includes: An obtaining module, configured to obtain a packet count value for a port of the network slice, where a change in the packet count value indicates that a data packet is transferred into or out of the port of the network slice; if the packet count value is less than a first preset value and the port of the network slice is in a lightly congested state, determine that the buffer congestion level of the port of the network slice is a first preset level; if the packet count value is less than a second preset value and the port of the network slice is in a moderately congested state, determine that the buffer congestion level of the port of the network slice is a second preset level; if the packet count value is less than a third preset value and the port of the network slice is in a severely congested state, determine that the buffer congestion level of the port of the network slice is a third preset level; if the packet count value is greater than the second preset value and the port of the network slice is in an uncongested state, determine that the buffer congestion level of the port of the network slice is a second preset level; if the packet count value is greater than the third preset value and the port of the network slice is in a lightly congested state, determine that the buffer congestion level of the port of the network slice is a third preset level; if the packet count value is greater than a fourth preset value and the port of the network slice is in a moderately congested state, determine that the buffer congestion level of the port of the network slice is a fourth preset level; A generating module, configured to generate a flow control frame carrying the buffer congestion level of the port of the network slice; A sending module, configured to send the flow control frame to a switching chip of the line card, so that the switching chip of the line card adjusts the rate of sending data packets to the port of the network slice according to the buffer congestion level of the port of the network slice, and avoid packet loss at the port of the network slice due to congestion.
6. An anti-packet-loss device, characterized in that Applied to a switching chip of a line card in a network switch chassis, the network switch chassis further includes a network slice, and the switching chip of the network slice is communicatively connected to the switching chip of the line card. The apparatus includes: A receiving module, configured to receive a flow control frame sent by a switching chip of the network slice, where the flow control frame carries a buffer congestion level of a port of the network slice; wherein, the buffer congestion level of the port of the network slice is obtained in the following manner: obtaining a packet count value for the port of the network slice, where a change in the packet count value represents that data packets are transferred into or out of the port of the network slice; if the packet count value is less than a first preset value and the port of the network slice is in a mild congestion state, determining that the buffer congestion level of the port of the network slice is a first preset level; if the packet count value is less than a second preset value and the port of the network slice is in a moderate congestion state, determining that the buffer congestion level of the port of the network slice is a second preset level; if the packet count value is less than a third preset value and the port of the network slice is in a severe congestion state, determining that the buffer congestion level of the port of the network slice is a third preset level; if the packet count value is greater than the second preset value and the port of the network slice is in an uncongested state, determining that the buffer congestion level of the port of the network slice is a second preset level; if the packet count value is greater than the third preset value and the port of the network slice is in a mild congestion state, determining that the buffer congestion level of the port of the network slice is a third preset level; if the packet count value is greater than a fourth preset value and the port of the network slice is in a moderate congestion state, determining that the buffer congestion level of the port of the network slice is a fourth preset level; An adjustment module, configured to adjust the rate of sending data packets to the port of the network slice according to the buffer congestion level of the port of the network slice, so as to avoid packet loss due to congestion at the port of the network slice.
7. A switching chip, characterized in that, The switching chip has a logic device, and a computer program is burned into the logic device, and when the computer program is executed, the packet loss prevention method described in claim 1 is implemented.
8. A switching chip, characterized in that, The switching chip has a logic device, and a computer program is burned into the logic device, and when the computer program is executed, the packet loss prevention method described in any one of claims 2 to 4 is implemented.
9. A network switch rack, characterized in that, The network switch rack includes a plurality of network slices and a plurality of line cards, and each of the network slices has a switching chip as described in claim 7, and each of the line cards has a switching chip as described in claim 8.
10. A computer-readable storage medium, characterized in that, It stores a computer program, and when the computer program is executed, the packet loss prevention method described in claim 1 or the packet loss prevention method described in any one of claims 2 to 4 is implemented.
Citation Information
Patent Citations
Network equipment
CN104092632A
Congestion control method, network device, and system
WO2021217641A1