CN111211990B - Data packet processing method and device - Google Patents

Data packet processing method and device Download PDF

Info

Publication number
CN111211990B
CN111211990B CN201911416910.7A CN201911416910A CN111211990B CN 111211990 B CN111211990 B CN 111211990B CN 201911416910 A CN201911416910 A CN 201911416910A CN 111211990 B CN111211990 B CN 111211990B
Authority
CN
China
Prior art keywords
data packet
message
received
storage
index information
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
CN201911416910.7A
Other languages
Chinese (zh)
Other versions
CN111211990A (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.)
Beijing Watertek Information Technology Co Ltd
Original Assignee
Beijing Watertek Information 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 Beijing Watertek Information Technology Co Ltd filed Critical Beijing Watertek Information Technology Co Ltd
Priority to CN201911416910.7A priority Critical patent/CN111211990B/en
Publication of CN111211990A publication Critical patent/CN111211990A/en
Application granted granted Critical
Publication of CN111211990B publication Critical patent/CN111211990B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/10Flow control; Congestion control
    • H04L47/12Avoiding congestion; Recovering from congestion
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/745Address table lookup; Address filtering
    • H04L45/74591Address table lookup; Address filtering using content-addressable memories [CAM]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/90Buffering arrangements
    • H04L49/9042Separate storage for different parts of the packet, e.g. header and payload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/90Buffering arrangements
    • H04L49/9057Arrangements for supporting packet reassembly or resequencing

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a data packet processing method, which comprises the following steps: when a first data packet of a message is received, storing the first data packet and establishing index information of the message; the index information at least comprises the preset attribute information of the message and the storage indication information of the data packet of the message; when other data packets except the first data packet of a message are received, matching with the existing index information according to the preset attribute information of the message carried in the other data packets; when the matching is successful, applying the storage space for storing the other data packets, and writing the initial address of the storage space applied by the other data packets into the head of the received corresponding storage space of the last data packet; and updating the storage indication information in the successfully matched index information according to the initial address of the storage space applied by the other data packets. The invention also discloses a data packet processing device.

Description

Data packet processing method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for processing data packets, which implement reassembly of data packets.
Background
In the field of data communication, it is often necessary to implement receiving, message reassembly and forwarding of data packets by a network device. In the prior art, a RAM (Random-Access Memory) table is usually established to store the first-come data packet, and data reassembly is completed after the end packet arrives.
Take the data packet processing of the avionics full duplex communication ethernet switched AFDX network as an example. And the AFDX data packet recombination is used for message recombination after the data of an AFDX network transmission layer is unpacked, and different network data packets belonging to the same message are recombined into one message. The related technical scheme is that a RAM table is established, the received FRAG ID (fragment ID) of the first frame is stored, the RAM table is sequentially searched by the subsequent data to find the matched FRAG ID, and message recombination is completed until the data of the last frame is received. However, if the data packets on the network are short and the interval is small, the current message reassembly process is interrupted by the next message packet, which may affect the reception of the AFDX protocol data stream. A new matching method is needed to speed up the reassembly of network packets.
Disclosure of Invention
In order to solve the above technical problem, the present invention provides a method and an apparatus for packet processing, which quickly match to a received network packet based on index information and then link the currently received packet with the received network packet. Thereby avoiding congestion when network load is large.
The invention provides a data packet processing method, which comprises the following steps:
when a first data packet of a message is received, storing the first data packet and establishing index information of the message; the index information at least comprises preset attribute information of the message and storage indication information of a data packet of the message;
when other data packets except the first data packet of a message are received, matching with the existing index information according to the preset attribute information of the message carried in the other data packets; when the matching is successful, applying the storage space for storing the other data packets, and writing the initial address of the storage space applied by the other data packets into the head of the received corresponding storage space of the last data packet; and updating the storage indication information in the index information which is successfully matched according to the initial address of the storage space applied by the other data packets.
Optionally, the predetermined attribute information of the message at least includes: source address, destination address and message identification.
Optionally, the establishing the index information of the message further includes: the created index information is saved in a Content Address Memory (CAM).
Optionally, the storage indication information at least includes: the storage starting address corresponding to the first data packet, the storage starting address corresponding to the last data packet which is received and the total length of the received data packets.
Optionally, when a first data packet of a message is received, storing the first data packet and establishing index information of the message includes:
applying for a storage space according to the length of the first data packet and the length of preset next packet address indication information, and writing the first data packet in the applied storage space;
establishing index information of the message to which the first data packet belongs, and storing the initial address of the storage space applied by the first data packet as the storage initial address corresponding to the first data packet in the index information; storing the initial address of the storage space applied by the first data packet as the storage initial address corresponding to the received last data packet in the index information; and saving the length of the first data packet as the total length of the received data packet in the index information.
Optionally, the updating, according to the starting address of the storage space applied by the other data packet, the storage indication information in the index information that is successfully matched includes:
updating the storage initial address corresponding to the received last data packet to the initial address of the storage space applied by the other data packets;
and adding the length of the other data packets to the total length of the original received data packet to be used as the updated total length of the received data packet.
Optionally, the method further comprises:
and when the received data packet is the last data packet of a message, acquiring all the received data packets of the message according to the index information successfully matched, and sending the recombined message after the message is recombined.
Optionally, the obtaining all received data packets of the message according to the index information successfully matched includes:
judging whether the total length of the received data packet in the index information which is successfully matched is equal to the total length of the message corresponding to the data packet or not;
and when the matching is equal to the first data packet, reading all the received data packets according to the storage initial address corresponding to the first data packet indicated by the storage indication information in the successfully matched index information.
Optionally, the writing the start address of the storage space applied by the other data packet into the header of the received storage space corresponding to the previous data packet includes:
determining a write address of next packet address indication information in a storage space corresponding to a last received and stored data packet according to a storage start address corresponding to the last received and stored data packet indicated by storage indication information in successfully matched index information; and writing the initial address of the storage space applied by the other data packets according to the determined write address of the next packet address indication information.
The present invention also provides a packet processing apparatus, comprising:
a receiving module configured to receive a data packet;
the first packet processing module is set to store a first data packet of a message and establish index information of the message when the first data packet of the message is received; the index information at least comprises preset attribute information of the message and storage indication information of a data packet of the message;
the subsequent packet processing module is set to match with the existing index information according to the preset attribute information of the message carried in other data packets when receiving other data packets except the first data packet of the message; when the matching is successful, applying the storage space for storing the other data packets, and writing the initial address of the storage space applied by the other data packets into the head of the received corresponding storage space of the last data packet; and updating the storage indication information in the index information which is successfully matched according to the initial address of the storage space applied by the other data packets.
Drawings
Fig. 1 is a flowchart of a data packet processing method according to an embodiment;
fig. 2 is a flowchart of a data packet processing method according to the second embodiment;
fig. 3 is a state machine corresponding to the data packet processing method according to the second embodiment;
fig. 4 is a structural diagram of a packet processing device according to a third embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail with reference to the accompanying drawings and specific embodiments. It should be noted that the embodiments and features of the embodiments in the present application may be arbitrarily combined with each other without conflict.
Example one
The invention provides a data packet processing method, the flow of which is shown in fig. 1, comprising:
step 101: receiving a data packet;
step 102: judging whether the received data packet is the first data packet of a message or not; when the received data packet is the first data packet of a message, step 103 is executed; when the received data packet is other than the first data packet of a message, executing step 104;
step 103: storing the first data packet and establishing index information of the message; the index information at least comprises preset attribute information of the message and storage indication information of a data packet of the message;
step 104: matching with the existing index information according to the preset attribute information of the message carried in the other data packets; when the matching is successful, applying the storage space for storing the other data packets, and writing the initial address of the storage space applied by the other data packets into the head of the received corresponding storage space of the last data packet; and updating the storage indication information in the successfully matched index information according to the initial address of the storage space applied by the other data packets.
Optionally, the predetermined attribute information of the message at least includes: source address, destination address and message identification.
Optionally, after the index information of the message is established in step 102, the method further includes: the created index information is saved in a Content Address Memory (CAM).
Optionally, the storage indication information at least includes: the storage starting address corresponding to the first data packet, the storage starting address corresponding to the last data packet which is received and the total length of the received data packets.
Optionally, in step 103, when a first data packet of a message is received, storing the first data packet and establishing index information of the message includes:
applying for a storage space according to the length of the first data packet and the length of preset next packet address indication information, and writing the first data packet in the applied storage space;
establishing index information of the message to which the first data packet belongs, and storing the initial address of the storage space applied by the first data packet as the storage initial address corresponding to the first data packet in the index information; storing the initial address of the storage space applied by the first data packet as the storage initial address corresponding to the received last data packet in the index information; and saving the length of the first data packet as the total length of the received data packet in the index information.
Optionally, in step 104, updating storage indication information in the successfully matched index information according to the starting address of the storage space applied by the other data packet, including:
updating the storage initial address corresponding to the received last data packet to the initial address of the storage space applied by the other data packets;
and adding the length of the other data packets to the total length of the original received data packet to obtain the total length of the updated received data packet.
Optionally, the method further comprises:
and when the received data packet is the last data packet of a message, acquiring all the received data packets of the message according to the index information successfully matched, and sending the recombined message after the message is recombined.
Optionally, the obtaining all received data packets of the message according to the index information successfully matched includes:
judging whether the total length of the received data packets in the successfully matched index information is equal to the total length of the message corresponding to the data packets or not;
and when the matching is equal to the first data packet, reading all the received data packets according to the storage initial address corresponding to the first data packet indicated by the storage indication information in the successfully matched index information.
Optionally, in step 104, writing the start address of the storage space applied by the other data packet into the header of the received storage space corresponding to the previous data packet includes:
determining a write address of next packet address indication information in a storage space corresponding to a last received and stored data packet according to a storage start address corresponding to the last received and stored data packet indicated by storage indication information in successfully matched index information; and writing the initial address of the storage space applied by the other data packets according to the determined write address of the next packet address indication information.
Example two
The present invention provides a data packet processing method, the flow of which is shown in FIG. 2,
the embodiment of the invention takes the receiving, storing and recombining processes of the AFDX network data packet as an example,
step 201, receiving a data packet, and judging whether the data packet is a first data packet of a message or not;
step 202, when the data packet is the first data packet of a message, applying for a storage space, and writing the data packet in the applied storage space; the size of the applied storage space is greater than or equal to the length of the first data packet plus the length of the preset next packet address indication information; assuming that the size of the preset next packet address indication information is 5 bytes, the size of the applied storage space may be: current packet length (ip _ length) + 5; the write start address of the first packet is +5 of the start address of the applied storage space.
Step 203, establishing the index information of the corresponding message of the data packet, and writing the index information of the corresponding message into a Content Address Memory (CAM) table. Wherein the index information of the message includes: a source address (scr ip), a destination address (dst ip), a message identifier (frag id), and a storage start address (start _ addr) corresponding to a first data packet; optionally, the index information of the message further includes: the total length of the message (total _ length), the total length of the received data packets (sum _ length), and the storage start address (offset _ addr) corresponding to the last data packet of the message that has been received completely. When the first data packet is written, the offset _ addr and the start _ addr are consistent. And the storage initial address corresponding to the first data packet is the initial address of the applied storage space.
Step 204, when the data packet is other data packet (not the first data packet) than the first data packet, searching the index table-the CAM table according to the attribute information of the data packet, and matching with the existing index information; if the matching is successful, go on to step 205; if the match is unsuccessful, the process ends. Wherein the attribute information of the data packet includes: source address (scr ip), destination address (dst ip), message identification (frag id).
Step 205, determining whether the data packet is the last data packet (trailer) of a message according to the attribute information of the data packet. Wherein the attribute information of the data packet further comprises at least one of the following information: a trailer identification and a packet address offset (offset). If not, steps 206 and 207 are performed, and if it is, step 208 is performed.
Step 206, when the data packet is judged not to be the tail packet, applying for a storage space, and writing the data packet into the applied storage space; the size of the applied storage space is greater than or equal to the length of the data packet plus the length of the preset next packet address indication information; assuming that the size of the preset next packet address indication information is 5 bytes, the size of the applied storage space may be: current packet length (ip _ length) + 5; the write-in start address of the data packet is the start address +5 of the applied storage space;
determining a write address of the next packet address indication information in the storage space corresponding to the last data packet according to the storage start address (offset _ addr) corresponding to the received last data packet in the index information successfully matched in step 204; and writing the initial address of the storage space applied by the current data packet into the next packet address indication information corresponding to the received last data packet. That is, the header of the memory space corresponding to the last received data packet stores the start address of the memory space applied by the current data packet.
Assuming that the reception of the 1 st, 2 nd, 3 rd and 4 th data packets of a message is completed and the currently received data packet is the 5 th data packet, the header of the corresponding storage space of the previously received and written stored 1 st data packet stores the storage start address corresponding to the 2 nd data packet, the header of the corresponding storage space of the received and written stored 2 nd data packet stores the storage start address corresponding to the 3 rd data packet, and the header of the corresponding storage space of the received and written stored 3 rd data packet stores the storage start address corresponding to the 4 th data packet; after the 5 th data packet is processed in step 206, the header of the corresponding storage space of the received and written stored 4 th data packet stores the storage start address corresponding to the 5 th data packet; and so on for more packets. That is, each stored packet corresponds to the head of the storage space, and the start address of the storage address pointing to the next packet is stored. Wherein, a determined space is reserved at the head of the storage space corresponding to each data packet to store the address indication information of the next packet; assuming that the size of the preset next packet address indication information is 5 bytes, the size of the applied storage space may be: current packet length (ip _ length) + 5; storing the address information of the next data packet in the first 5 bytes of the corresponding storage space of the data packet; the write-in initial address of the data packet is the initial address +5 of the applied storage space; i.e. the current packet is saved starting from byte 6.
Step 207, updating the index information successfully matched in step 204 in the CAM table, including: updating the total length of the received packet (sum _ length) + the current packet length (ip _ length), that is, the total length of the new received packet (sum _ length) + the current packet length (ip _ length) and the total length of the original received packet; and updating the storage starting address (offset _ addr) corresponding to the last data packet which is received and completed by the message as the starting address of the storage space applied by the current data packet. And ending after the current data packet is written in the applied storage space. I.e., offset addr points to the start address of the memory space corresponding to the last packet a message has currently received and held.
For example, the process involved in updating the index information in step 207 in the process of receiving and storing the 1 st, 2 nd, 3 th, and 4 th packets of a message is as follows: (assuming that each packet is 100 in length and the size of the predetermined next packet address indication information is 5 bytes)
Receiving a 1 st data packet, applying for a storage space of 100+5, after storage, establishing index information in a CAM (content addressable memory) table, recording the total length (sum _ length) of the received data packets as 100, and recording the storage start address (offset _ addr) of the last data packet as start _ addr;
receiving the 2 nd data packet, applying for a storage space of 100+5, after storage, updating the total length (sum _ length) of the received data packets in the index information to 100+100, and setting the storage start address (offset _ address) of the last data packet to address 2; wherein address2 is the initial address of the memory space applied by the 2 nd data packet;
receiving the 3 rd data packet, applying for a storage space of 100+5, after storage, updating the total length (sum _ length) of the received data packet in the index information to 200+100, and setting the storage start address (offset _ address) of the last data packet to address 3; wherein address3 is the initial address of the memory space applied by the 3 rd data packet;
receiving the 4 th data packet, applying for a storage space of 100+5, after storage, updating the total length (sum _ length) of the received data packets in the index information to 300+100, wherein the storage start address (offset _ address) of the last data packet is address 4; wherein address4 is the initial address of the memory space applied by the 4 th data packet;
receiving the 5 th data packet, applying for a storage space of 100+5, after storage, updating the total length (sum _ length) of the received data packets in the index information to 400+100, wherein the storage start address (offset _ address) of the last data packet is address 5; wherein address5 is the initial address of the memory space applied by the 5 th data packet;
and so on for more packets.
Step 208, when the data packet is determined to be the trailer, further determining whether all data packets of the corresponding message have been received. If all have been received, go to step 209; if not, the packet is discarded and step 210 is performed.
Step 209, applying for a storage space, and writing the data packet into the applied storage space; the head of the storage space corresponding to each data packet is reserved for determining a space for storing next packet address indication information; assuming that the size of the preset next packet address indication information is 5 bytes, the size of the applied storage space may be: current packet length (ip _ length) + 5; storing the address information of the next data packet in the first 5 bytes of the corresponding storage space of the data packet; the write start address of the data packet is the start address of the applied storage space +5, that is, the current data packet is stored from the 6 th byte.
Determining the write address of the next packet address indication information in the storage space corresponding to the last data packet (previous data packet) according to the storage start address (offset _ addr) corresponding to the last data packet that has been received in the index information that is successfully matched in step 204; and writing the initial address of the storage space applied by the current data packet into the next packet address indication information corresponding to the received last data packet (the last data packet). And then reading all data packets of the message, and sending the recombined message after finishing the data packet recombination of the message.
Step 210, releasing the storage space occupied by all the data packets of the message to which the data packet belongs, and deleting the index information of the message to which the data packet belongs in the CAM table. And then the process is finished.
Optionally, the reading all data packets of the message includes:
according to the storage start address (start _ addr) corresponding to the first data packet in the index information successfully matched in step 204, reading the next packet address indication information (that is, reading the data with the length of the preset next packet address indication information, for example, the information of the first 5 bytes in the foregoing example) and the first data packet, and determining the storage start address corresponding to the next data packet (second packet) according to the next packet address indication information; reading the address indication information of the next data packet (third packet) and the next data packet (second packet) according to the storage starting address corresponding to the next data packet (second packet); and the rest is repeated until all data packets of the message are read. That is, the data of all n packets is obtained by a linked list formed by the address indication information of the next packet stored in the storage space (header) corresponding to the first n-1 packets.
Optionally, when the header (first 5 bytes) of the storage space corresponding to a data packet does not hold the storage start address of the next data packet, it indicates that the data packet is the last data packet of the message.
Optionally, before step 201, step 200 is further included, receiving a data packet, and determining whether the data packet is a fragmented data packet of a message. If yes, go to step 201; if not, step 211 is performed.
In step 211, if the data packet is not a fragmented data packet of a message, the received data packet is sent. And then the process is finished.
Optionally, after step 203, step 212 is further included: starting a packet timer of the message corresponding to the data packet;
correspondingly, before step 201, step 213 is further included: it is determined whether a packet timer for the message currently expires. If so, go to step 214; if not, continuing to execute step 201; or step 200 is performed.
In step 214, the message identifier of the expired group timer is determined, the index information in the CAM table is matched according to the message identifier, the storage space occupied by the received data packet of the message is released according to the matched index information, and the corresponding index information in the CAM is deleted.
Optionally, in step 200, it is determined whether the current packet is a fragmented packet of a message, including (taking an AFDX packet as an example):
when the AFDX packet has the following attributes: MF is equal to 0, and the AFDX packet has attributes: if the OFFSET is equal to 0, the data packet is not a fragment data packet of a message;
when the attribute of the AFDX packet is: MF equals 1, and the AFDX packet has the attribute: OFFSET is equal to 0; alternatively, MF is equal to 0, and the attributes of the AFDX packet: OFFSET is not equal to 0, the packet is a fragmented packet of a message.
Optionally, the determining whether the current data packet is a first data packet (head packet) of a message in step 201 includes: when the attribute of the AFDX packet is: DF equals 0 and the AFDX packet attributes: MF equals 1, and the AFDX packet has the attribute: OFFSET equals 0, then the packet is the first packet of a message (head packet); otherwise, it is not the first packet of a message.
Optionally, the determining in step 205 whether the current packet is the last packet (trailer) of a message includes: when the AFDX packet has the following attributes: MF is equal to 0, and the AFDX packet has attributes: OFFSET is not equal to 0, then the packet is the last packet (tail packet) of a message; otherwise, it is not the last packet of a message.
Optionally, the determining in step 208 whether all data packets of the corresponding message have been received includes: according to the matched index information, judging whether the total length (sum _ length) of the written and stored data packets and the length (ip _ length) of the current data packet are equal to the total length (total _ length) of the message to which the current data packet belongs; if yes, receiving all data packets of all the affiliated messages; otherwise, not all are received.
Wherein, MF, OFFSET, DF are the attribute defined by AFDX frame header (data packet); MF (more fragment) indicates whether a frame to be reassembled is to follow; OFFSET (OFFSET address) indicates an OFFSET of data contained in a current frame (packet) in the entire message, and one message may include a plurality of data frames; DF (Don't Fragment) indicates that the message is not fragmented, i.e. does not require reassembly.
The total length (total _ length) of the message to which the current packet belongs, and the length (ip _ length) of the current packet are the attributes defined by the AFDX frame header.
The corresponding state machine of this embodiment is shown in fig. 3.
EXAMPLE III
The present invention provides a packet processing apparatus 40, which has a structure as shown in fig. 4, and includes:
a receiving module 401 configured to receive a data packet;
the first packet processing module 402 is configured to, when a first data packet of a message is received, store the first data packet and establish index information of the message; the index information at least comprises the preset attribute information of the message and the storage indication information of the data packet of the message;
a subsequent packet processing module 403, configured to, when receiving another data packet other than the first data packet of a message, match the predetermined attribute information of the message carried in the other data packet with the existing index information; when the matching is successful, applying the storage space for storing the other data packets, and writing the initial address of the storage space applied by the other data packets into the head of the received corresponding storage space of the last data packet; and updating the storage indication information in the index information which is successfully matched according to the initial address of the storage space applied by the other data packets.
Optionally, the apparatus further comprises: an index information storage module 404 configured to store the created index information. Optionally, the index information storage module 404 is a Content Address Memory (CAM).
Optionally, the apparatus further comprises: the data packet storage module 405 is configured to store the received data packet and the next packet address indication information.
Optionally, the predetermined attribute information of the message at least includes: source address, destination address and message identification.
Optionally, the storage indication information at least includes: the storage starting address corresponding to the first data packet, the storage starting address corresponding to the received last data packet and the total length of the received data packets.
Optionally, the first packet processing module 402 is configured to, when a first data packet of a message is received, store the first data packet and establish index information of the message, where the process includes:
applying for a storage space according to the length of the first data packet and the length of preset next packet address indication information, and writing the first data packet in the applied storage space;
establishing index information of the message to which the first data packet belongs, and storing the initial address of the storage space applied by the first data packet as the storage initial address corresponding to the first data packet in the index information; storing the initial address of the storage space applied by the first data packet as the storage initial address corresponding to the received last data packet in the index information; and saving the length of the first data packet as the total length of the received data packets in the index information.
Optionally, the subsequent packet processing module 403 is further configured to:
updating the storage initial address corresponding to the received last data packet to the initial address of the storage space applied by the other data packets;
and adding the length of the other data packets to the total length of the original received data packet to be used as the updated total length of the received data packet.
Optionally, the apparatus further includes a tail packet processing module, configured to, when the received data packet is a last data packet of a message, obtain all received data packets of the message according to the successfully matched index information, and send the reassembled message after completing the reassembly of the message.
Optionally, the tail packet processing module is further configured to:
judging whether the total length of the received data packets in the successfully matched index information is equal to the total length of the message corresponding to the data packets or not;
and when the matching is equal to the first data packet, reading all the received data packets according to the storage initial address corresponding to the first data packet indicated by the storage indication information in the successfully matched index information.
Optionally, the subsequent packet processing module 403 is further configured to:
determining a write address of next packet address indication information in a storage space corresponding to a last received and stored data packet according to a storage start address corresponding to the last received and stored data packet indicated by storage indication information in successfully matched index information; and writing the initial address of the storage space applied by the other data packets according to the determined write address of the next packet address indication information.
Compared with the prior art, the scheme provided by the invention can process the receiving, storing and recombining of the data packets of a plurality of messages in parallel in a mode of adding the index table (CAM table) and the chain table, thereby greatly improving the searching speed in the message fragment recombining process, integrally improving the data packet processing efficiency and effectively relieving the congestion when the network load is large.
It will be understood by those of ordinary skill in the art that all or part of the steps of the above embodiments may be implemented using a computer program flow, which may be stored in a computer readable storage medium and executed on a corresponding hardware platform (e.g., system, apparatus, device, etc.), and when executed, includes one or a combination of the steps of the method embodiments.
Alternatively, all or part of the steps of the above embodiments may be implemented by using an integrated circuit, and the steps may be respectively manufactured as an integrated circuit module, or a plurality of the blocks or steps may be manufactured as a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The devices/functional modules/functional units in the above embodiments may be implemented by using a general-purpose computing device, and they may be centralized on a single computing device or distributed on a network formed by a plurality of computing devices.
Each device/function module/function unit in the above embodiments may be implemented in the form of a software function module and may be stored in a computer-readable storage medium when being sold or used as a separate product. The computer readable storage medium mentioned above may be a read-only memory, a magnetic disk or an optical disk, etc.
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 think of the changes or substitutions within the technical scope of the present invention, and shall cover 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 (8)

1. A method for processing a data packet, comprising:
when a first data packet of a message is received, storing the first data packet and establishing index information of the message; the index information at least comprises preset attribute information of the message and storage indication information of a data packet of the message;
when other data packets except the first data packet of a message are received, matching with the existing index information according to the preset attribute information of the message carried in the other data packets; when the matching is successful, applying a storage space to store the other data packets, and writing the initial address of the storage space applied by the other data packets into the head of the received corresponding storage space of the last data packet; updating storage indication information in the index information which is successfully matched according to the initial address of the storage space applied by the other data packets;
the storage indication information at least comprises: the storage starting address corresponding to the first data packet, the storage starting address corresponding to the last data packet after the data packet is received and the total length of the received data packet;
when receiving a first data packet of a message, storing the first data packet and establishing index information of the message, including:
applying for a storage space according to the length of the first data packet and the length of preset next packet address indication information, and writing the first data packet in the applied storage space;
establishing index information of the message to which the first data packet belongs, and storing the initial address of the storage space applied by the first data packet as the storage initial address corresponding to the first data packet in the index information; storing the initial address of the storage space applied by the first data packet as the storage initial address corresponding to the received last data packet in the index information; and saving the length of the first data packet as the total length of the received data packets in the index information.
2. The method of claim 1,
the predetermined attribute information of the message at least includes: source address, destination address and message identification.
3. The method of claim 1,
after the index information of the message is established, the method further comprises the following steps: the created index information is saved in a Content Address Memory (CAM).
4. The method of claim 1,
the updating of the storage indication information in the successfully matched index information according to the starting address of the storage space applied by the other data packets includes:
updating the storage initial address corresponding to the received last data packet to the initial address of the storage space applied by the other data packets;
and adding the length of the other data packets to the total length of the original received data packet to be used as the updated total length of the received data packet.
5. The method of claim 1,
the method further comprises the following steps:
and when the received data packet is the last data packet of a message, acquiring all the received data packets of the message according to the index information successfully matched, and sending the recombined message after the message is recombined.
6. The method of claim 5,
wherein, the obtaining all received data packets of the message according to the index information successfully matched comprises:
judging whether the total length of the received data packets in the successfully matched index information is equal to the total length of the message corresponding to the data packets or not;
and when the first data packet is equal to the second data packet, reading all the received data packets according to the storage initial address corresponding to the first data packet indicated by the storage indication information in the index information which is successfully matched.
7. The method of claim 1,
wherein, writing the initial address of the storage space applied by the other data packets into the header of the received corresponding storage space of the last data packet includes:
determining a write address of next packet address indication information in a storage space corresponding to a last received and stored data packet according to a storage start address corresponding to the last received and stored data packet indicated by storage indication information in successfully matched index information; and writing the initial address of the storage space applied by the other data packets according to the determined write address of the next packet address indication information.
8. A packet processing apparatus, comprising:
a receiving module configured to receive a data packet;
the first packet processing module is set to store a first data packet of a message and establish index information of the message when the first data packet of the message is received; the index information at least comprises the preset attribute information of the message and the storage indication information of the data packet of the message;
the subsequent packet processing module is set to match with the existing index information according to the preset attribute information of the message carried in other data packets when receiving other data packets except the first data packet of the message; when the matching is successful, applying the storage space for storing the other data packets, and writing the initial address of the storage space applied by the other data packets into the head of the received corresponding storage space of the last data packet; updating storage indication information in the index information which is successfully matched according to the initial address of the storage space applied by the other data packets;
the storage indication information at least comprises: the storage starting address corresponding to the first data packet, the storage starting address corresponding to the last data packet after the data packet is received and the total length of the received data packet;
when receiving a first data packet of a message, storing the first data packet and establishing index information of the message, including:
applying for a storage space according to the length of the first data packet and the length of preset next packet address indication information, and writing the first data packet in the applied storage space;
establishing index information of the message to which the first data packet belongs, and storing the initial address of the storage space applied by the first data packet as the storage initial address corresponding to the first data packet in the index information; storing the initial address of the storage space applied by the first data packet as the storage initial address corresponding to the received last data packet in the index information; and saving the length of the first data packet as the total length of the received data packet in the index information.
CN201911416910.7A 2019-12-31 2019-12-31 Data packet processing method and device Active CN111211990B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911416910.7A CN111211990B (en) 2019-12-31 2019-12-31 Data packet processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911416910.7A CN111211990B (en) 2019-12-31 2019-12-31 Data packet processing method and device

Publications (2)

Publication Number Publication Date
CN111211990A CN111211990A (en) 2020-05-29
CN111211990B true CN111211990B (en) 2022-09-27

Family

ID=70786502

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911416910.7A Active CN111211990B (en) 2019-12-31 2019-12-31 Data packet processing method and device

Country Status (1)

Country Link
CN (1) CN111211990B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112966166B (en) * 2021-02-07 2023-09-05 白腊梅 Method and device for generating and matching indexes of request sentences and answer sentences
CN116893987B (en) * 2023-09-11 2024-01-12 归芯科技(深圳)有限公司 Hardware acceleration method, hardware accelerator and hardware acceleration system
CN117527529B (en) * 2024-01-05 2024-03-19 平湖科谱激光科技有限公司 Ethernet data storage method and device capable of automatically recovering from normal state

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1581793A (en) * 2003-08-05 2005-02-16 华为技术有限公司 Device and method for recombining internet protocol (IP) packet
CN103501279A (en) * 2013-09-27 2014-01-08 北京旋极信息技术股份有限公司 Avionics full-duplex real-time Ethernet data package reconstitution method and system
EP3413521A1 (en) * 2016-02-03 2018-12-12 ZTE Corporation Data packet sending method, data packet receiving method, data packet sending device and data packet receiving device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1581793A (en) * 2003-08-05 2005-02-16 华为技术有限公司 Device and method for recombining internet protocol (IP) packet
CN103501279A (en) * 2013-09-27 2014-01-08 北京旋极信息技术股份有限公司 Avionics full-duplex real-time Ethernet data package reconstitution method and system
EP3413521A1 (en) * 2016-02-03 2018-12-12 ZTE Corporation Data packet sending method, data packet receiving method, data packet sending device and data packet receiving device

Also Published As

Publication number Publication date
CN111211990A (en) 2020-05-29

Similar Documents

Publication Publication Date Title
CN111211990B (en) Data packet processing method and device
WO2022078509A1 (en) Method and apparatus for encapsulating extension header of ipv6 packet
WO2017088557A1 (en) Processing method and apparatus for sending and receiving data packet
WO2008031346A1 (en) Method, apparatus and system for complex flow classification of fragmented datagrams
WO2021169235A1 (en) Method and apparatus for processing routing message, and storage medium and electronic apparatus
CN110708250A (en) Method for improving data forwarding performance, electronic equipment and storage medium
CN111740847B (en) High-speed network data transmission system and method based on FPGA
CN102035738A (en) Method and device for acquiring routing information
US20220393908A1 (en) Message Encapsulation Method and Apparatus, and Message Decapsulation Method and Apparatus
CN109525518B (en) IP message network address conversion method and device based on FPGA
CN109889312A (en) Multilink data transmission method, device and computer readable storage medium
CN114500633B (en) Data forwarding method, related device, program product and data transmission system
CN112398754B (en) Data transmission method, device, medium, electronic equipment and network access equipment
WO2018177041A1 (en) Method and apparatus for saving and recombining message fragment, and computer storage medium
US8488489B2 (en) Scalable packet-switch
CN107707548A (en) TLV message parsing methods, device, electronic equipment and storage medium
WO2023125056A1 (en) Network data control method and apparatus, and storage medium and electronic device
EP3749043A1 (en) Method and apparatus for detecting link packet loss, storage medium, and processor
WO2016101490A1 (en) Update processing method and device
CN115801927A (en) Message parsing method and device
CN115767531A (en) Bluetooth authentication method, device, electronic device and storage medium
CN114157730A (en) Message duplicate removal method and device
US20150334016A1 (en) Relay device
CN110445721B (en) Message forwarding method and device
CN113132273A (en) Data forwarding method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant