CN101662416B - Method for processing network packets - Google Patents

Method for processing network packets Download PDF

Info

Publication number
CN101662416B
CN101662416B CN2008101463132A CN200810146313A CN101662416B CN 101662416 B CN101662416 B CN 101662416B CN 2008101463132 A CN2008101463132 A CN 2008101463132A CN 200810146313 A CN200810146313 A CN 200810146313A CN 101662416 B CN101662416 B CN 101662416B
Authority
CN
China
Prior art keywords
network
package
buffer unit
protocol stack
network package
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.)
Expired - Fee Related
Application number
CN2008101463132A
Other languages
Chinese (zh)
Other versions
CN101662416A (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.)
Sunplus Technology Co Ltd
Original Assignee
Sunplus 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 Sunplus Technology Co Ltd filed Critical Sunplus Technology Co Ltd
Priority to CN2008101463132A priority Critical patent/CN101662416B/en
Publication of CN101662416A publication Critical patent/CN101662416A/en
Application granted granted Critical
Publication of CN101662416B publication Critical patent/CN101662416B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses a method for processing a plurality of network packets, which is applied to an embedded system connected to a network. The embedded system comprises a network device driver module and a simple network protocol stack module. The method for processing the plurality of network packets comprises that: first the network device driver module receives the plurality of network packets, and each time copying one network packet to a buffer unit of the simple network protocol stack module, records the packet length of the copied network packet into a packet information list; and then the simple network protocol stack module takes the network packets out one by one from the buffer unit according to the packet lengths in the packet information list, and performs resolving processing on the packets. Thus, the method can accurately process the plurality of network packets even in an environment where a simple network protocol stack is used.

Description

The processing method of multimeshed network package
Technical field
The invention relates to a kind of processing method of network package, particularly relevant for a kind of using under the environment of simple and easy network protocol stack, handle the method for multimeshed network package.
Background technology
Existing network protocol stack (TCP/IP stack) comprises two kinds of complete network protocol stack and simple and easy network protocol stack.In the complete network protocol stack, Ethernet driver layer and network protocol stack layer are kept a network package formation separately in the mode of formation (queue), and have only when obtaining system's right of execution and could carry out respective action to the network package in the formation further.Use the benefit of complete network protocol stack to be that level is well defined, but also need take more memory headroom comparatively speaking and consume high processing device resource.In addition, keep the running that two network package formations just must depend on operating system, also need the support of multi-thread environment simultaneously.
Yet, concerning the embedded system of no operating system (non-OS), must use simple and easy network protocol stack to overcome the restriction of hardware aspects such as memory size and processor frequencies.In the network protocol stack layer of simple and easy network protocol stack, the mode that no longer sees through formation is deposited network package, the substitute is a monoblock buffer memory internal memory (buffer).Basically, when the Ethernet driver layer is received a network package, just can at once network package be copied to the buffer memory internal memory, then the network package in the buffer memory internal memory be handled by the network protocol stack layer.In brief, a network package can only be collected and handle to simple and easy network protocol stack once.
In the practice design, embedded system is to see through this class network equipment of network card to connect network.When network card is peripheral controller interface (Peripheral Controller Interface, PCI) time, because pci interface can produce interrupt signal, therefore network card when receiving a network package at every turn, just can send interrupt signal to system, can correctly copy to the network protocol stack layer from the Ethernet driver layer to guarantee network package.But when network card is USB (Universal Serial Bus, USB) interface or secure digital input and output (Secure Digital Input/Output, SDIO) during interface, because these two kinds of interfaces can't produce interrupt action, thereby must require data to network card by system itself.Just because of this, uncontrollable network card sends the network package quantity of system to.
At above-mentioned situation, can leave all network package in the buffer memory internal memory in the lump earlier, then carry out package more individually and resolve action.Because most network package frame format all has package length information, even and if do not have package length information, as long as network package meets the specific network protocols standard, so also have fixing package length.In view of the above, as long as obtain package length from the frame header earlier before the network package in resolving the buffer memory internal memory, just can correctly handle network package.Yet, be not that all network package all can meet network protocol standard.For not meeting the network package that network protocol standard and frame header lack package length information, owing to can't correctly grasp its package length, therefore when the network protocol stack layer is prepared to obtain network package from the buffer memory internal memory, just quite easy because of the initial address of erroneous judgement network package in the buffer memory internal memory, and then cause problems such as packet loss or system exception.
Summary of the invention
In view of this, the invention provides a kind of processing method of multimeshed network package, under the environment that uses simple and easy network protocol stack, support the processing of multimeshed network package, guarantee the stability and the reliability of system according to this.
For reaching above-mentioned and other purpose, the present invention proposes a kind of processing method of multimeshed network package, be applicable to the embedded system that is connected to network, this embedded system comprises network equipment driver module and simple and easy network protocol stack (TCP/IP stack) module.The method at first receives several network package by the network equipment driver module.When the network equipment driver module copies to the buffer unit of simple and easy network protocol stack module with one of them network package at every turn, the package length of the network package that is replicated is recorded in the packet information tabulation.Then, simple and easy network protocol stack module is taken out network package by corresponding in the buffer unit in regular turn, and it is carried out the package dissection process according to the package length in the packet information tabulation.
In one embodiment of the invention, wherein the network equipment driver module step that at every turn one of them network package copied to buffer unit comprises and begins to deposit in regular turn network package foremost by buffer unit.The step of depositing network package in regular turn then comprises and obtains the end address of leaving last network package in the buffer unit in, and the network package that the next one will copy to buffer unit is deposited in the end address of continuing.
In one embodiment of the invention, wherein the package length of the network package that is replicated is recorded the step of packet information tabulation, comprise that more renewal has copied to the package sum of the all-network package of buffer unit.
In one embodiment of the invention, wherein when the network equipment driver module copies to buffer unit with one of them network package at every turn, comprise that more the initial address of network package in buffer unit that will be replicated is recorded in the packet information tabulation.
In one embodiment of the invention, wherein before simple and easy network protocol stack module is taken out the step of corresponding network package in by buffer unit, more be included in after the network equipment driver module copies to buffer unit with whole network package, system's right of execution is switched to simple and easy network protocol stack module by the network equipment driver module.
In one embodiment of the invention, wherein the network equipment driver module comprises the driver of network equipment, and network equipment can be USB (Universal Serial Bus, USB) interface network card, or secure digital input and output (Secure Digital Input/Output, SDIO) interface network card.
In one embodiment of the invention, wherein after the dissection process of finishing several network package, simple and easy network protocol stack module can be removed the content in the packet information tabulation.
In one embodiment of the invention, wherein simple and easy network protocol stack module comprises single-threaded network protocol stack.
In one embodiment of the invention, wherein embedded system is the embedded system of no operating system (non-OS) environment.
The present invention is under the environment that uses simple and easy network protocol stack, writes down its package length when network package being copied to buffer unit at every turn.Thereafter judge the initial and end address of each network package in buffer unit according to package length, correctly from buffer unit, obtain network package according to this and carry out the package dissection process.Avoid handling mistake because of erroneous judgement length causes package, and stiffness of system being caused negative effect handling when not having the network package of package length information.
For above-mentioned feature and advantage of the present invention can be become apparent, preferred embodiment cited below particularly, and cooperate appended graphicly, be described in detail below.
Description of drawings
Fig. 1 is the flow chart of the processing method of the multimeshed network package that illustrates according to one embodiment of the present of invention.
Fig. 2 is the flow chart of the processing method of the multimeshed network package that illustrates according to another embodiment of the present invention.
Fig. 3 A, 3B, 3C are the schematic diagrames of the simple and easy network protocol stack environment that illustrates according to one embodiment of the present of invention.
The primary clustering symbol description
110~130: each step of the processing method of the described multimeshed network package of one embodiment of the present of invention
210~250: each step of the processing method of the described multimeshed network package of an alternative embodiment of the invention
310: the network equipment driver module
311: the network package formation
320: simple and easy network protocol stack module
321: buffer unit
330: the packet information tabulation
P1, P2, P3: network package
Embodiment
Under the environment that uses simple and easy network protocol stack, if network package does not meet network protocol standard, or in the frame header, lack package length information, the situation generation that all may cause the package parse error and then lead to system abnormity.The present invention is for fear of above-mentioned situation and then develops the processing method of a kind of multimeshed network package that.In order to make content of the present invention more clear, below the example that can implement according to this really as the present invention especially exemplified by embodiment.
In following embodiment, will be example with the embedded system that is connected to network (for example Ethernet), explanation according to this sees through each step that simple and easy network protocol stack is handled the multimeshed network package.Wherein, embedded system can be any device with network on-line function, and for example multimedia device or the like does not limit its scope at this.And based on the restriction of hardware aspects such as memory size and system effectiveness, the embedded system of the following stated is the embedded system of no operating system (non-OS) environment.
Embedded system system sees through the network equipment driver module and simple and easy network protocol stack (TCP/IP stack) module realizes the function of network on-line.Wherein, the network equipment driver module comprises the driver of network equipment, and embedded system is to see through network equipment to connect network.In the present embodiment, network equipment for example is USB (Universal Serial Bus, USB) interface network card or secure digital input and output (Secure Digital Input/Output, SDIO) interface network card, and the embedded system of present embodiment belongs to no operating system environment, can't adopt the network protocol stack of complete complexity, therefore in the present embodiment, simple and easy network protocol stack module comprises single-threaded network protocol stack (for example uIP protocol stack).
Fig. 1 is the flow chart of the processing method of the multimeshed network package that illustrates according to one embodiment of the present of invention.See also Fig. 1, in embedded system with after network links to each other, because network equipment can once receive several network package, therefore shown in step 110, when the network equipment preparation is sent to embedded system inside with these network package, at first just receive these network package by the network equipment driver module.
Then in step 120, when the network equipment driver module prepared that network package copied to the buffer unit of simple and easy network protocol stack module, the package length that whenever duplicates the network package that a network package just will be replicated simultaneously at present was recorded in the packet information tabulation.In view of the above, after all network package all have been copied to buffer unit, also relatively write down the package length of all-network package in the packet information tabulation.
At last shown in step 130, simple and easy network protocol stack module is according to the package length that is write down in the packet information tabulation, judge the initial and end address of each network package in buffer unit, taking out network package by corresponding in the buffer unit in order, and the network package of each taking-up is carried out the package dissection process.
Each step as shown in Figure 1 when the network equipment driver module is sent to buffer unit with network package at every turn, just is recorded to package length the packet information tabulation; And simple and easy network protocol stack module is in resolving the process of network package, just can resolve with reference to the network package that the content of packet information tabulation is once taken out definite length.In view of the above, when processing does not meet the network package of network protocol standard, also can guarantee the correctness of package length.
Below be the action that network package copies to buffer unit to be described in detail at the network equipment driver module.Fig. 2 is the flow chart of the processing method of the multimeshed network package that illustrates according to another embodiment of the present invention.See also Fig. 2, see through network equipment and after network links to each other, at first shown in step 210, by network equipment driver module reception several network package from network equipment in embedded system.
Though the network equipment driver module can receive a plurality of network package at one time, yet shown in step 220, the network equipment driver module once only can take out a network package, and it is copied to the buffer unit of simple and easy network protocol stack module.In the present embodiment, the network equipment driver module is to begin to deposit in regular turn network package foremost by buffer unit.Therefore, first network package that is copied to buffer unit just can leave buffer unit in foremost.Thereafter, the network equipment driver module when copying to buffer unit with network package at every turn, at first obtain the end address of leaving last network package in the buffer unit in, and the network package that the next one will copy to buffer unit is deposited in the end address of continuing.
Next in step 230, the network equipment driver module is recorded in the packet information tabulation with the package length of the network package that is replicated.In one embodiment, the network equipment driver module also will upgrade the package sum of the all-network package that copies to buffer unit synchronously.And in another embodiment, except this information of record package length in the packet information tabulation, also can be recorded in the packet information tabulation to the initial address that network package leaves in the buffer unit in the lump.
In the replication actions of finishing a network package and after upgrading the packet information tabulation, shown in step 240, judge whether not copy to as yet in addition the network package of buffer unit.If still have network package not to be copied to buffer unit as yet, then repeated execution of steps 220 and step 230 are till all network package have all copied to buffer unit.
If whole network package all has been copied to buffer unit, system's right of execution will switch to simple and easy network protocol stack module by the network equipment driver module so.This moment is shown in step 250, tabulate to obtain package length (or obtaining the initial address that network package leaves buffer unit in) by simple and easy network protocol stack module inquiry packet information, and carry out the package dissection process according to package length takes out suitable length accordingly from buffer unit network package, till the all-network package in buffer unit has all taken out and has resolved and finished.In the present embodiment, simple and easy network protocol stack module then can empty the content that buffer unit write down, to finish the handling process of multimeshed network package.
The flow process of Fig. 2 can be applicable under the environment of the simple and easy network protocol stack of various uses.Even if under this environment, can only improve a network package of handling in the buffer unit at every turn, but see through the mechanism of record package length, still can be earlier that several network package are temporary to buffer unit.When preparation is handled the network package in the buffer unit, just can not come network package is resolved with the length of mistake in default of this information of package length by mistake.
Fig. 3 A is the schematic diagram of the simple and easy network protocol stack environment that illustrates according to one embodiment of the present of invention.See also Fig. 3 A, in the network package formation 311 of network equipment driver module 310, deposit three network package (being network package P1, P2, P3) that are received from network equipment.And simple and easy network protocol stack module 320 comprises buffer unit 321, duplicates and next network package in order to deposit from network package formation 311.Wherein, buffer unit 321 for example is a monoblock buffer memory internal memory (buffer).Packet information tabulation 330 then is to be used for writing down the package length that each is copied to the network package in the buffer unit 321.
When 310 preparations of network equipment driver module copy to buffer unit 321 with the network package P1 in the network package formation 311, owing in buffer unit 321, do not deposit any network package as yet, therefore network equipment driver module 310 can leave network package P1 in buffer unit 321 foremost, and the package length of network package P1 is recorded in packet information tabulation 330.The result who finishes after the above-mentioned action will be shown in Fig. 3 B.
Then, when 310 preparations of network equipment driver module copy to buffer unit 321 with network package P2, at first obtain the end address of last network package in buffer unit 321 (being network package P1), and network package P2 is deposited in this end address of continuing.The package length of network package P2 also will be recorded in packet information tabulation 330 in the lump.In like manner, network package P3 also can copy to buffer unit 321 according to above-mentioned handling process, and its package length also can be recorded in the packet information tabulation 330.
Shown in Fig. 3 C, after network equipment driver module 310 copies to buffer unit 321 with all network package, just the network package that simple and easy network protocol stack module 320 can be prepared to begin in the buffer unit 321 is handled.At first, simple and easy network protocol stack module 320 is consulted packet information tabulation 330 to obtain the package length of network package P1.Then, from buffer unit 321, intactly take out network package P1, and it is carried out the package dissection process according to package length.Similarly, simple and easy network protocol stack module 320 can continue to consult packet information tabulation 330 obtaining the package length of network package P2, P3 in regular turn, and then takes out network package P2 and P3 one by one to carry out the package dissection process from buffer unit 321.In view of the above, correctly take out all and be temporarily stored in network package in the buffer unit 321, thereby avoid handling the wrong problem that is caused because of package.
In sum, the processing method of multimeshed network package of the present invention can be guaranteed also can handle the multimeshed network package under simple and easy network protocol stack environment.Concerning belonging to no operating system environment and seeing through USB interface (or SDIO interface) with embedded system that network links to each other, when network package of each storage, just write down its package length.When preparing to resolve the network package that is temporarily stored in the buffer unit, see through the package length information that is write down and correctly obtain network package, afterwards so that network package is carried out the package dissection process.Not only kept simple and easy network protocol stack thus and saved this advantage of system resource,, and then guaranteed the stability and the reliability of system simultaneously also because can correctly carry out the processing of multimeshed network package.
Though the present invention discloses as above with preferred embodiment; right its is not in order to limit the present invention; those of ordinary skill under any in the technical field; without departing from the spirit and scope of the present invention; when can doing a little change and retouching, so protection scope of the present invention is as the criterion when looking the scope that accompanying Claim defines.

Claims (10)

1. the processing method of a multimeshed network package is applicable to an embedded system that is connected to a network, and wherein this embedded system comprises a network equipment driver module and a simple and easy network protocol stack module, and this method comprises:
This network equipment driver module receives a plurality of network package;
This network equipment driver module at every turn will these a plurality of network package one of them when copying to a buffer unit of this simple and easy network protocol stack module, package length to the packet information tabulation of this network package that record is replicated; And
This simple and easy network protocol stack module is taken out those network package by corresponding in this buffer unit in regular turn, and is carried out a package dissection process according to those package lengths in this packet information tabulation.
2. the processing method of multimeshed network package as claimed in claim 1, wherein one of them step that copies to this buffer unit more comprises this network equipment driver module with those network package at every turn:
By this buffer unit begin foremost deposit those network package in regular turn.
3. the processing method of multimeshed network package as claimed in claim 2, the step of wherein depositing those network package in regular turn comprises:
Obtain an end address of leaving last network package in this buffer unit in; And
The network package that the next one will copy to this buffer unit is deposited in this end address of continuing.
4. the processing method of multimeshed network package as claimed in claim 1, wherein this package length of this network package of being replicated of record to the step of this packet information tabulation more comprises:
Upgrade a package sum of those network package that copied to this buffer unit.
5. the processing method of multimeshed network package as claimed in claim 1 wherein, more comprises when one of them copies to this buffer unit with those network package at every turn at this network equipment driver module:
The initial address of this network package in this buffer unit that record is replicated is to this packet information tabulation.
6. the processing method of multimeshed network package as claimed in claim 1 wherein more comprised before this simple and easy network protocol stack module is taken out the step of those corresponding network package in by this buffer unit:
After this network equipment driver module copies to this buffer unit with whole network package, system's right of execution is switched to this simple and easy network protocol stack module by this network equipment driver module.
7. the processing method of multimeshed network package as claimed in claim 1, wherein this network equipment driver module comprises one of them of driver of the driver of a USB (universal serial bus) network card and a secure digital input/output interface network card.
8. the processing method of multimeshed network package as claimed in claim 1, wherein after the dissection process of finishing a plurality of network package, this simple and easy network protocol stack module can be removed the content in this packet information tabulation.
9. the processing method of multimeshed network package as claimed in claim 1, wherein this simple and easy network protocol stack module comprises a single-threaded network protocol stack.
10. the processing method of multimeshed network package as claimed in claim 1, wherein this embedded system is the embedded system of no operating system (non-OS) environment.
CN2008101463132A 2008-08-25 2008-08-25 Method for processing network packets Expired - Fee Related CN101662416B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2008101463132A CN101662416B (en) 2008-08-25 2008-08-25 Method for processing network packets

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2008101463132A CN101662416B (en) 2008-08-25 2008-08-25 Method for processing network packets

Publications (2)

Publication Number Publication Date
CN101662416A CN101662416A (en) 2010-03-03
CN101662416B true CN101662416B (en) 2011-08-31

Family

ID=41790221

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2008101463132A Expired - Fee Related CN101662416B (en) 2008-08-25 2008-08-25 Method for processing network packets

Country Status (1)

Country Link
CN (1) CN101662416B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1375773A (en) * 2002-04-25 2002-10-23 威盛电子股份有限公司 Buffering controller and its management
CN1414741A (en) * 2002-11-12 2003-04-30 威盛电子股份有限公司 Radio local network clock synchronization method and medium access controller
CN101132359A (en) * 2006-08-18 2008-02-27 鸿富锦精密工业(深圳)有限公司 Network device and processing method for its cutting and packaging

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1375773A (en) * 2002-04-25 2002-10-23 威盛电子股份有限公司 Buffering controller and its management
CN1414741A (en) * 2002-11-12 2003-04-30 威盛电子股份有限公司 Radio local network clock synchronization method and medium access controller
CN101132359A (en) * 2006-08-18 2008-02-27 鸿富锦精密工业(深圳)有限公司 Network device and processing method for its cutting and packaging

Also Published As

Publication number Publication date
CN101662416A (en) 2010-03-03

Similar Documents

Publication Publication Date Title
US7813342B2 (en) Method and apparatus for writing network packets into computer memory
US8762789B2 (en) Processing diagnostic requests for direct block access storage devices
US8140637B2 (en) Communicating chunks between devices
CN1640089A (en) Methodology and mechanism for remote key validation for NGIO/InfiniBand applications
EP2871580A1 (en) Programmed input/output mode
WO2012132812A1 (en) Multi-thread file input/output system and multi-thread file input/output program
CN107527317A (en) Data transmission system based on image procossing
EP2791808A2 (en) Serial interface for fpga prototyping
RU2686016C2 (en) Network interface
CN1324844C (en) Method for providing data to members of network synchronously by gating system
JP4071098B2 (en) Architecture and runtime environment for network filter drivers
US8214553B2 (en) Virtualization of an input/output device for supporting multiple hosts and functions
US7817572B2 (en) Communications apparatus and communication method
WO2015172391A1 (en) Fast data read/write method and apparatus
WO2015039687A1 (en) Transmission and reception devices for reducing the delay in end-to-end delivery of network packets
CN101662416B (en) Method for processing network packets
WO2024037076A1 (en) Data interaction method, apparatus and system, and electronic device and storage medium
TWI235921B (en) System and method for effectively performing physical direct memory access operations
CN108063737B (en) FCoE storage area network read request processing method and system
US7676605B1 (en) Methods and apparatus for bridging a bus controller
CN103885813B (en) Packet capturing method in virtual machine environment
US9292225B2 (en) Methods for frame order control and devices in storage area network
JP4524112B2 (en) Access to implicit addressing sequential data storage
US8121127B2 (en) Method for handling multiple network packets
CN102984599A (en) Video acquiring and transmitting device and method based on RapidIO protocol network

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20110831

Termination date: 20170825