[go: up one dir, main page]

WO2025223244A1 - Packet reordering method and apparatus, and chip, device, storage medium and program product - Google Patents

Packet reordering method and apparatus, and chip, device, storage medium and program product

Info

Publication number
WO2025223244A1
WO2025223244A1 PCT/CN2025/088858 CN2025088858W WO2025223244A1 WO 2025223244 A1 WO2025223244 A1 WO 2025223244A1 CN 2025088858 W CN2025088858 W CN 2025088858W WO 2025223244 A1 WO2025223244 A1 WO 2025223244A1
Authority
WO
WIPO (PCT)
Prior art keywords
message
order
sequence number
sorting
delivery segment
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
PCT/CN2025/088858
Other languages
French (fr)
Chinese (zh)
Inventor
史洪波
包雅林
吕涛
韦奋
刘文涛
黄勇平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Jaguar Microsystems Co Ltd
Shenzhen Jaguar Microsystems Co Ltd
Original Assignee
Chengdu Jaguar Microsystems Co Ltd
Shenzhen Jaguar Microsystems 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 Chengdu Jaguar Microsystems Co Ltd, Shenzhen Jaguar Microsystems Co Ltd filed Critical Chengdu Jaguar Microsystems Co Ltd
Publication of WO2025223244A1 publication Critical patent/WO2025223244A1/en
Pending legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/12Avoiding congestion; Recovering from congestion
    • H04L47/125Avoiding congestion; Recovering from congestion by balancing the load, e.g. traffic engineering

Definitions

  • This application relates to the field of chip technology, and in particular to a message rearrangement method, apparatus, chip, device, storage medium, and program product.
  • ROCEV2 Remote Direct Memory Access over Converged Ethernet
  • some software can perform out-of-order reordering of the same queue pair (QP) for Remote Direct Memory Access (RDMA) through the processor or coprocessor.
  • QP queue pair
  • RDMA Remote Direct Memory Access
  • a message rearrangement method, apparatus, device, storage medium, and program product are provided.
  • this application provides a message rearrangement method.
  • the method includes:
  • the order position of the out-of-order message is determined in the bitmap of the queue management context corresponding to the current order delivery segment based on the message sequence number and packet sequence number.
  • the out-of-order messages are rearranged by adding marker information at the sorting positions.
  • determining whether the out-of-order packet is within the current ordering delivery segment of the network device's hardware processing engine based on the message sequence number and packet sequence number includes:
  • the out-of-order message is determined to be within the current sorting delivery segment of the hardware processing engine.
  • the difference between the message sequence number and the expected message sequence number is greater than the number of messages that the hardware processing engine can maintain, or if the difference between the packet sequence number and the expected packet sequence number is greater than the number of messages that the hardware processing engine can maintain, then it is determined that the out-of-order message is not in the current sorting delivery segment of the hardware processing engine.
  • the expected message sequence number is the message sequence number corresponding to the first sorting position in the bitmap of the queue management context
  • the expected packet sequence number is the packet sequence number corresponding to the first sorting position in the bitmap of the queue management context.
  • the method further includes:
  • a first out-of-order event message is reported to the micro-engine pool.
  • the first out-of-order event message includes the out-of-order message.
  • the micro-engine pool is used to call the host memory to sort the out-of-order message.
  • the method further includes:
  • the bitmap of the queue management context is moved according to the added marker information in the bitmap of the queue management context
  • a second out-of-order event message is reported to the micro-engine pool.
  • the second out-of-order event message is used to request the micro-engine pool to release the first sorting information of the out-of-order packets corresponding to the next sorting delivery segment.
  • the method further includes:
  • the first sorting information is bitwise ORed with the second sorting information in the bitmap of the queue management context corresponding to the next sorting delivery segment to update the bitmap of the queue management context corresponding to the next sorting delivery segment.
  • the apparatus includes:
  • the receiving module is used to receive out-of-order messages sent by the requesting end, wherein the out-of-order messages include message sequence numbers and packet sequence numbers;
  • the processing module is configured to determine whether the out-of-order packet is within the current sorting and delivery segment of the hardware processing engine of the network device based on the message sequence number and the packet sequence number; if the out-of-order packet is within the current sorting and delivery segment, the module determines the sorting position of the out-of-order packet in the bitmap of the queue management context corresponding to the current sorting and delivery segment based on the message sequence number and the packet sequence number.
  • the rearrangement module is used to rearrange the out-of-order packets by adding marker information at the sorting positions.
  • the processing module is further configured to: determine that the out-of-order message is within the current sorting and delivery segment of the hardware processing engine when the difference between the message sequence number and the expected message sequence number is less than or equal to the number of maintainable messages of the hardware processing engine and the difference between the packet sequence number and the expected packet sequence number is less than or equal to the number of maintainable messages of the hardware processing engine; and determine that the out-of-order message is not within the current sorting and delivery segment of the hardware processing engine when the difference between the message sequence number and the expected message sequence number is greater than the number of maintainable messages of the hardware processing engine or the difference between the packet sequence number and the expected packet sequence number is greater than the number of maintainable messages of the hardware processing engine.
  • the expected message sequence number is the message sequence number corresponding to the first sorting position in the bitmap of the queue management context
  • the expected packet sequence number is the packet sequence number corresponding to the first sorting position in the bitmap of the queue management context.
  • the processing module is further configured to report a first out-of-order event message to the micro-engine pool when the out-of-order message is not in the current sorting delivery segment of the hardware processing engine.
  • the first out-of-order event message includes the out-of-order message
  • the micro-engine pool is configured to call the host memory to sort the out-of-order message.
  • the processing module is further configured to move the bitmap of the queue management context according to the added tag information in the bitmap of the queue management context; when the bitmap of the queue management context moves from the current sorting delivery segment to the next sorting delivery segment and the first out-of-order event message has been reported, a second out-of-order event message is reported to the micro-engine pool, the second out-of-order event message being used to request the micro-engine pool to release the first sorting information of the out-of-order packets corresponding to the next sorting delivery segment.
  • the receiving module is further configured to receive the first sorting information sent by the micro-engine pool;
  • the processing module is further configured to perform a bitwise OR operation between the first sorting information and the second sorting information in the bitmap of the queue management context corresponding to the next sorting delivery segment, so as to update the bitmap of the queue management context corresponding to the next sorting delivery segment.
  • this application provides a chip.
  • the chip includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the message reordering method of the first aspect described above.
  • the computer device includes a processor and a chip as described in the third aspect, the chip being configured to schedule messages to the processor or to process them itself, the processor being configured to process messages scheduled by the chip.
  • this application also provides a computer-readable storage medium.
  • the computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements a message reordering method.
  • the computer program product includes a computer program that, when executed by a processor, implements a message reordering method.
  • Figure 1 is a schematic diagram of the application environment of a message rearrangement method provided in an embodiment of this application;
  • Figure 2 is a flowchart illustrating a message rearrangement method provided in an embodiment of this application
  • Figure 3 is a schematic diagram of a packet-by-packet equalization implementation provided by an embodiment of this application.
  • Figure 4 is a bit diagram of a micro-engine pool before update provided in an embodiment of this application.
  • Figure 5 is an updated bit diagram corresponding to a micro-engine pool provided in an embodiment of this application.
  • Figure 6 is a bit diagram of a queue management context provided in an embodiment of this application.
  • Figure 7 is a bit diagram of another queue management context provided in an embodiment of this application.
  • Figure 8 is a bit diagram corresponding to another micro-engine pool provided in the embodiment of this application.
  • Figure 9 is a bit diagram of the next sorting delivery segment corresponding to a micro-engine pool provided in an embodiment of this application.
  • Figure 10 is a bit diagram of another queue management context provided in an embodiment of this application.
  • Figure 11 is a bit diagram of another queue management context provided in an embodiment of this application.
  • Figure 12 is a schematic diagram illustrating the principle of message reordering provided in an embodiment of this application.
  • Figure 13 is an interactive schematic diagram of message rearrangement provided in an embodiment of this application.
  • Figure 14 is a flowchart illustrating another message rearrangement method provided in an embodiment of this application.
  • Figure 15 is a schematic diagram of a message rearrangement device provided in an embodiment of this application.
  • Figure 16 is a schematic diagram of the internal structure of a computer device provided in an embodiment of this application.
  • FIG. 1 is a schematic diagram of the application environment of a message reordering method provided in this application embodiment.
  • the network device may include a requesting end 101 and a receiving end 102.
  • the requesting end 101 on one network device can send an out-of-order message to the receiving end 102 on another network device.
  • the out-of-order message includes a message sequence number and a packet sequence number.
  • the receiving end 102 determines whether the out-of-order message is within the current ordering delivery segment of the network device's hardware processing engine based on the message sequence number and the packet sequence number.
  • the receiving end 102 determines the ordering position of the out-of-order message in the bitmap of the queue management context corresponding to the current ordering delivery segment based on the message sequence number and the packet sequence number. Subsequently, the receiving end 102 reorders the out-of-order message by adding marking information to the ordering position.
  • the receiver 102 reports a first out-of-order event message to the network device's micro-engine pool 103. This first out-of-order event message includes the out-of-order packet, and the micro-engine pool uses host memory to order the out-of-order packet.
  • the micro-engine pool can be a processor module of the network device.
  • the host can be the network device's system (e.g., operating system).
  • the embodiments of this application do not limit the network devices.
  • the network devices may include network interface cards (NICs), etc.
  • a message rearrangement method is provided. Taking the application of this method to the receiving end in Figure 1 as an example, the method includes S201-S204:
  • the out-of-order messages include message sequence number and packet sequence number.
  • the requester when the requester supports out-of-order message delivery, the requester can send out-of-order messages to the responder so that the responder can rearrange the out-of-order messages.
  • MSN Message Sequence Number
  • PSN Packet Sequence Number
  • a message can include one or more packets (PKTs). Accordingly, when the requesting end sends an out-of-order message, it can attach a message sequence number (MSN) and a packet sequence number (PSN), so that the receiving end can reorder the out-of-order message based on the MSN and PSN.
  • MSN message sequence number
  • PSN packet sequence number
  • out-of-order packets are generated when a network interface card (NIC) or switch dynamically load balances and swaps source packets to multiple transmission paths.
  • NIC network interface card
  • dynamic load balancing is a core networking solution used to distribute traffic among multiple servers in a server farm. Load balancing improves application availability and responsiveness and prevents server overload.
  • the load balancing service sits between client devices and backend servers, receiving incoming requests and then distributing them to any available server capable of fulfilling those requests.
  • a web server typically has multiple workers (e.g., processes or threads). When multiple clients connect to the same worker, that worker becomes busy and experiences significant tail latency, while other workers remain idle. To reduce overall resource utilization and lower the performance requirements of the web server, dynamic load balancing can be used to prevent multiple clients from connecting to the same worker.
  • workers e.g., processes or threads.
  • Figure 3 is a schematic diagram of packet-by-packet load balancing provided in an embodiment of this application. As shown in Figure 3, in this application, source packets can be switched to multiple transmission paths by network interface cards or switches through dynamic load balancing, reducing the tail latency of a single stream and greatly shortening the single stream transmission completion time.
  • the out-of-order transmission path can be determined by the switch using a key hash factor.
  • This key hash factor can include source IP address, source IP address + destination IP address, source IP address + destination IP address + source port number + destination port number, etc.
  • the source port number of the User Datagram Protocol (e.g., UDP.SPORT) can be modified, and the lower 16 bits of the Packet Sequence Number (PSN) can be used as the UDP source port number, thereby exchanging source packets to different paths through the modified UDP source port number.
  • UDP User Datagram Protocol
  • PSN Packet Sequence Number
  • NICs network interface cards
  • switches can better utilize dynamic load balancing algorithms for various types of traffic, avoiding the unbalanced effects caused by single large flows or equal-cost multi-path (ECMP) routing of multiple flows in the network.
  • ECMP equal-cost multi-path
  • the receiving end after the receiving end receives the out-of-order message sent by the requesting end, it can determine whether the out-of-order message is within the current ordering delivery segment of the network device's hardware processing engine based on the message sequence number and packet sequence number.
  • the hardware processing engine can be an RDMA Processing Engine (RPE).
  • RPE RDMA Processing Engine
  • the currently sorted delivery segment is the sequence of messages currently being sorted.
  • out-of-order packets corresponding to the current ordering delivery segment are aligned before the out-of-order packets corresponding to the next ordering delivery segment are aligned. That is, in each ordering delivery segment, the hardware processing engine only maintains the out-of-order packets for which packets are expected to be received.
  • the embodiments of this application do not impose restrictions on how to determine whether an out-of-order message is within the current sorting and delivery segment of the hardware processing engine of the network device.
  • the difference between the message sequence number and the expected message sequence number is less than or equal to the number of messages that the hardware processing engine can maintain and the difference between the packet sequence number and the expected packet sequence number is less than or equal to the number of messages that the hardware processing engine can maintain, it is determined that the out-of-order message is within the current sorting and delivery segment of the hardware processing engine.
  • the receiver can determine that the out-of-order message is within the current ordered delivery segment of the hardware processing engine. Accordingly, the ordering position of the out-of-order message can be determined in the bitmap of the Queue Pair Context (QPC) corresponding to the current ordered delivery segment.
  • QPC Queue Pair Context
  • X is the number of maintainable messages in the hardware processing engine
  • n is the number of maintainable packets in the hardware processing engine.
  • the difference between the message sequence number and the expected message sequence number is greater than the number of messages that the hardware processing engine can maintain, or the difference between the packet sequence number and the expected packet sequence number is greater than the number of messages that the hardware processing engine can maintain, then it is determined that the out-of-order message is not in the current sorting delivery segment of the hardware processing engine.
  • the receiver can determine that the out-of-order message is not within the current ordering delivery segment of the hardware processing engine.
  • X is the maintainable message count of the hardware processing engine
  • n is the maintainable message count of the hardware processing engine.
  • the embodiments of this application do not limit how the expected message sequence number and the expected packet sequence number are determined.
  • the expected message sequence number is the message sequence number corresponding to the first sorting position in the bitmap of the queue management context
  • the expected packet sequence number is the packet sequence number corresponding to the first sorting position in the bitmap of the queue management context.
  • the ordered delivery segment can be further subdivided into sub-segments; for instance, an ordered delivery segment of length n can be divided into m sub-segments, where m is 4 or 8.
  • the ordering position of the out-of-order message is determined in the bitmap of the queue management context corresponding to the current ordering delivery segment based on the message sequence number and packet sequence number.
  • the ordering position of the out-of-order message can be determined in the bitmap of the queue management context corresponding to the current ordering delivery segment based on the message sequence number and packet sequence number.
  • the position of the corresponding message can be located in the bitmap first based on the message sequence number, and then the position of the corresponding packet can be located in the bitmap based on the packet sequence number, thereby determining the sorting position of the out-of-order messages.
  • a first out-of-order event message is reported to the micro-engine pool.
  • the first out-of-order event message includes the out-of-order message, and the micro-engine pool is used to call the host memory to sort the out-of-order message.
  • a bitmap table can also be maintained in the micro-engine pool. Whenever the micro-engine pool receives the first out-of-order event message, it can determine the sorting position of the out-of-order message in the bitmap table corresponding to the micro-engine pool. Then, the bit of the sorting position is set to 1 to complete the sorting.
  • the hardware processing engine cannot sort out-of-order packets when the received MSN is equal to 0 and the iPSN is greater than 16, or when the MSN is not equal to 0.
  • the hardware processing engine can send a first out-of-order event message to the micro-engine pool to enable the micro-engine pool to sort the out-of-order packets.
  • the message reordering method provided in this application embodiment through the bitmap table maintained by the micro-engine pool, can realize a software-hardware combined reordering scheme of the micro-engine pool and the hardware processing engine.
  • the software-hardware combined reordering scheme provides both the line-speed sorting processing capability of the hardware processing engine and the flexible sorting extension capability based on the micro-engine pool microcode, thereby effectively controlling hardware resources and costs.
  • the hardware processing engine at the reordering end aggregates the received out-of-order messages. After receiving a complete out-of-order message within the current ordering delivery segment, it interacts with the micro-engine pool once. During this interaction, the micro-engine pool sends the first ordering information of the out-of-order messages corresponding to the next ordering delivery segment that exceeds the out-of-order level of the hardware processing engine to the hardware processing engine. This allows the hardware processing engine to perform a bitwise OR operation with the second ordering information in the bitmap of the queue management context corresponding to the next ordering delivery segment to sort the out-of-order messages corresponding to the next ordering delivery segment, thereby accelerating the sorting speed of out-of-order messages.
  • Figure 4 shows the bitmap before update for a micro-engine pool according to an embodiment of this application
  • Figure 5 shows the updated bitmap for a micro-engine pool according to an embodiment of this application.
  • FIGs 4 and 5 when the current sorted delivery segment has MSN 0 and iPSN 1 to 15, out-of-order packets with MSN 0 and iPSN 17, MSN 0 and iPSN 32, and MSN 1 and iPSN 0 are not in the current sorted delivery segment.
  • a corresponding first out-of-order event message can be generated and reported to the micro-engine pool.
  • the sorting is then updated in the bitmap table corresponding to the micro-engine pool, so that the bitmap table corresponding to the micro-engine pool shown in Figure 4 is updated to the bitmap table corresponding to the micro-engine pool shown in Figure 5.
  • out-of-order packets received beyond the expected order can be sent to the micro-engine pool for sorting, within the space of the micro-engine pool's maximum maintainable bitmap of size z.
  • the bitmap maintained by the engine pool uses memory at double the system data rate (DDR).
  • DDR system data rate
  • z is typically greater than n, for example, 256 or 384.
  • y represents the total number of messages that the memory can maintain, for example, 8, 16, or 32.
  • the out-of-order message exceeds the system's processing capacity and can be discarded directly, and subsequently recovered through relevant protocols (e.g., the go-back-n protocol).
  • the bitmap of the queue management context can be moved according to the marker information already added to the bitmap of the queue management context.
  • the bitmap of the queue management context can be shifted based on the length of the sub-segments in the current ordered delivery segment. If the length of the current ordered delivery segment is 16, the previous ordered delivery segment can be divided into 4 sub-segments, each corresponding to 4 bits. Then, after setting the first 4 bits to 1 to add marker information, the bitmap of the queue management context can be shifted 4 bits.
  • Figure 6 is a bitmap of a queue management context provided in an embodiment of this application
  • Figure 7 is a bitmap of another queue management context provided in an embodiment of this application.
  • the hardware processing engine receives an out-of-order message with MSN of 0 and iPSN of 0
  • the bitmap of the queue management context is as shown in Figure 6.
  • the bits with MSN of 0 and iPSN of 0 in the bitmap of the queue management context can be set to 1, so that the first 4 bits are all set to 1.
  • the bitmap of the queue management context can be shifted left by 4 bits, so that the first bit becomes MSN of 0 and iPSN of 4.
  • out-of-order messages with MSN 0 and iPSN 16-19 are changed from not being in the current sorting delivery segment to being in the current sorting delivery segment.
  • a second out-of-order event message is reported to the micro-engine pool.
  • the second out-of-order event message is used to request the micro-engine pool to release the first sorting information of the out-of-order packets corresponding to the next sorted delivery segment.
  • the current sorted delivery segment when the current sorted delivery segment corresponds to out-of-order packets with MSN 0 and iPSNs 1 to 15, the current sorted delivery segment can move to the next sorted delivery segment when MSN 0 and iPSNs 1 to 16 are reached.
  • the next sorted delivery segment corresponds to out-of-order packets with MSN 0 and iPSNs 16 to 31.
  • the bitmap corresponding to the micro-engine pool is as shown in Figure 8
  • the bitmap corresponding to the next sorted delivery segment with MSN 0 and iPSNs 16 to 31, as shown in Figure 9 can be sent to the hardware processing engine.
  • first sorting information sent by the micro-engine pool can be received. Subsequently, the first sorting information is bitwise ORed with the second sorting information in the bitmap of the queue management context corresponding to the next sorted delivery segment to update the bitmap of the queue management context corresponding to the next sorted delivery segment.
  • the hardware processing engine can perform a bitwise OR operation between the bitmap of the queue management context (as shown in Figure 10) and the bitmap sent by the microengine pool to obtain the bitmap of the queue management context (as shown in Figure 11).
  • Figure 12 is a schematic diagram of the principle of message reordering provided in an embodiment of this application.
  • the message reordering method provided in this embodiment of the application greatly reduces the number of messages sent to the micro-engine pool for processing by adopting hardware segmented sorting.
  • the micro-engine pool uses the system's memory to reduce hardware overhead, achieving the ability to improve system performance while achieving feasibility, thereby possessing the ability of system line-speed sorting.
  • the out-of-order packets can be rearranged by adding marker information to the sorting position.
  • reordering out-of-order packets allows the data of the out-of-order packets to be written directly to the host's buffer via the address specified in the packet header, requiring only the sorting of the packet descriptors. That is, marking information is added to the sorting positions corresponding to the descriptors in the bitmap; this marking information could, for example, set the bit at the sorting position to 1.
  • the hardware processing engine after the hardware processing engine completes the sorting of out-of-order packets, it can return an acknowledgment request to the receiving end based on the maintenance information. Furthermore, the receiving end can report the Completion Queue Entry (CQE) to the host based on the opcode.
  • CQE Completion Queue Entry
  • Figure 13 is a schematic diagram of message reordering interaction provided in an embodiment of this application.
  • the hardware processing engine can report a first out-of-order event message to the micro-engine pool.
  • the hardware processing engine can report a second out-of-order event message to the micro-engine pool.
  • the formats of the first and second out-of-order event messages can be as shown in Table 1.
  • the microengine can send a response message.
  • This response message can release the first ordering information of the out-of-order packets corresponding to the next ordering delivery segment to the hardware processing engine, thereby synchronizing the corresponding bitmap of the microengine.
  • the format of the response message can be shown in Table 2.
  • the hardware processing engine based on the sorting capabilities of the hardware processing engine, it can support processing one sort per sorting delivery segment at the fastest, with performance far exceeding that of sorting based on processor cores. This meets the sorting capability requirements of various data centers now and in the future, providing effective bandwidth for the entire data center. Simultaneously, the sorting scheme based on the hardware processing engine and micro-engine pool provides support for large-scale out-of-order correction capabilities, offers a degree of flexibility, and reduces the overall cost of the reordering scheme.
  • the message reordering method provided in this application first receives an out-of-order message sent by the requesting end.
  • the out-of-order message includes a message sequence number and a packet sequence number. Then, based on the message sequence number and packet sequence number, it is determined whether the out-of-order message is within the current ordering delivery segment of the network device's hardware processing engine. If the out-of-order message is within the current ordering delivery segment, its ordering position is determined in the bitmap of the queue management context corresponding to the current ordering delivery segment based on the message sequence number and packet sequence number. Finally, the out-of-order message is reordered by adding marker information to the ordering position.
  • FIG 14 is a flowchart illustrating another message rearrangement method provided in an embodiment of this application. As shown in Figure 14, the message rearrangement method includes steps S301-S310:
  • the out-of-order messages include message sequence number and packet sequence number.
  • out-of-order packets are generated when a network interface card (NIC) or switch dynamically load balances and swaps source packets to multiple transmission paths.
  • NIC network interface card
  • the difference between the message sequence number and the expected message sequence number is less than or equal to the number of messages that the hardware processing engine can maintain and the difference between the packet sequence number and the expected packet sequence number is less than or equal to the number of messages that the hardware processing engine can maintain, it is determined that the out-of-order message is within the current sorting delivery segment of the hardware processing engine.
  • the difference between the message sequence number and the expected message sequence number is greater than the number of messages that the hardware processing engine can maintain, or the difference between the packet sequence number and the expected packet sequence number is greater than the number of messages that the hardware processing engine can maintain, then it is determined that the out-of-order message is not in the current sorting delivery segment of the hardware processing engine.
  • the first out-of-order event message includes out-of-order packets, which the micro-engine pool uses to call the host memory to sort the out-of-order packets.
  • S308 then report the second out-of-order event message to the micro-engine pool.
  • the second out-of-order event message is used to request the micro-engine pool to release the first ordering information of the out-of-order message corresponding to the next ordering delivery segment.
  • the message reordering method provided in this application first receives an out-of-order message sent by the requesting end.
  • the out-of-order message includes a message sequence number and a packet sequence number. Then, based on the message sequence number and packet sequence number, it is determined whether the out-of-order message is within the current ordering delivery segment of the network device's hardware processing engine. If the out-of-order message is within the current ordering delivery segment, its ordering position is determined in the bitmap of the queue management context corresponding to the current ordering delivery segment based on the message sequence number and packet sequence number. Finally, the out-of-order message is reordered by adding marker information to the ordering position.
  • steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
  • this application also provides a message reordering apparatus for implementing the message reordering method described above.
  • the solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more message reordering apparatus embodiments provided below can be found in the limitations of the message reordering method described above, and will not be repeated here.
  • a message rearrangement apparatus 400 including: a receiving module 401, a processing module 402, and a rearrangement module 403, wherein:
  • the receiving module 401 is used to receive out-of-order messages sent by the requesting end.
  • the out-of-order messages include message sequence numbers and packet sequence numbers.
  • the processing module 402 is used to determine whether an out-of-order packet is within the current sorting and delivery segment of the network device's hardware processing engine based on the message sequence number and packet sequence number; if the out-of-order packet is within the current sorting and delivery segment, the processing module 402 determines the sorting position of the out-of-order packet in the bitmap of the queue management context corresponding to the current sorting and delivery segment based on the message sequence number and packet sequence number.
  • the rearrangement module 403 is used to rearrange out-of-order packets by adding marker information at the sorting position.
  • the processing module 402 is further configured to determine that the out-of-order message is within the current sorting and delivery segment of the hardware processing engine when the difference between the message sequence number and the expected message sequence number is less than or equal to the number of maintainable messages of the hardware processing engine and the difference between the packet sequence number and the expected packet sequence number is less than or equal to the number of maintainable messages of the hardware processing engine; and to determine that the out-of-order message is not within the current sorting and delivery segment of the hardware processing engine when the difference between the message sequence number and the expected message sequence number is greater than the number of maintainable messages of the hardware processing engine or the difference between the packet sequence number and the expected packet sequence number is greater than the number of maintainable messages of the hardware processing engine.
  • the expected message sequence number is the message sequence number corresponding to the first sorting position in the bitmap of the queue management context
  • the expected packet sequence number is the packet sequence number corresponding to the first sorting position in the bitmap of the queue management context.
  • the processing module 402 is further configured to report a first out-of-order event message to the micro-engine pool when the out-of-order message is not in the current sorting delivery segment of the hardware processing engine.
  • the first out-of-order event message includes the out-of-order message, and the micro-engine pool is used to call the host memory to sort the out-of-order message.
  • the processing module 402 is further configured to move the bitmap of the queue management context according to the added marker information in the bitmap of the queue management context; when the bitmap of the queue management context moves from the current sorting delivery segment to the next sorting delivery segment and a first out-of-order event message has been reported, a second out-of-order event message is reported to the micro-engine pool.
  • the second out-of-order event message is used to request the micro-engine pool to release the first sorting information of the out-of-order message corresponding to the next sorting delivery segment.
  • the receiving module 401 is further configured to receive first sorting information sent by the micro-engine pool.
  • the processing module 402 is further configured to perform a bitwise OR operation between the first sorting information and the second sorting information in the bitmap of the queue management context corresponding to the next sorting delivery segment, so as to update the bitmap of the queue management context corresponding to the next sorting delivery segment.
  • Each module in the aforementioned message rearrangement device can be implemented entirely or partially through software, hardware, or a combination thereof.
  • These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.
  • a computer device which may be a server.
  • the server has a network interface card (NIC) with a chip.
  • the internal structure of the server can be shown in Figure 16.
  • the computer device includes a processor, memory, input/output (I/O) interfaces, and a communication interface.
  • the processor, memory, and I/O interfaces are connected via a system bus, and the communication interface is connected to the system bus via the I/O interfaces.
  • the processor provides computing and control capabilities.
  • the memory includes non-volatile storage media and internal memory.
  • the non-volatile storage media stores the operating system, computer programs, and a database.
  • the internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media.
  • the database stores data.
  • the I/O interfaces are used for exchanging information between the processor and external devices.
  • the communication interface is used for communicating with external terminals via a network connection.
  • a chip in one embodiment, includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the aforementioned message reordering method.
  • the chip may be a data processing unit (DPU) chip.
  • a computer device in one embodiment, includes a processor and the chip provided in the foregoing embodiment.
  • the chip is used to schedule packets to the processor or to process them itself.
  • the processor is used to process packets scheduled by the chip.
  • the computer device may be a server, a server cluster, etc.
  • a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the above-described message reordering method.
  • a computer program product including a computer program that, when executed by a processor, implements the above-described message rearrangement method.
  • Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc.
  • ROM read-only memory
  • MRAM magnetic random access memory
  • FRAM ferroelectric random access memory
  • PCM phase change memory
  • Volatile memory can include random access memory (RAM) or external cache memory, etc.
  • RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).
  • SRAM Static Random Access Memory
  • DRAM Dynamic Random Access Memory
  • the databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases.
  • the processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

Landscapes

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

Abstract

The present application relates to a packet reordering method and apparatus, and a device, a storage medium and a program product. The method comprises: receiving an out-of-order packet sent by a requester, wherein the out-of-order packet comprises a message sequence number and a packet sequence number; on the basis of the message sequence number and the packet sequence number, determining whether the out-of-order packet is in the current in-order delivery segment of a hardware processing engine of a network device; when the out-of-order packet is in the current in-order delivery segment, on the basis of the message sequence number and the packet sequence number, determining an ordering position of the out-of-order packet in a bitmap of queue pair context corresponding to the current in-order delivery segment; and adding marking information to the ordering position, so as to reorder the out-of-order packet.

Description

报文重排方法、装置、芯片、设备、存储介质及程序产品Message rearrangement methods, apparatuses, chips, devices, storage media, and program products

相关申请Related applications

本申请要求2024年4月24日申请的,申请号为2024105011218,名称为“报文重排方法、装置、芯片、设备、存储介质及程序产品”的中国专利申请的优先权,在此将其全文引入作为参考。This application claims priority to Chinese patent application No. 2024105011218, filed on April 24, 2024, entitled “Message Rearrangement Method, Apparatus, Chip, Device, Storage Medium and Program Product”, the entire contents of which are incorporated herein by reference.

技术领域Technical Field

本申请涉及芯片技术领域,特别是涉及一种报文重排方法、装置、芯片、设备、存储介质及程序产品。This application relates to the field of chip technology, and in particular to a message rearrangement method, apparatus, chip, device, storage medium, and program product.

背景技术Background Technology

在人工智能和机器学习等新兴场景中,网络吞吐量比网络延迟更重要,工作的中央处理器和图像处理器的数量较少,但单流量却较大,则要求单负载有低尾延迟。由于聚合以太网上的远程直接内存访问协议(Remote Direct Memory Access over Converged Ethernet,ROCEV)2不支持乱序发送和重排,从而使得ROCEV2无法解决高吞吐量和低尾延迟问题。In emerging scenarios such as artificial intelligence and machine learning, network throughput is more important than network latency. The number of CPUs and GPUs operating is relatively small, but the individual traffic is large, requiring low tail latency per load. Because Remote Direct Memory Access over Converged Ethernet (ROCEV)2 does not support out-of-order transmission and reordering, ROCEV2 cannot solve the problem of high throughput and low tail latency.

相关技术中,部分软件可以通过处理器或者协处理器完成远程直接内存访问(Remote Direct Memory Access,RDMA)的同一个队列组(Queue Pair,QP)的乱序重排。In related technologies, some software can perform out-of-order reordering of the same queue pair (QP) for Remote Direct Memory Access (RDMA) through the processor or coprocessor.

然而,由于处理器或者协处理器处理排序需要前后文的关联,需要使用实时时钟(Real-Time Clock,RTC)的方式来完成,从而使得对于单QP无法使用多线程来完成排序,这导致了无法支持报文的大范围乱序纠正。However, since the sorting process of the processor or coprocessor requires contextual relationships, it needs to be done using a real-time clock (RTC). This makes it impossible to use multiple threads to complete the sorting for a single QP, which results in the inability to support large-scale out-of-order message correction.

发明内容Summary of the Invention

根据本申请的各实施例,提供一种报文重排方法、装置、设备、存储介质及程序产品。According to various embodiments of this application, a message rearrangement method, apparatus, device, storage medium, and program product are provided.

第一方面,本申请提供了一种报文重排方法。所述方法包括:Firstly, this application provides a message rearrangement method. The method includes:

接收请求端发送的乱序报文,所述乱序报文中包括消息序列号和包序列号;Receive out-of-order messages sent by the requesting end, wherein the out-of-order messages include message sequence number and packet sequence number;

根据所述消息序列号和所述包序列号,确定所述乱序报文是否在网络设备的硬件处理引擎的当前排序交付段内;Based on the message sequence number and the packet sequence number, determine whether the out-of-order message is within the current sorting delivery segment of the network device's hardware processing engine;

当所述乱序报文在所述当前排序交付段内,则根据所述消息序列号和包序列号,在所述当前排序交付段对应的队列管理上下文的比特图中确定所述乱序报文的排序位置;When the out-of-order message is within the current order delivery segment, the order position of the out-of-order message is determined in the bitmap of the queue management context corresponding to the current order delivery segment based on the message sequence number and packet sequence number.

通过在所述排序位置添加标记信息,对所述乱序报文进行重排。The out-of-order messages are rearranged by adding marker information at the sorting positions.

在其中一个实施例中,所述根据所述消息序列号和包序列号,确定所述乱序报文是否在所述网络设备的硬件处理引擎的当前排序交付段内,包括:In one embodiment, determining whether the out-of-order packet is within the current ordering delivery segment of the network device's hardware processing engine based on the message sequence number and packet sequence number includes:

当所述消息序列号与期望消息序列号的差值小于等于所述硬件处理引擎的可维护消息数且所述包序列号与期望包序列号的差值小于等于所述硬件处理引擎的可维护报文数,则确定所述乱序报文在所述硬件处理引擎的当前排序交付段内;If the difference between the message sequence number and the expected message sequence number is less than or equal to the number of maintainable messages of the hardware processing engine and the difference between the packet sequence number and the expected packet sequence number is less than or equal to the number of maintainable messages of the hardware processing engine, then the out-of-order message is determined to be within the current sorting delivery segment of the hardware processing engine.

当所述消息序列号与期望消息序列号的差值大于所述硬件处理引擎的可维护消息数或者所述包序列号与期望包序列号的差值大于所述硬件处理引擎的可维护报文数,则确定所述乱序报文不在所述硬件处理引擎的当前排序交付段内。If the difference between the message sequence number and the expected message sequence number is greater than the number of messages that the hardware processing engine can maintain, or if the difference between the packet sequence number and the expected packet sequence number is greater than the number of messages that the hardware processing engine can maintain, then it is determined that the out-of-order message is not in the current sorting delivery segment of the hardware processing engine.

在其中一个实施例中,所述期望消息序列号为所述队列管理上下文的比特图中的第一排序位置对应的消息序列号,所述期望包序列号为所述队列管理上下文的比特图中的第一排序位置对应的包序列号。In one embodiment, the expected message sequence number is the message sequence number corresponding to the first sorting position in the bitmap of the queue management context, and the expected packet sequence number is the packet sequence number corresponding to the first sorting position in the bitmap of the queue management context.

在其中一个实施例中,在所述根据所述消息序列号和包序列号,确定所述乱序报文是否在所述网络设备的硬件处理引擎的当前排序交付段内之后,所述方法还包括:In one embodiment, after determining whether the out-of-order message is within the current ordering delivery segment of the network device's hardware processing engine based on the message sequence number and packet sequence number, the method further includes:

当所述乱序报文不在所述硬件处理引擎的当前排序交付段内,则向微引擎池上报第一乱序事件消息,所述第一乱序事件消息中包括所述乱序报文,所述微引擎池用于调用主机内存排序所述乱序报文。When the out-of-order message is not in the current sorting delivery segment of the hardware processing engine, a first out-of-order event message is reported to the micro-engine pool. The first out-of-order event message includes the out-of-order message. The micro-engine pool is used to call the host memory to sort the out-of-order message.

在其中一个实施例中,在所述通过在所述排序位置添加标记信息,对所述乱序报文进行重排之后,所述方法还包括:In one embodiment, after rearranging the out-of-order packets by adding marker information at the sorting position, the method further includes:

根据所述队列管理上下文的比特图中已添加的标记信息,对所述队列管理上下文的比特图进行移动;The bitmap of the queue management context is moved according to the added marker information in the bitmap of the queue management context;

当所述队列管理上下文的比特图由所述当前排序交付段移动至下一排序交付段且上报过所述第一乱序事件消息,则向所述微引擎池上报第二乱序事件消息,所述第二乱序事件消息用于请求所述微引擎池释放所述下一排序交付段对应的乱序报文的第一排序信息。When the bitmap of the queue management context moves from the current sorting delivery segment to the next sorting delivery segment and the first out-of-order event message has been reported, a second out-of-order event message is reported to the micro-engine pool. The second out-of-order event message is used to request the micro-engine pool to release the first sorting information of the out-of-order packets corresponding to the next sorting delivery segment.

在其中一个实施例中,在所述向所述微引擎池上报第二乱序事件消息之后,所述方法还包括:In one embodiment, after reporting the second out-of-order event message to the micro-engine pool, the method further includes:

接收所述微引擎池发送的所述第一排序信息;Receive the first sorting information sent by the micro-engine pool;

将所述第一排序信息与所述下一排序交付段对应的队列管理上下文的比特图中的第二排序信息按位进行或运算,以更新所述下一排序交付段对应的队列管理上下文的比特图。The first sorting information is bitwise ORed with the second sorting information in the bitmap of the queue management context corresponding to the next sorting delivery segment to update the bitmap of the queue management context corresponding to the next sorting delivery segment.

第二方面,本申请提供了一种报文重排装置。所述装置包括:Secondly, this application provides a message rearrangement apparatus. The apparatus includes:

接收模块,用于接收请求端发送的乱序报文,所述乱序报文中包括消息序列号和包序列号;The receiving module is used to receive out-of-order messages sent by the requesting end, wherein the out-of-order messages include message sequence numbers and packet sequence numbers;

处理模块,用于根据所述消息序列号和所述包序列号,确定所述乱序报文是否在网络设备的硬件处理引擎的当前排序交付段内;当所述乱序报文在所述当前排序交付段内,则根据所述消息序列号和包序列号,在所述当前排序交付段对应的队列管理上下文的比特图中确定所述乱序报文的排序位置;The processing module is configured to determine whether the out-of-order packet is within the current sorting and delivery segment of the hardware processing engine of the network device based on the message sequence number and the packet sequence number; if the out-of-order packet is within the current sorting and delivery segment, the module determines the sorting position of the out-of-order packet in the bitmap of the queue management context corresponding to the current sorting and delivery segment based on the message sequence number and the packet sequence number.

重排模块,用于通过在所述排序位置添加标记信息,对所述乱序报文进行重排。The rearrangement module is used to rearrange the out-of-order packets by adding marker information at the sorting positions.

在其中一个实施例中,所述处理模块,还用于当所述消息序列号与期望消息序列号的差值小于等于所述硬件处理引擎的可维护消息数且所述包序列号与期望包序列号的差值小于等于所述硬件处理引擎的可维护报文数,则确定所述乱序报文在所述硬件处理引擎的当前排序交付段内;当所述消息序列号与期望消息序列号的差值大于所述硬件处理引擎的可维护消息数或者所述包序列号与期望包序列号的差值大于所述硬件处理引擎的可维护报文数,则确定所述乱序报文不在所述硬件处理引擎的当前排序交付段内。In one embodiment, the processing module is further configured to: determine that the out-of-order message is within the current sorting and delivery segment of the hardware processing engine when the difference between the message sequence number and the expected message sequence number is less than or equal to the number of maintainable messages of the hardware processing engine and the difference between the packet sequence number and the expected packet sequence number is less than or equal to the number of maintainable messages of the hardware processing engine; and determine that the out-of-order message is not within the current sorting and delivery segment of the hardware processing engine when the difference between the message sequence number and the expected message sequence number is greater than the number of maintainable messages of the hardware processing engine or the difference between the packet sequence number and the expected packet sequence number is greater than the number of maintainable messages of the hardware processing engine.

在其中一个实施例中,所述期望消息序列号为所述队列管理上下文的比特图中的第一排序位置对应的消息序列号,所述期望包序列号为所述队列管理上下文的比特图中的第一排序位置对应的包序列号。In one embodiment, the expected message sequence number is the message sequence number corresponding to the first sorting position in the bitmap of the queue management context, and the expected packet sequence number is the packet sequence number corresponding to the first sorting position in the bitmap of the queue management context.

在其中一个实施例中,所述处理模块,还用于当所述乱序报文不在所述硬件处理引擎的当前排序交付段内,则向微引擎池上报第一乱序事件消息,所述第一乱序事件消息中包括所述乱序报文,所述微引擎池用于调用主机内存排序所述乱序报文。In one embodiment, the processing module is further configured to report a first out-of-order event message to the micro-engine pool when the out-of-order message is not in the current sorting delivery segment of the hardware processing engine. The first out-of-order event message includes the out-of-order message, and the micro-engine pool is configured to call the host memory to sort the out-of-order message.

在其中一个实施例中,所述处理模块,还用于根据所述队列管理上下文的比特图中已添加的标记信息,对所述队列管理上下文的比特图进行移动;当所述队列管理上下文的比特图由所述当前排序交付段移动至下一排序交付段且上报过所述第一乱序事件消息,则向所述微引擎池上报第二乱序事件消息,所述第二乱序事件消息用于请求所述微引擎池释放所述下一排序交付段对应的乱序报文的第一排序信息。In one embodiment, the processing module is further configured to move the bitmap of the queue management context according to the added tag information in the bitmap of the queue management context; when the bitmap of the queue management context moves from the current sorting delivery segment to the next sorting delivery segment and the first out-of-order event message has been reported, a second out-of-order event message is reported to the micro-engine pool, the second out-of-order event message being used to request the micro-engine pool to release the first sorting information of the out-of-order packets corresponding to the next sorting delivery segment.

在其中一个实施例中,所述接收模块,还用于接收所述微引擎池发送的所述第一排序信息;In one embodiment, the receiving module is further configured to receive the first sorting information sent by the micro-engine pool;

所述处理模块,还用于将所述第一排序信息与所述下一排序交付段对应的队列管理上下文的比特图中的第二排序信息按位进行或运算,以更新所述下一排序交付段对应的队列管理上下文的比特图。The processing module is further configured to perform a bitwise OR operation between the first sorting information and the second sorting information in the bitmap of the queue management context corresponding to the next sorting delivery segment, so as to update the bitmap of the queue management context corresponding to the next sorting delivery segment.

第三方面,本申请提供了一种芯片。所述芯片包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现上述第一方面的报文重排方法。Thirdly, this application provides a chip. The chip includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the message reordering method of the first aspect described above.

第四方面,本申请还提供了一种计算机设备。所述计算机设备包括处理器和如第三方面所述芯片,所述芯片用于将报文调度给所述处理器或所述芯片自身处理,所述处理器用于处理所述芯片调度过来的报文。Fourthly, this application also provides a computer device. The computer device includes a processor and a chip as described in the third aspect, the chip being configured to schedule messages to the processor or to process them itself, the processor being configured to process messages scheduled by the chip.

第五方面,本申请还提供了一种计算机可读存储介质。所述计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现报文重排方法。Fifthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements a message reordering method.

第六方面,本申请还提供了一种计算机程序产品。所述计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现报文重排方法。Sixthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements a message reordering method.

本申请的一个或多个实施例的细节在下面的附图和描述中提出。本申请的其他特征、目的和优点将从说明书、附图以及权利要求书变得明显。Details of one or more embodiments of this application are set forth in the following drawings and description. Other features, objects, and advantages of this application will become apparent from the specification, drawings, and claims.

附图说明Attached Figure Description

为了更清楚地说明本申请实施例或传统技术中的技术方案,下面将对实施例或传统技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据公开的附图获得其他的附图。To more clearly illustrate the technical solutions in the embodiments of this application or the conventional technology, the drawings used in the description of the embodiments or the conventional technology will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the disclosed drawings without creative effort.

图1为本申请实施例提供的一种报文重排方法的应用环境示意图;Figure 1 is a schematic diagram of the application environment of a message rearrangement method provided in an embodiment of this application;

图2为本申请实施例提供的一种报文重排方法的流程示意图;Figure 2 is a flowchart illustrating a message rearrangement method provided in an embodiment of this application;

图3为本申请实施例提供的一种实现逐包均衡的示意图;Figure 3 is a schematic diagram of a packet-by-packet equalization implementation provided by an embodiment of this application;

图4为本申请实施例提供的一种微引擎池对应的更新前的比特示意图;Figure 4 is a bit diagram of a micro-engine pool before update provided in an embodiment of this application;

图5为本申请实施例提供的一种微引擎池对应的更新后的比特示意图;Figure 5 is an updated bit diagram corresponding to a micro-engine pool provided in an embodiment of this application;

图6为本申请实施例提供的一种队列管理上下文的比特示意图;Figure 6 is a bit diagram of a queue management context provided in an embodiment of this application;

图7为本申请实施例提供的另一种队列管理上下文的比特示意图;Figure 7 is a bit diagram of another queue management context provided in an embodiment of this application;

图8为本申请实施例提供的另一种微引擎池对应的比特示意图;Figure 8 is a bit diagram corresponding to another micro-engine pool provided in the embodiment of this application;

图9为本申请实施例提供的一种微引擎池对应的下一排序交付段对应的比特示意图;Figure 9 is a bit diagram of the next sorting delivery segment corresponding to a micro-engine pool provided in an embodiment of this application;

图10为本申请实施例提供的再一种队列管理上下文的比特示意图;Figure 10 is a bit diagram of another queue management context provided in an embodiment of this application;

图11为本申请实施例提供的又一种队列管理上下文的比特示意图;Figure 11 is a bit diagram of another queue management context provided in an embodiment of this application;

图12为本申请实施例提供的一种报文重排的原理示意图;Figure 12 is a schematic diagram illustrating the principle of message reordering provided in an embodiment of this application;

图13为本申请实施例提供的一种报文重排的交互示意图;Figure 13 is an interactive schematic diagram of message rearrangement provided in an embodiment of this application;

图14为本申请实施例提供的另一种报文重排方法的流程示意图;Figure 14 is a flowchart illustrating another message rearrangement method provided in an embodiment of this application;

图15为本申请实施例提供的一种报文重排装置的结构示意图;Figure 15 is a schematic diagram of a message rearrangement device provided in an embodiment of this application;

图16为本申请实施例提供的一种计算机设备的内部结构示意图。Figure 16 is a schematic diagram of the internal structure of a computer device provided in an embodiment of this application.

具体实施方式Detailed Implementation

下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

下面首先对于报文重排方法的应用环境进行说明。The following section will first explain the application environment of the message rearrangement method.

本申请实施例提供的报文重排方法可以应用于网络设备中。图1为本申请实施例提供的一种报文重排方法的应用环境示意图。如图1所示,网络设备上可以包括请求端101和接收端102。一个网络设备上的请求端101可以向另一个网络设备上的接收端102发送乱序报文,乱序报文中包括消息序列号和包序列号。随后,接收端102根据消息序列号和包序列号,确定乱序报文是否在网络设备的硬件处理引擎的当前排序交付段内。当乱序报文在当前排序交付段内,接收端102则根据消息序列号和包序列号,在当前排序交付段对应的队列管理上下文的比特图中确定乱序报文的排序位置,随后,接收端102通过在排序位置添加标记信息,对乱序报文进行重排。当乱序报文不在硬件处理引擎的当前排序交付段内,接收端102则向网络设备的微引擎池103上报第一乱序事件消息,第一乱序事件消息中包括乱序报文,微引擎池用于调用主机内存排序乱序报文。微引擎池可以是网络设备的处理器模块。主机(Host)可以是网络设备的系统(如,操作系统)。The message reordering method provided in this application embodiment can be applied to network devices. Figure 1 is a schematic diagram of the application environment of a message reordering method provided in this application embodiment. As shown in Figure 1, the network device may include a requesting end 101 and a receiving end 102. The requesting end 101 on one network device can send an out-of-order message to the receiving end 102 on another network device. The out-of-order message includes a message sequence number and a packet sequence number. Subsequently, the receiving end 102 determines whether the out-of-order message is within the current ordering delivery segment of the network device's hardware processing engine based on the message sequence number and the packet sequence number. When the out-of-order message is within the current ordering delivery segment, the receiving end 102 determines the ordering position of the out-of-order message in the bitmap of the queue management context corresponding to the current ordering delivery segment based on the message sequence number and the packet sequence number. Subsequently, the receiving end 102 reorders the out-of-order message by adding marking information to the ordering position. When an out-of-order packet is not within the current ordering delivery segment of the hardware processing engine, the receiver 102 reports a first out-of-order event message to the network device's micro-engine pool 103. This first out-of-order event message includes the out-of-order packet, and the micro-engine pool uses host memory to order the out-of-order packet. The micro-engine pool can be a processor module of the network device. The host can be the network device's system (e.g., operating system).

应理解,本申请实施例对于网络设备不做限制,在一些实施例中,上述网络设备可以包括网络接口卡(Network Interface Card,NIC)等。It should be understood that the embodiments of this application do not limit the network devices. In some embodiments, the network devices may include network interface cards (NICs), etc.

在一个实施例中,如图2所示,提供了一种报文重排方法,以该方法应用于图1中的接收端为例进行说明,包括S201-S204:In one embodiment, as shown in Figure 2, a message rearrangement method is provided. Taking the application of this method to the receiving end in Figure 1 as an example, the method includes S201-S204:

S201、接收请求端发送的乱序报文,乱序报文中包括消息序列号和包序列号。S201. Receive out-of-order messages sent by the requesting end. The out-of-order messages include message sequence number and packet sequence number.

在本申请中,当请求端(Requester)支持乱序发送报文,则请求端可以将乱序报文发送给接收端(Responder),以便接收端对乱序报文进行重排。In this application, when the requester supports out-of-order message delivery, the requester can send out-of-order messages to the responder so that the responder can rearrange the out-of-order messages.

其中,上述消息序列号(Message Sequence Number,MSN)和包序列号(Packet Sequence Number,PSN)均为乱序报文的描述符。The Message Sequence Number (MSN) and Packet Sequence Number (PSN) mentioned above are descriptors for out-of-order messages.

应理解,在RDMA中,存在消息(MESSAGE)的概念,一个MESSAGE可以包括一个或多个报文包(Packet,PKT)。相应的,请求端在发送乱序报文时,可以附带消息序列号(Message Sequence Number,MSN)和包序列号(Packet Sequence Number,PSN),从而使得接收端基于MSN和PSN对乱序报文进行排序。It should be understood that in RDMA, there is a concept of a message, and a message can include one or more packets (PKTs). Accordingly, when the requesting end sends an out-of-order message, it can attach a message sequence number (MSN) and a packet sequence number (PSN), so that the receiving end can reorder the out-of-order message based on the MSN and PSN.

在一些实施例中,乱序报文是由网卡或交换机通过动态负载均衡将源报文交换到多个传输路径时形成的。In some embodiments, out-of-order packets are generated when a network interface card (NIC) or switch dynamically load balances and swaps source packets to multiple transmission paths.

应理解,动态负载均衡是一种核心网络解决方案,用于在服务器场中的多台服务器之间分配流量。负载均衡可提高应用程序的可用性和响应能力,并防止服务器过载。负载均衡服务位于客户端设备和后端服务器之间,接收传入的请求,然后将其分发到能够满足这些请求的任何可用服务器。It should be understood that dynamic load balancing is a core networking solution used to distribute traffic among multiple servers in a server farm. Load balancing improves application availability and responsiveness and prevents server overload. The load balancing service sits between client devices and backend servers, receiving incoming requests and then distributing them to any available server capable of fulfilling those requests.

示例性的,一个网络服务器,通常有多个worker(例如,进程或线程)。当多个客户端连接到同一个worker,则该worker会变得繁忙并带来巨大的尾部延迟(tail latency),而其他worker将运行在空闲状态。为了降低资源的整体利用率,同时也降低了网络服务器的性能要求,可以通过动态负载均衡来避免多个客户端连接到同一个worker。For example, a web server typically has multiple workers (e.g., processes or threads). When multiple clients connect to the same worker, that worker becomes busy and experiences significant tail latency, while other workers remain idle. To reduce overall resource utilization and lower the performance requirements of the web server, dynamic load balancing can be used to prevent multiple clients from connecting to the same worker.

图3为本申请实施例提供的一种实现逐包均衡的示意图。如图3所示,在本申请中,可以通过动态负载均衡由网卡或交换机将源报文交换到多个传输路径,降低了单流的尾部延迟,极大的缩小单流传送完成时间。Figure 3 is a schematic diagram of packet-by-packet load balancing provided in an embodiment of this application. As shown in Figure 3, in this application, source packets can be switched to multiple transmission paths by network interface cards or switches through dynamic load balancing, reducing the tail latency of a single stream and greatly shortening the single stream transmission completion time.

示例性的,通过交换机进行动态负载均衡来实现逐包均衡时,乱序发送的传输路径(PATH)可以由交换机通过关键哈希(HASH)因子来确定。其中,关键HASH因子可以包括源IP地址、源IP地址+目的IP地址、源IP地址+目的IP地址+源端口号+目的端口号等。For example, when implementing packet-by-packet load balancing through dynamic load balancing using a switch, the out-of-order transmission path (PATH) can be determined by the switch using a key hash factor. This key hash factor can include source IP address, source IP address + destination IP address, source IP address + destination IP address + source port number + destination port number, etc.

示例性的,通过网卡进行动态负载均衡来实现逐包均衡时,可以修改用户数据报协议(User Datagram Protocol,UDP)的源端口号(例如,UDP.SPORT),使用数据包序列号(Packet Sequence Number,PSN)低16比特作为UDP的源端口号,从而通过修改后的UDP的源端口号将源报文交换到不同的PATH。For example, when implementing packet-by-packet load balancing through dynamic load balancing via the network interface card, the source port number of the User Datagram Protocol (UDP) (e.g., UDP.SPORT) can be modified, and the lower 16 bits of the Packet Sequence Number (PSN) can be used as the UDP source port number, thereby exchanging source packets to different paths through the modified UDP source port number.

在本申请中,基于逐包分发排序的情况下,网卡或交换机可以更好的使用各类流量的动态负载均衡算法,避免网络中单条大流或者多流等价多路径路由(Equal-Cost Multi-Path,ECMP)带来不均衡的影响。In this application, based on packet-by-packet distribution ordering, network interface cards (NICs) or switches can better utilize dynamic load balancing algorithms for various types of traffic, avoiding the unbalanced effects caused by single large flows or equal-cost multi-path (ECMP) routing of multiple flows in the network.

S202、根据消息序列号和包序列号,确定乱序报文是否在网络设备的硬件处理引擎的当前排序交付段内。S202. Based on the message sequence number and packet sequence number, determine whether the out-of-order message is within the current ordering delivery segment of the network device's hardware processing engine.

在本步骤中,当接收端接收到请求端发送的乱序报文后,可以根据消息序列号和包序列号,确定乱序报文是否在网络设备的硬件处理引擎的当前排序交付段内。In this step, after the receiving end receives the out-of-order message sent by the requesting end, it can determine whether the out-of-order message is within the current ordering delivery segment of the network device's hardware processing engine based on the message sequence number and packet sequence number.

其中,硬件处理引擎可以为RDMA硬件处理引擎(RDMA Processing Engine,RPE)。The hardware processing engine can be an RDMA Processing Engine (RPE).

其中,当前排序交付段为当前进行排序处理的报文序列。The currently sorted delivery segment is the sequence of messages currently being sorted.

在一些实施例中,在当前排序交付段对应的乱序报文排齐后,再进行下一排序交付段对应的乱序报文的排齐。即,在每个排序交付段,硬件处理引擎只维护期望接收到报文的乱序报文。In some embodiments, out-of-order packets corresponding to the current ordering delivery segment are aligned before the out-of-order packets corresponding to the next ordering delivery segment are aligned. That is, in each ordering delivery segment, the hardware processing engine only maintains the out-of-order packets for which packets are expected to be received.

应理解,本申请实施例对于如何确定乱序报文是否在网络设备的硬件处理引擎的当前排序交付段内不做限制,在一些实施例中,当消息序列号与期望消息序列号的差值小于等于硬件处理引擎的可维护消息数且包序列号与期望包序列号的差值小于等于硬件处理引擎的可维护报文数,则确定乱序报文在硬件处理引擎的当前排序交付段内。It should be understood that the embodiments of this application do not impose restrictions on how to determine whether an out-of-order message is within the current sorting and delivery segment of the hardware processing engine of the network device. In some embodiments, when the difference between the message sequence number and the expected message sequence number is less than or equal to the number of messages that the hardware processing engine can maintain and the difference between the packet sequence number and the expected packet sequence number is less than or equal to the number of messages that the hardware processing engine can maintain, it is determined that the out-of-order message is within the current sorting and delivery segment of the hardware processing engine.

示例性的,当MSN-期望消息序列号(Expected Message Sequence Number,EPSN)≤X,且PSN-期望包序列号(Expected Packet Sequence Number,EPSN)≤n,则接收端可以确定乱序报文在硬件处理引擎的当前排序交付段内。相应的,可以在当前排序交付段对应的队列管理上下文(Queue pair context,QPC)的比特图(bitmap)中确定乱序报文的排序位置。其中,X为硬件处理引擎的可维护消息数,n为硬件处理引擎的可维护报文数。For example, if the MSN-Expected Message Sequence Number (EPSN) ≤ X and the PSN-Expected Packet Sequence Number (EPSN) ≤ n, the receiver can determine that the out-of-order message is within the current ordered delivery segment of the hardware processing engine. Accordingly, the ordering position of the out-of-order message can be determined in the bitmap of the Queue Pair Context (QPC) corresponding to the current ordered delivery segment. Here, X is the number of maintainable messages in the hardware processing engine, and n is the number of maintainable packets in the hardware processing engine.

在另一些实施例中,当消息序列号与期望消息序列号的差值大于硬件处理引擎的可维护消息数或者包序列号与期望包序列号的差值大于硬件处理引擎的可维护报文数,则确定乱序报文不在硬件处理引擎的当前排序交付段内。In other embodiments, if the difference between the message sequence number and the expected message sequence number is greater than the number of messages that the hardware processing engine can maintain, or the difference between the packet sequence number and the expected packet sequence number is greater than the number of messages that the hardware processing engine can maintain, then it is determined that the out-of-order message is not in the current sorting delivery segment of the hardware processing engine.

示例性的,当MSN-EMSN>X,或PSN-EPSN>n,则接收端可以确定乱序报文不在硬件处理引擎的当前排序交付段内。其中,X为硬件处理引擎的可维护消息数,n为硬件处理引擎的可维护报文数。For example, when MSN-EMSN > X, or PSN-EPSN > n, the receiver can determine that the out-of-order message is not within the current ordering delivery segment of the hardware processing engine. Here, X is the maintainable message count of the hardware processing engine, and n is the maintainable message count of the hardware processing engine.

应理解,本申请实施例对于如何确定期望消息序列号和期望包序列号不做限制,在一些实施例中,期望消息序列号为队列管理上下文的比特图中的第一排序位置对应的消息序列号,期望包序列号为队列管理上下文的比特图中的第一排序位置对应的包序列号。It should be understood that the embodiments of this application do not limit how the expected message sequence number and the expected packet sequence number are determined. In some embodiments, the expected message sequence number is the message sequence number corresponding to the first sorting position in the bitmap of the queue management context, and the expected packet sequence number is the packet sequence number corresponding to the first sorting position in the bitmap of the queue management context.

应理解,本申请实施例对于硬件处理引擎的可维护消息数和硬件处理引擎的可维护报文数也不做限制,可以根据硬件资源和/或系统往返时延(Round-Trip Time,RTT)具体设置。It should be understood that the embodiments of this application do not limit the number of maintainable messages and maintainable packets of the hardware processing engine, and can be specifically set according to hardware resources and/or system round-trip time (RTT).

示例性的,可以基于硬件资源和系统RTT,选择64或128或256作为硬件处理引擎的可维护报文数。示例性的,可以基于硬件资源,选择2或4或8或16作为硬件处理引擎的可维护消息数。示例性的,还可以进一步划分出排序交付段中的子段,例如,可以将长度为n的排序交付段划分为m子段,m为4或8。For example, based on hardware resources and system RTT, 64, 128, or 256 can be selected as the maintainable message count for the hardware processing engine. For example, based on hardware resources, 2, 4, 8, or 16 can be selected as the maintainable message count for the hardware processing engine. For example, the ordered delivery segment can be further subdivided into sub-segments; for instance, an ordered delivery segment of length n can be divided into m sub-segments, where m is 4 or 8.

S203、当乱序报文在当前排序交付段内,则根据消息序列号和包序列号,在当前排序交付段对应的队列管理上下文的比特图中确定乱序报文的排序位置。S203. When an out-of-order message is within the current ordering delivery segment, the ordering position of the out-of-order message is determined in the bitmap of the queue management context corresponding to the current ordering delivery segment based on the message sequence number and packet sequence number.

在本步骤中,当确定乱序报文在当前排序交付段内后,可以根据消息序列号和包序列号,在当前排序交付段对应的队列管理上下文的比特图中确定乱序报文的排序位置。In this step, once it is determined that the out-of-order message is within the current ordering delivery segment, the ordering position of the out-of-order message can be determined in the bitmap of the queue management context corresponding to the current ordering delivery segment based on the message sequence number and packet sequence number.

在一些实施例中,可以首先基于消息序列号在比特图中定位对应的消息的位置,再基于包序列号在比特图中定位对应的包的位置,从而确定出乱序报文的排序位置。In some embodiments, the position of the corresponding message can be located in the bitmap first based on the message sequence number, and then the position of the corresponding packet can be located in the bitmap based on the packet sequence number, thereby determining the sorting position of the out-of-order messages.

示例性的,当当前排序交付段为MSN为0且iPSN为1至15。则MSN为0且iPSN为1至15的乱序报文,均不需要发给微引擎池处理,只需要在QPC的bitmap内确定相应的比特位,并将相应比特位置1进行标记,表示已经收到该乱序报文并完成排序。For example, when the current sorted delivery segment has an MSN of 0 and an iPSN of 1 to 15, out-of-order messages with an MSN of 0 and an iPSN of 1 to 15 do not need to be sent to the micro-engine pool for processing. It is only necessary to determine the corresponding bit in the QPC bitmap and mark the corresponding bit with 1 to indicate that the out-of-order message has been received and sorted.

在另一些实施例中,当乱序报文不在硬件处理引擎的当前排序交付段内,则向微引擎池上报第一乱序事件消息,第一乱序事件消息中包括乱序报文,微引擎池用于调用主机内存排序乱序报文。In other embodiments, when an out-of-order message is not in the current sorting delivery segment of the hardware processing engine, a first out-of-order event message is reported to the micro-engine pool. The first out-of-order event message includes the out-of-order message, and the micro-engine pool is used to call the host memory to sort the out-of-order message.

在一些实施例中,微引擎池中也可以维护一张bitmap表,每当微引擎池接收到第一乱序事件消息后,可以确定第一乱序事件消息中的乱序报文在微引擎池对应的bitmap表中的排序位置,随后,将该排序位置的比特位置1,以完成排序。In some embodiments, a bitmap table can also be maintained in the micro-engine pool. Whenever the micro-engine pool receives the first out-of-order event message, it can determine the sorting position of the out-of-order message in the bitmap table corresponding to the micro-engine pool. Then, the bit of the sorting position is set to 1 to complete the sorting.

示例性的,当当前排序交付段为MSN对应0且iPSN为1至15,则当接收到的MSN等于0号且iPSN超过16号的乱序报文,或者MSN不等于0号的乱序报文时,硬件处理引擎均无法进行排序。此时,硬件处理引擎可以向微引擎池发送第一乱序事件消息,来使微引擎池对乱序报文进行排序。For example, when the current sorting delivery segment corresponds to MSN 0 and iPSN is 1 to 15, the hardware processing engine cannot sort out-of-order packets when the received MSN is equal to 0 and the iPSN is greater than 16, or when the MSN is not equal to 0. In this case, the hardware processing engine can send a first out-of-order event message to the micro-engine pool to enable the micro-engine pool to sort the out-of-order packets.

本申请实施例提供的报文重排方法,通过微引擎池维持的bitmap表,可以实现微引擎池和硬件处理引擎的软硬结合重排序方案。相比相关技术,采用软硬结合重排序方案进行重排序,既提供了线速的硬件处理引擎的排序处理的能力,又提供了基于微引擎池微码的灵活排序扩展能力,从而可以有效控制硬件的资源和成本。The message reordering method provided in this application embodiment, through the bitmap table maintained by the micro-engine pool, can realize a software-hardware combined reordering scheme of the micro-engine pool and the hardware processing engine. Compared with related technologies, the software-hardware combined reordering scheme provides both the line-speed sorting processing capability of the hardware processing engine and the flexible sorting extension capability based on the micro-engine pool microcode, thereby effectively controlling hardware resources and costs.

并且,相比当前已有方案,重排序端的硬件处理引擎通过聚合收到的乱序报文,在收到当前排序交付段内完整的乱序报文后,和微引擎池交互一次,微引擎池在交互时把之前记录的超过硬件处理引擎乱序程度的下一排序交付段对应的乱序报文的第一排序信息下发到硬件处理引擎,以便硬件处理引擎与下一排序交付段对应的队列管理上下文的比特图中的第二排序信息按位进行或运算,以对下一排序交付段对应的乱序报文进行排序,从而加快了乱序报文的排序速度。Furthermore, compared to existing solutions, the hardware processing engine at the reordering end aggregates the received out-of-order messages. After receiving a complete out-of-order message within the current ordering delivery segment, it interacts with the micro-engine pool once. During this interaction, the micro-engine pool sends the first ordering information of the out-of-order messages corresponding to the next ordering delivery segment that exceeds the out-of-order level of the hardware processing engine to the hardware processing engine. This allows the hardware processing engine to perform a bitwise OR operation with the second ordering information in the bitmap of the queue management context corresponding to the next ordering delivery segment to sort the out-of-order messages corresponding to the next ordering delivery segment, thereby accelerating the sorting speed of out-of-order messages.

图4为本申请实施例提供的一种微引擎池对应的更新前的比特图,图5为本申请实施例提供的一种微引擎池对应的更新后的比特图。如图4和5所示,当当前排序交付段为MSN为0且iPSN为1至15,则MSN为0且iPSN为17、MSN为0且iPSN为32、MSN为1且iPSN为0的乱序报文均不在当前排序交付段内,可以生成相应的第一乱序事件消息上报给微引擎池,在微引擎池对应的bitmap表中进行排序更新,使得如图4所示的微引擎池对应的bitmap表更新为如图5所示的微引擎池对应的bitmap表。Figure 4 shows the bitmap before update for a micro-engine pool according to an embodiment of this application, and Figure 5 shows the updated bitmap for a micro-engine pool according to an embodiment of this application. As shown in Figures 4 and 5, when the current sorted delivery segment has MSN 0 and iPSN 1 to 15, out-of-order packets with MSN 0 and iPSN 17, MSN 0 and iPSN 32, and MSN 1 and iPSN 0 are not in the current sorted delivery segment. A corresponding first out-of-order event message can be generated and reported to the micro-engine pool. The sorting is then updated in the bitmap table corresponding to the micro-engine pool, so that the bitmap table corresponding to the micro-engine pool shown in Figure 4 is updated to the bitmap table corresponding to the micro-engine pool shown in Figure 5.

示例的,对于超出期望接收到的乱序报文可以送到微引擎池进行排序,应在微引擎池最大可以维护的比特图为z的空间内。其中,msn-emsn<y。For example, out-of-order packets received beyond the expected order can be sent to the micro-engine pool for sorting, within the space of the micro-engine pool's maximum maintainable bitmap of size z. Where msn - emsn < y.

其中,引擎池可以维护的比特图使用的是系统双倍数据速率(Double Data Rate,DDR)的内存。z通常大于n,例如以为256、384等。y为内存可以维护的消息总数,例如可以为8、16、32。The bitmap maintained by the engine pool uses memory at double the system data rate (DDR). z is typically greater than n, for example, 256 or 384. y represents the total number of messages that the memory can maintain, for example, 8, 16, or 32.

示例性的,当msn-emsn≥y或者psn-epsn≥z,则该乱序报文超出系统处理的能力,可以直接丢弃,后续通过相关(例如,go-back-n协议)协议恢复。For example, if msn-emsn≥y or psn-epsn≥z, the out-of-order message exceeds the system's processing capacity and can be discarded directly, and subsequently recovered through relevant protocols (e.g., the go-back-n protocol).

在一些实施例中,在通过在排序位置添加标记信息,对乱序报文进行重排之后,还可以根据队列管理上下文的比特图中已添加的标记信息,对队列管理上下文的比特图进行移动。In some embodiments, after reordering out-of-order packets by adding marker information at the sorting position, the bitmap of the queue management context can be moved according to the marker information already added to the bitmap of the queue management context.

示例性的,可以根据当前排序交付段中的子段的长度,对队列管理上下文的比特图进行移动。当当前排序交付段的长度为16,则可以将前排序交付段划分为4个子段,每个子段对应4个比特位。则当第1个比特位开始的4个比特位均通过置1添加标记信息后,可以将队列管理上下文的比特图移动4位。For example, the bitmap of the queue management context can be shifted based on the length of the sub-segments in the current ordered delivery segment. If the length of the current ordered delivery segment is 16, the previous ordered delivery segment can be divided into 4 sub-segments, each corresponding to 4 bits. Then, after setting the first 4 bits to 1 to add marker information, the bitmap of the queue management context can be shifted 4 bits.

示例性的,图6为本申请实施例提供的一种队列管理上下文的比特图,图7为本申请实施例提供的另一种队列管理上下文的比特图。当硬件处理引擎接收到MSN为0且iPSN为0的乱序报文时,队列管理上下文的比特图如图6所示,此时可以将队列管理上下文的比特图中MSN为0且iPSN为0的比特位置1,从而使得第1个比特位开始的4个比特位均已置1。此时,可以如图7所示,将队列管理上下文的比特图左移4为,将第1个比特位变为MSN为0且iPSN为4。For example, Figure 6 is a bitmap of a queue management context provided in an embodiment of this application, and Figure 7 is a bitmap of another queue management context provided in an embodiment of this application. When the hardware processing engine receives an out-of-order message with MSN of 0 and iPSN of 0, the bitmap of the queue management context is as shown in Figure 6. At this time, the bits with MSN of 0 and iPSN of 0 in the bitmap of the queue management context can be set to 1, so that the first 4 bits are all set to 1. At this time, as shown in Figure 7, the bitmap of the queue management context can be shifted left by 4 bits, so that the first bit becomes MSN of 0 and iPSN of 4.

需要说明的是,由于对队列管理上下文的比特图进行移动,队列管理上下文的比特图的第一排序位置对应的消息序列号和包序列号,也会发生变更。相应的原先不在当前排序交付段内的乱序报文可能变更为在当前排序交付段内。It should be noted that, due to the shifting of the bitmap of the queue management context, the message sequence number and packet sequence number corresponding to the first sorted position in the bitmap of the queue management context will also change. Consequently, out-of-order messages that were not originally in the current sorted delivery segment may become part of the current sorted delivery segment.

示例性的,第一排序位置对应的消息序列号和包序列号由MSN为0且iPSN为0变更为MSN为0且iPSN为4后,MSN为0且iPSN为16-19的乱序报文由不在当前排序交付段内,变更为在当前排序交付段内。For example, after the message sequence number and packet sequence number corresponding to the first sorting position are changed from MSN 0 and iPSN 0 to MSN 0 and iPSN 4, out-of-order messages with MSN 0 and iPSN 16-19 are changed from not being in the current sorting delivery segment to being in the current sorting delivery segment.

在一些实施例中,当队列管理上下文的比特图由当前排序交付段移动至下一排序交付段且上报过第一乱序事件消息,则向微引擎池上报第二乱序事件消息,第二乱序事件消息用于请求微引擎池释放下一排序交付段对应的乱序报文的第一排序信息。In some embodiments, when the bitmap of the queue management context moves from the current sorted delivery segment to the next sorted delivery segment and a first out-of-order event message has been reported, a second out-of-order event message is reported to the micro-engine pool. The second out-of-order event message is used to request the micro-engine pool to release the first sorting information of the out-of-order packets corresponding to the next sorted delivery segment.

示例性的,当当前排序交付段对应MSN为0且iPSN为1至15的乱序报文,则当前排序交付段移动至MSN为0且iPSN为1至16时,可以进入下一排序交付段,下一排序交付段对应MSN为0且iPSN为16至31的乱序报文。此时,当微引擎池对应的比特图如图8所示,则可以将如图9所示下一排序交付段对应的MSN为0且iPSN为16至31的比特图发送给硬件处理引擎。For example, when the current sorted delivery segment corresponds to out-of-order packets with MSN 0 and iPSNs 1 to 15, the current sorted delivery segment can move to the next sorted delivery segment when MSN 0 and iPSNs 1 to 16 are reached. The next sorted delivery segment corresponds to out-of-order packets with MSN 0 and iPSNs 16 to 31. At this time, if the bitmap corresponding to the micro-engine pool is as shown in Figure 8, the bitmap corresponding to the next sorted delivery segment with MSN 0 and iPSNs 16 to 31, as shown in Figure 9, can be sent to the hardware processing engine.

在另一些实施例中,在向微引擎池上报第二乱序事件消息之后,可以接收微引擎池发送的第一排序信息。随后,将第一排序信息与下一排序交付段对应的队列管理上下文的比特图中的第二排序信息按位进行或运算,以更新下一排序交付段对应的队列管理上下文的比特图。In other embodiments, after reporting the second out-of-order event message to the micro-engine pool, first sorting information sent by the micro-engine pool can be received. Subsequently, the first sorting information is bitwise ORed with the second sorting information in the bitmap of the queue management context corresponding to the next sorted delivery segment to update the bitmap of the queue management context corresponding to the next sorted delivery segment.

示例性的,当微引擎池将如图9所示下一排序交付段对应的MSN为0且iPSN为16至31的比特图发送给硬件处理引擎。硬件处理引擎可以将如图10所示的队列管理上下文的比特图与微引擎池发送的比特图,按位进行“或”运算,得到如图11所示的队列管理上下文的比特图。For example, when the microengine pool sends a bitmap corresponding to the next sorted delivery segment (as shown in Figure 9) with an MSN of 0 and an iPSN of 16 to 31 to the hardware processing engine, the hardware processing engine can perform a bitwise OR operation between the bitmap of the queue management context (as shown in Figure 10) and the bitmap sent by the microengine pool to obtain the bitmap of the queue management context (as shown in Figure 11).

图12为本申请实施例提供的一种报文重排的原理示意图,如图12所示,本申请实施例提供的报文重排方法,由于采用了硬件分段排序,大大降低送往微引擎池处理的报文数目,又通过微引擎池使用系统的内存来降低硬件的开销,达到可实现性同时提高系统性能的能力,从而具备系统线速排序的能力。Figure 12 is a schematic diagram of the principle of message reordering provided in an embodiment of this application. As shown in Figure 12, the message reordering method provided in this embodiment of the application greatly reduces the number of messages sent to the micro-engine pool for processing by adopting hardware segmented sorting. Furthermore, the micro-engine pool uses the system's memory to reduce hardware overhead, achieving the ability to improve system performance while achieving feasibility, thereby possessing the ability of system line-speed sorting.

S204、通过在排序位置添加标记信息,对乱序报文进行重排。S204. Reorder out-of-order messages by adding marker information to the sorting position.

在本步骤中,当确定乱序报文的排序位置后,可以通过在排序位置添加标记信息,对乱序报文进行重排。In this step, once the sorting position of out-of-order packets is determined, the out-of-order packets can be rearranged by adding marker information to the sorting position.

应理解,对乱序报文进行重排,可以将乱序报文的数据通过报文头写到的地址,直接写到主机的缓存中,只需要对报文的描述符进行排序。即,在比特图中将描述符对应的排序位置添加标记信息,该标记信息可例如将排序位置的比特位置1。It should be understood that reordering out-of-order packets allows the data of the out-of-order packets to be written directly to the host's buffer via the address specified in the packet header, requiring only the sorting of the packet descriptors. That is, marking information is added to the sorting positions corresponding to the descriptors in the bitmap; this marking information could, for example, set the bit at the sorting position to 1.

继续参考图12,当硬件处理引擎完成对乱序报文的排序后,硬件处理引擎可以根据维护信息返回确认信息请求端。并且,接收端可以基于操作码将完成队列条目(Completion Queue Entry,CQE)上报给主机。Referring again to Figure 12, after the hardware processing engine completes the sorting of out-of-order packets, it can return an acknowledgment request to the receiving end based on the maintenance information. Furthermore, the receiving end can report the Completion Queue Entry (CQE) to the host based on the opcode.

下面对于报文重排过程中的交互事件进行说明。图13为本申请实施例提供的一种报文重排的交互示意图。如图13所示,在请求端向接收端发送乱序报文后,当乱序报文不在当前排序交付段内,则硬件处理引擎可以向微引擎池上报第一乱序事件消息。当上报过第一乱序事件消息且队列管理上下文的比特图移动至下一排序交付段,则硬件处理引擎可以向微引擎池上报第二乱序事件消息。其中,第一乱序事件消息和第二乱序事件消息的格式可以如表1所示。The interactive events during the message reordering process are described below. Figure 13 is a schematic diagram of message reordering interaction provided in an embodiment of this application. As shown in Figure 13, after the requesting end sends an out-of-order message to the receiving end, if the out-of-order message is not within the current ordering delivery segment, the hardware processing engine can report a first out-of-order event message to the micro-engine pool. When the first out-of-order event message has been reported and the bitmap of the queue management context moves to the next ordering delivery segment, the hardware processing engine can report a second out-of-order event message to the micro-engine pool. The formats of the first and second out-of-order event messages can be as shown in Table 1.

表1
Table 1

随后,微引擎在接收到第二乱序事件消息后,可以发送响应消息,该响应消息中可以将下一排序交付段对应的乱序报文的第一排序信息释放给硬件处理引擎,以同步微引擎对应的比特图。其中,响应消息的格式可以如表2所示。Subsequently, upon receiving the second out-of-order event message, the microengine can send a response message. This response message can release the first ordering information of the out-of-order packets corresponding to the next ordering delivery segment to the hardware processing engine, thereby synchronizing the corresponding bitmap of the microengine. The format of the response message can be shown in Table 2.

表2
Table 2

在本申请中,基于硬件处理引擎排序能力,最快能支持每个排序交付段处理一个排序,性能远远大于基于处理器核类的排序,满足现在和未来各类数据中心对排序能力的要求,提供整个数据中心的有效带宽。同时,基于硬件处理引擎和微引擎池的排序方案,提供支持大范围乱序纠正能力,并提供一定的灵活性,同时降低了整体重排序方案的成本。In this application, based on the sorting capabilities of the hardware processing engine, it can support processing one sort per sorting delivery segment at the fastest, with performance far exceeding that of sorting based on processor cores. This meets the sorting capability requirements of various data centers now and in the future, providing effective bandwidth for the entire data center. Simultaneously, the sorting scheme based on the hardware processing engine and micro-engine pool provides support for large-scale out-of-order correction capabilities, offers a degree of flexibility, and reduces the overall cost of the reordering scheme.

本申请实施例提供的报文重排方法,首先接收请求端发送的乱序报文,乱序报文中包括消息序列号和包序列号。随后,根据消息序列号和包序列号,确定乱序报文是否在网络设备的硬件处理引擎的当前排序交付段内。当乱序报文在当前排序交付段内,则根据消息序列号和包序列号,在当前排序交付段对应的队列管理上下文的比特图中确定乱序报文的排序位置。最后,通过在排序位置添加标记信息,对乱序报文进行重排。由于采用了硬件分段排序,大大降低送往微处理池处理的报文数目,又降低了硬件的开销,达到报文重排的可实现性的同时提高报文重排的性能,从而可以支持报文的大范围乱序纠正。The message reordering method provided in this application first receives an out-of-order message sent by the requesting end. The out-of-order message includes a message sequence number and a packet sequence number. Then, based on the message sequence number and packet sequence number, it is determined whether the out-of-order message is within the current ordering delivery segment of the network device's hardware processing engine. If the out-of-order message is within the current ordering delivery segment, its ordering position is determined in the bitmap of the queue management context corresponding to the current ordering delivery segment based on the message sequence number and packet sequence number. Finally, the out-of-order message is reordered by adding marker information to the ordering position. Because hardware segmented ordering is used, the number of messages sent to the microprocessor pool for processing is greatly reduced, and hardware overhead is also reduced. This achieves message reordering feasibility while improving message reordering performance, thereby supporting large-scale out-of-order message correction.

图14为本申请实施例提供的另一种报文重排方法的流程示意图,如图14所示,该报文重排方法包括S301-S310:Figure 14 is a flowchart illustrating another message rearrangement method provided in an embodiment of this application. As shown in Figure 14, the message rearrangement method includes steps S301-S310:

S301、接收请求端发送的乱序报文,乱序报文中包括消息序列号和包序列号。S301. Receive out-of-order messages sent by the requesting end. The out-of-order messages include message sequence number and packet sequence number.

在一些实施例中,乱序报文是由网卡或交换机通过动态负载均衡将源报文交换到多个传输路径时形成的。In some embodiments, out-of-order packets are generated when a network interface card (NIC) or switch dynamically load balances and swaps source packets to multiple transmission paths.

S302、根据消息序列号和包序列号,确定乱序报文是否在网络设备的硬件处理引擎的当前排序交付段内。S302. Based on the message sequence number and packet sequence number, determine whether the out-of-order message is within the current ordering delivery segment of the network device's hardware processing engine.

若是,则执行,S304,若否,则执行S303。If yes, then execute S304; otherwise, execute S303.

在一些实施例中,当消息序列号与期望消息序列号的差值小于等于硬件处理引擎的可维护消息数且包序列号与期望包序列号的差值小于等于硬件处理引擎的可维护报文数,则确定乱序报文在硬件处理引擎的当前排序交付段内。In some embodiments, when the difference between the message sequence number and the expected message sequence number is less than or equal to the number of messages that the hardware processing engine can maintain and the difference between the packet sequence number and the expected packet sequence number is less than or equal to the number of messages that the hardware processing engine can maintain, it is determined that the out-of-order message is within the current sorting delivery segment of the hardware processing engine.

在一些实施例中,当消息序列号与期望消息序列号的差值大于硬件处理引擎的可维护消息数或者包序列号与期望包序列号的差值大于硬件处理引擎的可维护报文数,则确定乱序报文不在硬件处理引擎的当前排序交付段内。In some embodiments, if the difference between the message sequence number and the expected message sequence number is greater than the number of messages that the hardware processing engine can maintain, or the difference between the packet sequence number and the expected packet sequence number is greater than the number of messages that the hardware processing engine can maintain, then it is determined that the out-of-order message is not in the current sorting delivery segment of the hardware processing engine.

S303、向微引擎池上报第一乱序事件消息,第一乱序事件消息中包括乱序报文,微引擎池用于调用主机内存排序乱序报文。S303. Report the first out-of-order event message to the micro-engine pool. The first out-of-order event message includes out-of-order packets, which the micro-engine pool uses to call the host memory to sort the out-of-order packets.

S304、据消息序列号和包序列号,在当前排序交付段对应的队列管理上下文的比特图中确定乱序报文的排序位置。S304. Based on the message sequence number and packet sequence number, determine the order position of the out-of-order message in the bitmap of the queue management context corresponding to the current order delivery segment.

S305、通过在排序位置添加标记信息,对乱序报文进行重排。S305. Reorder out-of-order messages by adding marker information to the sorting position.

S306、根据队列管理上下文的比特图中已添加的标记信息,对队列管理上下文的比特图进行移动。S306. Move the bitmap of the queue management context according to the added marker information in the bitmap of the queue management context.

S307、确定队列管理上下文的比特图是否由当前排序交付段移动至下一排序交付段且上报过第一乱序事件消息。S307. Determine whether the bitmap of the queue management context has been moved from the current sorted delivery segment to the next sorted delivery segment and whether the first out-of-order event message has been reported.

若是,则执行S301,若否,则执行S308。If yes, then execute S301; otherwise, execute S308.

S308、则向微引擎池上报第二乱序事件消息,第二乱序事件消息用于请求微引擎池释放下一排序交付段对应的乱序报文的第一排序信息。S308, then report the second out-of-order event message to the micro-engine pool. The second out-of-order event message is used to request the micro-engine pool to release the first ordering information of the out-of-order message corresponding to the next ordering delivery segment.

S309、接收微引擎池发送的第一排序信息。S309, Receive the first sorting information sent by the micro-engine pool.

S310、将第一排序信息与下一排序交付段对应的队列管理上下文的比特图中的第二排序信息按位进行或运算,以更新下一排序交付段对应的队列管理上下文的比特图。S310. Perform a bitwise OR operation between the first sorting information and the second sorting information in the bitmap of the queue management context corresponding to the next sorting delivery segment to update the bitmap of the queue management context corresponding to the next sorting delivery segment.

本申请实施例提供的报文重排方法,首先接收请求端发送的乱序报文,乱序报文中包括消息序列号和包序列号。随后,根据消息序列号和包序列号,确定乱序报文是否在网络设备的硬件处理引擎的当前排序交付段内。当乱序报文在当前排序交付段内,则根据消息序列号和包序列号,在当前排序交付段对应的队列管理上下文的比特图中确定乱序报文的排序位置。最后,通过在排序位置添加标记信息,对乱序报文进行重排。由于采用了硬件分段排序,大大降低送往微处理池处理的报文数目,又降低了硬件的开销,达到报文重排的可实现性的同时提高报文重排的性能,从而可以支持报文的大范围乱序纠正。The message reordering method provided in this application first receives an out-of-order message sent by the requesting end. The out-of-order message includes a message sequence number and a packet sequence number. Then, based on the message sequence number and packet sequence number, it is determined whether the out-of-order message is within the current ordering delivery segment of the network device's hardware processing engine. If the out-of-order message is within the current ordering delivery segment, its ordering position is determined in the bitmap of the queue management context corresponding to the current ordering delivery segment based on the message sequence number and packet sequence number. Finally, the out-of-order message is reordered by adding marker information to the ordering position. Because hardware segmented ordering is used, the number of messages sent to the microprocessor pool for processing is greatly reduced, and hardware overhead is also reduced. This achieves message reordering feasibility while improving message reordering performance, thereby supporting large-scale out-of-order message correction.

应该理解的是,虽然如上的各实施例所涉及的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,如上的各实施例所涉及的流程图中的至少一部分步骤可以包括多个步骤或者多个阶段,这些步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤中的步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the steps in the flowcharts of the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

基于同样的构思,本申请实施例还提供了一种用于实现上述所涉及的报文重排方法的报文重排装置。该装置所提供的解决问题的实现方案与上述方法中所记载的实现方案相似,故下面所提供的一个或多个报文重排装置实施例中的具体限定可以参见上文中对于报文重排方法的限定,在此不再赘述。Based on the same concept, this application also provides a message reordering apparatus for implementing the message reordering method described above. The solution provided by this apparatus is similar to the implementation described in the above method; therefore, the specific limitations in one or more message reordering apparatus embodiments provided below can be found in the limitations of the message reordering method described above, and will not be repeated here.

在一个实施例中,如图15所示,提供了一种报文重排装置400,包括:接收模块401、处理模块402和重排模块403,其中:In one embodiment, as shown in FIG15, a message rearrangement apparatus 400 is provided, including: a receiving module 401, a processing module 402, and a rearrangement module 403, wherein:

接收模块401,用于接收请求端发送的乱序报文,乱序报文中包括消息序列号和包序列号。The receiving module 401 is used to receive out-of-order messages sent by the requesting end. The out-of-order messages include message sequence numbers and packet sequence numbers.

处理模块402,用于根据消息序列号和包序列号,确定乱序报文是否在网络设备的硬件处理引擎的当前排序交付段内;当乱序报文在当前排序交付段内,则根据消息序列号和包序列号,在当前排序交付段对应的队列管理上下文的比特图中确定乱序报文的排序位置。The processing module 402 is used to determine whether an out-of-order packet is within the current sorting and delivery segment of the network device's hardware processing engine based on the message sequence number and packet sequence number; if the out-of-order packet is within the current sorting and delivery segment, the processing module 402 determines the sorting position of the out-of-order packet in the bitmap of the queue management context corresponding to the current sorting and delivery segment based on the message sequence number and packet sequence number.

重排模块403,用于通过在排序位置添加标记信息,对乱序报文进行重排。The rearrangement module 403 is used to rearrange out-of-order packets by adding marker information at the sorting position.

在其中一个实施例中,处理模块402,还用于当消息序列号与期望消息序列号的差值小于等于硬件处理引擎的可维护消息数且包序列号与期望包序列号的差值小于等于硬件处理引擎的可维护报文数,则确定乱序报文在硬件处理引擎的当前排序交付段内;当消息序列号与期望消息序列号的差值大于硬件处理引擎的可维护消息数或者包序列号与期望包序列号的差值大于硬件处理引擎的可维护报文数,则确定乱序报文不在硬件处理引擎的当前排序交付段内。In one embodiment, the processing module 402 is further configured to determine that the out-of-order message is within the current sorting and delivery segment of the hardware processing engine when the difference between the message sequence number and the expected message sequence number is less than or equal to the number of maintainable messages of the hardware processing engine and the difference between the packet sequence number and the expected packet sequence number is less than or equal to the number of maintainable messages of the hardware processing engine; and to determine that the out-of-order message is not within the current sorting and delivery segment of the hardware processing engine when the difference between the message sequence number and the expected message sequence number is greater than the number of maintainable messages of the hardware processing engine or the difference between the packet sequence number and the expected packet sequence number is greater than the number of maintainable messages of the hardware processing engine.

在其中一个实施例中,期望消息序列号为队列管理上下文的比特图中的第一排序位置对应的消息序列号,期望包序列号为队列管理上下文的比特图中的第一排序位置对应的包序列号。In one embodiment, the expected message sequence number is the message sequence number corresponding to the first sorting position in the bitmap of the queue management context, and the expected packet sequence number is the packet sequence number corresponding to the first sorting position in the bitmap of the queue management context.

在其中一个实施例中,处理模块402,还用于当乱序报文不在硬件处理引擎的当前排序交付段内,则向微引擎池上报第一乱序事件消息,第一乱序事件消息中包括乱序报文,微引擎池用于调用主机内存排序乱序报文。In one embodiment, the processing module 402 is further configured to report a first out-of-order event message to the micro-engine pool when the out-of-order message is not in the current sorting delivery segment of the hardware processing engine. The first out-of-order event message includes the out-of-order message, and the micro-engine pool is used to call the host memory to sort the out-of-order message.

在其中一个实施例中,处理模块402,还用于根据队列管理上下文的比特图中已添加的标记信息,对队列管理上下文的比特图进行移动;当队列管理上下文的比特图由当前排序交付段移动至下一排序交付段且上报过第一乱序事件消息,则向微引擎池上报第二乱序事件消息,第二乱序事件消息用于请求微引擎池释放下一排序交付段对应的乱序报文的第一排序信息。In one embodiment, the processing module 402 is further configured to move the bitmap of the queue management context according to the added marker information in the bitmap of the queue management context; when the bitmap of the queue management context moves from the current sorting delivery segment to the next sorting delivery segment and a first out-of-order event message has been reported, a second out-of-order event message is reported to the micro-engine pool. The second out-of-order event message is used to request the micro-engine pool to release the first sorting information of the out-of-order message corresponding to the next sorting delivery segment.

在其中一个实施例中,接收模块401,还用于接收微引擎池发送的第一排序信息。In one embodiment, the receiving module 401 is further configured to receive first sorting information sent by the micro-engine pool.

处理模块402,还用于将第一排序信息与下一排序交付段对应的队列管理上下文的比特图中的第二排序信息按位进行或运算,以更新下一排序交付段对应的队列管理上下文的比特图。The processing module 402 is further configured to perform a bitwise OR operation between the first sorting information and the second sorting information in the bitmap of the queue management context corresponding to the next sorting delivery segment, so as to update the bitmap of the queue management context corresponding to the next sorting delivery segment.

上述报文重排装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。Each module in the aforementioned message rearrangement device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in the processor of a computer device in hardware form or independent of it, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.

在一个实施例中,提供了一种计算机设备,该计算机设备可以是服务器,该服务器插有网络接口卡,网络接口卡上包括有芯片。服务器的内部结构图可以如图16所示。该计算机设备包括处理器、存储器、输入/输出接口(Input/Output,简称I/O)和通信接口。其中,处理器、存储器和输入/输出接口通过系统总线连接,通信接口通过输入/输出接口连接到系统总线。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质和内存储器。该非易失性存储介质存储有操作系统、计算机程序和数据库。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的数据库用于存储数据。该计算机设备的输入/输出接口用于处理器与外部设备之间交换信息。该计算机设备的通信接口用于与外部的终端通过网络连接通信。本领域技术人员可以理解,图16中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。In one embodiment, a computer device is provided, which may be a server. The server has a network interface card (NIC) with a chip. The internal structure of the server can be shown in Figure 16. The computer device includes a processor, memory, input/output (I/O) interfaces, and a communication interface. The processor, memory, and I/O interfaces are connected via a system bus, and the communication interface is connected to the system bus via the I/O interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores data. The I/O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. Those skilled in the art will understand that the structure shown in Figure 16 is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

在一个实施例中,提供了一种芯片。所述芯片包括存储器和处理器,存储器中存储有计算机程序,该处理器执行计算机程序时实现上述报文重排方法。所述芯片可以是数据处理器(Data Processing Unit,DPU)芯片。In one embodiment, a chip is provided. The chip includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the aforementioned message reordering method. The chip may be a data processing unit (DPU) chip.

在一个实施例中,提供了一种计算机设备。所述计算机设备包括处理器和前述实施例提供的所述芯片,所述芯片用于将报文调度给所述处理器或所述芯片自身处理,所述处理器用于处理所述芯片调度过来的报文。所述计算机设备可以是服务器、服务器集群等。In one embodiment, a computer device is provided. The computer device includes a processor and the chip provided in the foregoing embodiment. The chip is used to schedule packets to the processor or to process them itself. The processor is used to process packets scheduled by the chip. The computer device may be a server, a server cluster, etc.

在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器执行时实现上述报文重排方法。In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the above-described message reordering method.

在一个实施例中,提供了一种计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现上述报文重排方法。In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the above-described message rearrangement method.

本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、数据库或其它介质的任何引用,均可包括非易失性和易失性存储器中的至少一种。非易失性存储器可包括只读存储器(Read-Only Memory,ROM)、磁带、软盘、闪存、光存储器、高密度嵌入式非易失性存储器、阻变存储器(ReRAM)、磁变存储器(Magnetoresistive Random Access Memory,MRAM)、铁电存储器(Ferroelectric Random Access Memory,FRAM)、相变存储器(Phase Change Memory,PCM)、石墨烯存储器等。易失性存储器可包括随机存取存储器(Random Access Memory,RAM)或外部高速缓冲存储器等。作为说明而非局限,RAM可以是多种形式,比如静态随机存取存储器(Static Random Access Memory,SRAM)或动态随机存取存储器(Dynamic Random Access Memory,DRAM)等。本申请所提供的各实施例中所涉及的数据库可包括关系型数据库和非关系型数据库中至少一种。非关系型数据库可包括基于区块链的分布式数据库等,不限于此。本申请所提供的各实施例中所涉及的处理器可为通用处理器、中央处理器、图形处理器、数字信号处理器、可编程逻辑器、基于量子计算的数据处理逻辑器等,不限于此。Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

以上实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请的保护范围应以所附权利要求为准。The above embodiments are merely illustrative of several implementation methods of this application, and their descriptions are relatively specific and detailed. However, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims (15)

一种报文重排方法,其特征在于,所述方法包括:A message rearrangement method, characterized in that the method includes: 接收请求端发送的乱序报文,所述乱序报文中包括消息序列号和包序列号;Receive out-of-order messages sent by the requesting end, wherein the out-of-order messages include message sequence number and packet sequence number; 根据所述消息序列号和所述包序列号,确定所述乱序报文是否在网络设备的硬件处理引擎的当前排序交付段内;Based on the message sequence number and the packet sequence number, determine whether the out-of-order message is within the current sorting delivery segment of the network device's hardware processing engine; 当所述乱序报文在所述当前排序交付段内,则根据所述消息序列号和包序列号,在所述当前排序交付段对应的队列管理上下文的比特图中确定所述乱序报文的排序位置;When the out-of-order message is within the current order delivery segment, the order position of the out-of-order message is determined in the bitmap of the queue management context corresponding to the current order delivery segment based on the message sequence number and packet sequence number. 通过在所述排序位置添加标记信息,对所述乱序报文进行重排。The out-of-order messages are rearranged by adding marker information at the sorting positions. 根据权利要求1所述的方法,其特征在于,所述根据所述消息序列号和包序列号,确定所述乱序报文是否在所述网络设备的硬件处理引擎的当前排序交付段内,包括:The method according to claim 1, characterized in that, determining whether the out-of-order packet is within the current sorting delivery segment of the hardware processing engine of the network device based on the message sequence number and the packet sequence number includes: 当所述消息序列号与期望消息序列号的差值小于等于所述硬件处理引擎的可维护消息数且所述包序列号与期望包序列号的差值小于等于所述硬件处理引擎的可维护报文数,则确定所述乱序报文在所述硬件处理引擎的当前排序交付段内;If the difference between the message sequence number and the expected message sequence number is less than or equal to the number of maintainable messages of the hardware processing engine and the difference between the packet sequence number and the expected packet sequence number is less than or equal to the number of maintainable messages of the hardware processing engine, then the out-of-order message is determined to be within the current sorting delivery segment of the hardware processing engine. 当所述消息序列号与期望消息序列号的差值大于所述硬件处理引擎的可维护消息数或者所述包序列号与期望包序列号的差值大于所述硬件处理引擎的可维护报文数,则确定所述乱序报文不在所述硬件处理引擎的当前排序交付段内。If the difference between the message sequence number and the expected message sequence number is greater than the number of messages that the hardware processing engine can maintain, or if the difference between the packet sequence number and the expected packet sequence number is greater than the number of messages that the hardware processing engine can maintain, then it is determined that the out-of-order message is not in the current sorting delivery segment of the hardware processing engine. 根据权利要求2所述的方法,其特征在于,所述期望消息序列号为所述队列管理上下文的比特图中的第一排序位置对应的消息序列号,所述期望包序列号为所述队列管理上下文的比特图中的第一排序位置对应的包序列号。According to the method of claim 2, the expected message sequence number is the message sequence number corresponding to the first sorting position in the bitmap of the queue management context, and the expected packet sequence number is the packet sequence number corresponding to the first sorting position in the bitmap of the queue management context. 根据权利要求1所述的方法,其特征在于,在所述根据所述消息序列号和包序列号,确定所述乱序报文是否在所述网络设备的硬件处理引擎的当前排序交付段内之后,所述方法还包括:The method according to claim 1, characterized in that, after determining whether the out-of-order message is within the current ordering delivery segment of the hardware processing engine of the network device based on the message sequence number and the packet sequence number, the method further includes: 当所述乱序报文不在所述硬件处理引擎的当前排序交付段内,则向微引擎池上报第一乱序事件消息,所述第一乱序事件消息中包括所述乱序报文,所述微引擎池用于调用主机内存排序所述乱序报文。When the out-of-order message is not in the current sorting delivery segment of the hardware processing engine, a first out-of-order event message is reported to the micro-engine pool. The first out-of-order event message includes the out-of-order message. The micro-engine pool is used to call the host memory to sort the out-of-order message. 根据权利要求4述的方法,其特征在于,在所述通过在所述排序位置添加标记信息,对所述乱序报文进行重排之后,所述方法还包括:According to the method described in claim 4, the method further includes, after rearranging the out-of-order packets by adding marker information at the sorting position: 根据所述队列管理上下文的比特图中已添加的标记信息,对所述队列管理上下文的比特图进行移动;The bitmap of the queue management context is moved according to the added marker information in the bitmap of the queue management context; 当所述队列管理上下文的比特图由所述当前排序交付段移动至下一排序交付段且上报过所述第一乱序事件消息,则向所述微引擎池上报第二乱序事件消息,所述第二乱序事件消息用于请求所述微引擎池释放所述下一排序交付段对应的乱序报文的第一排序信息。When the bitmap of the queue management context moves from the current sorting delivery segment to the next sorting delivery segment and the first out-of-order event message has been reported, a second out-of-order event message is reported to the micro-engine pool. The second out-of-order event message is used to request the micro-engine pool to release the first sorting information of the out-of-order packets corresponding to the next sorting delivery segment. 根据权利要求5所述的方法,其特征在于,在所述向所述微引擎池上报第二乱序事件消息之后,所述方法还包括:The method according to claim 5, characterized in that, after reporting the second out-of-order event message to the micro-engine pool, the method further includes: 接收所述微引擎池发送的所述第一排序信息;Receive the first sorting information sent by the micro-engine pool; 将所述第一排序信息与所述下一排序交付段对应的队列管理上下文的比特图中的第二排序信息按位进行或运算,以更新所述下一排序交付段对应的队列管理上下文的比特图。The first sorting information is bitwise ORed with the second sorting information in the bitmap of the queue management context corresponding to the next sorting delivery segment to update the bitmap of the queue management context corresponding to the next sorting delivery segment. 一种报文重排装置,其特征在于,所述装置包括:A message rearrangement apparatus, characterized in that the apparatus comprises: 接收模块,用于接收请求端发送的乱序报文,所述乱序报文中包括消息序列号和包序列号;The receiving module is used to receive out-of-order messages sent by the requesting end, wherein the out-of-order messages include message sequence numbers and packet sequence numbers; 处理模块,用于根据所述消息序列号和所述包序列号,确定所述乱序报文是否在网络设备的硬件处理引擎的当前排序交付段内;当所述乱序报文在所述当前排序交付段内,则根据所述消息序列号和包序列号,在所述当前排序交付段对应的队列管理上下文的比特图中确定所述乱序报文的排序位置;The processing module is configured to determine whether the out-of-order packet is within the current sorting and delivery segment of the hardware processing engine of the network device based on the message sequence number and the packet sequence number; if the out-of-order packet is within the current sorting and delivery segment, the module determines the sorting position of the out-of-order packet in the bitmap of the queue management context corresponding to the current sorting and delivery segment based on the message sequence number and the packet sequence number. 重排模块,用于通过在所述排序位置添加标记信息,对所述乱序报文进行重排。The rearrangement module is used to rearrange the out-of-order packets by adding marker information at the sorting positions. 根据权利要求7所述的装置,其特征在于,所述处理模块,还用于当所述消息序列号与期望消息序列号的差值小于等于所述硬件处理引擎的可维护消息数且所述包序列号与期望包序列号的差值小于等于所述硬件处理引擎的可维护报文数,则确定所述乱序报文在所述硬件处理引擎的当前排序交付段内;当所述消息序列号与期望消息序列号的差值大于所述硬件处理引擎的可维护消息数或者所述包序列号与期望包序列号的差值大于所述硬件处理引擎的可维护报文数,则确定所述乱序报文不在所述硬件处理引擎的当前排序交付段内。The apparatus according to claim 7, wherein the processing module is further configured to: determine that the out-of-order message is within the current sorting and delivery segment of the hardware processing engine when the difference between the message sequence number and the expected message sequence number is less than or equal to the number of maintainable messages of the hardware processing engine and the difference between the packet sequence number and the expected packet sequence number is less than or equal to the number of maintainable messages of the hardware processing engine; and determine that the out-of-order message is not within the current sorting and delivery segment of the hardware processing engine when the difference between the message sequence number and the expected message sequence number is greater than the number of maintainable messages of the hardware processing engine or the difference between the packet sequence number and the expected packet sequence number is greater than the number of maintainable messages of the hardware processing engine. 根据权利要求8所述的装置,其特征在于,所述期望消息序列号为所述队列管理上下文的比特图中的第一排序位置对应的消息序列号,所述期望包序列号为所述队列管理上下文的比特图中的第一排序位置对应的包序列号。The apparatus according to claim 8, wherein the expected message sequence number is the message sequence number corresponding to the first sorting position in the bitmap of the queue management context, and the expected packet sequence number is the packet sequence number corresponding to the first sorting position in the bitmap of the queue management context. 根据权利要求7所述的装置,其特征在于,所述处理模块,还用于当所述乱序报文不在所述硬件处理引擎的当前排序交付段内,则向微引擎池上报第一乱序事件消息,所述第一乱序事件消息中包括所述乱序报文,所述微引擎池用于调用主机内存排序所述乱序报文。The apparatus according to claim 7, wherein the processing module is further configured to report a first out-of-order event message to the micro-engine pool when the out-of-order message is not in the current sorting delivery segment of the hardware processing engine, the first out-of-order event message including the out-of-order message, and the micro-engine pool is configured to call the host memory to sort the out-of-order message. 根据权利要求10所述的装置,其特征在于,所述处理模块,还用于根据所述队列管理上下文的比特图中已添加的标记信息,对所述队列管理上下文的比特图进行移动;当所述队列管理上下文的比特图由所述当前排序交付段移动至下一排序交付段且上报过所述第一乱序事件消息,则向所述微引擎池上报第二乱序事件消息,所述第二乱序事件消息用于请求所述微引擎池释放所述下一排序交付段对应的乱序报文的第一排序信息。The apparatus according to claim 10, wherein the processing module is further configured to move the bitmap of the queue management context according to the added marker information in the bitmap of the queue management context; when the bitmap of the queue management context moves from the current sorting delivery segment to the next sorting delivery segment and the first out-of-order event message has been reported, a second out-of-order event message is reported to the micro-engine pool, the second out-of-order event message being used to request the micro-engine pool to release the first sorting information of the out-of-order packets corresponding to the next sorting delivery segment. 一种芯片,其特征在于,包括存储器和处理器,所述存储器存储有计算机程序,其特征在于,所述处理器执行所述计算机程序时实现权利要求1至6中任一项所述的方法的步骤。A chip, characterized in that it includes a memory and a processor, the memory storing a computer program, characterized in that the processor executes the computer program to implement the steps of the method according to any one of claims 1 to 6. 一种计算机设备,包括处理器和权利要求8所述芯片,其特征在于,所述芯片用于将报文调度给所述处理器或所述芯片自身处理,所述处理器用于处理所述芯片调度过来的报文。A computer device includes a processor and the chip of claim 8, characterized in that the chip is used to schedule messages to the processor or to process them on its own, and the processor is used to process messages scheduled by the chip. 一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至6中任一项所述的方法的步骤。A computer-readable storage medium having a computer program stored thereon, characterized in that, when the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6. 一种计算机程序产品,包括计算机程序,其特征在于,该计算机程序被处理器执行时实现权利要求1至6中任一项所述的方法的步骤。A computer program product includes a computer program, characterized in that, when executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 6.
PCT/CN2025/088858 2024-04-24 2025-04-14 Packet reordering method and apparatus, and chip, device, storage medium and program product Pending WO2025223244A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202410501121.8A CN118301100A (en) 2024-04-24 2024-04-24 Message reordering method, device, chip, equipment, storage medium and program product
CN202410501121.8 2024-04-24

Publications (1)

Publication Number Publication Date
WO2025223244A1 true WO2025223244A1 (en) 2025-10-30

Family

ID=91686173

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2025/088858 Pending WO2025223244A1 (en) 2024-04-24 2025-04-14 Packet reordering method and apparatus, and chip, device, storage medium and program product

Country Status (2)

Country Link
CN (1) CN118301100A (en)
WO (1) WO2025223244A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118301100A (en) * 2024-04-24 2024-07-05 深圳云豹智能有限公司 Message reordering method, device, chip, equipment, storage medium and program product

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111711566A (en) * 2020-07-03 2020-09-25 西安电子科技大学 Receiver out-of-order rearrangement method in multi-path routing scenario
US20220014468A1 (en) * 2020-07-13 2022-01-13 Google Llc Content Addressable Memory (CAM) Based Hardware Architecture For Datacenter Networking
CN115834002A (en) * 2022-11-16 2023-03-21 江苏为是科技有限公司 High-speed transmission system and method
CN116303173A (en) * 2023-05-19 2023-06-23 深圳云豹智能有限公司 Method, device, system and chip for reducing RDMA engine on-chip cache
CN118301100A (en) * 2024-04-24 2024-07-05 深圳云豹智能有限公司 Message reordering method, device, chip, equipment, storage medium and program product

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111711566A (en) * 2020-07-03 2020-09-25 西安电子科技大学 Receiver out-of-order rearrangement method in multi-path routing scenario
US20220014468A1 (en) * 2020-07-13 2022-01-13 Google Llc Content Addressable Memory (CAM) Based Hardware Architecture For Datacenter Networking
CN115834002A (en) * 2022-11-16 2023-03-21 江苏为是科技有限公司 High-speed transmission system and method
CN116303173A (en) * 2023-05-19 2023-06-23 深圳云豹智能有限公司 Method, device, system and chip for reducing RDMA engine on-chip cache
CN118301100A (en) * 2024-04-24 2024-07-05 深圳云豹智能有限公司 Message reordering method, device, chip, equipment, storage medium and program product

Also Published As

Publication number Publication date
CN118301100A (en) 2024-07-05

Similar Documents

Publication Publication Date Title
US7930422B2 (en) Apparatus and method for supporting memory management in an offload of network protocol processing
US7533176B2 (en) Method for supporting connection establishment in an offload of network protocol processing
US7493427B2 (en) Apparatus and method for supporting received data processing in an offload of network protocol processing
JP3777161B2 (en) Efficient processing of multicast transmission
CN104821887B (en) The device and method of processing are grouped by the memory with different delays
US9954771B1 (en) Packet distribution with prefetch in a parallel processing network device
JP2002541732A (en) Automatic service adjustment detection method for bulk data transfer
WO2001005123A1 (en) Apparatus and method to minimize incoming data loss
US7469295B1 (en) Modified round robin load balancing technique based on IP identifier
CN116471242A (en) RDMA-based transmitting end, RDMA-based receiving end, data transmission system and data transmission method
TW201528142A (en) Internal/external access after processor unit with multi-core processor
WO2025223244A1 (en) Packet reordering method and apparatus, and chip, device, storage medium and program product
TW202236104A (en) Message communication between integrated computing devices
US7603539B2 (en) Systems and methods for multi-frame control blocks
US20240323133A1 (en) Systems and methods of packet sequencing
US20250150396A1 (en) Load balancing for weighted equal cost multi-path (ecmp)
CN120710642A (en) Message retransmission method, device and chip
CN117880197A (en) Convergence for congestion management
WO2025222848A1 (en) Data communication method and related device
WO2024140068A2 (en) Message transmission method and system, and network apparatus
CN121058007A (en) Systems, methods and related apparatus for processing transaction flows
CN121217677A (en) A method and apparatus for transmitting RDMA messages
CN117891626A (en) Remote direct data access method and related equipment

Legal Events

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

Ref document number: 25793441

Country of ref document: EP

Kind code of ref document: A1