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

From: Jeff Garzik <[email-masked]>
Date: Fri, 15 Oct 2004 14:52:17 -0400

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