CN109246036A - A kind of method and apparatus handling fragment message - Google Patents

A kind of method and apparatus handling fragment message Download PDF

Info

Publication number
CN109246036A
CN109246036A CN201710557080.4A CN201710557080A CN109246036A CN 109246036 A CN109246036 A CN 109246036A CN 201710557080 A CN201710557080 A CN 201710557080A CN 109246036 A CN109246036 A CN 109246036A
Authority
CN
China
Prior art keywords
fragment
correct
new
tail
address
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.)
Granted
Application number
CN201710557080.4A
Other languages
Chinese (zh)
Other versions
CN109246036B (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.)
Sanechips Technology Co Ltd
Shenzhen ZTE Microelectronics Technology Co Ltd
Original Assignee
Shenzhen ZTE Microelectronics 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 Shenzhen ZTE Microelectronics Technology Co Ltd filed Critical Shenzhen ZTE Microelectronics Technology Co Ltd
Priority to CN201710557080.4A priority Critical patent/CN109246036B/en
Publication of CN109246036A publication Critical patent/CN109246036A/en
Application granted granted Critical
Publication of CN109246036B publication Critical patent/CN109246036B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/90Buffering arrangements
    • H04L49/9015Buffering arrangements for supporting a linked list

Landscapes

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

Abstract

The invention discloses a kind of method and apparatus for handling fragment message, comprising: correct queue linked list, error queue chained list is pre-created, and creates head pointer, tail pointer, empty tail pointer for each queue linked list;When there is the arrival of new fragment, address is distributed for new fragment, the address of new fragment is stored in the tail node of correct queue linked list and error queue chained list respectively, correct empty tail pointer and the empty tail pointer of mistake are respectively directed to the address of new fragment;Check whether new fragment is correct and whether new fragment is tail fragment;If correctly and being tail fragment, correct chain tail pointer is updated to the value of correct empty tail pointer, wrong void tail pointer is updated to the value of wrong chain tail pointer;If mistake, correct empty tail pointer is updated to the value of correct chain tail pointer, wrong chain tail pointer is updated to the value of wrong empty tail pointer.The present invention saves storage resource, improves message audit efficiency by creation chained list and using the method virtually joined the team.

Description

A kind of method and apparatus handling fragment message
Technical field
The present invention relates to network communication technology field more particularly to a kind of method and apparatus for handling fragment message.
Background technique
Since Ethernet is at low cost, networking flexibility and favorable expandability, IP (Internet Protocol) data are more and more Carrying over ethernet, but since payload length of the Ethernet to carrying has the upper limit of 1500 bytes (Byte), lead to IP When message passes through Ethernet, the too long message of length has to pass through fragment and recombination.
But loss, random ordering etc. may occur since the network of transmitting message can have delay or shake, fragment message Mistake, a kind of method of traditional inspection fragment mistake is one piece of biggish caching of first to file, will when the first fragment of message reaches The first fragment of message is placed in caching, as shown in Figure 1, by the position of fragment deposit caching 0, when the successive fragment of message reaches, root According to the sequence number of fragment, successively merging caches 1, caching 2 and the position for caching 3, until the tail fragment of message reaches.If fragment Message audit be it is correct, then fragment message is sent to destination, caching is emptied;If fragment message inspection is mistake, deposit The caching for storing up the fragment message of mistake is emptied.For example, when the 4th fragment reaches discovery mistake, the sky of caching 0 to caching 3 Between be released.There is congestion in output end under message emergency case in order to prevent, and the space of caching needs to consider maximum congestion amount. The shortcomings of the above method is when different types of message interleaves arrival, a kind of tail fragment of message is no all When arrival, other types of head fragment may be had arrived at, and needed to distribute one piece at this time for such first fragment and new deposited Space is stored up to check that mistake recombination is completed to it.Therefore it in the case that the message there are many type interleaves arrival, needs to be every A kind of spatial cache of message distribution M is wrong for its inspection and recombinates.If the type of message has N kind, required memory space Amount is M × N.Therefore, prior art needs to apply biggish caching, when connecting larger, it is necessary to which the storage of magnanimity is empty Between;And message audit recombination speed is slower, and the transmission rate of message data is unhappy, and when big flow easily causes congestion.
Summary of the invention
In order to solve the above-mentioned technical problems, the present invention provides a kind of method and apparatus for handling fragment message, Neng Goujie It saves storage resource, improve message audit efficiency.
In order to reach the object of the invention, the technical solution of the embodiment of the present invention is achieved in that
The embodiment of the invention provides a kind of methods for handling fragment message, comprising:
Correct queue linked list, error queue chained list and free address chained list is pre-created, is respectively used to storage and correctly divides The fragment address of the address of piece, the address of the fragment of mistake and free time;And create correct chain head pointer, correct chain tail pointer, Correct void tail pointer, mistake chain head pointer, mistake chain tail pointer and the empty tail pointer of mistake, the correct chain head pointer and wrong chain Head pointer is respectively directed to the head node of correct queue linked list and error queue chained list, and the correct chain tail pointer and wrong last-of-chain refer to Needle is respectively directed to the tail node of correct queue linked list and error queue chained list;
When there is the arrival of new fragment, it is new fragment distribution address from free address chained list, the deposit of new fragment is distributed Address, the address of new fragment is stored in the tail node of correct queue linked list and error queue chained list respectively, correct empty tail is referred to Needle and the empty tail pointer of mistake are respectively directed to the address of new fragment;
Check whether new fragment is correct and whether new fragment is tail fragment;
If new fragment is correct and new fragment is tail fragment, correct chain tail pointer is updated to the value of correct empty tail pointer, Wrong empty tail pointer is updated to the value of wrong chain tail pointer;
If new fragment mistake, correct empty tail pointer is updated to the value of correct chain tail pointer, more by wrong chain tail pointer The new value for the empty tail pointer of mistake.
Further, described to check whether new fragment is correct and whether new fragment is tail fragment, specifically includes:
Check the new fragment whether be tail fragment and the fragment number of the new fragment with the fragment number of a upper fragment whether Continuously;
If the new fragment is not that tail fragment and the fragment number of the new fragment and the fragment number of a upper fragment are continuous, Temporarily determine that the new fragment is correct and the new fragment is not tail fragment, continues to determine after waiting next new fragment to reach;
If the new fragment is not that tail fragment and the fragment number of the new fragment and the fragment number of a upper fragment are discontinuous, Then check whether the new fragment is first fragment, if it is first fragment, then reaches the new fragment of message before determining the head fragment Mistake;If not first fragment, then the new fragment mistake is determined;
If the new fragment is that tail fragment and the fragment number of the new fragment and the fragment number of a upper fragment are continuous, sentence The fixed new fragment is correct and new fragment is tail fragment;
If the new fragment is that tail fragment and the fragment number of the new fragment and the fragment number of a upper fragment are discontinuous, Determine the new fragment mistake.
It is further, described to check whether new fragment is correct and whether new fragment is tail fragment, further includes:
When determining a certain new fragment mistake, the new fragment for belonging to same reconstructed file that is reached before the new fragment or The new fragment for belonging to same reconstructed file reached after the new fragment is also determined as mistake.
Further, the method also includes:
Check whether the head fragment of the correct queue linked list is scheduled;
If the head fragment of the correct queue linked list is scheduled, described in the address deposit by the scheduled head fragment The correct chain head pointer is updated to next fragment pointed by the address of the scheduled head fragment by free address chained list Address.
Further, the method also includes:
Check whether the address of the head fragment of the error queue chained list is recovered;
If the address of the head fragment of the error queue chained list is recovered, the address of the head fragment being recovered is deposited Enter the free address chained list, under the wrong chain head pointer is updated to pointed by the address of the head fragment being recovered The address of one fragment.
The embodiment of the invention also provides a kind of devices for handling fragment message, including chained list module, distribution module, inspection Module, in which:
Chained list module is respectively used to for correct queue linked list, error queue chained list and free address chained list to be pre-created Store the address and the fragment address of free time of the address of correct fragment, the fragment of mistake;And create correct chain head pointer, just True chain tail pointer, correct empty tail pointer, mistake chain head pointer, mistake chain tail pointer and the empty tail pointer of mistake, the correct chain head Pointer and wrong chain head pointer are respectively directed to the address of the first fragment of correct queue linked list and error queue chained list, the correct chain Tail pointer and wrong chain tail pointer are respectively directed to the tail node of correct queue linked list and error queue chained list;
Distribution module, for when there is the arrival of new fragment, being new fragment distribution from the free address chained list of chained list module New fragment is stored in distributed address by address, by the address of new fragment be stored in respectively chained list module correct queue linked list and Correct empty tail pointer and the empty tail pointer of mistake are respectively directed to the address of new fragment, notice inspection by the tail node of error queue chained list Look into module;
It checks module, for receiving the notice of distribution module, checks whether new fragment is correct and whether new fragment is tail Fragment;If new fragment is correct and new fragment is tail fragment, correct chain tail pointer is updated to the value of correct empty tail pointer, it will be wrong Accidentally empty tail pointer is updated to the value of wrong chain tail pointer;If new fragment mistake, correct empty tail pointer is updated to correct last-of-chain Wrong chain tail pointer is updated to the value of wrong empty tail pointer by the value of pointer.
Further, whether the new fragment of the inspection module check is correct and whether new fragment is tail fragment, specifically includes:
Check the new fragment whether be tail fragment and the fragment number of the new fragment with the fragment number of a upper fragment whether Continuously;
If the new fragment is not that tail fragment and the fragment number of the new fragment and the fragment number of a upper fragment are continuous, Temporarily determine that the new fragment is correct and the new fragment is not tail fragment, continues to determine after waiting next new fragment to reach;
If the new fragment is not that tail fragment and the fragment number of the new fragment and the fragment number of a upper fragment are discontinuous, Then check whether the new fragment is first fragment, if it is first fragment, then reaches the new fragment of message before determining the head fragment Mistake;If not first fragment, then the new fragment mistake is determined;
If the new fragment is that tail fragment and the fragment number of the new fragment and the fragment number of a upper fragment are continuous, sentence The fixed new fragment is correct and new fragment is tail fragment;
If the new fragment is that tail fragment and the fragment number of the new fragment and the fragment number of a upper fragment are discontinuous, Determine the new fragment mistake.
Further, when the inspection module determines a certain new fragment mistake, what is reached before the new fragment belongs to The new fragment of same reconstructed file or the new fragment for belonging to same reconstructed file reached after the new fragment are also determined as mistake Accidentally.
Further, the inspection module is also used to:
Check whether the head fragment of the correct queue linked list is scheduled;
If the head fragment of the correct queue linked list is scheduled, described in the address deposit by the scheduled head fragment The correct chain head pointer is updated to next fragment pointed by the address of the scheduled head fragment by free address chained list Address.
Further, the inspection module is also used to:
Check whether the address of the head fragment of the error queue chained list is recovered;
If the address of the head fragment of the error queue chained list is recovered, the address of the head fragment being recovered is deposited Enter the free address chained list, under the wrong chain head pointer is updated to pointed by the address of the head fragment being recovered The address of one fragment.
Technical solution of the present invention has the following beneficial effects:
The method and apparatus of processing fragment message provided by the invention, by creating correct queue linked list and virtual queue chain Table, and head pointer, tail pointer and virtual tail pointer are set for each queue linked list and enable fragment virtually join the team before message audit; After message audit, fragment is enabled really to join the team, save storage resource, improve message audit efficiency, after accelerating recombination Scheduling rates, and quickly empty away the message of mistake from caching, reduce the holding time of invalid cache, to mention The high transmission rate of message data, reduces congestion when big flow;And individual queue is mutually indepedent, increases queue scheduling Diversity.
Detailed description of the invention
The drawings described herein are used to provide a further understanding of the present invention, constitutes part of this application, this hair Bright illustrative embodiments and their description are used to explain the present invention, and are not constituted improper limitations of the present invention.In the accompanying drawings:
Fig. 1 is the buffer structure schematic diagram of the method for existing processing fragment message;
Fig. 2 is a kind of flow diagram of the method for processing fragment message of the embodiment of the present invention;
Fig. 3 is a kind of structural schematic diagram of the device of processing fragment message of the embodiment of the present invention;
Fig. 4 is the flow diagram of the fragment message inspection of the preferred embodiment of the present invention;
Fig. 5 is the structural schematic diagram of the correct queue linked list of the preferred embodiment of the present invention;
Fig. 6 is the correct queue linked list of the preferred embodiment of the present invention or the storage organization schematic diagram of error queue chained list;
Fig. 7 be in Fig. 5 first fragment it is scheduled go out team when correct queue linked list structural schematic diagram;
Fig. 8 is the structural schematic diagram of correct queue linked list when having correct non-tail fragment c to reach in Fig. 5;
Fig. 9 is the structural schematic diagram of correct queue linked list when vicious fragment c is reached in Fig. 5;
Figure 10 is the structural schematic diagram of correct queue linked list when having correct tail fragment c arrival in Fig. 5;
Figure 11 is the structural schematic diagram of the error queue chained list of the preferred embodiment of the present invention;
Figure 12 is the structural schematic diagram of error queue chained list when first fragment address is recovered out team in Figure 11;
Figure 13 is the structural schematic diagram of error queue chained list when having correct non-tail fragment c to reach in Figure 11;
Figure 14 is the structural schematic diagram of error queue chained list when having correct tail fragment c arrival in Figure 11;
Figure 15 is the structural schematic diagram of error queue chained list when vicious fragment c is reached in Figure 11.
Specific embodiment
To make the objectives, technical solutions, and advantages of the present invention clearer, below in conjunction with attached drawing to the present invention Embodiment be described in detail.It should be noted that in the absence of conflict, in the embodiment and embodiment in the application Feature can mutual any combination.
As shown in Fig. 2, a kind of method for handling fragment message according to the present invention, includes the following steps:
Step 201: correct queue linked list, error queue chained list and free address chained list, the correct queue is pre-created Chained list, error queue chained list and free address chained list be respectively used to store the address of correct fragment, mistake fragment address And idle fragment address;And correct chain head pointer, correct chain tail pointer, correct empty tail are created for every correct queue linked list Pointer is that every error queue chained list creates wrong chain head pointer, mistake chain tail pointer and the empty tail pointer of mistake, the correct chain Head pointer and wrong chain head pointer are respectively directed to the address of the first fragment of correct queue linked list and error queue chained list, described correct Chain tail pointer and wrong chain tail pointer are respectively directed to the tail node of correct queue linked list and error queue chained list;
Further, it is natural number according to the number of types N, the N of message, the correct queue linked list of N item and N item is pre-created Error queue chained list.
Step 202: when there is the arrival of new fragment, being that new fragment distributes an address from free address chained list, simultaneously will New fragment is stored in distributed address, and the address of new fragment is stored in the periproct of correct queue linked list and error queue chained list respectively Correct empty tail pointer and the empty tail pointer of mistake are respectively directed to the address of new fragment by point;
Further, according to the fragment type of the new fragment, the address of the new fragment is stored in corresponding report respectively The correct queue linked list of literary type and the tail node of error queue chained list.
It is worth noting that each fragment carries fragment type (TYPE), fragment number when fragment reaches downlink side (SEQ), the information such as first fragment mark (SOP) and tail fragment mark (EOP), as shown in table 1.
Fragment carries information Explanation
Fragment type TYPE Type of message
Fragment SEQ If a message is cut into n piece, fragment range is 0~(n-1).
First fragment mark SOP It is effective when being 1, indicate that the fragment is the first fragment of a message.
Tail fragment mark EOP It is effective when being 1, indicate that the fragment is the tail fragment of a message.
Table 1
It should be noted that the address of new fragment is stored in just simultaneously before carrying out message audit to this new fragment In the tail node of true queue linked list and error queue chained list, the value of correct chain tail pointer and wrong chain tail pointer is not updated at this time, I.e. correct chain tail pointer still points to the tail node that inspected in correct queue linked list is correct message at this time, and mistake last-of-chain refers to Needle still points to the tail node for the message that inspected in error queue chained list is mistake.
Step 203: checking whether new fragment is correct and whether new fragment is tail fragment;
If new fragment is correct and new fragment is tail fragment, correct chain tail pointer is updated to the value of correct empty tail pointer, Wrong empty tail pointer is updated to the value of wrong chain tail pointer;
If new fragment mistake, correct empty tail pointer is updated to the value of correct chain tail pointer, more by wrong chain tail pointer The new value for the empty tail pointer of mistake.
Further, if new fragment is correct and new fragment is not tail fragment, the arrival of next fragment is waited, step is gone to Rapid 202.
It should be noted that correct chain tail pointer to be updated to the value of correct empty tail pointer, wrong empty tail pointer is updated It is by inspected for correctly newly the address of fragment is stored in correct queue linked list for the value of wrong chain tail pointer, and will Inspected is that the address of correctly new fragment is deleted from error queue chained list;Correct empty tail pointer is updated to correct last-of-chain to refer to Wrong chain tail pointer is updated to the value of wrong empty tail pointer by the value of needle, is by the address for the new fragment that inspected is mistake It is stored in error queue chained list, and the address for the new fragment that inspected is mistake is deleted from correct queue linked list.
Further, described to check whether new fragment is correct and whether new fragment is tail fragment, specifically includes:
Check the new fragment whether be tail fragment and the fragment number of the new fragment with the fragment number of a upper fragment whether Continuously;
If the new fragment is not that tail fragment and the fragment number of the new fragment and the fragment number of a upper fragment are continuous, Temporarily determine that the new fragment is correct and the new fragment is not tail fragment, continues to determine after waiting next new fragment to reach;
If the new fragment is not that tail fragment and the fragment number of the new fragment and the fragment number of a upper fragment are discontinuous, Then check whether the new fragment is first fragment, if it is first fragment, then reaches the new fragment of message before determining the head fragment Mistake;If not first fragment, then the new fragment mistake is determined;
If the new fragment is that tail fragment and the fragment number of the new fragment and the fragment number of a upper fragment are continuous, sentence The fixed new fragment is correct and new fragment is tail fragment;
If the new fragment is that tail fragment and the fragment number of the new fragment and the fragment number of a upper fragment are discontinuous, Determine the new fragment mistake.
It should be noted that is reached before the new fragment belongs to same recombination when determining a certain new fragment mistake The new fragment of message or the new fragment for belonging to same reconstructed file reached after the new fragment are also determined as mistake.
Further, the method also includes:
Check whether the head fragment of correct queue linked list is scheduled;
If the head fragment of correct queue linked list is scheduled, the address of scheduled head fragment is stored in free address chain Correct chain head pointer is updated to the address of next fragment pointed by the address of scheduled head fragment by table.
Further, the method also includes:
Check whether the address of the head fragment of error queue chained list is recovered;
If the address of the head fragment of error queue chained list is recovered, idly by the address deposit for the head fragment being recovered Location chained list, the address of next fragment pointed by the address for the head fragment that wrong chain head pointer is updated to be recovered.
As shown in figure 3, a kind of device for handling fragment message according to the present invention, including chained list module, distribution module, inspection Look into module, in which:
Chained list module is described correct for correct queue linked list, error queue chained list and free address chained list to be pre-created Queue linked list, error queue chained list and free address chained list are respectively used to store the fragment of the address of correct fragment, mistake Address and the fragment address of free time;And correct chain head pointer, correct chain tail pointer, correctly are created for every correct queue linked list Empty tail pointer is that every error queue chained list creates wrong chain head pointer, mistake chain tail pointer and the empty tail pointer of mistake, it is described just True chain head pointer and wrong chain head pointer are respectively directed to the address of the first fragment of correct queue linked list and error queue chained list, described Correct chain tail pointer and wrong chain tail pointer are respectively directed to the tail node of correct queue linked list and error queue chained list;
Distribution module, for when there is the arrival of new fragment, being new fragment distribution from the free address chained list of chained list module One address, while new fragment being stored in distributed address, the address of new fragment is stored in the correct team of chained list module respectively Correct empty tail pointer and the empty tail pointer of mistake are respectively directed to the ground of new fragment by the tail node of column chained list and error queue chained list Location, notice check module;
It checks module, for receiving the notice of distribution module, checks whether new fragment is correct and whether new fragment is tail Fragment;If new fragment is correct and new fragment is tail fragment, correct chain tail pointer is updated to the value of correct empty tail pointer, it will be wrong Accidentally empty tail pointer is updated to the value of wrong chain tail pointer;If new fragment mistake, correct empty tail pointer is updated to correct last-of-chain Wrong chain tail pointer is updated to the value of wrong empty tail pointer by the value of pointer.
Further, the chained list module is natural number according to the number of types N, the N of message, and it is correct that N item is pre-created Queue linked list and N error queue chained list;
The address of the new fragment is stored in corresponding by the distribution module respectively according to the fragment type of the new fragment The correct queue linked list of type of message and the tail node of error queue chained list.
It is worth noting that each fragment carries fragment type (TYPE), fragment number when fragment reaches downlink side (SEQ), the information such as first fragment mark (SOP) and tail fragment mark (EOP), as shown in table 1.
It should be noted that the address of new fragment stores simultaneously before checking that module carries out message audit to new fragment In the tail node of correct queue linked list and error queue chained list, correct chain tail pointer and wrong chain tail pointer are not updated at this time Value, i.e., correct chain tail pointer still points to the tail node that inspected in correct queue linked list is correct message, mistake chain at this time Tail pointer still points to the tail node for the message that inspected in error queue chained list is mistake.
Further, whether the new fragment of the inspection module check is correct and when whether new fragment is tail fragment, if newly Fragment is correct and new fragment is not tail fragment, then waits the arrival of next fragment.
It should be noted that the value for checking module and correct chain tail pointer being updated to correct empty tail pointer, by mistake Empty tail pointer is updated to the value of wrong chain tail pointer, is that the address that inspected is correctly new fragment is stored in correct queue In chained list, and the address that inspected is correctly new fragment is deleted from error queue chained list;Correct empty tail pointer is updated For the value of correct last-of-chain pointer, wrong chain tail pointer is updated to the value of wrong empty tail pointer, be by inspected is wrong The address of new fragment is stored in error queue chained list, and by the address for the new fragment that inspected is mistake from correct queue linked list Middle deletion.
Further, whether the new fragment of the inspection module check is correct and whether new fragment is tail fragment, specifically includes:
Check the new fragment whether be tail fragment and the fragment number of the new fragment with the fragment number of a upper fragment whether Continuously;
If the new fragment is not that tail fragment and the fragment number of the new fragment and the fragment number of a upper fragment are continuous, Temporarily determine that the new fragment is correct and the new fragment is not tail fragment, continues to determine after waiting next new fragment to reach;
If the new fragment is not that tail fragment and the fragment number of the new fragment and the fragment number of a upper fragment are discontinuous, Then check whether the new fragment is first fragment, if it is first fragment, then reaches the new fragment of message before determining the head fragment Mistake;If not first fragment, then the new fragment mistake is determined;
If the new fragment is that tail fragment and the fragment number of the new fragment and the fragment number of a upper fragment are continuous, sentence The fixed new fragment is correct and new fragment is tail fragment;
If the new fragment is that tail fragment and the fragment number of the new fragment and the fragment number of a upper fragment are discontinuous, Determine the new fragment mistake.
It should be noted that is reached before the new fragment belongs to when checking that module determines a certain new fragment mistake The new fragment of same reconstructed file or the new fragment for belonging to same reconstructed file reached after the new fragment are also determined as mistake Accidentally.
Further, the inspection module is also used to:
Check whether the head fragment of correct queue linked list is scheduled;
If the head fragment of correct queue linked list is scheduled, the address of scheduled head fragment is stored in free address chain Correct chain head pointer is updated to the address of next fragment pointed by the address of scheduled head fragment by table.
Further, the inspection module is also used to:
Check whether the address of the head fragment of error queue chained list is recovered;
If the address of the head fragment of error queue chained list is recovered, idly by the address deposit for the head fragment being recovered Location chained list, the address of next fragment pointed by the address for the head fragment that wrong chain head pointer is updated to be recovered.
Below by way of a preferred embodiment, the method and apparatus using processing fragment message of the invention are illustrated how. It is worth noting that, preferred embodiment below is intended merely to preferably describe the present invention, do not constitute to the present invention improperly It limits.
It is natural number according to the number of types N, the N of message, the correct queue linked list of N item, N error queue chain is pre-created Table and a free address chained list, the correct queue linked list, error queue chained list and free address chained list are respectively used to store The correctly address of fragment, the address of the fragment of mistake and the fragment address of free time;It and is every correct queue linked list creation Correct chain head pointer, correct chain tail pointer, correct empty tail pointer are that every error queue chained list creates wrong chain head pointer, mistake Accidentally chain tail pointer and the empty tail pointer of mistake, the correct chain head pointer and wrong chain head pointer be respectively directed to correct queue linked list and The address of the first fragment of error queue chained list, the correct chain tail pointer and wrong chain tail pointer are respectively directed to correct queue linked list With the tail node of error queue chained list;
It is that new fragment distributes an address, while new fragment being deposited from free address chained list when there is the arrival of new fragment Enter distributed address, the address of new fragment is stored in the tail node of correct queue linked list and error queue chained list respectively, it will just The address that really void tail pointer and mistake void tail pointer are respectively directed to new fragment (can determine that the corresponding message of new fragment is correct Before message either error message, fragment address is stored in the correct queue and error queue of Queue module simultaneously);
It is checked whether according to the information carried in heading as correct fragment, if message is checked as correctly, message It is just only stored in correct queue, wait scheduler module goes out team's scheduling, and out after team's scheduling, the address of fragment is recovered;If Message is checked as mistake, and message is just only stored in error queue, and fragmented address is waited to be recovered.Specific message inspection It is as shown in Figure 4 to look into process, comprising:
Step 401: checking whether newly arrived fragment is tail fragment, i.e. tail fragment mark (EOP) in inspection heading It whether is 1;If not tail fragment, step 402 is gone to;If it is tail fragment, step 407 is gone to;
Step 402: checking whether fragment number (SEQ) be correct, i.e. whether fragment number and the fragment number of a upper fragment be continuous, such as Fruit is continuous, goes to step 403;If discontinuous, step 404 is gone to;
Step 403: determining that this message is recombinating, by this fragment " virtually joining the team ", continue waiting for next fragment and reach;
Step 404: checking whether the newly arrived fragment is first fragment, i.e. first fragment mark in inspection heading It (SOP) whether is 1;If it is first fragment, step 405 is gone to;If not first fragment, step 406 is gone to;
Step 405: determine that the certain fragments of last message have been lost, i.e., all fragment mistakes of a upper message, this The message of newly arrived fragment continues waiting for the arrival of next fragment;
Step 406: determining that mistake occurs for this message;
Step 407: checking whether fragment number is correct;If correct, step 408 is gone to;If mistake goes to step 409;
Step 408: determining that this message is a correct message, be placed in queue, team is dispatched out in waiting;
Step 409: determining this message for error message, the fragment of this message of the fragment and subsequent arrival that arrived will be by All abandon.
As shown in Fig. 5 to Figure 15, the present invention completes the recombination of correct message and losing for error message by " virtually joining the team " It abandons.Each correct queue linked list and error queue chained list by a linked list head, chained list tail and virtual linked list tail register group at, All one piece of random access memory of queue sharing (Random Access Memory, RAM).
As shown in figure 5, the linked list head record of correct queue linked list be queue head fragment address, chained list tail record is The fragment address for message the last one fragment really joined the team is to be checked as correctly between linked list head and chained list tail The fragment address of message.Wherein, storage of the fragment in RAM is the address of a upper fragment using in queue as storage address chain It picks up and, as shown in fig. 6, RAM can be read by the address of fragment 2, read the address that content is fragment 3.
The virtual linked list tail record of correct queue linked list is the message all joined the team (including the message recombinated) Queue the last one fragment fragment address.Message between chained list tail and virtual linked list tail is that part fragment does not reach The fragment address of the message recombinated, this part fragment address belong to " virtually joining the team ", if queue is really added It will be by whether the inspection of whole packet correctly determines.
As shown in fig. 7, fragment 1, due to the team that is scheduled, the content in the linked list head register of correct queue linked list needs It is updated to next register that former chained list head pointer fragment 1 is directed toward, i.e., reads the fragment 2 stored in RAM with the address of fragment 1 Address is updated to new linked list head.
As shown in figure 8, checking that correctly non-tail fragment c is reached, then by fragment c chain behind fragment b, by fragment c's The storage address of address write-in fragment b.
As shown in figure 9, checking that the fragment c of mistake is reached, then it can determine that this message is mistake, need to abandon, then it will be virtual The content update of chained list tail is consistent with chained list tail.
As shown in Figure 10, tail fragment c is reached and is checked that correctly then all fragments of this message have been all arrived at and have been positive Chained list tail register and virtual linked list tail register are updated to the address of tail fragment c by true message, and the address of fragment c is written The content of the address of fragment b.
As shown in figure 11, what is retained in error queue chained list is the fragment of error message, this part fragment is once confirmed as The address of mistake, these fragments will be recovered.The linked list head register record of error queue chained list is error message queue The address of first fragment, chained list tail register record is the last one fragment for having been identified as the queue of message of mistake Fragment address is the fragment address for being confirmed to be the message of mistake between linked list head and chained list tail.
The virtual linked list tail record of error queue chained list is the message all joined the team (including the message recombinated) The fragment address of the last one fragment of queue, the message between chained list tail and virtual linked list tail are that part fragment does not reach just The fragment address of message in recombination.
As shown in figure 12, fragment 1 is updated to next link due to recycling scheduled team, the linked list head of error queue chained list out Address: the address of fragment 2, mode are reading RAM content using fragment 1 as read address.
As shown in figure 13, check that correctly non-tail fragment c is reached, then it represents that this message is recombinating, and fragment c chain is being divided Behind piece b, virtual linked list tail register is updated to the address of fragment c.
As shown in figure 14, check that correct tail fragment c is reached, then entire message is emptied from error queue --- it will be virtual The content update of chained list tail register is consistent with chained list tail register.
As shown in figure 15, it checks that the fragment of mistake reaches, then shows that this message is error message.By the address chain of fragment c Behind fragment b, virtual linked list tail and chained list tail register are updated to the address of fragment c.
The method and apparatus of processing fragment message provided by the invention, by creating correct queue linked list and virtual queue chain Table, and head pointer, tail pointer and virtual tail pointer are set for each queue linked list and enable fragment virtually join the team before message audit; After message audit, fragment is enabled really to join the team, save storage resource, improve message audit efficiency, after accelerating recombination Scheduling rates, and quickly empty away the message of mistake from caching, reduce the holding time of invalid cache, to mention The high transmission rate of message data, reduces congestion when big flow;And individual queue is mutually indepedent, increases queue scheduling Diversity.
Those of ordinary skill in the art will appreciate that all or part of the steps in the above method can be instructed by program Related hardware is completed, and described program can store in computer readable storage medium, such as read-only memory, disk or CD Deng.Optionally, one or more integrated circuits also can be used to realize, accordingly in all or part of the steps of above-described embodiment Ground, each module/unit in above-described embodiment can take the form of hardware realization, can also use the shape of software function module Formula is realized.The present invention is not limited to the combinations of the hardware and software of any particular form.
The foregoing is only a preferred embodiment of the present invention, is not intended to restrict the invention, for the skill of this field For art personnel, the invention may be variously modified and varied.All within the spirits and principles of the present invention, made any to repair Change, equivalent replacement, improvement etc., should all be included in the protection scope of the present invention.

Claims (10)

1. a kind of method for handling fragment message characterized by comprising
Correct queue linked list, error queue chained list and free address chained list is pre-created, is respectively used to store correct fragment Address, mistake fragment address and free time fragment address;And create correct chain head pointer, correct chain tail pointer, correct Empty tail pointer, mistake chain head pointer, mistake chain tail pointer and the empty tail pointer of mistake, the correct chain head pointer and wrong chain head refer to Needle is respectively directed to the head node of correct queue linked list and error queue chained list, the correct chain tail pointer and wrong chain tail pointer point It is not directed toward the tail node of correct queue linked list and error queue chained list;
When there is the arrival of new fragment, it is new fragment distribution address from free address chained list, new fragment is stored in distributed ground The address of new fragment, is stored in the tail node of correct queue linked list and error queue chained list by location respectively, will correct empty tail pointer and Mistake void tail pointer is respectively directed to the address of new fragment;
Check whether new fragment is correct and whether new fragment is tail fragment;
If new fragment is correct and new fragment is tail fragment, correct chain tail pointer is updated to the value of correct empty tail pointer, it will be wrong Accidentally empty tail pointer is updated to the value of wrong chain tail pointer;
If new fragment mistake, correct empty tail pointer is updated to the value of correct chain tail pointer, wrong chain tail pointer is updated to The value of mistake void tail pointer.
2. the method according to claim 1, wherein it is described check whether new fragment correct and new fragment whether be Tail fragment, specifically includes:
Check whether the new fragment is whether tail fragment and the fragment number of the new fragment and the fragment number of a upper fragment are continuous;
If the new fragment is not that tail fragment and the fragment number of the new fragment and the fragment number of a upper fragment are continuous, temporarily Determine that the new fragment is correct and the new fragment is not tail fragment, continues to determine after waiting next new fragment to reach;
If the new fragment is not that tail fragment and the fragment number of the new fragment and the fragment number of a upper fragment are discontinuous, examine Look into whether the new fragment is first fragment, if it is first fragment, then reaches the new fragment mistake of message before determining the head fragment; If not first fragment, then the new fragment mistake is determined;
If the new fragment is that tail fragment and the fragment number of the new fragment and the fragment number of a upper fragment are continuous, institute is determined State that new fragment is correct and new fragment is tail fragment;
If the new fragment is that tail fragment and the fragment number of the new fragment and the fragment number of a upper fragment are discontinuous, determine The new fragment mistake.
3. according to the method described in claim 2, it is characterized in that, it is described check whether new fragment correct and new fragment whether be Tail fragment, further includes:
When determining a certain new fragment mistake, the new fragment for belonging to same reconstructed file that is reached before the new fragment or at this The new fragment for belonging to same reconstructed file reached after new fragment is also determined as mistake.
4. the method according to claim 1, wherein the method also includes:
Check whether the head fragment of the correct queue linked list is scheduled;
If the head fragment of the correct queue linked list is scheduled, the address of the scheduled head fragment is stored in the free time The correct chain head pointer is updated to the ground of next fragment pointed by the address of the scheduled head fragment by address link list Location.
5. the method according to claim 1, wherein the method also includes:
Check whether the address of the head fragment of the error queue chained list is recovered;
If the address of the head fragment of the error queue chained list is recovered, the address of the head fragment being recovered is stored in institute Free address chained list is stated, the wrong chain head pointer is updated to pointed by the address of the head fragment being recovered next point The address of piece.
6. a kind of device for handling fragment message, which is characterized in that including chained list module, distribution module, check module, in which:
Chained list module is respectively used to store for correct queue linked list, error queue chained list and free address chained list to be pre-created The correctly address of fragment, the address of the fragment of mistake and the fragment address of free time;And create correct chain head pointer, correct chain Tail pointer, correct empty tail pointer, mistake chain head pointer, mistake chain tail pointer and the empty tail pointer of mistake, the correct chain head pointer The address of the first fragment of correct queue linked list and error queue chained list is respectively directed to wrong chain head pointer, the correct last-of-chain refers to Needle and wrong chain tail pointer are respectively directed to the tail node of correct queue linked list and error queue chained list;
Distribution module, for when there is the arrival of new fragment, being new fragment distribution address from the free address chained list of chained list module, New fragment is stored in distributed address, the address of new fragment is stored in correct queue linked list and the mistake team of chained list module respectively Correct empty tail pointer and the empty tail pointer of mistake, are respectively directed to the address of new fragment by the tail node of column chained list, and notice checks module;
It checks module, for receiving the notice of distribution module, checks whether new fragment is correct and whether new fragment is tail fragment; If new fragment is correct and new fragment is tail fragment, correct chain tail pointer is updated to the value of correct empty tail pointer, will mistake it is empty Tail pointer is updated to the value of wrong chain tail pointer;If new fragment mistake, correct empty tail pointer is updated to correct chain tail pointer Value, wrong chain tail pointer is updated to the value of wrong empty tail pointer.
7. device according to claim 6, which is characterized in that whether correct and new point of the new fragment of the inspection module check Whether piece is tail fragment, is specifically included:
Check whether the new fragment is whether tail fragment and the fragment number of the new fragment and the fragment number of a upper fragment are continuous;
If the new fragment is not that tail fragment and the fragment number of the new fragment and the fragment number of a upper fragment are continuous, temporarily Determine that the new fragment is correct and the new fragment is not tail fragment, continues to determine after waiting next new fragment to reach;
If the new fragment is not that tail fragment and the fragment number of the new fragment and the fragment number of a upper fragment are discontinuous, examine Look into whether the new fragment is first fragment, if it is first fragment, then reaches the new fragment mistake of message before determining the head fragment; If not first fragment, then the new fragment mistake is determined;
If the new fragment is that tail fragment and the fragment number of the new fragment and the fragment number of a upper fragment are continuous, institute is determined State that new fragment is correct and new fragment is tail fragment;
If the new fragment is that tail fragment and the fragment number of the new fragment and the fragment number of a upper fragment are discontinuous, determine The new fragment mistake.
8. device according to claim 7, which is characterized in that when the inspection module determines a certain new fragment mistake, The new fragment for belonging to same reconstructed file reached before the new fragment or belonging to of reaching after the new fragment are same heavy The new fragment of group message is also determined as mistake.
9. device according to claim 6, which is characterized in that the inspection module is also used to:
Check whether the head fragment of the correct queue linked list is scheduled;
If the head fragment of the correct queue linked list is scheduled, the address of the scheduled head fragment is stored in the free time The correct chain head pointer is updated to the ground of next fragment pointed by the address of the scheduled head fragment by address link list Location.
10. device according to claim 6, which is characterized in that the inspection module is also used to:
Check whether the address of the head fragment of the error queue chained list is recovered;
If the address of the head fragment of the error queue chained list is recovered, the address of the head fragment being recovered is stored in institute Free address chained list is stated, the wrong chain head pointer is updated to pointed by the address of the head fragment being recovered next point The address of piece.
CN201710557080.4A 2017-07-10 2017-07-10 Method and device for processing fragment message Active CN109246036B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710557080.4A CN109246036B (en) 2017-07-10 2017-07-10 Method and device for processing fragment message

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710557080.4A CN109246036B (en) 2017-07-10 2017-07-10 Method and device for processing fragment message

Publications (2)

Publication Number Publication Date
CN109246036A true CN109246036A (en) 2019-01-18
CN109246036B CN109246036B (en) 2021-02-09

Family

ID=65083465

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710557080.4A Active CN109246036B (en) 2017-07-10 2017-07-10 Method and device for processing fragment message

Country Status (1)

Country Link
CN (1) CN109246036B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111352781A (en) * 2020-02-28 2020-06-30 天津飞腾信息技术有限公司 Automatic message comparison correctness checking method and device for retransmission component module level verification
CN112433884A (en) * 2020-11-12 2021-03-02 苏州长风航空电子有限公司 Double-backup cross storage method for preventing power failure data damage during writing
CN112600764A (en) * 2020-12-07 2021-04-02 盛科网络(苏州)有限公司 Scheduling method, device and storage medium of cut-through forwarding mode
CN113259715A (en) * 2021-05-07 2021-08-13 广州小鹏汽车科技有限公司 Method and device for processing multi-channel video data, electronic equipment and medium
CN115190089A (en) * 2022-05-26 2022-10-14 中科驭数(北京)科技有限公司 Message storage method, device, equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20050117513A1 (en) * 2003-11-28 2005-06-02 Park Jeong S. Flow generation method for internet traffic measurement
US6910092B2 (en) * 2001-12-10 2005-06-21 International Business Machines Corporation Chip to chip interface for interconnecting chips
CN101022411A (en) * 2007-03-07 2007-08-22 华为技术有限公司 Multi-link binding protocol message zone receiving method
CN101594201A (en) * 2009-05-20 2009-12-02 清华大学 The method of integrally filtering error data in linked queue management structure
CN101676906A (en) * 2008-09-18 2010-03-24 中兴通讯股份有限公司 Method of managing memory database space by using bitmap

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6910092B2 (en) * 2001-12-10 2005-06-21 International Business Machines Corporation Chip to chip interface for interconnecting chips
US20050117513A1 (en) * 2003-11-28 2005-06-02 Park Jeong S. Flow generation method for internet traffic measurement
CN101022411A (en) * 2007-03-07 2007-08-22 华为技术有限公司 Multi-link binding protocol message zone receiving method
CN101676906A (en) * 2008-09-18 2010-03-24 中兴通讯股份有限公司 Method of managing memory database space by using bitmap
CN101594201A (en) * 2009-05-20 2009-12-02 清华大学 The method of integrally filtering error data in linked queue management structure

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111352781A (en) * 2020-02-28 2020-06-30 天津飞腾信息技术有限公司 Automatic message comparison correctness checking method and device for retransmission component module level verification
CN112433884A (en) * 2020-11-12 2021-03-02 苏州长风航空电子有限公司 Double-backup cross storage method for preventing power failure data damage during writing
CN112433884B (en) * 2020-11-12 2022-10-21 苏州长风航空电子有限公司 Double-backup cross storage method for preventing power failure data damage during writing
CN112600764A (en) * 2020-12-07 2021-04-02 盛科网络(苏州)有限公司 Scheduling method, device and storage medium of cut-through forwarding mode
CN112600764B (en) * 2020-12-07 2022-04-15 苏州盛科通信股份有限公司 Scheduling method, device and storage medium of cut-through forwarding mode
WO2022121808A1 (en) * 2020-12-07 2022-06-16 苏州盛科通信股份有限公司 Direct forwarding mode scheduling method and device, and storage medium
CN113259715A (en) * 2021-05-07 2021-08-13 广州小鹏汽车科技有限公司 Method and device for processing multi-channel video data, electronic equipment and medium
CN115190089A (en) * 2022-05-26 2022-10-14 中科驭数(北京)科技有限公司 Message storage method, device, equipment and storage medium
CN115190089B (en) * 2022-05-26 2024-03-22 中科驭数(北京)科技有限公司 Message storage method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN109246036B (en) 2021-02-09

Similar Documents

Publication Publication Date Title
CN109246036A (en) A kind of method and apparatus handling fragment message
US7813342B2 (en) Method and apparatus for writing network packets into computer memory
US7966281B2 (en) Management of storage and retrieval of data labels in random access memory
KR101407743B1 (en) Method for processing data packets in flow-aware network nodes
JP3777161B2 (en) Efficient processing of multicast transmission
US9081742B2 (en) Network communications processor architecture
CN103946803B (en) The processor queued up with efficient operation
US8761204B2 (en) Packet assembly module for multi-core, multi-thread network processors
US8873550B2 (en) Task queuing in a multi-flow network processor architecture
CN100571195C (en) Multiport Ethernet switch and data transmission method
WO2012162949A1 (en) Packet reassembly and resequence method, apparatus and system
TW201703475A (en) Method and apparatus for using multiple linked memory lists
CN106059957A (en) Flow table rapid searching method and system under high-concurrency network environment
CN111211990B (en) Data packet processing method and device
CN100589477C (en) Method for realizing data sending based on binding link
CN114584560A (en) Fragmented frame recombination method and device
CN105933325A (en) Kernel mode RPC (Remote Procedure CALL) communication acceleration method based on NFSoRDMA (Network File System over Remote Direct Memory Access)
CN110519180A (en) Network card virtualization queue scheduling method and system
CN106533976A (en) Data packet processing method and device
CN101594201A (en) The method of integrally filtering error data in linked queue management structure
WO2023142605A1 (en) Blockchain-based data processing method and related apparatus
CN106372013B (en) Long-distance inner access method, device and system
US8594101B2 (en) Packet relay apparatus and packet relay method
US9703739B2 (en) Return available PPI credits command
US9338219B2 (en) Direct push operations and gather operations

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