CN110535813A - Kernel state protocol stack and User space protocol stack simultaneously deposit treating method and apparatus - Google Patents

Kernel state protocol stack and User space protocol stack simultaneously deposit treating method and apparatus Download PDF

Info

Publication number
CN110535813A
CN110535813A CN201810516951.2A CN201810516951A CN110535813A CN 110535813 A CN110535813 A CN 110535813A CN 201810516951 A CN201810516951 A CN 201810516951A CN 110535813 A CN110535813 A CN 110535813A
Authority
CN
China
Prior art keywords
protocol stack
socket
function
message
type
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.)
Granted
Application number
CN201810516951.2A
Other languages
Chinese (zh)
Other versions
CN110535813B (en
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.)
Wangsu Science and Technology Co Ltd
Original Assignee
Wangsu Science and Technology 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 Wangsu Science and Technology Co Ltd filed Critical Wangsu Science and Technology Co Ltd
Priority to CN201810516951.2A priority Critical patent/CN110535813B/en
Publication of CN110535813A publication Critical patent/CN110535813A/en
Application granted granted Critical
Publication of CN110535813B publication Critical patent/CN110535813B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/161Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
    • H04L69/162Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/18Multiprotocol handlers, e.g. single devices capable of handling multiple protocols

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)

Abstract

The embodiment of the present invention provides a kind of kernel state protocol stack and User space protocol stack and deposits treating method and apparatus, belongs to network technique field.Method includes: adapter system socket correlation function, using meeting POSIX standard accordant interface specification;System socket correlation function and the corresponding socket function of restoration and reuse program after transformation adapter tube, so that kernel state protocol stack interface is mutually unified with User space protocol stack interface;According to pre-set message transmissions rule, selection handles the transmitting-receiving message of application program using kernel state protocol stack or User space protocol stack.Kernel state protocol stack provided in an embodiment of the present invention and User space protocol stack simultaneously deposit treating method and apparatus, kernel state protocol stack interface and User space protocol stack interface are unified, list is realized using multi-protocol stack and is deposited, for needing the application program using User space protocol stack, it only needs to do simple interface according to User space protocol stack and replace, application program source program portable workload is small, and system performance is high.

Description

Kernel state protocol stack and User space protocol stack simultaneously deposit treating method and apparatus
Technical field
The present invention relates to network technique field, in particular to a kind of kernel state protocol stack and User space protocol stack simultaneously deposit processing Method and apparatus.
Background technique
With the continuous development of network communication technology, bandwidth and the flow of network communication are increased with it, network protocol stack The bottleneck of processing capacity system performance easy to form.In traditional kernel state protocol stack, network interface card notifies to assist by hardware interrupts View stack has new data packet to reach, and the NIC driver of kernel is responsible for handling this hardware interrupts, by data packet from network interface card team Column copy in the buffer area that kernel is opened up (DMA) to, and then data packet passes through a series of protocol processes process, are finally sent to use In the specified buffer area of family program.In this process, interrupt processing, memory copying, system call (lock, traps, context Switching) etc. seriously affected the processing capacity of network packet.The scheduling that application program and data packet are handled of operating system May across CPU scheduling, locality failure further influences network performance, and the fast development of internet needs high performance network Processing capacity.
User space protocol stack in User space due to executing, without system calling and memory copying, so that the network of system Performance has a distinct increment.User space protocol stack can also do flexible customization according to different demands, therefore favor by developer.It is existing Kernel state protocol stack and User space protocol stack and deposit main problem present in processing method and be: allow using kernel state agreement The source program of stack and the source program using User space protocol stack are simultaneously deposited, since application program source program can not be changed locally, when answering With program from when using kernel state protocol stack to be transplanted to use User space protocol stack, need to modify a large amount of network-associated system tune With interface, heavy workload causes the overall performance of system bad.
Summary of the invention
The embodiment of the present invention provides a kind of kernel state protocol stack and User space protocol stack and deposits treating method and apparatus, uses During User space protocol stack is switched to solve application program from kernel state protocol stack, application program source program can not locally change The problem of moving, transplanting heavy workload.
In order to achieve the above objectives, the embodiment of the present invention adopts the following technical scheme that
In a first aspect, the embodiment of the present invention provides a kind of kernel state protocol stack and User space protocol stack and deposits processing method, Include:
Adapter system socket correlation function, using meeting POSIX standard accordant interface specification;
System socket correlation function and the corresponding socket function of restoration and reuse program after transformation adapter tube, so that Kernel state protocol stack interface is mutually unified with User space protocol stack interface;
According to pre-set message transmissions rule, selection is handled using kernel state protocol stack or User space protocol stack The transmitting-receiving message of application program.
In the first possible implementation of the first aspect, the system socket correlation function after transformation adapter tube, packet It includes:
The Socket type that recognition function calls;
If the Socket type of the function call is creation socket function, continue to judge the creation socket letter Whether several type parameters contains protocol stack flag bit;
If the type parameter of the creation socket function does not include protocol stack flag bit, in the creation socket letter Protocol stack flag bit is added in several type parameters;
Protocol stack flag bit is added on the filec descriptor that the creation socket function returns;
If the socket function type of the function call is not creation socket function, in the socket function Protocol stack flag bit is added on type parameter.
In the second possible implementation of the first aspect, the corresponding socket function of the restoration and reuse program, Include:
When application program executes creation operation, agreement stack marker is added on the type parameter of creation socket function Position.
In a third possible implementation of the first aspect, according to pre-set message transmissions rule, selection makes The transmitting-receiving message of application program is handled with kernel state protocol stack or User space protocol stack, comprising:
Protocol stack is selected according to the protocol stack flag bit on the filec descriptor of return, when recognizing socket function type When not to create socket function, the socket of the protocol stack of selection is called after removing the protocol stack flag bit on filec descriptor Function of word.
With reference to first aspect or second of the first possible implementation of first aspect or first aspect possible The possible implementation of the third of implementation or first aspect, in the fourth possible implementation, comprising:
According to Message processing efficiency requirements to the agreement of system socket function and the corresponding socket function of application program Stack marker position is configured.
With reference to first aspect or second of the first possible implementation of first aspect or first aspect possible The possible implementation of the third of implementation or first aspect, in a fifth possible implementation, comprising:
According to header feature, type of message is identified;
If type of message is control stream, message is handled using kernel state protocol stack;
If type of message is data flow, message is handled using User space protocol stack.
Second aspect, the embodiment of the present invention provide a kind of kernel state protocol stack and User space protocol stack and deposit processing unit, It include: protocol stack interface processing unit and message process unit;
The protocol stack interface processing unit is used for adapter system socket correlation function, using meeting POSIX standard one The interface specification of cause;
The protocol stack interface processing unit is also used to be transformed the system socket correlation function after adapter tube, and transformation is answered With the corresponding socket function of program, so that kernel state protocol stack interface is mutually unified with User space protocol stack interface;
The message process unit is used for according to pre-set message transmissions rule, selection using kernel state protocol stack or Person's User space protocol stack handles the transmitting-receiving message of application program.
In the first possible implementation of the second aspect, after protocol stack interface processing unit is for being transformed adapter tube System socket correlation function, specifically includes:
The Socket type that recognition function calls;
If the Socket type of the function call is creation socket function, continue to judge the creation socket letter Whether several type parameters contains protocol stack flag bit;
If the type parameter of the creation socket function does not include protocol stack flag bit, in the creation socket letter Protocol stack flag bit is added in several type parameters;
Protocol stack flag bit is added on the filec descriptor that the creation socket function returns;
If the socket function type of the function call is not creation socket function, in the socket function Protocol stack flag bit is added on type parameter.
In a second possible implementation of the second aspect, protocol stack interface processing unit is used for restoration and reuse program Corresponding socket function, specifically includes:
When application program executes creation operation, agreement stack marker is added on the type parameter of creation socket function Position.
In the third possible implementation of the second aspect, the message process unit is used for according to pre-set Message transmissions rule, selection handle the transmitting-receiving message of application program, tool using kernel state protocol stack or User space protocol stack Body includes:
Protocol stack is selected according to the protocol stack flag bit on the filec descriptor of return, when recognizing socket function type When not to create socket function, the socket of the protocol stack of selection is called after removing the protocol stack flag bit on filec descriptor Function of word.
Second in conjunction with the possible implementation of the first of second aspect or second aspect or second aspect is possible The possible implementation of the third of implementation or second aspect further includes in the fourth possible implementation agreement Stack type selecting unit;The protocol stack type selection unit is used for according to Message processing efficiency requirements to system socket function The protocol stack flag bit of socket function corresponding with application program is configured.
Second in conjunction with the possible implementation of the first of second aspect or second aspect or second aspect is possible The possible implementation of the third of implementation or second aspect further includes in a fifth possible implementation agreement Stack type recognition unit;The protocol stack type identification unit is used to identify type of message according to header feature;If message Type is control stream, then is handled using kernel state protocol stack message;If type of message is data flow, User space is used Protocol stack handles message.
Technical solution provided in an embodiment of the present invention is marked by adapter system socket correlation function using POSIX is met Quasi- accordant interface specification, and further pass through the system socket correlation function and restoration and reuse journey after transformation adapter tube The corresponding socket function of sequence, so that kernel state protocol stack interface is mutually unified with User space protocol stack interface, and then according to preparatory The message transmissions rule of setting, selection handle transmiting and receive telegrams for application program using kernel state protocol stack or User space protocol stack Text.Technical solution provided in an embodiment of the present invention, on the one hand, unified kernel state protocol stack interface and connect with User space protocol stack Mouthful, facilitate application program source program portable.On the other hand, list is realized using multi-protocol stack and is deposited, and application program source program can Local transplantation reduces transplanting workload.Therefore, technical solution provided in an embodiment of the present invention, for needing using User space The application program of protocol stack, it is only necessary to simple interface is done according to User space protocol stack and is replaced, application program source program portable work Work amount is small, and system performance is high.
The third aspect provides a kind of computer readable storage medium, is stored thereon with computer program, the computer journey When sequence is executed by least one processor, above-mentioned first aspect or the possible embodiment of first aspect and beneficial may be implemented Effect.
Fourth aspect provides a kind of computer program product, which includes storing computer journey The non-volatile computer readable storage medium storing program for executing of sequence, which, which is performed, makes computer realize above-mentioned first aspect The step of method, the embodiment and beneficial effect which solves the problems, such as may refer to above-mentioned first aspect Or the possible embodiment of first aspect and beneficial effect, overlaps will not be repeated.
Detailed description of the invention
To describe the technical solutions in the embodiments of the present invention more clearly, make required in being described below to embodiment Attached drawing is briefly described, it should be apparent that, drawings in the following description are only some embodiments of the invention, for For those of ordinary skill in the art, without creative efforts, it can also be obtained according to these attached drawings other Attached drawing.
Fig. 1 is kernel state protocol stack of the present invention and User space protocol stack and the flow chart for depositing processing method embodiment one;
Fig. 2 is the dual stack packet receiving flow chart of the embodiment of the present invention;
Fig. 3 is that the dual stack of the embodiment of the present invention is given out a contract for a project flow chart;
Fig. 4 is the structural schematic diagram of apparatus of the present invention embodiment one;
Fig. 5 is the structural schematic diagram of apparatus of the present invention embodiment two;
Fig. 6 is the structural schematic diagram for the device that another embodiment of the present invention provides.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other Embodiment shall fall within the protection scope of the present invention.
The core at network is the repeating process of message, if message control plane and data Forwarding plane do not separate, message It is introduced into inner core region and then copies user area to, supply upper level applications processing, and in order to comprehensively support user's space Each function, the interface for being largely used to docking is embedded in protocol stack.If application program directly adapter tube network data can be allowed Packet processing, memory management and CPU scheduling, then the promotion of the available matter of performance, especially for large-scale net Network data packet.Fig. 1 is kernel state protocol stack of the present invention and User space protocol stack and the flow chart for depositing processing method embodiment one, such as Shown in Fig. 1, the method for the present embodiment may include the following contents.
S101, adapter system socket correlation function, using meeting POSIX standard accordant interface specification.
When needing to cross over inner core region and user area when datagram transmission, datagram interrupts the context generated and switches sum number The speed of data message processing is all strongly limited according to the cost of duplication, the present embodiment is assisted by the kernel state of adapter tube operating system Kernel can be bypassed by discussing stack interface, execute datagram transmission using User space protocol stack.For example, DPDK (Data can be used Plane Development Kit, data plane development kit) bypass kernel.
System socket correlation function and the corresponding socket function of restoration and reuse program after S102, transformation adapter tube, So that kernel state protocol stack interface is mutually unified with User space protocol stack interface.
Existing ICP/IP protocol is all based on kernel operation, and in addition User space agreement is developed, User space association View is run on except kernel.Preferably, User space protocol stack interface is made to meet POSIX standard, in order to by kernel state protocol stack Interface is mutually unified with User space protocol stack interface.POSIX indicates portable operating system interface (Portable Operating System Interface of UNIX, is abbreviated as POSIX), POSIX standard defines operating system and should mention for application program The interface standard of confession.
Specifically, the system socket correlation function after transformation adapter tube, may include: the socket class that recognition function calls Type;If the Socket type of the function call is creation socket function, continue to judge the creation socket function Whether type parameter contains protocol stack flag bit;If the type parameter of the creation socket function does not include agreement stack marker Protocol stack flag bit is then added in the type parameter of the creation socket function in position;It is returned in the creation socket function Protocol stack flag bit is added on the filec descriptor returned;If the socket function type of the function call is not creation socket Function then adds protocol stack flag bit on the type parameter of the socket function.The corresponding socket of restoration and reuse program Function can specifically include: when application program executes creation operation, association is added on the type parameter of creation socket function Discuss stack marker position.
S103, according to pre-set message transmissions rule, selection uses kernel state protocol stack or User space protocol stack Message is handled.
Specifically, protocol stack is selected according to the protocol stack flag bit on the filec descriptor of return, when recognizing socket When type function is not creation socket function, the agreement of selection is called after removing the protocol stack flag bit on filec descriptor The socket function of stack.
In a particular application, corresponding to system socket function and application program generally according to Message processing efficiency requirements The protocol stack flag bit of socket function is configured.According to header feature, type of message is identified;If type of message is control System stream, then handled message using kernel state protocol stack;If type of message is data flow, User space protocol stack pair is used Message is handled.
Fig. 2 is the dual stack packet receiving flow chart of the embodiment of the present invention.As shown in Fig. 2, the dual stack of the present embodiment is received Packet method may include the following contents.
S201, network interface receive message.
S202, User space protocol stack processing rule whether is matched.
Judge whether to match User space protocol stack processing rule, if YES, then executes S203, otherwise, execute S204.
S203, message is handled using User space protocol stack.
S204, message is handled using kernel state protocol stack.
S205, upper level applications are transferred to handle message.
Detailed process are as follows: network interface card receives message, according to the rule of user setting, judges whether to need User space agreement Stack, if it is, otherwise entering kernel state protocol stack into the processing of User space protocol stack and handling, handed over after the completion of protocol stack processing It is handled by upper level applications.
Fig. 3 is that the dual stack of the embodiment of the present invention is given out a contract for a project flow chart.As shown in figure 3, the dual stack of the present embodiment is sent out Packet receiving method may include the following contents.
S301, upper level applications message.
S302, User space protocol stack processing rule whether is matched.
Judge whether to match User space protocol stack processing rule, if YES, then executes S303, otherwise, execute S304.
S303, message is handled using User space protocol stack.
S304, message is handled using kernel state protocol stack.
S305, network interface is transferred to send message.
Detailed process are as follows: upper level applications will send message, according to user setting rule, judge whether to need using use Family state protocol stack, if it is, otherwise enter kernel state protocol stack into the processing of User space protocol stack and handle, protocol stack processing After the completion, it is sent from network interface.
In this implementation, on the one hand, by unified kernel state protocol stack interface and User space protocol stack interface, facilitate using journey The transplanting of sequence source program.On the other hand, realize it is single using multi-protocol stack and deposit, application program source program can local transplantation, reduce Transplanting workload.Therefore, technical solution provided in this embodiment, for needing the application program using User space protocol stack, It only needs to do simple interface according to User space protocol stack and replace, application program source program portable workload is small, and system performance is high.
Method as described above, it is preferred that include protocol stack flag bit, institute in the type parameter of User space protocol stack interface Protocol stack flag bit is stated for identity protocol stack type.Specifically, during development of user state protocol stack, application program creation set When connecing word, the protocol stack flag bit of a User space protocol stack, application program other sockets are added on the basis of type parameter Word correlation function is then not necessarily to change.It further, whether include protocol stack flag bit according in the type parameter of protocol stack interface Judge agreement stack type;According to the agreement stack type judged, increase protocol stack flag bit on the filec descriptor of return.Again Further, protocol stack is selected according to the protocol stack flag bit on the filec descriptor of return, and on removing filec descriptor Protocol stack flag bit after call selection protocol stack function.
In the present embodiment, without using the Frame Design and codimg logic of the source program of User space protocol stack, for needing Use the application program source program of User space protocol stack, it is only necessary to simple interface be done according to User space protocol stack and replaced.Replacement Work includes:
(1) when application program creation socket, a protocol stack flag bit is added on the basis of type parameter.
(2) the other socket correlation functions of application program are without change.
(3) the socket correlation function of application program adapter system, using with POSIX standard accordant interface.
For creating socket, whether there will be agreement stack marker according to original type parameter, and carry out the set of different agreement stack Word judgement is connect, increases protocol stack flag bit newly on the filec descriptor of return.
Flag bit is being removed by according to the protocol stack flag bit on filec descriptor for other socket correlation functions Afterwards, the function of different agreement stack is called.
Method as described above, it is preferred that the message transmissions rule, comprising: if type of message is control stream, use Kernel state protocol stack handles message;If type of message be data flow, using User space protocol stack to message at Reason.
The scheme of the present embodiment, kernel are only used to handle control stream, and all data flow relevant operations are all carried out in User space Processing to evade the performance bottlenecks such as the packet copy of kernel, thread scheduling, system calling, interruption, and is aided with various Performance tunings Means, to reach higher performance.
Fig. 4 is the structural schematic diagram of apparatus of the present invention embodiment one, as shown in figure 4, the device of the present embodiment may include: Protocol stack interface processing unit 401 and message process unit 402.Wherein, protocol stack interface processing unit 401 is used for adapter system Socket correlation function, using meeting POSIX standard accordant interface specification;Protocol stack interface processing unit 401 is also used to change System socket correlation function and the corresponding socket function of restoration and reuse program after making adapter tube, so that kernel state agreement Stack interface is mutually unified with User space protocol stack interface;Message process unit 402 is used for according to pre-set message transmissions rule, Selection handles the transmitting-receiving message of application program using kernel state protocol stack or User space protocol stack.
The device of the present embodiment can be used for executing the method for embodiment of the method shown in Fig. 1, realization principle and be reached The technical effect arrived is similar, and details are not described herein.
In device as described above, protocol stack interface processing unit 401 is used to be transformed the system socket correlation after adapter tube Function can specifically include: the Socket type that recognition function calls;If the Socket type of the function call is creation set Function of word is connect, then continues to judge whether the type parameter of the creation socket function contains protocol stack flag bit;If the wound The type parameter for building socket function does not include protocol stack flag bit, then adds in the type parameter of the creation socket function Add protocol stack flag bit;Protocol stack flag bit is added on the filec descriptor that the creation socket function returns;If described The socket function type of function call is not creation socket function, then adds on the type parameter of the socket function Protocol stack flag bit.
In device as described above, protocol stack interface processing unit 401 is used for the corresponding socket letter of restoration and reuse program Number, can specifically include: when application program executes creation operation, add agreement on the type parameter of creation socket function Stack marker position.
In device as described above, message process unit 402 is used for according to pre-set message transmissions rule, and selection makes The transmitting-receiving message that application program is handled with kernel state protocol stack or User space protocol stack, can specifically include: according to return Filec descriptor on protocol stack flag bit select protocol stack, when recognizing socket function type not and be creation socket letter When number, the socket function of the protocol stack of selection is called after removing the protocol stack flag bit on filec descriptor.
The device of the present embodiment, realization principle and technical effect to be achieved above have discussion, herein no longer It repeats.
Fig. 5 is the structural schematic diagram of apparatus of the present invention embodiment two, as shown in figure 5, the device of the present embodiment can also wrap Protocol stack type selection unit 501 and protocol stack type identification unit 502 are included, protocol stack type selection unit 501 is used for basis Message processing efficiency requirements carry out the protocol stack flag bit of system socket function and the corresponding socket function of application program Setting.Protocol stack type identification unit 502 is used to identify type of message according to header feature;If type of message is control Stream, then handled message using kernel state protocol stack;If type of message is data flow, using User space protocol stack to report Text is handled.
The device of the present embodiment, realization principle and technical effect to be achieved above have discussion, herein no longer It repeats.
Fig. 6 is the structural schematic diagram for the device that another embodiment of the present invention provides, as shown in fig. 6, the device includes extremely A few processor 601 (such as CPU), memory 603 and at least one communication bus 604, for realizing the company between device Connect letter.Processor 601 is for executing the executable module stored in memory 603, such as computer program.Memory 603 May include high-speed random access memory (RAM:Random Access Memory), it is also possible to further include non-labile deposit Reservoir (non-volatile memory), for example, at least a magnetic disk storage.
In some embodiments, memory 603 stores program 605, and program 605 can be executed with device 601 processed, this A program include execute a kind of kernel state protocol stack and User space protocol stack and deposit processing method, this method comprises:
Adapter system socket correlation function, using meeting POSIX standard accordant interface specification;
System socket correlation function and the corresponding socket function of restoration and reuse program after transformation adapter tube, so that Kernel state protocol stack interface is mutually unified with User space protocol stack interface;
According to pre-set message transmissions rule, selection is handled using kernel state protocol stack or User space protocol stack The transmitting-receiving message of application program.
Above-mentioned execution kernel state protocol stack and User space protocol stack and the program for depositing processing method, it is preferable that transformation adapter tube System socket correlation function afterwards, comprising:
The Socket type that recognition function calls;
If the Socket type of the function call is creation socket function, continue to judge the creation socket letter Whether several type parameters contains protocol stack flag bit;
If the type parameter of the creation socket function does not include protocol stack flag bit, in the creation socket letter Protocol stack flag bit is added in several type parameters;
Protocol stack flag bit is added on the filec descriptor that the creation socket function returns;
If the socket function type of the function call is not creation socket function, in the socket function Protocol stack flag bit is added on type parameter.
Above-mentioned execution kernel state protocol stack and User space protocol stack and the program for depositing processing method, it is preferable that the transformation The corresponding socket function of application program, comprising:
When application program executes creation operation, agreement stack marker is added on the type parameter of creation socket function Position.
Above-mentioned execution kernel state protocol stack and User space protocol stack and the program for depositing processing method, it is preferable that according to preparatory The message transmissions rule of setting, selection handle transmiting and receive telegrams for application program using kernel state protocol stack or User space protocol stack Text, comprising:
Protocol stack is selected according to the protocol stack flag bit on the filec descriptor of return, when recognizing socket function type When not to create socket function, the socket of the protocol stack of selection is called after removing the protocol stack flag bit on filec descriptor Function of word.
Above-mentioned execution kernel state protocol stack and User space protocol stack and the program for depositing processing method, it is preferable that the message Transmission rule, comprising:
According to Message processing efficiency requirements to the agreement of system socket function and the corresponding socket function of application program Stack marker position is configured.
Above-mentioned execution kernel state protocol stack and User space protocol stack and the program for depositing processing method, it is preferable that the message Transmission rule, comprising:
According to header feature, type of message is identified;
If type of message is control stream, message is handled using kernel state protocol stack;
If type of message is data flow, message is handled using User space protocol stack.
Finally, it should be noted that the above embodiments are merely illustrative of the technical solutions of the present invention, rather than its limitations;Although Present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that: it still may be used To modify the technical solutions described in the foregoing embodiments or equivalent replacement of some of the technical features; And these are modified or replaceed, technical solution of various embodiments of the present invention that it does not separate the essence of the corresponding technical solution spirit and Range.

Claims (14)

1. a kind of kernel state protocol stack and User space protocol stack simultaneously deposit processing method characterized by comprising
Adapter system socket correlation function, using meeting POSIX standard accordant interface specification;
System socket correlation function and the corresponding socket function of restoration and reuse program after transformation adapter tube, so that kernel State protocol stack interface is mutually unified with User space protocol stack interface;
According to pre-set message transmissions rule, selection handles application using kernel state protocol stack or User space protocol stack The transmitting-receiving message of program.
2. the method as described in claim 1, which is characterized in that the system socket correlation function after transformation adapter tube, comprising:
The Socket type that recognition function calls;
If the Socket type of the function call is creation socket function, continue to judge the creation socket function Whether type parameter contains protocol stack flag bit;
If the type parameter of the creation socket function does not include protocol stack flag bit, in the creation socket function Protocol stack flag bit is added in type parameter;
Protocol stack flag bit is added on the filec descriptor that the creation socket function returns;
If the socket function type of the function call is not creation socket function, in the type of the socket function Protocol stack flag bit is added in parameter.
3. the method as described in claim 1, which is characterized in that the corresponding socket function of the restoration and reuse program, comprising:
When application program executes creation operation, protocol stack flag bit is added on the type parameter of creation socket function.
4. the method as described in claim 1, which is characterized in that according to pre-set message transmissions rule, select in use Core state protocol stack or User space protocol stack handle the transmitting-receiving message of application program, comprising:
Protocol stack is selected according to the protocol stack flag bit on the filec descriptor of return, is when recognizing socket function type not When creating socket function, the socket letter of the protocol stack of selection is called after removing the protocol stack flag bit on filec descriptor Number.
5. method according to any of claims 1-4, which is characterized in that the message transmissions rule, comprising:
According to Message processing efficiency requirements to the protocol stack mark of system socket function and the corresponding socket function of application program Will position is configured.
6. method according to any of claims 1-4, which is characterized in that the message transmissions rule, comprising:
According to header feature, type of message is identified;
If type of message is control stream, message is handled using kernel state protocol stack;
If type of message is data flow, message is handled using User space protocol stack.
7. a kind of kernel state protocol stack and User space protocol stack simultaneously deposit processing unit characterized by comprising protocol stack interface Manage unit and message process unit;
The protocol stack interface processing unit is used for adapter system socket correlation function, consistent using POSIX standard is met Interface specification;
The protocol stack interface processing unit is also used to be transformed system socket correlation function and restoration and reuse journey after taking over The corresponding socket function of sequence, so that kernel state protocol stack interface is mutually unified with User space protocol stack interface;
The message process unit is used for according to pre-set message transmissions rule, and selection uses kernel state protocol stack or use Family state protocol stack handles the transmitting-receiving message of application program.
8. device as claimed in claim 7, which is characterized in that protocol stack interface processing unit is used to that the system after adapter tube to be transformed Socket correlation function, specifically includes:
The Socket type that recognition function calls;
If the Socket type of the function call is creation socket function, continue to judge the creation socket function Whether type parameter contains protocol stack flag bit;
If the type parameter of the creation socket function does not include protocol stack flag bit, in the creation socket function Protocol stack flag bit is added in type parameter;
Protocol stack flag bit is added on the filec descriptor that the creation socket function returns;
If the socket function type of the function call is not creation socket function, in the type of the socket function Protocol stack flag bit is added in parameter.
9. device as claimed in claim 7, which is characterized in that protocol stack interface processing unit is corresponding for restoration and reuse program Socket function, specifically include:
When application program executes creation operation, protocol stack flag bit is added on the type parameter of creation socket function.
10. device as claimed in claim 7, which is characterized in that the message process unit is used for according to pre-set report Literary transmission rule, selection handle the transmitting-receiving message of application program using kernel state protocol stack or User space protocol stack, specifically Include:
Protocol stack is selected according to the protocol stack flag bit on the filec descriptor of return, is when recognizing socket function type not When creating socket function, the socket letter of the protocol stack of selection is called after removing the protocol stack flag bit on filec descriptor Number.
11. such as the described in any item devices of claim 7-10, which is characterized in that further include protocol stack type selection unit;Institute Protocol stack type selection unit is stated for corresponding to system socket function and application program according to Message processing efficiency requirements The protocol stack flag bit of socket function is configured.
12. such as the described in any item devices of claim 7-10, which is characterized in that further include protocol stack type identification unit;Institute Protocol stack type identification unit is stated for identifying type of message according to header feature;If type of message is control stream, make Message is handled with kernel state protocol stack;If type of message is data flow, message is carried out using User space protocol stack Processing.
13. a kind of computer readable storage medium, which is characterized in that the computer storage medium is stored with computer program, The computer program includes program instruction, and described program instruction makes the processor execute such as right when being executed by a processor It is required that kernel state protocol stack described in any one of 1 to 6 and User space protocol stack and the step of deposit processing method.
14. a kind of computer program product, which is characterized in that the computer program product includes storing computer program Non-volatile computer readable storage medium storing program for executing, the computer program, which is performed, to make to appoint in computer realization claim 1 to 6 Kernel state protocol stack described in one and User space protocol stack and the step of deposit processing method.
CN201810516951.2A 2018-05-25 2018-05-25 Method and device for processing coexistence of kernel mode protocol stack and user mode protocol stack Active CN110535813B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810516951.2A CN110535813B (en) 2018-05-25 2018-05-25 Method and device for processing coexistence of kernel mode protocol stack and user mode protocol stack

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810516951.2A CN110535813B (en) 2018-05-25 2018-05-25 Method and device for processing coexistence of kernel mode protocol stack and user mode protocol stack

Publications (2)

Publication Number Publication Date
CN110535813A true CN110535813A (en) 2019-12-03
CN110535813B CN110535813B (en) 2022-04-22

Family

ID=68656951

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810516951.2A Active CN110535813B (en) 2018-05-25 2018-05-25 Method and device for processing coexistence of kernel mode protocol stack and user mode protocol stack

Country Status (1)

Country Link
CN (1) CN110535813B (en)

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111162833A (en) * 2020-04-08 2020-05-15 北京前沿探索深空科技有限公司 Low-orbit satellite information forwarding method, device and system, controller and medium
CN112261031A (en) * 2020-10-19 2021-01-22 腾讯科技(深圳)有限公司 Updating method, device, equipment and storage medium of TCP protocol stack
CN112422453A (en) * 2020-12-09 2021-02-26 新华三信息技术有限公司 Message processing method, device, medium and equipment
CN112637329A (en) * 2020-12-21 2021-04-09 网络通信与安全紫金山实验室 Identification method, device, equipment and storage medium of multiple application programs
CN112883007A (en) * 2021-02-20 2021-06-01 杭州迪普科技股份有限公司 Native protocol message processing method and device for Linux system
CN113055269A (en) * 2019-12-27 2021-06-29 厦门网宿有限公司 Virtual private network data transmission method and device
CN113259400A (en) * 2021-07-14 2021-08-13 南京易科腾信息技术有限公司 Network interaction system, method and storage medium based on network protocol
CN114697194A (en) * 2022-02-17 2022-07-01 清华大学 Blocking type event notification method and device
CN115174206A (en) * 2022-07-01 2022-10-11 江苏深网科技有限公司 User mode application safety detection method and detection system under transparent network bridge mode
CN115334156A (en) * 2021-04-26 2022-11-11 深信服科技股份有限公司 Message processing method, device, equipment and storage medium
WO2022251998A1 (en) * 2021-05-31 2022-12-08 华为技术有限公司 Communication method and system supporting multiple protocol stacks
CN115460470A (en) * 2022-08-19 2022-12-09 武汉烽火技术服务有限公司 Multicast data forwarding method, device, equipment and readable storage medium
CN115827120A (en) * 2023-01-10 2023-03-21 苏州浪潮智能科技有限公司 User mode network stack calling method, user mode interface setting method and device
CN116846991A (en) * 2023-07-11 2023-10-03 中科驭数(北京)科技有限公司 Network application data forwarding method and device
CN117041379A (en) * 2023-07-10 2023-11-10 中科驭数(北京)科技有限公司 Method and device for simultaneously monitoring newly-built connection of user mode protocol stack and kernel mode protocol stack
CN117395329A (en) * 2023-12-13 2024-01-12 井芯微电子技术(天津)有限公司 Method, device and storage medium for receiving and transmitting Ethernet two-layer protocol message

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070183418A1 (en) * 2006-02-08 2007-08-09 Level 5 Networks, Inc. Method and apparatus for multicast packet reception
CN101841470A (en) * 2010-03-29 2010-09-22 东南大学 High-speed capturing method of bottom-layer data packet based on Linux
CN102339234A (en) * 2011-07-12 2012-02-01 迈普通信技术股份有限公司 Device for operating protocol stack and method
US20120143979A1 (en) * 2005-03-24 2012-06-07 Olderdissen Jan Ra Protocol stack using shared memory
CN103997500A (en) * 2014-06-04 2014-08-20 西北工业大学 Achieving method of light-weight real-time TCP/IP protocol stack
US20160226961A1 (en) * 2015-01-30 2016-08-04 Nicira, Inc. Edge datapath using user space network stack
CN106302199A (en) * 2016-08-10 2017-01-04 成都广达新网科技股份有限公司 A kind of User space protocol stack realization method and system based on L3 Switching machine equipment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120143979A1 (en) * 2005-03-24 2012-06-07 Olderdissen Jan Ra Protocol stack using shared memory
US20070183418A1 (en) * 2006-02-08 2007-08-09 Level 5 Networks, Inc. Method and apparatus for multicast packet reception
CN101841470A (en) * 2010-03-29 2010-09-22 东南大学 High-speed capturing method of bottom-layer data packet based on Linux
CN102339234A (en) * 2011-07-12 2012-02-01 迈普通信技术股份有限公司 Device for operating protocol stack and method
CN103997500A (en) * 2014-06-04 2014-08-20 西北工业大学 Achieving method of light-weight real-time TCP/IP protocol stack
US20160226961A1 (en) * 2015-01-30 2016-08-04 Nicira, Inc. Edge datapath using user space network stack
CN106302199A (en) * 2016-08-10 2017-01-04 成都广达新网科技股份有限公司 A kind of User space protocol stack realization method and system based on L3 Switching machine equipment

Cited By (25)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113055269A (en) * 2019-12-27 2021-06-29 厦门网宿有限公司 Virtual private network data transmission method and device
CN113055269B (en) * 2019-12-27 2023-03-07 厦门网宿有限公司 Virtual private network data transmission method and device
CN111162833A (en) * 2020-04-08 2020-05-15 北京前沿探索深空科技有限公司 Low-orbit satellite information forwarding method, device and system, controller and medium
CN112261031A (en) * 2020-10-19 2021-01-22 腾讯科技(深圳)有限公司 Updating method, device, equipment and storage medium of TCP protocol stack
CN112261031B (en) * 2020-10-19 2023-08-29 腾讯科技(深圳)有限公司 TCP protocol stack updating method, device, equipment and storage medium
CN112422453A (en) * 2020-12-09 2021-02-26 新华三信息技术有限公司 Message processing method, device, medium and equipment
CN112422453B (en) * 2020-12-09 2022-05-24 新华三信息技术有限公司 Message processing method, device, medium and equipment
CN112637329A (en) * 2020-12-21 2021-04-09 网络通信与安全紫金山实验室 Identification method, device, equipment and storage medium of multiple application programs
CN112883007A (en) * 2021-02-20 2021-06-01 杭州迪普科技股份有限公司 Native protocol message processing method and device for Linux system
CN115334156A (en) * 2021-04-26 2022-11-11 深信服科技股份有限公司 Message processing method, device, equipment and storage medium
WO2022251998A1 (en) * 2021-05-31 2022-12-08 华为技术有限公司 Communication method and system supporting multiple protocol stacks
CN113259400A (en) * 2021-07-14 2021-08-13 南京易科腾信息技术有限公司 Network interaction system, method and storage medium based on network protocol
CN114697194A (en) * 2022-02-17 2022-07-01 清华大学 Blocking type event notification method and device
CN114697194B (en) * 2022-02-17 2023-07-14 清华大学 Blocking event notification method and device
CN115174206A (en) * 2022-07-01 2022-10-11 江苏深网科技有限公司 User mode application safety detection method and detection system under transparent network bridge mode
CN115174206B (en) * 2022-07-01 2024-04-02 江苏深网科技有限公司 User mode application security detection method and detection system in transparent network bridge mode
CN115460470A (en) * 2022-08-19 2022-12-09 武汉烽火技术服务有限公司 Multicast data forwarding method, device, equipment and readable storage medium
CN115460470B (en) * 2022-08-19 2024-03-26 烽火通信科技股份有限公司 Multicast data forwarding method, device, equipment and readable storage medium
CN115827120B (en) * 2023-01-10 2023-05-23 苏州浪潮智能科技有限公司 User state network stack calling and user state interface setting method and device
CN115827120A (en) * 2023-01-10 2023-03-21 苏州浪潮智能科技有限公司 User mode network stack calling method, user mode interface setting method and device
CN117041379A (en) * 2023-07-10 2023-11-10 中科驭数(北京)科技有限公司 Method and device for simultaneously monitoring newly-built connection of user mode protocol stack and kernel mode protocol stack
CN117041379B (en) * 2023-07-10 2024-04-19 中科驭数(北京)科技有限公司 Method and device for simultaneously monitoring newly-built connection of user mode protocol stack and kernel mode protocol stack
CN116846991A (en) * 2023-07-11 2023-10-03 中科驭数(北京)科技有限公司 Network application data forwarding method and device
CN117395329A (en) * 2023-12-13 2024-01-12 井芯微电子技术(天津)有限公司 Method, device and storage medium for receiving and transmitting Ethernet two-layer protocol message
CN117395329B (en) * 2023-12-13 2024-02-06 井芯微电子技术(天津)有限公司 Method, device and storage medium for receiving and transmitting Ethernet two-layer protocol message

Also Published As

Publication number Publication date
CN110535813B (en) 2022-04-22

Similar Documents

Publication Publication Date Title
CN110535813A (en) Kernel state protocol stack and User space protocol stack simultaneously deposit treating method and apparatus
CN106464530B (en) The method and system for the dynamic dispatching that network updates
CN105577567B (en) Network packet method for parallel processing based on Intel DPDK
CN103377091B (en) The method and system efficiently performed of the operation in resource-sharing pond
US9794370B2 (en) Systems and methods for distributed network-aware service placement
CN104052789B (en) Method and system for the load balance of virtual networking system
US10148771B2 (en) Systems and methods for decentralized service placement in a resource pool
CN104025049B (en) Generate the compiled code of indicator register liveness
Morreale et al. Software defined networking: Design and deployment
CN101390079B (en) Migrating a virtual machine that owns a resource such as a hardware device
CN107526645B (en) A kind of communication optimization method and system
CN105262685B (en) A kind of message processing method and device
EP4080362A2 (en) Method and apparatus for creating a container
CN110325968A (en) System upgrade management in distributed computing system
US20130097617A1 (en) Integration of disparate applications on a network
CN108322325A (en) A kind of virtual machine management method and device
CN103294556B (en) Method and system for host computer system access control
CN103391325A (en) Network operating system device and method for Internet of Things
CN110149231A (en) Update method, apparatus, storage medium and the equipment of virtual switch
CN109479059A (en) The system and method for transport layer class letter and isolation for container flow
CN108605017A (en) Inquiry plan and operation perception communication buffer management
US20230221981A1 (en) Sidecar-based integration capabilities for containerized applications
CN109445921A (en) A kind of distributed data task processing method and device
CN110007877A (en) Host and dual control storage equipment room data transmission method, device, equipment and medium
US20130067047A1 (en) Network management system node and method for use in a network management system node for re-configuring a set of data network nodes in a data 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
GR01 Patent grant
GR01 Patent grant