Summary of the invention
The technical problem to be solved in the present invention is at problems of the prior art and defective, a kind of high speed router traffic management chip storage of linked list management method and system are provided, can realize read operation flowing water, hide read latency, improve message processing speed chained list node.
For this reason, the present invention has adopted following technical scheme:
A kind of high speed router traffic management chip storage of linked list management method comprises the steps:
For M queue linked list set up in each message queue, and described queue linked list is stored in the plug-in buffer memory; M is more than or equal to N/K, and M is integer, and wherein N is the time-delay of reading of described plug-in buffer memory, and k is the time that a chained list node is handled in the requirement of traffic management chip;
When message is joined the team, the chained list node of this message is left in described M the queue linked list of its correspondence;
When message goes out group, from M queue linked list of this message, find corresponding chained list node, and read corresponding message data according to this chained list node.
Further, described plug-in buffer memory refers to the QDR buffer memory.
Further, the value of M satisfies: if N/K is an integer, then M equals N/K, if N/K is not an integer, then M equals N/K+1.
Further, described when message is joined the team, the chained list node of this message is left in described M the queue linked list of its correspondence, specifically comprise:
When a message is joined the team, find described M queue linked list of its correspondence according to the queue number of message, and, judge what chained list nodes this message needs according to the length of message;
With the chained list node applied for adding in the described M queue linked list of poll successively, upgrade the tail node pointer value of a described M queue linked list successively.
Further, described when message goes out group, from M queue linked list of this message, find corresponding chained list node, and read corresponding message data according to this chained list node, specifically comprise:
When message goes out group, according to the queue number that goes out team, read the first node pointer numerical value of described M queue linked list of its correspondence successively, first node corresponding memory space data are read, obtain chained list node, and read corresponding message data according to chained list node;
Upgrade the first node pointer numerical value of every queue linked list after reading numerical value, and the node of this free time address correspondence is added to the afterbody of idle chained list.
A kind of high speed router traffic management chip storage of linked list management system comprises that queue linked list sets up join the team administration module and message of module, message and go out group administration module;
Wherein, described queue linked list is set up module and is used for, and for M queue linked list set up in each message queue, and described queue linked list is stored in the plug-in buffer memory; M is more than or equal to N/K, and M is integer, and wherein N is the time-delay of reading of described plug-in buffer memory, and k is the time that a chained list node is handled in the requirement of traffic management chip;
The described message administration module of joining the team is used for, and when message is joined the team, the chained list node of this message is left in described M the queue linked list of its correspondence;
Described message goes out group administration module and is used for, and when message goes out group, finds corresponding chained list node from M queue linked list of this message, and reads corresponding message data according to this chained list node.
Further, described plug-in buffer memory refers to the QDR buffer memory.
Further, the value of M satisfies: if N/K is an integer, then M equals N/K, if N/K is not an integer, then M equals N/K+1.
Beneficial effect of the present invention is:
The invention provides a kind of multilinked list structure management spatial cache, a plurality of chained lists can make read operation flowing water, hidden read latency, improved message processing speed, satisfy the requirement of high speed processing message data, thereby improved effective solution for the management of the storage of linked list of high speed router traffic management chip.The present invention is convenient to hardware and is realized, adapts to the high-speed high capacity cache management.It is simple that the present invention simultaneously also has realization, the advantage that is easy to promote the use of.
Embodiment
Below in conjunction with the drawings and specific embodiments the present invention is described in further detail.
Fig. 1 is a high speed router traffic management chip storage of linked list management principle schematic, as shown in the figure, high speed router traffic management chip comprises queue linked list management subsystem, queue scheduling subsystem, chained list node storage subsystem and metadata cache management subsystem.When message was joined the team, queue linked list management subsystem was set up chained list and is given the storage of metadata cache management subsystem with message data for the message of joining the team, and chained list node is stored in the chained list node storage subsystem; When going out group, which formation message is the queue scheduling subsystem determine go out team, and the notification queue linked list management system, and the queue linked list management system is obtained out group message address information from this queue linked list node, give metadata cache management subsystem, read message data from metadata cache management subsystem.
The general chained list node that adopts the formation of QDR buffer memory, time-delay is read in the existence of QDR buffer memory, supposes that the time-delay of reading of QDR buffer memory is N, supposes that it is K that the traffic management chip requires the time of a chained list node of processing; Then the queue linked list number that message queue needs among the present invention be " N/K " (if can divide exactly is exactly this numerical value, if aliquant then this numerical value adds " 1 "), and certainly, the queue linked list number of message queue needs can also be for greater than " N/K ".Adopt the multilinked list structure, operation can be got up by flowing water between a plurality of chained list nodes of same message queue, reaches the effect that reduces the time-delay of QDR cache read, satisfies the chained list node processing time of traffic management chip regulation.Set forth below that message is joined the team and the interpolation and the delete procedure of chained list node when going out group.
Suppose that the queue linked list number that every formation needs is M.When each message is joined the team, find its corresponding M queue linked list, judge promptly which queue linked list this message should add to, and, judge what chained list nodes this message needs according to the length of message according to the queue number of message; With the chained list node applied for adding in this M queue linked list of poll successively, upgrade the tail node pointer value of queue linked list successively then; So just finished joining the team of a message, the chained list node of this message has been added in the corresponding queues chained list; The process of setting up of each queue linked list similarly repeats no more.
When message goes out group, according to the queue number that goes out team, read the first node pointer numerical value of this queue linked list successively, first node corresponding memory space data are read, upgrade the first node pointer numerical value of every queue linked list after reading numerical value, and add the node of this free time address correspondence the afterbody of idle chained list to, so that utilize next time.
Fig. 2 is a high speed router traffic management chip storage of linked list management method schematic flow sheet of the present invention, and as shown in the figure, high speed router traffic management chip storage of linked list management method of the present invention specifically comprises the steps:
1, set up M queue linked list for each message queue, and be stored in the plug-in buffer memory, the basic descriptor information of queue linked list is stored in the sheet of high speed router traffic management chip.In the present embodiment, plug-in buffer memory adopts the QDR buffer memory.
If N/K is an integer, then M is not less than N/K, if N/K is not an integer, then M is not less than N/K+1, that is: M is more than or equal to N/K, and M is an integer.Wherein N is the time-delay of reading of QDR buffer memory, and k is the time that a chained list node is handled in the requirement of traffic management chip.The value of M preferably satisfies: if N/K is an integer, then M equals N/K, if N/K is not an integer, then M equals N/K+1.
2, when message is joined the team, find described M queue linked list of its correspondence according to the queue number of message, and, judge what chained list nodes this message needs according to the length of message.
3, with the chained list node applied for adding in the described M queue linked list of poll successively, upgrade the tail node pointer value of a described M queue linked list successively.
4, when message goes out group, according to the queue number that goes out team, read the first node pointer numerical value of described M queue linked list of its correspondence successively, first node corresponding memory space data are read, obtain chained list node, and read corresponding message data according to chained list node.
5, read numerical value and upgrade the first node pointer numerical value of every queue linked list afterwards, and the node of this free time address correspondence is added to the afterbody of idle chained list.
Mode with specific embodiment is described further the present invention program below.
Among this embodiment, the present invention adopts 4 list structures, is 8 cycles because read the QDR buffer delay, node of the fastest per two period treatment, so each queue linked list uses 4 child lists just can realize read operation flowing water.
The initial idle chained list node of the memory space of metadata cache management subsystem and queue linked list management subsystem is one to one among Fig. 1, as shown in Figure 3, the figure illustrates, the memory space of metadata cache management subsystem is divided into the N piece, then in queue linked list management subsystem, initial idle chained list node also is divided into N, is to concern one to one between them.N is the natural number greater than 1.
The basic descriptor information of the queue linked list of each formation is stored in the sheet, as shown in Figure 4, it comprises that the head and the tail node of 4 queue linked lists, one 4 go out group activation flag, one 4 the activation flag of joining the team, 41 the empty flag bit of queue linked list and 1 queue empty indicate.Have only 41 empty the sign when all being " 1 " of queue linked list, this formation is empty.When joining the team, according to message queue number, select 4 corresponding queue linked lists, read the activation flag of joining the team of this formation and judge which queue linked list the message chained list node should add in, when this chained list node is the tail node of this message, the bag tail tag will of this chained list node is set to " 1 ", otherwise is " 0 ".When going out group, read the basic descriptor information of chained list according to the queue number that goes out team, obtain the first node pointer numerical value of which queue linked list according to group activation flag judgement that goes out of reading, this first node pointer numerical value corresponding memory space message data is read, until the tail node message data of this message is read, just might more the swap out queue number of team reads the message data of another formation; When the head and the tail node of queue linked list equates, this queue linked list is labeled as sky, when all 4 queue linked lists all were empty, 4 queue linked list overall labelings of this formation were empty.Demonstrating message below joins the team and goes out group process.
Message is joined the team flow process as shown in Figure 5, after the idle chained list node of message application, begin to add, judge whether this queue linked list is empty from first packet node, if be empty just with this idle chain table address as the queue linked list owner pointer, judge then whether this node is the bag tail, if the bag tail then finishes to join the team, otherwise continue to add next node, upgrade the queue linked list tail pointer, judge whether this bag is the bag tail, and the like add in the chained list end fully to up to the node of this bag and join the team; When if first packet node adds, this formation non-NULL then adds to this node in the formation and upgrades the queue linked list tail pointer, judges that whether this bag is the bag tail, if the bag tail then finishes this time to join the team, adds end otherwise continue to add until this message node.The message node number of supposing the N-5 formation is 20, and the order that this 20 message node is joined the team is followed successively by 0 to 19, supposes when formation N-5 is initial to be empty queue.First node application of this formation to the idle node address be 0, this moment this formation the activity of joining the team chained list be masked as " 0001 ", then this address " 0 " is stored into the owner pointer of queue linked list 1; The idle node address that second node application arrived is " 1 "; The activity of the joining the team chained list of this formation this moment is masked as " 0010 ", then this address " 1 " is stored into the owner pointer of queue linked list 2; And the like, these 20 nodes to be added in 4 queue linked lists of N-5 formation, the on-link mode (OLM) of 4 queue linked list reality of final n-5 formation is as shown in Figure 6.Stored the next node address pointer numerical value that this node points in each chained list node, when going out group, seek out the next node address and then must obtain by reading a last node content.The node of 4 queue linked list links of N-5 formation correspondence is respectively: the node of queue linked list 1 link is 0,4,8,12 and 16, and the head and the tail node of this queue linked list is stored the 0th and the 12nd node data pointer respectively; The node of queue linked list 2 links is 1,5,9,13 and 17, and the head and the tail node of this queue linked list is stored the 1st and the 13rd node data pointer respectively; The node of queue linked list 3 links is 2,6,10,14 and 18, and the head and the tail node of this queue linked list is stored the 2nd and the 14th node data pointer respectively; The node of queue linked list 4 links is 3,7,11,15 and 19, and the head and the tail node of this queue linked list is stored the 3rd and the 15th node data pointer respectively.
The flow process that message goes out team satisfies the formation that group condition and provides out team's request as shown in Figure 7, searches the head and the tail pointer of queue linked list according to going out group queue number, judges which queue linked list to begin to obtain the chained list node data from according to going out group activation flag; Read after the chained list node data, judge the whether bag tail of this message of this node, if, finish this and go out team, wait for that the request of next formation goes out team once more; Otherwise, obtain the chained list node data from another queue linked list according to going out group activation flag judgement.If going out the queue number of team is N-5, and the chained list of N-5 formation this moment as shown in Figure 6.Find the head and the tail pointer of this queue linked list according to queue number N-5, go out group activation flag this moment and be " 0001 ", then from the first node reading of data of queue linked list 1, first node address " 0 " and message length are sent to metadata cache management subsystem, the message in this node corresponding stored space is read; It is data cached for the QDR of " 0 " to read the address, data such as the address pointer " 4 " read and bag tail tag will are write the first node of queue linked list 1, add the address afterbody of idle chained list to for the node of " 0 " simultaneously, wait for reusing this free buffer space when joining the team.Judge according to the first node bag tail tag will before upgrading whether preceding first node is the bag tail, if then finish this time to go out team; If not, then go out group activation flag for " 0010 ", obtain the first node data of queue linked list 2, finish message and go out team, it to go out group process the same with queue linked list 1 first node processing process, go out team fully up to a message.Need 5 chained list node spaces if N-5 formation this time goes out the message of team, then this message go out the N-5 formation after the team fully chained list as shown in Figure 8.
When going out group, handle chained list node data 2 cycles of the fastest needs, the head and the tail pointer data of queue linked list is stored in the sheet, in the QDR buffer memory of node pointer storage outside sheet, there is read latency in the QDR buffer memory, the single linked list structure does not satisfy chained list node data of 2 period treatment, therefore adopts multilinked list structure head it off.The read latency of QDR buffer memory is 8 cycles, and 4 list structures can satisfy the sequential requirement of flowing water, 4 chained list stream treatment processes when Fig. 9 has shown group.
Figure 10 is a high speed router traffic management chip storage of linked list management system structural representation of the present invention, as shown in the figure, high speed router traffic management chip storage of linked list management system of the present invention comprises that queue linked list sets up join the team administration module and message of module, message and go out group administration module.
Wherein, queue linked list is set up module and is used to each message queue to set up M queue linked list, and is stored in the plug-in buffer memory, in the present embodiment, plug-in buffer memory is the QDR buffer memory, and the basic descriptor information of queue linked list is stored in the sheet of high speed router traffic management chip.If N/K is an integer, then M is not less than N/K, if N/K is not an integer, then M is not less than N/K+1, and wherein N is the time-delay of reading of QDR buffer memory, and k is the time that a chained list node is handled in the requirement of traffic management chip.The value of M preferably satisfies: if N/K is an integer, then M equals N/K, if N/K is not an integer, then M equals N/K+1.
The message administration module of joining the team is used for, and when message is joined the team, the chained list node of this message is left in its corresponding M queue linked list.
Message goes out group administration module and is used for, and when message goes out group, finds corresponding chained list node from M queue linked list of this message, and reads corresponding message data according to this chained list node.
The specific embodiments of high speed router traffic management chip storage of linked list management system can be referring to top to the specifying of high speed router traffic management chip storage of linked list management method, and they are consistent, repeat no more herein.
Above-described specific embodiment, purpose of the present invention, technical scheme and beneficial effect are further described, institute it should be noted, the above only is specific embodiments of the invention, and those skilled in the art can carry out various changes and modification to the present invention and not break away from the spirit and scope of the present invention.Like this, if of the present invention these are revised and modification belongs within the scope of the technical scheme of claim record of the present invention and equivalent technologies thereof, then the present invention also is intended to comprise these changes and modification interior.