On Mon, 2007-07-23 at 21:07 -0700, David Miller wrote:
> Another area of consternation are drivers that were using
> netif_rx_reschedule(), as that interface was removed because it
> doesn't fit well with the caller managing the dev->quota et al.  I
> left race conditions in the drivers that were using that interface,
> but they should still basically work nonetheless.

Hmm, virtio does this, if the implementation returns false from
->restart.  But it's basically a bandaid for things like lguest which
don't check irq status on irq enable, hence is subject to the race.

But AFAICT netif_rx_reschedule() is implementable in a driver anyway.
What am I missing?

static void resched_me(struct work_struct *work)
{
        struct foo *foo = container_of(work, struct foo, work);

        irq_disable();
        netif_rx_schedule(foo->dev);
        irq_enable();
}

struct foo {
        ...;
        struct napi_struct napi;
        struct work_struct rescheduler;
};

int foo_poll(struct napi_struct *napi, int budget)
{
...
        enable_rx_interrupts();
        netif_rx_complete(napi);

        /* Broken interrupts, so we have race after enabling. */
        if (unlikely(ring_has_new_packet(dev)))
                schedule_work(&foo->rescheduler);
        return used;
}

Cheers,
Rusty.

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to