CN104796337A - Method and device for forwarding message - Google Patents

Method and device for forwarding message Download PDF

Info

Publication number
CN104796337A
CN104796337A CN201510170834.1A CN201510170834A CN104796337A CN 104796337 A CN104796337 A CN 104796337A CN 201510170834 A CN201510170834 A CN 201510170834A CN 104796337 A CN104796337 A CN 104796337A
Authority
CN
China
Prior art keywords
message
queue
address
user space
memory
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
CN201510170834.1A
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.)
Comba Telecom Technology Guangzhou Ltd
Comba Telecom Systems Guangzhou Co Ltd
Tianjin Comba Telecom Systems Co Ltd
Comba Network Systems Co Ltd
Original Assignee
Comba Telecom Systems Guangzhou 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 Comba Telecom Systems Guangzhou Co Ltd filed Critical Comba Telecom Systems Guangzhou Co Ltd
Priority to CN201510170834.1A priority Critical patent/CN104796337A/en
Publication of CN104796337A publication Critical patent/CN104796337A/en
Pending legal-status Critical Current

Links

Abstract

The invention discloses a method and device for forwarding a message. The method includes: a kernel-state receiving process stores the message received by a network card in a sharing internal memory and notifies a user-state process; the user-state process maps the physical address of the sharing internal memory to the virtual address of the user-state process and then extracts the message from the sharing internal memory and processes the message; the user-state process stores the processed message in the shearing internal memory and notifies a kernel-state transmitting process; the kernel-state transmitting process transmits the processed message through the corresponding network card. By the method, copying of the message from kernel space to application space is avoided, message forwarding speed is increased, and system resource utilization rate can be increased.

Description

A kind of method of E-Packeting and device
Technical field
The present invention relates to the communications field, particularly relate to a kind of method of E-Packeting and device.
Background technology
In network communication technology field, often need to receive message from network, then according to systemic-function, message is processed accordingly.After having processed, for intermediate equipment, message needs from another port repeating.This just relates to the message repeating technology in same system between multiple network interface card, in the process studied existing message repeating technology, finds to adopt the application program implementation method based on socket.The method, based on existing operating system platform, adopts socket technology to complete the process of reception to network message, process, forwarding in the user space.In whole process, network message, before arrival application program, needs through following processing links: trawl performance process, kernel protocol stack process, the copy of message from kernel spacing to application space, kernel protocol stack, trawl performance.And copy is a kind of process consuming very much system resource, thus cause the processing speed of message repeating low.
Summary of the invention
The embodiment of the present invention provides a kind of method of E-Packeting and device, in order to realize in the process E-Packeted, can avoid the copy of message from kernel spacing to application space, thus while raising message transferring speed, also can improve the resource utilization of system.
The embodiment of the present invention provides a kind of method E-Packeted, and the method comprises: the packet storage that network interface card receives by kernel state receiving process is in shared drive and notify User space process;
Described User space process, by after the physical address map of described shared drive to the virtual address of described User space process, is extracted described message and processes described message from described shared drive;
Described User space process by process after packet storage in described shared drive and notify kernel state send process;
Described kernel state is sent process and is sent by corresponding network interface card by the message after described process.
Preferably, the packet storage that network interface card receives by described kernel state receiving process is in shared drive and notify User space process, is specially:
Described kernel state receiving process applies for memory block from memory pool, and receiving queue tail of the queue in described memory block, and is inserted in the address of described memory block by the described packet storage received by network interface card;
Receiving queue described in described User space process poll, reads the address of described memory block from receiving queue head, until described receiving queue is empty;
When described receiving queue is empty, described User space process enters sleep state, until wake described User space process during described receiving queue non-NULL up.
Preferably, receiving queue is inserted in the address of described memory block, is specially:
Hash operation is carried out according to the source IP address of described message and object IP address;
According to the value obtained after Hash operation, determine the queue value of kernel state receiving queue;
According to the queue value of the kernel receiving queue determined, the block address memory of described message is stored in corresponding receiving queue.
Preferably, described User space process is extracted described message and is processed described message from described shared drive, be specially: described User space process reads the address of the memory block storing described message from the receiving queue team head of described shared drive, and the address according to described memory block is read the content of described message to the corresponding position of memory pool and processes described message.
Preferably, described User space process by process after packet storage in described shared drive and notify described kernel state send process, be specially:
The address of the memory block of the message after described process is inserted into transmit queue tail of the queue by described User space process, and calling system function notifies that described kernel state sends process.
Preferably, described shared drive is that described kernel state distributes when initialization, comprising:
The memory pool be made up of many memory blocks;
For the internal memory that the receiving queue and transmit queue of preserving the address of described memory block use;
For preserving the internal memory that the head pointer of described receiving queue and tail pointer and head pointer and tail pointer for preserving described transmit queue use.
The embodiment of the present invention provides a kind of device E-Packeted, and device comprises:
Receiver module, being used to indicate packet storage that network interface card receives by kernel state receiving process in shared drive notifies User space process;
Processing module, for after described User space process is by the physical address map of described shared drive to the virtual address of described User space process, extracts described message and processes described message from described shared drive;
Notification module, for described User space process by process after packet storage after described shared drive, notice kernel state send process;
Sending module, is used to indicate described kernel state transmission process and is sent by corresponding network interface card by the message after described process.
Preferably, described receiver module, specifically for:
Indicate described kernel state receiving process to apply for memory block from memory pool, receiving queue tail of the queue in described memory block, and is inserted in the address of described memory block by the described packet storage received by network interface card;
Indicate receiving queue described in described User space process poll, read described block address memory from receiving queue head, until described receiving queue is empty;
When described receiving queue is empty, described User space process is indicated to enter sleeping eyes state, until wake described User space process during described receiving queue non-NULL up.
Preferably, described receiver module, specifically for:
Hash operation is carried out according to the source IP address of described message and object IP address;
According to the value obtained after Hash operation, determine the queue value of kernel state receiving queue;
According to the queue value of the kernel receiving queue determined, the block address memory of described message is stored in corresponding receiving queue.
Preferably, described processing module, specifically for:
Indicate described User space process from the receiving queue team head of described shared drive, read the address saving the memory block of described message, according to the content reading described message in described block address memory to memory pool, described message is processed.
Preferably, described notification module, specifically for:
Indicate described User space process that the block address memory of the message after described process is inserted into transmit queue tail of the queue, and calling system function notify that described kernel state sends process.
Preferably, described shared drive is that described kernel state distributes when initialization, comprising:
The memory pool be made up of multiple described memory block;
For the internal memory that the receiving queue and transmit queue of preserving the address of described memory block use;
For preserving the internal memory that the head pointer of described receiving queue and tail pointer and head pointer and tail pointer for preserving described transmit queue use.
The method E-Packeted that above-described embodiment provides and device, comprising: the packet storage that network interface card receives by kernel state receiving process is in shared drive and notify User space process; Described User space process, by after the physical address map of described shared drive to the virtual address of described User space process, is extracted described message and processes described message from described shared drive; Described User space process by process after packet storage in described shared drive and notify kernel state send process; Described kernel state is sent process and is sent by corresponding network interface card by the message after described process.Can find out, first, the packet storage that network interface card receives by kernel state receiving process is in shared drive; Then, the virtual address of the physical address of shared drive and User space process is set up mapping relations by User space process, User space process processes the message that network interface card receives according to set up mapping relations, and by the packet storage after process in shared drive; Finally, send process by kernel state and the message after process is sent by corresponding network interface card, therefore, avoid the copy of message from kernel spacing to application space, thus while raising message transferring speed, also can improve the resource utilization of system.
Accompanying drawing explanation
In order to be illustrated more clearly in the technical scheme in the embodiment of the present invention, below the accompanying drawing used required in describing embodiment is briefly introduced, apparently, accompanying drawing in the following describes is only some embodiments of the present invention, for those of ordinary skill in the art, under the prerequisite not paying creative work, other accompanying drawing can also be obtained according to these accompanying drawings.
The method flow diagram E-Packeted that Fig. 1 provides for the embodiment of the present invention;
The apparatus structure schematic diagram E-Packeted that Fig. 2 provides for the embodiment of the present invention.
Embodiment
In order to make the object, technical solutions and advantages of the present invention clearly, below in conjunction with accompanying drawing, the present invention is described in further detail, and obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making other embodiments all obtained under creative work prerequisite, belong to the scope of protection of the invention.
Fig. 1 is a kind of method flow diagram E-Packeted that the embodiment of the present invention provides.As shown in Figure 1, the method can comprise:
The packet storage that network interface card receives by S101, kernel state receiving process is in shared drive and notify User space process.
S102, User space process, by after the physical address map of shared drive to the virtual address of User space process, are extracted message and process message from shared drive.
S103, User space process by process after packet storage in shared drive and notify kernel state send process.
S104, kernel state are sent process and are sent by corresponding network interface card by the message after process.
Wherein, shared drive is that kernel state distributes when initialization.Concrete, kernel state, when initialization, can distribute first piece of continuous print physical memory of certain capacity for building shared drive, and can be divided by distribute continuous print physical memory further.Such as, kernel state is when initialization, can allocated size be that the continuous physical memory of 16M is for building shared drive, further, also the continuous physical memory of distributed 16M can be divided into 8K memory block, the size that can calculate each memory block is like this 2K, and is the message that the memory block of 2K is used for storing kernel state receiving process and receives by size.
Kernel state, when initialization, except distributing the continuous print physical memory of certain capacity for building except shared drive, also distributes second piece of continuous print physical memory for building receiving queue and transmit queue.Wherein, the block address memory of message of constructed receiving queue for storing kernel state receiving process and receiving, constructed transmit queue sends the block address memory of the message after process process for storing kernel state.Such as, suppose that kernel state is when initialization, allocated size is that the continuous physical memory of 16M is for building shared drive, and the continuous physical memory of distributed 16M is divided into 8K memory block, the address of further hypothesis 1K memory block needs to preserve with a queue, at this moment, kernel state is when initialization, except allocated size is that the continuous physical memory of 16M is for building except shared drive, also need to distribute another block internal memory for preserving 8 receiving queues and 8 transmit queues, wherein, 8 receiving queues can be: be qos [1], qos [2], qos [3], qos [4], qos [5], qos [6], qos [7], qos [8], 8 transmit queues can be: qos [9], qos [10], qos [11], qos [12], qos [13], qos [14], qos [15], qos [16].
Concrete, when being stored in receiving queue by the block address memory of message, Hash operation is carried out in source IP address and the object IP address of the message that can receive according to kernel state receiving process; According to the value obtained after Hash operation, determine the queue value of kernel state receiving queue; According to the queue value of the kernel receiving queue determined, the block address memory of message is stored in corresponding receiving queue, to ensure the homology chummage of message.
Wherein, Hash operation is exactly after receiving message, first from 32 bits of the source IP address of message, object IP address, extract respectively the binary number of fixed position, fixed qty, such as 12 to 20 totally 9 figure places, then this group number is carried out xor operation, and carry out the operation of remainder number according to number of queues.Like this, just by different packet storages in different receiving queues, the homology chummage of message can be also ensure that simultaneously.
In addition, kernel state is when initialization, except distributing first piece of continuous print physical memory of certain capacity for building shared drive and second piece of continuous print physical memory for building except receiving queue, transmit queue, also can distribute the 3rd piece of continuous print physical memory, for head pointer and the tail pointer of the head pointer and tail pointer and transmit queue that store receiving queue.
Such as, suppose that kernel state is when initialization, allocated size is that the continuous physical memory of 16M is for building shared drive with another block internal memory for preserving 8 receiving queues and 8 transmit queues.Further hypothesis 8 receiving queues are respectively: qos [1], qos [2], qos [3], qos [4], qos [5], qos [6], qos [7], qos [8], 8 transmit queues are respectively: qos [9], qos [10], qos [11], qos [12], qos [13], qos [14], qos [15], qos [16], head pointer and the tail pointer of above-mentioned 8 receiving queues of further hypothesis are respectively: be qos [1] .head, qos [2] .head, qos [3] .head, qos [4] .head, qos [5] .head, qos [6] .head, qos [7] .head, qos [8] .head, qos [1] .tail, qos [2] .tail, qos [3] .tail, qos [4] .tail, qos [5] .tail, qos [6] .tail, qos [7] .tail, qos [8] .tail, head pointer and the tail pointer of above-mentioned 8 transmit queues are respectively: be qos [9] .head, qos [10] .head, qos [11] .head, qos [12] .head, qos [13] .head, qos [14] .head, qos [15] .head, qos [16] .head, qos [9] .tail, qos [10] .tail, qos [11] .tail, qos [12] .tail, qos [13] .tail, qos [14] .tail, qos [15] .tail, qos [16] .tail.
At this moment, kernel state, when initialization, also needs to distribute another block continuous print physical memory, for head pointer and the tail pointer of the head pointer and tail pointer and above-mentioned 8 transmit queues of depositing above-mentioned 8 receiving queues.
Kernel state is when initialization, not only distribute first piece of continuous print physical memory for building shared drive, second piece of continuous print physical memory for building receiving queue and transmit queue and the 3rd piece of continuous print physical memory for the head pointer of the head pointer and tail pointer and transmit queue that store up receiving queue and tail pointer, but also records the first address of the first address of first piece of continuous print physical memory, the first address of second piece of continuous print physical memory and the 3rd piece of continuous print physical memory distributed.Like this, the first address of distribute first piece continuous print physical memory of User space process by record, the first address of the first address of second piece of continuous print physical memory and the 3rd piece of continuous print physical memory, can read the first address of first piece of continuous print physical memory and size, the first address of second piece of continuous print physical memory and the first address of size and the 3rd piece of continuous print physical memory thereof and size thereof.And, first address and the size thereof of first piece of continuous print physical memory is read in User space process, after the first address of the first address of second piece of continuous print physical memory and size and the 3rd piece of continuous print physical memory and size thereof, the virtual address of the address of first piece of continuous print physical memory and User space process is made to set up mapping relations by calling system function, like this, the mapping relations of User space process by setting up, the message stored in memory block is processed, therefore, User space process directly can have access to the message that kernel state receives, thus avoid the copy of message from kernel state to User space, improve the forwarding speed of message, simultaneously, also save system resource.
In above-mentioned steps S101, the packet storage that network interface card receives by kernel state receiving process is in shared drive and notify User space process, be specially: kernel state receiving process applies for memory block from memory pool, the address of the memory block applied in the memory block applied for, and is inserted into the tail of the queue of receiving queue by the packet storage received by network interface card; User space process poll receiving queue, reads the address of memory block from receiving queue head, until receiving queue is empty; When receiving queue is empty, User space process enters sleep state, until wake User space process up during receiving queue non-NULL.Can find out, adopt wake-up waiting mechanism and interrupt the mode that combines of poll, the expense of CPU when deducting idle, thus improve forwarding speed and the resource utilization ratio of message.
In above-mentioned steps S102, User space process is extracted message and is processed message from shared drive, be specially: User space process reads the address of the memory block of stored messages from the receiving queue team head of shared drive, the address according to memory block is read the content of message to the corresponding position of memory pool and processes message.
In above-mentioned steps S103, User space process by process after packet storage in shared drive and notify kernel state send process, be specially: the address of the memory block of the message after process is inserted into transmit queue tail of the queue by User space process, and calling system function notice kernel state sends process.
Below by a concrete example, detailed explanation explanation is carried out to above-mentioned content.
In order to describe for simplicity, suppose that receiving queue only has a queue to be qos [M] and this queue is current for empty.Further hypothesis kernel state receiving process is message 1, message 2, message 3 according to the message that time order and function is received sequentially, then kernel state receiving process is after receiving message 1, message 2, message 3, from shared drive application to memory block 1 for stored messages 1, apply for memory block 2 for stored messages 2 and application to memory block 3 for stored messages.The physical address of the memory block 1 that further hypothesis is applied for is 001, the physical address of memory block 2 is 002 (binary system is 0010), the physical address of memory block 3 is 003 (binary system is 0011).Then, be 001 by the physical address of memory block 1, the physical address of memory block 2 is 002, the physical address of memory block 3 is 003 be stored in receiving queue qos [M] successively, then the physical address 001 of message 1 is stored in the head of receiving queue qos [M], and the physical address 003 of message 3 is stored in the afterbody of receiving queue qos [M].Now, User space process by calling system function, and according to the head pointer of receiving queue qos [M] and tail pointer, makes physical address 001, physical address 002, physical address 003 set up mapping relations with the virtual address of User space process.Like this, User space process, according to set up mapping relations, can process message 1, message 2, message 3, therefore, User space process directly can have access to the message that kernel state receives, thus avoids the copy of message from kernel state to User space, has saved system resource.
On basis based on above-mentioned example, suppose that transmit queue is qos [N] and current for empty.After User space process processes message 1, message 2, message 3, successively the physical address 002 of the physical address 001 of message 1, message 2, the physical address 003 of message 3 are stored to transmit queue qos [N], kernel state sends and carries out by arriving transmit queue qos [N], and according to physical address 001, the physical address 002 of message 2, the physical address 003 of message 3 of message 1 in transmit queue qos [N], read message 1, message 2, message 3, and message 1, message 2, message 3 are sent on corresponding network interface card.After message 1, message 2, message 3 are sent to corresponding network interface card by kernel state transmission process, memory block 1, memory block 2, memory block 3 are discharged, at this moment, kernel state sends physical address 001, the physical address 002 of memory block 2, the physical address 003 of memory block 3 of memory block 1 that process reclaims memory block 1, memory block 2, memory block 3 and distributes.
The mode of first in first out that what above-mentioned receiving queue qos [M], transmit queue qos [N] adopted is, in the specific implementation, receiving queue and transmit queue also can adopt mode first-in last-out, no longer describe in detail mode first-in last-out at this.
Message in the embodiment of the present invention can be 5 tuple messages, also can be the message of other type.
According to above content, can find out that the method E-Packeted that above-described embodiment provides comprises: the packet storage that network interface card receives by kernel state receiving process is in shared drive and notify User space process; Described User space process, by after the physical address map of described shared drive to the virtual address of described User space process, is extracted described message and processes described message from described shared drive; Described User space process by process after packet storage in described shared drive and notify kernel state send process; Described kernel state is sent process and is sent by corresponding network interface card by the message after described process.Can find out, first, the packet storage that network interface card receives by kernel state receiving process is in shared drive; Then, the virtual address of the physical address of shared drive and User space process is set up mapping relations by User space process, User space process processes the message that network interface card receives according to set up mapping relations, and by the packet storage after process in shared drive; Finally, send process by kernel state and the message after process is sent by corresponding network interface card, therefore, avoid the copy of message from kernel spacing to application space, thus while raising message transferring speed, also can improve the resource utilization of system.
Based on identical technical conceive, the embodiment of the present invention also provides a kind of device E-Packeted, and this device can perform said method embodiment.The device E-Packeted that the embodiment of the present invention provides as shown in Figure 2.Comprise:
Receiver module 21, being used to indicate packet storage that network interface card receives by kernel state receiving process in shared drive notifies User space process;
Processing module 22, for after described User space process is by the physical address map of described shared drive to the virtual address of described User space process, extracts described message and processes described message from described shared drive;
Notification module 23, for described User space process by process after packet storage after described shared drive, notice kernel state send process;
Sending module 24, is used to indicate described kernel state transmission process and is sent by corresponding network interface card by the message after described process.
Preferably, receiver module 21, specifically for:
Indicate described kernel state receiving process to apply for memory block from memory pool, receiving queue tail of the queue in described memory block, and is inserted in the address of described memory block by the described packet storage received by network interface card;
Indicate receiving queue described in described User space process poll, read described block address memory from receiving queue head, until described receiving queue is empty;
When described receiving queue is empty, described User space process is indicated to enter sleeping eyes state, until wake described User space process during described receiving queue non-NULL up.
Preferably, receiver module 21, specifically for:
Hash operation is carried out according to the source IP address of described message and object IP address;
According to the value obtained after Hash operation, determine the queue value of kernel state receiving queue;
According to the queue value of the kernel receiving queue determined, the block address memory of described message is stored in corresponding receiving queue.
Preferably, processing module 22, specifically for:
Indicate described User space process from the receiving queue team head of described shared drive, read the address saving the memory block of described message, according to the content reading described message in described block address memory to memory pool, described message is processed.
Preferably, notification module 23, specifically for:
Indicate described User space process that the block address memory of the message after described process is inserted into transmit queue tail of the queue, and calling system function notify that described kernel state sends process.
Preferably, described shared drive is that described kernel state distributes when initialization, comprising:
The memory pool be made up of multiple described memory block;
For the internal memory that the receiving queue and transmit queue of preserving the address of described memory block use;
For preserving the internal memory that the head pointer of described receiving queue and tail pointer and head pointer and tail pointer for preserving described transmit queue use.
To sum up, the method E-Packeted that the embodiment of the present invention provides and device, comprising: the packet storage that network interface card receives by kernel state receiving process is in shared drive and notify User space process; Described User space process, by after the physical address map of described shared drive to the virtual address of described User space process, is extracted described message and processes described message from described shared drive; Described User space process by process after packet storage in described shared drive and notify kernel state send process; Described kernel state is sent process and is sent by corresponding network interface card by the message after described process.Can find out, first, the packet storage that network interface card receives by kernel state receiving process is in shared drive; Then, the virtual address of the physical address of shared drive and User space process is set up mapping relations by User space process, User space process processes the message that network interface card receives according to set up mapping relations, and by the packet storage after process in shared drive; Finally, send process by kernel state and the message after process is sent by corresponding network interface card, therefore, avoid the copy of message from kernel spacing to application space, thus while raising message transferring speed, also can improve the resource utilization of system.
The present invention describes with reference to according to the flow chart of the method for the embodiment of the present invention, equipment (system) and computer program and/or block diagram.Should understand can by the combination of the flow process in each flow process in computer program instructions realization flow figure and/or block diagram and/or square frame and flow chart and/or block diagram and/or square frame.These computer program instructions can being provided to the processor of all-purpose computer, special-purpose computer, Embedded Processor or other programmable data processing device to produce a machine, making the instruction performed by the processor of computer or other programmable data processing device produce device for realizing the function of specifying in flow chart flow process or multiple flow process and/or block diagram square frame or multiple square frame.
These computer program instructions also can be stored in can in the computer-readable memory that works in a specific way of vectoring computer or other programmable data processing device, the instruction making to be stored in this computer-readable memory produces the manufacture comprising command device, and this command device realizes the function of specifying in flow chart flow process or multiple flow process and/or block diagram square frame or multiple square frame.
These computer program instructions also can be loaded in computer or other programmable data processing device, make on computer or other programmable devices, to perform sequence of operations step to produce computer implemented process, thus the instruction performed on computer or other programmable devices is provided for the step realizing the function of specifying in flow chart flow process or multiple flow process and/or block diagram square frame or multiple square frame.
Although describe the preferred embodiments of the present invention, those skilled in the art once obtain the basic creative concept of cicada, then can make other change and amendment to these embodiments.So claims are intended to be interpreted as comprising preferred embodiment and falling into all changes and the amendment of the scope of the invention.
Obviously, those skilled in the art can carry out various change and modification to the present invention and not depart from the spirit and scope of the present invention.Like this, if these amendments of the present invention and modification belong within the scope of the claims in the present invention and equivalent technologies thereof, then the present invention is also intended to comprise these change and modification.

Claims (12)

1. the method E-Packeted, is characterized in that, the method comprises: the packet storage that network interface card receives by kernel state receiving process is in shared drive and notify User space process;
Described User space process, by after the physical address map of described shared drive to the virtual address of described User space process, is extracted described message and processes described message from described shared drive;
Described User space process by process after packet storage in described shared drive and notify kernel state send process;
Described kernel state is sent process and is sent by corresponding network interface card by the message after described process.
2. the method for claim 1, is characterized in that, the packet storage that network interface card receives by described kernel state receiving process is in shared drive and notify User space process, is specially:
Described kernel state receiving process applies for memory block from memory pool, and receiving queue tail of the queue in described memory block, and is inserted in the address of described memory block by the described packet storage received by network interface card;
Receiving queue described in described User space process poll, reads the address of described memory block from receiving queue head, until described receiving queue is empty;
When described receiving queue is empty, described User space process enters sleep state, until wake described User space process during described receiving queue non-NULL up.
3. method as claimed in claim 2, is characterized in that, receiving queue is inserted in the address of described memory block, is specially:
Hash operation is carried out according to the source IP address of described message and object IP address;
According to the value obtained after Hash operation, determine the queue value of kernel state receiving queue;
According to the queue value of the kernel receiving queue determined, the block address memory of described message is stored in corresponding receiving queue.
4. method as claimed in claim 2, it is characterized in that, described User space process is extracted described message and is processed described message from described shared drive, be specially: described User space process reads the address of the memory block storing described message from the receiving queue team head of described shared drive, and the address according to described memory block is read the content of described message to the corresponding position of memory pool and processes described message.
5. the method for claim 1, is characterized in that, described User space process by process after packet storage in described shared drive and notify described kernel state send process, be specially:
The address of the memory block of the message after described process is inserted into transmit queue tail of the queue by described User space process, and calling system function notifies that described kernel state sends process.
6. the method as described in any one of claim 1 to 5, is characterized in that, described shared drive is that described kernel state distributes when initialization, comprising:
The memory pool be made up of many memory blocks;
For the internal memory that the receiving queue and transmit queue of preserving the address of described memory block use;
For preserving the internal memory that the head pointer of described receiving queue and tail pointer and head pointer and tail pointer for preserving described transmit queue use.
7. the device E-Packeted, is characterized in that, this device comprises:
Receiver module, being used to indicate packet storage that network interface card receives by kernel state receiving process in shared drive notifies User space process;
Processing module, for after described User space process is by the physical address map of described shared drive to the virtual address of described User space process, extracts described message and processes described message from described shared drive;
Notification module, for described User space process by process after packet storage after described shared drive, notice kernel state send process;
Sending module, is used to indicate described kernel state transmission process and is sent by corresponding network interface card by the message after described process.
8. device as claimed in claim 7, is characterized in that, described receiver module, specifically for:
Indicate described kernel state receiving process to apply for memory block from memory pool, receiving queue tail of the queue in described memory block, and is inserted in the address of described memory block by the described packet storage received by network interface card;
Indicate receiving queue described in described User space process poll, read described block address memory from receiving queue head, until described receiving queue is empty;
When described receiving queue is empty, described User space process is indicated to enter sleeping eyes state, until wake described User space process during described receiving queue non-NULL up.
9. device as claimed in claim 8, is characterized in that, described receiver module, specifically for:
Hash operation is carried out according to the source IP address of described message and object IP address;
According to the value obtained after Hash operation, determine the queue value of kernel state receiving queue;
According to the queue value of the kernel receiving queue determined, the block address memory of described message is stored in corresponding receiving queue.
10. device as claimed in claim 7, is characterized in that, described processing module, specifically for:
Indicate described User space process from the receiving queue team head of described shared drive, read the address saving the memory block of described message, according to the content reading described message in described block address memory to memory pool, described message is processed.
11. devices as claimed in claim 7, is characterized in that, described notification module, specifically for:
Indicate described User space process that the block address memory of the message after described process is inserted into transmit queue tail of the queue, and calling system function notify that described kernel state sends process.
12. devices as described in any one of claim 7 to 11, it is characterized in that, described shared drive is that described kernel state distributes when initialization, comprising:
The memory pool be made up of multiple described memory block;
For the internal memory that the receiving queue and transmit queue of preserving the address of described memory block use;
For preserving the internal memory that the head pointer of described receiving queue and tail pointer and head pointer and tail pointer for preserving described transmit queue use.
CN201510170834.1A 2015-04-10 2015-04-10 Method and device for forwarding message Pending CN104796337A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510170834.1A CN104796337A (en) 2015-04-10 2015-04-10 Method and device for forwarding message

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510170834.1A CN104796337A (en) 2015-04-10 2015-04-10 Method and device for forwarding message

Publications (1)

Publication Number Publication Date
CN104796337A true CN104796337A (en) 2015-07-22

Family

ID=53560859

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510170834.1A Pending CN104796337A (en) 2015-04-10 2015-04-10 Method and device for forwarding message

Country Status (1)

Country Link
CN (1) CN104796337A (en)

Cited By (29)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106603376A (en) * 2016-12-14 2017-04-26 东软集团股份有限公司 Message processing method and virtual private network SSLVPN server
CN106685829A (en) * 2016-12-27 2017-05-17 京信通信技术(广州)有限公司 Method and apparatus of forwarding real time transport protocol RTP user plane data
CN106856455A (en) * 2016-12-27 2017-06-16 京信通信技术(广州)有限公司 A kind of method and apparatus of GTPU user face datas forwarding
CN107193673A (en) * 2017-06-28 2017-09-22 锐捷网络股份有限公司 A kind of message processing method and equipment
CN107733837A (en) * 2016-08-11 2018-02-23 杭州迪普科技股份有限公司 Method for detecting abnormality and device based on application layer Network Abnormal message
CN107908365A (en) * 2017-11-14 2018-04-13 郑州云海信息技术有限公司 The method, apparatus and equipment of User space memory system data interaction
CN107948071A (en) * 2016-10-12 2018-04-20 北京金山云网络技术有限公司 Message forwarding method and device
CN108063781A (en) * 2016-11-07 2018-05-22 北京京东尚科信息技术有限公司 The apparatus and method that customized information is popped up in browser
CN108243118A (en) * 2016-12-27 2018-07-03 华为技术有限公司 The method and physical host to E-Packet
CN108989432A (en) * 2018-07-20 2018-12-11 南京中兴新软件有限责任公司 Document sending method, document receiving method and the transmitting/receiving file device of User space
CN109669784A (en) * 2017-10-13 2019-04-23 华为技术有限公司 A kind of method and system of interprocess communication
CN110149262A (en) * 2019-04-02 2019-08-20 视联动力信息技术股份有限公司 A kind for the treatment of method and apparatus and storage medium of signaling message
CN110445580A (en) * 2019-08-09 2019-11-12 浙江大华技术股份有限公司 Data transmission method for uplink and device, storage medium, electronic device
CN110602262A (en) * 2018-06-13 2019-12-20 网宿科技股份有限公司 Router and method for processing data message thereof
CN110602154A (en) * 2018-06-13 2019-12-20 网宿科技股份有限公司 WEB server and method for processing data message thereof
CN110932890A (en) * 2019-11-20 2020-03-27 厦门网宿有限公司 Data transmission method, server and computer readable storage medium
CN111181736A (en) * 2019-12-31 2020-05-19 奇安信科技集团股份有限公司 Data transmission method, apparatus, system, medium, and program product
WO2020125652A1 (en) * 2018-12-18 2020-06-25 中兴通讯股份有限公司 Packet forwarding method and apparatus, network device, and computer readable medium
CN111404986A (en) * 2019-12-11 2020-07-10 杭州海康威视系统技术有限公司 Data transmission processing method, device and storage medium
CN111679914A (en) * 2020-06-12 2020-09-18 北京字节跳动网络技术有限公司 Memory management method, system, computer equipment and storage medium
CN111813579A (en) * 2020-07-17 2020-10-23 济南浪潮数据技术有限公司 Communication method, communication device, readable storage medium and file system
CN112104572A (en) * 2020-09-11 2020-12-18 北京天融信网络安全技术有限公司 Data processing method and device, electronic equipment and storage medium
CN112118167A (en) * 2020-08-17 2020-12-22 深圳市风云实业有限公司 Method for quickly transmitting cross-network tunnel data
CN112272111A (en) * 2020-10-16 2021-01-26 苏州浪潮智能科技有限公司 Method, system and device for processing snmp data
CN112769716A (en) * 2021-01-12 2021-05-07 烽火通信科技股份有限公司 Data forwarding method and device of virtual switch based on hybrid virtual network bridge
CN113110916A (en) * 2021-04-22 2021-07-13 深信服科技股份有限公司 Virtual machine data reading and writing method, device, equipment and medium
CN114070805A (en) * 2020-07-27 2022-02-18 武汉神州数码云科网络技术有限公司 Method for realizing message receiving and transmitting of switch management network port
CN115002028A (en) * 2022-04-30 2022-09-02 济南浪潮数据技术有限公司 Message processing method, device and medium
WO2022237624A1 (en) * 2021-05-14 2022-11-17 华为技术有限公司 Memory allocation method, apparatus and system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101135980A (en) * 2006-08-29 2008-03-05 飞塔信息科技(北京)有限公司 Device and method for realizing zero copy based on Linux operating system
CN101150487A (en) * 2007-11-15 2008-03-26 曙光信息产业(北京)有限公司 A transmission method for zero copy network packet
CN101150488A (en) * 2007-11-15 2008-03-26 曙光信息产业(北京)有限公司 A receiving method for zero copy network packet
CN101917350A (en) * 2010-09-13 2010-12-15 南京中兴特种软件有限责任公司 Network card drive-based zero copy Ethernet message capturing and transmitting implementation method under Linux

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101135980A (en) * 2006-08-29 2008-03-05 飞塔信息科技(北京)有限公司 Device and method for realizing zero copy based on Linux operating system
CN101150487A (en) * 2007-11-15 2008-03-26 曙光信息产业(北京)有限公司 A transmission method for zero copy network packet
CN101150488A (en) * 2007-11-15 2008-03-26 曙光信息产业(北京)有限公司 A receiving method for zero copy network packet
CN101917350A (en) * 2010-09-13 2010-12-15 南京中兴特种软件有限责任公司 Network card drive-based zero copy Ethernet message capturing and transmitting implementation method under Linux

Cited By (43)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107733837A (en) * 2016-08-11 2018-02-23 杭州迪普科技股份有限公司 Method for detecting abnormality and device based on application layer Network Abnormal message
CN107948071B (en) * 2016-10-12 2020-12-11 北京金山云网络技术有限公司 Message forwarding method and device
CN107948071A (en) * 2016-10-12 2018-04-20 北京金山云网络技术有限公司 Message forwarding method and device
CN108063781B (en) * 2016-11-07 2021-01-26 北京京东尚科信息技术有限公司 Apparatus and method for popping out customized information in browser
CN108063781A (en) * 2016-11-07 2018-05-22 北京京东尚科信息技术有限公司 The apparatus and method that customized information is popped up in browser
CN106603376A (en) * 2016-12-14 2017-04-26 东软集团股份有限公司 Message processing method and virtual private network SSLVPN server
CN106603376B (en) * 2016-12-14 2019-09-13 东软集团股份有限公司 Message processing method and Virtual Private Network SSLVPN server
CN106856455A (en) * 2016-12-27 2017-06-16 京信通信技术(广州)有限公司 A kind of method and apparatus of GTPU user face datas forwarding
CN106685829A (en) * 2016-12-27 2017-05-17 京信通信技术(广州)有限公司 Method and apparatus of forwarding real time transport protocol RTP user plane data
CN108243118A (en) * 2016-12-27 2018-07-03 华为技术有限公司 The method and physical host to E-Packet
CN106856455B (en) * 2016-12-27 2020-01-14 京信通信系统(中国)有限公司 Method and device for forwarding GTPU user plane data
CN106685829B (en) * 2016-12-27 2020-06-19 京信通信系统(中国)有限公司 Method and device for transmitting real-time transport protocol RTP user plane data
CN107193673A (en) * 2017-06-28 2017-09-22 锐捷网络股份有限公司 A kind of message processing method and equipment
CN107193673B (en) * 2017-06-28 2020-05-26 锐捷网络股份有限公司 Message processing method and device
CN109669784A (en) * 2017-10-13 2019-04-23 华为技术有限公司 A kind of method and system of interprocess communication
US11892953B2 (en) 2017-10-13 2024-02-06 Huawei Technologies Co., Ltd. Interprocess communication method and interprocess communications system
CN107908365A (en) * 2017-11-14 2018-04-13 郑州云海信息技术有限公司 The method, apparatus and equipment of User space memory system data interaction
CN110602262A (en) * 2018-06-13 2019-12-20 网宿科技股份有限公司 Router and method for processing data message thereof
CN110602154A (en) * 2018-06-13 2019-12-20 网宿科技股份有限公司 WEB server and method for processing data message thereof
CN108989432A (en) * 2018-07-20 2018-12-11 南京中兴新软件有限责任公司 Document sending method, document receiving method and the transmitting/receiving file device of User space
WO2020125652A1 (en) * 2018-12-18 2020-06-25 中兴通讯股份有限公司 Packet forwarding method and apparatus, network device, and computer readable medium
CN110149262A (en) * 2019-04-02 2019-08-20 视联动力信息技术股份有限公司 A kind for the treatment of method and apparatus and storage medium of signaling message
CN110149262B (en) * 2019-04-02 2021-03-12 视联动力信息技术股份有限公司 Method and device for processing signaling message and storage medium
CN110445580A (en) * 2019-08-09 2019-11-12 浙江大华技术股份有限公司 Data transmission method for uplink and device, storage medium, electronic device
CN110445580B (en) * 2019-08-09 2022-04-19 浙江大华技术股份有限公司 Data transmission method and device, storage medium, and electronic device
CN110932890A (en) * 2019-11-20 2020-03-27 厦门网宿有限公司 Data transmission method, server and computer readable storage medium
CN110932890B (en) * 2019-11-20 2022-09-09 厦门网宿有限公司 Data transmission method, server and computer readable storage medium
CN111404986A (en) * 2019-12-11 2020-07-10 杭州海康威视系统技术有限公司 Data transmission processing method, device and storage medium
CN111181736A (en) * 2019-12-31 2020-05-19 奇安信科技集团股份有限公司 Data transmission method, apparatus, system, medium, and program product
CN111679914A (en) * 2020-06-12 2020-09-18 北京字节跳动网络技术有限公司 Memory management method, system, computer equipment and storage medium
CN111813579A (en) * 2020-07-17 2020-10-23 济南浪潮数据技术有限公司 Communication method, communication device, readable storage medium and file system
CN114070805A (en) * 2020-07-27 2022-02-18 武汉神州数码云科网络技术有限公司 Method for realizing message receiving and transmitting of switch management network port
CN112118167B (en) * 2020-08-17 2022-04-12 深圳市风云实业有限公司 Method for quickly transmitting cross-network tunnel data
CN112118167A (en) * 2020-08-17 2020-12-22 深圳市风云实业有限公司 Method for quickly transmitting cross-network tunnel data
CN112104572A (en) * 2020-09-11 2020-12-18 北京天融信网络安全技术有限公司 Data processing method and device, electronic equipment and storage medium
CN112104572B (en) * 2020-09-11 2023-02-07 北京天融信网络安全技术有限公司 Data processing method and device, electronic equipment and storage medium
CN112272111A (en) * 2020-10-16 2021-01-26 苏州浪潮智能科技有限公司 Method, system and device for processing snmp data
CN112769716A (en) * 2021-01-12 2021-05-07 烽火通信科技股份有限公司 Data forwarding method and device of virtual switch based on hybrid virtual network bridge
CN113110916A (en) * 2021-04-22 2021-07-13 深信服科技股份有限公司 Virtual machine data reading and writing method, device, equipment and medium
CN113110916B (en) * 2021-04-22 2023-11-07 深信服科技股份有限公司 Virtual machine data reading and writing method, device, equipment and medium
WO2022237624A1 (en) * 2021-05-14 2022-11-17 华为技术有限公司 Memory allocation method, apparatus and system
CN115002028A (en) * 2022-04-30 2022-09-02 济南浪潮数据技术有限公司 Message processing method, device and medium
CN115002028B (en) * 2022-04-30 2024-02-13 济南浪潮数据技术有限公司 Message processing method, device and medium

Similar Documents

Publication Publication Date Title
CN104796337A (en) Method and device for forwarding message
US20220255884A1 (en) System and method for facilitating efficient utilization of an output buffer in a network interface controller (nic)
CN106980582B (en) Data processing method and device
CN101616083B (en) Message forwarding method and device
CN101707565B (en) Method and device for transmitting and receiving zero-copy network message
CN104583993B (en) For optimizing the apparatus and method for partly enlivening live load
CN101557348B (en) Message forwarding method and device based on token bucket
CN105511954A (en) Method and device for message processing
CN104394096A (en) Multi-core processor based message processing method and multi-core processor
CN102790776A (en) Heartbeat connection normalizing processing method, terminal, server and communication system
JP7046983B2 (en) Packet transmission method and equipment
CN111538694B (en) Data caching method for network interface to support multiple links and retransmission
CN112698959A (en) Multi-core communication method and device
CN102957626A (en) Message forwarding method and device
CN100486248C (en) Zero-copy communication method under real-time environment
US9268621B2 (en) Reducing latency in multicast traffic reception
CN116204487A (en) Remote data access method and device
CN103312614A (en) Multicast message processing method, line card and communication device
US20200348989A1 (en) Methods and apparatus for multiplexing data flows via a single data structure
CN105656794A (en) Data distribution method and device
CN106372013B (en) Long-distance inner access method, device and system
CN102117261B (en) Communication method between inner processors of chip
CN111404986A (en) Data transmission processing method, device and storage medium
CN110895517A (en) Method, equipment and system for transmitting data based on FPGA
CN100391200C (en) Data transmitting method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
EXSB Decision made by sipo to initiate substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20180214

Address after: 510663 Shenzhou Road, Guangzhou Science City, Guangzhou, Guangzhou economic and Technological Development Zone, Guangdong Province, No. 10

Applicant after: Comba Telecom System (China) Co., Ltd.

Applicant after: Comba Telecom Systems (Guangzhou) Co., Ltd.

Applicant after: Jingxin Communication Technology (Guangzhou) Co., Ltd.

Applicant after: TIANJIN COMBA TELECOM SYSTEMS CO., LTD.

Address before: 510663 Guangdong city of Guangzhou Province Economic and Technological Development Zone Jinbi Road No. 6

Applicant before: Comba Telecom Systems (Guangzhou) Co., Ltd.

RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20150722