Network packet processing related Query

Sachin Rane SRane at alphion.com
Fri May 6 09:27:30 EDT 2011


Hi,

I want to improve my understanding about the logic of the code written
for 'process_backlog ()' .

File Source: net/core/dev.c,  linux-2.6.16

I am considering only Non-NAPI network devices ( > 1) in this
discussion.

The 'net_rx_action' function invokes 'dev->poll(dev, &budget)' for each
network device present in 'poll_list'. '
The default handler for Non-NAPI network devices is 'process_backlog
()'.

The signature of the function is:
static int process_backlog (struct net_device *backlog_dev, int *budget)

'backlog_dev' represents the device for which the 'poll' function is
invoked.

In the code body the function acts on CPU specific 'input_pkt_queue'.
This queue holds all the incoming packets from the network devices and
'poll_list' has reference for these network devices.

The function takes out one element (packet) from the 'input_pkt_queue'
and process the packet.

As the 'input_pkt_queue' is shared by all the network devices, the
'packet' which is popped-out from the list can be from any network
device not required to be from 'backlog_dev' (the device for which
'process_backlog' has been called).

I have confusion here.
The code doesn't operate only on the packets queued-in by 'backlog_dev'
to 'input_pkt_queue'. It pops-out the node from the queue and process
it. But it updates the 'quota' which is specific for the device
'backlog_dev' for which the function have got called.

Why it is so? Am I missing out something here?

Thanks for reading my mail patiently.

Regards,
Sachin Rane



More information about the Kernelnewbies mailing list