A computer system can send packets from one system to another system over a network. The network generally includes a device such as a router that classifies and routes the packets to the appropriate destination. Often the device includes a control processor or network processor. Typically, the network processor includes multiple engines that process the network traffic. Each engine performs a particular task and includes a set of resources, for example, a control store for storing instruction code.
Referring to
Typically, a networking device 20 receives the data frames 18 on one or more input ports 22 that provide a physical link to the network 16. The networking device 20 passes the frames 18 to the network processor 28, which processes and passes the data frames 18 to a switching fabric 24. The switching fabric 24 connects to output ports 26 of the networking device 20. However, in some arrangements, the networking device 20 does not include the switching fabric 24 and the network processor 28 directs the data packets to the output ports 26. The output ports 26 are in communication with the network processor 28 and are used for scheduling transmission of the data to the network 16 for reception at the appropriate computer system 14. A data frame may be a packet, for example a TCP packet or IP packet.
Referring to
An engine can be single-threaded or multi-threaded (i.e., executes a number of threads). When an engine is multi-threaded, each thread acts independently as if there are multiple virtual engines. Each engine 46, 50, 54, and 58 (or the threads of a multi-threaded engine) includes a program pointer 48, 52, 56, and 60 that points to the location in the control store 72 of the code or instructions for a specific task. For example, the program pointer 52 of engine 50 points to a location in the control store 72 with instructions 66 for AAL5 processing.
During start-up of the system, engines 44, 50, 54, and 58 are assigned a program pointer that points to a specific code area in the unified control store 72. This configures each engine to perform a particular task. For example, in
The program pointers 48, 52, 56, and 60 for engines 44, 50, 54, and 58 can be dynamically reassigned. When a program pointer for a particular engine is reassigned, the task performed by the engine changes (e.g., the engine executes the instructions stored at the location in the control store pointed to by the pointer that was reassigned to another engine). A control mechanism 42 dynamically reassigns the pointers. The control mechanism 42 reassigns the pointers based on the packets received or based on other information such as engine processing load. The dynamic reassignment of program pointers for the engines allows dynamic allocation of tasks among the multiple engines without rebooting the network processor 28. In some examples, dynamic task allocation may provide advantages. For instance, dynamic reassignment allows the network processor 28 to operate efficiently because the workload can be distributed amongst all available resources.
In one example, the control mechanism 42 monitors the proportion of packets entering the network processor for different tasks. If the control mechanism 42 determines that a large percentage of the packets are AAL2 packets and a low percentage are AAL5 packets, the control mechanism 42 reassigns the program pointer 56 of engine 54 (or a pointer for another engine) to point to the AAL2 instruction set 66 in the control store 72. The control mechanism 42 monitors and reassigns program pointer, e.g., 52 to point to the control store location where AAL2 instructions are stored. Thus, the instructions used by the engine 50 will be instructions to process AAL2 packets and engine 50 will process the next AAL2 packet. The control mechanism waits until a task currently running on engine 50 is complete before changing the program pointer 52. The engine 50 continues to execute the same instruction pointed to by the program pointer 52 for different incoming data frames until the control mechanism 42 changes the program pointer 52 of the engine 50.
Referring to
Other engines in system 80 execute multiple threads. The threads for the engines are referred to collectively as a ‘pool of threads.’ Within the pool of threads, each thread is associated with a status register. The status of a thread is stored in a common area (accessible by the control mechanism), for example, the status register can be stored as bits in a central register of the network processor. Alternately, the bits used to indicate the status can be local to a thread or an engine and accessible such that the control mechanism can access to the status registers to determine when to assign tasks to the threads.
The status register indicates status of the particular thread with which the register is associated. For example, the register indicates if the thread is executing an instruction or if the thread is in an idle state. For example, status indications can include ‘IDLE’ and ‘BUSY’. An ‘IDLE’ status indicates that the engine or thread is in an idle state and not executing any function. A ‘BUSY’ state indicates that the engine or thread is currently executing a function. An additional status of ‘ASSIGNED’ can be kept in the status registers and used to indicate threads to which a packet has been allocated for processing, but for which the processing has not yet begun. The status register of the thread or engine is updated during processing to indicate the correct status for the thread.
System 80 also includes a memory 82 with a list 84 of ‘IDLE’ threads. Threads with an ‘IDLE’ status are included in the list 84 of ‘IDLE’ threads. Engine 86 references the list 84 to determine which threads in the pool of threads are available to process a packet.
For example, in
Some systems process packets differently based on a priority indication. If a priority system is used, a thread with an ASSIGNED status register can be preempted from processing the currently assigned packet to process a different packet with a higher priority. A thread with a ‘BUSY’ status, however, is generally not reassigned based on priority of another packet. Once the busy thread has finished executing the assigned task, the status register is set to ‘IDLE’. When the status is ‘IDLE’, another packet may be assigned to the thread for processing.
Referring to
Engine 86 searches 106 the memory 82 for a thread with an ‘IDLE’ status. Process 100 determines 108 if an ‘IDLE’ thread is found. If an ‘IDLE’ thread is not found, process 100 continues to search 106 the memory until an ‘IDLE’ thread is found. If an ‘IDLE’ thread is found, process 100 changes 110 the status of the thread from ‘IDLE’ to ‘ASSIGNED.’ Process 100 sends 112 a signal (e.g., a wakeup signal) to the thread and assigns 114 the PROTOCOL function to the thread's program counter. Since the program counter has been assigned, the thread's program counter now points to a particular function code in the unified control store 72 in
Referring to
Referring to
While in the examples above, four engines were shown, any number of engines could be used. While in the examples above, three status indications (idle, busy, and assigned) were described, other status indications could be used in addition to or instead of the described set of status indications.
A number of embodiments have been described, however, it will be understood that various modifications may be made. Accordingly, other embodiments are within the scope of the following claims.