1. Field of the Invention
The present invention relates to communication systems, in particular, to data caching and coherency maintenance for an accelerated processor architecture for packet networks.
2. Description of the Related Art
Network processors are generally used for analyzing and processing packet data for routing and switching packets in a variety of applications, such as network surveillance, video transmission, protocol conversion, voice processing, and internet traffic routing. Early types of network processors were based on software-based approaches with general-purpose processors, either singly or in a multi-core implementation, but such software-based approaches are slow. Further, increasing the number of general-purpose processors diminished performance improvements, or actually slowed down overall network processor throughput. Newer designs add hardware accelerators to offload certain tasks from the general-purpose processors, such as encryption/decryption, packet data inspections, and the like. These newer network processor designs are traditionally implemented with either i) a non-pipelined architecture or ii) a fixed-pipeline architecture.
In a typical non-pipelined architecture, general-purpose processors are responsible for each action taken by acceleration functions. A non-pipelined architecture provides great flexibility in that the general-purpose processors can make decisions on a dynamic, packet-by-packet basis, thus providing data packets only to the accelerators or other processors that are required to process each packet. However, significant software overhead is involved in those cases where multiple accelerator actions might occur in sequence.
In a typical fixed-pipeline architecture, packet data flows through the general-purpose processors and/or accelerators in a fixed sequence regardless of whether a particular processor or accelerator is required to process a given packet. This fixed sequence might add significant overhead to packet processing and has limited flexibility to handle new protocols, limiting the advantage provided by using the accelerators. Network processors implemented as a system on chip (SoC) having multiple processing modules might typically classify an incoming packet to determine which of the processing modules will perform operations for the particular packet or flow of packets.
A network processor in a switching network might provide transport of received data packets from an input port to one (unicast) or more (multicast) output ports of the network. Received data packets are provided to one or more output ports according to a scheduling algorithm. Traditionally, a network processor includes a traffic manager to schedule packets for transmission by the network processor based on a scheduling hierarchy. A scheduling hierarchy might be a tree structure of queues and schedulers. Each scheduler performs arbitration to pick an eligible child node for transmission in each scheduling cycle such that a packet is typically scheduled for transmission in each scheduling cycle of the network processor.
This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
Described embodiments provide for scheduling packets for transmission by a network processor. A traffic manager generates a tree scheduling hierarchy having a root scheduler and N scheduler levels. The network processor generates tasks corresponding to received packets. The traffic manager enqueues the received task in the associated queue. The queue has a corresponding scheduler level M, with a corresponding parent scheduler at each of M−1 levels in the scheduling hierarchy, where M is a positive integer less than or equal to N. In a single scheduling cycle, a parent scheduler selects a child node to transmit one or more tasks, and the child node responds whether the scheduling is accepted, and if so, with a number of tasks for scheduling. Starting at the parent scheduler and iteratively repeating at each scheduling level until reaching the root scheduler of the scheduling hierarchy, statistics corresponding to the selected node are updated. The traffic manager generates output packets corresponding to the scheduled tasks, thereby achieving a superscalar task scheduling throughput higher than the scheduling cycle of the traffic manager.
Other aspects, features, and advantages of the present invention will become more fully apparent from the following detailed description, the appended claims, and the accompanying drawings in which like reference numerals identify similar or identical elements.
Described embodiments of the present invention provide a Modular Traffic Manager (MTM) for a multi-core, multi-threaded network processor.
Table 1 defines a list of acronyms employed throughout this specification as an aid to understanding the described embodiments of the present invention:
I/O interface 104 might typically be implemented as hardware that connects network processor 100 to one or more external devices through I/O communication link 102. I/O communication link 102 might generally be employed for communication with one or more external devices, such as a computer system or networking device, which interface with network processor 100. I/O communication link 102 might be a custom-designed communication link, or might conform to a standard communication protocol such as, for example, a Small Computer System Interface (“SCSI”) protocol bus, a Serial Attached SCSI (“SAS”) protocol bus, a Serial Advanced Technology Attachment (“SATA”) protocol bus, a Universal Serial Bus (“USB”), an Ethernet link, an IEEE 802.11 link, an IEEE 802.15 link, an IEEE 802.16 link, a Peripheral Component Interconnect Express (“PCI-E”) link, a Serial Rapid I/O (“SRIO”) link, or any other interface link. Received packets are preferably placed in a buffer in shared memory 112 by transfer between I/O interface 104 and shared memory 112 through switch 110.
In embodiments of the present invention, shared memory 112 is a conventional memory operating as a cache that might be allocated and/or subdivided. For example, shared memory 112 might include one or more FIFO queues that might be dynamically allocated to the various μP cores 106 and hardware accelerators 108. External memory interface 114 couples shared memory 112 to one or more external memories, shown as external memory 116, to provide off-chip storage of data not needed by the various μP cores 106 and hardware accelerators 108 to free space in shared memory 112. The μP cores and hardware accelerators might interact with each other, for example, by one or more communication bus rings 118 that pass “tasks” from a source core to a destination core. As described herein, tasks are instructions to the destination core to perform certain functions, and a task might contain address pointers to data stored in shared memory 112, as described in related U.S. patent application Ser. Nos. 12/782,379, 12/782,393, and 12/782,411, all filed May 18, 2010, which are incorporated by reference herein.
Network processor 100 might typically receive data packets from one or more source devices, perform processing operations for the received data packets, and transmit data packets out to one or more destination devices. As shown in
The various μP cores 106 and hardware accelerators 108 of network processor 100 might include several exemplary types of processors or accelerators. For example, the various μP cores 106 might be implemented as Pentium® or Power PC® processors, or a combination of different processor types (Pentium® is a registered trademark of Intel Corporation, and Power PC® is a registered trademark of IBM). The various hardware accelerators 108 might include, for example, one or more function-specific modules, such as a Modular Packet Processor (MPP), a Packet Assembly Block (PAB), a Modular Traffic Manager (MTM), a Memory Management Block (MMB), a Stream Editor (SED), a Security Protocol Processor (SPP), a Regular Expression (RegEx) engine, and other special-purpose modules.
The SED is a software-driven accelerator that allows for editing of packets. The SED performs packet editing functions that might include adding and modifying packet headers as well as fragmenting or segmenting data (e.g., IP fragmentation). The SED receives packet data as well as parameters from tasks and a task specified per-flow state. The output of the SED can become the outgoing packet data and can also update task parameters.
The RegEx engine is a packet search engine for state-based cross-packet pattern matching. The RegEx engine is multi-threaded accelerator. An exemplary RegEx engine might be implemented such as described in U.S. Pat. Nos. 7,439,652 and 7,899,904, the teachings of which are incorporated by reference herein in their entireties.
The SPP provides encryption/decryption capabilities and is a command-driven hardware accelerator, preferably having the flexibility to handle protocol variability and changing standards with the ability to add security protocols with firmware upgrades. The ciphers and integrity (hash) functions might be implemented in hardware. The SPP has a multiple ordered task queue mechanism, discussed in more detail below, that is employed for load balancing across the threads.
The MMB allocates and frees memory resources in shared memory 112. Memory is allocated for such applications as task FIFO storage, packet data storage, hash-table collision handling, timer event management, and traffic manager queues. The MMB provides reference counts to each block of memory within shared memory 112. Multiple reference counts allow for more efficient storage of information, such as multicast traffic (data to be sent to multiple destinations) or for retransmission. Multiple reference counts remove a need for replicating data each time the data is needed. The MMB preferably tracks the memory allocations using a stack-based approach since a memory block recently released is preferably the next block to be allocated for a particular task, reducing cache trashing and cache tracking overhead. Blocks in shared memory 112 might be dynamically allocated by the MMB to store data, with the blocks in one of the following sizes: 256, 2048, 16384, and 65536 bytes. The MMB might operate substantially as described in related U.S. patent application Ser. No. 12/963,895 filed Dec. 9, 2010, which is incorporated by reference herein.
The PAB is a command driven hardware accelerator providing a holding buffer with packet assembly, transmit, retransmit, and delete capabilities. An incoming task to the PAB can specify to insert/extract data from anywhere in any assembly buffer. Gaps are supported in any buffer. Locations to insert and extract can be specified to the bit level. Exemplary traditional packet reassembly functions might be supported, such as IP defragmentation. The PAB might also support generalized holding buffer and sliding window protocol transmit/retransmit buffering, providing an offload for features like TCP origination, termination, and normalization. The PAB might operate substantially as described in related U.S. patent application Ser. No. 12/971,742 filed Dec. 17, 2010, which is incorporated by reference herein.
The MPP is a multi-threaded special purpose processor that provides tree based longest prefix and access control list classification. The MPP also has a hardware hash-based classification capability with full hardware management of hash-table additions, deletions, and collisions. Optionally associated with each hash entry is a timer that might be used under software control for tasks such as connection timeout and retransmission timing. The MPP contains a statistics and state management engine, which when combined with the hash table and timer facilities, provides support for state-based protocol processing. The MPP might support millions of flows, limited only by the amount of DRAM capacity assigned to the functions. The MPP architecture might be able to store all per thread states in memory instead of in register files. The MPP might operate substantially as described in related U.S. patent application Ser. No. 12/974,477 filed Dec. 21, 2010, Ser. Nos. 12/975,823, 12/975,880, 12/976,045, and 12/976,228 all filed Dec. 22, 2010, which are incorporated by reference herein. The MPP might also include hash functionality such as described in related U.S. patent application Ser. Nos. 13/046,717, 13/046,719, and 13/046,726 all filed Mar. 12, 2011, which are incorporated by reference herein.
As will be described herein, the MTM is a software-driven accelerator that provides packet scheduling and possibly up to six levels of scheduling hierarchy. The MTM might support millions of queues and schedulers (enabling per flow queuing if desired). The MTM might provide support for shaping and scheduling with smooth deficit weighted round robin (SDWRR) for every queue and scheduler. The MTM might also support multicasting. Each copy of a packet is scheduled independently and traverses down different virtual pipelines enabling multicast with independent encapsulations or any other processing. The MTM might also contain a special purpose processor that can be used for fine-grained control of scheduling decisions. The MTM might be used to make discard decisions as well as scheduling and shaping decisions.
As described in related U.S. patent application Ser. Nos. 12/782,379, 12/782,393, and 12/782,411, which are incorporated by reference herein, sub-caches 202(1)-202(N) might be addressed via switch 110 in such a way as to balance access to the caches, referred to herein as striping, helping to avoid hot spots in shared memory 112, improve performance of the caching in and out of external memory 116, and reduce cache access bottlenecks. Thus, in embodiments of the present invention, each sub-cache 202(1)-202(N) might form a memory array, and the number of system caches might preferably be implemented as a power of two. One or more memory blocks might be allocated to each sub-cache 202(1)-202(N). In embodiments of the present invention, each sub-cache 202(1)-202(N) might be implemented as an N-way associative cache employing a least recently used (LRU) caching algorithm. In some embodiments, each sub-cache 202(1)-202(N) might have a total size of 512 kB and a cache line length of 256 B.
As shown in
As shown in
As described herein, network processor 100 might generally send and receive data packets, for example, an IP packet, and each packet might have one or more corresponding tasks sent between processing modules of network processor 100 for processing of the packet data. As described herein, MTM 300 schedules data packets corresponding to the tasks for transmission from network processor 100 according to one or more rules (e.g., priorities, traffic shaping rules, etc.). As shown in
In some embodiments, input queue block 306 might include four input task queues (not shown). Two of the input task queues might be employed to queue low and high priority unicast packets, and the second pair of task queues might be employed to queue low and high priority multicast packets. This separation of unicast and multicast input queues is beneficial since multicast tasks typically take longer to enqueue than unicast tasks, since multiple copies of tasks are placed in corresponding queues for multicast tasks. MTM 300 queues tasks of the same type in the same task queue in order. MTM 300, via scheduler 310, might implement a programmable weighted round-robin service policy between the various task queues of input queue block 306. High priority task queues might generally be scheduled before low priority task queues. In some embodiments, the various queues in block 306 might be implemented as FIFO queues pointing to task data stored in system memory 210. Each FIFO might be implemented as one or more 2 KB blocks that can be dynamically linked to additional memory blocks, for example such as described in related U.S. patent application Ser. No. 13/046,717, filed Mar. 12, 2011. Further, scheduler 310 might typically support up to an N-level scheduling hierarchy. In general, L1 cache 313 might include up to N separate L1 cache modules, one for each hierarchy level of scheduler 310, where each L1 cache module operates substantially as described in related U.S. patent application Ser. No. 13/192,140, filed Jul. 27, 2011. In an exemplary embodiment, N might be 7. Task read module 326 might read data corresponding to tasks from system memory 210 and interface with task ring interface 324, interface 314 and scheduler 310.
Queues might typically exist at any level of scheduling hierarchy 400 other than the root level, which might only contain schedulers to subsequent levels of hierarchy 400. In described embodiments of scheduling hierarchy 400, any node in the hierarchy might have up to 64 k child nodes. Root scheduler 402 and each scheduler 406 in scheduling hierarchy 400 arbitrates between the children of this particular scheduler to pick a task to be scheduled for transmission by MTM 300. Further, root scheduler 402 and each scheduler 406 perform traffic shaping for the particular scheduling node to shape the traffic to a particular rate. In some embodiments, each scheduler 406 and root scheduler 402 might selectably perform Smooth Deficit Weighted Round Robin (SDWRR), Deficit Weighted Round Robin (DWRR) or Strict Priority arbitration between queues 404 and schedulers 406 under it.
For a received unicast task, MTM 300 places at most one task in one of its queues in block 306. For each unicast task, the previous processing module in the virtual pipeline for the task (e.g., the one of accelerators 108 that provides the task to MTM 300) provides MTM 300 with a queue ID for the task to be placed in, for example a queue identified by flow ID field 504. For unicast tasks, virtual pipeline ID field 506 might be employed to correct packet length for scheduling of a packet corresponding to the task, for example by adding or subtracting the number of bytes corresponding to the value of field 506. In some embodiments, shared parameter index field 508 might include a pointer index to an entry in a shared parameter table of MTM 300 to run script data corresponding to the task.
The shared parameter table might be stored in one or more L1 caches 313 of MTM 300. The one or more L1 caches 313 of MTM 300 might operate substantially as described in related U.S. patent application Ser. Nos. 13/192,104 and 13/192,187, both filed Jul. 27, 2011. The shared parameter table might include one or more parameters for processing the unicast task, for example, shared parameters can be used to store state data (for example, statistics of MTM 300 such as packet count or byte count) based on an input metric (for example, counting all packets originating from a single port destined to a given queue of MTM 300). When MTM 300 receives a unicast task, a template merge operation is performed on the task that extracts MTM-specific fields from the task (e.g., command type field 502, flow ID field 504, and virtual pipeline ID field 506) and determines a queue for the task (e.g., a queue ID value from flow ID field 504). Buffer manager 302 also determines if MTM 300 can accept the new task for scheduling, for example if the queue of scheduling hierarchy 400 corresponding to the task is not filled beyond a threshold. If the task is accepted, the task is placed at the tail end of the corresponding MTM queue identified by flow ID field 504. If the task cannot be accepted by a queue of scheduling hierarchy 400, the task might be dropped and removed from the MTM pipeline. The threshold decision to determine whether a task can or cannot be accepted by a given queue might be performed by control software running on a microprocessor of network processor 100.
Expanded unicast tasks are tasks corresponding to unicast packets, but the task does not contain any a queue ID in flow ID field 504. Thus, the virtual pipeline down which the expanded unicast tasks were sent within network processor 100 terminates at MTM 300. MTM 300 determines one or more destination processing modules or a new virtual pipeline for the expanded unicast task. Multicast tasks are duplicated by multicaster 304 such that the task is stored in multiple queues of MTM 300 to be sent to multiple destinations. A multicast task includes a flow ID in field 504, which points to a sequence of expanded unicast flow IDs that are used when duplicating the task. Processing of unicast, expanded unicast, and multicast tasks might be performed by MTM 300 substantially as described in related U.S. patent application Ser. No. 13/232,422 filed Sep. 14, 2011, which is incorporated by reference herein.
Described embodiments might provide a reference count for data corresponding to a task. The reference count might correspond to a number of tasks, for example duplicate multicast tasks, that refer to the data. The reference count might incremented each time a task is duplicated corresponding to a multicast flow. However, in some embodiments, the reference count might not be incremented for each duplication of the task, but rather is incremented by n−1 for every n copies of the task. For example, in an exemplary embodiment, the reference count is incremented by 255 for the first duplication of the task, and is decremented by 256−number of copies for the last copy of the task. If there are more than 256 copies, then another increment is made for every 256th multicast copy.
At step 610, once a queue is reached in scheduling hierarchy 400, at step 614, a task from the head of the selected queue is selected, and at step 616, the selected task is scheduled for transmission by MTM 300. For example, by iteratively selecting, at each scheduling level up scheduling hierarchy 400 from the scheduler that is the direct parent of the queue to root scheduler 402, root scheduler 402 selects a task for transmission by MTM 300. When root scheduler 402 selects a task, corresponding task data might be read from system memory 210, for example as described in regard to
Considering the exemplary scheduling hierarchy shown in
At step 708, one or more lists corresponding to the parent scheduler(s) are updated corresponding to the received task. As will be described subsequently, lists such as an active task list and a pending task list might be employed to track the status of each node in scheduling hierarchy 400. At step 708, these lists might be updated to reflect the addition of the received task to the scheduling hierarchy. At step 710, statistics for each of the at least one parent schedulers are updated, such as the number of tasks under the scheduler, the amount of memory used, and one or more time values to determine an achieved scheduling rate for the corresponding child node. At step 712, task enqueue operation 606 ends. In some embodiments of the present invention, enqueue operation 606 might start at the queue level, and proceed upward through the scheduling hierarchy to root scheduler 402.
As indicated by the dashed lines for steps 702, 705 and 710, enqueue operation 606 might be substantially similar to a re-enqueue operation. As shown in
At step 806, if the actual packet scheduling rate determined at step 804 is not within a predetermined rate restriction for the corresponding scheduler and queue, then sub-process 614 continues to step 808. One or more predetermined rate restrictions might be set in a given system. For example, certain types of data traffic might be prioritized or de-prioritized, thus queues and/or schedulers corresponding to different types of traffic might have one or more corresponding rate restrictions to limit maximum packet/data throughput for given traffic types. At step 808, the difference between the actual packet scheduling rate determined at step 804 and the predetermined rate restriction is determined. This difference corresponds to an amount of time that the scheduler or queue should be removed from the scheduling hierarchy at step 810, such that queued tasks can not be scheduled from the given scheduler or queue. After the determined time elapses at step 810, the node exceeding the scheduling rate is re-enqueued in the scheduling hierarchy, for example by the re-enqueue operation shown in
When a task is available for scheduling at the top of scheduling hierarchy 400, the scheduler at the top level (e.g., root scheduler 402) schedules the task for transmission. As shown in
Considering the exemplary scheduling hierarchy shown in
Thus, as described herein, MTM 300 might perform an enqueue operation (
Described embodiments of MTM 300 might speculatively schedule, in a superscalar manner, more than one task in a clock cycle to achieve a scheduling rate higher than when scheduling a single task in the clock cycle. As described herein, embodiments of the present invention employ a scheduling hierarchy that is a tree structure of schedulers and queues. As described, each scheduler might have zero or more child schedulers 404 or queues 406, where schedulers are branch nodes and queues are leaf nodes of scheduler tree 400. Each queue 406 might comprise a linked list of tasks being processed by network processor 100. As described, when a task is received by MTM 300, the task is added to the tail end of a corresponding queue, and one or more parent schedulers corresponding to that queue are updated throughout the tree structure corresponding to the newly arrived task.
Described embodiments thus might increase the throughput of each scheduler in the scheduling hierarchy by scheduling multiple tasks in each scheduling cycle. Some embodiments might allow a parent scheduler to schedule multiple tasks from a child node (which can be either a scheduler or a queue) in each scheduling cycle. The child node responds to the parent scheduler indicating whether the scheduling of the tasks has been accepted, and if so, how many tasks are accepted. The number of scheduled tasks propagates through the scheduling hierarchy from the queue through its parent scheduler up to the root scheduler at the top of the scheduler hierarchy. Data structures are maintained at each scheduler and queue, and might be updated to reflect the updated task counter.
Referring to
A task dequeue operation, such as shown in
After step 908, a scheduling cycle is complete and the parent scheduler can begin a new scheduling cycle (e.g., at step 904). Also, on receiving a schedule message from the parent (e.g., at step 904), the child node starts its own scheduling cycle to communicate to its own child node corresponding to the scheduled task(s) (e.g., at step 904). Once a queue is reached as the child node (e.g., at step 910), characteristics about the data corresponding to the scheduled task, the data flow, and the destination receiver are determined (e.g., at step 912). For example, the queue might determine the actual amount of data corresponding to the scheduled task(s), the number of tasks that can be scheduled, and might indicate a desired data rate of the data flow and destination receiver. The corrected number of tasks to be scheduled is propagated through scheduling hierarchy 400 to update the number of tasks available for scheduling at each node.
Described embodiments provide a method of implementing byte accurate scheduling of tasks from a queue when the size of a packet corresponding to the task (e.g., the amount of data to be transmitted by MTM 300) is not known at the time of scheduling. Task scheduling rules such as shaping rates and arbitration rules are applied at each level of the hierarchy, and preferably these rules are applied in a byte accurate fashion. As described herein, queues are collections of tasks waiting to be scheduled at a specific rate and schedulers are any combination of queues and other schedulers. Described embodiments typically schedule queues or schedulers using a “default packet size” and then correct the various scheduler algorithms using a “task update” when the actual size of the packet being scheduled is known. The actual packet size might be greater than or less than the default packet size, and the task update might indicate the difference between the default packet size and the actual packet size.
When the scheduler runs, the default packet size might be used to perform traffic shaping and arbitration. In some embodiments, traffic shaping might be based on a desired data rate for traffic of a given queue or scheduler, and arbitration might be based on a Deficit Weighted Round Robin (DWRR) or a Smooth Deficit Weighted Round Robin (SDWRR), described subsequently. The scheduling proceeds down the scheduling hierarchy from the root scheduler to a chosen queue. Once a task is chosen from a queue, the data packet corresponding to the task is read from system memory 210, and the queue sends a task update message to each scheduler up to the root scheduler indicating the actual size of the packet data corresponding to the task. When the task update message is received by a scheduler, each scheduler updates its traffic shaping control data (e.g., leaky token buckets) and arbitration control data (e.g., DWRR buckets) to account for the difference between the default packet size and the actual packet size, for example at step 816 of task scheduling sub-process 614 of
In some embodiments, the default packet size might be set by control software running on a processor of network processor 100. Each scheduler includes an associated default packet data size value. The default packet data size might be employed to perform speculative read operations, as described subsequently. In embodiments of the present invention, the default packet data size value is defined for each scheduler as an integer multiple of 16 byte increments (e.g., N*16 B), where N is the default packet scale value of the scheduler. Further, the value of N might be set by control software of network processor 100.
As described herein, one or more schedulers within scheduling hierarchy 400 might employ a smooth deficit weighted round robin (SDWRR) arbitration algorithm. In some embodiments, SDWRR arbitration might be employed by root scheduler 402 to perform fast scheduling of tasks available at its children schedulers. Since root scheduler 402 schedules every task within MTM 300, root scheduler 402 beneficially schedules each task from a child as fast possible, and moves on to the next child that has tasks available for scheduling. To reduce the time required to schedule each task, root scheduler 402 beneficially employs relatively small data structures and little control logic to issue up to one new schedule every cycle.
At step 1006, root scheduler 402 determines whether the selected scheduler ID value is an active scheduler, for example by checking the active bit vector value corresponding to the selected scheduler. In some embodiments, root scheduler 402 might start at the lowest scheduler ID value and increment the value, proceeding upward to the highest scheduler ID value before returning to the lowest scheduler ID value, and so on, although other implementations are possible. At step 1006, if the selected child scheduler is inactive, SDWRR algorithm 1000 proceeds to step 1020, where the next scheduler is selected, and processing returns to step 1004 to check the status of the newly selected scheduler. At step 1006, if the selected child scheduler is active, SDWRR algorithm 1000 proceeds to step 1008.
At step 1008, if the child scheduler has been scheduled, but a response has not yet been sent to root scheduler 402, then the child scheduler is pending, and SDWRR algorithm 1000 proceeds to step 1014. At step 1014, root scheduler 402 waits for an acknowledgement signal from the child scheduler before processing the corresponding child scheduler. In some embodiments, root scheduler 402 might process other active children while waiting for a response from the corresponding child scheduler. At step 1018 the one or more status indicators corresponding to the selected scheduler are updated. If, at step 1008, the child scheduler is active, but no response is pending to root scheduler 402, then SDWRR algorithm 1000 proceeds to step 1010. At step 1010, if the selected child scheduler is backlogged, at step 1016, the selected scheduler might be moved to the tail end of the active scheduler list such that other child schedulers are selected before the backlogged scheduler is selected again. Alternatively, the selected scheduler might be moved off the active list and placed on a backlogged list. If, at step 1010, the selected child scheduler is not backlogged, at step 1012, one or more tasks from the selected child scheduler are scheduled for transmission by MTM 300. In general, root scheduler 402 might select one or more tasks from the child scheduler at the head of the active list.
Once a task is scheduled from a child scheduler at step 1012, at step 1018 the one or more status indicators corresponding to the selected scheduler are updated. For example, the selected child scheduler might remain in the active list (if it has not reached its corresponding arbitration limit and, thus, is not backlogged), or the selected child scheduler might be moved to the pending list (if a response to the scheduling of step 1012 is not yet received from the selected child scheduler), or the selected child scheduler might be added to a backlogged list (if the selected child scheduler is backlogged). In some embodiments, the pending list and backlogged list might be implemented as one list. When the child scheduler is added to the pending list, its arbitration limit might be restored, and the child scheduler is added back to the active list once it is below its corresponding shaping rate and it has tasks available for scheduling. If the active list becomes empty, the pending list might become active before the shaping rate is reached. If a child scheduler becomes empty, having no tasks left to schedule, the child scheduler ID value might be provided to timer and clock interface 320 for further processing. Once the status indicators are updated, SDWRR algorithm 1000 proceeds to step 1020, where the next scheduler is selected, and processing returns to step 1004 to check the status of the newly selected scheduler.
In an exemplary embodiment, root scheduler 402 might employ a 5-bit pointer indicating the next child scheduler to be selected from up to 32 child schedulers. To select a new child for scheduling, root scheduler 402 might search through the status bit vectors from the pointer value to the highest scheduler ID value to look for a next scheduler ID value having its corresponding active indicator set without having a corresponding pending indicator or backlogged indicator set (e.g., at steps 1004, 1006, 1008 and 1010). Upon scheduling a scheduler (e.g., at step 1012), the pointer value is updated to the next contiguous scheduler ID value from the selected scheduler (e.g., at step 1018). If no scheduler ID value between the pointer value and the highest scheduler ID value can be scheduled, then child schedulers having ID values between the lowest scheduler ID value and the pointer value can be selected for scheduling (e.g., at step 1012). This technique provides smoothness of the arbiter by providing every child scheduler with a chance to be scheduled before the same child scheduler can be picked for consecutive scheduling cycles.
At step 1012, root scheduler 402 sends a scheduling event to the selected scheduler (e.g., the scheduler having an ID value equal to base S1 scheduler ID+selected scheduler offset). The selected child scheduler sends a response to root scheduler 402 (e.g., at step 1014). In the response, the selected child scheduler might indicate that the child scheduler should become (1) backlogged and inactive (e.g., the child scheduler has reached its traffic shaping rate), (2) should become inactive and be removed from scheduling hierarchy 400 (e.g., the child scheduler has become empty), or (3) that the child scheduler should remain active (e.g., the child scheduler has not yet reached its traffic shaping rate and is not backlogged). Thus, SDWRR algorithm 1000 is weighted, in that each child scheduler indicates in its response whether it needs to be taken out of the arbitration due to constraints such as the shaping rate for that child, etc. Steps 1004, 1006, 1008, 1010, 1012 and 1018 might typically be performed in a single scheduling cycle of MTM 300, thereby achieving a fast scheduling rate compared to other SDWRR implementations requiring multiple tens or hundreds of cycles for each schedule operation.
Described embodiments track the number of tasks to be scheduled by each node in scheduling hierarchy 400 by localized message passing and a capped task count. Each node of scheduling hierarchy 400 reports “capped” task count value to its parent scheduler. Each node might employ a “parent view” data structure to track the task count previously reported to the parent scheduler. Each node of scheduling hierarchy 400 beneficially tracks how many tasks are under it, so scheduling occurs for each task. Since a given node might have several child nodes under it in its subtree of scheduling hierarchy 400, the number of tasks under a given parent node might be very large (several millions). Thus, maintaining an absolute packet count at every node of scheduling hierarchy 400 could require very large counters. Also, described enqueue (e.g.,
Each queue in scheduling hierarchy 400 might maintain an absolute task count. Each child node in scheduling hierarchy 400 communicates a “capped” task count to its corresponding parent scheduler. The “capped” task count might be equal to the task count of the child node, but might be limited to no greater than a fixed value. In some embodiments, the fixed value is 15, such that if the task count is less than or equal to 15, then the capped task count is equal to the actual number of tasks, otherwise, the task count is set to a maximum value of 15. Task counts are transferred between child nodes and parent nodes by localized handshake messages such that the task count is only transferred from a child to parent. Task count data is transferred from the bottom level of scheduling hierarchy 400 to the top of scheduling hierarchy 400 by local exchange of messages, one level at a time.
Each node of scheduling hierarchy 400 maintains a “parent view” data field. The parent view field specifies the task count of the child node from the parent scheduler's point of view (e.g., the task count reported by the child to the parent scheduler). The parent view task count might differ from the actual task count for one of several reasons: (i) the task count of the child node is capped at the maximum reported task count, (ii) the task count of the child node is below the capped value but the task count of the child node changed after the last handshake message to its parent scheduler, or (iii) the child node is being removed from scheduling hierarchy 400, for example, for traffic shaping.
During task enqueue operations (e.g.,
During task dequeue operations (e.g.,
Employing a capped task count at each parent scheduler level allows the counters at the parent levels to be bounded to known, relatively small values (and thus, an arbitrarily large counter is not required to support the several millions of tasks that could potentially be in a given scheduling branch). Further, local parent-child messaging to determine task counts at each level of scheduling hierarchy 400 beneficially de-centralizes the tracking of task counts. Employing the parent view data field allows updating the parent with a new task count value even if the corresponding scheduling operations are not complete.
Each scheduler in scheduling hierarchy 400 is a configurable arbiter and rate enforcer for tasks assigned to queues and child schedulers from one level to the next higher level of scheduling hierarchy 400. To achieve desired scheduling rates for multiple different traffic flows, scheduling hierarchy 400 might provide for up to N scheduling levels of queues and schedulers below root scheduler 402. In some embodiments, N is 6 levels for scheduling hierarchy 400. Each level in scheduler hierarchy 400 might have substantially similar characteristics (e.g., each scheduler 404 might operate substantially similarly and each queue node 406 might operate substantially similarly), while root scheduler 402 operates as a special case as described, for example, with regard to
As described herein, scheduling hierarchy 400 is a tree structure of schedulers at higher levels and queues as leaf nodes. A queue is a structure with a list of tasks that serves as an entry point for tasks into the scheduling hierarchy. A queue might exist at any level of the scheduling hierarchy, although in some embodiments, only schedulers might be children of root scheduler 402. In described embodiments, scheduling hierarchy 400 might be implemented as any hierarchical configuration (symmetric or asymmetric), up to hardware defined maximum level of schedulers, through static configuration and dynamic configuration updates during operation of network processor 100.
In described embodiments, queues might be added under any level of scheduling hierarchy 400 other than root scheduler 402, and the total number of queues in scheduling hierarchy 400 might be unlimited for practical purposes (e.g., several millions of queues), limited only by the maximum value of the queue ID value, and the size of system memory 210 for storing data corresponding to queued tasks. Queues might be dynamically added or deleted in scheduling hierarchy 400 during operation of network processor 100 by adding or removing a queue ID value from the active, pending and backlogged status indicators of the corresponding one or more parent schedulers. As described herein, schedulers might be added at any level of scheduling hierarchy 400 and consist of queues and schedulers under it. The number of schedulers supported by scheduling hierarchy 400 might also be relatively large (e.g., several millions). In some embodiments, each scheduler node might support a maximum of 64 k children queues and schedulers. Each level in the scheduling node performs two functions: (i) arbitrating between the children of this particular node to pick a winner for scheduling, and (ii) traffic shaping the particular node to a particular data rate. These functions might be performed by hardware logic circuits, or might be performed under software control using a traffic shaper script of MTM 300.
One or more configurable mapping tables are employed to map a received task to a flow ID to a given queue of scheduling hierarchy 400. The one or more configurable mapping tables might be dynamically created and updated during operation of network processor 100. During operation of network processor 100, scheduling hierarchy 400 might be populated with one or more schedulers and queues to receive incoming tasks. The amount of data stored in system memory 210 corresponding to tasks queued in scheduling hierarchy 400 changes during operation corresponding to the incoming and transmitted tasks. Scheduling hierarchy 400 might be modified dynamically during the runtime, for example, by draining a particular branch of scheduling hierarchy 400, or by adding a branch of one or more schedulers and queues to scheduling hierarchy 400. In described embodiments, the queue and scheduler data structures might be 64-byte data structures stored in system memory 210 to align with the line sizes of the memory and caching data structures. Queue Engine 308 performs the maintenance of the data structures of scheduling hierarchy 400 in system memory 210.
Each data flow has an associated ID value. In an exemplary embodiment, the flow ID is a 24-bit value where the upper 4 bits index into a level mapping table of MTM 300. The level mapping table defines the level of scheduling hierarchy 400 where the data flow should be queued, and includes a parent ID value, which is a pointer to a location in system memory 210 storing the data structure for the parent scheduler for the flow ID. The parent ID value and the lower 20-bits of the flow ID value determine the physical memory address of the corresponding scheduler data structure. Thus, the scheduling hierarchy allows for arbitrary configuration of queues, in terms of the number of queues at a given level of scheduling hierarchy 400, and the level of scheduling hierarchy 400 of the parent scheduler of the queue. In addition to hierarchy information, the scheduler data structures might also contain traffic shaping data such as constraints on the maximum peak and sustained data rates allowed for the particular node. The structures might also store state data, such as a time value for the last task transmission and an amount of system memory 210 used to store task data, for use in deciding when the node should be allowed for scheduling a next time.
For fully populated levels of hierarchy, a new queue might typically be inserted to the scheduling hierarchy at the lowest level (e.g., level 6, as shown in the exemplary hierarchy of
In described embodiments, each scheduler other than root scheduler 402 might selectably employ any arbitration algorithm, for example a Smooth Deficit Weighted Round Robin (SDWRR) such as shown in
In embodiments of the present invention, traffic shaping rates might selectably employ either a peak/sustained mode or a peak/minimum mode to enforce task scheduling traffic shaping of nodes of scheduling hierarchy 400. In the peak/sustained mode, each node might be assigned a corresponding peak rate and a corresponding sustained rate. In peak/minimum mode, each node might be assigned a corresponding peak rate and a corresponding minimum rate. In peak/sustained mode, if a traffic shaper of MTM 300 determines that a given node is scheduling tasks too fast, the traffic shaper might disallow the node from scheduling more tasks (e.g., by removing the child node from the corresponding parent's list for a predetermined time). In peak/minimum mode, if a given child node is scheduling tasks over the peak rate, the child node might be delayed from scheduling tasks for a predetermined amount of time. A separate calculation is performed based on the child's minimum rate that might allocate additional arbitration credits to the child at the rate of its minimum rate, such that the child is allowed to schedule tasks without going below a minimum rate.
Described embodiments provide a minimum rate guarantee for a node in scheduling hierarchy 400 employing a byte-based token bucket. When employing SDWRR or DWRR arbitration, the bandwidth available from the parent is distributed in the ratio of each child node's arbitration bucket weights. To guarantee a minimum rate at each child node, an amount of bandwidth might be reserved and then the remaining bandwidth might be distributed in the ratio of the bucket weights. The minimum rate guarantee for a given child node might be implemented by incrementing the child's arbitration token bucket by a determined amount at a rate corresponding to the guaranteed minimum rate. The amount that is added to the child's token bucket is determined by the computation: (time elapsed from last transmission) * desired minimum rate (expressed in bytes per time). By applying the compensation in bytes, the algorithm is independent of packet size that is being transmitted by network processor 100 corresponding to the various scheduled tasks to transmit whole packets that might be of arbitrary size.
Described embodiments account for differences in the scale of time and rate between the minimum rate and other rates implemented for the child, since the minimum rate might be much smaller than the child's peak rate. To account for varying rates, a credit to the arbitration bucket is performed in units of bytes and 8 bits of a byte fraction. In described embodiments, MTM 300 might typically support a 64 b time value that is available from a timer or clock of network processor 100 via timer and clock interface 320. Each increment of the clock might be called a “clock tick”. In some embodiments, a 24 b subset (“scaled clock”) of the 64 b time value might be selected to calculate timing for a given node of scheduling hierarchy 400. Which 24 b subsets are chosen is based on a scaling factor corresponding to the node, which might be set by control software of network processor 100. Each scheduling node might maintain a “last transmit time” value corresponding to a time value when the node was most recently scheduled by its parent scheduler.
To account for large variations between the minimum rate and the actual rate, some embodiments might also include an additional minimum rate scaling factor (8 b field) that might be employed to further scale time values used for minimum rate calculations. The desired guaranteed minimum rate might be set by control software of network processor 100 as a 16-bit field. For example, the 16-bit desired minimum rate value might correspond to the number of bytes that should be transmitted in 256 scaled time ticks, where the scaled time ticks is the elapsed time scaled according to the node's scaling factor and the additional minimum rate scaling factor.
In an exemplary embodiment, at steps 1304 and 1306, the elapsed time (delta time) is determined by the calculation: PCR delta time[31:0]=current timestamp[31:0]−last transmit time[31:0]. This calculates delta time in peak cell rate (PCR) time units. At steps 1310 and 1312, the credit value is determined by shifting the determined delta time by the minimum rate scaling factor: MCR delta time [23:0]=(PCR delta time >> min rate scaling factor)[23:0]+additional minimum rate delta time[7:0]. The additional minimum rate delta time value was stored based on a previous calculation (e.g., steps 1306 and 1310). This step shifts delta time to minimum cell rate (MCR) time units. Additionally, bucket value[31:0]=old bucket value[31:0]+(MCR delta time[23:8]* desired minimum rate[15:0])[31:0]. This step computes the arbitration bucket value in terms of bytes plus 8 bits of fraction. The fraction (lower 8 bits of the bucket value) and delta time fraction (lower 8 bits of the MCR delta time value) are stored in memory to use for a subsequent repetition of process 1300. The minimum rate (min rate) that is programmed is the number of bytes that can be transmitted in 256 scaled time units, where a scaled time unit is based on a minimum rate time scale.
Thus, described embodiments provide a method to guarantee a minimum rate for nodes in an arbitration mechanism of a packet-based network. Since the “credit” is calculated in bytes and added to a byte based token bucket, the scheduling node might still schedule a whole number of packets.
Described embodiments read task data for scheduled tasks from system memory 210. Task data might be of variable size. Described embodiments allow multiple threads of MTM 300 (e.g., tasks from multiple queues) to access system memory 210 to read the task data. Ordering is typically enforced on tasks from the same thread. Further, task data might be speculatively fetched from system memory 210 to provide higher throughput of MTM 300. As described herein, for each schedule operation, MTM 300 selects a queue to transmit one or more tasks (e.g., at step 616 of
The task read operation reads the task data for the task at the head of the scheduled task queue from system memory 210. As described herein, the queue contains the head pointer of the task queue in memory and contains the size of the task data of the task at the head of the queue. Task read operations might allow multiple threads (e.g., one queue per thread) to aggregate memory requests and sent multiple requests over one memory port to system memory 210. In some embodiments, task read operations might have up to 4 threads (4 queues) active at a time. The task data returned from system memory 210 could be out of order and is ordered through a re-order queue for each thread. Since a given queue structure might only know the size of the data for the task at the head of its queue, memory read requests might be issued speculatively, when possible, when the same queue sends multiple tasks back-to-back. Such a speculative read request avoids waiting for data corresponding to the first task to return from system memory 210 before knowing the size of the data for the task behind it. Described embodiments provide a task read operations with multiple threads with speculative read operations and ordering enforcement on returned data for each thread.
Speculative read operations provide the advantage of avoiding a wait for the read of data for the task at the head of the queue to finish being read from system memory 210 before learning the actual size of data for the next task in the queue. When data for more than one task is read from system memory 210, the second and subsequent tasks are read speculatively, since the actual size of the task data is not known. The amount of data that is fetched from system memory 210 by the speculative read operation might be configurable, and thus tuned for a given traffic pattern. If the size of task data fetched during a speculative read is greater than the actual task size, the excess data might be used for the next task in the same queue, or the excess data might be discarded.
Task read operations update the head pointer of the queue after the read has been performed to point to the next task in the queue. Task read operations also update the task size field with the corresponding task data size of the new head of queue task. In some embodiments, tasks are stored in system memory 210, for example as shown in
Tasks might typically be stored in 2 KB blocks in system memory 210, and tasks might straddle 2 KB memory blocks. When a task straddles a memory block, the task data is parsed, and a next pointer field of the task is read, which is the last 16 B of the 2 KB block. This pointer is the location of the next memory read request. When all the read data comes back, the entire task becomes available.
At step 1712, if the speculative read operation returned the entire data for the speculatively read task(s), at step 1714, any extraneous data at the end of the speculatively read data is discarded, and at step 1720, process 1612 completes. Any left over scheduling credits (e.g., traffic shaping credits) might be used for a next speculative task read. At step 1712, if the speculative read operation did not return the entire data for the speculatively read task(s), at step 1716, the actual task data size for the speculatively read task is determined from the task header (e.g., the first 16 B of the task data). At step 1718, task read module 326 issues a read request for the remaining task data, where the read request is based on the actual task data size from the task header. At step 1720, step 1612 completes.
In described embodiments, for a speculative read request at step 1710, a read request of size N*16 B is issued for the task, where N is a configurable positive integer set by control software of network processor 100 (in some embodiments, N might default to 12). If there is any scheduling credit left from the previous speculative read, then a speculative read request for a subsequent task might be equal to (N*credit)*16 B. The speculative read computes the read address from the last read address and request size for that thread. If the speculative read data is more than the task, the remaining data might be discarded, or might be used for a next task. When a thread becomes empty, any left over data from speculative read operations might be discarded. Read data from system memory might be out of order and might be stored in a buffer for each thread such that the data might be re-ordered. Task read module 326 might select a thread to be read out in round robin fashion. As described herein, the queue structure contains the head pointer of the task queue in memory. The queue structure also contains the size of the task at the head of the queue. At step 1710, task read module 326 might update the head pointer of the queue after the read has been performed and update the task data size field that indicates the size of the task at the head of the queue. For this, the output task read block might read 16 extra bytes from memory to retrieve the header of the next task.
Described embodiments provide a method to drain packets from a part of a traffic manager scheduling hierarchy. The structure of scheduling hierarchy 400 might be altered when conditions in the network change. To alter the structure of scheduling hierarchy 400, MTM 300 might drain all the tasks associated with a queue, scheduler, or branch of scheduling hierarchy 400. When a scheduler is drained, the entire branch under the scheduler is drained of tasks. Described embodiments provide a method that: 1) stops enqueuing any tasks on the queues that are part of the hierarchy to be drained and waits to ensure all task enqueue operations on the part of the hierarchy to be drained are complete before starting the drain operation; 2) drains all tasks associated with a queue or scheduler (and the sub-tree underneath) in the hierarchy; 3) signals the end of steps (1) and (2) by generating an interrupt to a control processor of network processor 100; 4) recovers all the memory used by drained tasks when executing step (2); and 5) executes steps (1) and (2) without affecting the rest of scheduler hierarchy 400.
At step 1514, MTM 300 determines whether all task enqueue operations are complete for the queue or scheduler branch to be drained. In some embodiments, MTM 300 might determine whether the task enqueue operations are complete for all tasks for the queue to be drained by monitoring task counts of scheduling nodes at three stages of the enqueue process: (1) monitor task count when tasks are received by MTM 300 (e.g., step 602 of
At step 1516, the queue or branch of scheduling hierarchy 400 to be drained is removed from scheduling hierarchy 400, and the tasks corresponding to the queue/branch are placed in a drain FIFO buffer of MTM 300. An indicator is set for a first drained task to indicate that a drain operation has been initiated (“first drain indicator”). A drain FSM inserts as many scheduling events into the pipeline of the given queue (and propagated up through scheduling hierarchy 400) as there are tasks in the drain FIFO. Each time the scheduling logic processes a drain packet, an indicator is set (“subsequent drain indicator”). The first task corresponding to the first drain indicator is scheduled normally at step 1516, although the memory and state indicators for the drained queue/branch are cleared up through scheduling hierarchy 400 at step 1518. Tasks corresponding to “subsequent drain indicators” are read from system memory 210 and dropped at step 1516. At step 1520, space used by drained tasks in system memory 210 is now available for reallocation. Task drain process 1522 completes at step 1522 once the drain FIFO is empty, the memory used in system memory 210 associated with the drained queue/branch is zero, or the linked list containing the children of the scheduler is empty.
In described embodiments, each node of scheduling hierarchy 400 maintains a scheduling data structure which includes various control data such as linked list pointers of the child nodes, statistics such as task count and memory used, characteristics such as the scheduling rate and scheduling algorithm, and various state indicators such as backpressure events and timer events. The state indicators might also include an indicator that a node is removed from the scheduling hierarchy (an “in-hierarchy indicator”).
During scheduling, when a node with available tasks is selected by its parent for scheduling, the parent checks the various state indicators to determine whether the particular node might be scheduled (e.g., at step 614 of
Any processing module in network processor 100 might generate a message directed for a particular node in scheduling hierarchy 400 to set or release the backpressure state. Described embodiments also allow any node at any level in the scheduling hierarchy to be controlled using backpressure (e.g., previously queues were the typical places where a backpressure might be applied). Since described embodiments provide the flexibility of a scheduler being backpressured, a partial tree from the scheduling hierarchy can be effectively backpressured and taken off-line for scheduling purposes.
Described embodiments provide a mechanism to dynamically control scheduling hierarchy 400 where one or more scheduling nodes have a backpressure or other timer event. A timer event is typically used to control the scheduling rates, for example to meet a traffic shaping constraint, and a backpressure event is usually caused by a resource availability constraint by a processing module of network processor 100 that receives tasks from MTM 300. When a scheduling node is subject to a backpressure or timer event, tasks from the corresponding scheduling node and its child nodes (if any) are prevented from being scheduled. When a scheduling node is released from a backpressure or timer event, tasks from the scheduling node and its child nodes (if any) become reavailable for scheduling (e.g., a re-enqueue operation as described in regard to
Described embodiments provide that corresponding data structures for each scheduling node maintain one or more status indicators to represent the state of backpressure and timer events and whether the node is available for scheduling. When a node is subject to a backpressure or timer event, the node is removed from the parent scheduler's list of active nodes to schedule. Queue and scheduler levels are encoded in their respective IDs, which enables detecting and directing of incoming requests for backpressure and timer events for the target ID. Any processing module (e.g., one of μP cores 106 or hardware accelerators 108) of network processor 100 might request a backpressure event for a particular scheduling node, for example if the processing module cannot accept another task from that node.
A scheduler might create a timer event if the scheduling rate for a particular scheduling node exceeds the constraints imposed on its rate (e.g., at steps 806 to 812 of
When scheduler logic encounters a node having its timer indicator or backpressure indicator set, the scheduler takes the node out of the scheduling hierarchy and sends a “response” message to its parent to remove this node from its parent's list of active nodes for scheduling. Thus, this node is no longer available for scheduling until a re-enqueue operation occurs (e.g., step 812).
At step 1810, once a backpressure release request or a timer release request is received by MTM 300 corresponding to the backpressure request or timer request received at step 1802, processing continues to step 1812. At step 1812, the scheduling data structure for the target scheduling node is read from one of system memory 210 to one of L1 caches 313. At step 1814, if the task count for the node is non-zero, then at step 1818, the corresponding backpressure and timer indicators are updated, and the node is re-enqueued in scheduling hierarchy 400, for example by updating the in-hierarchy status indicator. At step 1820, the updated scheduling data structure is written to system memory 210. At step 1822, backpressure and timer request process 1800 completes.
If, at step 1814, the node has a task count equal to zero, at step 1816, the corresponding backpressure and timer indicators are updated, but the node is not necessarily re-enqueued in scheduling hierarchy 400 until one or more tasks are enqueued in the node. At step 1820, the updated scheduling data structure is written to system memory 210. At step 1822, backpressure and timer request process 1800 completes. Process 1800 might be repeated at each parent level of scheduling hierarchy 400 above the requested node, such that task counts and status indicators at each parent level are updated accordingly to the received backpressure or timer request.
Thus, as described herein, embodiments of the present invention provide dynamic control of specific nodes in scheduling hierarchy 400 using backpressure and timer indicators. Nodes are removed from scheduling hierarchy 400 when backpressured or in a timer event, and nodes are added back in to scheduling hierarchy 400 when the backpressure or timer event is complete. A node at any level in scheduling hierarchy 400 might be controlled by the backpressure and timer events, and might be either a queue or a scheduler.
As described herein, in embodiments of scheduling hierarchy 400, each level in hierarchy requires the processing of enqueue and dequeue operations. State machines for the enqueue and dequeue operations might require exclusive accesses to one or more data structures of scheduling hierarchy 400 (e.g., the scheduling data structures) while still allowing read and write accesses to other data structures of scheduling hierarchy 400. As described, each node of scheduling hierarchy 400 generally interacts directly only with its parent node and child node(s). Changing the structure of scheduling hierarchy 400 (e.g., removing a branch or scheduling level, etc.) potentially requires updating multiple parent and child levels of scheduling hierarchy 400.
Scheduling hierarchy 400 includes one or more finite state machines (FSMs), for example in scheduler 310, to perform enqueue, dequeue, re-enqueue and scheduling operations. Each FSM typically might require exclusive access to the queue or scheduler data structure being processed. One or more entries in the corresponding scheduling data structures might be reserved for updates by the FSMs. Some entries might be exclusive to a given FSM, while others are shared among two or more FSMs. Further, to update its own reserved entries, an FSM might copy whole data structures without another FSM updating other bytes of that data structure in parallel. Apart from the FSMs, other accesses to these data structures are non-blocking. For the FSMs, the priority to access data structures, as well as interactions with parent and child node updates is defined to avoid architectural deadlock. The order of execution among various FSMs and functions enables fast hardware implementations of the scheduling FSMs.
As described herein, an enqueue FSM might perform a task enqueue operation (e.g., as shown in
A dequeue FSM might perform a task dequeue operation (e.g., as shown in
As described, re-enqueue operations might occur when a given node exceeds its scheduling rate, and the node is temporarily removed from scheduling hierarchy 400 for a computed time duration. After serving this duration, the node is added back to scheduling hierarchy 400 via a re-enqueue operation. This operation is similar to the enqueue operation except that, the number of tasks added back to the parent is the total number available at this node, and there is no new memory usage added to scheduling hierarchy 400.
A link operation occurs whenever an enqueue or dequeue operation is performed at a scheduler which adds to the tail of the linked list of active child nodes. The tail scheduler or queue receives a link message and updates its next pointer to the new tail. The parent waits for the completion message to go forward with the remaining part of its enqueue or dequeue operation.
In described embodiments, there is an L1 cache module (e.g., one of L1 caches 313) for each scheduler level (other than root scheduler 402) and one for the queue level of scheduling hierarchy 400. The enqueue FSM allocates the queue in the queue L1 cache at the start of the enqueue process. The enqueue operation starts at the queue level, and progressively works its way through the levels of scheduling hierarchy up to the root scheduler. The dequeue operation starts at the root scheduler and works its way through the scheduling hierarchy to the queue level (and eventually to the task). Based on the level of the parent of the queue, the scheduler's from parent level onwards is allocated by modules per level. Upon completion of enqueue operations, these entries in the L1 cache are de-allocated per level. The dequeue operation is similar to enqueue, with the difference being that it allocates the scheduler per level, starting from the first level of schedulers below root scheduler 402, proceeding to the queue level. After the end of a dequeue operation, all entries in the L1 cache are deallocated per level.
The re-enqueue operation starts at the level the particular node is in the scheduling hierarchy and progressively reaches root scheduler 402. The link operation is initiated by a scheduler level and competed either by its child scheduler at immediately lower than itself or by its child queue. Thus, each level might have one or more FSMs working for each of these operations simultaneously. An exemplary interaction for these operations for scheduling data structure accesses is as follows:
Thus, described embodiments provide a modularized and distributed hardware implementation of a high performance scheduler. A modularized implementation also provides flexibility in adding or subtracting a particular level (target level) in the scheduling hierarchy by simple connections between respective parent and child levels of the target level. This addition or subtraction might be done in hardware or software.
During enqueue and dequeue operations, the various FSMs might access one or more data structures stored in L1 caches 313, each data structure corresponding to a given queue or scheduler. Each data structure might have one or more data fields, where each data field might be reserved for modification by less than all of the FSMs, or might be generally available to all the FSMs. Therefore, embodiments of the present invention provide a method for allowing read-only write access or locked/mutually exclusive (mutex) access to one or more data fields of the data structures. Thus, flexible access to the data structures from one or more threads might be provided, while also maintaining data coherency across multiple operations.
As described herein, enqueue and re-enqueue operations (e.g.,
Other than enqueue, re-enqueue and dequeue operations, other FSMs of MTM 300 might access the various status and control data structure of the various nodes of scheduling hierarchy 400. For example, the amount of memory used by various tasks of a node might change during operation of MTM 300, or memory might be released from use at some time after a task has been dequeued, and a message to update the memory used might be propagated through scheduling hierarchy 400 as a background operation in addition to the regular scheduling operations. Additionally, one or more operations, such as buffer management and traffic shaping, might access various data fields from the control and status data structures. Lastly, during operation of MTM 300, various pointers corresponding to the memory blocks used by the corresponding task data might be updated, for example to indicate a new memory block is added to store task data (e.g., pointer data 1410 of
As described herein, the various control and status data structures of scheduling hierarchy 400 are stored in L1 caches 313. Queue engine 308 requests the data structures from L1 caches 313 on an as-needed basis. As described herein, data stored in system memory 210 might be stored in L1 caches 313 during processing. Described embodiments might provide four types of access for queue engine 308 to L1 caches 313: (1) simple read access, (2) simple write access, (3) locked read access, and (4) locked write access. Simple read access requests and simple write access requests are processed regardless of the status of a lock being placed on the requested data structure. Thus, a simple read access or a simple write access might correspond to data fields that modified by only one thread of MTM 300, since there would be no need to lock the data structure. A locked read access or a locked write access occurs only when the requested data structure is unlocked. The locked request updates a lock status of the data structure to provide exclusive access to data fields that might be modified by more than one thread of MTM 300, thus a need might exist to maintain data coherency between one or more thread operations of MTM 300.
In described embodiments, a lock of a data structure might vary in time from one cycle to typically multiple cycles of the network processor depending upon the nature of the locked access request. Similarly, a time gap between accesses to a lock from the same FSM, thread, or module of MTM 300 might be enforced as a configurable number of 0-M cycles of the network processor, where M is a positive integer.
Embodiments of the present invention provide two access arbiters (e.g., as part of queue engine 308 of
Address mutex arbiter 1902 might receive locked access requests from each source of MTM 300 that requires exclusive memory access (e.g., corresponding ones of FSMs 1904(1)-1904(Y) and QE FSMs 1908(1)-1908(X)). Each request might include the memory address requested and a priority field for indicating a priority level of the access request.
At step 2012, address mutex arbiter 1902 determines if any of the received requests for unique addresses are locked out by a prior access request, for example if one or more of the requested addresses are indicated as locked in the locked address table. If, at step 2012, one or more of the requested addresses are locked, at step 2014, the one or more access requests for one or more locked addresses might be queued. Process 2000 then proceeds to step 2016. If, at step 2012, none of the requested addresses are locked, process 2000 proceeds to step 2016. At step 2016, address mutex arbiter 1902 grants access to the one or more requested addresses of L1 caches 313 corresponding to the one or more requests that are not locked out by prior accesses. At step 2020, process 2000 completes. In some embodiments, the tests of steps 2006 and 2012 might occur in any order, or might occur substantially simultaneously.
In embodiments of the present invention, a lock grant (e.g., as granted at step 2016) is maintained either for a predetermined number of cycles of network processor 100, or might be unlocked when a release signal is received from the requestor. Thus, a lock grant might stay locked for one or more cycles of the network processor.
If, at step 2108, one or more of the queued requests are consecutive requests for the same address from the same source requestor, at step 2109, address mutex arbiter 1902 determines whether one or more lower priority requests are queued for the address. If, at step 2109, one or more lower priority requests are queued, at step 2110, address mutex arbiter 1902 disallows access by the consecutive request for each address, and grants access to a lower priority request for the address thus allowing a lower priority requestor to have a request processed after a release by the higher priority requestor, and preventing low priority requests from being locked out by high priority requests. After step 2110, process 2100 proceeds to step 2114. If, at step 2109, no lower priority requests are queued, at step 2111, address mutex arbiter 1902 allows access by the consecutive request for each address. If, at step 2108, none of the queued requests are consecutive requests for the same address from the same source requestor, at step 2112, the address mutex arbiter grants access for the one or more queued requests, for example by process 2000 as shown in
Thus, as described, embodiments of the present invention provide that simple read or write operations are granted access to L1 caches 313 by a simple arbitration process, such as strict priority or round robin, and one or more simple requests might be active for a given address simultaneously. Locked requests that enforce coherency might be granted access to L1 caches 313 based on the address of the request, followed by priority level for access requests to the same address, and then by history such that consecutive requests to the same address by the same requestor do not prevent access by a lower priority request. Multiple requests for unique addresses are processed simultaneously in parallel execution on one or more data structures in L1 caches 313, thus improving memory throughput, while also maintaining data coherency.
As described herein, referring to
Shared parameters are loaded into buffer manager 302 during a task enqueue operation (e.g., at step 704 as shown in
Thus, as described herein, embodiments of the present invention provide for scheduling packets for transmission by a network processor. A traffic manager generates a tree scheduling hierarchy having a root scheduler and N scheduler levels. The network processor generates tasks corresponding to received packets. The traffic manager enqueues the received task in the associated queue. The queue has a corresponding scheduler level M, with a corresponding parent scheduler at each of M−1 levels in the scheduling hierarchy, where M is a positive integer less than or equal to N. In a single scheduling cycle, a parent scheduler selects a child node to transmit one or more tasks, and the child node responds whether the scheduling is accepted, and if so, with a number of tasks for scheduling. Starting at the parent scheduler and iteratively repeating at each scheduling level until reaching the root scheduler of the scheduling hierarchy, statistics corresponding to the selected node are updated. The traffic manager generates output packets corresponding to the scheduled tasks, thereby achieving a superscalar task scheduling throughput higher than the scheduling cycle of the traffic manager.
Reference herein to “one embodiment” or “an embodiment” means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the invention. The appearances of the phrase “in one embodiment” in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments necessarily mutually exclusive of other embodiments. The same applies to the term “implementation.” As used in this application, the word “exemplary” is used herein to mean serving as an example, instance, or illustration. Any aspect or design described herein as “exemplary” is not necessarily to be construed as preferred or advantageous over other aspects or designs. Rather, use of the word exemplary is intended to present concepts in a concrete fashion.
While the exemplary embodiments of the present invention have been described with respect to processing blocks in a software program, including possible implementation as a digital signal processor, micro-controller, or general purpose computer, the present invention is not so limited. As would be apparent to one skilled in the art, various functions of software might also be implemented as processes of circuits. Such circuits might be employed in, for example, a single integrated circuit, a multi-chip module, a single card, or a multi-card circuit pack.
Additionally, the term “or” is intended to mean an inclusive “or” rather than an exclusive “or”. That is, unless specified otherwise, or clear from context, “X employs A or B” is intended to mean any of the natural inclusive permutations. That is, if X employs A; X employs B; or X employs both A and B, then “X employs A or B” is satisfied under any of the foregoing instances. In addition, the articles “a” and “an” as used in this application and the appended claims should generally be construed to mean “one or more” unless specified otherwise or clear from context to be directed to a singular form.
Moreover, the terms “system,” “component,” “module,” “interface,”, “model” or the like are generally intended to refer to a computer-related entity, either hardware, a combination of hardware and software, software, or software in execution. For example, a component may be, but is not limited to being, a process running on a processor, a processor, an object, an executable, a thread of execution, a program, and/or a computer. By way of illustration, both an application running on a controller and the controller can be a component. One or more components may reside within a process and/or thread of execution and a component may be localized on one computer and/or distributed between two or more computers.
As used herein in reference to an element and a standard, the term “compatible” means that the element communicates with other elements in a manner wholly or partially specified by the standard, and would be recognized by other elements as sufficiently capable of communicating with the other elements in the manner specified by the standard. The compatible element does not need to operate internally in a manner specified by the standard.
Also for purposes of this description, the terms “couple,” “coupling,” “coupled,” “connect,” “connecting,” or “connected” refer to any manner known in the art or later developed in which energy is allowed to be transferred between two or more elements, and the interposition of one or more additional elements is contemplated, although not required. Conversely, the terms “directly coupled,” “directly connected,” etc., imply the absence of such additional elements. Signals and corresponding nodes or ports might be referred to by the same name and are interchangeable for purposes here.
Although the subject matter described herein may be described in the context of illustrative implementations to process one or more computing application features/operations for a computing application having user-interactive components the subject matter is not limited to these particular embodiments. Rather, the techniques described herein can be applied to any suitable type of user-interactive component execution management methods, systems, platforms, and/or apparatus.
The present invention can be embodied in the form of methods and apparatuses for practicing those methods. The present invention can also be embodied in the form of program code embodied in tangible media, such as magnetic recording media, optical recording media, solid state memory, floppy diskettes, CD-ROMs, hard drives, or any other non-transitory machine-readable storage medium, wherein, when the program code is loaded into and executed by a machine, such as a computer, the machine becomes an apparatus for practicing the invention. The present invention can also be embodied in the form of program code, for example, whether stored in a non-transitory machine-readable storage medium, loaded into and/or executed by a machine, or transmitted over some transmission medium or carrier, such as over electrical wiring or cabling, through fiber optics, or via electromagnetic radiation, wherein, when the program code is loaded into and executed by a machine, such as a computer, the machine becomes an apparatus for practicing the invention. When implemented on a general-purpose processor, the program code segments combine with the processor to provide a unique device that operates analogously to specific logic circuits. The present invention can also be embodied in the form of a bitstream or other sequence of signal values electrically or optically transmitted through a medium, stored magnetic-field variations in a magnetic recording medium, etc., generated using a method and/or an apparatus of the present invention.
It should be understood that the steps of the exemplary methods set forth herein are not necessarily required to be performed in the order described, and the order of the steps of such methods should be understood to be merely exemplary. Likewise, additional steps might be included in such methods, and certain steps might be omitted or combined, in methods consistent with various embodiments of the present invention.
It will be further understood that various changes in the details, materials, and arrangements of the parts which have been described and illustrated in order to explain the nature of this invention might be made by those skilled in the art without departing from the scope of the invention as expressed in the following claims.
This application claims the benefit of the filing date of U.S. provisional application No. 61/388,962, filed Oct. 1, 2010, the teachings of which are incorporated herein in their entireties by reference. This application is a continuation-in-part, and claims the benefit of the filing date, of U.S. patent application Ser. No. 12/782,379 filed May 18, 2010, Ser. No. 12/782,393 filed May 18, 2010, now issued as U.S. Pat. No. 8,255,644, and Ser. No. 12/782,411 filed May 18, 2010, now issued as U.S. Pat. No. 8,407,707, the teachings of which are incorporated herein in their entireties by reference. The subject matter of this application is related to U.S. patent application Ser. No. 12/430,438 filed Apr. 27, 2009 now issued as U.S. Pat. No. 8,352,669, Ser. No. 12/729,226 filed Mar. 22, 2010, Ser. No. 12/729,231 filed Mar. 22, 2010, now issued as U.S. Pat. No. 8,473,657, Ser. No. 12/963,895 filed Dec. 9, 2010, Ser. No. 12/971,742 filed Dec. 17, 2010, Ser. No. 12/974,477 filed Dec. 21, 2010, Ser. No. 12/975,823 filed Dec. 22, 2010, Ser. No. 12/975,880 filed Dec. 22, 2010, Ser. No. 12/976,045 filed Dec. 22, 2010, Ser. No. 12/976,228 filed Dec. 22, 2010, Ser. No. 12/979,551 filed Dec. 28, 2010, Ser. No. 12/979,665 filed Dec. 28, 2010, Ser. No. 12/979,800 filed Dec. 28, 2010, Ser. No. 13/046,717 filed Mar. 12, 2011, Ser. No. 13/046,719 filed Mar. 12, 2011, now issued as U.S. Pat. No. 8,321,385, Ser. No. 13/046,726 filed Mar. 12, 2011, Ser. No. 13/192,104 filed Jul. 27, 2011, Ser. No. 13/192,140 filed Jul. 27, 2011, Ser. No. 13/192,187 filed Jul. 27, 2011, Ser. No. 13/232,422 filed Sep. 14, 2011, Ser. No. 13/250,927 filed Sep. 30 2011, Ser. No. 13/250,898 filed Sep. 30,2011, Ser. No. 13/250,910 filed Sep. 30, 2011, Ser. No. 13/250,865 filed Sep. 30, 2011, Ser. No. 13/250,837 filed Sep. 30, 2011, Ser. No. 13/251,035 filed Sep. 30, 2011, Ser. No. 13/250,883 filed Sep. 30, 2011, Ser. No. 13/250,891 filed Sep. 30, 2011, Ser. No. 13/250,938 filed Sep. 30 2011, Ser. No. 13/250,948 filed Sep. 30, 2011, and Ser. No. 13/250,954 filed Sep. 30, 2011, the teachings of which are incorporated herein in their entireties by reference.
Number | Name | Date | Kind |
---|---|---|---|
4622631 | Frank et al. | Nov 1986 | A |
5623698 | Stephenson et al. | Apr 1997 | A |
5892766 | Wicki et al. | Apr 1999 | A |
5943283 | Wong et al. | Aug 1999 | A |
6038630 | Foster et al. | Mar 2000 | A |
6195335 | Calvignac et al. | Feb 2001 | B1 |
6216167 | Momirov | Apr 2001 | B1 |
6289013 | Lakshman et al. | Sep 2001 | B1 |
6341130 | Lakshman et al. | Jan 2002 | B1 |
6567564 | van der Wal | May 2003 | B1 |
6636932 | Regev et al. | Oct 2003 | B1 |
6914882 | Merani et al. | Jul 2005 | B2 |
7058057 | Dooley et al. | Jun 2006 | B2 |
7089346 | Cebulla et al. | Aug 2006 | B2 |
7159219 | Chen et al. | Jan 2007 | B2 |
7234018 | Purcell et al. | Jun 2007 | B1 |
7366728 | Corl et al. | Apr 2008 | B2 |
7397809 | Wang | Jul 2008 | B2 |
7453898 | Cohen et al. | Nov 2008 | B1 |
7461208 | Caprioli et al. | Dec 2008 | B1 |
7519065 | Angle et al. | Apr 2009 | B2 |
7596142 | MacAdam | Sep 2009 | B1 |
7600078 | Cen et al. | Oct 2009 | B1 |
7659894 | Keller et al. | Feb 2010 | B2 |
7720055 | Kadambi et al. | May 2010 | B2 |
7760747 | Dally et al. | Jul 2010 | B2 |
20020029214 | Yianilos et al. | Mar 2002 | A1 |
20020165985 | Chen et al. | Nov 2002 | A1 |
20030033276 | Cheng et al. | Feb 2003 | A1 |
20030115417 | Corrigan | Jun 2003 | A1 |
20030123468 | Nong | Jul 2003 | A1 |
20040255209 | Gross | Dec 2004 | A1 |
20050027920 | Fitzsimmons et al. | Feb 2005 | A1 |
20050152352 | Jun et al. | Jul 2005 | A1 |
20060029079 | Cohen et al. | Feb 2006 | A1 |
20060256783 | Ayrapetian et al. | Nov 2006 | A1 |
20070016756 | Hsieh et al. | Jan 2007 | A1 |
20070226798 | Sibert | Sep 2007 | A1 |
20080162793 | Chu et al. | Jul 2008 | A1 |
20080239992 | Krasnyanskiy | Oct 2008 | A1 |
20100260198 | Rojas-Cessa et al. | Oct 2010 | A1 |
Number | Date | Country |
---|---|---|
H02-271444 | Nov 1990 | JP |
Entry |
---|
Sundaram, Chandra, Goyal, Shenoy, Sahni, Vin. “Application Performance in the QLinux Multimedia Operating System”, ACM Multimedia, Los Angeles, CA (2000). |
Lu, Sheng, Dinda. “Size-based Scheduling Policies with Inaccurate Scheduling Information”, Proceedings of the IEEE Computer Society's 12th Annual International Symposium on Modeling, Analysis, and Simulation of Computer and Telecommunications Systems (2004). |
Schurgers, Raghunathan, Srivastava. “Modulation Scaling for Real-time Energy Aware Packet Scheduling”, IEEE, Nov. 2001. |
Number | Date | Country | |
---|---|---|---|
20120020371 A1 | Jan 2012 | US |
Number | Date | Country | |
---|---|---|---|
61388962 | Oct 2010 | US |
Number | Date | Country | |
---|---|---|---|
Parent | 12782379 | May 2010 | US |
Child | 13251091 | US | |
Parent | 12782393 | May 2010 | US |
Child | 12782379 | US | |
Parent | 12782411 | May 2010 | US |
Child | 12782393 | US |