An efficient UDP data reception method

By establishing access permissions between user space and network card space on the smart TV platform, UDP data is directly mapped to the link layer and distributed using a data block linked list, solving the problem of excessive memory and CPU usage in high bitrate data processing and achieving efficient data transmission and processing.

CN119450115BActive Publication Date: 2025-12-02SHENZHEN IPANEL TECH LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411487633.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-10-24
Publication Date
2025-12-02
Estimated Expiration
2044-10-24

AI Technical Summary

Technical Problem

Existing technologies cannot efficiently process high bitrate data on platforms such as smart TVs, resulting in excessive memory and CPU usage, which affects user operation response and system stability.

Method used

By establishing access permissions between user space and network interface card (NIC) space through its built-in protocol stack, UDP data is directly mapped to the link layer of the NIC space and distributed to the application layer using a linked list of data blocks of consistent size, avoiding intermediate protocol stack processing.

Benefits of technology

It reduces memory bandwidth usage and CPU load, improves memory utilization efficiency, reduces protocol stack processing overhead, and enhances data processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119450115B_ABST
    Figure CN119450115B_ABST
Patent Text Reader

Abstract

This invention provides an efficient UDP data reception method. It establishes access permissions between the user space interface and the network interface card (NIC) space interface using a built-in protocol stack. Based on these permissions, it maps UDP data from the user space to the link layer of the NIC space. At the link layer, it distributes UDP data using a buffer with a consistent-size linked list of data blocks. The UDP data is then transmitted according to the distribution and forwarded to the application layer. The link layer data access mechanism is implemented based on virtual NIC data access and the built-in protocol stack. Data is processed in a loop using shared memory. Detected target data is not processed by the protocol stack; the data payload is directly sent from the link layer to the application layer for processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of data reception technology, and in particular to an efficient UDP data reception method. Background Technology

[0002] With the increasing popularity of 4K live streaming and video-on-demand services, the demand for transmission bandwidth is rising, leading to a surge in the amount of data processed. In particular, some operators have begun piloting and promoting 8K live streaming services, placing even higher demands on high-bitrate data processing performance. How to achieve high-speed data processing with current hardware capabilities while reducing the demands on the hardware platform is a problem that must be addressed.

[0003] On some Linux systems, mapping user space memory to the network card driver's memory space can achieve a similar data reception scheme. The main drawback of the existing technology is in terms of the data reception method:

[0004] 1. The virtual network adapter technology built into the operating system is only supported by most Linux platforms, and some platforms with limited functionality do not even support it;

[0005] 2. Although data reception can be achieved through virtual network adapters on Linux systems, Android systems do not have similar permission.

[0006] 3. Smart TVs use operating systems provided by various manufacturers, and most of them do not support external access via virtual network cards, so they are not universally available, even though the market share of smart TVs is increasing.

[0007] In terms of data processing methods:

[0008] 1. Currently, the mainstream data reception method is to build UDP sockets to receive data from the network card. The data needs to go from the link layer to the application layer. The data needs to be processed by the protocol stack in between. The header of the initial Ethernet frame is stripped layer by layer, and finally the payload is filled into the socket's memory space, waiting for the application to access it. In between, there are multiple data copies and packet processing, which all require memory and CPU time slices. Especially for high-speed data processing, memory bandwidth and CPU usage will increase significantly. For many low-performance hardware platforms, it is basically impossible to carry out high-speed data services.

[0009] 2. Excessive CPU and memory usage also hinders the normal operation of other applications, causing delays in user response and even application instability. Summary of the Invention

[0010] This invention provides an efficient UDP data reception method to solve the problems mentioned in the background art.

[0011] An efficient UDP data reception method includes:

[0012] S1: Establish access permissions between the user space interface and the network card space interface through the built-in protocol stack;

[0013] S2: Based on the access permissions, map the UDP data in user space to the link layer in network interface card space;

[0014] S3: UDP data is distributed using a buffer with a consistent data block linked list at the link layer;

[0015] S4: Transmit the UDP data according to the UDP data distribution and pass it to the application layer.

[0016] Preferably, before step S1, the method further includes:

[0017] The built-in protocol stack is parsed to obtain multiple protocol layers, and the protocol functions of each protocol layer are obtained.

[0018] Based on the protocol functions, the configuration parameters for each protocol layer are determined. Based on the relationships between the protocol layers, the configuration parameters are optimized to obtain the target configuration parameters.

[0019] Based on the target configuration parameters, the built-in protocol stack is added to the UDP data receiving platform.

[0020] Preferably, in step S1, establishing access permissions between the user space interface and the network card space interface through the built-in protocol stack includes:

[0021] A user model is established based on the user space interface, a storage space model is established based on the network card space interface, and a dedicated language for access permissions is established based on the user model and the storage space model.

[0022] Based on the access permission-specific language, create protocol permissions corresponding to the built-in protocol stack;

[0023] Based on the aforementioned protocol permissions, establish access permissions between the user space interface and the network card space interface.

[0024] Preferably, in step S2, mapping UDP data from user space to the link layer of the network interface card (NIC) space based on the access permissions includes:

[0025] Obtain the first memory heap in user space, obtain the second memory heap in network interface card space, and match the first memory heap and the second memory heap to obtain the memory heap matching relationship;

[0026] Based on the memory heap matching relationship, access information is established, and according to the access information, UDP data in user space is mapped to the link layer of network interface card space.

[0027] Preferably, in step S3, the distribution of UDP data using a buffer with a consistent-size linked list of data blocks at the link layer includes:

[0028] Configure a maximum transmission unit of 20 bytes for each data block, and organize all configured data blocks into a linked list;

[0029] The UDP data at the link layer mapped to the network interface card space is divided into multiple Ethernet frames according to the transmission capacity of the maximum transmission unit, and the Ethernet frames are matched sequentially to the data blocks in the data block list.

[0030] After receiving an Ethernet frame, the data block identifies the data block length, effective data length, and data offset within the block in the last 8 bytes based on the data content of the Ethernet frame.

[0031] After the data block has been distributed, it is returned to the data block list for the distribution of new Ethernet frames.

[0032] Preferably, in step S4, transmitting the UDP data according to the UDP data distribution and transmitting it to the application layer includes:

[0033] Set the buffer's round-robin strategy according to the UDP data distribution;

[0034] According to the described cyclic strategy, UDP data at the link layer will be passed sequentially to the network layer, transport layer, session layer, presentation layer, and finally to the application layer.

[0035] Preferably, the step of setting the buffer's round-robin strategy according to the distribution of UDP data includes:

[0036] Obtain the initial data block queue corresponding to the distribution of UDP data, and obtain the head queue position and tail queue position of the initial data block queue;

[0037] Obtain the first data block at the first queue position, and obtain the UDP header of the first data block. Based on the UDP header, determine whether the data in the first data block is unicast or multicast data.

[0038] If so, the first data block is transmitted to the user processing data list to wait for processing. After the first data block completes the user data processing task, the first data block is looped back to the tail queue position of the buffer. The initial data block queue is shifted to the head queue position. The new first data block corresponding to the head queue position is judged, processed and looped again.

[0039] Otherwise, the first data block is looped back to the tail queue position of the buffer through the built-in protocol stack, the initial data block queue is shifted to the head queue position, and the new first data block corresponding to the head queue position is judged, processed, and looped again.

[0040] Preferably, the step of sequentially passing UDP data from the link layer to the network layer, transport layer, session layer, presentation layer, and finally to the application layer according to the loop strategy includes:

[0041] The system acquires UDP data processing tasks at the network layer, transport layer, session layer, presentation layer, and application layer. Based on these data processing tasks, it determines the UDP data processing operation at each layer according to the cyclical strategy.

[0042] The UDP data processing operations of each layer are arranged into an operation sequence in order. According to the operation sequence, the UDP data in the link layer is passed to the network layer, transport layer, session layer, presentation layer, and finally to the application layer.

[0043] Preferably, it also includes: obtaining data access requirements, and accessing and displaying UDP data based on the data access requirements, specifically:

[0044] Based on the data access requirements and in conjunction with access permissions, determine the interface information that meets the requirements and establish the association information between the interface information.

[0045] Based on the association information, determine the interface mapping characteristics of UDP data, and establish the access mapping path of UDP data according to the interface mapping characteristics;

[0046] Based on the access mapping path, UDP data is mapped to the access network interface card space;

[0047] Data display requirements are obtained from the data access requirements, and the amount of data to be transmitted and the data processing characteristics are determined based on the data display requirements.

[0048] Based on the data volume and data processing characteristics, design the transmission rules between adjacent layers of the network layer, transport layer, session layer, presentation layer and application layer;

[0049] Based on the aforementioned transmission rules, the specific strategy parameters in the buffer's loop strategy are determined to obtain the target loop strategy.

[0050] UDP data is transmitted according to the target loop strategy, and the results of the transmission are displayed based on the UDP data.

[0051] Preferably, based on the transmission rules, the specific strategy parameters in the buffer's loop strategy are determined to obtain the target loop strategy, including:

[0052] Data mapping features, data processing task information at each layer, protocol stack information, and data transmission mapping information are obtained from the transmission rules.

[0053] Based on the data processing task information, the task processing parameters in the loop strategy are determined; based on the protocol stack information, the protocol stack parameters in the loop strategy are determined; and based on the data transmission mapping information, the mapping parameters in the loop strategy are determined.

[0054] Based on the task processing parameters, protocol stack parameters, and mapping parameters, the target loop strategy is obtained.

[0055] Compared with the prior art, the present invention has achieved the following beneficial effects:

[0056] By utilizing its built-in protocol stack, access permissions are established between the user space interface and the network interface card (NIC). This built-in stack offers broad applicability, eliminating Android system limitations and making it particularly suitable for USB NICs. Regarding access permissions, UDP data from user space is mapped to the NIC's link layer. The link layer and application layer share memory. During the data filling process, the application layer uses pre-allocated memory, avoiding the process of copying data from the driver to kernel space and then back to the link layer. This also avoids copying socket buffer memory from the link layer to user space, reducing memory bandwidth usage. The link layer uses a linked list of data blocks of uniform size for UDP data distribution. UDP data is transmitted according to this distribution and then to the application layer. Data description information is filled into the shared memory blocks during construction, allowing direct access to data during transmission. The use of a circular buffer also improves memory efficiency and reduces additional memory overhead. Data travels directly from the link layer to the application layer without going through layers of protocol stack processing, reducing the protocol stack's processing burden and lowering CPU usage.

[0057] Other features and advantages of the invention will be set forth in the description which follows, and will be apparent in part from the description, or may be learned by practicing the invention. The objects and other advantages of the invention may be realized and obtained by means of the structures particularly pointed out in this application.

[0058] The technical solution of the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. Attached Figure Description

[0059] The accompanying drawings are provided to further illustrate the invention and form part of the specification. They are used in conjunction with embodiments of the invention to explain the invention and do not constitute a limitation thereof. In the drawings:

[0060] Figure 1 This is a flowchart of an efficient UDP data receiving method according to an embodiment of the present invention;

[0061] Figure 2 This is a hierarchy diagram showing the data transmission process of UDP data through the network interface card in this embodiment of the invention.

[0062] Figure 3 This is a structural diagram of the buffer in an embodiment of the present invention. Detailed Implementation

[0063] The preferred embodiments of the present invention will be described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.

[0064] Example 1:

[0065] This invention provides an efficient UDP data reception method, such as... Figure 1 As shown, it includes:

[0066] S1: Establish access permissions between the user space interface and the network card space interface through the built-in protocol stack;

[0067] S2: Based on the access permissions, map the UDP data in user space to the link layer in network interface card space;

[0068] S3: UDP data is distributed using a buffer with a consistent data block linked list at the link layer;

[0069] S4: Transmit the UDP data according to the UDP data distribution and pass it to the application layer.

[0070] In this embodiment, a built-in protocol stack is provided, supporting protocols such as DNS, ARP, ICMP, and IGMP, as well as HTTP transmission. It also supports user memory mapping to the link layer for reading and writing to address differences between systems and access permission issues.

[0071] In this embodiment, such as Figure 2 As shown, UDP data is transmitted through the network interface card (NIC) in sequence, starting from the link layer and passing through the network layer, transport layer, session layer, presentation layer, and application layer.

[0072] In this embodiment, the buffer is structured as follows: Figure 3 As shown, each data block of Ethernet frame data is transmitted cyclically.

[0073] In this embodiment, the data receiving buffer uses a linked list of data blocks of uniform size to fill the waiting-to-fill queue. Each data block is allocated space of the maximum MTU + 20 bytes during design (to facilitate expansion and reserve block record information). When a complete Ethernet frame is received, it is callbacked to the user space. When passing it to the application, only the last 8 bytes of each memory block need to be used to identify the length of the memory block, the length of the valid data, and the data offset within the block. This allows the application to accurately locate the valid data position and length, facilitating data access and allowing the memory block to be reused. Once the user has finished processing the data, the memory block can be returned to the waiting-to-fill queue. This reduces data copying while completing the cyclic reception and distribution of data.

[0074] In this embodiment, since only the head and tail nodes of the queue need to be processed during data processing, spinlocks can reduce blocking. At the same time, since the data does not go through the protocol stack to the application layer, the data interaction is completed directly through the circular buffer, which greatly reduces the processing overhead of the protocol stack and reduces CPU usage. Also, because memory copying is reduced, the limited memory bandwidth can be utilized.

[0075] The beneficial effects of the above design scheme are as follows: By integrating a protocol stack, access permissions are established between the user space interface and the network card space interface. The integrated protocol stack provides universal adaptability, is not limited by the Android system, and is particularly suitable for USB network cards. Regarding access permissions, UDP data from user space is mapped to the link layer of the network card space. The link layer and application layer share memory. During the data filling process, the application layer uses pre-allocated memory space, avoiding the process of copying data from the driver to the kernel space and then back to the link layer. This also avoids copying socket buffer memory from the link layer to user space, reducing memory bandwidth usage. The link layer uses a buffer with a consistent-size linked list of data blocks for UDP data distribution. UDP data is transmitted according to the distribution and then to the application layer. Data description information is filled during the construction of shared memory blocks, allowing direct access to data during transmission. The use of a circular buffer also improves memory efficiency and reduces additional memory overhead. Data travels directly from the link layer to the application layer without going through layers of packet processing in the protocol stack, reducing the processing burden on the protocol stack and lowering CPU usage.

[0076] Example 2:

[0077] Based on Embodiment 1, this embodiment of the invention provides an efficient UDP data reception method, which further includes the following steps before step S1:

[0078] The built-in protocol stack is parsed to obtain multiple protocol layers, and the protocol functions of each protocol layer are obtained.

[0079] Based on the protocol functions, the configuration parameters for each protocol layer are determined. Based on the relationships between the protocol layers, the configuration parameters are optimized to obtain the target configuration parameters.

[0080] Based on the target configuration parameters, the built-in protocol stack is added to the UDP data receiving platform.

[0081] The beneficial effects of the above design scheme are as follows: by parsing the built-in protocol stack, multiple protocol layers are obtained, and the protocol functions of each protocol layer are acquired. Based on the protocol functions, the configuration parameters for each protocol layer are determined. Based on the relationship between the protocol layers, the configuration parameters are optimized to obtain the target configuration parameters. Based on the target configuration parameters, the built-in protocol stack is added to the UDP data receiving platform, supporting user memory mapping to link layer read and write to solve the differences between their respective systems and access permission issues.

[0082] Example 3:

[0083] Based on Embodiment 1, this embodiment of the invention provides an efficient UDP data reception method. In step S1, an access permission system is established between the user space interface and the network card space interface using a built-in protocol stack, including:

[0084] A user model is established based on the user space interface, a storage space model is established based on the network card space interface, and a dedicated language for access permissions is established based on the user model and the storage space model.

[0085] Based on the access permission-specific language, create protocol permissions corresponding to the built-in protocol stack;

[0086] Based on the aforementioned protocol permissions, establish access permissions between the user space interface and the network card space interface.

[0087] The beneficial effects of the above design scheme are as follows: By establishing a user model based on the user space interface and a storage space model based on the network interface card (NIC) space interface, a dedicated access permission language is established based on the user model and the storage space model. Based on the dedicated access permission language, protocol permissions corresponding to the built-in protocol stack are created. Based on the protocol permissions, access permissions between the user space interface and the NIC space interface are established, thereby reducing data copying by directly mapping the user space memory to the NIC layer link for data reception.

[0088] Example 4:

[0089] Based on Embodiment 1, this embodiment of the invention provides an efficient UDP data reception method. In step S2, based on the access permissions, UDP data in user space is mapped to the link layer of the network interface card (NIC), including:

[0090] Obtain the first memory heap in user space, obtain the second memory heap in network interface card space, and match the first memory heap and the second memory heap to obtain the memory heap matching relationship;

[0091] Based on the memory heap matching relationship, access information is established, and according to the access information, UDP data in user space is mapped to the link layer of network interface card space.

[0092] The beneficial effects of the above design scheme are: based on the memory heap matching relationship, access information is established, and according to the access information, the UDP data in the user space is mapped to the link layer of the network card space through the access permission, thereby realizing the direct mapping of the user space memory to the link data reception of the network card layer to reduce data copying.

[0093] Example 5:

[0094] Based on Embodiment 1, this embodiment of the invention provides an efficient UDP data reception method. In step S3, UDP data is distributed at the link layer using a buffer with a data block linked list of uniform size, including:

[0095] Configure a maximum transmission unit of 20 bytes for each data block, and organize all configured data blocks into a linked list;

[0096] The UDP data at the link layer mapped to the network interface card space is divided into multiple Ethernet frames according to the transmission capacity of the maximum transmission unit, and the Ethernet frames are matched sequentially to the data blocks in the data block list.

[0097] After receiving an Ethernet frame, the data block identifies the data block length, effective data length, and data offset within the block in the last 8 bytes based on the data content of the Ethernet frame.

[0098] After the data block has been distributed, it is returned to the data block list for the distribution of new Ethernet frames.

[0099] The beneficial effects of the above design scheme are as follows: By configuring a maximum transmission unit (MTU) and 20 bytes for each data block, all configured data blocks are grouped into a data block linked list. The UDP data mapped to the network interface card (NIC) space at the link layer is divided into multiple Ethernet frames according to the MTU's transmission capacity. These Ethernet frames are then matched sequentially to the data blocks in the data block linked list. After receiving an Ethernet frame, the data block identifies the data block length, valid data length, and data offset within the block in the last 8 bytes based on the data content of the Ethernet frame. After the data block completes data distribution, it is returned to the data block linked list for the distribution of new Ethernet frames. This allows applications to accurately locate the valid data position and valid data length, facilitating data access while reusing the memory. Once the user has finished processing the data, the memory block can be returned to the queue waiting to be filled. This reduces data copying while completing the cyclic reception and distribution of data.

[0100] Example 6:

[0101] Based on Embodiment 1, this embodiment of the invention provides an efficient UDP data receiving method. In step S4, the UDP data is transmitted according to the UDP data distribution and then transmitted to the application layer, including:

[0102] Set the buffer's round-robin strategy according to the UDP data distribution;

[0103] According to the described cyclic strategy, UDP data at the link layer will be passed sequentially to the network layer, transport layer, session layer, presentation layer, and finally to the application layer.

[0104] The beneficial effects of the above design scheme are as follows: by setting a circular strategy for the buffer according to the distribution of UDP data, the UDP data at the link layer is sequentially passed to the network layer, transport layer, session layer, presentation layer, and finally to the application layer according to the circular strategy. Since only the head and tail nodes of the queue need to be processed during the data processing, the use of spin locks can reduce blocking. At the same time, since the data does not go through the process of being passed to the application layer through the protocol stack, the data interaction is completed directly through the circular buffer, which greatly reduces the processing overhead of the protocol stack and reduces the CPU usage. Also, because memory copying is reduced, the limited memory bandwidth can be utilized.

[0105] Example 7:

[0106] Based on Embodiment 6, this embodiment of the invention provides an efficient UDP data reception method, wherein setting a buffer cyclic strategy according to the distribution of UDP data includes:

[0107] Obtain the initial data block queue corresponding to the distribution of UDP data, and obtain the head queue position and tail queue position of the initial data block queue;

[0108] Obtain the first data block at the first queue position, and obtain the UDP header of the first data block. Based on the UDP header, determine whether the data in the first data block is unicast or multicast data.

[0109] If so, the first data block is transmitted to the user processing data list to wait for processing. After the first data block completes the user data processing task, the first data block is looped back to the tail queue position of the buffer. The initial data block queue is shifted to the head queue position. The new first data block corresponding to the head queue position is judged, processed and looped again.

[0110] Otherwise, the first data block is looped back to the tail queue position of the buffer through the built-in protocol stack, the initial data block queue is shifted to the head queue position, and the new first data block corresponding to the head queue position is judged, processed, and looped again.

[0111] The advantages of the above design are: during data processing, only the head and tail nodes of the queue need to be processed, and the use of spin locks can reduce blocking. At the same time, since the data does not go through the protocol stack to the application layer, the data interaction is completed directly through the circular buffer, which greatly reduces the processing overhead of the protocol stack and reduces CPU usage. Also, because memory copying is reduced, the limited memory bandwidth can be utilized.

[0112] Example 8:

[0113] Based on Embodiment 6, this embodiment of the invention provides an efficient UDP data reception method, wherein the UDP data at the link layer is sequentially passed to the network layer, transport layer, session layer, presentation layer, and finally to the application layer according to the described round-robin strategy, including:

[0114] The system acquires UDP data processing tasks at the network layer, transport layer, session layer, presentation layer, and application layer. Based on these data processing tasks, it determines the UDP data processing operation at each layer according to the cyclical strategy.

[0115] The UDP data processing operations of each layer are arranged into an operation sequence in order. According to the operation sequence, the UDP data in the link layer is passed to the network layer, transport layer, session layer, presentation layer, and finally to the application layer.

[0116] The advantages of the above design scheme are: the data access mechanism of the link layer is completed based on the data access of the virtual network card and the built-in protocol stack, the data is processed in a loop using the shared memory method, and the detected target data is sent directly from the link layer to the application layer for processing without being processed by the protocol stack.

[0117] Example 9:

[0118] Based on Embodiment 1, this embodiment of the invention provides an efficient UDP data receiving method, which further includes: obtaining data access requirements, and accessing and displaying UDP data based on the data access requirements, specifically:

[0119] Based on the data access requirements and in conjunction with access permissions, determine the interface information that meets the requirements and establish the association information between the interface information.

[0120] Based on the association information, determine the interface mapping characteristics of UDP data, and establish the access mapping path of UDP data according to the interface mapping characteristics;

[0121] Based on the access mapping path, UDP data is mapped to the access network interface card space;

[0122] Data display requirements are obtained from the data access requirements, and the amount of data to be transmitted and the data processing characteristics are determined based on the data display requirements.

[0123] Based on the data volume and data processing characteristics, design the transmission rules between adjacent layers of the network layer, transport layer, session layer, presentation layer and application layer;

[0124] Based on the aforementioned transmission rules, the specific strategy parameters in the buffer's loop strategy are determined to obtain the target loop strategy.

[0125] UDP data is transmitted according to the target loop strategy, and the results of the transmission are displayed based on the UDP data.

[0126] The beneficial effects of the above design scheme are: by further determining the specific parameter settings in the data reception, transmission and display process based on data access requirements, a target loop strategy is obtained, UDP data is transmitted according to the target loop strategy, and the display results of UDP data are based on the transmission results, thus ensuring the efficiency and accuracy of data reception and display.

[0127] Example 10:

[0128] Based on Embodiment 9, this embodiment of the invention provides an efficient UDP data reception method, which, based on the transmission rules, determines specific policy parameters in the buffer's loop strategy to obtain a target loop strategy, including:

[0129] Data mapping features, data processing task information at each layer, protocol stack information, and data transmission mapping information are obtained from the transmission rules.

[0130] Based on the data processing task information, the task processing parameters in the loop strategy are determined; based on the protocol stack information, the protocol stack parameters in the loop strategy are determined; and based on the data transmission mapping information, the mapping parameters in the loop strategy are determined.

[0131] Based on the task processing parameters, protocol stack parameters, and mapping parameters, the target loop strategy is obtained.

[0132] The beneficial effects of the above design scheme are: by further determining the specific parameter settings in the data reception, transmission and display process based on data access requirements, a target loop strategy is obtained, UDP data is transmitted according to the target loop strategy, and the display results of UDP data are based on the transmission results, thus ensuring the efficiency and accuracy of data reception and display.

[0133] Obviously, those skilled in the art can make various modifications and variations to this invention without departing from its spirit and scope. Therefore, if these modifications and variations fall within the scope of this application and its equivalents, this invention also intends to include these modifications and variations.

Claims

1. A highly efficient UDP data receiving method, characterized in that, include: S1: Establish access permissions between the user space interface and the network card space interface through the built-in protocol stack; S2: Based on the access permissions, map the UDP data in user space to the link layer in network interface card space; S3: UDP data is distributed using a buffer at the link layer that uses a linked list of data blocks of uniform size, including: Configure a maximum transmission unit of 20 bytes for each data block, and organize all configured data blocks into a linked list; The UDP data at the link layer mapped to the network interface card space is divided into multiple Ethernet frames according to the transmission capacity of the maximum transmission unit, and the Ethernet frames are matched sequentially to the data blocks in the data block list. After receiving an Ethernet frame, the data block identifies the data block length, effective data length, and data offset within the block in the last 8 bytes based on the data content of the Ethernet frame. After the data block has been distributed, the data block is returned to the data block list for the distribution of new Ethernet frames. S4: Transmit the UDP data according to the UDP data distribution and pass it to the application layer.

2. The efficient UDP data receiving method according to claim 1, characterized in that, Before S1, it also includes: The built-in protocol stack is parsed to obtain multiple protocol layers, and the protocol functions of each protocol layer are obtained. Based on the protocol functions, the configuration parameters for each protocol layer are determined. Based on the relationships between the protocol layers, the configuration parameters are optimized to obtain the target configuration parameters. Based on the target configuration parameters, the built-in protocol stack is added to the UDP data receiving platform.

3. The efficient UDP data receiving method according to claim 1, characterized in that, In step S1, access permissions between the user space interface and the network card space interface are established through the built-in protocol stack, including: A user model is established based on the user space interface, a storage space model is established based on the network card space interface, and a dedicated language for access permissions is established based on the user model and the storage space model. Based on the access permission-specific language, create protocol permissions corresponding to the built-in protocol stack; Based on the aforementioned protocol permissions, establish access permissions between the user space interface and the network card space interface.

4. The efficient UDP data receiving method according to claim 1, characterized in that, In step S2, based on the access permissions, mapping UDP data in user space to the link layer of the network interface card (NIC) includes: Obtain the first memory heap in user space, obtain the second memory heap in network interface card space, and match the first memory heap and the second memory heap to obtain the memory heap matching relationship; Based on the memory heap matching relationship, access information is established, and according to the access information, UDP data in user space is mapped to the link layer of network interface card space.

5. The efficient UDP data receiving method according to claim 1, characterized in that, In step S4, the UDP data is transmitted according to the UDP data distribution and then transmitted to the application layer, including: Set the buffer's round-robin strategy according to the UDP data distribution; According to the described cyclic strategy, UDP data at the link layer will be passed sequentially to the network layer, transport layer, session layer, presentation layer, and finally to the application layer.

6. The efficient UDP data receiving method according to claim 5, characterized in that, The method for setting the buffer's round-robin strategy according to UDP data distribution includes: Obtain the initial data block queue corresponding to the distribution of UDP data, and obtain the head queue position and tail queue position of the initial data block queue; Obtain the first data block at the first queue position, and obtain the UDP header of the first data block. Based on the UDP header, determine whether the data in the first data block is unicast or multicast data. If so, the first data block is transmitted to the user processing data list to wait for processing. After the first data block completes the user data processing task, the first data block is looped back to the tail queue position of the buffer. The initial data block queue is shifted to the head queue position. The new first data block corresponding to the head queue position is judged, processed and looped again. Otherwise, the first data block is looped back to the tail queue position of the buffer through the built-in protocol stack, the initial data block queue is shifted to the head queue position, and the new first data block corresponding to the head queue position is judged, processed, and looped again.

7. The efficient UDP data receiving method according to claim 5, characterized in that, The process, following the described cyclical strategy, involves sequentially passing UDP data from the link layer to the network layer, transport layer, session layer, presentation layer, and finally to the application layer, including: The system acquires UDP data processing tasks at the network layer, transport layer, session layer, presentation layer, and application layer. Based on these data processing tasks, it determines the UDP data processing operation at each layer according to the cyclical strategy. The UDP data processing operations of each layer are arranged into an operation sequence in order. According to the operation sequence, the UDP data in the link layer is passed to the network layer, transport layer, session layer, presentation layer, and finally to the application layer.

8. The efficient UDP data receiving method according to claim 1, characterized in that, Also includes: Obtain data access requirements, and based on these requirements, access and display UDP data, specifically as follows: Based on the data access requirements and in conjunction with access permissions, determine the interface information that meets the requirements and establish the association information between the interface information. Based on the association information, determine the interface mapping characteristics of UDP data, and establish the access mapping path of UDP data according to the interface mapping characteristics; Based on the access mapping path, UDP data is mapped to the access network interface card space; Data display requirements are obtained from the data access requirements, and the amount of data to be transmitted and the data processing characteristics are determined based on the data display requirements. Based on the data volume and data processing characteristics, design the transmission rules between adjacent layers of the network layer, transport layer, session layer, presentation layer and application layer; Based on the aforementioned transmission rules, the specific strategy parameters in the buffer's loop strategy are determined to obtain the target loop strategy. UDP data is transmitted according to the target loop strategy, and the results of the transmission are displayed based on the UDP data.

9. The efficient UDP data receiving method according to claim 8, characterized in that, Based on the aforementioned transmission rules, the specific policy parameters in the buffer's loop strategy are determined to obtain the target loop strategy, including: Data mapping features, data processing task information at each layer, protocol stack information, and data transmission mapping information are obtained from the transmission rules. Based on the data processing task information, the task processing parameters in the loop strategy are determined; based on the protocol stack information, the protocol stack parameters in the loop strategy are determined; and based on the data transmission mapping information, the mapping parameters in the loop strategy are determined. Based on the task processing parameters, protocol stack parameters, and mapping parameters, the target loop strategy is obtained.

Citation Information

Patent Citations

  • Data packet processing method and device and storage medium

    CN110855610A

  • Implementation method and device of lightweight network protocol stack

    CN115665267A