Threading model

The default mode of operation is for io-pkt to create one thread per CPU.

The io-pkt stack is fully multithreaded at layer 2. However, only one thread may acquire the "stack context" for upper-layer packet processing. If multiple interrupt sources require servicing at the same time, these may be serviced by multiple threads. Only one thread will be servicing a particular interrupt source at any point in time. Typically an interrupt on a network device indicates that there are packets to be received. The same thread that handles the receive processing may later transmit the received packets out another interface. Examples of this are layer-2 bridging and the "ipflow" fastforwarding of IP packets.

The stack uses a thread pool to service events that are generated from other parts of the system. These events may be:

You can use a command-line option to the driver to control the priority at which the thread is run to receive packets. Client connection requests are handled in a floating-priority mode (i.e., the thread priority matches that of the client application thread accessing the stack resource manager).

Once a thread receives an event, it examines the event type to see if it's a hardware event, stack event, or "other" event:

This capability of having a thread change directly from being a hardware-servicing thread to being the stack thread eliminates context switching and greatly improves the receive performance for locally terminated IP flows.