Message processing method and device, FPGA (Field Programmable Gate Array) and communication equipment
By using a first ring RAM and a message status bitmap in the communication device, the received packet messages can be buffered and reordered, which solves the problems of resource waste and performance degradation in out-of-order packet processing and improves storage and transmission efficiency.
Patent Information
- Application Number
- CN202411315509.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2026-03-20
AI Technical Summary
Existing technologies for reordering and selectively retransmitting out-of-order packets in communication transmission suffer from resource waste and performance degradation, especially due to the inability of packets to completely fill small storage blocks, leading to increased operational steps.
A first ring RAM is used for packet buffering, and the receiving queue is reordered through a packet status bitmap and a buffer sequence. Combining the buffer start address and packet length simplifies the operation, avoids storage waste caused by small blocks not being filled, and improves storage performance.
By caching packets with contiguous addresses, storage resources are saved, operation steps are simplified, storage performance is improved, and efficient reordering and selective retransmission of out-of-order packets are achieved.
Smart Images

Figure CN121711322A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communication technology, and more specifically, to a message processing method, apparatus, FPGA, and communication device. Background Technology
[0002] In communication transmission, to achieve reliable transmission, the receiver needs to be able to reorder received out-of-order packets, and the sender needs to be able to selectively retransmit packets when lost. The traditional method is to divide RAM (Random Access Memory) into multiple small blocks, using one or more blocks to store a single packet, and then using a BD (Buffer Descriptor) table for indexing to facilitate the reordering of received out-of-order packets. However, this method can lead to situations where packets cannot completely fill all the blocks, resulting in wasted resources. Furthermore, using multiple blocks to store packets increases the number of steps involved in storing and retrieving packets, increasing overhead and degrading overall performance. Summary of the Invention
[0003] In view of this, the purpose of the present invention is to provide a message processing method, apparatus, FPGA and communication device.
[0004] To achieve the above objectives, the technical solution adopted by the present invention is as follows:
[0005] In a first aspect, the present invention provides a message processing method applied to an FPGA, the FPGA including a first ring RAM, the message processing method comprising:
[0006] For each received packet, a buffering operation is performed on the packet, and the starting address of the buffer and the packet length in the first ring RAM are used as its buffering information;
[0007] The value of the preset message status bitmap is updated according to the sequence number of the packet, and the buffer information of the packet is saved to the preset buffer sequence; wherein, the value of the message status bitmap represents the reception status of N consecutively sequenced packets, and the buffer sequence is used to save the buffer information of N consecutively sequenced packets; N is an integer greater than or equal to 2.
[0008] Based on the value of the message status bitmap and the cache sequence, each cached information is stored in a preset receiving queue, so that each cached information in the receiving queue is arranged according to the sequence number of each packet, so as to reorder the multiple received packets.
[0009] In an optional implementation, the step of buffering the packet includes:
[0010] Obtain the start address of the current write operation pointed to by the write pointer of the first ring RAM, and obtain the end address of the previous read operation pointed to by the read pointer of the first ring RAM;
[0011] The storage state of the first ring RAM is determined based on the current write start address and the previous read end address;
[0012] If the storage state of the first ring RAM is full, the packet is discarded;
[0013] If the storage state of the first ring RAM is not full, the packet is cached in the first ring RAM according to the current write start address, and the current write start address is used as the cache start address of the packet.
[0014] In an optional implementation, the message status bitmap includes the value of N bits, which represent the reception status of N consecutively sequenced packet messages. The buffer sequence includes N buffer descriptors, which are used to store the buffer information of a packet message. Each bit of the message status bitmap corresponds to the buffer descriptor at the same position in the buffer sequence.
[0015] The steps of updating the value of the preset message status bitmap according to the sequence number of the packet and saving the cache information of the packet to the preset cache sequence include:
[0016] In the message status bitmap, the value of the bit corresponding to the sequence number of the packet is updated, and the buffer information of the packet is saved to the buffer descriptor corresponding to the bit in the buffer sequence.
[0017] In an optional implementation, the arrangement of the N bits of the message status bitmap from the least significant bit to the most significant bit represents the arrangement order of the N packet messages; the value of the bit is a first value or a second value, where the first value indicates that the reception status is not received, and the second value indicates that the reception status is received.
[0018] The step of storing each piece of cached information into a preset receive queue based on the value of the message status bitmap and the cache sequence includes:
[0019] Obtain the current value of the least significant bit of the message status bitmap;
[0020] When the current value of the least significant bit is the second value, the buffer descriptor corresponding to the least significant bit in the cache sequence is used as the target buffer descriptor, and the cache information stored in the target buffer descriptor is used as the target cache information.
[0021] Based on the value of each other bit in the message status bitmap, determine the release flag of the target buffer information, store the target buffer information and its release flag in the receive queue, and then release the target buffer descriptor; wherein, the release flag is used to indicate whether to perform a storage space release operation;
[0022] By performing a shift operation on the N buffer descriptors in the cache sequence, the buffer descriptor at position (n+1) is moved to position n, and the target buffer descriptor is placed at position N; n is a natural number less than N;
[0023] By shifting the values of N bits in the message status bitmap, the value of the (n+1)th bit is moved to the nth bit and the value of the Nth bit is set to the first value, a new message status bitmap is obtained. The step of obtaining the current value of the least significant bit of the message status bitmap is repeated until all buffered information is stored in the receive queue.
[0024] In an optional implementation, the release flag is a first flag or a second flag, where the first flag indicates that a storage space release operation is performed, and the second flag indicates that a storage space release operation is not performed.
[0025] The step of determining the release flag of the target buffer information based on the value of each other bit in the message status bitmap includes:
[0026] When the value of each other bit in the message status bitmap is the first value, the first flag is used as the release flag for the target cache information;
[0027] When at least one of the second values exists in the value of each other bit of the message status bitmap, the second flag is used as a release flag for the target cache information.
[0028] In an optional implementation, the FPGA further includes a second ring RAM, and the message processing method further includes:
[0029] According to the sequence number of each packet to be sent, each packet to be sent is cached in the second ring RAM in sequence, and the cache start address and packet length of each packet to be sent are used as its cache information;
[0030] For each packet to be sent, the buffer information of the packet to be sent is saved to the buffer descriptor corresponding to the sequence number of the packet to be sent in the preset BD ring, and the sending timestamp of the packet to be sent is saved to the position corresponding to the sequence number of the packet to be sent in the preset time ring.
[0031] When a response message is received, the sequence number of each received packet and the sequence number of each suspected lost packet are determined based on the message status bitmap and expected sequence number in the response message.
[0032] For each received packet sequence number, the corresponding buffer descriptor is obtained from the BD ring according to the received packet sequence number. After releasing the storage space in the second ring RAM used to cache the received packet according to the cache information stored in the buffer descriptor, the buffer descriptor is released.
[0033] For each suspected lost packet packet, the corresponding sending timestamp is obtained from the time ring according to the sequence number of the suspected lost packet packet. If the time difference between the sending timestamp and the current time exceeds a preset duration, the sequence number of the suspected lost packet packet is used as the sequence number of the packet to be retransmitted.
[0034] For each sequence number of the packet to be retransmitted, the cache information stored in the corresponding buffer descriptor in the BD ring is obtained according to the sequence number of the packet to be retransmitted, and the cache information is stored in the preset retransmission queue.
[0035] Based on each cached information in the retransmission queue, each packet to be retransmitted is retransmitted, and the sending timestamp of each packet to be retransmitted is updated in the time ring.
[0036] In an optional implementation, the step of determining the sequence number of each received packet and the sequence number of each suspected lost packet based on the packet status bitmap and expected sequence number in the response information includes:
[0037] Each first bit is determined based on the value of each bit in the message status bitmap of the response information; the value of the first bit indicates the reception status as received.
[0038] Each second bit is determined based on the value of each bit in the message status bitmap of the response information and each first bit; the receiving status represented by the value of the second bit is not received and at least one first bit exists among all bits higher than the second bit.
[0039] For each of the first bits, the sequence number of the corresponding received packet is calculated based on the first bit and the expected received sequence number, thus obtaining the sequence number of each received packet.
[0040] For each of the second bits, the sequence number of the corresponding suspected lost packet is calculated based on the second bit and the expected received sequence number, thus obtaining the sequence number of each suspected lost packet.
[0041] In a second aspect, the present invention provides a message processing apparatus applied to an FPGA, the FPGA including a first ring RAM, the message processing apparatus comprising:
[0042] The caching module is used to perform a caching operation on each received packet, and use the starting address of the caching in the first ring RAM and the packet length as its caching information;
[0043] An update module is used to update the value of a preset message status bitmap according to the sequence number of the packet, and save the cache information of the packet to a preset cache sequence; wherein, the value of the message status bitmap represents the reception status of N consecutively sequenced packets, and the cache sequence is used to save the cache information of N consecutively sequenced packets; where N is an integer greater than or equal to 2.
[0044] The reordering module is used to store each cached information into a preset receiving queue according to the value of the message status bitmap and the cache sequence, so that each cached information in the receiving queue is arranged according to the sequence number of each packet message, so as to reorder the multiple received packet messages.
[0045] Thirdly, the present invention provides an FPGA for implementing the message processing method described in any of the foregoing embodiments.
[0046] Fourthly, the present invention provides a communication device including the FPGA described in the foregoing embodiments.
[0047] This invention provides a message processing method, apparatus, FPGA, and communication device. The method includes: first, buffering received packet messages and using the buffer start address and message length in a first circular RAM as buffer information; then, updating the value of a preset message status bitmap according to the packet sequence number and saving the buffer information of the packet messages to a preset buffer sequence; finally, storing each buffer information in a preset receive queue according to the message status bitmap value and the buffer sequence, so that each buffer information in the receive queue is arranged according to the sequence number of each packet message, thereby reordering multiple received packet messages. This invention buffers received packet messages in contiguous addresses, eliminating the need for dividing into small blocks and avoiding wasted storage space due to incomplete small blocks, thus saving storage resources. Furthermore, by using the buffer start address and message length to represent the buffer location of the packet messages, packet messages can be directly read and stored according to the buffer location, simplifying operations and improving storage performance.
[0048] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0049] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0050] Figure 1 A block diagram of a communication device provided in an embodiment of the present invention is shown;
[0051] Figure 2 One of the flowcharts of the message processing method provided in the embodiment of the present invention is shown;
[0052] Figure 3 One example diagram of the message processing method provided in an embodiment of the present invention is shown;
[0053] Figure 4 The second example diagram shows the message processing method provided in the embodiment of the present invention;
[0054] Figure 5 The third example diagram shows the message processing method provided in the embodiment of the present invention;
[0055] Figure 6 The fourth example diagram shows the message processing method provided in the embodiment of the present invention;
[0056] Figure 7 Figure 5 shows an example of the message processing method provided in an embodiment of the present invention;
[0057] Figure 8 This is a second schematic flowchart of the message processing method provided in an embodiment of the present invention;
[0058] Figure 9 A functional block diagram of the message processing apparatus provided in an embodiment of the present invention is shown.
[0059] Icons: 100 - Communication equipment; 110 - Processor; 120 - Memory; 130 - Communication module; 140 - FPGA; 300 - Message processing device; 310 - Cache module; 330 - Update module; 350 - Reordering module; 370 - Retransmission module. Detailed Implementation
[0060] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.
[0061] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.
[0062] It should be noted that relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0063] Please see Figure 1This is a block diagram of a communication device provided in an embodiment of the present invention. The communication device 100 includes a processor 110, a memory 120, a communication module 130, and an FPGA 140. These components are electrically connected directly or indirectly to each other to achieve data transmission or interaction. For example, these components can be electrically connected to each other through one or more communication buses or signal lines.
[0064] The processor 110 is used to read / write data or programs stored in the memory 120 and perform corresponding functions. It can be a general-purpose processor, including CPU (Central Processing Unit), NP (Network Processor), etc.; it can also be a DSP digital signal processor, ASIC application-specific integrated circuit or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component.
[0065] The memory 120 is used to store programs or data. The memory 120 can be RAM (Random Access Memory), ROM (Read Only Memory), PROM (Programmable Read-Only Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electric Erasable Programmable Read-Only Memory), etc.
[0066] The communication module 130 is used for signaling or data communication with other devices.
[0067] FPGA140 is used to execute the message processing method provided in the embodiments of the present invention to rearrange received out-of-order packets and selectively retransmit sent packets.
[0068] Understandable Figure 1 The structure shown is only a schematic diagram of the communication device 100. The communication device 100 may also include components that are larger than... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown. Figure 1 The components shown can be implemented using hardware, software, or a combination thereof.
[0069] It should be noted that the communication device provided in this embodiment of the invention can function as both a receiver and a transmitter. When the communication device functions as a receiver, it can rearrange received out-of-order packets; when it functions as a transmitter, it can selectively retransmit transmitted packets. The process of rearranging received out-of-order packets when the communication device functions as a receiver will be described below.
[0070] Please see Figure 2 This is a flowchart illustrating a message processing method provided in an embodiment of the present invention.
[0071] Step S202: For each received packet, perform a buffering operation on the packet and use the starting address of the buffer and the packet length in the first ring RAM as its buffering information.
[0072] In this embodiment, the FPGA includes a first circular RAM, which is used to buffer received packet messages. Each packet message can be buffered sequentially into the first circular RAM according to the order in which they are received, in a contiguous address manner; that is, the first circular RAM stores out-of-order packet messages.
[0073] It is understood that the processing method for each received packet in the embodiments of the present invention is similar. For the sake of brevity, the following description takes a single packet as an example. First, the packet is buffered. After the packet is buffered in the first circular RAM, the starting address of the buffer is obtained. The packet length and the starting address are used as the buffer information of the packet.
[0074] In essence, compared to existing technologies, this invention caches received packet messages in contiguous addresses. This eliminates the need for dividing the packets into smaller blocks and avoids wasted storage space due to incomplete blocks, thus saving storage resources. Furthermore, this invention uses the cache start address and message length to represent the cache location of packet messages. This allows for direct reading and storage of packet messages based on their cache location, simplifying operations and improving packet processing performance while saving computational resources.
[0075] Step S204: Update the value of the preset message status bitmap according to the sequence number of the packet, and save the buffer information of the packet to the preset buffer sequence; wherein, the value of the message status bitmap represents the reception status of N consecutively sequenced packet messages, and the buffer sequence is used to save the buffer information of N consecutively sequenced packet messages; N is an integer greater than or equal to 2.
[0076] In this embodiment, a message status bitmap can be pre-set to monitor the reception status of multiple consecutive sequence number packets, and a buffer sequence can also be pre-set to store the buffer information of these multiple monitored packets. That is, the message status bitmap and the buffer sequence are used to record the information of packets within the currently monitored sequence number range, and the total number of sequence numbers in this sequence number range is N.
[0077] If the sequence number of a received packet does not fall within the currently monitored sequence number range, it indicates a serious packet out-of-order issue, and the packet is discarded. If the sequence number of a received packet falls within the currently monitored sequence number range, the packet is buffered. After buffering it in the first ring RAM, the packet status bitmap is updated based on the packet's sequence number, and the buffered information of the packet is saved to the buffer sequence, thus recording the packet's information.
[0078] Step S206: Based on the value of the message status bitmap and the cache sequence, store each cache information into a preset receiving queue so that each cache information in the receiving queue is arranged according to the sequence number of each packet message, so as to reorder the multiple received packet messages.
[0079] In this embodiment, since the message status bitmap and the buffer sequence record information about the packet messages within the currently monitored sequence number range, the reception status of the packet messages within that sequence number range can be obtained based on the value of the message status bitmap. Furthermore, based on the reception status of each packet message, each buffered piece of information in the buffer sequence is sequentially stored into a preset receive queue, so that each buffered piece of information in the receive queue is arranged according to the sequence number of each packet message. Therefore, each packet message can be read sequentially according to each buffered piece of information in the receive queue, thereby reordering the out-of-order packet messages stored in the first circular RAM. Optionally, the receive queue can be a FIFO (First Input First Output) queue.
[0080] As can be seen from the above steps, the received packet messages are first cached, and the cache start address and message length of the packet message in the first ring RAM are used as its cache information. Then, the value of the preset message status bitmap is updated according to the sequence number of the packet message, and the cache information of the packet message is saved to the preset cache sequence. Finally, according to the value of the message status bitmap and the cache sequence, each cache information is stored in the preset receive queue, so that each cache information in the receive queue is arranged according to the sequence number of each packet message, thereby reordering the received multiple packet messages. This invention caches the received packet messages in contiguous addresses, thus eliminating the need to divide them into small blocks and avoiding storage space waste due to incomplete small blocks, achieving the effect of saving storage resources. Furthermore, by using the cache start address and message length to represent the cache position of the packet message, the packet message can be directly read and stored according to the cache position, thereby simplifying the operation and improving storage performance.
[0081] Optionally, for the process of caching the packet in step S202, this embodiment of the invention provides a possible implementation.
[0082] Step S202-1: Obtain the start address of the current write operation pointed to by the write pointer of the first ring RAM, and obtain the end address of the previous read operation pointed to by the read pointer of the first ring RAM.
[0083] Step S202-3: Determine the storage state of the first ring RAM based on the start address of this write and the end address of the last read.
[0084] Step S202-5: If the storage state of the first ring RAM is full, then discard the packet.
[0085] Step S202-7: If the storage state of the first ring RAM is not full, then according to the start address of this write, the packet is cached in the first ring RAM, and the start address of this write is used as the cache start address of the packet.
[0086] For ease of understanding, an example diagram is provided in this embodiment of the invention. Please refer to... Figure 3 This includes a first circular RAM, where the write and read directions are the same, both clockwise. The first circular RAM has a write pointer and a read pointer. The write pointer points to an address in the first circular RAM, indicating the address where the current writing of a packet begins. The read pointer points to an address in the first circular RAM, indicating the address at which the last packet was released after the last read, i.e., the address where the last read ended.
[0087] In this embodiment, when performing a packet buffering operation, the address at which the write pointer of the first circular RAM currently points to begin writing the packet (i.e., the start address of the current write operation) is first obtained, and the tail address at which the read pointer of the first circular RAM currently points to after the last packet read is released (i.e., the end address of the last read operation) is also obtained. Then, based on the start address of the current write operation and the end address of the last read operation, the storage state of the first circular RAM is determined. This storage state can be represented by a water level. For example, if the address pointed to by the write pointer is represented as Wr_ptr and the address pointed to by the read pointer is represented as Rd_ptr, then the water level, wr_level, can be represented as: wr_level = (Wr_ptr - Rd_ptr).
[0088] If the write speed of a packet in the first ring RAM is faster than the read speed, the address pointed to by the write pointer may exceed the address pointed to by the read pointer. In other words, the calculated water level will exceed the set threshold. At this time, the storage state of the first ring RAM is considered to be full, which means that the first ring RAM does not have enough space to cache the packet, so the packet will be discarded.
[0089] If the write speed of the packet in the first ring RAM is slower than the read speed or the difference between the two is not significant, the address pointed to by the write pointer will not exceed the address pointed to by the read pointer. That is, the calculated water level will not exceed the set threshold. Therefore, the storage state of the first ring RAM is considered to be not full, which means that the first ring RAM still has enough space to cache the packet. So, according to the start address of this write, the packet is cached in the first ring RAM, and the start address of this write is used as the cache start address of the packet.
[0090] Optionally, for step S204, this embodiment of the invention provides a possible implementation method, namely: in the message status bitmap, update the value of the bit corresponding to the sequence number of the packet message, and save the buffer information of the packet message to the buffer descriptor corresponding to the bit in the buffer sequence.
[0091] In this embodiment, the message status bitmap includes N bits. Each bit corresponds to a sequence number within the currently monitored sequence number range, and the value of the bit indicates the reception status of the packet message corresponding to that sequence number. There are two possible values for the bit: a first value and a second value. The first value indicates a reception status of "not received," and the second value indicates a reception status of "received."
[0092] A buffer sequence consists of N buffer descriptors (BDs), which can be implemented using BD tables. Each buffer descriptor stores the buffer information for a packet within the currently monitored sequence number range. That is, one sequence number corresponds to one bit and one buffer descriptor. Furthermore, for a given sequence number, the position of its corresponding bit in the packet status bitmap is the same as the position of its corresponding buffer descriptor in the buffer sequence.
[0093] The FPGA also includes a register that stores the sequence number (NSN) of the next packet to be received. This NSN determines the range of the currently monitored sequence number, which is from NSN to NSN+(N-1).
[0094] For ease of understanding, an example is provided in this embodiment of the invention. For instance, if N is 16, then the message status bitmap has 16 bits, i.e., bits 0 to 15, and the buffer sequence has 16 buffer descriptors, i.e., BD0 to B015, with bits 0 to 15 corresponding one-to-one with the buffer descriptors BD0 to B015. The NSN can be represented by 8 bits of data, i.e., the NSN can represent any sequence number from 0 to 255. Furthermore, the first value indicating a reception status of not received is set to 0, and the second value indicating a reception status of received is set to 1.
[0095] Assuming the current NSN is 2, the current monitored sequence number range is 2 to 17, and the value of the receive status bitmap is 0000000000010100. The correspondence between the 16 sequence numbers in the current monitored sequence number range, the 16 bits of the receive status bitmap, the value of each bit, and the 16 buffer descriptors in the buffer sequence is as follows: Figure 4 As shown.
[0096] Assuming the currently processed packet is packet Y, and packet Y's sequence number is 2, then in the receive status bitmap, the bit corresponding to sequence number 2 (bit 0) is determined, and the value of bit 0 is updated from the first value (0) indicating not received to the second value (1) indicating received. This yields the updated receive status bitmap value: 0000000000010101. Furthermore, the buffer descriptor corresponding to bit 0 (BD0) is retrieved from the buffer sequence, and the buffer information for packet Y is saved to BD0.
[0097] It should be noted that the sequence range represented by NSN, the specific value of N, and the first and second values can be set according to the actual situation, and the embodiments of the present invention do not limit this.
[0098] Optionally, for step S206, this embodiment of the invention provides a possible implementation.
[0099] Step S206-1: Obtain the current value of the least significant bit of the message status bitmap.
[0100] Step S206-3: When the current value of the least significant bit is the second value, the buffer descriptor corresponding to the least significant bit in the cache sequence is used as the target buffer descriptor, and the cache information stored in the target buffer descriptor is used as the target cache information.
[0101] Step S206-5: Based on the value of each other bit in the message status bitmap, determine the release flag of the target buffer information, store the target buffer information and its release flag in the receive queue, and then release the target buffer descriptor; wherein, the release flag is used to indicate whether to perform a storage space release operation.
[0102] To facilitate understanding, let's continue with the example of packet Y. After updating the value of the receive state bitmap based on the sequence number of packet Y, the obtained receive state bitmap value is 0000000000010101. Based on this receive state bitmap, firstly, the current value of the least significant bit (bit 0) of the packet state bitmap is obtained. This current value is the second value (1), indicating that packet 2 with sequence number NSN has been received. Then, the buffer descriptor corresponding to bit 0 in the buffer sequence, BD0, is used as the target buffer descriptor, and the buffer information stored in BD0 is used as the target buffer information.
[0103] Then, based on the values of each other bit in the message status bitmap (i.e., bits 1 to 15), the release flag for the target buffer information is determined. After storing the target buffer information and its release flag in the receive queue, the target buffer descriptor, BD0, is released. The release flag indicates whether a storage space release operation should be performed after reading packet Y from the first ring RAM.
[0104] Step S206-7 involves shifting the N buffer descriptors in the cache sequence, moving the buffer descriptor at position (n+1) to position n, and placing the target buffer descriptor at position N; n is a natural number less than N.
[0105] Step S206-9 involves shifting the values of N bits in the message status bitmap, moving the value of the (n+1)th bit to the nth bit, and setting the value of the Nth bit to the first value to obtain a new message status bitmap. Step S206-1 is then repeated until all buffered information is stored in the receive queue.
[0106] Understandably, upon receiving a packet with sequence number NSN, there's no need to monitor packets with that sequence number. Therefore, the NSN needs to be updated by incrementing it by 1, thus updating the currently monitored sequence number range. Since the receive status bitmap and buffer sequence are used to record information about packets within the currently monitored sequence number range, they also need to be updated.
[0107] To facilitate understanding, let's continue with the example above. Increasing the original NSN (2) by 1 results in a new NSN of 3, thus updating the currently monitored sequence number range to 3-18. Correspondingly, the receive status bitmap and buffer sequence also need to be updated to record information about the 16 packets with sequence numbers 3 to 18.
[0108] By shifting the 16 buffer descriptors in the cache sequence, the buffer descriptor at position (n+1) is moved to position n, and the target buffer descriptor is placed at position 16. Specifically, the buffer descriptor at position 2 is moved to position 1, the buffer descriptor at position 3 is moved to position 2, and so on, until the buffer descriptor at position 16 is moved to position 15, and the target buffer descriptor (BD0) is placed at position 16, resulting in a new cache sequence.
[0109] By shifting the 16 bits of the message status bitmap, the value of the (n+1)th bit is moved to the nth bit, and the value of the 16th bit is set to the first value. That is, the value of bit 1 is moved to bit 0, the value of bit 2 is moved to bit 1, and so on. The value of bit 15 is moved to bit 14, and the value of the 16th bit (bit 15) is set to 0. This results in the new message status bitmap: 00000000000001010. After updating in this way, the correspondence between the 16 sequence numbers in the currently monitored sequence number range, the 16 bits of the receive status bitmap, the value of each bit, and the 16 buffer descriptors in the buffer sequence is as follows: Figure 5 As shown. It should be noted that since the buffer information in BD0 is stored in the receive queue, BD0 is empty, that is, the starting address and the message length are both 0. Therefore, the buffer descriptor corresponding to bit 15 can be represented by all zeros.
[0110] Based on the new message status bitmap (0000000000001010), step S206-1 is re-executed. In this message status bitmap, bit 0 has the first value (0), and bit 1 has the second value (1), indicating that the packet with sequence number NSN (3) has not yet been received, but the packet with sequence number 4 has been received. Since the current value of the least significant bit (bit 0) is the first value (0), steps S206-3 to S206-7 will not be executed at this time. Instead, the system will wait until the packet with sequence number 3 is received, changing the value of bit 0 to 1, at which point steps S206-3 to S206-7 will be executed. After receiving the packet with sequence number 3, NSN will be updated to 4, and only then will the buffer information of the packet with sequence number 4 be stored in the receive queue. This ensures that each buffer information in the receive queue is arranged according to the sequence number of each packet. This enables the reordering of received out-of-order packets.
[0111] Optionally, for the process of determining the release flag of the target cache information based on the value of each other bit in the message status bitmap in step S206-5, this embodiment of the invention provides a possible implementation.
[0112] Step S206-5-A: When the value of each other bit in the message status bitmap is the first value, the first flag is used as the release flag for the target buffer information.
[0113] Step S206-5-B: When at least one second value exists in the value of each other bit of the message status bitmap, the second flag is used as a release flag for the target buffer information.
[0114] In this embodiment, there are two types of release flags: a first flag and a second flag. The first flag indicates that a storage space release operation is performed, and the second flag indicates that a storage space release operation is not performed. For example, the first flag can be set to 1, and the second flag can be set to 0. It should be noted that the first flag and the second flag can be set according to actual conditions, and this embodiment of the invention does not limit this.
[0115] To facilitate understanding, let's continue with the example of packet Y. When determining the release flag for the cached information of packet Y, the value of the packet status bitmap is 0000000000010101. At this time, if any of the other bits in the packet status bitmap (bits 1 to 15) contains a second value of 1, it indicates that there is a packet with a sequence number following that of packet Y, which was cached in the first circular RAM before packet Y. Therefore, the second flag, 0, is used as the release flag for the cached information of packet Y. Thus, after packet Y is read from the first circular RAM according to its cached information, no memory release operation is performed.
[0116] Based on the values in the message status bitmap, it can be seen that bits 2 and 4 are both 1, indicating that packets with sequence numbers 4 and 6 were received before packet Y (sequence number 2). This means they were cached in the first ring RAM before packet Y. Therefore, the number of packets cached in the first ring RAM is as follows: Figure 6 As shown.
[0117] During the message reading process, since the buffered information in the receive queue is arranged according to the sequence number of the packets, packet Y with sequence number 2 will be read before packets with sequence numbers 4 and 6 are read. That is, in the storage space preceding packet Y, there are packets whose reading order is later than packet Y. Therefore, if the storage space used to buffer packet Y and the storage space preceding it are released after reading packet Y, the unread packets with sequence numbers 4 and 6 will be lost. Therefore, this embodiment of the invention sets the release flag for the buffered information of packet Y to a second flag, thus avoiding the loss of packets by not performing a storage space release operation after reading packet Y.
[0118] Accordingly, if the values of bits 1 to 15 in the message status bitmap are all the first value (0) when determining the release flag for the buffer information of packet Y, it indicates that there is no packet with a sequence number following that of packet Y that is buffered in the first circular RAM before packet Y. Therefore, the first flag (1) is used as the release flag for the buffer information of packet Y. After packet Y is read from the first circular RAM according to its buffer information, a storage space release operation is performed.
[0119] In this scenario, it means that before receiving packet Y with sequence number 2, only packets with sequence numbers 0 and 1 were received, and both were cached in the first ring RAM before packet Y. Therefore, the number of packets cached in the first ring RAM is as follows: Figure 7 As shown.
[0120] During the message reading process, since the buffered information in the receive queue is arranged according to the sequence number of the packets, the packets with sequence number 0, sequence number 1, and sequence number 2 are read sequentially. That is, in the storage space preceding packet Y, there are no packets read after packet Y. Therefore, this embodiment of the invention sets the release flag of the buffered information of packet Y to the first flag, so that after reading packet Y, a storage space release operation can be performed to release storage space in a timely manner, thereby improving the utilization rate of the first circular RAM.
[0121] The following section describes the process of selective retransmission of packet messages when a communication device acts as the sender. Please refer to [link / reference needed]. Figure 8 This is another flowchart illustrating the message processing method provided in this embodiment of the invention.
[0122] Step S210: According to the sequence number of each packet to be sent, cache each packet to be sent into the second ring RAM in sequence, and use the cache start address and packet length of each packet to be sent as its cache information.
[0123] In this embodiment, the FPGA includes a second circular RAM, which is used to buffer packets to be sent. Each packet to be sent can be buffered sequentially into the second circular RAM according to its sequence number and the address pointed to by the write pointer of the second circular RAM, indicating the start of writing to the current packet. The buffer start address and packet length of each packet are used as its buffer information.
[0124] Step S212: For each packet to be sent, save the buffer information of the packet to be sent to the buffer descriptor corresponding to the sequence number of the packet to be sent in the preset BD ring, and save the sending timestamp of the packet to be sent to the position corresponding to the sequence number of the packet to be sent in the preset time ring.
[0125] In this embodiment, a buffer descriptor (BD) ring and a time ring can be pre-configured. The BD ring includes multiple buffer descriptors, and the time ring contains the same number of positions. The sequence number of a packet to be sent corresponds to one buffer descriptor and one position. The buffer descriptor stores the buffer information of the packet to be sent, and the position stores the transmission timestamp of the packet. A timer can also be pre-configured to accumulate time in a set unit duration. For example, the total number of buffer descriptors in the BD ring and the total number of positions in the time ring can be set to 256, and the timer's unit duration can be set to 1µs. These parameters can also be set according to actual conditions, and this embodiment of the invention is not limited in this regard.
[0126] The BD ring has write pointers and read pointers. The write pointer points to the sequence number of the packet to be sent, for which buffered information is to be saved. The read pointer points to the sequence number of the packet to be sent. Using the write pointer, the buffered information of each packet to be sent can be saved to the BD ring sequentially according to its sequence number. Using the read pointer, each packet to be sent can be read from the second ring RAM sequentially according to its sequence number and the buffered information, and then sent. A timer is used to obtain the transmission timestamp of each packet to be sent, and the timestamp is saved to the corresponding position in the time ring.
[0127] Step S214: When a response message is received, determine the sequence number of each received packet and the sequence number of each suspected lost packet based on the message status bitmap and expected sequence number in the response message.
[0128] In this embodiment, after sending a packet, a response message is received from the peer device. This response message carries a packet status bitmap and an expected sequence number. The packet status bitmap represents the reception status of multiple packet messages; the expected sequence number represents the peer device's NSN, i.e., the sequence number of the next packet message it expects to receive. Therefore, based on this packet status bitmap and expected sequence number, the sequence numbers of the packet messages already received by the peer device, as well as the sequence numbers of packet messages that may have been lost, can be determined.
[0129] In essence, this invention uses a message status bitmap in the response information to provide feedback on the reception status of multiple packet messages to the sender at once. This improves the efficiency and reliability of message transmission.
[0130] Step S216: For each received packet sequence number, obtain the corresponding buffer descriptor from the BD ring according to the sequence number of the received packet, and release the storage space in the second ring RAM used to cache the received packet according to the cache information stored in the buffer descriptor, and then release the buffer descriptor.
[0131] In this embodiment, the message status bitmap includes N bits, where each bit corresponds to the sequence number of a packet, and the value of the bit indicates the reception status of the packet with the corresponding sequence number. Therefore, the bits in the message status bitmap that indicate a received status can be obtained, and combined with NSN, the sequence number of each received packet can be calculated. It should be noted that since NSN represents the sequence number of the next packet the peer device expects to receive, it means the peer device has already received the packet with sequence number NSN-1, so NSN-1 is also the sequence number of a received packet.
[0132] It is understood that the processing method for each received packet is similar in the embodiments of the present invention. The following description takes a received packet as an example. According to the sequence number of the received packet, the corresponding buffer descriptor is obtained from the BD ring. After releasing the storage space in the second ring RAM used to cache the received packet according to the cache information stored in the buffer descriptor, the buffer descriptor is released.
[0133] This can be understood as follows: since packet loss may occur during the transmission of packet messages, the present invention releases the packet message only after confirming that the packet message has been received, thereby improving the reliability of message transmission.
[0134] Step S218: For each suspected lost packet packet, obtain the corresponding sending timestamp from the time ring according to the suspected lost packet packet sequence number, and if the time difference between the sending timestamp and the current time exceeds a preset duration, use the sequence number of the suspected lost packet packet as the sequence number of the packet to be retransmitted.
[0135] Understandably, if the message status bitmap contains bits indicating a "not received" status, the sequence number of each unreceived packet can be calculated using the NSN (Non-Received Number). These unreceived packets may include packets yet to be sent, packets already sent but still on the transmission link, or even lost packets. Therefore, it's necessary to identify the sequence number of each suspected lost packet based on the message status bitmap and further analyze these suspected lost packets to determine if packet loss has actually occurred.
[0136] It is understood that the processing method for each suspected lost packet is similar in this embodiment of the invention. The following explanation uses a suspected lost packet as an example. Based on the sequence number of the suspected lost packet, the corresponding sending timestamp is obtained from the time ring, and the time difference between the sending timestamp and the current time is calculated. If the time difference does not exceed a preset duration, it indicates that the suspected lost packet may still be on the transmission link, and therefore it will not be determined as a packet requiring retransmission. If the time difference exceeds the preset duration, it indicates that the suspected lost packet has been lost, and therefore the suspected lost packet will be treated as a packet to be retransmitted, thus obtaining the sequence number of the packet to be retransmitted.
[0137] Step S220: For each packet to be retransmitted, obtain the cache information stored in the corresponding buffer descriptor in the BD ring according to the sequence number of the packet to be retransmitted, and store the cache information in the preset retransmission queue.
[0138] Step S222: Based on each buffer information in the retransmission queue, retransmit each packet to be retransmitted, and update the sending timestamp of each packet to be retransmitted in the time ring.
[0139] In this embodiment, after obtaining the sequence number of the packet to be retransmitted, the cache information stored in the corresponding buffer descriptor in the BD ring is obtained according to the sequence number of the packet to be retransmitted, and the cache information is stored in the preset retransmission queue.
[0140] Then, based on the buffer information in the retransmission queue, each packet to be retransmitted is retransmitted, and a new transmission timestamp for each packet is obtained through a timer, and the new transmission timestamp is updated to the corresponding position in the time ring. This achieves selective retransmission of transmitted packets. Optionally, the retransmission queue can also be a FIFO queue.
[0141] It should be noted that when there is cached information in the retransmission queue, this embodiment of the invention will prioritize sending the packet to be retransmitted according to the cached information in the retransmission queue until the retransmission queue is empty, at which point the packet will be sent according to the write pointer of the BD ring.
[0142] Optionally, for step S214, this embodiment of the invention provides a possible implementation.
[0143] Step S214-1: Determine each first bit based on the value of each bit in the message status bitmap of the response information; the value of the first bit indicates the reception status as received.
[0144] Step S214-3: Determine each second bit based on the value of each bit in the message status bitmap of the response information and each first bit; the value of the second bit indicates a reception status of not received and at least one first bit exists among all bits higher than the second bit.
[0145] Step S214-5: For each first bit, calculate the sequence number of the corresponding received packet based on the first bit and the expected received sequence number, and obtain the sequence number of each received packet.
[0146] Step S214-7: For each second bit, calculate the sequence number of the corresponding suspected lost packet packet based on the second bit and the expected received sequence number, and obtain the sequence number of each suspected lost packet packet.
[0147] For ease of understanding, an example is provided in this embodiment of the invention. For instance, the message status bitmap in the response information is 0000000000110110, and the expected sequence number (NSN) is 1. Based on the value of each bit in the message status bitmap, each first bit is determined, and the obtained first bits are, in order: bit 1, bit 2, bit 4, and bit 5. The values of these first bits all indicate that the reception status is "received". Then, based on each first bit and the NSN (1), the sequence numbers of each received packet are, in order: 2, 3, 5, and 6.
[0148] Then, based on the value of each bit in the message status bitmap, each second bit is determined, resulting in bit 0 and bit 3. The values of these second bits all indicate that the reception status is "not received," and that a first bit exists among all bits higher than this second bit.
[0149] This can be understood as follows: for each second bit, if the peer device has received a packet sent after the packet with the sequence number corresponding to that second bit, but has not yet received the packet with the sequence number corresponding to that second bit, then it means that the packet with the sequence number corresponding to that second bit may have been lost. Therefore, based on each second bit and the NSN (1), we can calculate the sequence number of each suspected lost packet as follows: 1, 4.
[0150] To perform the corresponding steps in the above embodiments and various possible methods, an implementation of a message processing apparatus is given below. Please refer to... Figure 9 This is a functional block diagram of the message processing device provided in this embodiment of the invention. It should be noted that the message processing device 300 provided in this embodiment has the same basic principle and technical effects as those in the above embodiments. For the sake of brevity, any parts not mentioned in this embodiment can be referred to the corresponding content in the above embodiments. The message processing device 300 includes:
[0151] The caching module 310 is used to perform a caching operation on each received packet, and uses the starting address of the caching in the first ring RAM and the packet length as its caching information.
[0152] The update module 330 is used to update the value of the preset message status bitmap according to the sequence number of the packet message, and save the buffer information of the packet message to the preset buffer sequence; wherein, the value of the message status bitmap represents the reception status of N consecutive sequence number packet messages, and the buffer sequence is used to save the buffer information of N consecutive sequence number packet messages; N is an integer greater than or equal to 2.
[0153] The rearrangement module 350 is used to store each cached information into a preset receiving queue according to the value of the message status bitmap and the cache sequence, so that each cached information in the receiving queue is arranged according to the sequence number of each packet message, so as to reorder the multiple received packet messages.
[0154] Optionally, the cache module 310 is further configured to: obtain the start address of the current write pointed to by the write pointer of the first ring RAM, and obtain the end address of the last read pointed to by the read pointer of the first ring RAM; determine the storage state of the first ring RAM according to the start address of the current write and the end address of the last read; if the storage state of the first ring RAM is full, discard the packet; if the storage state of the first ring RAM is not full, cache the packet in the first ring RAM according to the start address of the current write, and use the start address of the current write as the cache start address of the packet.
[0155] Optionally, the update module 330 is further configured to: update the value of the bit corresponding to the sequence number of the packet in the message status bitmap, and save the buffer information of the packet to the buffer descriptor corresponding to the bit in the buffer sequence.
[0156] Optionally, the rearrangement module 350 is further configured to: obtain the current value of the least significant bit of the message status bitmap; when the current value of the least significant bit is the second value, use the buffer descriptor corresponding to the least significant bit in the buffer sequence as the target buffer descriptor, and use the buffer information stored in the target buffer descriptor as the target buffer information; determine the release flag of the target buffer information according to the value of each other bit of the message status bitmap, and after storing the target buffer information and its release flag in the receive queue, release the target buffer descriptor; wherein, the release flag is used to indicate whether to perform storage. Space release operation: By shifting the N buffer descriptors in the buffer sequence, the buffer descriptor at position (n+1) is moved to position (n) and the target buffer descriptor is placed at position (n). n is a natural number less than N. By shifting the values of the N bits in the message status bitmap, the value of the (n+1)th bit is moved to position (n) and the value of the Nth bit is set to the first value, a new message status bitmap is obtained. The process of obtaining the current value of the least significant bit of the message status bitmap is repeated until all buffer information is stored in the receive queue.
[0157] Optionally, the rearrangement module 350 is further configured to: use the first flag as a release flag for the target buffer information when the value of each other bit in the message status bitmap is the first value; and use the second flag as a release flag for the target buffer information when the value of each other bit in the message status bitmap contains at least one second value.
[0158] Optionally, the message processing device 300 further includes a retransmission module 370, configured to sequentially cache each packet to be sent into a second ring RAM according to its sequence number, and use the cache start address and message length of each packet as its cache information; for each packet to be sent, the cache information is saved to a buffer descriptor in a preset BD ring corresponding to the sequence number of the packet to be sent, and the sending timestamp of the packet to be sent is saved to a preset time ring corresponding to the sequence number of the packet to be sent; when an acknowledgment is received, the sequence number of each received packet and the sequence number of each suspected lost packet are determined according to the message status bitmap and expected received sequence number in the acknowledgment; for each received packet, the retransmission module 370 retrieves the packet from the BD ring according to the received packet sequence number. The process involves: acquiring the corresponding buffer descriptor; releasing the storage space in the second ring RAM used to cache received packets based on the cache information stored in the buffer descriptor; releasing the buffer descriptor after that; for each suspected lost packet sequence number, retrieving the corresponding sending timestamp from the time ring based on the sequence number of the suspected lost packet; if the time difference between the sending timestamp and the current time exceeds a preset duration, using the sequence number of the suspected lost packet as the sequence number of the packet to be retransmitted; for each packet to be retransmitted, retrieving the cache information stored in the corresponding buffer descriptor from the BD ring based on the sequence number of the packet to be retransmitted, and storing the cache information in a preset retransmission queue; retransmitting each packet to be retransmitted based on the cache information in the retransmission queue, and updating the sending timestamp of each packet to be retransmitted in the time ring.
[0159] Optionally, the retransmission module 370 is further configured to: determine each first bit according to the value of each bit in the message status bitmap of the response information; the value of the first bit indicates that the reception status is received; determine each second bit according to the value of each bit in the message status bitmap of the response information and each first bit; the value of the second bit indicates that the reception status is not received and at least one first bit exists among all bits higher than the second bit; for each first bit, calculate the sequence number of the corresponding received packet according to the first bit and the expected received sequence number to obtain the sequence number of each received packet; for each second bit, calculate the sequence number of the corresponding suspected lost packet according to the second bit and the expected received sequence number to obtain the sequence number of each suspected lost packet.
[0160] This invention also provides an FPGA for implementing the message processing method disclosed in this invention.
[0161] This invention also provides a communication device, including the FPGA provided in this invention.
[0162] In the several embodiments provided by this invention, it should be understood that the disclosed apparatus and methods can also be implemented in other ways. The apparatus embodiments described above are merely illustrative; for example, the flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods, and computer program products according to various embodiments of the invention. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than those marked in the drawings. For example, two consecutive blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram and / or flowchart, and combinations of blocks in block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or action, or using a combination of dedicated hardware and computer instructions.
[0163] In addition, the functional modules in the various embodiments of the present invention can be integrated together to form an independent part, or each module can exist independently, or two or more modules can be integrated to form an independent part.
[0164] If the aforementioned functions are implemented as software functional modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0165] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention. Various modifications and variations can be made to the present invention by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the scope of protection of the present invention.
Claims
1. A message processing method, characterized in that, Applied to an FPGA, wherein the FPGA includes a first ring RAM, the message processing method includes: For each received packet, a buffering operation is performed on the packet, and the buffer start address and packet length of the packet in the first ring RAM are used as its buffer information; The value of the preset message status bitmap is updated according to the sequence number of the packet, and the buffer information of the packet is saved to the preset buffer sequence; wherein, the value of the message status bitmap represents the reception status of N consecutively sequenced packets, and the buffer sequence is used to save the buffer information of N consecutively sequenced packets; N is an integer greater than or equal to 2. Based on the value of the message status bitmap and the cache sequence, each cached information is stored in a preset receiving queue, so that each cached information in the receiving queue is arranged according to the sequence number of each packet, so as to reorder the multiple received packets.
2. The message processing method according to claim 1, characterized in that, The step of caching the packet includes: Obtain the start address of the current write operation pointed to by the write pointer of the first ring RAM, and obtain the end address of the previous read operation pointed to by the read pointer of the first ring RAM; The storage state of the first ring RAM is determined based on the current write start address and the previous read end address; If the storage state of the first ring RAM is full, the packet is discarded; If the storage state of the first ring RAM is not full, the packet is cached in the first ring RAM according to the current write start address, and the current write start address is used as the cache start address of the packet.
3. The message processing method according to claim 1, characterized in that, The message status bitmap includes N bits, which represent the reception status of N consecutively sequenced packet messages. The buffer sequence includes N buffer descriptors, which are used to store the buffer information of a packet message. Each bit of the message status bitmap corresponds to the buffer descriptor at the same position in the buffer sequence. The steps of updating the value of the preset message status bitmap according to the sequence number of the packet and saving the cache information of the packet to the preset cache sequence include: In the message status bitmap, the value of the bit corresponding to the sequence number of the packet is updated, and the buffer information of the packet is saved to the buffer descriptor corresponding to the bit in the buffer sequence.
4. The message processing method according to claim 3, characterized in that, The arrangement of the N bits in the message status bitmap from least significant bit to most significant bit represents the arrangement order of the N packet messages; the value of each bit is either a first value or a second value, where the first value indicates that the reception status is not received, and the second value indicates that the reception status is received. The step of storing each piece of cached information into a preset receive queue based on the value of the message status bitmap and the cache sequence includes: Obtain the current value of the least significant bit of the message status bitmap; When the current value of the least significant bit is the second value, the buffer descriptor corresponding to the least significant bit in the cache sequence is used as the target buffer descriptor, and the cache information stored in the target buffer descriptor is used as the target cache information. Based on the value of each other bit in the message status bitmap, determine the release flag of the target buffer information, store the target buffer information and its release flag in the receive queue, and then release the target buffer descriptor; wherein, the release flag is used to indicate whether to perform a storage space release operation; By performing a shift operation on the N buffer descriptors in the cache sequence, the buffer descriptor at position (n+1) is moved to position n, and the target buffer descriptor is placed at position N; n is a natural number less than N; By shifting the values of N bits in the message status bitmap, the value of the (n+1)th bit is moved to the nth bit and the value of the Nth bit is set to the first value, a new message status bitmap is obtained. The step of obtaining the current value of the least significant bit of the message status bitmap is repeated until all buffered information is stored in the receive queue.
5. The message processing method according to claim 4, characterized in that, The release flag is either a first flag or a second flag, where the first flag indicates that a storage space release operation is performed, and the second flag indicates that a storage space release operation is not performed. The step of determining the release flag of the target buffer information based on the value of each other bit in the message status bitmap includes: When the value of each other bit in the message status bitmap is the first value, the first flag is used as the release flag for the target cache information; When at least one of the second values exists in the value of each other bit of the message status bitmap, the second flag is used as a release flag for the target cache information.
6. The message processing method according to claim 1, characterized in that, The FPGA further includes a second ring RAM, and the message processing method further includes: According to the sequence number of each packet to be sent, each packet to be sent is cached in the second ring RAM in sequence, and the cache start address and packet length of each packet to be sent are used as its cache information; For each packet to be sent, the buffer information of the packet to be sent is saved to the buffer descriptor corresponding to the sequence number of the packet to be sent in the preset BD ring, and the sending timestamp of the packet to be sent is saved to the position corresponding to the sequence number of the packet to be sent in the preset time ring. When a response message is received, the sequence number of each received packet and the sequence number of each suspected lost packet are determined based on the message status bitmap and expected sequence number in the response message. For each received packet sequence number, the corresponding buffer descriptor is obtained from the BD ring according to the received packet sequence number. After releasing the storage space in the second ring RAM used to cache the received packet according to the cache information stored in the buffer descriptor, the buffer descriptor is released. For each suspected lost packet packet, the corresponding sending timestamp is obtained from the time ring according to the sequence number of the suspected lost packet packet. If the time difference between the sending timestamp and the current time exceeds a preset duration, the sequence number of the suspected lost packet packet is used as the sequence number of the packet to be retransmitted. For each sequence number of the packet to be retransmitted, the cache information stored in the corresponding buffer descriptor in the BD ring is obtained according to the sequence number of the packet to be retransmitted, and the cache information is stored in the preset retransmission queue. Based on each cached information in the retransmission queue, each packet to be retransmitted is retransmitted, and the sending timestamp of each packet to be retransmitted is updated in the time ring.
7. The message processing method according to claim 6, characterized in that, The step of determining the sequence number of each received packet and the sequence number of each suspected lost packet based on the packet status bitmap and expected sequence number in the response information includes: Each first bit is determined based on the value of each bit in the message status bitmap of the response information; the value of the first bit indicates the reception status as received. Each second bit is determined based on the value of each bit in the message status bitmap of the response information and each first bit; the receiving status represented by the value of the second bit is not received and at least one first bit exists among all bits higher than the second bit. For each of the first bits, the sequence number of the corresponding received packet is calculated based on the first bit and the expected received sequence number, thus obtaining the sequence number of each received packet. For each of the second bits, the sequence number of the corresponding suspected lost packet is calculated based on the second bit and the expected received sequence number, thus obtaining the sequence number of each suspected lost packet.
8. A message processing apparatus, characterized in that, Applied to an FPGA, the FPGA including a first ring RAM, the message processing device includes: The caching module is used to perform a caching operation on each received packet, and use the starting address of the caching in the first ring RAM and the packet length as its caching information; An update module is used to update the value of a preset message status bitmap according to the sequence number of the packet, and save the cache information of the packet to a preset cache sequence; wherein, the value of the message status bitmap represents the reception status of N consecutively sequenced packets, and the cache sequence is used to save the cache information of N consecutively sequenced packets; where N is an integer greater than or equal to 2. The reordering module is used to store each cached information into a preset receiving queue according to the value of the message status bitmap and the cache sequence, so that each cached information in the receiving queue is arranged according to the sequence number of each packet message, so as to reorder the multiple received packet messages.
9. An FPGA, characterized in that, Used to implement the message processing method according to any one of claims 1 to 7.
10. A communication device, characterized in that, Including the FPGA as described in claim 9.
