netdev
[Top] [All Lists]

Re: [PATCH 2.6.9-rc2 2/8] S2io: sw bug fixes

To: Raghavendra Koushik <raghavendra.koushik@xxxxxxxx>
Subject: Re: [PATCH 2.6.9-rc2 2/8] S2io: sw bug fixes
From: Jeff Garzik <jgarzik@xxxxxxxxx>
Date: Fri, 15 Oct 2004 14:52:17 -0400
Cc: ravinandan.arakali@xxxxxxxx, "'Francois Romieu'" <romieu@xxxxxxxxxxxxx>, netdev@xxxxxxxxxxx, leonid.grossman@xxxxxxxx, rapuru.sriram@xxxxxxxx
In-reply-to: <200410141735.i9EHZJ39006121@xxxxxxxxxxxxxxxxx>
References: <200410141735.i9EHZJ39006121@xxxxxxxxxxxxxxxxx>
Sender: netdev-bounce@xxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20040922
Raghavendra Koushik wrote:
As I said the s2io_close can be called from stack or by the reset task. If
called from the task (or work) is it still Ok to flush all scheduled works?
[...]
I believe the best way to restart the NIC is to call s2io_close and
s2io_open sequentially.


Look at other drivers, e.g. drivers/net/tulip/tulip_core.c. You will see two levels of functions:

        tulip_open() -- net stack dev->open() hook
        tulip_close() -- net stack dev->stop() hook

        tulip_up() -- reset-and-start-hardware helper function
        tulip_down() -- stop-hardware helper function

If S2IO follows this model, all good.

If you have both the net stack and your own code directly calling the net stack dev->stop() hook, that will lead to problems. If you are doing this, you must _precisely duplicate_ the code in dev_close() in order to avoid races; but even then, you are really interfering with the code that synchronizes and manages reference-counted objects (struct net_device), which is unwise.

        Jeff



<Prev in Thread] Current Thread [Next in Thread>