CN111817818A - Method and device for transmitting data packet - Google Patents

Method and device for transmitting data packet Download PDF

Info

Publication number
CN111817818A
CN111817818A CN201910290555.7A CN201910290555A CN111817818A CN 111817818 A CN111817818 A CN 111817818A CN 201910290555 A CN201910290555 A CN 201910290555A CN 111817818 A CN111817818 A CN 111817818A
Authority
CN
China
Prior art keywords
block
data packet
target
layer
queue
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910290555.7A
Other languages
Chinese (zh)
Inventor
李海聪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Mobile Communications Group Co Ltd
China Mobile Group Sichuan Co Ltd
Original Assignee
China Mobile Communications Group Co Ltd
China Mobile Group Sichuan Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by China Mobile Communications Group Co Ltd, China Mobile Group Sichuan Co Ltd filed Critical China Mobile Communications Group Co Ltd
Priority to CN201910290555.7A priority Critical patent/CN111817818A/en
Publication of CN111817818A publication Critical patent/CN111817818A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/0001Systems modifying transmission characteristics according to link quality, e.g. power backoff
    • H04L1/0015Systems modifying transmission characteristics according to link quality, e.g. power backoff characterised by the adaptation strategy
    • H04L1/0016Systems modifying transmission characteristics according to link quality, e.g. power backoff characterised by the adaptation strategy involving special memory structures, e.g. look-up tables
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/568Storing data temporarily at an intermediate stage, e.g. caching

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Quality & Reliability (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a method and a device for transmitting data packets, which are used for solving the problem of high packet loss rate of the transmitted data packets. The scheme provided by the application comprises the following steps: determining at least one target block in a user layer according to at least one data packet received by a network layer and an annular preset block queue in a kernel layer, wherein when the number of the determined target blocks is multiple, the multiple target blocks are adjacent in the preset block queue; storing the at least one data packet into the at least one target block. The scheme of the embodiment of the invention can ensure that the target block for storing the data packet conforms to the preset block queue, so that the physical addresses of the stored data packet are logically continuous, the problem of packet loss caused by logic address dispersion is avoided, and the probability of packet loss is reduced.

Description

Method and device for transmitting data packet
Technical Field
The present invention relates to the field of data transmission, and in particular, to a method and an apparatus for transmitting data packets.
Background
In the Linux operating system, I/O operations enable data to be transferred between a buffer in the kernel address space of the operating system and a buffer defined by the application address space. The CPU overhead is large in the data transmission process, and the data transmission capability is low.
A method for zero-copy data transmission includes the following two steps:
1) an effective user-level communication interface is created, namely, an application program directly sends out or receives data from the communication interface, and unnecessary copying processes in a system kernel are eliminated;
2) the direct data transmission from the input end to the output end of the router means that the received message is buffered by a memory only once, and the message in the buffer queue is directly transmitted to the output port to be transmitted after being processed by necessary control information, so that the rapid forwarding of the message is realized.
The existing zero-copy data transmission method generally stores data packets randomly, so that the positions of the stored data packets are scattered, and packet loss is easy to occur in the transmission process.
How to reduce the packet loss rate of the transmission data packet is a technical problem to be solved by the application.
Disclosure of Invention
An object of the embodiments of the present application is to provide a method and an apparatus for transmitting a data packet, so as to solve the problem of high packet loss rate of the transmitted data packet.
In a first aspect, a method for transmitting a data packet is provided, including:
determining at least one target block in a user layer according to at least one data packet received by a network layer and an annular preset block queue in a kernel layer, wherein when the number of the determined target blocks is multiple, the multiple target blocks are adjacent in the preset block queue;
storing the at least one data packet into the at least one target block.
In a second aspect, an apparatus for transmitting data packets includes:
the device comprises a determining module, a judging module and a judging module, wherein the determining module determines at least one target block in a user layer according to at least one data packet received by a network layer and an annular preset block queue in a kernel layer, and when the number of the determined target blocks is multiple, the multiple target blocks are adjacent in the preset block queue;
the storage module stores the at least one data packet into the at least one target block.
In a third aspect, an electronic device is provided, comprising a processor, a memory and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the steps of the method according to the first aspect.
In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, which computer program, when being executed by a processor, realizes the steps of the method according to the first aspect.
In the embodiment of the present application, at least one target block in a user layer is determined according to at least one data packet received by a network layer and an annular preset block queue in a kernel layer, wherein when the number of the determined target blocks is multiple, the multiple target blocks are adjacent in the preset block queue; storing the at least one data packet into the at least one target block. The scheme of the embodiment of the invention can ensure that the target block for storing the data packet conforms to the preset block queue, so that the physical addresses of the stored data packet are logically continuous, the problem of packet loss caused by logic address dispersion is avoided, and the probability of packet loss is reduced.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the invention and not to limit the invention. In the drawings:
FIG. 1a is a schematic flow chart of a method for transmitting data packets according to the present application;
FIG. 1b is a schematic diagram of a logical structure of a transport packet according to the present application;
FIG. 1c is a schematic diagram of a predetermined block queue logic structure according to the present application;
FIG. 2 is a second flowchart of a method for transmitting data packets according to the present application;
fig. 3 is a third flowchart of a method for transmitting data packets according to the present application;
FIG. 4 is a fourth flowchart illustrating a method of transmitting data packets according to the present application;
FIG. 5 is a fifth flowchart illustrating a method of transmitting data packets according to the present application;
FIG. 6 is a sixth flowchart illustrating a method of transmitting data packets according to the present application;
FIG. 7 is a seventh flowchart illustrating a method of transmitting a data packet according to the present application;
FIG. 8 is an eighth flowchart illustrating a method of transmitting data packets according to the present application;
fig. 9 is a schematic structural diagram of an electronic device of the present application.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention. The reference numbers in the present application are only used for distinguishing the steps in the scheme and are not used for limiting the execution sequence of the steps, and the specific execution sequence is described in the specification.
In the prior art, a typical zero-copy data transmission architecture includes a network card layer, a kernel layer and a user layer. In the zero-copy scheme, the user layer and the network card layer are directly interacted, so that the resource overhead required by the copying and transmission of the kernel layer is avoided, and the target of zero-copy is achieved.
Because the number of data packets is large and the capacity is large in the current high-speed network environment, the existing zero-copy technology adopts a random storage method for the captured data packets, so that the storage positions of the data packets are always scattered, and inconvenience is caused for reading the data packets and analyzing the data packets in subsequent work of intrusion detection. In addition, because the data packets are stored dispersedly, the probability of packet loss is often high, and the data packets finally acquired by the user process may be incomplete.
To solve the problems in the prior art, the present application provides a method for transmitting a data packet, as shown in fig. 1a, including the following steps:
s11: determining at least one target block in a user layer according to at least one data packet received by a network layer and an annular preset block queue in a kernel layer, wherein when the number of the determined target blocks is multiple, the multiple target blocks are adjacent in the preset block queue;
s12: storing the at least one data packet into the at least one target block.
Referring to the structure shown in fig. 1b, the scheme provided by the present application is applicable to a transmission architecture including a network layer Z, a kernel layer Y and a user layer X.
When the user layer X includes a plurality of buffers N, the size of each buffer N may be different, and the physical locations of the plurality of buffers N may be discontinuous. The buffer N in the user layer X may be divided into a plurality of buffer blocks in advance according to the positions and sizes of the plurality of buffer blocks N, and preferably, the capacity of each buffer block is equal. Then, a unique descriptor can be established for each buffer block, and the descriptor is used for characterizing the buffer block.
In addition, the user layer X in the present scheme may also be regarded as a part of the application program, and the buffer N in the user layer X may be an area that can store data associated with the application program.
The function of the kernel layer y (kernel) is to realize data transmission between the network layer and the user layer X. The core layer Y is pre-configured with a ring-shaped predetermined block queue M, which may also be referred to as a free queue. The predetermined block queue M includes a plurality of identifiers capable of representing buffer blocks in the user layer X, where the buffer blocks can store data, and specifically, the identifiers may be descriptors of the blocks. Each entry in the predetermined block queue M includes a descriptor of the block. Preferably, there are no two or more identical tile descriptors in the predetermined tile queue M.
A Network Information Center (NIC) may include a receive loop (not shown in fig. 1 b), and the content of the receive loop is synchronized with the predetermined block queue M in the kernel layer Y. The network layer Z transfers the data packet O received from the network directly into the buffer of the user layer X according to the information in the reception loop.
Specifically, the number of target blocks may be determined according to the capacity of the packet O received in the network layer Z, and when the capacity of the packet is larger, the number of the determined target blocks may be larger. After determining the number of target blocks, the descriptors of the number of target blocks may be selected from the predetermined block queue M. When the number is greater than 1, the descriptors selected from the predetermined block queue M are adjacent.
As shown in fig. 1c, a schematic diagram of a logical structure of the predetermined block queue is shown. The predetermined block queue includes m1、m2、m3、m4、m5、m6、m7、m8There are 8 descriptors corresponding to the buffer block.
Assuming that the network layer determines that the number of target blocks is 1 according to the received data packet, the selected descriptor may be m based on the predetermined block queue shown in fig. 1c1. Assuming that the network layer determines that the number of target blocks is 3 according to the received data packet, the selected descriptor may be m based on the predetermined block queue shown in fig. 1c1、m2、m3. In fact, the starting position of the selection descriptor can be set in advance in the predetermined block queue according to the actual situation. For example, m shown by the dashed box shown in FIG. 1c1The position of the descriptor is set as the starting position of the selected descriptor, and then continuous descriptors are selected from the positions shown by the dotted line boxes along the preset direction according to the determined number of the target blocks. In this embodiment, the preset direction may be a clockwise direction.
In practical application, the network layer can continuously receive a plurality of data packets. Suppose that the network layer receives O in turn1、O2、O3For a total of three packets. Meanwhile, assuming that each block in the predetermined block queue can store one packet, the number of the determined target blocks is three. Based on the predetermined block queue structure shown in fig. 1c, the descriptors of the selected three target blocks may be m1、m2、m3. Subsequently, the network layer may package the packet O1Is transmitted to descriptor m1In the corresponding target block, packet O2Is transmitted to descriptor m2In the corresponding target block, packet O3Is transmitted to descriptor m3Within the corresponding target block.
In addition, the network layer may receive the packet O first1And will data packet O1Is transmitted to descriptor m1Receiving the data packet O after the corresponding target block2
According to the scheme provided by the application, after at least one target block is determined, the network layer directly transmits the data packet to the at least one target block in the user layer. The target block for storing the data packet can be ensured to be in accordance with the preset block queue, so that the physical addresses of the stored data packet are logically continuous, the application program can determine the physical position for storing the data packet based on the preset block queue, the packet loss problem caused by logic address dispersion is avoided, and the packet loss probability is reduced. In comparison, in the prior art, the network layer first transmits the data packet from the storage unit of the network layer to a certain block buffer of the kernel, and then the interrupt handler pushes the data packet in the kernel layer to the protocol stack of the upper layer. The disadvantage of this way of transferring data is mainly the multiple copies and system calls. According to the scheme provided by the application, the network layer transmits the data packet according to the receiving ring, the target block located in the user layer can be determined according to the descriptor in the preset block queue, then the data packet is directly transmitted to the user layer from the network layer, and the data packet does not enter the protocol stack of the kernel any more.
Preferably, before the above steps are performed, initialization operations need to be performed on the user layer, the kernel layer and the network layer. Based on the method provided by the foregoing embodiment, before the foregoing step S11 is executed, as shown in fig. 2, the method provided by the present application further includes:
s101: establishing at least one block in the user layer, and generating a block address mapping table containing the mapping relation between the at least one block and the physical address of the at least one block;
s102: and generating the preset block queue in the kernel layer according to the at least one established block.
Specifically, an initialization operation is first performed on the user layer. First, at least one buffer area which can be used for storing data packets in a user layer is determined, and the at least one buffer area is divided into a plurality of buffer blocks (user buffers). The size and number of the buffer blocks can be preset according to actual requirements. Then, an address mapping table of the user layer is initialized, and the size of the address mapping table is related to the number of buffer blocks. The address mapping table includes the corresponding relationship between the buffer blocks and the physical addresses of the buffer blocks.
After initializing the user layer, an initialization operation is performed on the kernel layer. A circular pre-defined block queue (FREEQ) is established, each entry in the queue corresponding to a buffer block in the user layer where data can be stored. Specifically, defining a FREE linked list, initializing the FREE list, and assigning FREE [ i ] to i; so that the pointer to FREE (i) points to UserBuffer [ i ].
According to the scheme provided by the application, the initialization operation of the user layer and the kernel layer can be realized, and the preset block queue in the kernel layer is associated with the block in the user layer. According to the preset block queue in the kernel layer, it can know which blocks in the user layer can be used for storing data, so that the network layer can store the data packet in the idle buffer blocks in the user layer.
Based on the method provided by the foregoing embodiment, as shown in fig. 3, the foregoing step S102 preferably includes:
s1021: generating a descriptor in one-to-one correspondence with the at least one tile, the descriptor including a tile identifier of the tile corresponding to the descriptor;
s1022: generating a predetermined block queue including at least one descriptor in the kernel layer.
Specifically, each buffer block in the user layer corresponds to a chunk symbol, and each chunk symbol is filled into an offset field of a descriptor corresponding to the buffer block. Then, the descriptors corresponding to the buffer blocks are circularly arranged and programmed into the predetermined block queue (FREEQ), so that each entry in the predetermined block queue corresponds to a buffer block in the user layer for storing data.
The above scheme provided by the present application can generate descriptors corresponding to the buffer blocks based on the block identifiers of the buffer blocks, so that each entry in the preset block queue corresponds to one buffer block in the user layer.
Based on the method provided by the foregoing embodiment, preferably, after the foregoing step S102, as shown in fig. 4, the method provided by the present application further includes:
s103: generating a physical address table in the kernel layer according to the at least one established block, wherein the physical address table comprises a corresponding relation between each established block and a physical address of each established block;
s104: and generating a data field in the network layer according to the preset block queue and the physical address table, wherein the data field comprises a pointer pointing to the preset block queue and an address of the physical address table.
Specifically, in the process of initializing the kernel layer, a physical address table may be established in the kernel layer, where the physical address table is associated with the preset block queue. The physical address table includes a buffer block and a corresponding relation of physical addresses of the buffer block.
According to the scheme provided by the application, the physical address table associated with the preset block queue can be established in the kernel layer, and the physical address table comprises the physical address of each block in the preset block queue, so that the network layer determines the buffer block capable of storing data according to the preset block queue and the physical address table, determines the physical address of the buffer block and further transmits the received data.
Then, an initialization operation is performed on the network layer. Initializing a data field in the network layer, and filling a pointer of a preset block queue in the kernel layer and an address in a physical address table into the data field in the network layer. The network layer can determine the buffer blocks and the physical addresses of the blocks which can be used for storing data according to the preset block queue and the physical address table in the kernel layer.
Based on the method provided by the foregoing embodiment, it is preferable that, before step S12, as shown in fig. 5, the method further includes:
s105: writing the size of at least one data packet received by the network layer into the data field;
wherein, the step S12 includes:
s121: determining a descriptor of a target block in the preset block queue according to the data field of the network layer;
s122: determining a physical address corresponding to the descriptor of the target block in the physical address table according to a data field of the network layer;
s123: and storing at least one data packet in the target block according to the size of the at least one data packet in the data field of the network layer.
Specifically, after initializing the user layer, the kernel layer, and the network layer, the network layer performs packet capturing. And sending a hardware interrupt once after the data packet to be stored reaches the network layer, and receiving the packet to interrupt the processing program.
Then, based on the data field of the network layer, the descriptor of the available target block in the preset block queue is determined, and the descriptor is analyzed to obtain the block number and the physical address of the target block. Then, the physical address of the target block is written into a data field of a network layer, and the data packet is transmitted based on the size of the data packet.
The scheme provided by the application can directly transmit the data packet received by the network layer to the buffer block in the user layer. In the transmission process, the network layer determines at least one target block capable of storing the received data packet according to a preset block queue and a physical address list in the kernel layer, so that the determined target block can be used for storing the received data packet, and the situations of packet loss or overflow and the like in the transmission process are avoided.
After the network layer transmits the data packet to the target block in the user layer, the application program of the user layer may parse the data packet stored in the target block. Specifically, the application program in the user layer may monitor the number of descriptors in the predetermined block queue, and once the number of descriptors in the predetermined block queue changes, it indicates that a buffer block in the user layer stores new data. The application program of the user layer can find the target block address for storing the data through the pointer in the block address mapping table, and then analyze the data in the target block of the address.
According to the technical scheme, the data packet can be directly transmitted to the user layer from the network layer, so that the application program in the user layer can directly analyze the data in the target block. In the transmission process, the data packet does not need to enter the kernel layer, and zero copy is realized. Moreover, the scheme provided by the application can effectively reduce the burden of the system, improve the efficiency of capturing the packet, and avoid the situations of packet loss, overflow and the like. . Based on the method provided in the foregoing embodiment, preferably, the preset block queue includes at least one descriptor of a free block;
as shown in fig. 6, step S11 includes:
s111: determining the size of a data packet to be stored according to at least one data packet received by the network layer;
s112: determining the number of target blocks according to the size of the data packet to be stored;
s113: and determining the physical address of each target block in the user layer according to the descriptor of the target block in the preset block queue.
In the embodiments provided in the present application, the network layer may receive a plurality of data packets in advance, and then transmit the plurality of data packets to the target block in the user layer. The size of the data packet to be stored may be a sum of capacities of at least one data packet received by the network layer.
Preferably, the buffer area in the user layer is divided into a plurality of buffer blocks with equal size in advance, and the number of the target blocks is determined according to the size of the divided buffer blocks and the size of the data packet to be stored. And enabling the total capacity of the determined number of target blocks to be larger than or equal to the size of the data packet to be stored.
And the network layer transmits at least one received data packet to a target block of the user layer according to the physical address of the target block.
Through the technical scheme provided by the application, the network layer can realize batch transmission of a plurality of data packets, the number of the determined target blocks is suitable for the data packets to be stored, and the condition that the data overflow is caused by too small number of the target blocks or the resource waste is caused by too large number of the target blocks is avoided.
Based on the method provided in the foregoing embodiment, preferably, the step S12 includes:
and when the number of the determined target blocks is multiple, storing the data packets to be stored into the determined multiple target blocks according to the sequence of the preset block queue according to the physical address of each target block in the user layer.
In the embodiment of the application, the number of the determined target blocks is multiple, and the network layer transmits the data packet to the target block of the user layer according to the sequence of the preset block queue. Specifically, assume that the network layer receives 2 packets, the first packet size is 17.3M, and the second packet size is 8.2M. Presetting the capacity of each cache block to be 10M, determining the number of the target blocks to be 3 according to the size of the block to be stored, and sequentially setting the target blocks to be a first target block, a second target block and a third target block. And obtaining descriptors of 3 target blocks from a preset block queue, and determining physical addresses of the 3 target blocks according to the obtained descriptors. Subsequently, the first packet is divided into two parts, the first part is 10M and the second part is 7.3M. And transmitting the first part of the first data packet into the first target block, transmitting the second part of the first data packet into the second target block, and transmitting the second data packet into the third target block, thereby realizing the data packet transmission.
By the scheme provided by the application, the data packets received by the network layer can be transmitted and stored in the target block of the user layer according to the sequence of the preset block queue. The sequence of reading the target blocks can be determined by the application program according to the preset block queue, the application program is prevented from reading a plurality of incomplete data packets, and the efficiency of reading the data packets by the application program is improved.
Based on the method provided by the foregoing embodiment, it is preferable that after step S12, as shown in fig. 7, the method further includes:
s114: writing a physical address of the at least one target block storing the at least one data packet into a block address mapping table of the user layer;
s115: and the application program analyzes the at least one data packet according to the block address mapping table of the user layer.
In this embodiment, the user layer further includes a block address mapping table, where the block address mapping table includes a corresponding relationship between a target block storing the data packet and a physical address of the target block. The application program can determine the target block in which the data packet has been stored and the physical address thereof according to the block address mapping table, so as to read the physical address of the target block and perform the parsing of the data packet.
Based on the method provided by the foregoing embodiment, preferably, after step S12, as shown in fig. 8, the method provided by the present application further includes:
s116: removing descriptors of the at least one target block storing the at least one data packet in the preset block queue;
after the step S115, the method further includes:
s117: adding a descriptor of at least one target block storing the at least one data packet in the preset block queue.
In this embodiment, the descriptor of the target block storing the data packet is removed from the predetermined block queue, so that all the buffer blocks characterized by the descriptor in the predetermined block queue are buffer blocks not storing data. After the application program analyzes the data packet in the target block, the descriptor of the target block in which the data packet is originally stored is added back to the preset block queue, so that the target block queue can continuously store the new data packet received by the network layer.
According to the scheme provided by the application, the descriptor of the target block can be removed from the preset block queue after the target block stores the new data packet, and the data packet stored in the target block is prevented from being covered by the new data before the application program is analyzed. In addition, after the application program analyzes the data in the target block, the descriptor of the target block is added back to the preset block queue, and the descriptor of the target block capable of storing the data is ensured to be always in the preset block queue.
In order to solve the above problems in the prior art, the present application further provides an apparatus 90 for transmitting data packets, as shown in fig. 9, including:
a determining module 91, configured to determine at least one target block in a user layer according to at least one data packet received by a network layer and an annular preset block queue in a kernel layer, where when the number of the determined target blocks is multiple, the multiple target blocks are adjacent in the preset block queue;
the storage module 92 stores the at least one data packet into the at least one target block.
In the embodiment of the present application, at least one target block in a user layer is determined according to at least one data packet received by a network layer and an annular preset block queue in a kernel layer, wherein when the number of the determined target blocks is multiple, the multiple target blocks are adjacent in the preset block queue; storing the at least one data packet into the at least one target block. The scheme of the embodiment of the invention can ensure that the target block for storing the data packet conforms to the preset block queue, so that the physical addresses of the stored data packet are logically continuous, the problem of packet loss caused by logic address dispersion is avoided, and the probability of packet loss is reduced.
Preferably, an embodiment of the present invention further provides an electronic device, which includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor, where the computer program, when executed by the processor, implements each process of the above-mentioned embodiment of the image processing method, and can achieve the same technical effect, and details are not repeated here to avoid repetition.
An embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements each process of the above-mentioned embodiment of the image processing method, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here. The computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
While the present invention has been described with reference to the embodiments shown in the drawings, the present invention is not limited to the embodiments, which are illustrative and not restrictive, and it will be apparent to those skilled in the art that various changes and modifications can be made therein without departing from the spirit and scope of the invention as defined in the appended claims.

Claims (10)

1. A method for transmitting data packets, comprising:
determining at least one target block in a user layer according to at least one data packet received by a network layer and an annular preset block queue in a kernel layer, wherein when the number of the determined target blocks is multiple, the multiple target blocks are adjacent in the preset block queue;
storing the at least one data packet into the at least one target block.
2. The method of claim 1, wherein the predetermined block queue comprises a descriptor of at least one free block;
the determining at least one target block in the user layer according to at least one data packet received by the network layer and the annular preset block queue in the kernel layer includes:
determining the size of a data packet to be stored according to at least one data packet received by the network layer;
determining the number of target blocks according to the size of the data packet to be stored;
and determining the physical address of each target block in the user layer according to the descriptor of the target block in the preset block queue.
3. The method of claim 2, wherein said storing said at least one data packet into said at least one target block comprises:
and when the number of the determined target blocks is multiple, storing the data packets to be stored into the determined multiple target blocks according to the sequence of the preset block queue according to the physical address of each target block in the user layer.
4. The method of claim 1, wherein after storing the at least one data packet into the at least one target block, further comprising:
writing a physical address of the at least one target block storing the at least one data packet into a block address mapping table of the user layer;
and the application program analyzes the at least one data packet according to the block address mapping table of the user layer.
5. The method of claim 4, wherein after storing the at least one data packet into the at least one target block, further comprising:
removing descriptors of the at least one target block storing the at least one data packet in the preset block queue;
after the application program resolves the at least one data packet according to the block address mapping table of the user layer, the method further comprises the following steps:
adding a descriptor of at least one target block storing the at least one data packet in the preset block queue.
6. The method of claim 1, wherein before determining at least one target block in the user layer based on at least one packet received by the network layer and a circular pre-defined block queue in the kernel layer, further comprising:
establishing at least one block in the user layer, and generating a block address mapping table containing the mapping relation between the at least one block and the physical address of the at least one block;
and generating the preset block queue in the kernel layer according to the at least one established block.
7. The method of claim 6, wherein the generating the predetermined block queue in the kernel layer according to the established at least one block comprises:
generating a descriptor in one-to-one correspondence with the at least one tile, the descriptor including a tile identifier of the tile corresponding to the descriptor;
generating a predetermined block queue including at least one descriptor in the kernel layer.
8. The method of claim 7, wherein after generating the predetermined block queue in the kernel layer according to the established at least one block, further comprising:
generating a physical address table in the kernel layer according to the at least one established block, wherein the physical address table comprises a corresponding relation between each established block and a physical address of each established block;
and generating a data field in the network layer according to the preset block queue and the physical address table, wherein the data field comprises a pointer pointing to the preset block queue and an address of the physical address table.
9. The method of claim 8, wherein prior to storing the at least one data packet in the at least one target block, further comprising:
writing the size of at least one data packet received by the network layer into the data field;
wherein the storing the at least one data packet into the at least one target block comprises:
determining a descriptor of a target block in the preset block queue according to the data field of the network layer;
determining a physical address corresponding to the descriptor of the target block in the physical address table according to a data field of the network layer;
and storing at least one data packet in the target block according to the size of the at least one data packet in the data field of the network layer.
10. An apparatus for transmitting data packets, comprising:
the device comprises a determining module, a judging module and a judging module, wherein the determining module determines at least one target block in a user layer according to at least one data packet received by a network layer and an annular preset block queue in a kernel layer, and when the number of the determined target blocks is multiple, the multiple target blocks are adjacent in the preset block queue;
the storage module stores the at least one data packet into the at least one target block.
CN201910290555.7A 2019-04-11 2019-04-11 Method and device for transmitting data packet Pending CN111817818A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910290555.7A CN111817818A (en) 2019-04-11 2019-04-11 Method and device for transmitting data packet

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910290555.7A CN111817818A (en) 2019-04-11 2019-04-11 Method and device for transmitting data packet

Publications (1)

Publication Number Publication Date
CN111817818A true CN111817818A (en) 2020-10-23

Family

ID=72843666

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910290555.7A Pending CN111817818A (en) 2019-04-11 2019-04-11 Method and device for transmitting data packet

Country Status (1)

Country Link
CN (1) CN111817818A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101150486A (en) * 2007-11-15 2008-03-26 曙光信息产业(北京)有限公司 A management method for receiving network data of zero copy buffer queue
CN101198924A (en) * 2005-02-03 2008-06-11 Level5网络有限公司 Including descriptor queue empty events in completion events
CN101707565A (en) * 2009-12-04 2010-05-12 曙光信息产业(北京)有限公司 Method and device for transmitting and receiving zero-copy network message
CN102467473A (en) * 2010-11-03 2012-05-23 Tcl集团股份有限公司 Method and device for transmitting data between user space and kernel
US20170024132A1 (en) * 2015-07-22 2017-01-26 Samsung Electronics Co., Ltd. Storage device for supporting virtual machine, storage system including the storage device, and method of operating the same
CN107870879A (en) * 2016-09-23 2018-04-03 中国移动通信有限公司研究院 A kind of data-moving method, accelerator board, main frame and data-moving system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101198924A (en) * 2005-02-03 2008-06-11 Level5网络有限公司 Including descriptor queue empty events in completion events
CN101150486A (en) * 2007-11-15 2008-03-26 曙光信息产业(北京)有限公司 A management method for receiving network data of zero copy buffer queue
CN101707565A (en) * 2009-12-04 2010-05-12 曙光信息产业(北京)有限公司 Method and device for transmitting and receiving zero-copy network message
CN102467473A (en) * 2010-11-03 2012-05-23 Tcl集团股份有限公司 Method and device for transmitting data between user space and kernel
US20170024132A1 (en) * 2015-07-22 2017-01-26 Samsung Electronics Co., Ltd. Storage device for supporting virtual machine, storage system including the storage device, and method of operating the same
CN107870879A (en) * 2016-09-23 2018-04-03 中国移动通信有限公司研究院 A kind of data-moving method, accelerator board, main frame and data-moving system

Similar Documents

Publication Publication Date Title
JP3473975B2 (en) Network system and communication method in network
US7953915B2 (en) Interrupt dispatching method in multi-core environment and multi-core processor
US10218645B2 (en) Low-latency processing in a network node
US8005022B2 (en) Host operating system bypass for packets destined for a virtual machine
US7571247B2 (en) Efficient send socket call handling by a transport layer
CN112261094B (en) Message processing method and proxy server
CN113891396B (en) Data packet processing method and device, computer equipment and storage medium
US20180181421A1 (en) Transferring packets between virtual machines via a direct memory access device
US10212259B2 (en) Management of transmission control blocks (TCBs) supporting TCP connection requests in multiprocessing environments
US6742075B1 (en) Arrangement for instigating work in a channel adapter based on received address information and stored context information
CN113986811B (en) High-performance kernel mode network data packet acceleration method
KR20120072134A (en) Apparatus and method for accelerating virtual desktop
CN110602154A (en) WEB server and method for processing data message thereof
EP3832987B1 (en) Data processing method and device
US7853713B2 (en) Communication interface device and communication method
CN116016687B (en) Message distribution method and system based on DPDK
CN111817818A (en) Method and device for transmitting data packet
EP3992770A1 (en) Message processing method and apparatus, and computer storage medium
CN112187484B (en) Method and device for sending network broadcast flow for reducing occupied broadband and storage medium
CN116560809A (en) Data processing method and device, equipment and medium
CN116136790A (en) Task processing method and device
CN114095550A (en) Remote procedure calling method for directly reading reference parameter by server
CN109688204A (en) Document down loading method, device based on NDN network, node, terminal
KR20200051196A (en) Electronic device providing fast packet forwarding with reference to additional network address translation table
JP2004094931A (en) Network system and communication method in network

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20201023