CN106533976B - data packet processing method and device - Google Patents
data packet processing method and device Download PDFInfo
- Publication number
- CN106533976B CN106533976B CN201610982732.4A CN201610982732A CN106533976B CN 106533976 B CN106533976 B CN 106533976B CN 201610982732 A CN201610982732 A CN 201610982732A CN 106533976 B CN106533976 B CN 106533976B
- Authority
- CN
- China
- Prior art keywords
- data
- buffer
- sending
- original data
- data string
- 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
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L49/00—Packet switching elements
- H04L49/90—Buffering arrangements
- H04L49/9021—Plurality of buffers per packet
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L47/00—Traffic control in data switching networks
- H04L47/50—Queue scheduling
- H04L47/62—Queue scheduling characterised by scheduling criteria
- H04L47/625—Queue scheduling characterised by scheduling criteria for service slots or service orders
- H04L47/6275—Queue scheduling characterised by scheduling criteria for service slots or service orders based on priority
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L49/00—Packet switching elements
- H04L49/90—Buffering arrangements
- H04L49/9047—Buffering arrangements including multiple buffers, e.g. buffer pools
- H04L49/9052—Buffering arrangements including multiple buffers, e.g. buffer pools with buffers of different sizes
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
the invention is applicable to the technical field of communication, and provides a data packet processing method and device. The method comprises the following steps: the method comprises the steps of obtaining original data in an original data packet, splitting the original data into N sections of data strings, sending the N sections of data strings to a buffer according to a sequence, and sending the next section of data string to the buffer after the data strings received by the buffer are sent. By the method, the data strings can be sent in order, and the accuracy and the integrity of the sent data are improved.
Description
Technical Field
The embodiment of the invention belongs to the technical field of communication, and particularly relates to a data packet processing method and device.
background
At present, in the prior art, a controller splits a data string into a plurality of data strings, then sends the plurality of data strings to buffers with the same number, sets priorities for the buffers with the same number according to the sequence of the split plurality of data strings, and finally sends the received data strings according to the buffers with the priorities. Since the receiving side may cause the recombined data to be incorrect due to disorder or missing between data strings when a packet loss accident occurs.
therefore, a new technical solution is needed to solve the above technical problems.
disclosure of Invention
The embodiment of the invention provides a data packet processing method and a data packet processing device, and aims to solve the problem that data sent by the conventional method is incorrect due to disorder or missing of sent data packets.
the embodiment of the invention is realized in such a way that a data packet processing method comprises the following steps:
Acquiring original data in an original data packet, and splitting the original data into N sections of data strings, wherein N is an integer and is greater than or equal to 1;
sending the N sections of data strings to a buffer according to the sequence;
And after the data string received by the buffer is sent, sending the next segment of data string to the buffer.
Optionally, the obtaining the original data in the original data packet and splitting the original data into N data strings specifically includes:
Acquiring the number of buffers and original data in an original data packet;
and when the number of the buffers is N, splitting the original data in the original data packet into N data strings.
optionally, the obtaining the original data in the original data packet and splitting the original data into N data strings specifically includes:
acquiring the capacity of a buffer and original data in an original data packet;
and splitting the original data in the original data packet into N sections of data strings, so that the size of the split data strings is smaller than or equal to the capacity of the buffer.
optionally, after the sending of the data string received by the buffer is finished, sending the next segment of data string to the buffer, specifically including:
Reading a preset sending flag bit, and judging whether the data string received by the buffer is sent completely according to the sending flag bit;
And after the data string received by the buffer is completely sent, sending the next section of data string to the buffer.
Optionally, the reading a preset sending flag bit, and determining whether sending of the data string received by the buffer is completed according to the sending flag bit specifically includes:
Reading a preset sending zone bit, and judging that the data string received by the buffer is sent completely when the sending zone bit is a first preset value;
When the sending flag bit is a second preset value, judging that the data string received by the buffer is not sent completely, wherein the second preset value is not equal to the first preset value;
Correspondingly, after the data string received by the buffer is completely sent, before the next data string is sent to the buffer, the method includes:
resetting the transmit flag bit from the first preset value to the second preset value.
Another object of an embodiment of the present invention is to provide a packet processing apparatus, including:
The device comprises an original data acquisition unit, a data processing unit and a data processing unit, wherein the original data acquisition unit is used for acquiring original data in an original data packet and splitting the original data into N sections of data strings, N is an integer and is more than or equal to 1;
The data string sending unit is used for sending the N sections of data strings to the buffer according to the sequence;
the data string sending unit is further configured to send the next segment of data string to the buffer after the data string received by the buffer is sent.
Optionally, the raw data acquiring unit specifically includes:
the first obtaining module is used for obtaining the number of the buffers and the original data in the original data packet;
And the first splitting module is used for splitting the original data in the original data packet into N sections of data strings when the number of the buffers is N.
Optionally, the raw data acquiring unit specifically includes:
the second acquisition module is used for acquiring the capacity of the buffer and the original data in the original data packet;
and the second splitting module splits the original data in the original data packet into N sections of data strings, so that the size of the split data strings is smaller than or equal to the capacity of the buffer.
Optionally, the data string sending unit specifically includes:
The sending judgment module is used for reading a preset sending flag bit and judging whether the sending of the data string received by the buffer is finished according to the sending flag bit;
and the data string sending module is used for sending the next section of data string to the buffer after the data string received by the buffer is sent.
optionally, the sending determining module specifically includes:
A sending completion judging module, configured to read a preset sending flag bit, and when the sending flag bit is a first preset value, judge that sending of the data string received by the buffer is completed; when the sending flag bit is a second preset value, judging that the data string received by the buffer is not sent completely, wherein the second preset value is not equal to the first preset value;
Correspondingly, the packet processing apparatus further includes:
A reset unit for resetting the transmission flag bit from the first preset value to the second preset value.
in the embodiment of the invention, the original data in the obtained original data packet is divided into N data strings, the N data strings are sent to the buffer according to the sequence, and the next data string is sent to the buffer after the data string received by the buffer is sent, so that the ordered sending completion of each data string can be ensured, and the accuracy and the integrity of the sent data are improved.
Drawings
Fig. 1 is a flowchart of a data packet processing method according to a first embodiment of the present invention;
Fig. 2 is a block diagram of a packet processing apparatus according to a second embodiment of the present invention.
Detailed Description
in order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
in the embodiment of the invention, the original data in the original data packet is acquired and split into N data strings, the N data strings are sent to the buffer according to the sequence, and after the data strings received by the buffer are sent, the next data string is sent to the buffer.
in order to explain the technical means of the present invention, the following description will be given by way of specific examples.
the first embodiment is as follows:
Fig. 1 is a flowchart illustrating a packet processing method according to a first embodiment of the present invention, which is detailed as follows:
step S11, obtaining the original data in the original data packet, and splitting the original data into N data strings, where N is an integer and is greater than or equal to 1.
when there are a plurality of buffers, in order to balance the use of the buffers and avoid excessive use of any one of the buffers, the step S11 specifically includes:
A1, the number of acquisition buffers and the original data in the original data packet.
And A2, when the number of the buffers is N, splitting the original data in the original data packet into N data strings.
specifically, the original data in the original data packet is obtained, the number of buffers is obtained, and when the number of the buffers is N, the original data in the original data packet is split into N data strings according to the number of the buffers. It should be noted that the size of the split N-segment data string is smaller than the maximum capacity of the buffer. In general, when there are a plurality of buffers, the maximum capacity is equal, and at this time, the original data may be divided into N data strings of equal byte size, but if the bytes of the original data are not enough to divide the N data strings of equal byte size equally, the original data is first divided into N-1 data strings of equal byte size, and the remaining bytes are regarded as the nth data string. For example, the original data is split into a data string of 3(N ═ 3) segments with a byte size of 8 bytes. Of course, if the remaining data string is less than 8 bytes after splitting the 2-byte data string having a byte size of 8 bytes, the remaining bytes will be the 3 rd-stage data string.
Optionally, when there is only one buffer, in order to avoid that the size of the data string sent to the buffer exceeds the maximum capacity of the buffer, the step S11 specifically includes:
A1', obtaining the capacity of the buffer and the original data in the original data packet;
A2', splitting the original data in the original data packet into N data strings, so that the size of the split data strings is smaller than or equal to the capacity of the buffer. Specifically, whether the size of the original data exceeds the maximum capacity of a buffer is judged, and when the size of the original data exceeds the maximum capacity of the buffer, the original data in the original data packet is split into N data strings, so that the size of each split data string is smaller than or equal to the capacity of the buffer.
And step S12, sending the N data strings to a buffer according to the sequence.
Specifically, after splitting the original data in the obtained original data packet into N data strings according to the number or capacity of the buffer, the N data strings are sent to the buffer according to the sequence of the original data, for example, the 1 st data string is sent to the buffer first, and then the 2 nd data string is sent.
Optionally, in order to ensure that the split data strings are sent in sequence, before the S12, the method includes:
And B0, marking the split data strings into N sections according to the sequence of the original data.
Specifically, after the original data in the obtained original data packet is divided into N data strings according to the number or capacity of the buffer, the N data strings are labeled from small to large according to the sequence of the original data, and at this time, step S12 sequentially sends the N data strings to the buffer according to the labels from small to large.
optionally, when the number of buffers is N, in order to ensure that the split data strings are sent in sequence, the S12 includes:
b1, configuring the priority of the N buffers.
B2, setting a one-to-one correspondence according to the sequence of the data strings and the high and low priorities of the buffers, and sending the N sections of data strings to the corresponding buffers according to the correspondence.
Specifically, the data string ranked at 1 is set to correspond to the buffer with the highest priority, the data string ranked at 2 is set to correspond to the buffer with the second highest priority, and the rest are analogized in sequence. Since the higher the priority of the buffer is, the earlier the sequence of transmitting the data strings is, the priority transmission of the data strings in the front is guaranteed.
step S13, after the data string received by the buffer is sent, the next data string is sent to the buffer.
Specifically, after the data string received by the buffer is confirmed to be sent, the next segment of data is sent to the buffer, so that the data string can be guaranteed to be completely sent, and a receiver can be guaranteed to receive the complete data string.
in order to further confirm that the data string received by the buffer has been sent, the step S13 specifically includes:
And C1, reading a preset sending flag bit, and judging whether the data string received by the buffer is sent completely according to the sending flag bit.
And C2, after the data string received by the buffer is completely sent, sending the next segment of data string to the buffer.
Specifically, after the data string received by the buffer is sent, a preset sending flag bit is read, and whether the received data string is sent or not is judged according to the sending flag bit. And when the preset sending flag bit is read to indicate that the data string received by the buffer is completely sent, sending the next segment of data string to the buffer. And when a preset sending flag bit is read to indicate that the data string received by the buffer is not sent completely, continuing to wait for sending the next segment of data string to the buffer.
Further, the C1 specifically includes:
and C11, reading a preset sending flag bit, and judging that the data string received by the buffer is sent completely when the sending flag bit is a first preset value. For example, the first preset value may be set to 1.
and C12, when the sending flag bit is a second preset value, determining that the sending of the data string received by the buffer is not completed, where the second preset value is not equal to the first preset value. For example, the second preset value may be set to 0.
correspondingly, after the data string received by the buffer is completely sent, before the next data string is sent to the buffer, the method includes:
and C13, resetting the sending flag bit from the first preset value to the second preset value.
specifically, after the data string received by the buffer is sent, a preset sending flag bit is read, when the sending flag bit is a second preset value, it is determined that the received data string is not sent completely, the next data string is continuously sent to the buffer, when the sending flag bit is a first preset value, it is determined that the data string received by the buffer is sent completely, the sending flag bit is reset from the first preset value to a second preset value, and then the next data string is sent to the buffer.
Optionally, in order to improve the transmission efficiency and avoid invalid waiting, after the end of transmitting the data string received by the buffer, before transmitting the next segment of data string to the buffer, the method further includes:
And D1, when the data string received by the buffer is judged not to be completely transmitted and the next data string is continuously transmitted, acquiring the transmission time of the data string received by the buffer.
and D2, when the sending time is larger than or equal to a preset time threshold, restarting to send the data string received by the buffer. It should be noted that, when restarting transmission of a data string received by the buffer, since the buffer may have stored part of the data string at the last reception, in order to avoid the buffer storing an erroneous data string, when the buffer receives the first data of a new data string, if it is determined that the buffer has stored data, the data stored in the buffer is overwritten with the newly received data string.
D3, when the number of times of restarting and sending the data string received by the buffer is larger than the preset number of times, prompting that the sending is failed.
specifically, when the read preset sending flag bit is a second preset value and it is determined that the sending of the received data string is not completed, obtaining sending time for sending the data string received by the buffer, and when the sending time is smaller than a preset time threshold, continuing to wait for the end of the sending; and restarting to transmit the data string received by the buffer when the transmission time is greater than or equal to a preset time threshold.
specifically, taking an application scenario as an example, after the controller receives the data packets, the number of the acquired buffers is 3, the controller splits the original data of the can data packet into 3 data strings according to the number of the buffers, configures the priorities of the 3 buffers according to the sequence of the 3 data strings, stores the data string 1 with the highest sequence in the buffer 1 with the highest priority, and starts to send the data string 1. Before sending the data string 2 to the buffer 2, the controller reads a preset sending flag bit, when the sending flag bit is 1, the data string 1 received by the buffer 1 is judged to be sent completely, the controller resets the sending flag bit to 0, then the data string 2 is sent to the buffer 2, and the sending of the data string 2 is started; if the preset transmission flag bit is read to be 0 before the data string 2 is transmitted to the buffer 2, it is determined that the data string 1 received by the buffer 1 has not been transmitted. Acquiring the sending time of the sending data string 1, and when the sending time is greater than or equal to a preset time threshold value, restarting the sending data string 1 received by the sending buffer 1 before sending the data string 2 to the buffer 2 by the controller. When the number of times of restarting the data string 1 received by the transmission buffer 1 is larger than a preset number of times, a transmission failure is prompted.
In the first embodiment of the present invention, original data in an original data packet is obtained and split into N data strings, the N data strings are sequentially sent to a buffer, after the sending of the data string received by the buffer is completed, a sending flag is read, when the sending flag is a first preset value, it is determined that the sending of the received data string is completed, and then the next data string is sent to the buffer. When the sending flag bit is a second preset value, the received data string is judged not to be sent completely, and the next data string continues to wait for sending, so that the completion of orderly sending of each data string is ensured, and the accuracy of data sending is improved.
it should be understood that, in the embodiment of the present invention, the sequence numbers of the above-mentioned processes do not mean the execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiment of the present invention.
example two:
Fig. 2 is a block diagram of a packet processing apparatus according to a second embodiment of the present invention, and only the parts related to the embodiment of the present invention are shown for convenience of description.
The packet processing apparatus includes: a raw data acquisition unit 21 and a data string transmission unit 22, wherein:
The original data obtaining unit 21 is configured to obtain original data in an original data packet, and split the original data into N segments of data strings, where N is an integer and is greater than or equal to 1.
When there are multiple buffers, in order to balance the use of the buffers and avoid overuse of one buffer, the raw data obtaining unit 21 specifically includes:
The first obtaining module is used for obtaining the number of the buffers and the original data in the original data packet;
And the first splitting module is used for splitting the original data in the original data packet into N sections of data strings when the number of the buffers is N.
Specifically, the original data in the original data packet is obtained, the number of buffers is obtained, and when the number of the buffers is N, the original data in the original data packet is split into N data strings according to the number of the buffers. It should be noted that the size of the split N-segment data string is smaller than the maximum capacity of the buffer. In general, when there are a plurality of buffers, the maximum capacity is equal, and at this time, the original data may be divided into N data strings of equal byte size, but if the bytes of the original data are not enough to divide the N data strings of equal byte size equally, the original data is first divided into N-1 data strings of equal byte size, and the remaining bytes are regarded as the nth data string. For example, the original data is split into a data string of 3(N ═ 3) segments with a byte size of 8 bytes. Of course, if the remaining data string is less than 8 bytes after splitting the 2-byte data string having a byte size of 8 bytes, the remaining bytes will be the 3 rd-stage data string.
Optionally, when there is only one buffer, in order to avoid that the size of the data string sent to the buffer exceeds the maximum capacity of the buffer, the original data obtaining unit 21 specifically includes:
the second acquisition module is used for acquiring the capacity of the buffer and the original data in the original data packet;
And the second splitting module splits the original data in the original data packet into N sections of data strings, so that the size of the split data strings is smaller than or equal to the capacity of the buffer. Specifically, whether the size of the original data exceeds the maximum capacity of a buffer is judged, and when the size of the original data exceeds the maximum capacity of the buffer, the original data in the original data packet is split into N data strings, so that the size of each split data string is smaller than or equal to the capacity of the buffer.
And the data string sending unit 22 is configured to send the N data strings to the buffer in sequence.
Specifically, after splitting the original data in the obtained original data packet into N data strings according to the number or capacity of the buffer, the N data strings are sent to the buffer according to the sequence of the original data, for example, the 1 st data string is sent to the buffer first, and then the 2 nd data string is sent.
optionally, in order to ensure that the split data strings are sent in sequence, the packet processing apparatus includes:
And the labeling unit is used for labeling the data strings which are split into N sections according to the sequence of the original data.
Specifically, after the original data in the obtained original data packet is divided into N data strings according to the number or capacity of the buffer, the N data strings are labeled from small to large according to the sequence of the original data, and at this time, the data string transmitting unit 22 sequentially transmits the N data strings to the buffer according to the labels from small to large.
optionally, when the number of buffers is N, in order to ensure that the split data strings are sequentially transmitted, the data string transmitting unit 22 includes:
and the priority configuration module is used for configuring the priorities of the N buffers.
And the second data string sending module is used for setting a one-to-one correspondence relationship according to the sequence of the data strings and the high and low priorities of the buffers, and sending the N sections of data strings to the corresponding buffers according to the correspondence relationship.
Specifically, the data string ranked at 1 is set to correspond to the buffer with the highest priority, the data string ranked at 2 is set to correspond to the buffer with the second highest priority, and the rest are analogized in sequence. Since the higher the priority of the buffer is, the earlier the sequence of transmitting the data strings is, the priority transmission of the data strings in the front is guaranteed.
The data string sending unit 22 is further configured to send the next segment of data string to the buffer after the data string received by the buffer is sent.
Specifically, after the data string received by the buffer is confirmed to be sent, the next segment of data is sent to the buffer, so that the data string can be guaranteed to be completely sent, and a receiver can be guaranteed to receive the complete data string.
In order to further confirm that the data string received by the buffer has been sent, the data string sending unit 22 specifically includes:
The sending judgment module is used for reading a preset sending flag bit and judging whether the sending of the data string received by the buffer is finished according to the sending flag bit;
and the data string sending module is used for sending the next section of data string to the buffer after the data string received by the buffer is sent.
specifically, after the data string received by the buffer is sent, a preset sending flag bit is read, and whether the received data string is sent or not is judged according to the sending flag bit. And when the preset sending flag bit is read to indicate that the data string received by the buffer is completely sent, sending the next segment of data string to the buffer. And when a preset sending flag bit is read to indicate that the data string received by the buffer is not sent completely, continuing to wait for sending the next segment of data string to the buffer.
Further, the sending and determining module specifically includes:
a sending completion judging module, configured to read a preset sending flag bit, and when the sending flag bit is a first preset value, judge that sending of the data string received by the buffer is completed; for example, the first preset value may be set to 1. And when the sending flag bit is a second preset value, judging that the data string received by the buffer is not sent completely, wherein the second preset value is not equal to the first preset value. For example, the second preset value may be set to 0.
correspondingly, the packet processing apparatus further includes:
A reset unit for resetting the transmission flag bit from the first preset value to the second preset value.
Specifically, after the data string received by the buffer is sent, a preset sending flag bit is read, when the sending flag bit is a second preset value, it is determined that the received data string is not sent completely, the next data string is continuously sent to the buffer, when the sending flag bit is a first preset value, it is determined that the data string received by the buffer is sent completely, the sending flag bit is reset from the first preset value to a second preset value, and then the next data string is sent to the buffer.
Optionally, in order to improve the transmission efficiency and avoid invalid waiting, the packet processing apparatus further includes:
And the time acquisition unit is used for acquiring the sending time of the data string received by the buffer when the data string received by the buffer is judged not to be sent completely and continuously waits for sending the next section of data string.
And the restarting unit is used for restarting and transmitting the data string received by the buffer when the transmission time is greater than or equal to a preset time threshold. It should be noted that, when restarting transmission of a data string received by the buffer, since the buffer may have stored part of the data string at the last reception, in order to avoid the buffer storing an erroneous data string, when the buffer receives the first data of a new data string, if it is determined that the buffer has stored data, the data stored in the buffer is overwritten with the newly received data string.
And the reminding unit is used for reminding that the sending is failed when the number of times of restarting and sending the data string received by the buffer is greater than the preset number of times.
specifically, when the read preset sending flag bit is a second preset value and it is determined that the received data string is not sent completely, the used sending time for sending the data string received by the buffer is obtained, and when the used sending time is smaller than a preset time threshold, the sending is continuously waited to be finished; and restarting to transmit the data string received by the buffer when the used transmission time is greater than or equal to a preset time threshold.
in a second embodiment of the present invention, original data in an original data packet is obtained and split into N data strings, the N data strings are sequentially sent to a buffer, after the sending of the data string received by the buffer is completed, a sending flag is read, when the sending flag is a first preset value, it is determined that the sending of the received data string is completed, and then the next data string is sent to the buffer. When the sending flag bit is a second preset value, the received data string is judged not to be sent completely, and the next data string continues to wait for sending, so that the completion of orderly sending of each data string is ensured, and the accuracy of data sending is improved.
those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
it is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
the functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
the above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.
Claims (10)
1. a method for packet processing, the method comprising:
Acquiring original data in an original data packet, and splitting the original data into N data strings with equal byte size, wherein N is an integer and is greater than or equal to 1;
Labeling the N segments of data strings according to the sequence of the original data, configuring the priorities of the N buffers when the number of the buffers is N, setting a one-to-one correspondence relationship according to the sequence labels of the data strings and the priorities of the buffers, and sending the N segments of data strings to corresponding buffers according to the sequence labels and the correspondence relationship;
and after the data string received by the buffer is sent, sending the next segment of data string to the buffer.
2. The data packet processing method according to claim 1, wherein the obtaining of the original data in the original data packet and splitting into N data strings specifically includes:
Acquiring the number of buffers and original data in an original data packet;
And when the number of the buffers is N, splitting the original data in the original data packet into N data strings.
3. The data packet processing method according to claim 1, wherein the obtaining of the original data in the original data packet and splitting into N data strings specifically comprises:
Acquiring the capacity of a buffer and original data in an original data packet;
And splitting the original data in the original data packet into N sections of data strings, so that the size of the split data strings is smaller than or equal to the capacity of the buffer.
4. the method according to claim 1, wherein after the data string received by the buffer is sent, sending a next data string to the buffer, specifically comprising:
Reading a preset sending zone bit, and judging whether the data string received by the buffer is sent completely according to the sending zone bit;
and after the data string received by the buffer is completely sent, sending the next section of data string to the buffer.
5. The method according to claim 4, wherein the reading a preset sending flag bit and determining whether the sending of the data string received by the buffer is completed according to the sending flag bit specifically comprises:
reading a preset sending zone bit, and judging that the data string received by the buffer is sent completely when the sending zone bit is a first preset value;
when the sending flag bit is a second preset value, judging that the data string received by the buffer is not sent completely, wherein the second preset value is not equal to the first preset value;
Correspondingly, after the data string received by the buffer is completely sent, before the next data string is sent to the buffer, the method includes:
resetting the transmit flag bit from the first preset value to the second preset value.
6. A packet processing apparatus, characterized in that the apparatus comprises:
the device comprises an original data acquisition unit, a data processing unit and a data processing unit, wherein the original data acquisition unit is used for acquiring original data in an original data packet and splitting the original data into N data strings with equal byte size, N is an integer and is more than or equal to 1;
a data string sending unit, configured to label the N segments of data strings according to the sequence of the original data, configure priorities of the N buffers when the number of buffers is N, set a one-to-one correspondence relationship according to the sequence label of the data string and the priority of the buffer, and send the N segments of data strings according to the sequence label and the correspondence relationship to the corresponding buffers;
the data string sending unit is further configured to send the next segment of data string to the buffer after the data string received by the buffer is sent.
7. the packet processing apparatus according to claim 6, wherein the raw data obtaining unit specifically includes:
the first obtaining module is used for obtaining the number of the buffers and the original data in the original data packet;
And the first splitting module is used for splitting the original data in the original data packet into N sections of data strings when the number of the buffers is N.
8. the packet processing apparatus according to claim 6, wherein the raw data obtaining unit specifically includes:
The second acquisition module is used for acquiring the capacity of the buffer and the original data in the original data packet;
And the second splitting module splits the original data in the original data packet into N sections of data strings, so that the size of the split data strings is smaller than or equal to the capacity of the buffer.
9. The apparatus according to claim 6, wherein the data string transmitting unit specifically includes:
The sending judgment module is used for reading a preset sending zone bit and judging whether the sending of the data string received by the buffer is finished according to the sending zone bit;
and the data string sending module is used for sending the next section of data string to the buffer after the data string received by the buffer is sent.
10. the apparatus according to claim 9, wherein the transmission determining module specifically includes:
a sending completion judging module, configured to read a preset sending flag bit, and when the sending flag bit is a first preset value, judge that sending of the data string received by the buffer is completed; when the sending flag bit is a second preset value, judging that the data string received by the buffer is not sent completely, wherein the second preset value is not equal to the first preset value;
correspondingly, the packet processing apparatus further includes:
A reset unit for resetting the transmission flag bit from the first preset value to the second preset value.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610982732.4A CN106533976B (en) | 2016-11-07 | 2016-11-07 | data packet processing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610982732.4A CN106533976B (en) | 2016-11-07 | 2016-11-07 | data packet processing method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106533976A CN106533976A (en) | 2017-03-22 |
CN106533976B true CN106533976B (en) | 2019-12-06 |
Family
ID=58351373
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610982732.4A Expired - Fee Related CN106533976B (en) | 2016-11-07 | 2016-11-07 | data packet processing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106533976B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2021017527A1 (en) * | 2019-08-01 | 2021-02-04 | 青岛海信宽带多媒体技术有限公司 | Optical module data sending and receiving methods and devices, and optical module |
CN110430017B (en) * | 2019-08-01 | 2022-02-11 | 青岛海信宽带多媒体技术有限公司 | Data sending method and device and optical module |
CN110430025B (en) * | 2019-08-01 | 2021-12-14 | 青岛海信宽带多媒体技术有限公司 | Data sending method and device and optical module |
CN110380785A (en) * | 2019-08-16 | 2019-10-25 | 青岛海信宽带多媒体技术有限公司 | A kind of digital diagnostic information acquisition methods, device and optical module |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1274499A (en) * | 1998-07-31 | 2000-11-22 | 索尼计算机娱乐公司 | Method, system and appts. for sending and receiving information |
US7320037B1 (en) * | 2002-05-10 | 2008-01-15 | Altera Corporation | Method and apparatus for packet segmentation, enqueuing and queue servicing for multiple network processor architecture |
CN102664779A (en) * | 2012-03-31 | 2012-09-12 | 航天东方红卫星有限公司 | CAN bus data transmitting method |
CN102693206A (en) * | 2007-01-30 | 2012-09-26 | 世意法(北京)半导体研发有限责任公司 | WUSB (wireless universal serial bus) isochronous buffer management in endpoint |
CN103365805A (en) * | 2012-04-06 | 2013-10-23 | 上海算芯微电子有限公司 | Dynamic switching multi-path input-output interface system and method |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6590901B1 (en) * | 1998-04-01 | 2003-07-08 | Mosaid Technologies, Inc. | Method and apparatus for providing a packet buffer random access memory |
CN101175104B (en) * | 2006-10-31 | 2010-04-21 | 华为技术有限公司 | Dithering caching device and its management method |
CN102918515B (en) * | 2010-05-28 | 2015-10-14 | 惠普发展公司,有限责任合伙企业 | Store data in the multiple impact dampers in Memory Controller any in |
-
2016
- 2016-11-07 CN CN201610982732.4A patent/CN106533976B/en not_active Expired - Fee Related
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1274499A (en) * | 1998-07-31 | 2000-11-22 | 索尼计算机娱乐公司 | Method, system and appts. for sending and receiving information |
US7320037B1 (en) * | 2002-05-10 | 2008-01-15 | Altera Corporation | Method and apparatus for packet segmentation, enqueuing and queue servicing for multiple network processor architecture |
CN102693206A (en) * | 2007-01-30 | 2012-09-26 | 世意法(北京)半导体研发有限责任公司 | WUSB (wireless universal serial bus) isochronous buffer management in endpoint |
CN102664779A (en) * | 2012-03-31 | 2012-09-12 | 航天东方红卫星有限公司 | CAN bus data transmitting method |
CN103365805A (en) * | 2012-04-06 | 2013-10-23 | 上海算芯微电子有限公司 | Dynamic switching multi-path input-output interface system and method |
Also Published As
Publication number | Publication date |
---|---|
CN106533976A (en) | 2017-03-22 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106533976B (en) | data packet processing method and device | |
US20180123714A1 (en) | Method, Device, and System for Sending and Receiving Code Block Data Stream | |
CN102326363B (en) | Microcontroller with can module using buffer description table | |
US8184026B2 (en) | Mobile industry processor interface | |
US20220045922A1 (en) | Slave-to-master data and out-of-sequence acknowledgements on a daisy-chained bus | |
CN102724122B (en) | Reliable serial port transmission method and device based on hardware system | |
EP3605881B1 (en) | Method and device for transmitting and receiving network management information, transmitting apparatus and receiving apparatus | |
KR101752964B1 (en) | Supporting rma api over active message | |
US10033546B2 (en) | Method and system for reprogramming | |
CN111209240B (en) | Data transmission method, electronic equipment and storage medium | |
US20140107863A1 (en) | Vehicle Control Device, Vehicle Control System | |
CN103365810A (en) | Method and apparatus to reduce flash memory device programming time over a C.A.N. bus | |
US10649947B2 (en) | Stack timing adjustment for serial communications | |
CN106788916B (en) | Data transmission method and data transmission device for bus | |
US8331332B2 (en) | Wireless USB host and channel time allocation method | |
CN111405534A (en) | Information transmission method, first terminal and computer storage medium | |
IL270195B2 (en) | Wireless communication method, terminal device, and network device | |
CN107493216B (en) | Controller area network CAN bus data processing method and device | |
US20110093483A1 (en) | Method and apparatus for data exchange in a distributed system | |
EP3562149B1 (en) | Software upgrade method and device | |
CN104202124A (en) | Erp (enterprise resource planning) data package communication method | |
US9998405B2 (en) | Packet reception apparatus | |
CN107592967B (en) | Method and device for transmitting control frame in network, related unit and transport means | |
CN116634587B (en) | Method, device and storage medium for recovering data | |
CN110505038B (en) | Data transmission method and related device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20191206 Termination date: 20211107 |
|
CF01 | Termination of patent right due to non-payment of annual fee |