Patent ID: 8638805

Claim:
A method of restructuring a scheduling hierarchy of a network processor having a plurality of processing modules and at least one shared memory with packet data, the scheduling hierarchy employed for scheduling one or more packets for transmission by the network processor, the method comprising: generating, by the network processor, one or more tasks corresponding to each of a plurality of received packets associated with one or more data flows; receiving, by a traffic manager of the network processor, a task corresponding to a data flow, the task provided by one of the plurality of processing modules of the network processor; determining, by the traffic manager, a queue of the scheduling hierarchy corresponding to the received task, the queue having a corresponding parent scheduler at each of one or more next levels of the scheduling hierarchy up to a root scheduler of the scheduling hierarchy, wherein the queue and one or more corresponding parent schedulers at each level of the scheduling hierarchy form a branch of the scheduling hierarchy; determining that the queue and one or more of the parent schedulers of the branch of the scheduling hierarchy associated with the received task should be restructured, and, in response: dropping subsequently received tasks for the queue and one or more corresponding parent schedulers in the branch of the scheduling hierarchy; draining all tasks of the queue and one or more parent schedulers; removing the queue and the one or more corresponding parent schedulers in the branch from the scheduling hierarchy; and deallocating memory space used in the at least one shared memory for packet data corresponding to the drained tasks, whereby the memory space is available for reallocation, whereby the structure of the scheduling hierarchy is modified by altering only the determined branch of the scheduling hierarchy.