Frame fragment aggregation packaging method based on FPGA (Field Programmable Gate Array)
By implementing the frame shard aggregation and packaging method on the FPGA, a small number of data frames and frame length are cached, which solves the transmission efficiency problems when the frame length is too long and multi-frame access channels in wireless laser communication, and achieves more efficient data transmission.
Patent Information
- Application Number
- CN202510281661.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-11
- Publication Date
- 2025-06-24
AI Technical Summary
In wireless laser communication, the prior art has the problem that the frame length is too long during data packet transmission, resulting in weakening of anti-interference capability. At the same time, multiple data frames need to be cached when accessing channels at the same time, resulting in a reduction in transmission efficiency.
A frame shard aggregation and packaging method based on FPGA is proposed, which efficiently processes physical frame packaging by cacheing a small number of data frames and frame lengths, and reduces filling redundancy by aggregating the last frame and subsequent short frames of the shard.
Through multi-level judgment and individually cache frame length, the integrity and efficiency of frame packaging are achieved, transmission overhead and filling redundancy are reduced, and system throughput is improved.
Smart Images

Figure CN120200712A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of wireless laser communication, and in particular relates to a frame fragmentation aggregation packaging method based on FPGA. Background Art
[0002] In wireless laser communication, in order to improve communication transmission efficiency, multiple short data packets can be aggregated into a large data packet, sharing the physical layer header, reducing the overhead of the transmission process, and improving the throughput and transmission efficiency of the system. In addition, since the anti-interference ability will be weakened when the frame length is too long, there is a maximum transmission unit limit in data transmission. When the data packet exceeds the maximum transmission unit, the data packet needs to be fragmented and sent as multiple short data packets.
[0003] To achieve the above encapsulation effect, multiple data frames need to access the channel at the same time. The number of aggregated frames or frame fragments is determined by the frame length data of multiple data packet headers. Due to the characteristics of FPGA pipeline operation, the simultaneous access of multiple data frames often means that more data frames need to be cached. In addition, when shorter data fragments appear, filling them into separate physical frames will cause certain redundancy and reduce transmission efficiency. Summary of the invention
[0004] The purpose of the present invention is to overcome the above-mentioned shortcomings and propose a frame fragment aggregation encapsulation method, which efficiently processes physical frame encapsulation by caching a small amount of data frames and frame lengths, and reduces padding redundancy by aggregating the last frame of the fragment and subsequent short frames.
[0005] According to the technical solution provided by the present invention, a frame fragment aggregation encapsulation method based on FPGA includes the following steps:
[0006] Step 1), cache service data, cache frame data and frame length information respectively, and set the physical frame encapsulation length to n bytes;
[0007] Step 2), read the current data frame and the subsequent data frame length, and determine the operation on the service data: if the sum of the first frame length and the frame header check bit is greater than n, go to step 4) for operation; if the sum of the first frame length and the frame header check bit is less than n, then judge the sum of the first two frame lengths, if the sum of the first two frame lengths and the frame header check bit is less than n, then go to step 3) for operation; if the sum of the first two frame lengths and the frame header check bit is greater than n, then go to step 5) for operation;
[0008] Step 3), when the length of the third frame does not overflow, the second frame is aggregated into the current physical frame, and the second frame is used as the current data frame, and the length of one frame is pre-read, and the above operation is repeated; if it overflows, the second frame is determined to be the last frame of the current physical frame, and when the current data frame is encapsulated and the last frame is aggregated, the process goes to step 5);
[0009] Step 4), encapsulate the first n bytes of the current data frame, and determine whether the sum of the remaining length s of the current data frame and the frame header check bits is greater than n. If it is greater, encapsulate the current physical frame, subtract the current fragmentation length from the remaining length of the data frame, and repeat the above operations; if it is equal to n, after encapsulating the current physical frame, when starting to encapsulate the last data frame fragment, mark the number of fragments and then transfer to Step 5); if it is less than n, continue to determine whether the sum of the remaining length of the current data frame, the length of the next data frame, and the frame header check bits is greater than n. If it is greater than n, when starting to encapsulate the last data frame fragment after encapsulating the current physical frame, mark the number of fragments and then transfer to Step 5. If it is not greater than n, after encapsulating the current physical frame, transfer to Step 3 when starting to encapsulate the last data frame fragment;
[0010] Step 5), encapsulate the current data frame. If there is still space in the physical frame, fill the fields to the full physical frame length, complete the encapsulation of the physical frame, and transfer to Step 2) to prepare for the encapsulation of the next physical frame.
[0011] As a further improvement of the present invention, the specific operation of reading the lengths of the current data frame and subsequent data frames in Step 2) is as follows: read the frame length fifo according to the frame length pre-reading status. If the readable data in the fifo is not less than 3, pre-read the lengths of the first 3 frames, with the current frame as the length L1 of the first frame, the length L2 of the second frame, and the length L3 of the third frame. If the readable data in the fifo is not 0 and less than 3, mark the number of read frame lengths after reading it empty. If the fifo is empty, wait for the next frame of data.
[0012] As a further improvement of the present invention, the standard for the third frame length not overflowing in Step 3) is that the sum of the second frame L2, the length L3 of the third frame, and the frame header check bits is not greater than the remaining length m of the physical frame data segment.
[0013] As a further improvement of the present invention, the specific operation of pre-reading the length of one frame in Step 3) is as follows: if the frame length fifo is not empty, the frame length pre-reading status remains unchanged. If the fifo is empty, mark the frame length pre-reading status as having pre-read one frame.
[0014] The beneficial effects of the present invention are as follows:
[0015] Through multi-level judgment, the encapsulation completely covers four cases: only fragmentation, only aggregation, simultaneous presence of fragmentation and aggregation, and separate encapsulation into frames. And in any case, the encapsulation of the physical frame ends with the encapsulation of the last frame in Step 5 and filling as needed, ensuring the integrity of the frame encapsulation. At the same time, by separately caching the frame length and marking the frame length pre-reading status, the frame encapsulation judgment operation can be simplified, and the encapsulation error caused by reading more or less frame length data can be avoided.
[0016] Make full use of the advantage of the efficient operation of the FPGA pipeline. By separately caching the data frame length, only a small number of data frames need to be cached (at most only 3 frames) to complete the fragmentation, aggregation, and encapsulation of data frames. At the same time, short data frames and the last frames of fragments are aggregated to make full use of the physical frame space, reduce transmission overhead and padding redundancy, and improve system throughput. Description of the Drawings
[0017] Figure 1 It is a flowchart of the method of the present invention.
[0018] Figure 2 It is an example of data frame encapsulation. Detailed Embodiments
[0019] The present invention will be further described below in conjunction with the embodiments in the drawings:
[0020] As shown in the figure, a method for fragmenting, aggregating, and encapsulating frames based on FPGA includes the following steps:
[0021] Step 1), cache service data, cache frame data and frame length information respectively, and set the physical frame encapsulation length to n bytes;
[0022] Step 2), read the lengths of the current data frame and subsequent data frames, and judge the operation on the service data:
[0023] The specific operation of reading the lengths of the current data frame and subsequent data frames is as follows: read the frame length fifo according to the frame length pre-reading status. If the readable data in the fifo is not less than 3, pre-read the lengths of the first 3 frames, take the current frame as the first frame length L1, the second frame length L2, and the third frame length L3. If the readable data in the fifo is not 0 and less than 3, mark the number of read frame lengths after reading it empty. If the fifo is empty, wait for the next frame of data;
[0024] If the sum of the length of the first frame and the frame header check bit is greater than n, go to step 4) for operation; if the sum of the length of the first frame and the frame header check bit is less than n, judge the sum of the lengths of the first two frames. If the sum of the lengths of the first two frames and the frame header check bit data sum is less than n, go to step 3) for operation; if the sum of the lengths of the first two frames and the frame header check bit is greater than n, go to step 5) for operation;
[0025] Step 3), when the length of the third frame does not overflow and the sum of the length of the second frame L2, the length of the third frame L3, and the frame header check bit is not greater than the remaining length m of the physical frame data segment, aggregate the second frame into the current physical frame, and use the second frame as the current data frame. Then pre-read the length of one frame. That is, if the frame length fifo is not empty, the frame length pre-read status remains unchanged; if the fifo is empty, mark the frame length pre-read status as having pre-read one frame, and repeat the above operations. If it overflows, determine that the second frame is the last frame of the current physical frame. After encapsulating the current data frame and starting to aggregate the last frame, go to Step 5).
[0026] Step 4), take the first n bytes of the current data frame for encapsulation, and determine whether the sum of the remaining length s of the current data frame and the frame header check bit is greater than n. If it is greater, encapsulate the current physical frame, and repeat the above operations after subtracting the current shard length from the remaining length of the data frame. If it is equal to n, after encapsulating the current physical frame, when starting to encapsulate the last data frame shard, mark the number of shards and then go to Step 5). If it is less than n, continue to determine whether the sum of the remaining length of the current data frame, the length of the next data frame, and the frame header check bit is greater than n. If it is greater than n, after encapsulating the current physical frame and starting to encapsulate the last data frame shard, mark the number of shards and then go to Step 5). If it is not greater than n, after encapsulating the current physical frame, when starting to encapsulate the last data frame shard, go to Step 3).
[0027] Step 5), encapsulate the current data frame. If there is still space in the physical frame, fill the fields to the complete physical frame length, complete the physical frame encapsulation, and go to Step 2) to prepare for the encapsulation of the next physical frame.
[0028] Embodiment
[0029] Assume that the physical frame length is 1000 bytes, the length of the first frame of the service data frame is 2100 bytes, the length of the second frame is 400 bytes, the length of the third frame is 600 bytes, the length of the fourth frame is 1000 bytes, the frame header length is 5 bytes, the optional field (frame aggregation option) is 0 or 4 bytes, the check bit is 2 bytes, the bytes of the current data frame that have been encapsulated is data_cnt, and the bytes of the current physical frame that have been encapsulated is flame_cnt.
[0030] Perform Step 1, cache the service data and frame length information, and set the physical frame length n = 1000.
[0031] Perform Step 2. Since the frame length has not been pre-read currently, read the frame length fifo 3 times to obtain the lengths of the first 3 frames, L1 = 2100, L2 = 400, L3 = 600, and mark that 3 frames have been pre-read. Determine the length of the service data frame. The length of the first frame L1 = 2100 bytes > the physical frame length n = 1000 bytes, and go to Step 4 for frame sharding.
[0032] According to Step 4, the current data frame is encapsulated with data_cnt = 1000 bytes. Since L1 - data_cnt = 1100 > 1000, that is, the unencapsulated part of the data frame is still greater than 1000 bytes of the physical frame length, Step 3 is repeated.
[0033] According to Step 4, the current data frame has been encapsulated with data_cnt = 1000 + 1000 = 2000 bytes. Since L1 - data_cnt + L2 + frame header + optional field + check bit = 518 < 1000, it transfers to Step 3 for frame aggregation.
[0034] According to Step 3, the current physical frame has been encapsulated with flame_cnt = 109 bytes. Since flame_cnt + L2 + L3 + frame header + optional field + check bit > 1000, that is, the remaining space after encapsulating the current frame is less than the length of the third frame. The second data frame is the last frame aggregated within the current physical frame. Mark that there is no frame aggregation option when encapsulating this frame. After encapsulating the current frame, transfer to Step 5 and modify the marked pre - read frame count to 1 frame.
[0035] According to Step 5, there are still 500 bytes of space remaining in the physical frame after encapsulating the second data frame. Perform padding processing on it and transfer to Step 2.
[0036] According to Step 2, since only 1 frame length has been pre - read currently, read the frame length fifo twice to obtain the length of the fourth frame as 1000, and the length of the fifth frame is empty. Mark that two frames have been pre - read. Since the current frame length is 600 bytes, which is less than the physical frame length but the sum with the next frame length is greater than 1000, directly transfer to Step 5 to perform padding processing on the current frame.
Claims
1. A frame fragment aggregation encapsulation method based on FPGA, characterized in that: The following steps are involved: Step 1), cache service data, cache frame data and frame length information respectively, and set the physical frame encapsulation length to n bytes; Step 2), read the current data frame and the subsequent data frame length, and determine the operation on the service data: if the sum of the first frame length and the frame header check bit is greater than n, go to step 4) for operation; if the sum of the first frame length and the frame header check bit is less than n, then judge the sum of the first two frame lengths, if the sum of the first two frame lengths and the frame header check bit is less than n, then go to step 3) for operation; if the sum of the first two frame lengths and the frame header check bit is greater than n, then go to step 5) for operation; Step 3), when the length of the third frame does not overflow, the second frame is aggregated into the current physical frame, and the second frame is used as the current data frame, and the length of one frame is pre-read, and the above operation is repeated; if it overflows, the second frame is determined to be the last frame of the current physical frame, and when the current data frame is encapsulated and the last frame is aggregated, the process goes to step 5); Step 4), take the first n bytes of the current data frame for encapsulation, and determine whether the sum of the remaining length s of the current data frame and the frame header check bit is greater than n. If so, encapsulate the current physical frame, and repeat the above operation after deducting the current fragment length from the remaining length of the data frame; if equal to n, after encapsulating the current physical frame, when starting to encapsulate the last data frame fragment, mark the number of fragments and proceed to step 5); if less than n, continue to determine whether the sum of the remaining length of the current data frame and the next data frame length and the frame header check bit is greater than n. If so, after encapsulating the current physical frame, when starting to encapsulate the last data frame fragment, mark the number of fragments and proceed to step 5); if not greater than n, after encapsulating the current physical frame, when starting to encapsulate the last data frame fragment, proceed to step 3); Step 5), encapsulate the current data frame. If there is still space in the physical frame, fill the field to the complete physical frame length, complete the physical frame encapsulation, and go to step 2) to prepare for the next physical frame encapsulation.
2. The FPGA-based frame fragment aggregation and encapsulation method according to claim 1, characterized in that: The specific operation of reading the length of the current data frame and the subsequent data frame in the step 2) is: read the frame length fifo according to the frame length pre-reading status, if the fifo readable data is not less than 3, then pre-read the first 3 frame lengths, with the current frame as the first frame length L1, the second frame length L2, and the third frame length L3, if the readable data in the fifo is not 0 and less than 3, then mark the number of read frame lengths after reading empty, if the fifo is empty, wait for the next frame data.
3. The FPGA-based frame fragment aggregation and encapsulation method according to claim 1, characterized in that: The criterion for the third frame length not overflowing in the step 3) is that the sum of the second frame L2 and the third frame length L3 and the frame header check bit is not greater than the remaining length m of the physical frame data segment.
4. The FPGA-based frame fragment aggregation and encapsulation method according to claim 1, characterized in that: The specific operation of pre-reading a frame length in step 3) is: if the frame length fifo is not empty, the frame length pre-reading state remains unchanged; if the fifo is empty, the frame length pre-reading state is marked as having pre-read one frame.