A kind of method and apparatus that is used for obtaining at a high speed TCP connection data
Technical field
The present invention relates to the network data processing field, be specifically related to a kind of method and apparatus that TCP connects data that is used for obtaining at a high speed.
Background technology
The TCP Unloading Technology is the TCP/ip network protocol stack in the host software to be handled to be cured in the network interface card hardware realize, so that reduce the cpu of system load, increases the technology of network I/O bandwidth.The TCP uninstalling system generally comprises two parts function, and first is the management of TCP connection status, shows to safeguard that with the TCP connection each TCP connects beginning, transfer of data, closing state.Second portion is the tcp data management, is used for the data of out of order TCP message are resequenced, and the data extract of TCP transmission is come out to submit to main frame.
Generally in the TCP uninstalling system, hardware will use a data buffer when carrying out the tcp data management, the data extract that each TCP connects is come out, finishing reordering of tcp data and splice with buffer, is that unit is submitted to host computer system then with the buffering area.
Application number 200680026247.4 discloses the method and system of a kind of transparent transmission control protocol (TCP) unloading, and the various aspects of described method comprise: collect the TCP section in the network interface Card processor, but state information is not transferred to host computer system.The TCP section of collecting is buffered in the colligator.Colligator can check the network flow relevant with the TCP section of collecting to have inlet in stream look-up table (FLT).When FLT expired, colligator can cut out current inlet, and network flow is assigned to available inlet.Information among the also renewable FLT of colligator.When the incident that stops the collection of TCP section took place, colligator can generate the TCP section of single polymerization based on the TCP section of collecting.The TCP section and the state information of polymerization can be sent to main frame to handle.
Application number 03820350.2 discloses a kind of system and method for TCP unloading.On TEEC, receive input TCP grouping, and at least a portion of handling described input grouping by described TEEC once, and needn't carry out any reorganization and/or repeating transmission by described TEEC.The described input of at least a portion TCP grouping can be buffered at least one inner elastomeric buffer of described TEEC.Described inner elastomeric buffer can comprise reception inner elastomeric buffer and/or send the inner elastomeric buffer.Therefore, the described input of at least a portion TCP grouping can be buffered in the described reception inner elastomeric buffer.The input grouping of the described processing of at least a portion can be put in the part of a mainframe memory, so that handled by host-processor or CPU.In addition, DMA is sent in the part of described mainframe memory but the input TCP of the described processing of at least a portion divides into groups.
The shortcoming of obtaining tcp data with general TCP uninstalling system is, some applied business need be handled in real time to tcp data, main frame need in time be taken the data of TCP transmission, after needing hardware to splice a certain amount of data, general TCP uninstalling system submits to main frame again, though help improving system bandwidth, reduced the response speed of system.
Summary of the invention
The object of the invention provides a kind of system tcp data is in time uploaded main frame, avoids tcp data to splice in hardware.
A kind of method that is used for obtaining at a high speed TCP connection data comprises following steps:
A, special chip extract the TCP link information after receiving the TCP message by network interface from message, and carry in the internal memory to plate original message is temporary;
B, special chip are according to the TCP link information of message, and the inquiry plate carries the TCP connection table in the internal memory, if the message that newly connects just connects new list item of increase to this in connecting table; If close the message of connection, just connecting the list item deletion that should connect in the table; If the data message that has connected, the then current state of this connection of record in connecting list item;
C, for the tcp data message, special chip is according to connecting the state that writes down in the list item, it is out of order to judge whether this message has taken place, if do not have out of orderly, then directly is uploaded to main frame; If take place out of orderly, then message is put into chained list, wait for that follow-up message resequences, after ordering is finished, be that unit uploads main frame with the message;
D, network interface card increase a self-defining header structure before main frame is submitted message to before the encapsulation header of message, preserve the information that this TCP connects;
E, drive software carry internal memory to message from the network interface card plate and are transferred to host memory;
When F, application software read tcp data by the api interface storehouse, interface library software read original message from host memory, and according to the information header of COM Continuation of Message, the location tcp data the original message data structure, converts the tcp data structure of application need to.
A kind of optimal technical scheme of the present invention is: the sequencer procedure that takes place after out of order uses the message chained list, does not use the splicing buffer, only to the message rearrangement, does not carry out the splicing of tcp data.
An optimal technical scheme more of the present invention is: the TCP link information of preserving in the described D step comprises the skew in message of connection status, tcp data.
A kind of equipment that is used for obtaining at a high speed TCP connection data comprises network interface card and host software part,
Described network interface card comprises that special chip, network interface and plate carry internal memory;
Described host software comprises that partly network interface card drives and application software api interface storehouse.
A kind of optimal technical scheme of the present invention is: described special chip is the main control chip of network interface card, moves all message processing logics.
The present invention can in time submit to main frame to message, can conveniently realize the conversion of original message data to the tcp data form again, plays the effect of data splicing, and whole system can realize the tcp data that obtains at a high speed.
Description of drawings
Fig. 1 is a system construction drawing of the present invention
Embodiment
The technical program is the equipment of a software and hardware one, hardware be with special chip for the network interface card that main devices designs, comprise network interface, special chip, plate carry internal memory and constitute.Software is driven by network interface card and application software api interface storehouse constitutes.
The function of the every part of system is as follows:
(1) network interface: network message Data Receiving network access card.
(2) special chip: the main control chip of network interface card, move all message processing logics.
(3) plate carries internal memory: the connection table that storage TCP connection management is used, temporary message.
(4) network interface card drives: the administration configuration network interface card, and for network interface card provides path to the transfer of data of main frame.
(5) api interface storehouse: connect the DLL (dynamic link library) of network interface card system and application software, the message format of network interface card being submitted to main frame converts the tcp data form that application software needs to.
The processing method and the process of this equipment are as follows:
(1) the hardware network interface card receives message.
Special chip extracts the TCP link information after receiving the TCP message by network interface from message, and carries in the internal memory to plate original message is temporary.
(2) the hardware network interface card carries out the TCP connection management.
Special chip is according to the TCP link information of message, the inquiry plate carries the TCP connection table in the internal memory, if the message that newly connects, just in connecting table, connect new list item of increase to this, if close the message of connection, just connecting the list item deletion that should connect in the table, if the data message that has connected, the then current state of this connection of record in connecting list item.
(3) network interface card hardware carries out the rearrangement of the out of order data of TCP, but does not carry out data splicing.
To the tcp data message, special chip is according to connecting the state that writes down in the list item, and it is out of order to judge whether this data message takes place, if do not have out of orderly, then directly is uploaded to main frame; If take place out of orderly, then message is put into chained list, wait for that follow-up message resequences, after ordering is finished, be that unit uploads main frame with the message.This sequencer procedure uses the message chained list, does not use the splicing buffer, does not carry out the splicing of tcp data.
(4) network interface card hardware adds information header to message, record TCP link information.
Network interface card increases a self-defining header structure before main frame is submitted message to before the encapsulation header of message, wherein preserve the information that this TCP connects, and comprises connection status, the tcp data skew in message etc.
(5) drive software carries internal memory to message from the network interface card plate and is transferred to host memory.
(6) Data Format Transform is carried out in the api interface storehouse.
When application software read tcp data by the api interface storehouse, interface library software read original message from host memory, and according to the information header of COM Continuation of Message, the location tcp data the original message data structure, converts the tcp data structure of application need to.
The present invention uses in the network security private server of dawn production, has obtained good effect.