CN103714033B - Data processing method and device - Google Patents

Data processing method and device Download PDF

Info

Publication number
CN103714033B
CN103714033B CN201310753237.2A CN201310753237A CN103714033B CN 103714033 B CN103714033 B CN 103714033B CN 201310753237 A CN201310753237 A CN 201310753237A CN 103714033 B CN103714033 B CN 103714033B
Authority
CN
China
Prior art keywords
task control
data
sent
control block
packet
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.)
Active
Application number
CN201310753237.2A
Other languages
Chinese (zh)
Other versions
CN103714033A (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.)
Newpoint Intelligent Technology Group Co ltd
Original Assignee
Innofidei 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 Innofidei Technology Co Ltd filed Critical Innofidei Technology Co Ltd
Priority to CN201310753237.2A priority Critical patent/CN103714033B/en
Publication of CN103714033A publication Critical patent/CN103714033A/en
Application granted granted Critical
Publication of CN103714033B publication Critical patent/CN103714033B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention provides a data processing method and device. The data processing method comprises the steps of receiving a data packet sent by user equipment, copying data in the data packet into a task control block according to the first set rule, and setting the data in the task control block to be in the completion state; calling a USB interface to send the data in the task control block to a USB data card, meanwhile, continuously receiving other data packets sent by the user equipment, copying data into other task control blocks respectively according to the first set rule, and organizing the other task control blocks into a task control block chain table to be sent; after the data, set to be in the completion state, in the task control blocks are sent, packaging the data in the task control blocks in the task control block chain table to be sent; calling the USB interface to send the packaged data to the USB data card. According to the data processing method and device, the problems that the transmission efficiency of a USB bus cannot be fully utilized, and the USB data transmission speed is low are solved.

Description

Data processing method and device
Technical field
The present invention relates to data card technical field, particularly relate to a kind of data processing method and device.
Background technology
USB(Universal Serial Bus, USB (universal serial bus)) standard that become computer realm connects Vocal imitation skill, owing to it has the feature such as plug and play, easy to use, low cost, rapidly be industry Strong backing, has become the bus standard of main flow the most.USB is widely used in tradition PC(Personal Computer, PC) peripheral hardware, such as mouse, keyboard, display etc., movable storage device is as moved Dynamic hard disk, flash disk etc., and emerging consumer electronics, as MP3 player, digital camera, Mobile phone etc..Meanwhile, its range of application is also constantly expanding, data communication system based on USB Also increasing, wherein, the most representational for USB data card.
The uplink service of USB data card needs to follow NDIS(Network Driver Interface Standard, NetWare Driver Interface Specification) serial mode that requires.At present, data based on USB When card carries out data transmission, the transfer process of packet is: PC(Personal Computer, Ge Ren electricity Brain) operating system usb data that packet is sent in PC by the interface called according to NDIS Card driver;USB data card driver is sent to usb data by usb bus packet Card;After USB data card acknowledges receipt of this packet, USB data card driver reinforms PC This packet of operating system is sent completely;PC operating system receives USB data card driver and sends Usb bus sent the message of this packet;PC operating system can decide whether to send out according to demand Send next packet.
Above-mentioned existing USB data transmission mode, when carrying out the transmission of packet, PC operating system Must etc. previous packet send to USB data card, and receive USB data card driver send Completion message after, just again can send next packet to USB data card driver.By Fast less than the transmission of usb bus in PC operating system and the rate of interaction of USB data card driver Rate so that the efficiency of transmission of usb bus can not be fully used, causes USB data transmission speed Low.
Summary of the invention
The invention provides a kind of data processing method and device, to solve existing USB data transmission Mode is when carrying out the transmission of packet, and the efficiency of transmission of usb bus can not be fully used, USB The problem that message transmission rate is low.
In order to solve the problems referred to above, the invention discloses a kind of data processing method, including: receive user The packet that equipment sends;Data in described packet are set rule according to first and copies to task control In clamp dog, and it is completion status by the data setting in described task control block;Call USB (universal serial bus) Interface sends the data in described task control block to described USB (universal serial bus) data card, continues to connect simultaneously Receive other packets that described subscriber equipment sends, and by the data in other packets described according to described First sets rule copies in other task control blocks respectively, is organized into by other task control blocks described Task control block chained list to be sent;Data in the described task control block being set as completion status send After completing, set rule to each task control in described task control block chained list to be sent according to second Data in block package;Call the described data after described USB transmission group bag extremely Described USB (universal serial bus) data card.
In order to solve the problems referred to above, the invention also discloses a kind of data processing equipment, including: receive mould Block, for receiving the packet that subscriber equipment sends;Replication module, for by the number in described packet Copy in task control block according to setting rule according to first, and the data in described task control block are set It is set to completion status;Molded tissue block, is used for calling USB to described USB (universal serial bus) Data card sends the data in described task control block, continues to the transmission of described subscriber equipment its simultaneously His packet, and the data in other packets described are set rule according to described first copy to respectively In other task control blocks, other task control blocks described are organized into task control block chained list to be sent; Group bag module, after the data in the described task control block being set as completion status are sent completely, Rule is set in each task control block in described task control block chained list to be sent according to second Data package;Sending module, the institute after calling described USB transmission group bag State data to described USB (universal serial bus) data card.
Compared with prior art, the invention have the advantages that
Data processing scheme in the present invention, the subscriber equipment at USB data card driver place is to USB When data card sends packet, after receiving a packet to be sent, packet is replicated and takes office Business controls in block, and the packet being replicated is set as completion status.When the packet being replicated is set After being set to completion status, this is set as that the packet of completion status is sent to USB number by USB interface According to card;Meanwhile, also continue to receive the packet that subscriber equipment sends, it is to avoid in prior art, Need to send to USB data card the packet received, just can continue to next packet, Thus cause data processing speed slow, the problem that message transmission rate is low.Additionally, also by receive its Data in his packet copy to form task control block chained list to be sent in task control block, are setting After being sent completely for the data in the described task control block of completion status, by task control block chain to be sent The data in each task control block in table package, and are sent to USB by USB interface in the lump In data card, solving in existing technology, USB data card driver can only send a number every time According to bag to USB data card, the efficiency of transmission of usb bus can not be fully used, data transmission speed The problem that rate is low.By the data processing scheme in the present invention, carry out packet caching, organize bag after send out Deliver to USB data card, take full advantage of the efficiency of transmission of usb bus, improve the transmission speed of data Rate.
Accompanying drawing explanation
Fig. 1 is the flow chart of steps of a kind of data processing method of according to embodiments of the present invention;
Fig. 2 is the flow chart of steps of a kind of data processing method of according to embodiments of the present invention two;
Fig. 3 is the flow chart of steps of a kind of data processing method of according to embodiments of the present invention three;
Fig. 4 is the flow chart of steps of a kind of data processing method of according to embodiments of the present invention four;
Fig. 5 is the flow chart of steps of a kind of data processing method of according to embodiments of the present invention five;
Fig. 6 is the concrete steps flow process using the data processing method in embodiment five to package data Figure;
Fig. 7 is that the packet after the group bag obtaining the data processing method used in embodiment five solves The particular flow sheet of bag;
Fig. 8 is the structured flowchart of a kind of data processing equipment of according to embodiments of the present invention six;
Fig. 9 is the structured flowchart of a kind of data processing equipment of according to embodiments of the present invention seven;
Figure 10 is the structured flowchart of a kind of data processing equipment of according to embodiments of the present invention eight.
Detailed description of the invention
Understandable, below in conjunction with the accompanying drawings for enabling the above-mentioned purpose of the present invention, feature and advantage to become apparent from The present invention is further detailed explanation with detailed description of the invention.
Embodiment one
With reference to Fig. 1, it is shown that the flow chart of steps of a kind of data processing method of the embodiment of the present invention one.
The data processing method of the present invention is illustrated by the present embodiment from usb data sending side, this reality The step of the data process executing example is as follows:
Step S102: receive the packet that subscriber equipment sends.
Data processing method in the present embodiment processes dress by the data being integrated with USB data card driver Putting realization, this data processing equipment is arranged on terminal unit such as PC, and PC operating system passes through USB Data card driver sends the packet needing to send to USB data card, and USB data card drives journey Sequence is called USB interface and is sent packet to USB data card, and PC passes through USB data card driver Need during calling interface to follow NDIS.
Step S104: the data in packet are set rule according to first and copies in task control block, And be completion status by the data setting in task control block.
When receiving packet, by USB data card driver, the data in packet can be copied to In task control block.
First sets rule can be appropriately arranged with according to practical situation by those skilled in the art, e.g., permissible Directly control that block chained list extracts an idle task from idle task and control block by the data in packet Copy to this idle task control in block;One can also be taken out from task control block chained list to be sent Data in packet are copied in task control block to be sent by task control block to be sent.
After the data in packet are copied in task control block, the data in task control block are set It is set to completion status.When the data in task block are completion status, USB data card driver should Feedback of status follows NDIS agreement, according to demand calling interface to PC operating system, PC operating system Continue through USB data card driver and send the packet needing to send to USB data card.Need Illustrating, USB data card driver is not the most ceaselessly the data in task control block to be set Be set to completion status, when the data in task block reach a certain amount of, will not continue by data setting be Completion status, but state undetermined, now, PC operating system will not drive to USB data card again Program sends packet.
Step S106: call USB interface and send the data in task control block to USB data card, with Time continue to other packets that subscriber equipment sends, and by the data in other packets according to first Set rule to copy to respectively, in other task control blocks, other task control blocks are organized into be sent Business controls block chained list.
Data in these chained lists are when the USB interface free time, it will sent to USB data card by group bag.
That is, data send and data receiver is carried out simultaneously, thus it is effectively improved data and processes and send out Send efficiency.
Step S108: after the data in the task control block being set as completion status are sent completely, press Set rule according to second the data in each task control block in task control block chained list to be sent are entered Row group bag.
After data in the task control block being set as completion status are sent completely, i.e. USB interface is empty Idle, it will the data being cached in task control block chained list to be sent are packaged, group is wrapped Data sent in USB data card by USB interface in the lump.
Wherein, second sets rule can be appropriately arranged with according to the actual requirements by those skilled in the art, as Directly the data in the task control block setting quantity are packaged, or, by one or more tasks Control to package etc. again after the data in block copy in the task control block in the most available free space.
Step S110: call the data after USB interface transmission group bag to USB data card.
The data processing method provided by the present embodiment, the user at USB data card driver place sets Standby when USB data card sends packet, after receiving a packet to be sent, by data Packet replication is in task control block, and the packet being replicated is set as completion status.When be replicated After packet is set to completion status, this is set as that the packet of completion status is sent out by USB interface Deliver to USB data card;Meanwhile, also continue to receive other packets that subscriber equipment sends, keep away Exempt from prior art, needed to be sent extremely by the packet received by USB data card driver After USB data card, the problem that just can continue to next packet, thus cause data processing speed Slowly, the problem that message transmission rate is low.Additionally, also use USB data card driver to receive Other packets in data copy to task control block forms task control block chained list to be sent, After the data being set as in the task control block of completion status are sent completely, by task control block chain to be sent The data in each task control block in table package, and are sent to USB by USB interface in the lump In data card, solving in existing technology, USB data card driver can only send a number every time According to bag to USB data card, the efficiency of transmission of usb bus can not be fully used, data transmission speed The problem that rate is low.By the data processing method in the present embodiment, after carrying out packet caching, organizing bag Send to USB data card, take full advantage of the efficiency of transmission of usb bus, improve the transmission of data Speed.
Embodiment two
With reference to Fig. 2, it is shown that the flow chart of steps of a kind of data processing method of the embodiment of the present invention two.
The data processing method of the present invention is still illustrated by the present embodiment from usb data sending side, this Embodiment carries out the process of data with the data processing equipment that USB data card driver is integrated, Specifically comprising the following steps that of data processing method
The integrated data processing equipment of step S202:USB data card driver receives subscriber equipment and sends out The packet sent.
Data processing equipment integrated for USB data card driver is installed on terminal by the present embodiment set On standby such as PC, PC operating system is sent by USB data card driver to be needed to usb data The packet that card sends, USB data card driver is sent out to USB data card by calling USB interface The packet sent.Wherein, PC operating system needs when calling USB interface to follow NDIS agreement.
The integrated data processing equipment of step S204:USB data card driver is by the number in packet Copy in task control block according to setting rule according to first, and by the data setting in task control block be Completion status.
Preferably, the data in packet are pressed by the data processing equipment that USB data card driver is integrated Set the regular concrete steps copied in task control block according to first to include: USB data card driver Integrated data processing equipment judges whether there is task control to be sent in USB data card driver Clamp dog;If existing, then the data in the packet sent by subscriber equipment copy to one still free free time Between task control block to be sent in, wherein, this free space is more than or equal to packet to be copied Size;If not existing, then control block chained list extracts an idle task control block from idle task, Data in packet are copied in the idle task control block extracted.
The integrated data processing equipment of step S206:USB data card driver is calling USB interface While the data that USB data card sends in task control block, continue to what subscriber equipment sent Other packets, and the data in other packets are copied to other respectively according to the first setting rule Business controls, in block, other task control blocks to be organized into task control block chained list to be sent.
The data processing equipment use USB data card driver general that USB data card driver is integrated The packet received copies in task control block, before replicating data, select to replicate data In which task control block.If in task block chained list to be sent, there is task control to be sent The most available free space in clamp dog, and this task control block to be sent, and free space more than or etc. Size in packet to be copied, then, by selecting this task control block to be sent, replicate and connect Data in other packets received, data and the original data in task control block to be sent that will replicate Package.If in task block chained list to be sent, there is not task control block to be sent, or, Do not have free space to be more than or equal to the task control block of size of packet to be copied, then appoint from the free time Business controls to extract in block chained list an idle task control block, copies to the data in packet extract Idle task control block in.
When the packet in task control block chained list to be sent reaches some, USB data card drives The data in task control block that the integrated data processing equipment of program will not may be copied to again continue to set For completion status, but set it to other states, state the most undetermined.The most now, USB The integrated data processing equipment of data card driver will be this feedback of status to subscriber equipment, Yong Hushe The standby calling interface that will not be further continued for sends packet.
The integrated data processing equipment of step S208:USB data card driver is being set as shape After data in the task control block of state are sent completely, from task control block chained list to be sent, extract one Task control block to be sent.
The integrated data processing equipment of step S210:USB data card driver judges task to be sent Control whether block chained list exists other task control blocks to be sent.If not existing, then perform step S212;If existing, then perform step S214.
Step S212: when judging not exist in task control block chained list to be sent other tasks to be sent When controlling block, the integrated data processing equipment of USB data card driver directly invokes USB interface and sends out Send the data in the task control block of extraction to USB data card, terminate this flow process.
Step S214: when judging to there is other task controls to be sent in task control block chained list to be sent During clamp dog, then the data processing equipment that USB data card driver is integrated is from task control block to be sent Chained list extracts other task control blocks to be sent again, in the task control block all to be sent extracted Data package.
Specifically, the data processing equipment that USB data card driver is integrated is from task control block to be sent Chained list extracts other task control blocks to be sent again, in the task control block all to be sent extracted The step that packages of data include:
The integrated data processing equipment of step S2142:USB data card driver is from task control to be sent Clamp dog chained list extracts other task control block to be sent again.
The data processing equipment judgement successively extraction that step S2144:USB data card driver is integrated Whether the data volume size sum of two task control blocks to be sent is less than or equal to setting value;If so, Then perform step S2146;If it is not, then perform step S2148.
Wherein, setting value can be appropriately arranged with according to practical situation by those skilled in the art, more preferably, Setting value can be arranged to 32KB, naturally it is also possible to is other value.
Step S2146: if the data volume size sum of two task control blocks to be sent is less than or equal to Setting value, then to be sent the appointing that the data processing equipment that USB data card driver is integrated will extract The data that business controls in a task control block in block copy to carry out in another task control block group Bag, and the task control block being replicated data is linked into idle task control block chained list, return step S210。
Wherein, replicate and the task control block that is replicated can be any in two task control blocks Individual.
After the data in a task control block are copied in another task control block, will be replicated The task control block of data is linked into idle task and controls block chained list, returns step S210 and continues to judge Whether task control block chained list to be sent exists other task control blocks to be sent.
When the data in each task control block in task control block chained list to be sent are packaged, Can package to sent each packet in task control block successively.During group bag, Mei Dangyi When data in individual task control block to be sent are copied in another task control block to be sent, i.e. enter During row every time group bag, all can revise total bag number of data in the packet after group bag, and each data The bag long message of bag.Packet after group bag includes: total bag number of packet of group bag, each data The bag length of bag and real data.
Step S2148: if the data volume size sum of two task control blocks to be sent be more than described in set Definite value, then the data processing equipment that USB data card driver is integrated drives journey by USB data card The task control block to be sent of rear extraction is put back in task control block chained list to be sent by sequence, performs step S216。
The integrated data processing equipment of step S216:USB data card driver calls USB interface and sends out Send the data after group bag to USB data card.
The data processing method provided by the present embodiment, at the data that USB data card driver is integrated Reason device, when USB data card sends packet, is receiving the packet that subscriber equipment sends After, packet is copied in task control block, and the packet being replicated is set as completion status. After the packet being replicated is set to completion status, this is set as that the packet of completion status passes through USB interface sends to USB data card;Meanwhile, also continue to receive subscriber equipment send other Packet, it is to avoid in prior art, need the number that will be received by USB data card driver Send to USB data card according to bag, just can continue to next packet, thus cause at data Reason speed is slow, the problem that message transmission rate is low.Additionally, use USB data card driver to connect Data in other packets received copy to form task control block chain to be sent in task control block Table, after the data in the described task control block being set as completion status are sent completely, by packet Data cache, after the USB interface free time, by each in task control block chained list to be sent Data in task control block package, and are sent to USB data card by USB interface in the lump, Solve in existing technology, a packet can only be sent by USB data card driver every time To USB data card, the efficiency of transmission of usb bus can not be fully used, and message transmission rate is low Problem.By the data processing method in the present embodiment, by USB data card driver by number Send after carrying out caching according to bag, organize bag to USB data card, take full advantage of the transmission effect of usb bus Rate, improves the transfer rate of data.
Embodiment three
With reference to Fig. 3, it is shown that the flow chart of steps of a kind of data processing method of the embodiment of the present invention three.
The present embodiment receives side from usb data and illustrates the data processing method the present invention, this What the data of embodiment processed specifically comprises the following steps that
Step S302:USB data card is received USB data card driver and is sent by USB interface Group bag after packet.Wherein, group bag after packet by USB data card driver by with Under type packages: USB data card driver receives the packet that subscriber equipment sends;By data Data in bag set rule according to first and copy in task control block, and by the number in task control block According to being set as completion status;The number in task control block is sent to USB data card calling USB interface While according to, continue to other packets needing to send to USB data card, and by other data Data in bag set rule according to first and copy in other task control blocks respectively, by other task controls Clamp dog is organized into task control block chained list to be sent;Number in the task control block being set as completion status After being sent completely, set rule to each task control in task control block chained list to be sent according to second Data in clamp dog package.
It should be noted that USB data card driver is setting rule to the number received according to first Copy to the process in task control block according to the data in bag refer in embodiment one or embodiment two Reproduction process.Further, rule is being set to sent each in task control block chained list according to second The process that data in task control block package, it is possible to the group in reference example one or embodiment two Packet procedures.
Packet after reception group is wrapped by step S304:USB data card unpacks.
By the data processing method provided in the present embodiment, receive in USB data card and set through terminal After packet after the USB data card driver group bag of standby side, USB data card is by the number after group bag It is reduced to raw data packets according to bag, and then the data in each packet are processed, it is to avoid be existing USB data transmission in, on the one hand, need drive to USB data card after having received a packet Dynamic program side returns and confirms that response could receive next packet again, and data transmission bauds and efficiency are equal Low problem;On the other hand, the reception of this individual data bag also results in USB data card and to have processed If needs process next packet after the data of a packet, then also wait for next data Bag sends and could process it to USB data card again, causes the problem that treatment effeciency is low, joint Save and waited that packet sends the time to USB data card, improve the transfer rate of data.
Embodiment four
With reference to Fig. 4, it is shown that the flow chart of steps of a kind of data processing method of the embodiment of the present invention four.
The present embodiment still receives side from usb data and illustrates the data processing method the present invention, Specifically comprising the following steps that of the data processing method of the present embodiment
Step S402:USB data card is received USB data card driver and is sent by USB interface Group bag after packet.
Wherein, the packet after group bag is packaged in the following manner by USB data card driver: USB data card driver receives the packet that subscriber equipment sends;By the data in packet according to One sets rule copies in task control block, and by the data setting in task control block for completing shape State;While calling USB interface data in USB data card transmission task control block, continue Receive other packets that subscriber equipment sends, and the data in other packets are set rule according to first Copy to the most respectively, in other task control blocks, other task control blocks are organized into task control to be sent Block chained list;After data in the task control block being set as completion status are sent completely, set according to second Data in each task control block in task control block chained list to be sent are then packaged by set pattern.
In the present embodiment, the packet after setting group bag includes: total bag number of the packet of group bag, each The bag length of individual packet and real data.
Total bag number of the packet after step S404:USB data card acquisition group bag and each packet Bag is long.
Total bag number of the packet after step S406:USB data card foundation group bag and each packet Bag is long to be unpacked the packet after group bag.
Including: unwrap the beginning from first data, each packet in the packet after the bag of judgement group successively Whether bag is long meets established standards;If being unsatisfactory for established standards, after the most directly stopping remaining group of bag Packet unpacks;If meeting established standards, then the packet meeting established standards is unpacked also Return whether the bag length of each packet in the packet after judging described group of bag successively meets established standards Step.
In a kind of preferred packet judging after group bag, whether the bag length of each packet meets and sets mark Standard is: the bag obtaining a packet is long, contrasts, this Bao Changyu setting value such as by setting value It is set to 1500 bytes, then judge that bag is long whether less than or equal to 1500 bytes of setting value, if little In or equal to 1500 bytes of setting value, then can determine that the long conformance with standard of bag of this packet, then can enter Row unpacking process;If being not more than 1500 bytes of this setting value, then stop de-packaging operation, no longer to this In packet after group bag, remaining packet unpacks.It should be noted that 1500 bytes are only Exemplary illustration, can be the most suitable value according to requirements set.
USB data card after the bag length judging first packet meets established standards, then can replicate this number According to the data in bag, and data are processed;When after the data processed in first packet, connect And judge whether the bag length of second packet meets established standards, if the bag length of second packet is also Meet established standards, then also can replicate the data in second packet, process, circulate successively Operation, until the data in all of packet have all processed, or runs into long being unsatisfactory for of bag and sets mark Accurate packet stops unpacking.
When the bag length of a certain packet is unsatisfactory for established standards, then illustrate that the group packet procedures of this packet can Can there is a problem, i.e. packet after group bag there is a problem, then will stop the data after this group bag Bag unpacks.Such as: the packet after a certain group of bag comprises 10 packets, then USB number Successively the packet after group bag is unpacked according to card.It is assumed that the bag length of front 5 packets is all satisfied Established standards, then front 5 packets are just unpacked by USB data card, replicate front 5 numbers According to the data in bag, and these data are processed;During to the 6th packet, it is judged that the 6th packet Bag length be unsatisfactory for established standards, then stopping is unpacked by USB data card, i.e. will not continue to process after The remaining packet in limit.
By the data processing method provided in the present embodiment, receive in USB data card and set through terminal After packet after the USB data card driver group bag of standby side, after USB data card acquisition group bag Total bag number of packet and the bag of each packet are long, according to the bag length of total bag number and each packet to group Packet after bag unpacks, and enables USB data card to reduce initial data, and to initial data It is further processed.Further, during unpacking, USB data card can judge the bag of packet Whether length meets established standards, and the bag length once packet is unsatisfactory for established standards, then can stop immediately Unpack, it is possible to save and unpack the time, it is ensured that the accuracy of data.
Embodiment five
With reference to Fig. 5, it is shown that the flow chart of a kind of data processing method of the embodiment of the present invention five.
In the present embodiment, set USB data card driver and be arranged in PC, from PC and USB The data processing method of the present invention is illustrated by the angle of the data interaction between data card.
The data processing method steps of the present embodiment is as follows:
Step S502:PC operating system follows NDIS agreement, according to NDIS agreement calling interface MPSendPacket transmission upstream data bag is to the USB data card driver of PC, wherein, up Packet is i.e. sent to the packet of USB data card.
Wherein, MPSendPacket interface is the transmission interface being registered to NDIS, when needs send IP MpSendPacket can be called during (Internet Protocol, the agreement of interconnection between network) packet Interface.
The state of packet is set as by step S504:USB data card driver NDIS_STATUS_PENDING, state the most undetermined.
Step S506:USB data card driver judges task control block chained list to be sent Whether QueueSendTCB exists task control block TCB to be sent.If existing, then perform step S508, if not existing, then performs step S510.
Task control block chained list QueueSendTCB to be sent is to preserve TCB(Tast Control to be sent Block, task control block) chained list of pointer.
It is multiple that step S508:USB data card driver takes out a TCB from QueueSendTCB Data in packet processed, perform step S512.
Step S510:USB data card driver controls block chained list SendFreeList from idle task One idle TCB of middle taking-up, the data in duplicate packet, perform step S512.
If QueueSendTCB has TCB to be sent, the data in IP packet are copied to this In TCB;Otherwise, from SendFreeList, an idle TCB is taken out to preserve in IP packet Data.
The state of bag is set as by step S512:USB data card driver NDIS_STATUS_COMPLETE。
NDIS_STATUS_COMPLETE i.e. completion status, after packet has been replicated, this number Being set to NDIS_STATUS_COMPLETE state according to the state of bag, PC operating system is in data After the state of bag is set to NDIS_STATUS_COMPLETE state, may proceed to send next Individual IP packet.
Step S514:USB data card driver judges that USB interface is the most idle.If it is idle, then Perform step S516;If the most idle, then perform step S518.
Step S516:USB data card driver calls USB interface and is set as completion status The transmission of the packet in TCB, performs step S520.
The task control block TCB replicating data is put into by step S518:USB data card driver In QueueSendTCB, to be sent, terminate this transmission flow.
When the USB free time, USB data card driver calls USB and sends function and realize USB and connect Mouthful, send the data in TCB;The most just TCB is got back into QueueSendTCB.
Step S520:USB data card driver determines that packet is sent completely.
After packet is sent completely, now USB is idle, and USB data card driver can call into USB Be sent completely function.Here package action, after group bag completes, again sends.
Whether step S522:USB data card driver judges to have in QueueSendTCB to be sent TCB.If there is TCB to be sent, then perform step S524.If there is not TCB to be sent Then terminate this transmission flow.
Step S524:USB data card driver inquiry QueueSendTCB, and the behaviour that packages Make, return step S516.
After execution of step S524, again return to step S516, i.e. in QueueSendTCB Data package operation, send the data after group bag to USB data card.
Wherein, the idiographic flow of the above-mentioned operation that packages the data in QueueSendTCB is with reference to attached Fig. 6.
Specifically, the step operated that packages the data in QueueSendTCB is as follows:
Step S602:USB data card driver determines that USB has been sent completely current packet.
Whether step S604:USB data card driver judges to have in QueueSendTCB to be sent TCB.If existing, perform step S606;If not existing, then terminate this group packet procedures.
Step S606:USB data card driver takes a TCB out from QueueSendTCB.
For ease of difference, the named pTCB of TCB that this is extracted.
Step S608:USB data card driver judges in QueueSendTCB the most pending The TCB sent.If existing, perform step S610;If not existing, then call USB and send function, send out Send the data in pTCB.
Step S610:USB data card driver extracts a TCB from QueueSendTCB again Out.
For ease of difference, the named PTempTCB of TCB that this is extracted.
The bag length of the packet in step S612:USB two TCB of data card driver inspection and be No less than 32KB.If the bag length of the packet in two TCB and be less than or equal to 32KB, then hold Row step S614;If more than 32KB, directly perform step S616.
If that is, PTCB and PTempTCB data meet group bag condition, by PTempTCB's In data copy to PTCB data.PTempTCB data message is removed, and gets back into QueueTCB In.
It should be understood that 32KB is merely illustrative, other appropriate value is equally applicable.
Data in PTempTCB are copied to PTCB by step S614:USB data card driver In.
After data in PTempTCB are copied in PTCB, the data in PTempTCB are deleted Remove.Packet in PTCB is packaged with the packet in PTempTCB.
Certainly, in actual applications, it is also possible to the data in PTCB are copied in PTempTCB.
PTempTCB is put back in QueueSendTCB by step S616:USB data card driver.
In step S618:USB data card driver amendment PTCB, record wraps the long and letter of bag number Breath, calls USB and sends function, send the data in PTCB.
It should be noted that the above-mentioned the most simply group bag that packaged by PTCB with PTempTCB shows Example, in the flow process of whole group of bag, if QueueSendTCB exists multiple TCB to be sent, So will circulate the step of above-mentioned group of bag, the data in TCB to be sent to each package.
The form of the packet after a kind of group of bag is as shown in table 1:
Table 1
Wherein, Byte0(byte 0) and Byte1(byte 1) show that this usb data comprises IP The total number of bag.Bag according to total bag number He each IP bag is long, can circulate the data obtaining IP bag.
Data after group bag are sent to USB data card by USB data card driver, usb data Blocking and unpack the data after group bag, this unpacking process is as shown in Figure 7.
With reference to Fig. 7, it is shown that the idiographic flow that the data after the group bag in the present embodiment are unpacked.
Unpack specifically comprises the following steps that
Step S702:USB data card receives the data after group bag.
The number of packet and each data in data after step S704:USB data card acquisition group bag The bag of bag is long.
As it has been described above, Byte0 and Byte1 shows that this organizes the total number containing IP bag of the packet after wrapping. Bag according to total bag number He each IP bag is long, and circulation obtains the data of IP bag.
Step S706:USB data card judges that (the most whether rationally the bag length of packet the most one by one Meet established standards).If the bag length of packet is reasonable, then perform step S708;If it is unreasonable, the most directly Connect stopping to unpack.
Step S708:USB data card replicates the data of n-th IP packet.
Wherein, N is the natural number of total number of the IP bag less than or equal to Byte0 instruction.From the 1st Individual data unwrap the beginning, and last packet to this group bag stops.
Step S710:USB data card processes the data in n-th IP packet, returns step S706.
The data processing method provided by the present embodiment, USB data card driver is according to specific bar Part, the packet that will comply with the transmission of NDIS agreement carries out storing up bag, disposable toward USB after reaching condition Data card sends, and can improve the efficiency of data transmission, it will be apparent that improve upstream rate.Use this enforcement After the group of example wraps capable scheme, find that speed can improve 100% by test.
Embodiment six
With reference to Fig. 8, it is shown that the structured flowchart of a kind of data processing equipment of the embodiment of the present invention six.
Data processing equipment in the present embodiment is positioned at usb data sending side, this data processing equipment bag Include: receiver module 802, the packet sent to USB data card for receiving subscriber equipment to need;Multiple Molding block 804, copies in task control block for the data in packet are set rule according to first, And be completion status by the data setting in task control block;Molded tissue block 806, is used for calling USB and connects Mouth sends the data in task control block to USB data card, continues to what subscriber equipment sent simultaneously Other packets, and the data in other packets are copied to other respectively according to the first setting rule Business controls, in block, other task control blocks to be organized into task control block chained list to be sent;Group bag module 808, after the data in the task control block being set as completion status are sent completely, according to second Set rule the data in each task control block in task control block chained list to be sent are packaged; Sending module 810, the data after calling USB interface transmission group bag are to USB data card.
The data processing equipment of the present embodiment is used for realizing corresponding USB in aforesaid plurality of embodiment of the method The data processing method of data sending side, and there is the data process side of corresponding usb data sending side The beneficial effect of method.The data processing equipment provided by the present embodiment, carries out packet caching, group Send after bag to USB data card, take full advantage of the efficiency of transmission of usb bus, improve data Transfer rate.
Embodiment seven
With reference to Fig. 9, it is shown that the structured flowchart of a kind of data processing equipment of the embodiment of the present invention seven.
The present embodiment has carried out further optimization to the device in embodiment six, and the data after optimization process dress Put and include: receiver module 902, for receiving the packet that subscriber equipment sends;Replication module 904, Copy in task control block for the data in packet are set rule according to first, and by task control Data setting in clamp dog is completion status;Molded tissue block 906, for sending task to USB data card Control the data in block, continue to other packets that subscriber equipment sends simultaneously, and by other data Data in bag set rule according to first and copy in other task control blocks respectively, by other task controls Clamp dog is organized into task control block chained list to be sent;Group bag module 908, for being set as completion status Task control block in data be sent completely after, according to second set rule to task control block to be sent The data in each task control block in chained list package;Sending module 910, is used for calling USB Data after interface transmission group bag are to USB data card.
Preferably, group bag module 908 includes: extract submodule 9082, for being set as completion status Task control block in data be sent completely after, from task control block chained list to be sent extract one treat The task control block sent;First judges submodule 9084, is used for judging task control block chained list to be sent In whether there is other task control blocks to be sent;Implementation sub-module 9086, for judging son first The judged result of module 9084 be not in the presence of, call sending module by USB data card driver 910;In the presence of judging that the judged result of submodule 9084 is first, from task control block chain to be sent Table extracts other task control blocks to be sent again, in the task control block all to be sent extracted Data package.
Preferably, implementation sub-module 9086 is treated extracting other again from task control block chained list to be sent The task control block sent, when the data in the task control block all to be sent extracted are packaged: Other task control block to be sent is extracted again from task control block chained list to be sent;Judge successively Whether the data volume size sum of two task control blocks to be sent extracted is less than or equal to setting value, Wherein, setting value is less than or equal to the size of described task control block;If during less than or equal to setting value, The data in a task control block in the task control block to be sent that will extract copy to another Task control block packages, and the task control block being replicated data is linked into idle task control Clamp dog chained list, returns first and judges submodule 9084;If during more than setting value, to be sent by rear extraction Task control block put back in task control block chained list to be sent.
Preferably, the packet after group bag includes: total bag number of packet of group bag, each packet Bag length and real data.
Preferably, replication module 904 includes: judge submodule 9042, is used for judging USB data card Whether driver exists task control block to be sent;
First replicon module 9044, is used in the presence of judging that submodule 9042 judged result is, then Data in the packet send subscriber equipment copy to be sent the appointing in a space the most available free Business controls in block, and wherein, free space is more than or equal to the size of packet to be copied;
Second replicon module 9046, be used for judging submodule 9042 judged result as in the presence of not, from Idle task controls to extract in block chained list an idle task control block, the data in packet is replicated In the idle task control block extracted.
The data processing equipment of the present embodiment is used for realizing aforementioned enforcement one, embodiment two and embodiment three In multiple embodiments of the method in the data processing method of corresponding usb data sending side, and have The beneficial effect that corresponding method is implemented, does not repeats them here.
Embodiment eight
With reference to Figure 10, it is shown that the structured flowchart of a kind of data processing equipment of the embodiment of the present invention eight.
The data processing equipment of the present embodiment is positioned at usb data and receives side, and this data processing equipment includes: Receiver module 1002, after receiving the group bag that USB data card driver is sent by USB interface Packet;Unpacking module 1004, the packet after wrapping reception group unpacks;Wherein, Packet after group bag is packaged in the following manner by USB data card driver: usb data Card driver receives the packet needing to send to USB data card;By the data in packet according to First sets rule copies in task control block, and by the data setting in task control block for completing shape State;While calling USB interface data in USB data card transmission task control block, continue Receive need to USB data card send other packets, and by the data in other packets according to First sets rule copies to, in other task control blocks, be organized into pending by other task control blocks respectively Send task control block chained list;Data in the described task control block being set as completion status are sent completely After, set rule to the number in each task control block in task control block chained list to be sent according to second According to packaging.
The data processing equipment provided by the present embodiment, is received in USB data card and passes through the application In data processing method group bag after packet after, to group bag after packet unpack, make USB Data card can reduce initial data, and be further processed initial data, it is to avoid existing In data processing method, if needs process next data after having processed the data of a packet Bag, then also wait for next packet transmission and could again it be processed to USB data card, Save and wait that packet sends the time to USB data card, also improve the transmission speed of data equally Rate.
Preferably, the packet after group bag includes: total bag number of packet of group bag, each packet Bag length and real data;Unpack total bag number of the module 1004 packet after obtaining group bag with each The bag of individual packet is long;According to the bag of total bag number and each packet is long, packet after group bag is solved Bag.
Preferably, module 1004 is unpacked after the bag length according to total bag number and each packet is to group bag When packet unpacks: unwrap the beginning from first data, in the packet after the bag of judgement group successively each Whether the bag length of packet meets established standards;If being unsatisfactory for established standards, directly stop remaining group Packet after bag unpacks;If meeting established standards, then the packet meeting established standards is carried out Unpack and return the bag length of each packet in the packet performed after judging group bag successively whether to meet and set Calibration standard.
The data processing equipment of the present embodiment is used for realizing aforementioned enforcement three, embodiment four and embodiment five In multiple embodiments of the method in corresponding usb data receive the data processing method of side, and have The beneficial effect that corresponding method is implemented, does not repeats them here.
Each embodiment in this specification all uses the mode gone forward one by one to describe, and each embodiment stresses Be all the difference with other embodiments, between each embodiment, identical similar part sees mutually ?.For device embodiment, due to itself and embodiment of the method basic simlarity, so the ratio described Relatively simple, relevant part sees the part of embodiment of the method and illustrates.
Above data processing method provided by the present invention and device are described in detail, herein should Being set forth principle and the embodiment of the present invention by specific case, the explanation of above example is only It is the method and core concept thereof being adapted to assist in and understanding the present invention;General technology simultaneously for this area Personnel, according to the thought of the present invention, the most all will change, In sum, this specification content should not be construed as limitation of the present invention.

Claims (8)

1. a data processing method, it is characterised in that including:
Receive the packet that subscriber equipment sends;
According to first, the data in described packet are set rule copy in task control block, and by institute Stating the data setting in task control block is completion status;
Call USB and send described task control to described USB (universal serial bus) data card Data in block, continue to simultaneously described subscriber equipment send other packets, and by described other Data in packet set rule according to described first and copy in other task control blocks respectively, by institute State other task control blocks and be organized into task control block chained list to be sent;
After data in the described task control block being set as completion status are sent completely, set according to second Set pattern then carries out group to the data in each task control block in described task control block chained list to be sent Bag;Including: from described task control block chained list to be sent, extract a task control block to be sent; Judge whether described task control block chained list to be sent exists other task control blocks to be sent;If no Exist, then directly invoke described USB and send the number in the described task control block extracted According to described USB (universal serial bus) data card;If existing, then from described task control block chained list to be sent Extract other task control blocks to be sent again, to the data in the task control block all to be sent extracted Package;
Call the described data after described USB transmission group bag total to described general serial Line data card.
Method the most according to claim 1, it is characterised in that described from described task to be sent Control block chained list to extract other task control blocks to be sent again, to the task control all to be sent extracted The step that data in clamp dog package includes:
Other task control block to be sent is extracted again from described task control block chained list to be sent;
Judge the data volume size sum of two described task control blocks to be sent successively extracted whether Less than or equal to setting value, wherein, described setting value is less than or equal to the size of described task control block;
If less than or equal to described setting value, then in the task control block to be sent that will extract appoints The data that business controls in block copy to package in another task control block, and will be replicated data Task control block be linked into idle task control block chained list, return the described task control to be sent of described judgement Whether clamp dog chained list exists the step of other task control blocks to be sent;
If more than described setting value, then the task control block described to be sent of rear extraction is put back to described in treat Send in task control block chained list.
3. according to the method described in any one of claim 1 to 2, it is characterised in that the number after group bag According to including: total bag number of packet, the bag length of each packet and the real data of group bag.
4. according to the method described in any one of claim 1 to 2, it is characterised in that described by described Data in packet copy to step in task control block according to the first setting rule and include:
Judge whether USB (universal serial bus) data card driver exists task control block to be sent;
If exist, then the data in the packet described subscriber equipment sent copy to one the most available free In the task control block to be sent in space, wherein, described free space is more than or equal to institute to be copied State the size of packet;
If not existing, then control block chained list extracts an idle task control block from idle task, will In the task control block of the described free time that the data in described packet copy to extraction.
5. a data processing equipment, it is characterised in that including:
Receiver module, for receiving the packet that subscriber equipment sends;
Replication module, copies to task control for the data in described packet are set rule according to first In clamp dog, and it is completion status by the data setting in described task control block;
Molded tissue block, is used for calling USB and sends to described USB (universal serial bus) data card Data in described task control block, continue to other packets that described subscriber equipment sends simultaneously, And the data in other packets described are copied to other tasks respectively according to described first setting rule Control, in block, other task control blocks described to be organized into task control block chained list to be sent;
Group bag module, is sent completely for the data in the described task control block being set as completion status After, set rule in each task control block in described task control block chained list to be sent according to second Data package;
Sending module, the described data after calling described USB transmission group bag are to institute State USB (universal serial bus) data card;
Described group of bag module includes: extract submodule, for being set as the described task control of completion status After data in clamp dog are sent completely, from described task control block chained list to be sent, extraction one is to be sent Task control block;First judges submodule, be used for judging described task control block chained list to be sent is Other task control blocks to be sent of no existence;Implementation sub-module, for judging submodule described first Judged result be not in the presence of, call described sending module described first judge submodule judgement knot In the presence of fruit is, from described task control block chained list to be sent, extract other task controls to be sent again Data in the task control block all to be sent extracted are packaged by block.
Device the most according to claim 5, it is characterised in that described implementation sub-module is from institute State and task control block chained list to be sent extracts other task control blocks to be sent again, extraction is owned When data in task control block to be sent package:
Other task control block to be sent is extracted again from described task control block chained list to be sent; Judge whether the data volume size sum of two the described task control blocks to be sent successively extracted is less than Or equal to setting value, wherein, described setting value is less than or equal to the size of described task control block;If it is little In or equal to described setting value time, will extract task control block to be sent in a task control block In data copy to another task control block packages, and the task control of data will be replicated Clamp dog is linked into idle task and controls block chained list, returns described first and judges submodule;If setting described in being more than During definite value, the task control block described to be sent of rear extraction is put back to described task control block chain to be sent In table.
7. according to the device described in any one of claim 5 to 6, it is characterised in that the number after group bag According to including: total bag number of packet, the bag length of each packet and the real data of group bag.
8. according to the device described in any one of claim 5 to 6, it is characterised in that described backed stamper Block includes:
Judge submodule, be used for judging whether USB (universal serial bus) data card driver exists to be sent Task control block;
First replicon module, in the presence of described judgement submodule judged result is, then by described Data in the packet that subscriber equipment sends copy to the task to be sent in a space the most available free Controlling in block, wherein, described free space is more than or equal to the size of described packet to be copied;
For described, second replicon module, judges that submodule judged result, as in the presence of not, is appointed from the free time Business controls to extract in block chained list an idle task control block, the data in described packet is copied to In the task control block of the described free time extracted.
CN201310753237.2A 2013-12-31 2013-12-31 Data processing method and device Active CN103714033B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310753237.2A CN103714033B (en) 2013-12-31 2013-12-31 Data processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310753237.2A CN103714033B (en) 2013-12-31 2013-12-31 Data processing method and device

Publications (2)

Publication Number Publication Date
CN103714033A CN103714033A (en) 2014-04-09
CN103714033B true CN103714033B (en) 2017-01-11

Family

ID=50407027

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310753237.2A Active CN103714033B (en) 2013-12-31 2013-12-31 Data processing method and device

Country Status (1)

Country Link
CN (1) CN103714033B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104090858A (en) * 2014-06-10 2014-10-08 中兴通讯股份有限公司 Data transmission method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101227688A (en) * 2007-11-21 2008-07-23 中兴通讯股份有限公司 Method for transmitting data through USB interface on mobile phone
CN101655894A (en) * 2008-08-19 2010-02-24 上海华虹集成电路有限责任公司 Method for improving throughput of grouping algorithm on general serial bus encryption lock
CN101788972A (en) * 2010-03-08 2010-07-28 威盛电子股份有限公司 System and method for transmitting data
CN102736995A (en) * 2011-04-14 2012-10-17 中国移动通信集团广东有限公司 Electronic equipment and control method for USB communication module of electronics equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101227688A (en) * 2007-11-21 2008-07-23 中兴通讯股份有限公司 Method for transmitting data through USB interface on mobile phone
CN101655894A (en) * 2008-08-19 2010-02-24 上海华虹集成电路有限责任公司 Method for improving throughput of grouping algorithm on general serial bus encryption lock
CN101788972A (en) * 2010-03-08 2010-07-28 威盛电子股份有限公司 System and method for transmitting data
CN102736995A (en) * 2011-04-14 2012-10-17 中国移动通信集团广东有限公司 Electronic equipment and control method for USB communication module of electronics equipment

Also Published As

Publication number Publication date
CN103714033A (en) 2014-04-09

Similar Documents

Publication Publication Date Title
CN103873692B (en) Method, device and system for resource sharing
CN106161633B (en) Transmission method and system for packed files based on cloud computing environment
CN110083606A (en) Across chain storage method, terminal and storage medium
CN108494817A (en) Data transmission method, relevant apparatus and system
CN105450785B (en) File transmission method and device
CN104935641B (en) A kind of method and apparatus for accelerating file transmission
TW201833784A (en) Hybrid-based compatibility method, adaptation piece and running device and system
US20150067013A1 (en) Methods for servicing web service requests using parallel agile web services and devices thereof
CN102546612A (en) Remote procedure call implementation method based on remote direct memory access (RDMA) protocol in user mode
CN107784085A (en) The deriving method and its terminal of a kind of data list
CN111555984B (en) Method and device for data transmission, smart home equipment and storage medium
CN114040445A (en) Data transmission method and device
CN109746405A (en) Slab roller-way autocontrol method, device, terminal device and storage medium
WO2019218478A1 (en) Response method and device for call service
CN103714033B (en) Data processing method and device
CN107888663A (en) A kind of method of distribution of document, equipment and computer-readable medium
CN109636460B (en) Service processing method, device, equipment and storage medium
CN101986282A (en) Topological adaptation method and device
CN103299298A (en) Service processing method and system
CN113986811A (en) High-performance kernel-mode network data packet acceleration method
CN105357148A (en) Method and system for preventing output message of network exchange chip from being disordered
WO2015000417A1 (en) Method, apparatus, application interactive platform, terminal, and system for uploading an image
CN102685072B (en) The method of uploading pictures and terminal unit
CN102256182A (en) RTP (Real-time Transport Protocol)-based video stream fragment framing method
CN109842644B (en) Parameter expansion method and system, cloud computing management platform assembly and user terminal

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20191212

Address after: 353, block a, No.79, Jinyi Road, Xiaoshan Economic and Technological Development Zone, Xiaoshan District, Hangzhou City, Zhejiang Province

Patentee after: Newpoint Enterprise Management Group Co.,Ltd.

Address before: 100084 A, building 8, Tsinghua Science and Technology Park, No. 803, Zhongguancun East Road, building 1, Beijing, Haidian District

Patentee before: INNOFIDEI TECHNOLOGIES Inc.

CP01 Change in the name or title of a patent holder
CP01 Change in the name or title of a patent holder

Address after: 311200 353, block a, 79 Jinyi Road, Xiaoshan Economic and Technological Development Zone, Xiaoshan District, Hangzhou City, Zhejiang Province

Patentee after: Newpoint Intelligent Technology Group Co.,Ltd.

Address before: 311200 353, block a, 79 Jinyi Road, Xiaoshan Economic and Technological Development Zone, Xiaoshan District, Hangzhou City, Zhejiang Province

Patentee before: Newpoint Enterprise Management Group Co.,Ltd.