A method for reordering messages and an electronic device

By dividing the on-chip shared storage space into storage blocks and utilizing a global free pointer pool, bitmaps, and pointer arrays, the problems of low storage resource utilization and high out-of-order reassembly latency in message transmission in multi-node computing power clusters are solved, achieving efficient out-of-order reassembly and deterministic data delivery.

CN123123302APending Publication Date: 2026-11-17WUHAN LINGJIU MICROELECTRONICS CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611621954.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-20
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

In large-scale model training and distributed artificial intelligence computing, message transmission between multi-node computing power clusters suffers from problems such as low storage resource utilization, high latency in out-of-order reordering processing, and difficulty in guaranteeing the determinism of the receiving path.

Method used

The on-chip shared storage space is divided into multiple storage blocks, and unified scheduling is achieved through a global free pointer pool. Bitmaps and pointer arrays are configured, and relative offsets are used for message storage and status recording to realize batch extraction and direct data transmission.

Benefits of technology

It improves the utilization rate of storage resources, shortens the processing latency of out-of-order reordering, and ensures determinism of the receiving path and efficient data delivery.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123123302A_ABST
    Figure CN123123302A_ABST
Patent Text Reader

Abstract

This application relates to a message reordering method and electronic device. The method includes: dividing the on-chip shared storage space into multiple storage blocks; storing the physical pointers of each storage block into a global free pointer pool; and configuring a bitmap, pointer array, and expected sequence number for each logical queue; obtaining the logical queue identifier and received sequence number of the message; determining the relative offset based on the received sequence number and the expected sequence number; using the relative offset as an index, storing the message payload into the storage block indicated by the physical pointer popped from the global free pointer pool; writing the physical pointer into the pointer array; and setting the bit corresponding to the relative offset in the bitmap; detecting the number of consecutively set bits from the start bit in the bitmap; batch extracting a number of physical pointers to trigger direct data placement and transmission; and incrementing the expected sequence number by a number of bits. This technical solution can improve storage utilization and shorten reordering latency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of network communication technology, and in particular to a method for message reordering and an electronic device. Background Technology

[0002] In large model training and distributed artificial intelligence computing, lossless data streams with ultra-high bandwidth and extremely low latency need to be transmitted between multi-node computing power clusters. In order to balance the load on multiple equivalent paths, the sending side often distributes the messages of the same data stream, thus disrupting the order in which the messages arrive at the receiving side.

[0003] To restore the order of messages, the receiving side typically allocates a fixed on-chip storage space for each logical connection and links the messages in a hardware linked list. The hardware state machine reads and compares the sequence numbers from the head of the linked list, locates the insertion interval, and then rewrites the pointers of adjacent nodes. Another improved method is to use a bitmap to record the arrival status of the message corresponding to each sequence number, replacing the linked list with a bitmap.

[0004] The common limitations of the above methods are: storage space and logical connections are always fixedly bound; space unused by one logical connection cannot be used by other logical connections; when a micro-burst occurs in an individual logical connection, its buffer is quickly filled, while the space corresponding to logical connections not participating in communication remains idle for a long time; the bitmap only records the arrival status, and the write position of the payload is not separated from the logical order. Furthermore, the writing of the payload and the recording of the status, as well as the extraction and delivery of continuous messages, all require hardware state machines to compare or scan bit by bit, which takes multiple clock cycles. Therefore, in high-speed line-rate packet reception scenarios, the utilization rate of on-chip storage resources is reduced, the processing latency of out-of-order reassembly becomes difficult to control as the out-of-order depth increases, and the determinism of the receiving path is difficult to guarantee. Summary of the Invention

[0005] This application provides a message reordering method and electronic device to at least partially solve the above-mentioned technical problems.

[0006] To achieve the above objectives, according to a first aspect of this application, a method for message reordering is provided, comprising: The on-chip shared memory space is divided into multiple memory blocks, the physical pointers of each memory block are stored in the global free pointer pool, and bitmaps, pointer arrays and expected sequence numbers are configured for each logical queue; Obtain the logical queue identifier and receive sequence number of the message, and determine the relative offset based on the receive sequence number and the expected sequence number; Using the relative offset as an index, the payload of the message is stored in the storage block indicated by the physical pointer popped from the global free pointer pool, the physical pointer is written into the pointer array, and the bit corresponding to the relative offset in the bitmap is set. The number of consecutive bits set from the start bit in the bitmap is detected, and the number of physical pointers of the bitmap are extracted in batches to trigger direct data placement and transmission, and the expected sequence number is incremented by the number of bits.

[0007] In some embodiments, configuring bitmaps, pointer arrays, and expected sequence numbers for each logical queue includes: Context entries are allocated for each of the logical queues in the context memory. The context entries are used to store the bitmap, the pointer array, the expected sequence number, and the count of used storage blocks. Set the safeguard water level and the shared cutoff water level in each of the aforementioned context entries; The guaranteed water level is used to indicate the amount of storage that the logical queue is guaranteed, and the shared cutoff water level is used to indicate the upper limit of the storage that the logical queue can occupy.

[0008] In some embodiments, the message reordering method further includes: The context table entry of the logical queue is read according to the logical queue identifier to obtain the used storage block count and the shared truncation waterline of the logical queue; Compare the used storage block count with the shared cutoff waterline, and compare the remaining amount in the global free pointer pool with the critical threshold; When the count of used storage blocks is less than or equal to the shared cutoff water level and the remaining amount is greater than the critical threshold, the message is determined to have passed the admission decision.

[0009] In some embodiments, the message reordering method further includes: When the count of used storage blocks is greater than the shared cutoff water level, or the remaining amount is less than or equal to the critical threshold, the congestion cutoff flag is set, and the admission decision of subsequent packets is blocked. During the admission decision for intercepting subsequent packets, the request for physical pointers from the global free pointer pool is stopped, and subsequent packets are discarded before reception. Backpressure signaling is generated at the physical layer and sent to the source end along the physical link, wherein the backpressure signaling includes at least one of priority flow control pause frames and explicit congestion notification messages.

[0010] In some embodiments, the message reordering method further includes: During the period when the congestion truncation flag is set, the count of used storage blocks in the logical queue is monitored; When the number of used storage blocks is less than or equal to the shared cutoff water level, the congestion cutoff flag is cleared. After the congestion truncation flag is cleared, the direct data placement transmission is triggered to output the payload already stored in the on-chip shared storage space.

[0011] In some embodiments, the steps of storing the packet payload into the storage block indicated by the physical pointer popped from the global free pointer pool using the relative offset as an index, writing the physical pointer into the pointer array, and setting the bit corresponding to the relative offset in the bitmap include: The relative offset is used as the physical address line for the pointer array and the bitmap; The storage of the payload, the writing of the pointer array, and the setting of the bitmap are performed in parallel on the rising edge of the same clock cycle, so as to decouple the physical storage location of the payload in the on-chip shared memory space from the logical order of the message.

[0012] In some embodiments, the parallel execution of storing the payload, writing to the pointer array, and setting the bitmap on the rising edge of the same clock cycle includes: Pop a physical pointer from the global free pointer pool and write the payload of the message into the storage block indicated by the physical pointer; The physical pointer is passed through and written to the index bit of the pointer array at the relative offset; The bit of the bitmap is set to the relative offset, wherein the index bits of the pointer array correspond one-to-one with the bits of the bitmap according to the relative offset.

[0013] In some embodiments, detecting the number of bits that are continuously set from the start bit in the bitmap and extracting the physical pointers of the number of bits in batches includes: When the bit in the bitmap changes from zero to one, the number of consecutive bits set from the start bit in the bitmap is determined within a single gate delay by a preamble detector. The bitmap and the pointer array are logically shifted to the right by the number of bits using a barrel shifter; The number of physical pointers starting from the start bit in the pointer array are extracted in parallel.

[0014] In some embodiments, the parallel extraction of the number of physical pointers starting from the start bit in the pointer array further includes: The aforementioned number of physical pointers are packaged and pushed to the direct memory access command queue to trigger the zero-copy direct data placement transmission; After the payload in the storage block indicated by the number of physical pointers is read out, the number of physical pointers is pushed back to the global free pointer pool.

[0015] In a second aspect, an electronic device is provided, comprising: at least one processing device; and a memory communicatively connected to the at least one processing device; wherein the memory stores instructions executable by the at least one processing device to enable the at least one processing device to implement the method described above.

[0016] The message reordering method in this embodiment divides the on-chip shared storage space into storage blocks and assigns them to a global free pointer pool for unified scheduling. Any logical queue can use a free storage block as needed, and storage resources are no longer fixed to a specific logical queue. When a sudden surge in traffic occurs in a particular logical queue, storage blocks that are temporarily unused by other logical queues can be directly borrowed, thus improving the utilization rate of storage resources. Furthermore, after a message arrives, its position in the pointer array and bitmap only needs to be determined based on the relative offset. The writing of the payload and the recording of the status do not need to go through step-by-step comparisons or traversals, and the processing time for reordering the packet reception path does not increase with the out-of-order depth. After messages with consecutive sequence numbers arrive one after another, multiple payloads can be extracted in batches and delivered in order in a single action, thereby shortening the end-to-end reordering delay.

[0017] Other features and advantages of this application will be described in detail in the following detailed description section. Attached Figure Description

[0018] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0019] Figure 1 This is a flowchart of a message reordering method provided in one embodiment of this application; Figure 2 This is a structural block diagram of a network device provided in one embodiment of this application; Figure 3 This is a schematic diagram illustrating the mapping principle between a bitmap and a pointer array provided in one embodiment of this application; Figure 4 This is a schematic diagram illustrating the principle of continuous position detection and batch extraction provided in one embodiment of this application; Figure 5 This is a schematic diagram of the state transition for water level monitoring and congestion truncation provided in one embodiment of this application; Figure 6 This is a structural block diagram of an electronic device provided in one embodiment of this application. Detailed Implementation

[0020] 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 a part of the embodiments of this application, and not all of them. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the protection scope of this application.

[0021] In the description of this application, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more features. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.

[0022] According to a first aspect of this application, this application provides a method for reordering messages, comprising the following steps: Step 100: Divide the on-chip shared storage space into multiple storage blocks, store the physical pointers of each storage block into the global free pointer pool, and configure bitmaps, pointer arrays and expected sequence numbers for each logical queue.

[0023] Specifically, upon power-on or during underlying firmware initialization, the network device's internal management microkernel can evenly divide the large-capacity shared on-chip storage space into multiple storage blocks of equal size, and sequentially push the physical base addresses of all available storage blocks into a global free pointer pool as physical pointers. Here, a physical pointer refers to the physical base address of a storage block within the on-chip shared storage space; one physical pointer corresponds to one storage block. The network device uses the popping and pushing of physical pointers to indicate the borrowing and returning of storage blocks. It can be understood that the aforementioned physical base address is used both as the write address of the storage block and as the record content of the pointer array, and both are the same value. Optionally, the global free pointer pool can be implemented as a First-In-First-Out (FIFO) queue or other depth-addressed free pointer manager; this application does not limit this implementation.

[0024] Specifically, each logical queue pair is configured with a bitmap, a pointer array, and an expected sequence number. Each bit in the bitmap corresponds to a sequence number in the logical queue, and the bit level indicates whether the message corresponding to that sequence number has arrived. Each index bit in the pointer array corresponds to a sequence number in the logical queue, and the index bit stores a physical pointer to the storage block where the message payload corresponding to that sequence number is located. The expected sequence number refers to the sequence number of the message that the logical queue is currently expecting to receive. The bits in the bitmap and the index bits in the pointer array correspond one-to-one with the same sequence number. The bitmap is responsible for recording "which sequence numbers of messages have arrived," and the pointer array is responsible for recording "which storage block the arrived message payload is stored in." Together, they constitute the transmit and receive status of the logical queue.

[0025] Furthermore, the on-chip shared memory space can be on-chip static random access memory (SRAM) or other randomly accessible on-chip storage media; the memory blocks can be divided equally by the number of bytes, or equally by the sum of the maximum length of the message payload and fixed overhead. This application does not limit the specific size of the memory blocks or the encoding method of the physical pointers.

[0026] Step 200: Obtain the logical queue identifier and the receiving sequence number of the message, and determine the relative offset based on the receiving sequence number and the expected sequence number.

[0027] Specifically, after an Ethernet data frame enters the network device's receiving path via an external Ethernet interface, the hardware parsing engine extracts the logical queue identifier and receive sequence number of the packet within a single clock cycle in a pipelined manner. The logical queue identifier indicates the logical queue to which the packet belongs; it can be a number maintained internally by the logical connection within the network device. The receive sequence number is the packet's sequence number within its logical queue, carried by the sending side in the packet. Using the logical queue identifier as an index, the hardware parsing engine loads the expected sequence number of that logical queue from the context memory. Then, a subtractor circuit calculates the difference between the received sequence number and the expected sequence number, using this difference as the relative offset. The relative offset represents the number of sequence numbers between the current packet and the packet currently expected by the logical queue. Different packets within the same logical queue have different relative offsets, thus it can be directly used as an index for subsequent addressing.

[0028] In some embodiments, the method for determining the relative offset is not limited to the difference method described above. For example, the network device may also load a reference sequence number simultaneously with the expected sequence number, and calculate the relative offset by the difference between the received sequence number and the reference sequence number, combined with the distance between the reference sequence number and the expected sequence number; or, for example, the distance between the received sequence number and the expected sequence number may be provided by a parallel comparison circuit without a subtractor. This application does not limit the specific method for obtaining the relative offset.

[0029] Step 300: Using the relative offset as an index, store the payload of the message into the storage block indicated by the physical pointer popped from the global free pointer pool, write the physical pointer into the pointer array, and set the bit corresponding to the relative offset in the bitmap.

[0030] Specifically, the hardware mapping addressing module pops a physical pointer from the global free pointer pool and writes the packet payload into the storage block indicated by the physical pointer. Furthermore, the hardware mapping addressing module writes the physical pointer into the index bit of the pointer array at the relative offset, thereby establishing the correspondence between the sequence number and the storage block. Additionally, the hardware mapping addressing module sets the bit at the relative offset of the bitmap to mark that the packet corresponding to the sequence number has arrived. All three actions use the same relative offset to determine their respective positions, thus establishing a correspondence between the storage location of the packet payload, the recording position of the pointer array, and the setting position of the bitmap, eliminating the need for further conversion or comparison between the three.

[0031] Furthermore, since the write location of the payload is determined by the physical pointer popped from the global free pointer pool on the spot, the physical storage location of a message in the on-chip shared memory space is no longer bound to its logical order in the logical queue. In other words, physically adjacent memory blocks can carry messages with non-adjacent sequence numbers, and messages with adjacent sequence numbers do not need to be stored physically adjacent; the logical order of the messages is recorded only by the bitmap and pointer array. Therefore, memory blocks can freely circulate between logical queues and are no longer exclusively occupied by any one logical queue.

[0032] Within the on-chip shared memory space, storage blocks belonging to different logical queues can coexist. For example, the storage block with physical base address 0x1000 stores packets from logical queue number 2, the storage block with physical base address 0x2400 stores packets from logical queue number 5, and the storage block with physical base address 0x9B00 is a free storage block. It is evident that the same shared memory space is not divided into fixed intervals corresponding one-to-one with logical queues; the packet payload of any logical queue can fall into any free storage block within the on-chip shared memory space. This is precisely the physical layout manifestation of the aforementioned decoupling.

[0033] Optionally, in addition to the message payload, a small amount of auxiliary information, such as the receiving timestamp or verification information, can be written into the storage block pointed to by the physical pointer popped from the global free pointer pool. This application does not limit this.

[0034] Step 400: Detect the number of bits that are continuously set from the start bit in the bitmap, extract the number of physical pointers of the number of bits in batch to trigger direct data placement and transmission, and increment the expected sequence number by the number of bits.

[0035] Specifically, bits that are consecutively set starting from the start bit in the bitmap indicate that several consecutive sequence numbers of messages have arrived in the logical queue from the current expected sequence number, and the payloads of these messages can now be delivered in sequence. The continuity detection circuit detects the number of consecutively set bits starting from the start bit, extracts a corresponding number of physical pointers from the pointer array according to this number of bits, and pushes these physical pointers together to trigger direct data placement transmission, thereby delivering multiple consecutive message payloads at once. Subsequently, the network device adds this number of bits to the expected sequence number, causing the expected sequence number to move forward to the smallest sequence number that has not yet arrived.

[0036] It should be noted that the starting bit of the bitmap described in this application refers to the bit in the bitmap corresponding to the current expected sequence number, that is, the zeroth bit of the bitmap, which is the end of the bitmap aligned with the current sequence number to be delivered. After each batch extraction is completed, the bitmap and pointer array shift forward relative to the starting bit, and the starting bit still corresponds to the updated expected sequence number. It can be understood that the sequence numbers corresponding to the bits in the bitmap before the starting bit have all been delivered, and their contents can be reset or overwritten before the next bit setting.

[0037] Specifically, the aforementioned direct data placement transmission refers to the network device directly writing the payload stored in the storage block to the target storage area on the host side via the memory access transmission engine, according to the logically consecutive physical pointers, without the host side needing to first receive out-of-order packets and then rearrange and reassemble them. Since the physical pointers are already arranged in logical order, the payload only needs to be moved once from the on-chip shared storage space to the target storage area on the host side, without needing to be copied again through an intermediate buffer, thus reducing the polling overhead on the bus. It can be understood that the target storage area can be the host's system memory or the graphics processor's video memory; the target storage area for direct data placement transmission can be pre-informed to the network device by the host side using a descriptor, and this application does not limit its specific form or method of notification.

[0038] The message reordering method in this embodiment divides the on-chip shared storage space into storage blocks and assigns them to a global free pointer pool for unified scheduling. Any logical queue can use a free storage block as needed, and storage resources are no longer fixed to a specific logical queue. When a sudden surge in traffic occurs in a particular logical queue, storage blocks that are temporarily unused by other logical queues can be directly borrowed, thus improving the utilization rate of storage resources. Furthermore, after a message arrives, its position in the pointer array and bitmap only needs to be determined based on the relative offset. The writing of the payload and the recording of the status do not need to go through step-by-step comparisons or traversals, and the processing time for reordering the packet reception path does not increase with the out-of-order depth. After messages with consecutive sequence numbers arrive one after another, multiple payloads can be extracted in batches and delivered in order in a single action, thereby shortening the end-to-end reordering delay.

[0039] In an optional embodiment of this application, configuring bitmaps, pointer arrays, and expected sequence numbers for each logical queue includes: Step 101: Allocate context entries for each of the logical queues in the context memory. The context entries are used to store the bitmap, the pointer array, the expected sequence number, and the count of used storage blocks.

[0040] Specifically, the context memory and the on-chip shared memory are independent of each other. Addressed by logical queue identifiers, it can be implemented using a register array or on-chip random access memory. During initialization, the network device allocates a context entry for each logical queue. The number of entries is comparable to the number of logical queues the network device supports for concurrent processing, reaching tens of thousands. Bitmaps, pointer arrays, expected sequence numbers, and used memory block counts are stored in the same context entry. Subsequent steps read in-situ using the logical queue identifier as an index, without needing to access the on-chip shared memory again. Therefore, the read operation can be completed within one clock cycle.

[0041] In this embodiment, the used storage block count is used to record the number of storage blocks currently occupied by the logical queue. During message reception, the used storage block count of the logical queue is incremented by one for each physical pointer popped from the global free pointer pool by the network device; and decremented by one for each physical pointer pushed back into the global free pointer pool. Therefore, the used storage block count is directly proportional to the size of the on-chip shared storage space currently occupied by the logical queue, and can be directly compared with the water level set in step 102 in units of storage blocks, without the need for unit conversion before comparison.

[0042] Step 102: Set a guaranteed water level and a shared cutoff water level in each of the context entries; wherein, the guaranteed water level is used to indicate the amount of storage that the logical queue is guaranteed, and the shared cutoff water level is used to indicate the upper limit of the amount of storage that the logical queue can occupy.

[0043] Specifically, as long as the used storage block count of a logical queue is not higher than the guaranteed water level, its packets will not be overwhelmed by burst traffic from other logical queues, thus limiting the transmission latency of that logical queue to a controllable range. The shared truncation water level is higher than the guaranteed water level, and the difference between the two represents the portion that the logical queue can flexibly borrow when on-chip storage resources are plentiful, and needs to relinquish when resources are scarce. Optionally, the above two water levels can be set once during initialization, or they can be dynamically calculated by the water level monitoring module based on the remaining amount of the global free pointer pool during the receiving process. For example, when the remaining amount is sufficient, the shared truncation water level can be appropriately increased to absorb larger burst traffic, and when the remaining amount is scarce, it can be appropriately decreased to accelerate release. This application does not limit the specific values ​​and adjustment methods of the water levels.

[0044] The message reordering method in this embodiment stores the send / receive status and occupancy measurement of logical queues in a context table entry that can be directly addressed by the logical queue identifier. The bitmap, pointer array, expected sequence number, and used storage block count are obtained in a single read, so the message receiving path does not need to access the shared storage space separately to obtain this information. At the same time, the protection waterline and the shared truncation waterline describe the "protected storage amount" and the "elastically borrowable storage amount" separately, so that the occupancy relationship of multiple logical queues on the same shared storage space can be clearly defined in the initialization stage, providing an unambiguous comparison benchmark for subsequent admission determination.

[0045] In an optional embodiment of this application, the method further includes steps 500 to 502 described below, and performs steps 503 to 505 described later (see Appendix) if the admission decision fails. Figure 1 (As shown), after the admission decision is passed, step 300 is executed; steps 506 to 508, described below, are executed after the congestion truncation flag is set: Step 500: Read the context table entry of the logical queue according to the logical queue identifier to obtain the used storage block count and the shared truncation waterline of the logical queue.

[0046] In this embodiment, the hardware parsing engine accesses the context memory using the logical queue identifier as an index, and reads the used storage block count and shared truncation watermark of the logical queue to which the packet belongs. The above reading and the loading of the expected sequence number in step 200 can share the same context memory access, or they can be completed in the same pipeline cycle. This application does not limit this.

[0047] Step 501: Compare the used storage block count with the shared cutoff waterline, and compare the remaining amount of the global free pointer pool with the critical threshold.

[0048] Specifically, the remaining amount in the global free pointer pool can be maintained by a hardware accumulator in the water level monitoring module: each time a physical pointer is popped from the pool, the remaining amount is decremented by one; each time a physical pointer is pushed back into the pool, the remaining amount is incremented by one. The critical threshold is the lower limit of the remaining amount in the global free pointer pool. Its meaning is that when the remaining amount drops to this lower limit, the on-chip shared memory space is nearly exhausted. If not restricted, the next borrowing of any logical queue may fail, thus affecting all logical queues. Optionally, the critical threshold can be a fixed value, or it can be adjusted according to the line speed of the receiving path or the number of established logical queues. This application does not limit its value selection method.

[0049] Reference Figure 5 As shown on the left, the above comparison can be performed in parallel by several hardware comparison circuits: the used memory block count and the shared truncation water level are compared by one comparison circuit, and the remaining amount of the global free pointer pool and the critical threshold are compared by another comparison circuit; the results of the two comparisons are sent to the hardware admission decision and backpressure triggering logic in the water level monitoring module, which outputs the admission decision result, or triggers the setting of the congestion truncation flag and backpressure signaling when either comparison fails.

[0050] Step 502: When the count of used storage blocks is less than or equal to the shared cutoff water level and the remaining amount is greater than the critical threshold, the message is determined to have passed the admission decision.

[0051] It is understandable that if both comparisons are true simultaneously, it indicates that the storage occupied by the logical queue has not yet reached its own allowed limit, and there is still a surplus of shared on-chip storage space. Therefore, the current message can be normally received and enter the storage and status recording process in step 300. The above reading, comparison, and determination are completed by hardware comparison circuits and gate circuits. The determination result directly participates in enabling subsequent actions in the form of a level signal. The entire process ends within a single clock cycle, without the need for main processor intervention or software polling.

[0052] The message reordering method in this embodiment incorporates the occupancy rate of each logical queue, its own occupancy limit, and the remaining amount and critical threshold of global free storage resources into the decision criteria. Whether a message can be accepted is determined by two independent conditions: the former constrains a single logical queue from unrestrainedly occupying shared storage space, and the latter constrains the overall free resources from being exhausted. Accordingly, a burst of traffic from any logical queue will not both fill its own quota and deplete global free resources, thus maintaining the storage space and transmission latency obtained by other logical queues.

[0053] Reference Figure 1 As shown, in an optional embodiment of this application, the method further includes: Step 503: When the count of used storage blocks is greater than the shared cutoff water level, or the remaining amount is less than or equal to the critical threshold, set the congestion cutoff flag and block the admission decision of subsequent packets.

[0054] Step 504: During the admission decision for intercepting subsequent packets, stop requesting physical pointers from the global free pointer pool and discard subsequent packets before reception.

[0055] Step 505: Generate backpressure signaling at the physical layer and send it to the source end along the physical link, wherein the backpressure signaling includes at least one of priority flow control pause frames and explicit congestion notification messages.

[0056] Specifically, the congestion truncation flag can be a bit in a context table entry or a global register bit within the network device. Setting this flag indicates that packets in the logical queue have been determined to be unacceptable. After this flag is set, although the receive path will still parse the logical queue identifier and receive sequence number of subsequent packets, it will no longer output a valid determination result, and subsequent packets will be determined to be unacceptable. At the same time, the network device stops requesting physical pointers from the global free pointer pool, that is, it bypasses the pointer fetching path in the hardware mapping addressing module, so that the logical queue that has exceeded its limit can no longer borrow new storage blocks.

[0057] The intercepted subsequent packets are immediately discarded at the receiving stage, that is, they are discarded before entering the on-chip shared storage space, so they will not occupy any storage blocks and will not leave any records in the pointer array and bitmap. Optionally, the network device can also use a packet loss statistics counter to count and accumulate the number of packets dropped each time, so that the operation and maintenance side can grasp the packet loss scale during backpressure. This application does not limit this.

[0058] Understandably, the physical layer of the network device then generates backpressure signaling and sends it along the physical link to the source. Backpressure signaling can be a Priority Flow Control (PFC) pause frame, used by the downstream node to request the upstream switch to pause sending data frames of a specified priority to this port; or it can be an Explicit Congestion Notification (ECN) message, used to inform the source of the local congestion status, causing the source to proactively reduce its transmission rate. Either of these signaling methods can be used, or they can be used simultaneously. Thus, a closed loop is formed between the real-time level of the on-chip shared storage space and the backpressure control of the external network. Backpressure does not need to be forwarded through host-side software, shortening the round-trip time for congestion feedback.

[0059] The message reordering method in this embodiment interrupts three actions simultaneously when on-chip storage resources exceed their limits: it stops allowing subsequent messages in the logical queue, stops borrowing new storage blocks for it, and sends a backpressure signaling to the source. The combined effect of these three actions causes the occupied size of the logical queue to immediately stop growing after exceeding the limit. The occupied storage blocks are gradually returned as the payload is read out, preventing a sudden, malicious outbreak in an individual logical queue from escalating into the exhaustion of the entire shared storage space. Other normally communicating logical queues can still maintain stable transmission latency within the storage capacity corresponding to the guaranteed waterline.

[0060] In an optional embodiment of this application, the method further includes: Step 506: During the congestion truncation flag being set, monitor the count of used storage blocks in the logical queue.

[0061] Step 507: When the number of used storage blocks is less than or equal to the shared cutoff waterline, clear the congestion cutoff flag.

[0062] Step 508: After the congestion truncation flag is cleared, the direct data placement transmission is triggered again to output the payload already stored in the on-chip shared storage space.

[0063] Specifically, after the backpressure takes effect, the source reduces its transmission rate. Packets already arriving within the network device continue to be extracted in batches and delivered to the host side following the aforementioned steps. The corresponding physical pointers are pushed back into the global free pointer pool, and the used storage block count of this logical queue gradually decreases. The network device's hardware monitoring logic continuously reads this count. Once it falls below the shared truncation watermark, the congestion truncation flag is automatically cleared, and the receiving path returns to normal reception without software intervention or waiting for a fixed silence period.

[0064] Furthermore, after the congestion truncation flag is cleared, the network device continues to output the payloads already stored in the on-chip shared storage space in logical order until all these temporarily stored payloads have been read out. It can be understood that packets discarded during backpressure leave gaps at their corresponding sequence numbers. After retransmission at the source, the aforementioned steps will continue to set the bits at these sequence numbers, restoring the bitmap to continuity from the start bit, thus returning the logical queue to a complete sequential delivery state.

[0065] The packet reordering method in this embodiment uses the congestion truncation flag's clearing condition directly from the used storage block count of the logical queue, rather than from whether a packet has re-arrived or whether the timeout count has expired. Therefore, the release of backpressure strictly corresponds to the actual released storage space: packets will not be prematurely released before the storage space is released, and the blocking will not be unnecessarily prolonged when the storage space is released below the waterline. During the backpressure period, the payload temporarily stored in the on-chip shared storage space is still continuously delivered. After the logical queue recovers, it is not necessary to re-collect all the data from this period, and the retransmission scope is limited to those dropped packets.

[0066] Reference Figure 5 As shown on the right, in an optional embodiment of this application, the above-mentioned admission decision and the setting and clearing of the congestion truncation flag can be implemented by a dynamic water level control state machine in the network device; the state machine transitions between the following three states based on the positional relationship between the used storage block count of the logical queue and the guaranteed water level and the shared truncation water level: When in the exclusive protection zone, if the number of used storage blocks is less than the protection water level, the storage demand of the logical queue is completely within its protected storage capacity, and the burst traffic of other logical queues must not occupy this part of the storage capacity.

[0067] When in the elastic shared borrowing zone, if the used storage block count is not less than the guaranteed waterline and less than the shared cutoff waterline, it indicates that the occupancy of the logical queue above the guaranteed waterline is part of the elastic borrowing from shared storage resources. When shared storage resources are plentiful, this part of the occupancy is allowed to continue to grow; when resources are scarce, this part of the occupancy needs to be relinquished. When the logical queue experiences a backlog due to out-of-order packets, causing the used storage block count to continue to grow above the guaranteed waterline, the state machine moves from the exclusive guaranteed zone to the elastic shared borrowing zone.

[0068] When in the hardware-active truncation defense state, if the count of used storage blocks is not less than the shared truncation waterline, or the remaining amount in the global free pointer pool is lower than the critical threshold, the aforementioned interception and backpressure process is triggered. When the logical queue releases storage blocks due to the filling of sequence number gaps and the continuous read load of the memory access transmission engine, causing the count of used storage blocks to fall back to an area not less than the protection waterline and less than the shared truncation waterline, the state machine returns to the elastic shared borrowing area; when the count of used storage blocks further falls below the protection waterline, the state machine returns to the exclusive protection area.

[0069] Reference Figure 3 As shown, in an optional embodiment of this application, the steps of storing the payload of the message into the storage block indicated by the physical pointer popped from the global free pointer pool using the relative offset as an index, writing the physical pointer into the pointer array, and setting the bit corresponding to the relative offset in the bitmap include: Step 301: Use the relative offset as the physical address line of the pointer array and the bitmap.

[0070] Specifically, both the pointer array and the bitmap are implemented using register arrays. Their respective address decoding lines are directly driven by relative offsets, with each bit of the relative offset corresponding to a bit of the address line. Therefore, the relative offsets can locate the i-th relative offset index bit of the pointer array and the i-th relative offset bit bit of the bitmap without any arithmetic transformations. The index determination process does not involve comparing with the arrived sequence numbers one by one, nor does it involve searching the insertion interval. Optionally, the relative offsets can also be decoded at one stage or extended in bit width before being connected to the address lines, as long as the index bits and bits maintain a one-to-one correspondence according to the relative offsets. This application does not impose any limitations on this.

[0071] Step 302: Storing the payload, writing to the pointer array, and setting the bitmap are performed in parallel on the rising edge of the same clock cycle, so as to decouple the physical storage location of the payload in the on-chip shared memory space from the logical order of the message.

[0072] In this embodiment, the three actions share the same relative offset and the same physical pointer, and take effect simultaneously on the rising edge of the same clock cycle: the payload is written to the memory block, the physical pointer is written to the corresponding index bit of the pointer array, and the corresponding bit bit of the bitmap is set. Since the three actions are completed within the same clock cycle, the collection of out-of-order messages no longer requires traversing and locating the insertion interval and then rewriting the predecessor and successor pointers in the linked list node; payload storage and status recording can be completed simultaneously with a single memory access.

[0073] Furthermore, in this embodiment, decoupling means that the physical location of the payload in the on-chip shared storage space depends only on the physical pointer given by the global free pointer pool on the spot, and is independent of the order of the packets in the logical queue; physically adjacent storage blocks can carry packets with non-adjacent sequence numbers. This decoupling allows storage blocks to flow across logical queues, and also makes the packet writing path no longer dependent on any data structure ordered by sequence number.

[0074] The message reordering method in this embodiment uses relative offsets to directly drive the address lines of the pointer array and bitmap, compressing the action of "determining where the message should be recorded" into a single address decoding. Out-of-order insertion no longer requires a positioning step. The three actions also take effect in parallel within the same clock cycle, eliminating the sequential dependency between payload storage and status recording. Therefore, there is no window where two memory accesses conflict with each other, and the processing time between the arrival of the message and the completion of its status recording is shortened to one clock cycle.

[0075] In an optional embodiment of this application, the parallel execution of storing the payload, writing to the pointer array, and setting the bitmap on the rising edge of the same clock cycle includes: Step 3021: Pop a physical pointer from the global free pointer pool and write the payload of the message into the storage block indicated by the physical pointer.

[0076] Specifically, popping a physical pointer involves retrieving the physical base address of a free memory block from the head of the global free pointer pool. The physical pointer is then removed from the pool, and the remaining space in the global free pointer pool decreases by one unit. The retrieved physical pointer is not cached and is directly sent to the on-chip shared memory space as a write address. The packet payload is then written to the memory block starting at that address. For example, if the physical pointer popped from the global free pointer pool is 0x88A2, the packet payload will be written to the memory block with physical base address 0x88A2.

[0077] Step 3022: Pass-through the physical pointer into the index bit of the pointer array at the relative offset.

[0078] In this context, "pass-through" refers to the physical pointer being popped from the global free pointer pool and directly sent to the write data port of the pointer array without any buffering or transformation, using a relative offset as the write address. This establishes a definite correspondence between the index bit of the pointer array and the memory block indicated by the physical pointer, allowing the delivery of subsequent messages to directly retrieve the memory block containing the payload from this index bit. For example, if the relative offset is 3, then the physical pointer 0x88A2 is written to the 3rd index bit of the pointer array.

[0079] Step 3023: Set the bit of the bitmap to the relative offset position, wherein the index bits of the pointer array correspond one-to-one with the bits of the bitmap according to the relative offset.

[0080] Specifically, one-to-one correspondence means that the index bits of the pointer array and the bits of the bitmap are addressed by the same relative offset, and the two with the same sequence number correspond to the same sequence number. Therefore, if a bit in the bitmap is set, it means that the physical pointer to the message payload corresponding to that sequence number is already stored in the same index bit of the pointer array; conversely, if a bit in the bitmap is kept reset, it means that the message corresponding to that sequence number has not yet arrived, and the content of the corresponding index bit in its pointer array is not yet meaningful. Optionally, the delivered bits and index bits can also be reset or overwritten after the messages are extracted in batches, and this application does not limit this.

[0081] The message reordering method in this application arranges the retrieval of free storage blocks, the writing of logical pointer records, and the setting of arrival status flags as three parallel actions within the same clock cycle. The three actions only use one relative offset and one physical pointer, and there are no intermediate states that need to be sequentially advanced. The bitmap and pointer array correspond one-to-one according to the relative offset, so that the two types of information, "which messages have arrived" and "where the arrived messages are stored", are always synchronized. At any time, there will be no inconsistency where one side has been updated while the other side has not been updated.

[0082] Reference Figure 4 As shown, in an optional embodiment of this application, detecting the number of bits consecutively set from the start bit in the bitmap and batch extracting the physical pointers of the number of bits includes: Step 401: When the bit from the start bit in the bitmap changes from zero to one, the number of bits that are continuously set from the start bit in the bitmap is determined within a single gate delay by a preamble detector.

[0083] Specifically, when the bit at the start position of the bitmap changes from zero to one, it indicates that the message corresponding to the currently expected sequence number has arrived, meaning the sequence number gap caused by late messages has been filled. The number of consecutive high bits in the bitmap starting from the start position at this time represents the number of messages that can be delivered in sequence. The Leading One Detector is a set of combinational logic circuits hardwired to the output of the bitmap. Its output is established instantaneously with changes in the bitmap output, progressing bit by bit without relying on clock ticks, thus providing the number of bits within a single gate delay. Optionally, the Leading One Detector can also be replaced with other combinational logic circuits that can output the number of consecutive valid bits starting from a specified position; this application does not limit this.

[0084] Step 402: Shift the bitmap and the pointer array to the right by the number of bits using a barrel shifter.

[0085] The barrel shifter performs a rightward logical shift of the same number of bits on both the bitmap and the pointer array within the same clock cycle, shifting both forward by that number of bits towards the start bit. After the shift, the start bit of the bitmap re-corresponds to the smallest sequence number yet to be reached, and the pointer array stores physical pointers to undelivered messages starting from the start bit. Because the bitmap and pointer array shift synchronously, their one-to-one correspondence is maintained after the shift. It can be understood that the shift can also be equivalently implemented by shifting the read reference of both the bitmap and the pointer array forward by that number of bits; this application does not limit the implementation method.

[0086] Step 403: Extract the number of physical pointers from the pointer array starting from the starting bit in parallel.

[0087] Specifically, before the shift, the index bits of the pointer array starting from the start bit store the physical pointers of the message payloads delivered in sequence. The continuity detection circuit extracts the physical pointers stored in these index bits in parallel, thus obtaining this set of physical pointers simultaneously. Compared to bit-by-bit scanning, this step does not require a clock cycle for each physical pointer, and the extraction time is independent of the number of messages delivered in this operation.

[0088] The message reordering method in this application embodiment uses combinational logic circuits to directly provide the number of consecutively set bits from the bitmap output, and a barrel shifter to synchronously shift the bitmap and pointer array within one clock cycle. The continuity detection and index update steps do not depend on the clock tick and proceed bit by bit. Therefore, the extraction time is determined by the propagation delay of the circuit and does not increase linearly with the increase of the number of messages delivered this time. For a large number of messages arriving continuously at line speed, the processing time for sequential delivery remains stable.

[0089] Reference Figure 4 As shown, in an optional embodiment of this application, the parallel extraction of the number of physical pointers starting from the start bit in the pointer array further includes: Step 4031: Pack the number of physical pointers into a package and push it to the direct memory access command queue to trigger the zero-copy direct data placement transmission.

[0090] Specifically, packaging refers to assembling this set of physical pointers into a command description in sequence and writing it into the Direct Memory Access (DMA) command queue. The memory access transfer engine reads this command description, accesses the corresponding memory blocks in the on-chip shared memory space according to the physical pointers, and directly writes the payload stored therein to the target memory area on the host side via a single bus transfer. Since this set of physical pointers is already arranged in logical order, the order of the payload in the target memory area on the host side is also determined. The payload does not need to be reassembled inside the network device or in the host memory, hence it is a zero-copy operation.

[0091] Step 4032: After the payload in the storage block indicated by the number of physical pointers is read out, the number of physical pointers is pushed back to the global free pointer pool.

[0092] It's understandable that the pushback of the physical pointer is coordinated with the reading of the payload: only after the memory access transfer engine has read the payload from the storage block is the physical pointer corresponding to that storage block pushed back to the global free pointer pool. In this way, payloads that have been delivered but not yet read will not be overwritten by subsequent messages due to the reallocation of storage blocks. Simultaneously with the pushback of the physical pointer, the used storage block count of the logical queue decreases by that number of bits, and the remaining amount in the global free pointer pool increases accordingly.

[0093] In other embodiments, the physical pointer may be pushed back to the global free pointer pool after the memory access transfer engine reads it away, and the payload stored therein may be confirmed before the memory block is popped back. This application does not limit the specific time of pushing back the physical pointer, and any method of pushing back before the memory block is reallocated is within the protection scope of this application.

[0094] The message reordering method in this embodiment combines a batch of physical pointers arranged in logical order into a single command description for delivery, reducing the number of delivery actions from the number of messages to one. The memory access transmission engine does not need to poll or address packets one by one. At the same time, since the arrangement order in the host-side target storage area is given by the order of the physical pointers, the payload only needs to be moved once from the on-chip shared storage space to the host-side target storage area, without any intermediate assembly buffer, thus saving the polling overhead on the bus and the processing overhead on the host side.

[0095] The message reordering method provided in this application can be applied to network devices with on-chip shared storage resources, such as network interface controllers, smart network interface cards, switches, routers, or data processors. The above embodiments are all described using network devices as examples. (Refer to...) Figure 2As shown, after a message enters the network device via an external Ethernet interface, the network device is equipped with a hardware parsing engine, a subtractor circuit, a water level monitoring module, a hardware mapping addressing module, a continuity detection circuit, and a memory access transmission engine on the receiving path, as well as a context memory, an on-chip shared memory space, and a global free pointer pool. The context memory stores bitmaps, pointer arrays, expected sequence numbers, and used memory block counts for each logical queue. The on-chip shared memory space includes multiple storage blocks for storing the message payload. The global free pointer pool stores physical pointers to each of the storage blocks. The memory access transmission engine writes the payload to the target storage area on the host side. All of the above components are implemented by hardware circuits, and message parsing, storage, status recording, and relocation do not require main processor intervention. Optionally, the water level monitoring module also outputs congestion truncation and backpressure control when the admission decision fails. It is understood that this application does not limit the specific form of the network device; any network device with on-chip shared memory resources that needs to reassemble out-of-order messages on the receiving path can use the method provided in this application's embodiments.

[0096] In a specific application scenario, a network device (taking a smart NIC as an example) connects to a 400G Ethernet link, carrying a large amount of lossless network data streams generated by large-scale model aggregation communication. The on-chip shared memory space is divided into fixed-size storage blocks. All physical pointers are pushed into the global free pointer pool during initialization. The bitmaps and pointer arrays of each logical queue are cleared, the expected sequence numbers are set to their initial values, and the critical thresholds for the protection waterline, shared truncation waterline, and global free pointer pool are set to agreed-upon values. The congestion truncation flag is cleared.

[0097] Taking one of the logical queues as an example, its expected sequence number is 0x1000. A message with sequence number 0x1003 arrives first. The hardware parsing engine extracts the logical queue identifier and receive sequence number of this message within the first-level pipeline, loads the expected sequence number 0x1000, and calculates a relative offset of 3. The water level monitoring module reads the used memory block count and shared truncation water level of this logical queue, confirming that the occupancy is within limits and the remaining amount in the global free pointer pool is higher than the critical threshold, thus determining that the message passes the admission decision. The hardware mapping addressing module then drives the address line with a relative offset of 3, pops the physical pointer 0x88A2 from the global free pointer pool on the rising edge of the same clock cycle, writes the message payload into the memory block indicated by 0x88A2, passes the physical pointer 0x88A2 through to the third index bit of the pointer array, and sets the third bit of the bitmap; the above process is the single-cycle mapping between the bitmap and the pointer array.

[0098] Subsequently, messages with sequence numbers 0x1000, 0x1001, and 0x1002 arrive successively and fill the gaps, changing the number of consecutively set bits in the bitmap from the start bit to 4. A preamble detector provides this count within a single gate delay. A barrel shifter logically shifts the bitmap and pointer array 4 bits to the right within the same clock cycle. The four index bits of the pointer array from the start bit are extracted in parallel, resulting in four physical pointers. These four physical pointers are packaged and pushed to the direct memory access command queue. The memory access transfer engine writes the four message payloads directly to the host-side target memory area in this order, achieving zero-copy direct data placement and transmission. After the payloads are read, the four physical pointers are pushed back to the global free pointer pool, reducing the used memory block count of this logical queue by 4, and the expected sequence number is updated from 0x1000 to 0x1004.

[0099] If, during this process, the used storage block count of the logical queue exceeds the shared truncation watermark, or the remaining amount in the global free pointer pool falls below the critical threshold, the congestion truncation flag is set: subsequent packets to the logical queue are blocked, the pointer fetching path of the hardware mapping addressing module is bypassed, packets are discarded before reception, and the physical layer simultaneously sends priority flow control pause frames and explicit congestion notification messages to the upstream switch along the Ethernet physical link. During the backpressure period, payloads already stored in the on-chip shared storage space continue to be batched and delivered, physical pointers are returned as payloads are read out, and the used storage block count subsequently decreases; when the count falls to no greater than the shared truncation watermark, the congestion truncation flag is automatically cleared, the logical queue resumes normal reception, discarded packets are retransmitted from the source and the bitmap is refilled, and the logical queue returns to a complete sequential delivery state.

[0100] It is understood that the above-mentioned rate, sequence number, physical pointer and water level values ​​are only an exemplary illustration of the embodiments of this application, and this application does not limit the specific values ​​mentioned above; the number of logical queues and the size of storage blocks in the above example can also be adjusted according to the actual specifications of the network device.

[0101] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.

[0102] The embodiments, implementation methods, and related technical features of this application can be combined and substituted for each other without conflict.

[0103] According to a second aspect of this application, an electronic device is provided, comprising at least one processing device; and a memory communicatively connected to the at least one processing device; wherein the memory stores instructions executable by the at least one processing device, the instructions being executed by the at least one processing device to enable the at least one processing device to implement the method described in the above-described method embodiments and have all the beneficial effects of the above-described method, which will not be elaborated further in this application.

[0104] The aforementioned electronic device can be a network device from any of the foregoing embodiments. For example... Figure 6 As shown, the electronic device includes a processing unit 901 and a memory. The processing unit 901 may include one or more combinations of devices with data processing capabilities, such as a central processing unit (CPU), a graphics processing unit (GPU), a neural processing unit (NPU), a tensor processing unit (TPU), an application-specific integrated circuit (ASIC), and a field-programmable gate array (FPGA). The memory may include one or more combinations of a read-only memory (ROM) 902, a random access memory (RAM) 903, a storage section 908, and a removable medium 911. The processing unit 901 performs various appropriate actions and processes according to instructions stored in the memory to implement the methods described above. In some embodiments, the instructions are stored in the read-only memory 902 as a program, or loaded from the storage section 908 into the random access memory 903 as a program and then executed. In some embodiments, the acceleration unit such as the graphics processor or neural processing unit in the processing device 901 may also be configured with video memory as its local memory. The video memory may be implemented in the form of high-bandwidth memory or graphics double data rate memory, or it may be partitioned from a portion of the storage space in the random access memory 903. The aforementioned video memory is also a specific implementation of the memory described in this disclosure.

[0105] Processing device 901, read-only memory 902, and random access memory 903 are interconnected via bus 904. Input / output (I / O) interface 905 is also connected to bus 904. In some embodiments, the following components are connected to I / O interface 905: input section 906 including keyboard, mouse, etc.; output section 907 including cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; storage section 908 including hard disk, etc.; and communication section 909 including network interface card, such as LAN card, modem, etc. Communication section 909 performs communication processing via a network such as the Internet. Drive 910 is also connected to I / O interface 905 as needed. Removable media 911, such as disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 910 as needed so that computer programs read from there can be installed into storage section 908 as needed.

[0106] The above are merely preferred embodiments of this application and are not intended to limit this application in any way. Any simple modifications, equivalent changes, and alterations made to the above embodiments based on the technical essence of this application without departing from the scope of the technical solution of this application shall still fall within the scope of the technical solution of this application.

Claims

1. A method for reordering and reassembling messages, characterized in that, The method includes: The on-chip shared memory space is divided into multiple memory blocks, the physical pointers of each memory block are stored in the global free pointer pool, and bitmaps, pointer arrays and expected sequence numbers are configured for each logical queue; Obtain the logical queue identifier and receive sequence number of the message, and determine the relative offset based on the receive sequence number and the expected sequence number; Using the relative offset as an index, the payload of the message is stored in the storage block indicated by the physical pointer popped from the global free pointer pool, the physical pointer is written into the pointer array, and the bit corresponding to the relative offset in the bitmap is set. The number of consecutive bits set from the start bit in the bitmap is detected, and the number of physical pointers of the bitmap are extracted in batches to trigger direct data placement and transmission, and the expected sequence number is incremented by the number of bits.

2. The message reordering method according to claim 1, characterized in that, The configuration of bitmaps, pointer arrays, and expected sequence numbers for each logical queue includes: Context entries are allocated for each of the logical queues in the context memory. The context entries are used to store the bitmap, the pointer array, the expected sequence number, and the count of used storage blocks. Set the safeguard water level and the shared cutoff water level in each of the aforementioned context entries; The guaranteed water level is used to indicate the amount of storage that the logical queue is guaranteed, and the shared cutoff water level is used to indicate the upper limit of the storage that the logical queue can occupy.

3. The message reordering method according to claim 2, characterized in that, The method further includes: The context table entry of the logical queue is read according to the logical queue identifier to obtain the used storage block count and the shared truncation waterline of the logical queue; Compare the used storage block count with the shared cutoff waterline, and compare the remaining amount in the global free pointer pool with the critical threshold; When the count of used storage blocks is less than or equal to the shared cutoff water level and the remaining amount is greater than the critical threshold, the message is determined to have passed the admission decision.

4. The message reordering method according to claim 3, characterized in that, The method further includes: When the count of used storage blocks is greater than the shared cutoff water level, or the remaining amount is less than or equal to the critical threshold, the congestion cutoff flag is set, and the admission decision of subsequent packets is blocked. During the admission decision for intercepting subsequent packets, the request for physical pointers from the global free pointer pool is stopped, and subsequent packets are discarded before reception. Backpressure signaling is generated at the physical layer and sent to the source end along the physical link, wherein the backpressure signaling includes at least one of priority flow control pause frames and explicit congestion notification messages.

5. The message reordering method according to claim 4, characterized in that, The method further includes: During the period when the congestion truncation flag is set, the count of used storage blocks in the logical queue is monitored; When the number of used storage blocks is less than or equal to the shared cutoff water level, the congestion cutoff flag is cleared. After the congestion truncation flag is cleared, the direct data placement transmission is triggered to output the payload already stored in the on-chip shared storage space.

6. The message reordering method according to claim 1, characterized in that, The steps of storing the packet payload into the storage block indicated by the physical pointer popped from the global free pointer pool, writing the physical pointer into the pointer array, and setting the bit corresponding to the relative offset in the bitmap, using the relative offset as an index, include: The relative offset is used as the physical address line for the pointer array and the bitmap; The storage of the payload, the writing of the pointer array, and the setting of the bitmap are performed in parallel on the rising edge of the same clock cycle, so as to decouple the physical storage location of the payload in the on-chip shared memory space from the logical order of the message.

7. The message reordering method according to claim 6, characterized in that, The parallel execution of storing the payload, writing to the pointer array, and setting the bitmap on the rising edge of the same clock cycle includes: Pop a physical pointer from the global free pointer pool and write the payload of the message into the storage block indicated by the physical pointer; The physical pointer is passed through and written to the index bit of the pointer array at the relative offset; The bit of the bitmap is set to the relative offset, wherein the index bits of the pointer array correspond one-to-one with the bits of the bitmap according to the relative offset.

8. The message reordering method according to claim 1, characterized in that, The step of detecting the number of consecutively set bits from the start bit in the bitmap and batch extracting the physical pointers of that number of bits includes: When the bit in the bitmap changes from zero to one, the number of consecutive bits set from the start bit in the bitmap is determined within a single gate delay by a preamble detector. The bitmap and the pointer array are logically shifted to the right by the number of bits using a barrel shifter; The number of physical pointers starting from the start bit in the pointer array are extracted in parallel.

9. The message reordering method according to claim 8, characterized in that, The parallel extraction of the number of physical pointers starting from the start bit in the pointer array further includes: The aforementioned number of physical pointers are packaged and pushed to the direct memory access command queue to trigger the zero-copy direct data placement transmission; After the payload in the storage block indicated by the number of physical pointers is read out, the number of physical pointers is pushed back to the global free pointer pool.

10. An electronic device, characterized in that, include: At least one processing device; And a memory communicatively connected to the at least one processing device; wherein the memory stores instructions executable by the at least one processing device to enable the at least one processing device to implement the method as described in any one of claims 1 to 9.