Re: NAPI Race?

From: P
Date: Wed Oct 08 2003 - 06:41:01 EST


Marko Rauhamaa wrote:
It looks to me like net_rx_action() might suffer from a race, which in
turn might explain some weirdness in my driver test results.

Here's the essence of the function from net/core/dev.c:

net_rx_action()
{
local_irq_disable();
while (!list_empty(&queue->poll_list)) {
local_irq_enable();
/* do stuff */
local_irq_disable();
}
local_irq_enable();
}

Say I receive a packet. net_rx_action() processes it in the while loop
and reenables interrupts. But just before net_rx_action() returns, I
receive another packet, and __netif_rx_schedule() gets called from the
driver. Then the soft irq is raised from within itself. If I'm not
interrupted for some other reason, the packet will get processed only at
the next jiffie when the soft irq is invoked again.

Am I mistaken?

Probably not, as I tested the reception timing
accuracy against an independent hardware "packet
timestamper", and out of 2 million packets,
3 were delayed by up to 5ms on the linux box
(e100 NAPI). There were about 10 packets delayed
between 1ms and 5ms.

Pádraig.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/