Search

US-12627614-B2 - Data forwarding method, data buffering method, apparatus, and related device

US12627614B2US 12627614 B2US12627614 B2US 12627614B2US-12627614-B2

Abstract

A data forwarding method includes, after congestion of an egress queue is relieved, a network device that receives a packet from an upstream node, and determines whether a storage device associated with the egress queue buffers a previous packet that belongs to a same data flow as the packet. When the storage device does not buffer the previous packet, the network device schedules the packet to the egress queue, to forward the packet to a downstream node, where the storage device is configured to receive, during congestion of the egress queue, a packet sent by the network device.

Inventors

  • ShiXing Liu
  • Yinben Xia

Assignees

  • HUAWEI TECHNOLOGIES CO., LTD.

Dates

Publication Date
20260512
Application Date
20220608
Priority Date
20191209

Claims (12)

  1. 1 . A method implemented by a network device, the method comprising: receiving, from an upstream node, one or more packets during congestion of an egress queue of the network device; buffering the one or more packets in a storage device associated with the egress queue; receiving, from the upstream node, a first packet after the congestion is relieved; obtaining a first flowkey of the first packet, wherein the first flowkey indicates a first data flow to which the first packet belongs; determining, based on the first flowkey, whether a previous packet belonging to the first data flow is buffered in the storage device; and scheduling the first packet to the egress queue to forward the first packet to a downstream node when the previous packet is not buffered in the storage device.
  2. 2 . The method of claim 1 , further comprising sending the first packet to the storage device for buffering when the previous packet is buffered in the storage device.
  3. 3 . The method of claim 1 , further comprising: receiving a second packet; and buffering the second packet in the storage device during congestion of the egress queue.
  4. 4 . The method of claim 1 , further comprising recording a quantity of packets of each data flow that are buffered in the storage device.
  5. 5 . The method of claim 4 , further comprising recording, in a flow table, the quantity of the packets of each data flow that are buffered in the storage device, wherein the flow table comprises at least one entry, and wherein each of the at least one entry comprises a flowkey and a packet quantity corresponding to the flowkey.
  6. 6 . The method of claim 5 , further comprising: querying, based on the first flowkey, the flow table to obtain the packet quantity corresponding to the first data flow in the flow table; determining that the previous packet is not buffered in the storage device when the packet quantity is equal to zero; and determining that the previous packet is buffered in the storage device when the packet quantity is greater than zero.
  7. 7 . A network device comprising: a memory configured to store computer instructions; and a processor coupled to the memory and configured to execute the computer instructions to cause the network device to: receive, from an upstream node, a one or more packets during congestion of an egress queue of the network device; buffer the one or more packets in a storage device associated with the egress queue; receive, from the upstream node, a first packet after the congestion is relieved; obtain a first flowkey of the first packet, wherein the first flowkey indicates a first data flow to which the first packet belongs; determine, based on the first flowkey, whether a previous packet belonging to the first data flow is buffered in the storage device; and schedule the first packet to the egress queue to forward the first packet to a downstream node when the previous packet is not buffered in the storage device.
  8. 8 . The network device of claim 7 , wherein the processor is further configured to execute the computer instructions to cause the network device to: send the first packet to the storage device for buffering when the previous packet is buffered in the storage device.
  9. 9 . The network device of claim 7 , wherein the processor is further configured to execute the computer instructions to cause the network device to: receive a second packet; and buffer the second packet in the storage device during congestion of the egress queue.
  10. 10 . The network device of claim 7 , wherein the processor is further configured to execute the computer instructions to cause the network device to record a quantity of packets of each data flow that are buffered in the storage device.
  11. 11 . The network device of claim 10 , wherein the processor is further configured to execute the computer instructions to cause the network device to further record, in a flow table, the quantity of the packets of each data flow that are buffered in the storage device, wherein the flow table comprises at least one entry, and wherein each of the at least one entry comprises a flowkey and a packet quantity corresponding to the flowkey.
  12. 12 . The network device of claim 11 , wherein the processor is further configured to execute the computer instructions to cause the network device to: query, based on the first flowkey, the flow table to obtain the packet quantity corresponding to the first data flow in the flow table; determine that the previous packet is not buffered in the storage device when the second packet quantity is equal to zero; and determine that the previous packet is buffered in the storage device when the second packet quantity is greater than zero.

Description

CROSS-REFERENCE TO RELATED APPLICATIONS This application is a continuation of International Patent Application No. PCT/CN2020/115582 filed on Sep. 16, 2020, which claims priority to Chinese Patent Application No. 201911249818.6 filed on Dec. 9, 2019. The disclosures of the aforementioned applications are hereby incorporated by reference in their entireties. TECHNICAL FIELD This disclosure relates to the field of network communications technologies, and in particular, to a data forwarding method, a data buffering method, an apparatus, and a related device. BACKGROUND When a sender in a network sends a packet to a receiver, the packet passes through a plurality of forwarding devices on a path between the sender and the receiver. When a plurality of senders sends packets to a same receiver, these packets may be aggregated into a same egress queue of a same forwarding device. If an ingress rate of the egress queue is greater than an egress rate, the egress queue is congested or even fully filled. Therefore, a packet that subsequently arrives at the forwarding device cannot be sent to the egress queue, and the packet is dropped. As a result, packet drop occurs on the network, and forwarding performance of the forwarding device is severely degraded. When egress queues are congested or even fully filled, some forwarding devices temporarily buffer received packets by using buffer queues other than the egress queues. After the congested state of the egress queues is cancelled or relieved, the forwarding devices extract the temporarily buffered packets from the buffer queues, and then send the packets to the egress queues, to reduce packet loss. However, in actual application, packets from different senders belong to different data flows or traffic flows. Different data flows include different quantities of packets and have different flowsizes. For a small data flow, because time consumed for transmitting the small data flow on a forwarding path is short, a longer period of time in which the small data flow waits in the egress queue and the buffer queue of the forwarding device causes greater impact on transmission performance of the forwarding device. In addition, in the process in which the forwarding device schedules the packet from the buffer queue to the egress queue, if a new data flow that has not occurred before arrives at the forwarding device, the forwarding device also sends packets in the new data flow to the buffer queue for buffering. Therefore, forwarding of the new data flow is affected, congestion spreads, and the forwarding performance of the device deteriorates. SUMMARY This disclosure provides a data forwarding method, a data buffering method, an apparatus, and a related device, to improve forwarding performance of a forwarding device. According to a first aspect, this disclosure provides a data forwarding method. The method includes that after congestion of an egress queue is relieved, a network device receives a packet sent by an upstream node, the network device obtains a flowkey of the packet, where the flowkey indicates a data flow to which the packet belongs, the network device determines, based on the flowkey, whether a previous packet belonging to the data flow is buffered in a storage device associated with the egress queue, and when the storage device does not buffer the previous packet of the data flow, the network device schedules the packet to the egress queue, to forward the packet to a downstream node, where the storage device is configured to buffer a packet that is received by the network device during congestion of the egress queue of the network device. According to the foregoing method, after congestion of the egress queue is relieved, if the network device receives the packet sent by the upstream device, the network device determines whether the storage device buffers the previous packet that belongs to the same data flow as the packet. If the storage device does not buffer the previous packet, the network device may determine that the packet belongs to a new data flow. In this case, to avoid affecting forwarding performance of the new data flow, the network device directly schedules the packet to the egress queue, to implement queue jumping. Therefore, in the solution in this embodiment of this disclosure, when congestion of the egress queue of the network device is relieved, time consumed from the arrival of the packet of the new data flow at the network device to the forwarding of the packet to the downstream node can be reduced, and forwarding performance of the network device can be improved. In an implementation, the method further includes, when the previous packet of the data flow is buffered in the storage device, the network device sends the packet to the storage device for buffering. Therefore, if the storage device buffers the previous packet, the network device may determine that the packet belongs to a data flow that has been buffered in the storage device. There