WO2016202113A1 - 一种队列管理方法、装置及存储介质 - Google Patents

一种队列管理方法、装置及存储介质 Download PDF

Info

Publication number
WO2016202113A1
WO2016202113A1 PCT/CN2016/081033 CN2016081033W WO2016202113A1 WO 2016202113 A1 WO2016202113 A1 WO 2016202113A1 CN 2016081033 W CN2016081033 W CN 2016081033W WO 2016202113 A1 WO2016202113 A1 WO 2016202113A1
Authority
WO
WIPO (PCT)
Prior art keywords
queue
pointer group
address
operation request
new
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.)
Ceased
Application number
PCT/CN2016/081033
Other languages
English (en)
French (fr)
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
Original Assignee
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 ZTE Microelectronics Technology Co Ltd filed Critical ZTE Microelectronics Technology Co Ltd
Publication of WO2016202113A1 publication Critical patent/WO2016202113A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling
    • H04L47/62Queue scheduling characterised by scheduling criteria
    • H04L47/6245Modifications to standard FIFO or LIFO

Definitions

  • the present invention relates to a related art of queue management in the field of communication technologies, and in particular, to a queue management method, apparatus, and storage medium.
  • queue management is a basic and core function and technology. It is a kind of management that stores the message information according to the queue number and then outputs the message according to the scheduling.
  • Packets belonging to the same queue are stored in a linked list by means of nodes in a first-in, first-out manner.
  • the node can be in the whole message, or it can be divided into several blocks (each block is called a block) and then in block units.
  • the storage space address corresponding to each node is called a pointer, and all queues share the same node cache space.
  • This kind of queue management method can save space for storage when there are many queues. However, in the existing method of queue management based on linked list, this method can not save storage space better. For example, if the number of blocks to be stored is 1 megabyte (Million, M), the storage space required for other association processing in the queue management implementation process is not considered.
  • the processing space required for the linked list node needs 1M*20bits. For chip design, it is a big storage space.
  • Queue management is performed by connecting nodes in a linked list. The more nodes are stored, the more storage space is required, and the higher the cost of the chip. Each node needs to access the storage space once, and the access frequency is fast. The power consumption of the chip is large.
  • embodiments of the present invention are directed to providing a queue management method, apparatus, and storage medium, which can improve queue management capabilities and reduce costs.
  • An embodiment of the present invention provides a queue management method, where the method includes:
  • Determining that the current operation request is an enqueue operation request of the packet, and determining, according to the queue number in the enqueue operation request, that the new pointer group is not created for the queue, determining the report according to the current pointer group of the queue And storing, by the first storage address corresponding to the text, the packet in the first storage address; or determining, according to the queue number in the enqueue operation request, that a new pointer group needs to be created for the queue, The queue creates a new pointer group and determines a second storage address corresponding to the packet according to the newly created pointer group, and stores the packet in the second storage address;
  • Determining that the current operation request is a dequeue operation request of the message reading the message according to the queue number in the dequeue operation request, and updating the pointer group corresponding to the queue.
  • the determining, according to the queue number in the enqueue operation request, that there is no need to create a new pointer group for the queue includes:
  • determining, according to the queue number in the enqueue operation request, that a new pointer group needs to be created for the queue includes:
  • the determining, according to the current pointer group of the queue, the first storage address corresponding to the packet includes:
  • the determining, by the newly created pointer group, the second storage address corresponding to the packet includes:
  • Reading the memory link header node obtaining the value as the base address of the newly created pointer group, and splicing the base address of the newly created pointer group with the offset address in the newly created pointer group as the address The second storage address corresponding to the message.
  • the method further includes:
  • Determining whether the queue is a new queue if it is a new queue, updating a head node and a tail node of the queue; if the queue is not a new queue, updating a tail node of the queue and a memory chain header node.
  • the packet is read out and updated according to the queue number in the dequeuing operation request, and the pointer group corresponding to the queue is updated, including:
  • the method further includes:
  • the embodiment of the present invention further provides a queue management device, where the device includes: an enrollment module and a dequeue module;
  • the enqueue module is configured to determine that the current operation request is an enqueue operation request of the packet, and according to the queue number in the enqueue operation request, it is determined that when the new pointer group is not created for the queue, according to the queue Determining, by the current pointer group, the first storage address corresponding to the packet, and storing the packet in the first storage address; or determining, according to the queue number in the enqueue operation request, that a new queue needs to be created for the queue a pointer group, creating a new pointer group for the queue and determining a second storage address corresponding to the packet according to the newly created pointer group, and storing the packet to In the second storage address;
  • the dequeuing module is configured to determine that the current operation request is a dequeue operation request of the packet, and read and update the pointer group corresponding to the queue according to the queue number in the dequeue operation request.
  • the enqueue module is configured to determine, according to the queue number in the enqueue operation request, that the queue is not a new queue and the current pointer group of the queue is not full, determining that it is unnecessary to create a new queue for the queue. And determining that a new pointer group needs to be created for the queue when the queue is determined to be a new queue or the current pointer group of the queue is full according to the queue number in the enqueue operation request.
  • the enqueue module is configured to obtain the address of the base address and the offset address according to the base address and the offset address in the current pointer group of the queue, where the spliced address is The first storage address corresponding to the message.
  • the enqueue module is configured to read a memory link header node, and obtain a value as a base address of the newly created pointer group, and base address of the newly created pointer group and the newly created pointer The address after the offset address is spliced in the group is used as the second storage address corresponding to the packet.
  • the device further includes a first update module, configured to determine whether the queue is a new queue, if it is a new queue, update a head node and a tail node of the queue; if the queue is not a new queue, update The tail node of the queue and the memory chain header node.
  • a first update module configured to determine whether the queue is a new queue, if it is a new queue, update a head node and a tail node of the queue; if the queue is not a new queue, update The tail node of the queue and the memory chain header node.
  • the dequeue module is configured to read the head node of the queue according to the queue number in the dequeue operation request, read the message according to the head node, and update the pointer corresponding to the queue.
  • the base address in the group is the address corresponding to the pointer in the queue head node, and the offset address in the pointer group is updated accordingly.
  • the device further includes a second update module, configured to determine whether a null pointer group exists in the current pointer group of the queue, and if yes, update the head node and the tail of the queue Node and memory chain footer nodes.
  • the embodiment of the present invention further provides a computer storage medium, where the computer storage medium stores a computer program configured to execute the foregoing queue management method of the embodiment of the present invention.
  • the queue management method, device, and storage medium provided by the embodiment of the present invention determine that the current operation request is an enqueue operation request of the packet, and according to the queue number in the enqueue operation request, it is determined that no new queue is created for the queue.
  • the first storage address corresponding to the packet is determined according to the current pointer group of the queue, and the packet is stored in the first storage address; or, according to the queue number in the enqueue operation request
  • a new pointer group is created for the queue, and a second storage address corresponding to the packet is determined according to the newly created pointer group, and the packet is stored to the second The storage address is determined.
  • the current operation request is a dequeuing operation request of the packet, and the packet is read out and updated according to the queue number in the dequeue operation request.
  • the implementation of the pointer group reduces the storage space of the linked list node, reduces the number of times of accessing the linked list node and the bandwidth required for managing the random access memory (RAM), and improves the data storage space when the data storage space is fixed.
  • the ability to manage queues reduces costs.
  • FIG. 1 is a schematic flowchart of a queue management method according to an embodiment of the present invention.
  • FIG. 2 is a schematic diagram of initializing a memory link table according to an embodiment of the present invention.
  • FIG. 3 is a schematic diagram of queue descriptor information according to an embodiment of the present invention.
  • FIG. 4 is a schematic flowchart of a queue management method according to Embodiment 2 of the present invention.
  • FIG. 5 is a schematic flowchart of a queue management method according to Embodiment 3 of the present invention.
  • FIG. 6 is a schematic structural diagram of a queue management apparatus according to an embodiment of the present invention.
  • determining that the current operation request is an enqueue operation request of the packet, and determining, according to the queue number in the enqueue operation request, that a new pointer group is not required to be created for the queue, according to the queue current Determining, by the chunk, a first storage address corresponding to the packet, storing the packet in the first storage address; or determining, according to the queue number in the enqueue operation request, the queue
  • a new pointer group is created, a new pointer group is created for the queue, and a second storage address corresponding to the packet is determined according to the newly created pointer group, and the packet is stored in the second storage address;
  • the operation request is a dequeuing operation request of the message, and the message is read out according to the queue number in the dequeue operation request and the pointer group corresponding to the queue is updated.
  • FIG. 1 is a schematic flowchart of a queue management method according to an embodiment of the present invention. As shown in FIG. 1 , a queue management method in an embodiment of the present invention includes:
  • Step 101 Determine that the current operation request is an enqueue operation request of the packet, and determine, according to the queue number in the enqueue operation request, that a new pointer group is not required to be created for the queue, according to the current pointer group of the queue.
  • the first storage address corresponding to the packet is stored in the first storage address; or, according to the queue number in the enqueue operation request, when a new pointer group needs to be created for the queue, Creating a new pointer group for the queue and determining a second storage address corresponding to the packet according to the newly created pointer group, and storing the packet in the second storage address;
  • the method further includes: initializing the memory linked list according to the group of pointers;
  • the pointer group is a set of pointers corresponding to n nodes of the pointer group corresponding to the queue; n is the number of pointers in the pointer group, and is a positive integer, which can be set according to actual needs; Each pointer is numbered, and the numbers are arranged in order;
  • the initializing the memory linked list according to the group of pointers includes:
  • the method further includes: extracting a queue number in the enqueue operation request.
  • the determining, according to the queue number in the enqueue operation request, that there is no need to create a new pointer group for the queue includes:
  • determining, according to the queue number in the enqueue operation request, that a new pointer group needs to be created for the queue includes:
  • each queue may correspond to one or more pointer groups, and multiple queues may share one memory linked list; if the pointer group is not full, the pointer group has unused idle pointers, for example, a pointer group is storable.
  • Queue 5 nodes correspond to a pointer group of pointers, the queue has only one pointer group, and the current queue list has 3 nodes, that is, the current pointer group only stores pointers corresponding to the 3 nodes, that is, contains two idles. Pointer, the pointer group is not full.
  • the determining, according to the current pointer group of the queue, the first storage address corresponding to the packet includes:
  • the spliced address is the first storage address corresponding to the packet; for example: If the base address in the current pointer group is 10'b1 and the offset address is 2'b10, the address where the base address and the offset address are spliced is 12'b110, that is, the new address is 6; wherein, 10 For the data bit width, b represents a binary; thus, determining the first storage address corresponding to the message by the current pointer group of the queue, and storing the message to the first storage address, reducing the number of times of accessing the memory linked list node And the bandwidth required to manage RAM.
  • the method further includes:
  • the determining, by the newly created pointer group, the second storage address corresponding to the packet includes:
  • Reading the memory link header node obtaining the value as the base address of the newly created pointer group, and splicing the base address of the newly created pointer group with the offset address in the newly created pointer group as the address a second storage address corresponding to the message;
  • the offset address in the pointer group is 0.
  • the method further includes:
  • Determining whether the queue is a new queue if it is a new queue, updating a head node and a tail node of the queue; if the queue is not a new queue, updating a tail node of the queue and a memory chain header node;
  • the address of the head node that updates the queue is the address pointed to by the memory link header node, and the address of the tail node of the queue is updated to be the address interval n-1 pointed by the memory link header node.
  • the method further includes: updating descriptor information of the queue; where the descriptor information includes a queue The head pointer group, the queue tail pointer group, the head pointer group activity flag, the tail pointer group activity flag, the queue empty flag, and the like; the head pointer group is the base address of the pointer group corresponding to the queue; as shown in FIG.
  • Step 102 Determine that the current operation request is a dequeue operation request of the packet, and read and update the pointer group corresponding to the queue according to the queue number in the dequeue operation request;
  • the method further includes: extracting a queue number in the dequeue operation request.
  • the reading and updating the pointer group corresponding to the queue according to the queue number in the dequeuing operation request includes:
  • the method further includes:
  • the existence of a null pointer group in the current pointer group of the queue includes two cases: one is that the queue has only one pointer group, the pointer group is a null pointer group; the other is that the queue corresponds to more than one pointer. a group, the empty pointer group exists in the one or more pointer groups;
  • the head node that updates the queue is the next node pointed to by the queue head node, and the update queue tail node is the current tail node interval of the queue is n nodes.
  • the previous node, that is, the null pointer group is released, and the null pointer is recovered.
  • the node storage space corresponding to the needle group is updated, and the memory node tail node is the original node of the queue, that is, the head node before the queue update; by controlling the release timeliness of the pointer group, the storage space efficiency of the memory linked list node is improved.
  • the method further includes: determining whether the node included in the queue is empty, that is, whether the queue is an empty queue, and if the queue is an empty queue, updating a queue in the queue descriptor Mark; otherwise, no updates are made.
  • FIG. 4 is a schematic flowchart of a queue management method according to an embodiment of the present invention. As shown in FIG. 4, the queue management method in the embodiment of the present invention includes:
  • Step 401 Initialize a memory linked list according to a pointer group manner
  • the pointer group is a set of pointers corresponding to n nodes of the pointer group corresponding to the queue; n is a positive integer, which can be set according to actual needs; each pointer in the pointer group is numbered, and the number is Arrange in order;
  • the initializing the memory linked list according to the group of pointers includes:
  • Step 402 Receive an enqueue operation request of the packet, and extract a queue number in the enqueue operation request.
  • Step 403 Determine whether it is necessary to apply for a new pointer group for the queue, if necessary, perform step 404; if not, perform step 407;
  • the step includes: determining, according to the queue number in the enqueue operation request, that the queue is not a new queue and the current pointer group of the queue is not full, determining that it is unnecessary to create a new pointer group for the queue; Determining that the queue is a new queue, or when the current pointer group of the queue is full, determining that a new pointer group needs to be created for the queue;
  • each queue may correspond to one or more pointer groups, and multiple queues may share one memory linked list; if the pointer group is not full, the pointer group has unused idle pointers, for example, a pointer group is storable.
  • Queue 5 nodes correspond to a pointer group of pointers, the queue has only one pointer group, and the current queue list has 3 nodes, that is, the current pointer group only stores pointers corresponding to the 3 nodes, that is, contains two idles. Pointer, the pointer group is not full.
  • Step 404 Create a new pointer group for the queue and determine a second storage address corresponding to the packet according to the newly created pointer group, and store the packet in the second storage address.
  • the method further includes:
  • the determining, according to the newly created pointer group, the second storage address corresponding to the packet including:
  • Reading the memory link header node obtaining the value as the base address of the newly created pointer group, and splicing the base address of the newly created pointer group with the offset address in the newly created pointer group as the address a second storage address corresponding to the message;
  • the offset address in the pointer group is 0.
  • Step 405 Determine whether the queue is a new queue. If it is a new queue, perform step 406; if it is not a new queue, go to step 408.
  • Step 406 Update the head node and the tail node of the queue, and perform step 409;
  • the step includes: updating the address of the head node of the queue to the address pointed by the memory link header node, and updating the address of the tail node of the queue to be an address interval pointed by the memory link header node n-1 nodes, corresponding to the address of;
  • the method further includes: updating descriptor information of the queue; where the descriptor information includes a queue head pointer group, a queue tail pointer group, a head pointer group activity flag, a tail pointer group activity flag, and a queue. Empty mark, etc.; as shown in Figure 3.
  • Step 407 The first storage address corresponding to the packet is determined according to the current pointer group of the queue, the packet is stored in the first storage address, and step 409 is performed;
  • the determining, by the current pointer group of the queue, the first storage address corresponding to the packet includes:
  • the spliced address is the first storage address corresponding to the packet; for example: If the base address in the current pointer group is 10'b1 and the offset address is 2'b10, the address where the base address and the offset address are spliced is 12'b110, that is, the new address is 6; wherein, 10 For the data bit width, b represents a binary; thus, determining the first storage address corresponding to the message by the current pointer group of the queue, and storing the message to the first storage address, reducing the number of times of accessing the memory linked list node And the bandwidth required to manage RAM.
  • Step 408 Update the tail node of the queue and the memory link header node.
  • the step of updating the address of the tail node of the queue is the address corresponding to the address interval n-1 nodes pointed by the memory chain header node, and updating the memory link header node to point to the next available address, that is, updating the memory.
  • the head node of the linked list points to the address after the current head node address is separated by n nodes;
  • the method further includes: updating descriptor information of the queue; where the descriptor information includes a queue head pointer group, a queue tail pointer group, a head pointer group activity flag, Tail pointer group activity tag, queue empty tag, etc.
  • Step 409 End this process flow.
  • FIG. 5 is a schematic flowchart of a queue management method according to an embodiment of the present invention. As shown in FIG. 5, a queue management method according to an embodiment of the present invention includes:
  • Step 501 Receive a dequeue operation request of the packet, and extract a queue number in the dequeue operation request.
  • Step 502 Read and update the pointer group corresponding to the queue according to the queue number in the dequeuing operation request.
  • the base address in the address is the address corresponding to the pointer in the head node of the queue, and the offset address in the pointer group is updated accordingly.
  • Step 503 Determine whether there is a null pointer group in the current pointer group of the queue, if yes, go to step 504; if not, go to step 507;
  • the existence of a null pointer group in the current pointer group of the queue includes two cases: one is that the queue has only one pointer group, the pointer group is a null pointer group; the other is that the queue corresponds to more than one pointer. Group, there is a null pointer group in the one or more pointer groups.
  • Step 504 Update a head node, a tail node, and a memory link tail node of the queue.
  • the method includes: updating a head node of the queue to a next node pointed by the original node of the queue, and updating a queue tail node to a node before the current tail node of the queue is separated by n nodes, that is, releasing the null pointer group Recovering the node storage space corresponding to the null pointer group, updating the memory chain tail node as the queue original node, that is, the head node before the queue update; improving the memory link table node by controlling the release timeliness of the pointer group The efficiency of storage space.
  • Step 505 Determine whether the queue is an empty queue, if it is an empty queue, step 506; Otherwise, step 507 is performed.
  • Step 506 Update the queue empty tag in the queue descriptor.
  • Step 507 End this process flow.
  • FIG. 6 is a schematic structural diagram of a queue management apparatus according to an embodiment of the present invention. As shown in FIG. 6, the queue management apparatus in the embodiment of the present invention includes: an enqueue module 61 and a dequeue module 62;
  • the enqueue module 61 is configured to determine that the current operation request is an enqueue operation request of the packet, and according to the queue number in the enqueue operation request, it is determined that when the new pointer group is not created for the queue, according to the The current pointer group of the queue determines the first storage address corresponding to the packet, and the packet is stored in the first storage address; or, according to the queue number in the enqueue operation request, it is determined that the queue needs to be created for the queue. a new pointer group, a new pointer group is created for the queue, and a second storage address corresponding to the packet is determined according to the newly created pointer group, and the packet is stored in the second storage address;
  • the dequeue module 62 is configured to determine that the current operation request is a dequeue operation request of the message, and read and update the pointer group corresponding to the queue according to the queue number in the dequeue operation request.
  • the enqueue module 61 is further configured to initialize the memory linked list according to the group of pointers;
  • the pointer group is a set of pointers corresponding to n nodes of the pointer group corresponding to the queue; n is a positive integer, which can be set according to actual needs; each pointer in the pointer group is numbered, and the number is Arrange in order;
  • the inbound module 61 initializes the memory linked list according to the group of pointers, including:
  • the enqueue module 61 writes the current address in the memory linked list to the address of the next node in order, that is, when initializing, the data in the address 0 is written 1, and the data in the address 1 is written 2 until the data in the address N-1 is written. 0, as shown in Figure 2.
  • the enqueue module 61 is further configured to determine whether the current operation request is an enqueue operation request or a dequeue operation request of the message, and if the enqueue operation request is, extract the enqueue operation request. The queue number; if it is a dequeue operation request, the dequeue module 62 is triggered.
  • the enqueue module 61 is configured to determine, according to the queue number in the enqueue operation request, that the queue is not a new queue and the current pointer group of the queue is not full, The queue creates a new pointer group; and determines that the queue is a new queue according to the queue number in the enqueue operation request, or when the current pointer group of the queue is full, it is determined that a new pointer group needs to be created for the queue .
  • the enqueue module 61 is configured to acquire the address of the base address and the offset address according to the base address and the offset address in the current pointer group of the queue, where the spliced
  • the address is the first storage address corresponding to the message; for example, if the base address in the current pointer group is 10'b1 and the offset address is 2'b10, the address after the base address and the offset address are spliced Then, it is 12'b110, that is, the new address is 6; wherein 10 is the data bit width and b is the binary; thus, the first storage address corresponding to the packet is determined by the current pointer group of the queue, and the message is stored to The first storage address reduces the number of accesses to the memory linked list node and the bandwidth required to manage the RAM.
  • the enqueue module 61 is configured to read a memory link header node, obtain a value as a base address of the newly created pointer group, and base the newly created pointer group with the new address.
  • the spliced address of the offset address in the created pointer group is used as the second storage address corresponding to the packet;
  • the offset address in the pointer group is 0.
  • the apparatus further includes a first update module 63 configured to determine whether the queue is a new queue, and if it is a new queue, update a head node and a tail node of the queue; if the queue is not new Queue, updating the tail node of the queue and the memory link header node;
  • the first update module 63 updates the address of the head node of the queue.
  • the address pointed to by the memory link header node, and the address of the tail node of the queue is updated to be the address corresponding to the address interval pointed by the memory link header node n-1 nodes; if the queue is not a new queue, the first The update module 63 updates the address of the tail node of the queue to the address corresponding to the address interval n-1 nodes pointed by the memory link header node, and updates the memory link header node to point to the next available address, that is, updates the memory list.
  • the head node points to the address after the current head node address is separated by n nodes.
  • the first update module 63 is further configured to update descriptor information of the queue; where the descriptor information includes a queue head pointer group, a queue tail pointer group, a head pointer group activity flag, Tail pointer group activity tag, queue empty tag, etc.; as shown in Figure 3.
  • the dequeue module 62 is further configured to extract a queue number in the dequeue operation request.
  • the dequeue module 62 is configured to read the head node of the queue according to the queue number in the dequeue operation request, read the message according to the head node, and update the queue.
  • the base address in the corresponding pointer group is an address corresponding to the pointer in the queue head node, and the offset address in the pointer group is updated accordingly.
  • the apparatus further includes a second update module 64 configured to determine whether a null pointer group exists in the current pointer group of the queue, and if present, update the head node of the queue, Tail node and memory chain tail node;
  • the existence of a null pointer group in the current pointer group of the queue includes two cases: one is that the queue has only one pointer group, the pointer group is a null pointer group; the other is that the queue corresponds to more than one pointer. a group, the empty pointer group exists in the one or more pointer groups;
  • the second update module 64 is configured to update the head node of the queue to be the next node pointed by the queue head node, and the update queue tail node is a node before the current tail node of the queue is separated by n nodes, that is, Release the null pointer group, recover the node storage space corresponding to the null pointer group, update the memory link tail node to the queue original node, that is, the head node before the queue update; control the release timeliness of the pointer group , improve the efficiency of the memory linked list node storage space.
  • the second update module 64 is further configured to determine whether the node included in the queue is empty, that is, whether the queue is an empty queue, and if the queue is an empty queue, update the queue description. Queue empty tag in the character.
  • the enqueue module 61, the dequeue module 62, the first update module 63, and the second update module 64 proposed in the embodiments of the present invention may all be implemented by a processor, and may also be implemented by a specific logic circuit;
  • the processor can be a central processing unit (CPU), a microprocessor (MPU), or a field programmable gate array (FPGA).
  • the queue management method is implemented in the form of a software function module and is sold or used as a separate product, it may also be stored in a computer readable storage medium.
  • the technical solution of the embodiments of the present invention may be embodied in the form of a software product in essence or in the form of a software product stored in a storage medium, including a plurality of instructions.
  • a computer device (which may be a personal computer, server, or network device, etc.) is caused to perform all or part of the methods described in various embodiments of the present invention.
  • the foregoing storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read only memory (ROM), a magnetic disk, or an optical disk. This As such, embodiments of the invention are not limited to any specific combination of hardware and software.
  • the embodiment of the present invention further provides a computer storage medium, where the computer storage medium stores a computer program, and the computer program is used to execute the foregoing queue management method of the embodiment of the present invention.
  • the embodiment of the present invention determines that the current operation request is a request for the enqueue operation of the packet, and according to the queue number in the enqueue operation request, it is determined that when the new pointer group is not created for the queue, the current pointer group according to the queue is determined.
  • the dequeuing operation request reads out and updates the pointer group corresponding to the queue according to the queue number in the dequeue operation request.
  • the implementation of the pointer group reduces the storage space of the linked list node, reduces the number of accesses to the linked list node and the bandwidth required for managing the RAM, and improves the management capability of the queue and reduces the cost when the data storage space is fixed. .

Landscapes

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

Abstract

本发明公开了一种队列管理方法,包括:确定当前的操作请求为报文的入队操作请求,依据所述入队操作请求中的队列号确定无需为所述队列创建新的指针组时,依据所述队列当前的指针组确定所述报文对应的第一存储地址,将所述报文存储至第一存储地址中;或者,依据所述入队操作请求中的队列号确定需要为所述队列创建新的指针组时,为所述队列创建新的指针组并依据新创建的指针组确定所述报文对应的第二存储地址,将所述报文存储至第二存储地址中;确定当前的操作请求为报文的出队操作请求,依据所述出队操作请求中的队列号将报文读出并更新所述队列对应的指针组。本发明还公开了一种队列管理装置及存储介质。

Description

一种队列管理方法、装置及存储介质 技术领域
本发明涉及通信技术领域中队列管理的相关技术,尤其涉及一种队列管理方法、装置及存储介质。
背景技术
在通信类芯片中,队列管理是基础的也是核心的一种功能和技术,它是将报文信息按照队列号先进行存储,然后根据调度将报文再输出的一种管理。
属于同一个队列的报文,按照先进先出的原则通过节点串联成链表的方式进行存储。节点可以以整个报文为单位,也可以将报文等分成几块(每个块称为一个block),然后以block为单位。每个节点对应的存储空间地址称为指针,所有队列共享同一个节点缓存空间。此种队列管理方法在队列较多时能够较好的节省存储需要的空间,但是在现有的基于链表进行队列管理的方法中,此种方法却不能更好的节省存储空间。以需要存储的block个数为1兆(Million,M)为例,不考虑队列管理实现过程中其它关联处理需要的存储空间,此种处理方式需要的链表节点存储空间就需要1M*20bits,这对芯片设计来说,是一个很大的存储空间。
采用按照节点串联成链表的方式进行队列管理,存储的节点数越多,需要的存储空间也会越多,导致芯片成本也越高;每个节点都需要访问一次存储空间,访问频率快,导致芯片的功耗大。
发明内容
有鉴于此,本发明实施例期望提供一种队列管理方法、装置及存储介质,能够提高队列的管理能力,降低成本。
为达到上述目的,本发明实施例的技术方案是这样实现的:
本发明实施例提供了一种队列管理方法,所述方法包括:
确定当前的操作请求为报文的入队操作请求,依据所述入队操作请求中的队列号确定无需为所述队列创建新的指针组时,依据所述队列当前的指针组确定所述报文对应的第一存储地址,将所述报文存储至第一存储地址中;或者,依据所述入队操作请求中的队列号确定需要为所述队列创建新的指针组时,为所述队列创建新的指针组并依据新创建的指针组确定所述报文对应的第二存储地址,将所述报文存储至第二存储地址中;
确定当前的操作请求为报文的出队操作请求,依据所述出队操作请求中的队列号将报文读出并更新所述队列对应的指针组。
上述方案中,所述依据所述入队操作请求中的队列号确定无需为所述队列创建新的指针组包括:
依据所述入队操作请求中的队列号确定所述队列非新队列且所述队列当前的指针组未满时,确定无需为所述队列创建新的指针组;
相应的,依据所述入队操作请求中的队列号确定需要为所述队列创建新的指针组包括:
依据所述入队操作请求中的队列号确定所述队列为新队列或者所述队列当前的指针组已满时,确定需要为所述队列创建新的指针组。
上述方案中,所述依据所述队列当前的指针组确定所述报文对应的第一存储地址包括:
依据所述队列当前的指针组中的基地址及偏移地址获取所述基地址及偏移地址拼接后的地址,所述拼接后的地址为所述报文对应的第一存储地址。
上述方案中,所述依据新创建的指针组确定所述报文对应的第二存储地址包括:
读取存储器链表头节点,获得的值作为新创建的指针组的基地址,将所述新创建的指针组的基地址与所述新创建的指针组中的偏移地址拼接后的地址作为所述报文对应的第二存储地址。
上述方案中,所述将所述报文存储至第二存储地址中之后,所述方法还包括:
判断所述队列是否为新队列,如果是新队列,更新所述队列的头节点及尾节点;如果所述队列非新队列,更新所述队列的尾节点及存储器链表头节点。
上述方案中,所述依据所述出队操作请求中的队列号将报文读出并更新所述队列对应的指针组,包括:
依据所述出队操作请求中的队列号读取所述队列的头节点,依据所述头节点将报文读出,更新所述队列对应的指针组中的基地址为所述队列的头节点中指针对应的地址,并相应的更新所述指针组中的偏移地址。
上述方案中,依据所述出队操作请求中的队列号将报文读出并更新所述队列对应的指针组之后,所述方法还包括:
判断所述队列当前的指针组中是否存在空指针组,如果存在,更新所述队列的头节点、尾节点及存储器链表尾节点。
本发明实施例还提供了一种队列管理装置,所述装置包括:入队模块及出队模块;其中,
所述入队模块,配置为确定当前的操作请求为报文的入队操作请求,依据所述入队操作请求中的队列号确定无需为所述队列创建新的指针组时,依据所述队列当前的指针组确定所述报文对应的第一存储地址,将所述报文存储至第一存储地址中;或者,依据所述入队操作请求中的队列号确定需要为所述队列创建新的指针组时,为所述队列创建新的指针组并依据新创建的指针组确定所述报文对应的第二存储地址,将所述报文存储至 第二存储地址中;
所述出队模块,配置为确定当前的操作请求为报文的出队操作请求,依据所述出队操作请求中的队列号将报文读出并更新所述队列对应的指针组。
上述方案中,所述入队模块,配置为依据所述入队操作请求中的队列号确定所述队列非新队列且所述队列当前的指针组未满时,确定无需为所述队列创建新的指针组;以及依据所述入队操作请求中的队列号确定所述队列为新队列或者所述队列当前的指针组已满时,确定需要为所述队列创建新的指针组。
上述方案中,所述入队模块,配置为依据所述队列当前的指针组中的基地址及偏移地址获取所述基地址及偏移地址拼接后的地址,所述拼接后的地址为所述报文对应的第一存储地址。
上述方案中,所述入队模块,配置为读取存储器链表头节点,获得的值作为新创建的指针组的基地址,将所述新创建的指针组的基地址与所述新创建的指针组中的偏移地址拼接后的地址作为所述报文对应的第二存储地址。
上述方案中,所述装置还包括第一更新模块,配置为判断所述队列是否为新队列,如果是新队列,更新所述队列的头节点及尾节点;如果所述队列非新队列,更新所述队列的尾节点及存储器链表头节点。
上述方案中,所述出队模块,配置为依据所述出队操作请求中的队列号读取所述队列的头节点,依据所述头节点将报文读出,更新所述队列对应的指针组中的基地址为所述队列头节点中指针对应的地址,并相应的更新所述指针组中的偏移地址。
上述方案中,所述装置还包括第二更新模块,配置为判断所述队列当前的指针组中是否存在空指针组,如果存在,更新所述队列的头节点、尾 节点及存储器链表尾节点。
本发明实施例还提供了一种计算机存储介质,所述计算机存储介质存储有计算机程序,该计算机程序配置为执行本发明实施例的上述队列管理方法。
本发明实施例所提供的队列管理方法、装置及存储介质,确定当前的操作请求为报文的入队操作请求,依据所述入队操作请求中的队列号确定无需为所述队列创建新的指针组时,依据所述队列当前的指针组确定所述报文对应的第一存储地址,将所述报文存储至第一存储地址中;或者,依据所述入队操作请求中的队列号确定需要为所述队列创建新的指针组时,为所述队列创建新的指针组并依据新创建的指针组确定所述报文对应的第二存储地址,将所述报文存储至第二存储地址中;确定当前的操作请求为报文的出队操作请求,依据所述出队操作请求中的队列号将报文读出并更新所述队列对应的指针组。如此,通过指针组的实现方式,降低了链表节点存储空间,减少了访问链表节点的次数和管理随机存储器(Random Access Memory,RAM)所需的带宽,在数据存储空间固定的情况下,提高了队列的管理能力,降低了成本。
附图说明
图1为本发明实施例一队列管理方法流程示意图;
图2为本发明实施例中存储器链表初始化示意图;
图3为本发明实施例中队列描述符信息示意图;
图4为本发明实施例二队列管理方法流程示意图;
图5为本发明实施例三队列管理方法流程示意图;
图6为本发明实施例中队列管理装置组成结构示意图。
具体实施方式
在本发明实施例中,确定当前的操作请求为报文的入队操作请求,依据所述入队操作请求中的队列号确定无需为所述队列创建新的指针组时,依据所述队列当前的指针组(chunk)确定所述报文对应的第一存储地址,将所述报文存储至第一存储地址中;或者,依据所述入队操作请求中的队列号确定需要为所述队列创建新的指针组时,为所述队列创建新的指针组并依据新创建的指针组确定所述报文对应的第二存储地址,将所述报文存储至第二存储地址中;确定当前的操作请求为报文的出队操作请求,依据所述出队操作请求中的队列号将报文读出并更新所述队列对应的指针组。
实施例一
图1所示为本发明实施例中队列管理方法流程示意图;如图1所示,本发明实施例中队列管理方法包括:
步骤101:确定当前的操作请求为报文的入队操作请求,依据所述入队操作请求中的队列号确定无需为所述队列创建新的指针组时,依据所述队列当前的指针组确定所述报文对应的第一存储地址,将所述报文存储至第一存储地址中;或者,依据所述入队操作请求中的队列号确定需要为所述队列创建新的指针组时,为所述队列创建新的指针组并依据新创建的指针组确定所述报文对应的第二存储地址,将所述报文存储至第二存储地址中;
本步骤之前,所述方法还包括:按照指针组的方式初始化存储器链表;
这里,所述指针组为该指针组对应队列的n个节点对应的指针组成的集合;n为所述指针组内的指针数量,为正整数,可以依据实际需要进行设置;所述指针组中每个指针都编号,所述编号按顺序排列;
所述按照指针组的方式初始化存储器链表包括:
按照顺序将存储器链表中当前地址中写入下一个节点的地址,即初始化时,地址0中的数据写1,地址1中的数据写2,直到地址N-1中的数据 写0,如图2所示。
在一实施例中,确定当前的操作请求为报文的入队操作请求之后,所述方法还包括:提取所述入队操作请求中的队列号。
在一实施例中,所述依据所述入队操作请求中的队列号确定无需为所述队列创建新的指针组包括:
依据所述入队操作请求中的队列号确定所述队列非新队列且所述队列当前的指针组未满时,确定无需为所述队列创建新的指针组;
相应的,依据所述入队操作请求中的队列号确定需要为所述队列创建新的指针组包括:
依据所述入队操作请求中的队列号确定所述队列为新队列或者所述队列当前的指针组已满时,确定需要为所述队列创建新的指针组;
这里,每个队列可以对应一个或多个指针组,多个队列可共用一个存储器链表;所述指针组未满即所述指针组存在未使用的空闲指针,例如:某指针组为可存储对应队列5个节点对应指针的指针组,所述队列仅有一个指针组,当前所述队列链表含有3个节点,即当前指针组仅存储了所述3个节点对应的指针,即含有两个空闲指针,该指针组未满。
在一实施例中,所述依据所述队列当前的指针组确定所述报文对应的第一存储地址包括:
依据所述队列当前的指针组中的基地址及偏移地址获取所述基地址及偏移地址拼接后的地址,所述拼接后的地址为所述报文对应的第一存储地址;例如:若当前的指针组中的基地址为10’b1,偏移地址为2’b10,将所述基地址及偏移地址拼接后的地址则为12’b110,即新地址是6;其中,10为数据位宽,b表示二进制;如此,通过队列当前的指针组确定所述报文对应的第一存储地址,并将报文存储至所述第一存储地址,减少了访问存储器链表节点的次数及管理RAM所需的带宽。
在一实施例中,为所述队列创建新的指针组之后,所述方法还包括:
更新所述队列的尾节点的地址为当前尾节点的地址间隔n个节点之后的地址,并更新存储器链表的头节点指向下一个可用的地址,即更新存储器链表的头节点指向当前头节点地址间隔n个节点之后的地址;也即,以指针组为单位更新队列尾节点及存储器链表头节点;例如:当前队列尾节点的地址为2,新创建的指针组n=4,则更新所述队列尾节点的地址为6;当前存储器链表的头节点指向的地址为3,新创建的指针组n=4,则更新存储器链表的头节点指向地址7。
在一实施例中,所述依据新创建的指针组确定所述报文对应的第二存储地址包括:
读取存储器链表头节点,获得的值作为新创建的指针组的基地址,将所述新创建的指针组的基地址与所述新创建的指针组中的偏移地址拼接后的地址作为所述报文对应的第二存储地址;
这里,由于是新创建的指针组,所以该指针组中的偏移地址为0。
在一实施例中,所述将所述报文存储至第二存储地址中之后,所述方法还包括:
判断所述队列是否为新队列,如果是新队列,更新所述队列的头节点及尾节点;如果所述队列非新队列,更新所述队列的尾节点及存储器链表头节点;
其中,如果是新队列,更新所述队列的头节点的地址为存储器链表头节点指向的地址,并更新所述队列的尾节点的地址为所述存储器链表头节点指向的地址间隔n-1个节点后对应的地址;如果所述队列非新队列,更新所述队列的尾节点的地址为所述存储器链表头节点指向的地址间隔n-1个节点后对应的地址,并更新存储器链表头节点指向下一个可用的地址,即更新存储器链表的头节点指向当前头节点地址间隔n个节点之后的地址;
更新所述队列的头节点及尾节点,或者更新所述队列的尾节点及存储器链表头节点之后,所述方法还包括:更新所述队列的描述符信息;这里,所述描述符信息包括队列头指针组、队列尾指针组、头指针组活动标记、尾指针组活动标记、队列空标记等;所述头指针组即所述队列对应的指针组的基地址;如图3所示。
步骤102:确定当前的操作请求为报文的出队操作请求,依据所述出队操作请求中的队列号将报文读出并更新所述队列对应的指针组;
这里,所述确定当前的操作请求为报文的出队操作请求之后,所述方法还包括:提取所述出队操作请求中的队列号。
在一实施例中,所述依据所述出队操作请求中的队列号将报文读出并更新所述队列对应的指针组,包括:
依据所述出队操作请求中的队列号读取所述队列的头节点,依据所述头节点获得报文的存储地址并将报文读出,更新所述队列对应的指针组中的基地址为所述队列的头节点中指针对应的地址,并相应的更新所述指针组中的偏移地址。
在一实施例中,依据所述出队操作请求中的队列号将报文读出并更新所述队列对应的指针组之后,所述方法还包括:
判断所述队列当前的指针组中是否存在空指针组,如果存在,更新所述队列的头节点、尾节点及存储器链表尾节点;如果不存在,不作处理;
这里,所述队列当前的指针组中存在空指针组包括两种情况:一种是所述队列仅有一个指针组,该指针组为空指针组;另一种是所述队列对应一个以上指针组,所述一个以上指针组中存在空指针组;
如果所述队列当前的指针组中存在空指针组时,更新所述队列的头节点为所述队列原头节点指向的下一个节点,更新队列尾节点为所述队列当前尾节点间隔n个节点之前的节点,即释放所述空指针组,回收所述空指 针组对应的节点存储空间,更新存储器链表尾节点为所述队列原头节点,即所述队列更新前的头节点;通过控制指针组的释放及时性,提高了存储器链表节点存储空间的效率。
在一实施例中,所述方法还包括:判断所述队列包含的节点是否为空,即所述队列是否为空队列,如果所述队列为空队列,更新所述队列描述符中的队列空标记;否则,不进行更新。
实施例二
图4为本发明实施例中队列管理方法流程示意图;如图4所示,本发明实施例中队列管理方法包括:
步骤401:按照指针组的方式初始化存储器链表;
这里,所述指针组为该指针组对应队列的n个节点对应的指针组成的集合;n为正整数,可以依据实际需要进行设置;所述指针组中每个指针都编号,所述编号按顺序排列;
所述按照指针组的方式初始化存储器链表包括:
按照顺序将存储器链表中当前地址中写入下一个节点的地址,即初始化时,地址0中的数据写1,地址1中的数据写2,直到地址N-1中的数据写0,如图2所示。
需要说明的是,按照指针组的方式初始化存储器链表的操作仅需首次执行本实施例队列管理方法的时候执行,后续可直接应用。
步骤402:接收报文的入队操作请求,提取所述入队操作请求中的队列号。
步骤403:判断是否需要为所述队列申请新的指针组,如果需要,执行步骤404;如果不需要,执行步骤407;
本步骤包括:依据所述入队操作请求中的队列号确定所述队列非新队列且所述队列当前的指针组未满时,确定无需为所述队列创建新的指针组; 确定所述队列为新队列,或者所述队列当前的指针组已满时,确定需要为所述队列创建新的指针组;
这里,每个队列可以对应一个或多个指针组,多个队列可共用一个存储器链表;所述指针组未满即所述指针组存在未使用的空闲指针,例如:某指针组为可存储对应队列5个节点对应指针的指针组,所述队列仅有一个指针组,当前所述队列链表含有3个节点,即当前指针组仅存储了所述3个节点对应的指针,即含有两个空闲指针,该指针组未满。
步骤404:为所述队列创建新的指针组并依据新创建的指针组确定所述报文对应的第二存储地址,将所述报文存储至第二存储地址中;
这里,为所述队列创建新的指针组的同时,所述方法还包括:
更新所述队列的尾节点的地址为当前尾节点的地址间隔n个节点之后的地址,并更新存储器链表的头节点指向下一个可用的地址,即更新存储器链表的头节点指向当前头节点地址间隔n个节点之后的地址;也即,以指针组为单位更新队列尾节点及存储器链表头节点;例如:当前队列尾节点的地址为2,新创建的指针组n=4,则更新所述队列尾节点的地址为6;当前存储器链表的头节点指向的地址为3,新创建的指针组n=4,则更新存储器链表的头节点指向地址7。
在一实施例中,所述依据新创建的指针组确定所述报文对应的第二存储地址,包括:
读取存储器链表头节点,获得的值作为新创建的指针组的基地址,将所述新创建的指针组的基地址与所述新创建的指针组中的偏移地址拼接后的地址作为所述报文对应的第二存储地址;
这里,由于是新创建的指针组,所以该指针组中的偏移地址为0。
步骤405:判断所述队列是否为新队列,如果是新队列执行步骤406;如果不是新队列,执行步骤408。
步骤406:更新所述队列的头节点及尾节点,并执行步骤409;
本步骤包括:更新所述队列的头节点的地址为存储器链表头节点指向的地址,并更新所述队列的尾节点的地址为所述存储器链表头节点指向的地址间隔n-1个节点后对应的地址;
本步骤之后,所述方法还包括:更新所述队列的描述符信息;这里,所述描述符信息包括队列头指针组、队列尾指针组、头指针组活动标记、尾指针组活动标记、队列空标记等;如图3所示。
步骤407:依据所述队列当前的指针组确定所述报文对应的第一存储地址,将所述报文存储至第一存储地址中,并执行步骤409;
这里,依据所述队列当前的指针组确定所述报文对应的第一存储地址包括:
依据所述队列当前的指针组中的基地址及偏移地址获取所述基地址及偏移地址拼接后的地址,所述拼接后的地址为所述报文对应的第一存储地址;例如:若当前的指针组中的基地址为10’b1,偏移地址为2’b10,将所述基地址及偏移地址拼接后的地址则为12’b110,即新地址是6;其中,10为数据位宽,b表示二进制;如此,通过队列当前的指针组确定所述报文对应的第一存储地址,并将报文存储至所述第一存储地址,减少了访问存储器链表节点的次数及管理RAM所需的带宽。
步骤408:更新所述队列的尾节点及存储器链表头节点;
本步骤包括:更新所述队列的尾节点的地址为所述存储器链表头节点指向的地址间隔n-1个节点后对应的地址,并更新存储器链表头节点指向下一个可用的地址,即更新存储器链表的头节点指向当前头节点地址间隔n个节点之后的地址;
本步骤之后,所述方法还包括:更新所述队列的描述符信息;这里,所述描述符信息包括队列头指针组、队列尾指针组、头指针组活动标记、 尾指针组活动标记、队列空标记等。
步骤409:结束本次处理流程。
实施例三
图5为本发明实施例中队列管理方法流程示意图;如图5所示,本发明实施例队列管理方法包括:
步骤501:接收报文的出队操作请求,并提取所述出队操作请求中的队列号。
步骤502:依据所述出队操作请求中的队列号将报文读出并更新所述队列对应的指针组;
本步骤包括:依据所述出队操作请求中的队列号读取所述队列的头节点,依据所述头节点获得报文的存储地址并将报文读出,更新所述队列对应的指针组中的基地址为所述队列的头节点中指针对应的地址,并相应的更新所述指针组中的偏移地址。
步骤503:判断所述队列当前的指针组中是否存在空指针组,如果存在,执行步骤504;如果不存在,执行步骤507;
这里,所述队列当前的指针组中存在空指针组包括两种情况:一种是所述队列仅有一个指针组,该指针组为空指针组;另一种是所述队列对应一个以上指针组,所述一个以上指针组中存在空指针组。
步骤504:更新所述队列的头节点、尾节点及存储器链表尾节点;
本步骤包括:更新所述队列的头节点为所述队列原头节点指向的下一个节点,更新队列尾节点为所述队列当前尾节点间隔n个节点之前的节点,即释放所述空指针组,回收所述空指针组对应的节点存储空间,更新存储器链表尾节点为所述队列原头节点,即所述队列更新前的头节点;通过控制指针组的释放及时性,提高了存储器链表节点存储空间的效率。
步骤505:判断所述队列是否为空队列,如果是空队列,执行步骤506; 否则,执行步骤507。
步骤506:更新所述队列描述符中的队列空标记。
步骤507:结束本次处理流程。
实施例四
图6为本发明实施例中队列管理装置组成结构示意图;如图6所示,本发明实施例中队列管理装置组成包括:入队模块61及出队模块62;其中,
所述入队模块61,配置为确定当前的操作请求为报文的入队操作请求,依据所述入队操作请求中的队列号确定无需为所述队列创建新的指针组时,依据所述队列当前的指针组确定所述报文对应的第一存储地址,将所述报文存储至第一存储地址中;或者,依据所述入队操作请求中的队列号确定需要为所述队列创建新的指针组时,为所述队列创建新的指针组并依据新创建的指针组确定所述报文对应的第二存储地址,将所述报文存储至第二存储地址中;
所述出队模块62,配置为确定当前的操作请求为报文的出队操作请求,依据所述出队操作请求中的队列号将报文读出并更新所述队列对应的指针组。
在一实施例中,所述入队模块61,还配置为按照指针组的方式初始化存储器链表;
这里,所述指针组为该指针组对应队列的n个节点对应的指针组成的集合;n为正整数,可以依据实际需要进行设置;所述指针组中每个指针都编号,所述编号按顺序排列;
所述入队模块61按照指针组的方式初始化存储器链表包括:
入队模块61按照顺序将存储器链表中当前地址中写入下一个节点的地址,即初始化时,地址0中的数据写1,地址1中的数据写2,直到地址N-1中的数据写0,如图2所示。
在一实施例中,所述入队模块61,还配置为判断当前的操作请求是报文的入队操作请求还是出队操作请求,如果是入队操作请求,提取所述入队操作请求中的队列号;如果是出队操作请求,触发出队模块62。
在一实施例中,所述入队模块61,配置为依据所述入队操作请求中的队列号确定所述队列非新队列且所述队列当前的指针组未满时,确定无需为所述队列创建新的指针组;以及依据所述入队操作请求中的队列号确定所述队列为新队列,或者所述队列当前的指针组已满时,确定需要为所述队列创建新的指针组。
在一实施例中,所述入队模块61,配置为依据所述队列当前的指针组中的基地址及偏移地址获取所述基地址及偏移地址拼接后的地址,所述拼接后的地址为所述报文对应的第一存储地址;例如:若当前的指针组中的基地址为10’b1,偏移地址为2’b10,将所述基地址及偏移地址拼接后的地址则为12’b110,即新地址是6;其中,10为数据位宽,b表示二进制;如此,通过队列当前的指针组确定所述报文对应的第一存储地址,并将报文存储至所述第一存储地址,减少了访问存储器链表节点的次数及管理RAM所需的带宽。
在一实施例中,所述入队模块61,配置为读取存储器链表头节点,获得的值作为新创建的指针组的基地址,将所述新创建的指针组的基地址与所述新创建的指针组中的偏移地址拼接后的地址作为所述报文对应的第二存储地址;
这里,由于是新创建的指针组,所以该指针组中的偏移地址为0。
在一实施例中,所述装置还包括第一更新模块63,配置为判断所述队列是否为新队列,如果是新队列,更新所述队列的头节点及尾节点;如果所述队列非新队列,更新所述队列的尾节点及存储器链表头节点;
其中,如果是新队列,第一更新模块63更新所述队列的头节点的地址 为存储器链表头节点指向的地址,并更新所述队列的尾节点的地址为所述存储器链表头节点指向的地址间隔n-1个节点后对应的地址;如果所述队列非新队列,第一更新模块63更新所述队列的尾节点的地址为所述存储器链表头节点指向的地址间隔n-1个节点后对应的地址,并更新存储器链表头节点指向下一个可用的地址,即更新存储器链表的头节点指向当前头节点地址间隔n个节点之后的地址。
在一实施例中,所述第一更新模块63,还配置为更新所述队列的描述符信息;这里,所述描述符信息包括队列头指针组、队列尾指针组、头指针组活动标记、尾指针组活动标记、队列空标记等;如图3所示。
在一实施例中,所述第一更新模块63,还配置为在所述入队模块61为所述队列创建新的指针组之后,更新所述队列的尾节点的地址为当前尾节点的地址间隔n个节点之后的地址,并更新存储器链表的头节点指向下一个可用的地址,即更新存储器链表的头节点指向当前头节点地址间隔n个节点之后的地址;也即,以指针组为单位更新队列尾节点及存储器链表头节点;例如:当前队列尾节点的地址为2,新创建的指针组n=4,则更新所述队列尾节点的地址为6;当前存储器链表的头节点指向的地址为3,新创建的指针组n=4,则更新存储器链表的头节点指向地址7。
在一实施例中,所述出队模块62,还配置为提取所述出队操作请求中的队列号。
在一实施例中,所述出队模块62,配置为依据所述出队操作请求中的队列号读取所述队列的头节点,依据所述头节点将报文读出,更新所述队列对应的指针组中的基地址为所述队列头节点中指针对应的地址,并相应的更新所述指针组中的偏移地址。
在一实施例中,所述装置还包括第二更新模块64,配置为判断所述队列当前的指针组中是否存在空指针组,如果存在,更新所述队列的头节点、 尾节点及存储器链表尾节点;
这里,所述队列当前的指针组中存在空指针组包括两种情况:一种是所述队列仅有一个指针组,该指针组为空指针组;另一种是所述队列对应一个以上指针组,所述一个以上指针组中存在空指针组;
所述第二更新模块64,配置为更新所述队列的头节点为所述队列原头节点指向的下一个节点,更新队列尾节点为所述队列当前尾节点间隔n个节点之前的节点,即释放所述空指针组,回收所述空指针组对应的节点存储空间,更新存储器链表尾节点为所述队列原头节点,即所述队列更新前的头节点;通过控制指针组的释放及时性,提高了存储器链表节点存储空间的效率。
在一实施例中,所述第二更新模块64,还配置为判断所述队列包含的节点是否为空,即所述队列是否为空队列,如果所述队列为空队列,更新所述队列描述符中的队列空标记。
本发明实施例中提出的所述入队模块61、出队模块62、第一更新模块63及第二更新模块64均可以通过处理器来实现,当然也可通过具体的逻辑电路实现;在实际应用中,处理器可以为中央处理器(CPU)、微处理器(MPU)或现场可编程门阵列(FPGA)等。
本发明实施例中,如果以软件功能模块的形式实现上述队列管理方法,并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机、服务器、或者网络设备等)执行本发明各个实施例所述方法的全部或部分。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read Only Memory,ROM)、磁碟或者光盘等各种可以存储程序代码的介质。这 样,本发明实施例不限制于任何特定的硬件和软件结合。
相应地,本发明实施例还提供一种计算机存储介质,该计算机存储介质中存储有计算机程序,该计算机程序用于执行本发明实施例的上述队列管理方法。
以上所述仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围。
工业实用性
本发明实施例确定当前的操作请求为报文的入队操作请求,依据所述入队操作请求中的队列号确定无需为所述队列创建新的指针组时,依据所述队列当前的指针组确定所述报文对应的第一存储地址,将所述报文存储至第一存储地址中;或者,依据所述入队操作请求中的队列号确定需要为所述队列创建新的指针组时,为所述队列创建新的指针组并依据新创建的指针组确定所述报文对应的第二存储地址,将所述报文存储至第二存储地址中;确定当前的操作请求为报文的出队操作请求,依据所述出队操作请求中的队列号将报文读出并更新所述队列对应的指针组。如此,通过指针组的实现方式,降低了链表节点存储空间,减少了访问链表节点的次数和管理RAM所需的带宽,在数据存储空间固定的情况下,提高了队列的管理能力,降低了成本。

Claims (15)

  1. 一种队列管理方法,所述方法包括:
    确定当前的操作请求为报文的入队操作请求,依据所述入队操作请求中的队列号确定无需为所述队列创建新的指针组时,依据所述队列当前的指针组确定所述报文对应的第一存储地址,将所述报文存储至第一存储地址中;或者,依据所述入队操作请求中的队列号确定需要为所述队列创建新的指针组时,为所述队列创建新的指针组并依据新创建的指针组确定所述报文对应的第二存储地址,将所述报文存储至第二存储地址中;
    确定当前的操作请求为报文的出队操作请求,依据所述出队操作请求中的队列号将报文读出并更新所述队列对应的指针组。
  2. 根据权利要求1所述方法,其中,所述依据所述入队操作请求中的队列号确定无需为所述队列创建新的指针组包括:
    依据所述入队操作请求中的队列号确定所述队列非新队列且所述队列当前的指针组未满时,确定无需为所述队列创建新的指针组;
    相应的,依据所述入队操作请求中的队列号确定需要为所述队列创建新的指针组包括:
    依据所述入队操作请求中的队列号确定所述队列为新队列或者所述队列当前的指针组已满时,确定需要为所述队列创建新的指针组。
  3. 根据权利要求1或2所述方法,其中,所述依据所述队列当前的指针组确定所述报文对应的第一存储地址包括:
    依据所述队列当前的指针组中的基地址及偏移地址获取所述基地址及偏移地址拼接后的地址,所述拼接后的地址为所述报文对应的第一存储地址。
  4. 根据权利要求1或2所述方法,其中,所述依据新创建的指针组确定所述报文对应的第二存储地址包括:
    读取存储器链表头节点,获得的值作为新创建的指针组的基地址,将所述新创建的指针组的基地址与所述新创建的指针组中的偏移地址拼接后的地址作为所述报文对应的第二存储地址。
  5. 根据权利要求1或2所述方法,其中,所述将所述报文存储至第二存储地址中之后,所述方法还包括:
    判断所述队列是否为新队列,如果是新队列,更新所述队列的头节点及尾节点;如果所述队列非新队列,更新所述队列的尾节点及存储器链表头节点。
  6. 根据权利要求1或2所述方法,其中,所述依据所述出队操作请求中的队列号将报文读出并更新所述队列对应的指针组,包括:
    依据所述出队操作请求中的队列号读取所述队列的头节点,依据所述头节点将报文读出,更新所述队列对应的指针组中的基地址为所述队列的头节点中指针对应的地址,并相应的更新所述指针组中的偏移地址。
  7. 根据权利要求1或2所述方法,其中,依据所述出队操作请求中的队列号将报文读出并更新所述队列对应的指针组之后,所述方法还包括:
    判断所述队列当前的指针组中是否存在空指针组,如果存在,更新所述队列的头节点、尾节点及存储器链表尾节点。
  8. 一种队列管理装置,所述装置包括:入队模块及出队模块;其中,
    所述入队模块,配置为确定当前的操作请求为报文的入队操作请求,依据所述入队操作请求中的队列号确定无需为所述队列创建新的指针组时,依据所述队列当前的指针组确定所述报文对应的第一存储地址,将所述报文存储至第一存储地址中;或者,依据所述入队操作请求中的队列号确定需要为所述队列创建新的指针组时,为所述队列创建新的指针组并依据新创建的指针组确定所述报文对应的第二存储地址,将所述报文存储至第二存储地址中;
    所述出队模块,配置为确定当前的操作请求为报文的出队操作请求,依据所述出队操作请求中的队列号将报文读出并更新所述队列对应的指针组。
  9. 根据权利要求8所述装置,其中,所述入队模块,配置为依据所述入队操作请求中的队列号确定所述队列非新队列且所述队列当前的指针组未满时,确定无需为所述队列创建新的指针组;以及依据所述入队操作请求中的队列号确定所述队列为新队列或者所述队列当前的指针组已满时,确定需要为所述队列创建新的指针组。
  10. 根据权利要求8或9所述装置,其中,所述入队模块,配置为依据所述队列当前的指针组中的基地址及偏移地址获取所述基地址及偏移地址拼接后的地址,所述拼接后的地址为所述报文对应的第一存储地址。
  11. 根据权利要求8或9所述装置,其中,所述入队模块,配置为读取存储器链表头节点,获得的值作为新创建的指针组的基地址,将所述新创建的指针组的基地址与所述新创建的指针组中的偏移地址拼接后的地址作为所述报文对应的第二存储地址。
  12. 根据权利要求8或9所述装置,其中,所述装置还包括第一更新模块,配置为判断所述队列是否为新队列,如果是新队列,更新所述队列的头节点及尾节点;如果所述队列非新队列,更新所述队列的尾节点及存储器链表头节点。
  13. 根据权利要求8或9所述装置,其中,所述出队模块,配置为依据所述出队操作请求中的队列号读取所述队列的头节点,依据所述头节点将报文读出,更新所述队列对应的指针组中的基地址为所述队列头节点中指针对应的地址,并相应的更新所述指针组中的偏移地址。
  14. 根据权利要求8或9所述装置,其中,所述装置还包括第二更新模块,配置为判断所述队列当前的指针组中是否存在空指针组,如果存在, 更新所述队列的头节点、尾节点及存储器链表尾节点。
  15. 一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,该计算机可执行指令用于执行权利要求1至7任一项所述的队列管理方法。
PCT/CN2016/081033 2015-06-15 2016-05-04 一种队列管理方法、装置及存储介质 Ceased WO2016202113A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510330212.0 2015-06-15
CN201510330212.0A CN106254270A (zh) 2015-06-15 2015-06-15 一种队列管理方法及装置

Publications (1)

Publication Number Publication Date
WO2016202113A1 true WO2016202113A1 (zh) 2016-12-22

Family

ID=57544968

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/081033 Ceased WO2016202113A1 (zh) 2015-06-15 2016-05-04 一种队列管理方法、装置及存储介质

Country Status (2)

Country Link
CN (1) CN106254270A (zh)
WO (1) WO2016202113A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118677859A (zh) * 2024-08-21 2024-09-20 格创通信(浙江)有限公司 一种报文入队方法、装置、网络芯片及存储介质

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109542615B (zh) * 2018-10-18 2020-11-10 深圳市景阳科技股份有限公司 一种可变节点通用队列的实现方法、装置及终端设备
CN109656515A (zh) * 2018-11-16 2019-04-19 深圳证券交易所 队列消息的操作方法、装置和存储介质
CN109783035A (zh) * 2019-02-28 2019-05-21 中国人民解放军陆军工程大学 一种基于大颗粒度存储单元的队列管理器及方法
CN111224896B (zh) * 2020-01-06 2022-06-24 苏州雄立科技有限公司 一种多指针报文管理方法及装置
CN117424865B (zh) * 2023-12-18 2024-07-30 南京华芯科晟技术有限公司 报文地址管理装置、网络处理芯片、报文读取及存储方法

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101605100A (zh) * 2009-07-15 2009-12-16 华为技术有限公司 队列存储空间的管理方法和设备
CN103262021A (zh) * 2010-12-21 2013-08-21 国际商业机器公司 用于网络处理器的缓冲器管理方案
CN103914341A (zh) * 2013-01-06 2014-07-09 中兴通讯股份有限公司 数据队列出队管控方法和装置

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102447610B (zh) * 2010-10-14 2015-05-20 中兴通讯股份有限公司 实现报文缓存资源共享的方法和装置
CN102130833A (zh) * 2011-03-11 2011-07-20 中兴通讯股份有限公司 一种高速路由器流量管理芯片链表存储管理方法及系统

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101605100A (zh) * 2009-07-15 2009-12-16 华为技术有限公司 队列存储空间的管理方法和设备
CN103262021A (zh) * 2010-12-21 2013-08-21 国际商业机器公司 用于网络处理器的缓冲器管理方案
CN103914341A (zh) * 2013-01-06 2014-07-09 中兴通讯股份有限公司 数据队列出队管控方法和装置

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118677859A (zh) * 2024-08-21 2024-09-20 格创通信(浙江)有限公司 一种报文入队方法、装置、网络芯片及存储介质

Also Published As

Publication number Publication date
CN106254270A (zh) 2016-12-21

Similar Documents

Publication Publication Date Title
WO2016202113A1 (zh) 一种队列管理方法、装置及存储介质
CN113535633B (zh) 一种片上缓存装置和读写方法
US10339079B2 (en) System and method of interleaving data retrieved from first and second buffers
EP3057272B1 (en) Technologies for concurrency of cuckoo hashing flow lookup
US10693787B2 (en) Throttling for bandwidth imbalanced data transfers
WO2016179968A1 (zh) 一种队列管理方法、装置及存储介质
US11425057B2 (en) Packet processing
US9584332B2 (en) Message processing method and device
US10205673B2 (en) Data caching method and device, and storage medium
WO2016011894A1 (zh) 报文处理方法和装置
US9112708B1 (en) Processing multicast packets in a network device
CN108319654A (zh) 计算系统、冷热数据分离方法及装置、计算机可读存储介质
WO2016202120A1 (zh) 一种队列存储空间管理方法及装置、计算机存储介质
CN103647726A (zh) 一种报文调度方法及装置
CN107025142A (zh) 一种线程间消息传递方法、装置及电子设备
WO2021008104A1 (zh) Tee系统中的数据传输方法和装置
CN105516023A (zh) 一种报文转发方法和装置
CN103902471B (zh) 数据缓存处理方法和装置
CN111181874B (zh) 一种报文处理方法、装置及存储介质
CN111984198A (zh) 消息队列实现方法、装置及电子设备
CN111131197B (zh) 一种过滤策略管理系统及其方法
CN103746940B (zh) 一种网络设备以及解包输出报文的方法
CN106682134A (zh) leveldb数据库中数据对写入的方法、装置及系统
US8898353B1 (en) System and method for supporting virtual host bus adaptor (VHBA) over infiniband (IB) using a single external memory interface
CN102098221A (zh) 一种报文查询方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16810854

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16810854

Country of ref document: EP

Kind code of ref document: A1