Method and apparatus for solving the problem of segmented transmission in a WLAN
Technical Field
The invention relates to the field of network communication, in particular to a method and a device for solving the problem of segmented transmission of MSDU/MMPDU in a WLAN.
Background
In the wireless lan, in order to improve reliability due to a complicated network environment, the MSDU or MMDU needs to be decomposed into a plurality of fragments of a small length for transmission, and this procedure is called fragmentation. The length of the segment is controlled by a segment threshold value aFragmentationThreshold. Each fragment consists of two parts, a frame header and a frame body, wherein the frame header is copied from the MSDU/MMPDU, but the fragment sequence number field and the multi-fragment field in the frame header need to be set. The segment sequence number field of the first segment is 0, and the subsequent segments are sequentially increased by 1. The multi-segment field of all the segments is set to 1 except for the multi-segment field of the last segment which is set to 0.
Referring to FIG. 1, a MSDU/MMPDU divided into three segments is shown.
The protocol specifies that for each MSDU/MMPDU sent, the system should maintain a series of counters and timers for management for it, regardless of how many fragments it is broken into. The protocol also provides that for fragmented MSDU/MMPDU, transmission should be performed fragment by fragment starting from the 1 st fragment, and if transmission of a certain fragment fails, transmission is continued from the fragment after the channel is acquired next time. Until all fragments are sent out or some management counter of MSDU/MMPDU reaches a threshold. The protocol specifies that for each MSDU/MMPDU sent, the system should maintain a series of counters and timers for management for it, regardless of how many fragments it is broken into.
Referring to FIG. 2, a fragmented transmission process for an MSDU/MMPDU divided into three fragments is shown.
According to the protocol definition, the current realization method of segmented transmission is to segment the received MSDU/MMPDU and then transmit.
Referring to fig. 3, this figure shows an internal structural schematic of such an implementation.
The segmentation process for this implementation is as follows:
(1) when an MSDU/MMPDU is received, a management structure is defined for it, which contains MSDU/MMPDU related management counters and timers, a total fragment number register, a current fragment register, and a fragment array register for pointing to each fragment. The segment array register is pre-divided into a number of records, each of which will point to a segment according to the segmentation situation.
(2) And judging whether the frame body length exceeds a segmentation threshold value defined in the aFragmentationThreshold, if not, turning to (3), otherwise, turning to (4).
(3) Setting the total segment number register as 1, and pointing the first record in the segment array register group to the MSDU/MMPDU. And (7) turning.
(4) Setting the segment length equal to aFragmentationThreshold, and calculating the total number of segments according to the segment length. The total number of segments register is set to the total number of segments. Setting a segment counter with a value of 0; a segment address register is set, the value is the starting address of the frame body, go (5).
(5) And allocating a section of memory, and pointing the current record of the segmented array register to the starting address of the section of memory. Then copying the frame header of MSDU/MMPDU to the beginning of the fragment, and setting the fragment sequence number field and the multi-fragment field. Then, copying data with the length of the segment length to the memory from the address in the segment address register, and increasing the value of the segment address register by the segment length; the segment counter is incremented by 1. And judging whether the segment counter is equal to the total segment number of-1, if so, turning to (6), and otherwise, turning to (6).
(6) The remaining data is formed into the last segment, and its multi-segment field is set to 0. And (7) turning.
(7) And setting the current segmentation register as the sequence number of the first record, and transmitting the MSDU/MMPDU. After each segment is successfully sent, the current segment register is incremented by 1. Until the current register equals the value of the total fragmentation register, or some management counter of the MSDU/MMPDU reaches a threshold.
From the above-described composition structure and segmentation process, it can be known that the present method is a method of transmitting after segmenting. Has the following disadvantages:
memory replication is performed at each segmentation, which requires hardware to have a corresponding swap memory space, resulting in an increase in memory on the hardware chip.
The memory copy is performed at each segmentation, which consumes corresponding processing power and power consumption.
After MSDU/MMPDU is segmented, the total occupied space of the MSDU/MMPDU increases along with the increase of the number of segments.
According to the protocol, there can be 15 segments at most, and then 15 recorded segment array registers need to be pre-allocated, which also results in an increase in on-chip memory.
Disclosure of Invention
The present invention implements a method and apparatus different from the above that uses a side-transmit-side-fragmentation strategy for fragmented transmission of WLAN MSDUs/MMPDUs with two fragmented data structures. The invention improves the original method and can effectively solve the problems existing in the original method.
The invention discloses a hardware component, comprising: a transmit buffer TxBuff; a transmission controller; a segmented data structure; a segmented transmit data structure; a transmit FIFO, and a FIFO controller. Wherein,
the sending buffer area is used for storing MSDU/MMPDU to be sent;
the transmission controller is used for segmenting the MSDU/MMPDU and requiring the FIFO controller to transmit the segments;
the segmentation data structure consists of a series of registers and is used for recording the segmentation state of the MSDU/MMPDU; these registers include:
(1) MSDU/MMPDU start address register: recording the start address of the received MSDU/MMPDU in a sending buffer area, wherein the local address is the frame header start address of the MSDU/MMPDU;
(2) frame header length register: recording the frame header length of MSDU/MMPDU;
(3) segment length register: obtaining the length of the segment according to a segment threshold value aFragmentationThreshold;
(4) a segment total register: the total number of fragments obtained according to fragment length is recorded, and for MSDU/MMPDU which does not reach the threshold value, this value is 1.
(5) Current segment address register: the start address of the current segment of the MSDU/MMDPU in the send buffer is recorded.
(6) A segment counter: the sequence number of the next transmission of a segment is recorded, i.e. the next time the segment will be transmitted. The initialization is 1.
The segmented sending data structure consists of a series of registers and is used for recording the sending state of the segmented data; the register includes:
(1) a transmission address register: the address of the data byte currently to be sent is recorded.
(2) Sending frame header length register: the length of the transmitted frame header is recorded.
(3) Transmit data address register: the start address of the body part of the frame being transmitted, i.e. the start address of the segment currently to be transmitted in the present invention, is recorded. And 0 if the frame does not include a frame body, i.e., a data portion.
(4) A transmission length register: the sum of the frame header length and the frame body length of the frame to be sent at this time is recorded.
(5) A transmission length counter: the number of bytes that have been currently transmitted is recorded. The initialization is 0.
The FIFO is used for storing and sending data byte by byte and sending the data out;
and the FIFO controller is used for controlling the sending of the segmented data and returning a sending state to the sending controller.
The invention also discloses a method for transmitting MSDU/MMDU in WLAN in sections, which is used for establishing the relation among the above components and improving the defects of the original section transmitting method. The method comprises the following steps:
(1) the upper layer requires to transmit MSDU/MMPDU, which is put into the transmit buffer.
(2) The sending controller sets the corresponding register in the segment data structure for the MSDU/MMPDU, obtains the segment length according to the segment threshold value aFragmentationThreshold, then calculates the total number of segments, sets the current segment address register as the frame body head address, and sets the segment counter as 1. Judging whether the total number of the fragments is equal to 1, if so, setting a sequence number field of the fragments in the frame header of the MSDU/MMPDU to be 0, and setting a multi-fragment field to be 0; otherwise, the segment sequence number field is set to 0 and the multi-segment field is set to 1.
(3) Filling corresponding registers in a segmented transmission data structure, and setting a transmission address register value as an MSDU/MMPDU starting address register; the length register of the sending frame is the frame length; the sending data address register is the current segment starting address; the sending length register is the sum of the frame header length and the length of the current segment; the transmission length counter is 0.
(4) The transmission controller sends out a data transmission request signal.
(5) The FIFO controller, upon receiving the signal, waits until a channel acquisition signal arrives.
(6) And the FIFO controller reads the sending address register to obtain a sending address.
(7) The FIFO controller fetches a byte of data from the transmit buffer pointed to by the transmit address into the FIFO.
(8) The FIFO controller then sends the data out.
(9) After the data is successfully transmitted, the transmission counter is increased by 1, and the transmission address is increased by 1. Then judging whether the sending length is equal to the sending frame header length, if so, turning to (7); if so, it is determined whether it is equal to the value of the transmit length register, if less, go (10), otherwise go (11). If the transmission is in error, go to (12).
(10) The FIFO controller reads the starting address register of the sending data to obtain the starting address of the segmented data, and sets the sending address register as the address. And (7) turning.
(11) Sending a sending completion signal, after the sending control receives the signal, adding 1 to a segment counter, judging whether the number of the segments is greater than the total number of the segments, if so, indicating that all the segments of the MSDU/MMPDU are sent completely, and ending the process; if yes, setting the value of the current segmentation address register as the original value plus the segmentation length, setting the segmentation sequence number field in the frame header of the MSDU/MMPDU as the value of the segmentation counter minus 1, setting the multi-segmentation field as 0, and then turning to (3); if the value is smaller than the preset value, setting the value of the current segmentation address register as the original value plus the segmentation length, setting the segmentation sequence number field in the frame header of the MSDU/MMPDU as the value of the segmentation counter minus 1, setting the multi-segmentation field as 1, and turning to (3).
(12) If the transmission process is wrong, the registers in the segmented structure are kept unchanged, and then (3) is carried out.
As can be seen from the above-described steps, the present invention does not fragment the MSDU/MMPDU first, but instead fragments the MSDU/MMPDU during transmission by setting up two structures. And for MSDU/MMPDU which does not reach the fragmentation threshold, performing consistency processing as the case of only one fragment. If failure occurs during transmission, the state of keeping in the two structures can ensure that the segmentation and transmission are continued after the channel is obtained next time.
Compared with the original method, the method can effectively reduce the consumption of the storage area and the data copying, thereby reducing the cost and the power consumption.
The invention has the following advantages:
the invention does not have a separate segmentation process, but carries out segmentation while sending, thereby improving the communication efficiency.
The invention does not have the process of segment data copying, but is realized by using the address pointed by the changed address pointer, so the memory space does not need to be exchanged, and the size of the on-chip memory is reduced.
The invention has no data copying process, and reduces the corresponding processing consumption and power consumption.
The invention reduces the use of registers by pre-allocating the segmented array.
By the above reduction in space and processing power, hardware cost and power consumption are reduced.
Drawings
FIG. 1 is a schematic diagram of an MSDU/MMPDU broken into three fragments;
FIG. 2 is a schematic diagram of MSDU/MMPDU fragmentation transmission;
FIG. 3 is a schematic diagram of an implementation structure using a segment-first and then-send strategy;
fig. 4 is a schematic diagram of the internal structure of the implementation of the present invention.
Fig. 5 is a process diagram of implementing the segment transmitting method of the present invention based on fig. 4.
Detailed Description
The invention may be embodied in the form of structures and principles substantially as shown and described herein.
The present invention will be described in detail below with reference to the accompanying drawings.
Please refer to fig. 4, which is a schematic diagram of a hardware component structure implemented by the present invention according to the above-mentioned inventive principle. According to this schematic, the hardware component comprises: a transmit buffer TxBuff; a transmission controller; a segmented data structure; a segmented transmit data structure; a transmit FIFO, and a FIFO controller. Wherein,
the sending buffer area is used for storing MSDU/MMPDU to be sent;
the transmission controller is used for segmenting the MSDU/MMPDU and requiring the FIFO controller to transmit the segments;
the segmentation data structure consists of a series of registers and is used for recording the segmentation state of the MSDU/MMPDU; these registers include:
(1) MSDU/MMPDU start address register: recording the start address of the received MSDU/MMPDU in a sending buffer area, wherein the local address is the frame header start address of the MSDU/MMPDU;
(2) frame header length register: recording the frame header length of MSDU/MMPDU;
(3) segment length register: obtaining the length of the segment according to a segment threshold value aFragmentationThreshold;
(4) a segment total register: the total number of fragments obtained according to fragment length is recorded, and for MSDU/MMPDU which does not reach the threshold value, this value is 1.
(5) Current segment address register: the start address of the current segment of the MSDU/MMDPU in the send buffer is recorded.
(6) A segment counter: the sequence number of the next transmission of a segment is recorded, i.e. the next time the segment will be transmitted. The initialization is 1.
The segmented sending data structure consists of a series of registers and is used for recording the sending state of the segmented data; the register includes:
(1) a transmission address register: the address of the data byte currently to be sent is recorded.
(2) Sending frame header length register: the length of the transmitted frame header is recorded.
(3) Transmit data address register: the start address of the body part of the frame being transmitted, i.e. the start address of the segment currently to be transmitted in the present invention, is recorded. And 0 if the frame does not include a frame body, i.e., a data portion.
(4) A transmission length register: the sum of the frame header length and the frame body length of the frame to be sent at this time is recorded.
(5) A transmission length counter: the number of bytes that have been currently transmitted is recorded. The initialization is 0.
The FIFO is used for storing and sending data byte by byte and sending the data out;
and the FIFO controller is used for controlling the sending of the segmented data and returning a sending state to the sending controller.
Referring to fig. 4, a specific flow of MSDU/MMPDU fragment transmission using the above-described hardware components is described, which includes the following steps,
(1) the upper layer requires to transmit MSDU/MMPDU, which is put into the transmit buffer.
(2) The sending controller sets the corresponding register in the segment data structure for the MSDU/MMPDU, obtains the segment length according to the segment threshold value aFragmentationThreshold, then calculates the total number of segments, sets the current segment address register as the frame body head address, and sets the segment counter as 1. Judging whether the total number of the fragments is equal to 1, if so, setting a sequence number field of the fragments in the frame header of the MSDU/MMPDU to be 0, and setting a multi-fragment field to be 0; otherwise, the segment sequence number field is set to 0 and the multi-segment field is set to 1.
(3) Filling corresponding registers in a segmented transmission data structure, and setting a transmission address register value as an MSDU/MMPDU starting address register; the length register of the sending frame is the frame length; the sending data address register is the current segment starting address; the sending length register is the sum of the frame header length and the length of the current segment; the transmission length counter is 0.
(4) The transmission controller sends out a data transmission request signal.
(5) The FIFO controller, upon receiving the signal, waits until a channel acquisition signal arrives.
(6) And the FIFO controller reads the sending address register to obtain a sending address.
(7) The FIFO controller fetches a byte of data from the transmit buffer pointed to by the transmit address into the FIFO.
(8) The FIFO controller then sends the data out.
(9) After the data is successfully transmitted, the transmission counter is increased by 1, and the transmission address is increased by 1. Then judging whether the sending length is equal to the sending frame header length, if so, turning to (7); if so, it is determined whether it is equal to the value of the transmit length register, if less, go (10), otherwise go (11). If the transmission is in error, go to (12).
(10) The FIFO controller reads the starting address register of the sending data to obtain the starting address of the segmented data, and sets the sending address register as the address. And (7) turning.
(11) Sending a sending completion signal, after the sending control receives the signal, adding 1 to a segment counter, judging whether the number of the segments is greater than the total number of the segments, if so, indicating that all the segments of the MSDU/MMPDU are sent completely, and ending the process; if yes, setting the value of the current segmentation address register as the original value plus the segmentation length, setting the segmentation sequence number field in the frame header of the MSDU/MMPDU as the value of the segmentation counter minus 1, setting the multi-segmentation field as 0, and then turning to (3); if the value is smaller than the preset value, setting the value of the current segmentation address register as the original value plus the segmentation length, setting the segmentation sequence number field in the frame header of the MSDU/MMPDU as the value of the segmentation counter minus 1, setting the multi-segmentation field as 1, and turning to (3).
(12) If an error occurs in the transmission process, each register in the segmentation structure is kept unchanged, and then the step (3) is carried out to wait for obtaining the channel for transmission next time.
The above disclosure is only for a few specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any variations that can be made by those skilled in the art are intended to fall within the scope of the present invention.