A data encapsulation method, computer-readable storage medium and gateway

Through DMA technology and adaptive MODCOD adjustment, efficient processing of data encapsulation in forward satellite networks is achieved, solving the problems of complex logic and low efficiency of traditional methods, and improving system throughput and channel utilization.

CN115834724BActive Publication Date: 2024-08-23SPACE ENG NETWORK TECH DEV (HANGZHOU) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211458288.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-17
Publication Date
2024-08-23
Estimated Expiration
2042-11-17

AI Technical Summary

Technical Problem

Traditional data encapsulation methods are logically complex and inefficient in forward satellite networks, making it difficult to meet the needs of efficient data transmission.

Method used

DMA technology is used to load the protocol data unit into the transport container, and the encapsulation package is generated by linking the GSE header information and the base frame header to achieve zero copy of the memory, separate data plane and control plane processing, and adaptively adjust MODCOD to optimize channel utilization.

Benefits of technology

It improves system throughput and packaging efficiency, reduces memory fragmentation, rationally utilizes physical transmission channel resources, reduces padding ratio, and improves channel utilization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115834724B
    Figure CN115834724B
Patent Text Reader

Abstract

The present invention relates to a data encapsulation method, a computer-readable storage medium and a gateway, which aims to solve the problems of complex logic and low efficiency during data encapsulation. To this end, the method of the present invention includes the following steps: loading the protocol data unit from the network layer into a transport container through DMA and placing it in a GSE queue to be encapsulated; filling in the header information of the GSE according to the protocol data unit information, so that the GSE header and the protocol data unit are linked to generate a GSE encapsulation package; linking the header of the base frame band with multiple GSE encapsulation packages to generate a base frame band encapsulation package. The present invention completes data encapsulation by linking the header of the base frame band with multiple headers filled with protocol data unit information through DMA, realizing zero copy of memory, reducing memory fragmentation of the container memory pool, improving memory allocation efficiency, simple logic, and high system throughput.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data transmission, and specifically provides a data encapsulation method, a computer-readable storage medium and a gateway. Background Art

[0002] Figure 1 The figure shows the architecture of the forward satellite network. The main network elements of the forward satellite network include: Internet, IP gateway (as network layer), Layer 2 forward gateway (as data link layer), modem (as physical layer), satellite and user terminal (hereinafter referred to as UT). Data from the Internet is forwarded to the Layer 2 forward gateway via the IP gateway. The Layer 2 forward gateway encapsulates the data after receiving it and forwards the modulated data to the user terminal via the air link.

[0003] The Layer 2 forward gateway encapsulates the data sent from the IP gateway to the user through a link. It first performs GSE encapsulation, then encapsulates it into an appropriate baseband frame (hereinafter referred to as BBFrame), and sends it to the physical layer modulation board through the air interface to the user terminal. The purpose of the Layer 2 forward gateway is to form a BBFrame for the user's IP data packet according to the rules of DVB S2 / S2X and send it to the physical layer hardware modem. GSE is a data encapsulation mechanism at the data link layer, which is suitable for broadcast communications on the forward link. Traditional data encapsulation uses a method based on data copying and splicing, which has the disadvantages of complex logic and low efficiency. Summary of the invention

[0004] In order to overcome the above-mentioned defects, the present invention is proposed to provide a data encapsulation method that solves or at least partially solves the technical problem of how to achieve simpler logic and higher efficiency.

[0005] In a first aspect, the present invention provides a data encapsulation method, the method comprising:

[0006] The protocol data unit from the network layer is loaded into the transport container through DMA and placed in the GSE encapsulation queue;

[0007] Fill in the GSE header information according to the protocol data unit information, so that the GSE header and the protocol data unit are linked to generate a GSE encapsulation package;

[0008] The header of the base frame band is linked with multiple GSE encapsulation packets to generate a base frame band encapsulation packet.

[0009] In one embodiment, before the protocol data unit from the network layer is loaded into the transport container by DMA and placed in the GSE to-be-encapsulated queue, the method further comprises:

[0010] The protocol data units are divided into first-category protocol data units and second-category protocol data units according to the control plane queue and the data plane queue.

[0011] In one embodiment, the method further comprises:

[0012] Compare the capacity length of the protocol data unit MODCOD with the encapsulation length of the current base frame;

[0013] Determine whether the capacity length of the protocol data unit MODCOD is greater than the size of the current base frame band encapsulation length;

[0014] If the capacity length of the protocol data unit MODCOD is greater than the encapsulation length of the current base frame band, then the minimum MODCOD that can be used to encapsulate the protocol data unit is found in the base frame band;

[0015] If the MODCOD capacity length of the protocol data unit is not greater than the current base frame band encapsulation length, the MODCOD of the current base frame band is updated to the MODCOD of the protocol data unit, and the allowable encapsulation length of the base frame band at this time is recalculated.

[0016] In one embodiment, the step of searching for the minimum MODCOD that can be used to encapsulate the protocol data unit in the base frame band includes:

[0017] Define variable MODCOD as current MODCOD, define best MODCOD as current MODCOD and define remaining minimum encapsulation length as the encapsulation length of best MODCOD minus the encapsulation length of protocol data unit;

[0018] Decrement the variable MODCOD by 1, and determine whether the encapsulation length of the variable MODCOD is greater than or equal to the encapsulation length of the protocol data unit and whether the encapsulation length of the variable MODCOD minus the encapsulation length of the protocol data unit is less than the remaining minimum encapsulation length;

[0019] If the encapsulation length of the variable MODCOD is less than the encapsulation length of the protocol data unit or the encapsulation length of the variable MODCOD minus the encapsulation length of the protocol data unit is greater than or equal to the remaining minimum encapsulation length, then determine whether the variable MODCOD is the minimum MODCOD;

[0020] If the encapsulation length of the variable MODCOD is greater than or equal to the encapsulation length of the protocol data unit and the encapsulation length of the variable MODCOD minus the encapsulation length of the protocol data unit is less than the remaining minimum encapsulation length, then redefine the optimal MODCOD and the remaining minimum encapsulation length and determine whether the variable MODCOD is the minimum MODCOD;

[0021] If the variable MODCOD is the minimum MODCOD, the current MODCOD is the optimal MODCOD, and the remaining package length is the minimum remaining package length;

[0022] If the variable MODCOD is not the minimum MODCOD, the variable MODCOD is decremented by 1 until the minimum MODCOD is found.

[0023] In one embodiment, before the protocol data unit is loaded into a transport container and placed in front of a GSE to-be-encapsulated queue, the method further comprises:

[0024] The protocol data units are sorted according to their MODCODs to form a first team that is dequeued in ascending order of MODCOD. After the dequeuing is completed, the new MODCODs sent are arranged in descending order to form a second team that is dequeued. After the dequeuing is completed, the new third team that is sent again is dequeued in ascending order, and this process is repeated.

[0025] In one embodiment, after recalculating the allowable encapsulation length of the base frame band at this time, the method further includes:

[0026] Compare the remaining capacity of the base frame band with the length of the protocol data unit to be encapsulated;

[0027] If the length of the protocol data unit to be encapsulated is greater than the remaining capacity of the base frame band, the protocol data unit is fragmented, otherwise it is not fragmented, wherein fragmentation is the length division of the data.

[0028] In one embodiment, the data units in the protocol data unit MODCOD and the baseband frame MODCOD are all designed using a lock-free circular queue based on the CAS principle.

[0029] In one embodiment, if the length of the protocol data unit to be encapsulated is greater than the remaining capacity of the base frame band, the protocol data unit is fragmented, including:

[0030] The protocol data unit is divided into the first fragment, the middle fragment, and the last fragment according to its position when fragmented. The fixed header of GSE identifies the position of the fragment and the Label indicates the receiver;

[0031] The Total_length of the GSE encapsulating the first fragment identifies the length of the data immediately following this field and the total length of the subsequent protocol data unit, and the Protocol_Type identifies the data type of the protocol data unit;

[0032] The GSE encapsulated in the last fragment is suffixed with a CRC32 checksum.

[0033] In one embodiment, the calculation range of the checksum is from the Total_length of the GSE of the first fragment of the current protocol data unit to the last fragment of the current protocol data unit.

[0034] In one embodiment, the protocol data units are divided into first-category protocol data units and second-category protocol data units according to the control plane queue and the data plane queue, respectively, so that the first-category protocol data units and the second-category protocol data units are not in the same baseband frame.

[0035] In a second aspect, a computer-readable storage medium is provided, wherein a plurality of program codes are stored in the computer-readable storage medium, wherein the program codes are suitable for being loaded and run by a processor to execute the data encapsulation method described in any one of the technical solutions of the above-mentioned data encapsulation method.

[0036] In a third aspect, a gateway is provided, comprising a processor and a storage device, wherein the storage device is suitable for storing multiple program codes, and the program codes are suitable for being loaded and run by the processor to execute the data encapsulation method described in any one of the technical solutions of the above-mentioned data encapsulation method.

[0037] When adopting the above technical solution, the present invention completes data encapsulation by linking the GSE encapsulation package with DMA, the header of the base frame band and multiple headers to fill in the protocol data unit information, realizes zero memory copy, reduces memory fragmentation of the container memory pool, improves memory allocation efficiency, and improves system throughput; the data plane and control plane data are separately encapsulated and processed without interfering with each other, thereby improving the system encapsulation efficiency and facilitating statistics.

[0038] The present invention determines whether a speed reduction process is required by comparing the MODCOD of the protocol data unit and the MODCOD of the base frame band before data encapsulation, or by finding an adaptive encapsulation technology of the smallest base frame band MODCOD that can be encapsulated, so as to more reasonably utilize physical transmission channel resources, reduce the padding ratio, and improve channel utilization; and sort the MODCOD of the protocol data unit in ascending or descending order in sequence, and reduce the impact on system efficiency by slowing down the change of MODCOD, that is, by using the anti-jump technology. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] The disclosure of the present invention will become more easily understood with reference to the accompanying drawings. It is easy for those skilled in the art to understand that these drawings are only for illustrative purposes and are not intended to limit the scope of protection of the present invention. In addition, similar numbers in the figures are used to represent similar components, among which:

[0040] Figure 1 is a schematic diagram of a forward satellite network architecture according to the prior art;

[0041] Figure 2 is a schematic diagram of overall packaging according to an embodiment of the present invention;

[0042] Figure 3 is a schematic diagram of a memory zero-copy model according to an embodiment of the present invention;

[0043] Figure 4 is a schematic diagram of a main packaging process according to an embodiment of the present invention;

[0044] Figure 5 is a schematic diagram of the LastPDU non-fragmentation processing flow according to an embodiment of the present invention;

[0045] Figure 6 is a schematic diagram of a fragment processing flow of LastPDU according to an embodiment of the present invention;

[0046] Figure 7 is a schematic diagram of a complete PDU encapsulation sub-process according to an embodiment of the present invention;

[0047] Figure 8 is a schematic diagram of a PDU first-slice encapsulation sub-process according to an embodiment of the present invention;

[0048] Fig. 9 is a schematic diagram of a PDU intermediate fragment encapsulation sub-process according to an embodiment of the present invention;

[0049] Fig.10 is a schematic diagram of a PDU final fragment encapsulation sub-process according to an embodiment of the present invention;

[0050] Fig.11 is a schematic diagram of data plane control plane processing logic according to an embodiment of the present invention;

[0051] Fig.12 is a schematic diagram of finding a minimum MODCOD that can be used to encapsulate a protocol data unit according to an embodiment of the present invention;

[0052] Fig.13 is a schematic diagram of a MODCOD anti-jump process of a protocol data unit according to an embodiment of the present invention;

[0053] Fig.14 is a schematic diagram of filling in header information of GSE according to protocol data unit information according to an embodiment of the present invention;

[0054] Fig.15 It is a schematic diagram of a high-speed lock-free circular queue structure according to an embodiment of the present invention. DETAILED DESCRIPTION

[0055] Some embodiments of the present invention are described below with reference to the accompanying drawings. It should be understood by those skilled in the art that these embodiments are only used to explain the technical principles of the present invention and are not intended to limit the protection scope of the present invention.

[0056] In the description of the present invention, "module" and "processor" may include hardware, software or a combination of the two. A module may include hardware circuits, various suitable sensors, communication ports, and memories, and may also include software parts, such as program codes, or a combination of software and hardware. The processor may be a central processing unit, a microprocessor, an image processor, a digital signal processor, or any other suitable processor. The processor has data and / or signal processing functions. The processor may be implemented in software, hardware, or a combination of the two. Non-temporary computer-readable storage media include any suitable medium that can store program codes, such as a magnetic disk, a hard disk, an optical disk, a flash memory, a read-only memory, a random access memory, and the like. The term "A and / or B" means all possible combinations of A and B, such as only A, only B, or A and B. The term "at least one A or B" or "at least one of A and B" has a similar meaning to "A and / or B", and may include only A, only B, or A and B. The singular terms "one" and "the" may also include plural forms.

[0057] like Figure 2 As shown, a data encapsulation method according to an embodiment of the present invention includes:

[0058] S10. The protocol data unit (PDU) from the network layer is loaded into the transport container through DMA and placed in the GSE encapsulation queue.

[0059] S12. Fill in the GSE header information according to the protocol data unit information, so that the GSE header and the protocol data unit are linked to generate a GSE encapsulation package.

[0060] In a specific example, if Figure 3 As shown in the figure, there are three PDUs, namely PDU-1, PDU-2, and PDU-3. Due to the length problem, PDU-3 is fragmented into PDU-3Frag-1 and PDU-3Frag-2. When performing GSE encapsulation, the GSE header information is filled in according to the PDU information, and the GSE header is linked to the PDU to generate the GSE encapsulation, and so on. That is, the four GSE headers are linked to PDU-1, PDU-2, PDU-3Frag-1, and PDU-3Frag-2 respectively.

[0061] S14. Concatenate a header of a base frame band (hereinafter referred to as BBFrame) with a plurality of GSE encapsulation packages to generate a base frame band encapsulation package.

[0062] In a specific example, if Figure 3 As shown, the BBFrame header is linked to the GSE header and PDU-1 to form GSE-1, the GSE header and PDU-2 to form GSE-2, and the GSE header and PDU-3 to form GSE-3, to generate a BBFrame encapsulation. The new GSE encapsulation packet formed by the GSE header and PDU-3Frag-2 will be encapsulated in the next BBFrame. There is no memory copy in the whole process.

[0063] The present invention uses a unique data message carrier container, which is pre-allocated in the form of a memory pool. A message refers to a data unit exchanged and transmitted in a network. After the data message arrives, the network card adapter directly loads the message into the container through DMA, and the upper-layer application queries whether the container is filled through polling. If it is filled, the container is pushed into the next-level FIFO queue for processing, and an empty container is allocated to fill the vacancy. The traditional large-segment memory copy operation is avoided, and the processing efficiency is improved.

[0064] As a carrier for transporting data, containers support mirroring mode, that is, multiple containers simultaneously point to the same or different sections of the same message, realizing PDU fragmentation with zero memory copy. Links can be established between containers to add new headers and tails to messages without copying the original message to form new messages. That is, after the containers carrying data units are linked, new data units can be formed, and new messages, i.e. data units, can be filled into new containers. That is, after the PDU enters the encapsulator, the encapsulator first allocates a new container, fills in the GSE header information according to the PDU information, and the GSE header is linked to the PDU to generate a GSE encapsulation. Similarly, the BBFrame header is linked to multiple GSEs to generate a BBFrame encapsulation.

[0065] Since the MODCOD of the control plane is relatively fixed and has low efficiency, if the control plane and the data plane are mixed and encapsulated, the efficiency will be affected. To ensure that the control plane data (Fast block) and the data plane data (Data Block) can be distinguished by the physical layer board, in one embodiment, before the protocol data unit from the network layer is loaded into the transport container through DMA and placed in the GSE to be encapsulated queue, that is, before step S10, the method also includes: dividing the protocol data unit into a first type of protocol data unit and a second type of protocol data unit according to the control plane queue and the data plane queue.

[0066] For specific steps, see Fig.11 , Fig.11This is a logical diagram of data plane control plane processing according to an embodiment of the present invention. Since the data itself indicates the data type, the type of data can be distinguished by reading this information through an algorithm, and the control plane data and data plane data can be placed in different queues.

[0067] The control plane data and data plane data are completely encapsulated separately, and the control plane data and data plane data will not appear in the same BBFrame. The two types of data need to be separated before encapsulation, and the two processing modules process them separately without interfering with each other, which improves the encapsulation efficiency, simplifies the encapsulation process, and helps the physical layer transmitter distinguish between the control plane and data plane data.

[0068] A larger MODCOD represents a higher modulation order or coding efficiency, that is, a higher user data transmission rate. When the physical transmission channel is better, a larger MODCOD is selected, otherwise a smaller MODCOD is selected. The MODCOD used for actual transmission (MODCOD of BBFrame) should not be larger than the MODCOD set for user data (MODCOD of PDU), that is, it cannot be sent at overspeed, but it can be smaller than the MODCOD set for user data according to actual conditions, that is, it can be sent at a reduced speed. In order to make more reasonable use of physical transmission channel resources and minimize the number of Padding bytes, in step S10, after the protocol data unit from the network layer is loaded into the transport container through DMA and placed before the GSE to be encapsulated queue, it is necessary to find the minimum MODCOD that can be used to encapsulate the protocol data unit in the base frame band. In one embodiment, the specific process of step S16 (S161-S165) of finding the minimum MODCOD that can be used to encapsulate the protocol data unit in the base frame band can be found in reference. Fig.12 , including the following steps:

[0069] S161, define a variable MODCOD as the current MODCOD, define an optimal MODCOD as the current MODCOD, and define a remaining minimum encapsulation length as the encapsulation length of the optimal MODCOD minus the encapsulation length of the protocol data unit;

[0070] S162, decrement the variable MODCOD by 1;

[0071] S163, determining whether the encapsulation length of the variable MODCOD is greater than or equal to the encapsulation length of the protocol data unit and whether the encapsulation length of the variable MODCOD minus the encapsulation length of the protocol data unit is less than the remaining minimum encapsulation length;

[0072] If the encapsulation length of the variable MODCOD is greater than or equal to the encapsulation length of the protocol data unit and the encapsulation length of the variable MODCOD minus the encapsulation length of the protocol data unit is less than the remaining minimum encapsulation length, execute S164;

[0073] If the encapsulation length of the variable MODCOD is less than the encapsulation length of the protocol data unit or the encapsulation length of the variable MODCOD minus the encapsulation length of the protocol data unit is greater than or equal to the remaining minimum encapsulation length, execute S165;

[0074] S164, redefine the optimal MODCOD as the variable MODCOD, the remaining minimum encapsulation length is the encapsulation length of the variable MODCOD minus the encapsulation length of the protocol data unit, and execute the next step;

[0075] S165, judging whether the variable MODCOD is the minimum MODCOD;

[0076] If the variable MODCOD is not the minimum MODCOD, then return to S162;

[0077] If the variable MODCOD is the minimum MODCOD, the current MODCOD is the optimal MODCOD, and the remaining package length is the minimum remaining package length.

[0078] In this embodiment, a simple for loop is used to find the smallest or best MODCOD. The overall search process is similar to the for loop, and the variable MODCOD is decremented by 1 and compared one by one until the smallest or best BBFrame MODCOD is found.

[0079] During the encapsulation process, the PDU MODCOD and BBFrame MODCOD need to be adapted. If the PDU MOCOD changes dramatically, the BBFrame needs frequent padding, which affects the system efficiency. Therefore, before the protocol data unit is loaded into the transport container and placed in the GSE encapsulation queue in step S10, it is necessary to prevent the PDU MODCOD from jumping. In one embodiment, the specific steps of the method are shown in Fig.13 .

[0080] Fig.13This is a flow chart of MODCOD anti-jump of a protocol data unit according to an embodiment of the present invention. Before the PDU enters the data plane encapsulation queue (Data Block Queue) or the control plane encapsulation queue (Fast Block Queue), it is sorted according to the MODCOD of the PDU to form a first team that is dequeued in ascending order of MODCOD. Since the data stream is continuous, after the last MODCOD of the first team is dequeued, the newly sent MODCOD is arranged in descending order to form a second team that is dequeued in sequence. In this way, the change between the last MODCOD of the first team and the first MODCOD of the second team is no longer drastic, which slows down the change of MODCOD between the two teams and is conducive to further maintaining system stability. In the order of increasing, decreasing, and increasing, this is repeated to prevent the MODCOD jump of the queue to be encapsulated.

[0081] In a specific embodiment of step S10, after the protocol data is filled into the transport container and before it is placed in the GSE to be encapsulated queue, the method further includes the steps of preparing the base frame band (S100-S101), preparing the PDU to be encapsulated (S102), and determining the speed reduction (S103-S105). Figure 4 . Figure 4 This is a schematic diagram of the main packaging process according to an embodiment of the present invention. It includes the following steps:

[0082] S100, determine whether the current BBFrame is empty. If the BBFrame is empty, that is, does not exist, generate a new BBFrame with a package length of zero, and the current MODCOD is the maximum MODCOD, and execute S102; if the BBFrame is not empty, that is, exists, determine whether the package length is zero. If not, proceed to S101; if zero, proceed to S102;

[0083] In this embodiment, the encapsulation length refers to the length of the data capacity that has been encapsulated in the BBFrame, and the current MODCOD refers to the MODCOD of the current BBFrame.

[0084] S101, determine whether the BBFrame has timed out. If the BBFrame has not timed out, proceed to S102. If the BBFrame has timed out, perform adaptive encapsulation of the BBFrame MODCOD and complete the encapsulation by Padding.

[0085] In this embodiment, the adaptive encapsulation of BBFrame MODCOD is to find the MODCOD that is most suitable for encapsulating PDU in the MODCOD of BBFrame. The so-called most suitable means encapsulating PDU into BBFrame with the minimum remaining space capacity, minimizing the number of Padding bytes, and improving the utilization rate of physical transmission channel.

[0086] S102, prepare the PDU to be encapsulated, read the PDU and assign it to LastPDU, determine whether LastPDU is empty, if LastPDU is empty, the FIFO queue to be encapsulated is empty, generate an incomplete BBFrame or an empty BBFrame, and the encapsulation is not completed; if LastPDU is not empty, execute S103;

[0087] S103, determine whether the LastPDU MODCDO is less than the current MODCOD, if the LastPDU MODCDO is less than the current MODCOD, execute S104; if the LastPDU MODCDO is not less than the current MODCOD, execute S106;

[0088] In this embodiment, the sizes of LastPDU MODCOD and current BBFrame MODCOD are compared. The length of BBFrame and PDU is determined by its MODCOD and is fixed, so it is necessary to find the most suitable BBFrame MODCOD to encapsulate LastPDU MODCOD; the size of GSE changes with the size of PDU fragments.

[0089] S104 includes:

[0090] S1041 compares the capacity length of the protocol data unit MODCOD with the encapsulation length of the current base frame:

[0091] S1042, determine whether the encapsulation length of LastPDUMODCOD encapsulated in BBFrame is greater than the encapsulation length of BBFrame already encapsulated. If the encapsulation length of LastPDUMODCOD encapsulated in BBFrame is not greater than the encapsulation length of BBFrame already encapsulated, perform adaptive encapsulation of BBFrame, and complete encapsulation by Padding; if the encapsulation length of LastPDUMODCOD encapsulated in BBFrame is greater than the encapsulation length of BBFrame already encapsulated, execute S105;

[0092] In this embodiment, it is determined whether the encapsulation length of LastPDUMODCOD encapsulated in BBFrame is greater than the encapsulation length already encapsulated in BBFrame. The purpose is to determine whether it can continue to accommodate the data already encapsulated in BBFrame if the current MODCOD is slowed down, that is, its size is changed. If it cannot be accommodated, that is, the encapsulation length of LastPDUMODCOD encapsulated in BBFrame is not greater than the encapsulation length already encapsulated in BBFrame, no speed reduction processing is performed, and the adaptive encapsulation processing of BBFrame is entered.

[0093] S105, perform a speed reduction process, update the current MODCOD to LastMODCOD, and recalculate the capacity length of the BBFrame at this time, and execute S106;

[0094] S106, determine whether the encapsulation length is zero, if the encapsulation length is zero, then stamp the BBFrame timestamp and execute S107, if the encapsulation length is not zero, then execute S107;

[0095] S107, determine whether the LastPDU is a fragment. If the LastPDU is not a fragment, enter step S108: LastPDU non-fragment processing flow; if the LastPDU is a fragment, enter step S109: LastPDU fragment processing flow.

[0096] In this embodiment, it is determined whether the LastPDU is a fragment, that is, whether it is a completed PDU, or whether it has been fragmented before. There are two results in determining whether the LastPDU is a fragment, one is the LastPDU non-fragment processing flow, and the other is the LastPDU fragment processing flow. The determination of whether the LastPDU is a fragment occurs after step S10 and before step S12. The two processing flows are respectively Figure 5 , Figure 6 It is reflected in.

[0097] See also Figure 5 , step S108 further includes the following steps:

[0098] S1080, determine whether the encapsulation length is zero or whether the destination address of the LastPDU is different from the previous PDU. If the encapsulation length is not zero and the destination address of the LastPDU is different from the previous PDU, the Label Type in the GSE header information is re-use; if the encapsulation length is zero or the destination address of the LastPDU is different from the previous PDU, the Label Type in the GSE header information is non-re-use, the previous PDU address is reset to the LastPDU address, and S1081 is executed;

[0099] S1081, whether the total capacity length of the GSE encapsulation package shell and the LastPDU is greater than the remaining capacity length of the BBFrame, if the total capacity length of the GSE encapsulation package shell and the LastPDU is greater than the remaining capacity length of the BBFrame, execute S1082; if the total capacity length of the GSE encapsulation package shell and the LastPDU is not greater than the remaining capacity length of the BBFrame, execute S1083;

[0100] S1082, perform the sub-process of GSE encapsulation of the first PDU fragment, encapsulation is completed, and the process ends;

[0101] S1083, complete the PDU GSE encapsulation sub-process and execute the next step;

[0102] S1084, determine whether the remaining capacity length of the BBFrame is less than or equal to the Padding threshold. If the remaining capacity length of the BBFrame is not less than or equal to the Padding threshold, return to the starting point to continue encapsulation; if the remaining capacity length of the BBFrame is less than or equal to the Padding threshold, then Padding and encapsulation are completed.

[0103] See also Figure 6 , step S109 further includes the following steps:

[0104] S1090, determine whether the encapsulation length is zero. If the encapsulation length is not zero, the Label Type in the GSE header information is re-use; if the encapsulation length is zero, the Label Type in the GSE header information is non-re-use, and the PDU address before reset is the LastPDU address; execute the next step;

[0105] S1091, whether the total capacity length of the GSE package shell capacity, the LastPDU capacity, and the CRC32 is greater than the remaining capacity length of the BBFrame. If the total capacity length of the GSE package shell capacity, the LastPDU capacity, and the CRC32 is not greater than the remaining capacity length of the BBFrame, execute S1092; if the total capacity length of the GSE package shell capacity, the LastPDU capacity, and the CRC32 is greater than the remaining capacity length of the BBFrame, execute S1094;

[0106] S1092, performing GSE encapsulation of the final fragment of the PDU;

[0107] S1093, determine whether the remaining capacity length of the BBFrame is less than or equal to the Padding threshold. If the remaining capacity length of the BBFrame is not less than or equal to the Padding threshold, return to the starting point to continue encapsulation; if the remaining capacity length of the BBFrame is less than or equal to the Padding threshold, then Padding and encapsulation are completed.

[0108] S1094, performing the PDU intermediate fragmentation GSE encapsulation sub-process;

[0109] S1095, packaging is completed.

[0110] In this embodiment, the Padding threshold is a manually set value. If the minimum threshold is not reached, it means that there is still free space in the BBFrame for packaging.

[0111] According to DVB_S2 regulations, the BBFrame length of each MODCOD is fixed. It is difficult to ensure that the GSE fills the BBFrame when the complete PDU is encapsulated into GSE and loaded into the BBFrame, so Padding is required. Too much Padding will reduce the efficiency of channel utilization, and the PDU needs to be fragmented. When the PDU cannot be completely placed in the BBFrame, the PDU is divided into several blocks, each of which is encapsulated into a GSE and placed in the BBFrame to reduce the Padding ratio.

[0112] After step S10 and before step S12, in one embodiment, after recalculating the allowable encapsulation length of the base frame band at this time, the method further includes: comparing the remaining capacity of the base frame band with the length of the protocol data unit to be encapsulated; if the length of the protocol data unit to be encapsulated is greater than the remaining capacity of the base frame band, the protocol data unit is fragmented, otherwise it is not fragmented, wherein fragmentation is the length division of the data. The specific comparison and judgment steps for whether the protocol data unit is to be fragmented are S1081 and S1091. In the fragmentation mechanism, a PDU can be decomposed into multiple PDUs, thereby loading multiple GSE data packets, but a GSE data packet can only contain one PDU. A BBFrame can contain one or more GSE data packets.

[0113] In one embodiment of S12, if the length of the protocol data unit to be encapsulated is not greater than the remaining capacity of the base frame band, no fragmentation is performed. Then the complete PDU encapsulation sub-process S120 (S1201-S1204) is performed; and S14 is performed to link the header of the base frame band with multiple GSE encapsulation packets to generate a base frame band encapsulation packet, that is, the complete PDU encapsulation sub-process S140 (S1401-S1402), see the details. Figure 7 , Figure 71 is a schematic diagram of a complete PDU GSE encapsulation sub-process according to an embodiment of the present invention, comprising the following steps:

[0114] S1201, apply for GSE header mbuf;

[0115] S1202, fill in the GSE header information, including the GSE fixed header, Protocol-Type, and Label, where the total capacity length of the GSE encapsulation package is the sum of the GSE encapsulation package shell capacity and the LastPDU capacity;

[0116] S1203, concatenate the GSE header mbuf and the Last-PDU mbuf;

[0117] S1204, LastPDU is set to blank, that is, its internal data is completely encapsulated;

[0118] S1401, GSE is put into BBFrame, and the encapsulation length after encapsulation is the sum of the original encapsulation length of BBFrame before encapsulation and the total capacity of GSE encapsulation package, and the remaining capacity length of BBFrame is updated;

[0119] S1402, packaging is completed.

[0120] In this embodiment, the main purpose of mbuf is to store user data transmitted between processes and network interfaces, as well as source and destination addresses, socket options, etc. The GSE header mbuf and the LastPDU mbuf are concatenated to form a pointer connection between the GSE encapsulation shell and each data of the LastPDU, and a mutual pointing relationship is formed between the two.

[0121] In one embodiment of S12, if the length of the protocol data unit to be encapsulated is greater than the remaining capacity of the base frame band, the protocol data unit is fragmented, including being divided into the first fragment, the middle fragment, and the last fragment according to its position. After the fragmentation is completed, the fragments are respectively subjected to the PDU first fragment encapsulation sub-process S121 (S1211-S1215), the PDU middle fragment encapsulation sub-process S122 (S1221-S1224), and the PDU last fragment encapsulation sub-process S123 (S1231-S1235); and S14 is performed to link the header of the base frame band with multiple GSE encapsulation packages to generate a base frame band encapsulation package, specifically including: PDU first fragment encapsulation sub-process S141 (S1411-S1412), PDU middle fragment encapsulation sub-process S142 (S1421-S1422), and PDU last fragment encapsulation sub-process S143 (S1241-S1242).

[0122] See also Figure 8 , Figure 8The present invention is a schematic diagram of a PDU first-slice encapsulation sub-process according to an embodiment of the present invention, comprising the following steps:

[0123] S1211, first apply for the mbuf of the GSE header;

[0124] S1212, fill in the GSE header information, including the GSE fixed header, Frag-ID, Total-Length, Protocol-Type, Label, and GSE extension header. The total capacity length of the GSE encapsulated packet is the remaining capacity of the BBFrame. Because fragmentation is performed, the fragment number is +1 and used.

[0125] S1213, calculate CRC32 of the GSE header and LastPDU data starting from Total-Length;

[0126] S1214, apply for indirect mbuf, indirect mbuf points to the first byte of Last PDU data, Last PDU points to the remaining data, and the fragmentation flag of Last PDU is set to yes;

[0127] S1215, concatenates the GSE header mbuf and the indirect mbuf;

[0128] S1411, GSE is put into BBFrame, and the encapsulation length after encapsulation is the sum of the original encapsulation length of BBFrame before encapsulation and the total capacity of GSE encapsulation package, and the remaining capacity of BBFrame is zero;

[0129] S1412, packaging is completed.

[0130] In this embodiment, the indirect mbuf points to the byte before the LastPDU data, where the byte before the LastPDU data refers to the GSE header length of the remaining capacity of the original BBframe. The fragmentation mark of the LastPDU is set to yes, which means that since the current PDU has been fragmented for the first fragment, the PDU is marked as a fragment, that is, the current PDU is a fragment, which is convenient for later reading whether the PDU is a fragment.

[0131] See also Fig. 9 , Fig. 9 1 is a schematic diagram of a PDU intermediate fragment encapsulation sub-process according to an embodiment of the present invention, comprising the following steps:

[0132] S1221, apply for GSE header mbuf;

[0133] S1222: Fill in the GSE header information, including the GSE fixed header, Frag-ID, and Label. The total capacity length of the GSE encapsulation package is the remaining capacity of the BBFrame, and the fragment number remains unchanged.

[0134] S1223, apply for indirect mbuf, indirect mbuf points to the first byte of Last PDU data, and Last PDU points to the remaining data;

[0135] S1224, concatenates the GSE header mbuf and the indirect mbuf;

[0136] S1421, GSE is put into BBFrame, and the encapsulation length after encapsulation is the sum of the original encapsulation length of BBFrame before encapsulation and the total capacity of GSE encapsulation package, and the remaining capacity of BBFrame is zero;

[0137] S1422, packaging is completed.

[0138] In this embodiment, the fragment number remains unchanged because it is a fragment in the middle of the PDU, that is, a fragment in the middle part, and the fragment number of the current PDU continues to be used.

[0139] See also Fig.10 , Fig.10 1 is a schematic diagram of a PDU final fragment GSE encapsulation sub-process according to an embodiment of the present invention, comprising the following steps:

[0140] S1231, apply for GSE header mbuf;

[0141] S1232, fill in the GSE header information, including the GSE fixed header, Frag-ID, and Label. The total capacity length of the GSE encapsulation package is the sum of the GSE header length, PDU fragment length, and CRC32 capacity length. The fragment number does not change.

[0142] S1233, apply for CRC32 mbuf, fill in CRC32;

[0143] S1234, concatenate the GSE header mbuf, the Last-PDU mbuf and the CRC32 mbuf in sequence;

[0144] S1235, LastPDU is set to blank, that is, its internal data is encapsulated;

[0145] S1431, GSE is put into BBFrame, and the encapsulation length after encapsulation is the sum of the original encapsulation length of BBFrame before encapsulation and the total capacity of GSE encapsulation package, and the remaining capacity length of BBFrame is updated;

[0146] S1432, packaging is completed.

[0147] In step S12, the specific content of the header information of GSE is filled in according to the protocol data unit information. Fig.14 , Fig.14 The schematic diagram of filling in the header information of the GSE according to the information of the protocol data unit according to an embodiment of the present invention is as follows. According to the position of the fragment relative to the PDU, it is divided into the first fragment, the middle fragment and the last fragment.

[0148] In the first fragment of the encapsulated PDU: the fixed header of GSE identifies the location of the fragment, the Total_length of GSE identifies the length of the data immediately following this field and the total length of the subsequent protocol data unit, the Protocol_Type identifies the data type of the protocol data unit, and the Label indicates the receiver;

[0149] In the middle fragment of the encapsulated PDU: the fixed header of GSE identifies the location of the fragment, and the label indicates the receiver;

[0150] In the final fragment of the encapsulation: the GSE fixed header identifies the location of the fragment, the Label indicates the recipient, and the GSE is suffixed with a CRC32 checksum.

[0151] In one embodiment, the calculation range of the checksum is from the Total_length of the GSE of the first fragment of the current protocol data unit to the last fragment of the current protocol data unit, so as to sense transmission errors.

[0152] In addition, the data units in the protocol data unit MODCOD and the baseband frame MODCOD use the traditional locked queue, which has the following problems: low efficiency, difficult to meet the high traffic bandwidth requirements of the Layer 2 gateway; low maintainability, and easy to cause deadlock when the project is large. Therefore, in one embodiment, the data units in the protocol data unit MODCOD and the baseband frame MODCOD use a lock-free circular queue designed according to the CAS principle.

[0153] See also Fig.15 , Fig.15 1 is a schematic diagram of a high-speed lock-free circular queue structure according to an embodiment of the present invention. Variable Description:

[0154] prod_head, thread-shared variables and thread-internal variables. The thread-shared variables identify the next producer's queue entry position, and the thread-internal variables identify the current thread's queue entry start position.

[0155] prod_tail, thread-shared variables and thread-internal variables. The thread-shared variables identify the first enqueuing position of this enqueuing process, and the thread-internal variables identify the maximum reachable position of the consumer's consumption data.

[0156] prod_next, a thread internal variable, identifies the last position of the current thread in the queue.

[0157] cons_head, thread-shared variables and thread-internal variables. The thread-shared variables identify the next consumer dequeue position, and the thread-internal variables identify the starting position of the current thread's dequeue.

[0158] cons_tail, thread-shared variables and thread-internal variables. The thread-shared variables identify the first dequeue position of this dequeue process, and the thread-internal variables identify the maximum position where the producer can produce data.

[0159] cons_next, a thread internal variable, identifies the last position of the current thread in this dequeue.

[0160] When the producer thread enqueues n data, it copies the thread-shared variables prod_head and cons_tail into the thread, and assigns prod_head+n to prod_next. If prod_next is greater than cons_tail, enqueuing fails. Perform a CAS operation on prod_head. If the local prod_head and the shared prod_head are equal, set the shared prod_head to prod_next. Otherwise, re-copy prod_head and cons_tail, and repeat the above comparison until the shared prod_head is set. Starting from the local prod_head position, the producer enqueues n data into a lock-free circular queue in sequence. Perform a CAS operation on the local prod_head and shared prod_tail. If successful, that is, the two are equal, assign prod_next to the shared prod_tail. Otherwise, perform the CAS operation again until it succeeds.

[0161] When the consumer thread dequeues n data, it copies the thread-shared variables cons_head and prod_tail to the thread, and assigns cons_head+n to cons_next. If cons_next is greater than prod_tail, dequeuing fails (this section introduces bulk mode dequeuing, that is, either dequeue n data or fail). Perform a CAS operation on cons_head. If the local cons_head and the shared cons_head are equal, set the shared cons_head to cons_next. Otherwise, re-copy cons_head and prod_tail, and repeat the above comparison until the shared cons_head is set. The consumer starts from the local cons_head position and dequeues n data from the lock-free circular queue in turn. Perform a CAS operation on the local cons_head and the shared cons_tail. If successful, that is, the two are equal, assign cons_next to the shared cons_tail. Otherwise, perform the CAS operation again until it succeeds.

[0162] This system uses FIFO queues as the container carrier of PDU and BBFrame, and the queue entry and exit are interfaces between threads and modules. When facing multiple producer threads and multiple consumer threads, the CAS (Compare And Set) principle is used to design a lock-free circular queue to reduce the locking and unlocking process, so that data can be queued and dequeued more quickly, and the operating efficiency is improved.

[0163] It should be pointed out that although the various steps in the above embodiments are described in a specific order, those skilled in the art can understand that in order to achieve the effects of the present invention, different steps do not have to be performed in such an order. They can be performed simultaneously (in parallel) or in other orders. These changes are within the scope of protection of the present invention.

[0164] Furthermore, the present invention also provides a computer-readable storage medium, which stores multiple program codes, and the program codes are suitable for being loaded and run by a processor to execute the data encapsulation method described in any one of the technical solutions of the above-mentioned data encapsulation method.

[0165] It is understood by those skilled in the art that the present invention implements all or part of the processes in the method of the above embodiment, and can also be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable storage medium may include: any entity or device, medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory, random access memory, electric carrier signal, telecommunication signal and software distribution medium that can carry the computer program code. It should be noted that the content contained in the computer-readable storage medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable storage media do not include electric carrier signals and telecommunication signals.

[0166] Furthermore, the present invention also provides a gateway. In a gateway embodiment according to the present invention, a processor and a storage device are included. The storage device can be configured to store a program for executing the method of the above method embodiment, and the processor can be configured to execute the program in the storage device, which includes but is not limited to the program for executing the method of the above method embodiment. For ease of explanation, only the part related to the embodiment of the present invention is shown. For specific technical details not disclosed, please refer to the method part of the embodiment of the present invention. The control device can be a control device device formed by various electronic devices.

[0167] So far, the technical solutions of the present invention have been described in conjunction with the preferred embodiments shown in the accompanying drawings. However, it is easy for those skilled in the art to understand that the protection scope of the present invention is obviously not limited to these specific embodiments. Without departing from the principle of the present invention, those skilled in the art can make equivalent changes or substitutions to the relevant technical features, and the technical solutions after these changes or substitutions will fall within the protection scope of the present invention.

Claims

1. A data encapsulation method, characterized in that: The steps include: The protocol data unit from the network layer is loaded into the transport container through DMA and placed in the GSE encapsulation queue; Fill in the GSE header information according to the protocol data unit information, so that the GSE header and the protocol data unit are linked to generate a GSE encapsulation package; Linking the header of the base frame band with multiple GSE encapsulation packets to generate a base frame band encapsulation packet; The method further comprises: Compare the capacity length of the protocol data unit MODCOD with the encapsulation length of the current base frame; Determine whether the capacity length of the protocol data unit MODCOD is greater than the size of the current base frame band encapsulation length; If the capacity length of the protocol data unit MODCOD is greater than the encapsulation length of the current base frame band, then the minimum MODCOD that can be used to encapsulate the protocol data unit is found in the base frame band; If the MODCOD capacity length of the protocol data unit is not greater than the current base frame band encapsulation length, the MODCOD of the current base frame band is updated to the MODCOD of the protocol data unit, and the allowable encapsulation length of the base frame band at this time is recalculated.

2. The data encapsulation method according to claim 1, characterized in that: Before the protocol data unit from the network layer is loaded into the transport container by DMA and placed in the GSE to-be-encapsulated queue, the method further comprises: The protocol data units are divided into first-category protocol data units and second-category protocol data units according to the control plane queue and the data plane queue respectively; so that the first-category protocol data units and the second-category protocol data units are not in the same baseband frame.

3. The data encapsulation method according to claim 1, characterized in that: The step of searching for the minimum MODCOD that can be used to encapsulate the protocol data unit in the base frame band comprises: Define variable MODCOD as current MODCOD, define best MODCOD as current MODCOD and define remaining minimum encapsulation length as the encapsulation length of best MODCOD minus the encapsulation length of protocol data unit; Decrement the variable MODCOD by 1, and determine whether the encapsulation length of the variable MODCOD is greater than or equal to the encapsulation length of the protocol data unit and whether the encapsulation length of the variable MODCOD minus the encapsulation length of the protocol data unit is less than the remaining minimum encapsulation length; If the encapsulation length of the variable MODCOD is less than the encapsulation length of the protocol data unit or the encapsulation length of the variable MODCOD minus the encapsulation length of the protocol data unit is greater than or equal to the remaining minimum encapsulation length, then determine whether the variable MODCOD is the minimum MODCOD; If the encapsulation length of the variable MODCOD is greater than or equal to the encapsulation length of the protocol data unit and the encapsulation length of the variable MODCOD minus the encapsulation length of the protocol data unit is less than the remaining minimum encapsulation length, then redefine the optimal MODCOD and the remaining minimum encapsulation length and determine whether the variable MODCOD is the minimum MODCOD; If the variable MODCOD is the minimum MODCOD, the current MODCOD is the optimal MODCOD, and the remaining package length is the minimum remaining package length; If the variable MODCOD is not the minimum MODCOD, the variable MODCOD is decremented by 1 until the minimum MODCOD is found.

4. The packaging method according to claim 1, characterized in that: Before the protocol data unit is loaded into a transport container and placed in front of a GSE to-be-encapsulated queue, the method further comprises: The protocol data units are sorted according to their MODCODs to form a first team that is dequeued in ascending order of MODCOD. After the dequeuing is completed, the new MODCODs sent are arranged in descending order to form a second team that is dequeued. After the dequeuing is completed, the new third team that is sent again is dequeued in ascending order, and this process is repeated.

5. The packaging method according to claim 1, characterized in that: After recalculating the allowable encapsulation length of the base frame band at this time, the method further includes: Compare the remaining capacity of the base frame band with the length of the protocol data unit to be encapsulated; If the length of the protocol data unit to be encapsulated is greater than the remaining capacity of the base frame band, the protocol data unit is fragmented, otherwise it is not fragmented, wherein fragmentation is the length division of the data.

6. The packaging method according to claim 1, characterized in that: The data units in the protocol data unit MODCOD and the baseband frame MODCOD are all designed using a lock-free circular queue based on the CAS principle.

7. The packaging method according to claim 5, characterized in that: If the length of the protocol data unit to be encapsulated is greater than the remaining capacity of the base frame band, the protocol data unit is fragmented, including: The protocol data unit is divided into the first fragment, the middle fragment, and the last fragment according to its position when fragmented. The fixed header of GSE identifies the position of the fragment and the Label indicates the receiver; The Total_length of the GSE encapsulating the first fragment identifies the length of the data immediately following this field and the total length of the subsequent protocol data unit, and the Protocol_Type identifies the data type of the protocol data unit; The GSE encapsulating the last fragment is suffixed with a CRC32 checksum; the calculation range of the checksum is from the Total_length of the GSE of the first fragment of the current protocol data unit to the last fragment of the current protocol data unit.

8. A computer-readable storage medium storing a program, characterized in that: When the program is executed, the method according to any one of claims 1 to 7 is implemented.

9. A gateway, comprising a processor and a memory, wherein a program is stored in the memory, characterized in that: When the program is executed by the processor, the method according to any one of claims 1 to 7 is implemented.