[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGVrzcYTtBm1EdXdyjV8-CmFH=JE0xdtsQGwSL9cqC4y5z2JKA@mail.gmail.com>
Date: Tue, 3 Jun 2014 09:29:24 -0700
From: Florian Fainelli <f.fainelli@...il.com>
To: Balakumaran Kannan <kumaran.4353@...il.com>
Cc: David Miller <davem@...emloft.net>,
Steve Glendinning <steve.glendinning@...well.net>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: Re: [PATCH 1/1] driver: net: smsc911x: set NOCARRIER flag in driver initialization
2014-06-03 7:15 GMT-07:00 Balakumaran Kannan <kumaran.4353@...il.com>:
> On Sat, May 31, 2014 at 2:12 AM, David Miller <davem@...emloft.net> wrote:
>> From: Balakumaran Kannan <kumaran.4353@...il.com>
>> Date: Fri, 30 May 2014 18:35:43 +0530
>>
>>> All these drivers call netif_carrier_off function after registering
>>> the network device using register_netdev.
>>
>> I can quote more counter-examples than your list, starting with the
>> Broadcom tg3 driver.
>
> Thank you David for this information. I'll send updated patch as version-2.
>
> Still I couldn't understand the reason behind this. I should be grateful if you
> would explain me little bit.
I believe one reason is that as soon as you call register_netdev(),
the network device notifiers run as part of call_netdevice_notifiers()
and it is valid for a notified callback to open your network device.
This means that you can call the driver's ndo_open() before you
returned from register_netdev(). If netif_carrier_off() is called
after register_netdev(), there is a risk for ndo_open() not to get a
consistent carrier state, and the actual call to netif_carrier_off()
to mess things up.
--
Florian
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists