netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: Strange uses of netif_start_queue
  2005-08-12 13:35 Strange uses of netif_start_queue Alan Cox
@ 2005-08-12 13:27 ` Ralf Baechle
  2005-08-12 13:39   ` Ralf Baechle
  2005-08-12 13:33 ` Patrick McHardy
  2005-08-12 18:00 ` David S. Miller
  2 siblings, 1 reply; 7+ messages in thread
From: Ralf Baechle @ 2005-08-12 13:27 UTC (permalink / raw)
  To: Alan Cox; +Cc: netdev

On Fri, Aug 12, 2005 at 02:35:14PM +0100, Alan Cox wrote:

> Something I noticed doing the tty work. the 6pack driver calls
> netif_start_queue() before it calls register_netdev. I'm curious if this
> is allowed ?

As part of adding support for extended 6pack which is required by the
PR 430 I've recently fixed that.  It was looking suspect enough that I
fixed it though I don't see any way this could do harm.

  Ralf

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Strange uses of netif_start_queue
  2005-08-12 13:35 Strange uses of netif_start_queue Alan Cox
  2005-08-12 13:27 ` Ralf Baechle
@ 2005-08-12 13:33 ` Patrick McHardy
  2005-08-12 18:00 ` David S. Miller
  2 siblings, 0 replies; 7+ messages in thread
From: Patrick McHardy @ 2005-08-12 13:33 UTC (permalink / raw)
  To: Alan Cox; +Cc: netdev

Alan Cox wrote:
> Something I noticed doing the tty work. the 6pack driver calls
> netif_start_queue() before it calls register_netdev. I'm curious if this
> is allowed ?

All netif_start_queue does is clear_bit(...), so it is a NOP at that
point. I guess it could be removed.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Strange uses of netif_start_queue
@ 2005-08-12 13:35 Alan Cox
  2005-08-12 13:27 ` Ralf Baechle
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Alan Cox @ 2005-08-12 13:35 UTC (permalink / raw)
  To: netdev

Something I noticed doing the tty work. the 6pack driver calls
netif_start_queue() before it calls register_netdev. I'm curious if this
is allowed ?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Strange uses of netif_start_queue
  2005-08-12 13:27 ` Ralf Baechle
@ 2005-08-12 13:39   ` Ralf Baechle
  2005-08-12 18:03     ` David S. Miller
  0 siblings, 1 reply; 7+ messages in thread
From: Ralf Baechle @ 2005-08-12 13:39 UTC (permalink / raw)
  To: Alan Cox; +Cc: netdev

On Fri, Aug 12, 2005 at 02:27:59PM +0100, Ralf Baechle wrote:

> > Something I noticed doing the tty work. the 6pack driver calls
> > netif_start_queue() before it calls register_netdev. I'm curious if this
> > is allowed ?
> 
> As part of adding support for extended 6pack which is required by the
> PR 430 I've recently fixed that.  It was looking suspect enough that I
> fixed it though I don't see any way this could do harm.

To answer the fundamental question, I think netif_start_queue /
netif_stop_queue should be allowed in case the driver for some reason has
the desire to stop queueing of packet immediately after register_netdev.

  Ralf

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Strange uses of netif_start_queue
  2005-08-12 13:35 Strange uses of netif_start_queue Alan Cox
  2005-08-12 13:27 ` Ralf Baechle
  2005-08-12 13:33 ` Patrick McHardy
@ 2005-08-12 18:00 ` David S. Miller
  2005-08-12 18:46   ` Thomas Graf
  2 siblings, 1 reply; 7+ messages in thread
From: David S. Miller @ 2005-08-12 18:00 UTC (permalink / raw)
  To: alan; +Cc: netdev

From: Alan Cox <alan@lxorguk.ukuu.org.uk>
Date: Fri, 12 Aug 2005 14:35:14 +0100

> Something I noticed doing the tty work. the 6pack driver calls
> netif_start_queue() before it calls register_netdev. I'm curious if this
> is allowed ?

It's definitely a bug, and when register_netdev() happens it will
just overwrite that change of state.

Since the queue is not initialized yet, this could also cause
a crash or hang. :-)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Strange uses of netif_start_queue
  2005-08-12 13:39   ` Ralf Baechle
@ 2005-08-12 18:03     ` David S. Miller
  0 siblings, 0 replies; 7+ messages in thread
From: David S. Miller @ 2005-08-12 18:03 UTC (permalink / raw)
  To: ralf; +Cc: alan, netdev

From: Ralf Baechle <ralf@linux-mips.org>
Date: Fri, 12 Aug 2005 14:39:05 +0100

> To answer the fundamental question, I think netif_start_queue /
> netif_stop_queue should be allowed in case the driver for some reason has
> the desire to stop queueing of packet immediately after register_netdev.

I disagree.  register_netdev() does not make packets start getting
queued, you have to up the interface for that to start occuring.
And your ->open() routine has full control over that.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Strange uses of netif_start_queue
  2005-08-12 18:00 ` David S. Miller
@ 2005-08-12 18:46   ` Thomas Graf
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Graf @ 2005-08-12 18:46 UTC (permalink / raw)
  To: David S. Miller; +Cc: alan, netdev

* David S. Miller <20050812.110034.63126875.davem@davemloft.net> 2005-08-12 11:00
> From: Alan Cox <alan@lxorguk.ukuu.org.uk>
> Date: Fri, 12 Aug 2005 14:35:14 +0100
> 
> > Something I noticed doing the tty work. the 6pack driver calls
> > netif_start_queue() before it calls register_netdev. I'm curious if this
> > is allowed ?
> 
> It's definitely a bug, and when register_netdev() happens it will
> just overwrite that change of state.
> 
> Since the queue is not initialized yet, this could also cause
> a crash or hang. :-)

Hmm, maybe I got something wrong but:

As you say correctly, there is no way we can queue packets until
the device has been put up, a device cannot be put up while it is
not present but that doesn't happen before register_netdevice()
so the value of the queue bit doesn't matter at all. Actually the
default state is indeed to have the queue running (bit set to 0)
so the mentioned netif_start_queue() is a simple nop as Patrick
noted already. It will _not_ be overwritten by a call to
register_netdevice() though which is a good thing: It allows the
queue to be stopped from the very beginning without a race between
register_netdevice() and the call to netif_stop_queue().

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2005-08-12 18:46 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-12 13:35 Strange uses of netif_start_queue Alan Cox
2005-08-12 13:27 ` Ralf Baechle
2005-08-12 13:39   ` Ralf Baechle
2005-08-12 18:03     ` David S. Miller
2005-08-12 13:33 ` Patrick McHardy
2005-08-12 18:00 ` David S. Miller
2005-08-12 18:46   ` Thomas Graf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).