* [PATCH] ibm_newemac: emac_close() needs to call netif_carrier_off() @ 2009-08-19 21:00 Petri Gynther 2009-08-19 21:11 ` Stephen Hemminger 2009-08-20 9:21 ` David Miller 0 siblings, 2 replies; 9+ messages in thread From: Petri Gynther @ 2009-08-19 21:00 UTC (permalink / raw) To: benh, davem; +Cc: netdev When ibm_newemac netdev instance is shutdown with "ifconfig down", the netdev interface does not go properly down. netif_carrier_ok() keeps returning TRUE even after "ifconfig down". The problem can be seen when ibm_newemac instances are slaves of a bonding interface. The bonding interface code uses netif_carrier_ok() to determine the link status of its slaves. When ibm_newemac slave is shutdown with "ifconfig down", the bonding interface won't detect any link status change because netif_carrier_ok() keeps returning TRUE. Signed-off-by: Petri Gynther <pgynther@google.com> --- drivers/net/ibm_newemac/core.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/net/ibm_newemac/core.c b/drivers/net/ibm_newemac/core.c index beb8421..f0f8908 100644 --- a/drivers/net/ibm_newemac/core.c +++ b/drivers/net/ibm_newemac/core.c @@ -1305,6 +1305,8 @@ static int emac_close(struct net_device *ndev) free_irq(dev->emac_irq, dev); + netif_carrier_off(ndev); + return 0; } -- 1.5.4.3 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] ibm_newemac: emac_close() needs to call netif_carrier_off() 2009-08-19 21:00 [PATCH] ibm_newemac: emac_close() needs to call netif_carrier_off() Petri Gynther @ 2009-08-19 21:11 ` Stephen Hemminger 2009-08-19 21:34 ` David Miller 2009-08-20 9:21 ` David Miller 1 sibling, 1 reply; 9+ messages in thread From: Stephen Hemminger @ 2009-08-19 21:11 UTC (permalink / raw) To: Petri Gynther; +Cc: benh, davem, netdev On Wed, 19 Aug 2009 14:00:00 -0700 (PDT) Petri Gynther <pgynther@google.com> wrote: > When ibm_newemac netdev instance is shutdown with "ifconfig down", > the netdev interface does not go properly down. netif_carrier_ok() > keeps returning TRUE even after "ifconfig down". > > The problem can be seen when ibm_newemac instances are slaves of > a bonding interface. The bonding interface code uses netif_carrier_ok() > to determine the link status of its slaves. When ibm_newemac slave is > shutdown with "ifconfig down", the bonding interface won't detect any > link status change because netif_carrier_ok() keeps returning TRUE. Bonding should be testing for netif_running() && netif_carrier_ok(). In many devices state of carrier is undefined when device is down. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] ibm_newemac: emac_close() needs to call netif_carrier_off() 2009-08-19 21:11 ` Stephen Hemminger @ 2009-08-19 21:34 ` David Miller 2009-08-19 21:40 ` Petri Gynther 0 siblings, 1 reply; 9+ messages in thread From: David Miller @ 2009-08-19 21:34 UTC (permalink / raw) To: shemminger; +Cc: pgynther, benh, netdev From: Stephen Hemminger <shemminger@vyatta.com> Date: Wed, 19 Aug 2009 14:11:36 -0700 > On Wed, 19 Aug 2009 14:00:00 -0700 (PDT) > Petri Gynther <pgynther@google.com> wrote: > >> When ibm_newemac netdev instance is shutdown with "ifconfig down", >> the netdev interface does not go properly down. netif_carrier_ok() >> keeps returning TRUE even after "ifconfig down". >> >> The problem can be seen when ibm_newemac instances are slaves of >> a bonding interface. The bonding interface code uses netif_carrier_ok() >> to determine the link status of its slaves. When ibm_newemac slave is >> shutdown with "ifconfig down", the bonding interface won't detect any >> link status change because netif_carrier_ok() keeps returning TRUE. > > Bonding should be testing for netif_running() && netif_carrier_ok(). > > In many devices state of carrier is undefined when device is down. But if you check all of the drivers, ethernet in particular, the convention is to call netif_carrier_off() in foo_close(). ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] ibm_newemac: emac_close() needs to call netif_carrier_off() 2009-08-19 21:34 ` David Miller @ 2009-08-19 21:40 ` Petri Gynther 2009-08-19 22:32 ` Petri Gynther 0 siblings, 1 reply; 9+ messages in thread From: Petri Gynther @ 2009-08-19 21:40 UTC (permalink / raw) To: David Miller; +Cc: shemminger, benh, netdev I agree with David. And, that's why I propose this diff for ibm_newemac driver as well. On Wed, Aug 19, 2009 at 2:34 PM, David Miller<davem@davemloft.net> wrote: > From: Stephen Hemminger <shemminger@vyatta.com> > Date: Wed, 19 Aug 2009 14:11:36 -0700 > >> On Wed, 19 Aug 2009 14:00:00 -0700 (PDT) >> Petri Gynther <pgynther@google.com> wrote: >> >>> When ibm_newemac netdev instance is shutdown with "ifconfig down", >>> the netdev interface does not go properly down. netif_carrier_ok() >>> keeps returning TRUE even after "ifconfig down". >>> >>> The problem can be seen when ibm_newemac instances are slaves of >>> a bonding interface. The bonding interface code uses netif_carrier_ok() >>> to determine the link status of its slaves. When ibm_newemac slave is >>> shutdown with "ifconfig down", the bonding interface won't detect any >>> link status change because netif_carrier_ok() keeps returning TRUE. >> >> Bonding should be testing for netif_running() && netif_carrier_ok(). >> >> In many devices state of carrier is undefined when device is down. > > But if you check all of the drivers, ethernet in particular, the > convention is to call netif_carrier_off() in foo_close(). > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] ibm_newemac: emac_close() needs to call netif_carrier_off() 2009-08-19 21:40 ` Petri Gynther @ 2009-08-19 22:32 ` Petri Gynther 2009-08-19 23:48 ` Stephen Hemminger 2009-08-20 6:02 ` Benjamin Herrenschmidt 0 siblings, 2 replies; 9+ messages in thread From: Petri Gynther @ 2009-08-19 22:32 UTC (permalink / raw) To: shemminger; +Cc: David Miller, benh, netdev Stephen, I think your suggestion of adding netif_running() check to bond_check_dev_link() is valid and a good fix to the bonding driver. We can do this in a separate patch. However, I think that the change to ibm_newemac: emac_close() is needed as well. ibm_newemac netdevs should not return netif_carrier_ok() == TRUE when they have been shut down. On Wed, Aug 19, 2009 at 2:40 PM, Petri Gynther<pgynther@google.com> wrote: > I agree with David. And, that's why I propose this diff for > ibm_newemac driver as well. > > On Wed, Aug 19, 2009 at 2:34 PM, David Miller<davem@davemloft.net> wrote: >> From: Stephen Hemminger <shemminger@vyatta.com> >> Date: Wed, 19 Aug 2009 14:11:36 -0700 >> >>> On Wed, 19 Aug 2009 14:00:00 -0700 (PDT) >>> Petri Gynther <pgynther@google.com> wrote: >>> >>>> When ibm_newemac netdev instance is shutdown with "ifconfig down", >>>> the netdev interface does not go properly down. netif_carrier_ok() >>>> keeps returning TRUE even after "ifconfig down". >>>> >>>> The problem can be seen when ibm_newemac instances are slaves of >>>> a bonding interface. The bonding interface code uses netif_carrier_ok() >>>> to determine the link status of its slaves. When ibm_newemac slave is >>>> shutdown with "ifconfig down", the bonding interface won't detect any >>>> link status change because netif_carrier_ok() keeps returning TRUE. >>> >>> Bonding should be testing for netif_running() && netif_carrier_ok(). >>> >>> In many devices state of carrier is undefined when device is down. >> >> But if you check all of the drivers, ethernet in particular, the >> convention is to call netif_carrier_off() in foo_close(). >> > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] ibm_newemac: emac_close() needs to call netif_carrier_off() 2009-08-19 22:32 ` Petri Gynther @ 2009-08-19 23:48 ` Stephen Hemminger 2009-08-20 6:02 ` Benjamin Herrenschmidt 1 sibling, 0 replies; 9+ messages in thread From: Stephen Hemminger @ 2009-08-19 23:48 UTC (permalink / raw) To: Petri Gynther; +Cc: David Miller, benh, netdev On Wed, 19 Aug 2009 15:32:41 -0700 Petri Gynther <pgynther@google.com> wrote: > Stephen, > > I think your suggestion of adding netif_running() check to > bond_check_dev_link() is valid and a good fix to the bonding driver. > We can do this in a separate patch. > > However, I think that the change to ibm_newemac: emac_close() is > needed as well. ibm_newemac netdevs should not return > netif_carrier_ok() == TRUE when they have been shut down. I concur. Fixing the possible problems in both places is best. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] ibm_newemac: emac_close() needs to call netif_carrier_off() 2009-08-19 22:32 ` Petri Gynther 2009-08-19 23:48 ` Stephen Hemminger @ 2009-08-20 6:02 ` Benjamin Herrenschmidt 2009-08-20 9:20 ` David Miller 1 sibling, 1 reply; 9+ messages in thread From: Benjamin Herrenschmidt @ 2009-08-20 6:02 UTC (permalink / raw) To: Petri Gynther; +Cc: shemminger, David Miller, netdev On Wed, 2009-08-19 at 15:32 -0700, Petri Gynther wrote: > Stephen, > > I think your suggestion of adding netif_running() check to > bond_check_dev_link() is valid and a good fix to the bonding driver. > We can do this in a separate patch. > > However, I think that the change to ibm_newemac: emac_close() is > needed as well. ibm_newemac netdevs should not return > netif_carrier_ok() == TRUE when they have been shut down. Well, we definitely don't do that in sungem either, since we continue the link polling while the interface is down... IE. interface up/down is the data path and is orthogonal to the PHY polling in sungem. I suppose we -could- stop the polling while the interface is down, though I think my initial implementation did only poll the link while the interface was up and that was causing endless problems with various laptop-net style tools (however that was years and years ago). Cheers, Ben. > On Wed, Aug 19, 2009 at 2:40 PM, Petri Gynther<pgynther@google.com> wrote: > > I agree with David. And, that's why I propose this diff for > > ibm_newemac driver as well. > > > > On Wed, Aug 19, 2009 at 2:34 PM, David Miller<davem@davemloft.net> wrote: > >> From: Stephen Hemminger <shemminger@vyatta.com> > >> Date: Wed, 19 Aug 2009 14:11:36 -0700 > >> > >>> On Wed, 19 Aug 2009 14:00:00 -0700 (PDT) > >>> Petri Gynther <pgynther@google.com> wrote: > >>> > >>>> When ibm_newemac netdev instance is shutdown with "ifconfig down", > >>>> the netdev interface does not go properly down. netif_carrier_ok() > >>>> keeps returning TRUE even after "ifconfig down". > >>>> > >>>> The problem can be seen when ibm_newemac instances are slaves of > >>>> a bonding interface. The bonding interface code uses netif_carrier_ok() > >>>> to determine the link status of its slaves. When ibm_newemac slave is > >>>> shutdown with "ifconfig down", the bonding interface won't detect any > >>>> link status change because netif_carrier_ok() keeps returning TRUE. > >>> > >>> Bonding should be testing for netif_running() && netif_carrier_ok(). > >>> > >>> In many devices state of carrier is undefined when device is down. > >> > >> But if you check all of the drivers, ethernet in particular, the > >> convention is to call netif_carrier_off() in foo_close(). > >> > > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] ibm_newemac: emac_close() needs to call netif_carrier_off() 2009-08-20 6:02 ` Benjamin Herrenschmidt @ 2009-08-20 9:20 ` David Miller 0 siblings, 0 replies; 9+ messages in thread From: David Miller @ 2009-08-20 9:20 UTC (permalink / raw) To: benh; +Cc: pgynther, shemminger, netdev From: Benjamin Herrenschmidt <benh@kernel.crashing.org> Date: Thu, 20 Aug 2009 16:02:22 +1000 > On Wed, 2009-08-19 at 15:32 -0700, Petri Gynther wrote: >> Stephen, >> >> I think your suggestion of adding netif_running() check to >> bond_check_dev_link() is valid and a good fix to the bonding driver. >> We can do this in a separate patch. >> >> However, I think that the change to ibm_newemac: emac_close() is >> needed as well. ibm_newemac netdevs should not return >> netif_carrier_ok() == TRUE when they have been shut down. > > Well, we definitely don't do that in sungem either, since we continue > the link polling while the interface is down... IE. interface up/down is > the data path and is orthogonal to the PHY polling in sungem. I suppose > we -could- stop the polling while the interface is down, though I think > my initial implementation did only poll the link while the interface was > up and that was causing endless problems with various laptop-net style > tools (however that was years and years ago). It just shows how few people use sungem with bonding :-) Short term I'm going to add the ibm_newemac change. Longer term we should probably add the netif_running() check to bond_check_dev_link(). ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] ibm_newemac: emac_close() needs to call netif_carrier_off() 2009-08-19 21:00 [PATCH] ibm_newemac: emac_close() needs to call netif_carrier_off() Petri Gynther 2009-08-19 21:11 ` Stephen Hemminger @ 2009-08-20 9:21 ` David Miller 1 sibling, 0 replies; 9+ messages in thread From: David Miller @ 2009-08-20 9:21 UTC (permalink / raw) To: pgynther; +Cc: benh, netdev From: Petri Gynther <pgynther@google.com> Date: Wed, 19 Aug 2009 14:00:00 -0700 (PDT) > When ibm_newemac netdev instance is shutdown with "ifconfig down", > the netdev interface does not go properly down. netif_carrier_ok() > keeps returning TRUE even after "ifconfig down". > > The problem can be seen when ibm_newemac instances are slaves of > a bonding interface. The bonding interface code uses netif_carrier_ok() > to determine the link status of its slaves. When ibm_newemac slave is > shutdown with "ifconfig down", the bonding interface won't detect any > link status change because netif_carrier_ok() keeps returning TRUE. > > Signed-off-by: Petri Gynther <pgynther@google.com> Applied, thanks. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2009-08-20 9:21 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-08-19 21:00 [PATCH] ibm_newemac: emac_close() needs to call netif_carrier_off() Petri Gynther 2009-08-19 21:11 ` Stephen Hemminger 2009-08-19 21:34 ` David Miller 2009-08-19 21:40 ` Petri Gynther 2009-08-19 22:32 ` Petri Gynther 2009-08-19 23:48 ` Stephen Hemminger 2009-08-20 6:02 ` Benjamin Herrenschmidt 2009-08-20 9:20 ` David Miller 2009-08-20 9:21 ` David Miller
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).