All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: Ilya Shchepetkov <shchepetkov@ispras.ru>
Cc: <bjorn@mork.no>, "David S. Miller" <davem@davemloft.net>,
	Ben Hutchings <bhutchings@solarflare.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	ldv-project@ispras.ru
Subject: Re: [PATCH 0/5] Call netif_carrier_off() after	register_netdev()
Date: Fri, 17 Aug 2012 09:20:02 -0700	[thread overview]
Message-ID: <20120817092002.191a8869@nehalam.linuxnetplumber.net> (raw)
In-Reply-To: <1345190143-12050-1-git-send-email-shchepetkov@ispras.ru>

On Fri, 17 Aug 2012 11:55:43 +0400
Ilya Shchepetkov <shchepetkov@ispras.ru> wrote:

> >> Ben Hutchings <bhutchings@solarflare.com> writes:
> >>> But if you do it beforehand then it doesn't have the intended effect.
> >>> (Supposed to be fixed by 22604c866889c4b2e12b73cbf1683bda1b72a313, which
> >>> had to be reverted: c276e098d3ee33059b4a1c747354226cec58487c.)
> >>>
> >>> So you have to do it after, but without dropping the RTNL lock in
> >>> between.
> >> So you may want to add something like
> >>
> >> int register_netdev_carrier_off(struct net_device *dev)
> >> {
> >>      int err;
> >>
> >>      rtnl_lock();
> >>      err = register_netdevice(dev);
> >>         if (!err)
> >>                 set_bit(__LINK_STATE_NOCARRIER, &dev->state)
> >>      rtnl_unlock();
> >>      return err;
> >> }
> >>
> >>
> >> for these drivers?
> 
> t looks like this variant is equivalent to the existing code:
> 
> 	netif_carrier_off(dev);
> 	err = register_netdev(dev);
> 	if (err)
> 		goto out;
> 
> According to explanation in commit 22604c866889c4b2e12b73cbf1683bda1b72a313,
> in this case "this causes these drivers to incorrectly report their
> link status as IF_OPER_UNKNOWN which can falsely set the IFF_RUNNING
> flag when the interface is first brought up".
> 
> As far as I understand, to fix the issue it is required to call
> netif_carrier_off() itself:
> 
> int register_netdev_carrier_off(struct net_device *dev)
> {
> 	int err;
> 
> 	rtnl_lock();
> 	err = register_netdevice(dev);
> 	if (!err)
> 		netif_carrier_off(dev);
> 	rtnl_unlock();
> 	return err;
> }
> 
> What do you think?

Does this prevent  multiple link events from being reported to user space?

If the root cause of the problem is the link status
(commit 22604c866889c4b2e12b73cbf1683bda1b72a313), then the kernel
should be fixed to do link status correctly.

>From an application point of view IFF_RUNNING is meaningless unless IFF_UP
is set.

      reply	other threads:[~2012-08-17 16:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-14 10:28 [PATCH 0/5] Call netif_carrier_off() after register_netdev() Ilya Shchepetkov
2012-08-14 10:28 ` [PATCH 1/5] sgi-xp: " Ilya Shchepetkov
2012-08-14 14:22   ` Robin Holt
2012-08-14 10:28 ` [PATCH 2/5] de2104x: " Ilya Shchepetkov
2012-08-14 10:28 ` [PATCH 3/5] net/mlx4_en: " Ilya Shchepetkov
2012-08-14 12:36   ` Sathya.Perla
2012-08-14 14:56     ` Ben Hutchings
2012-08-14 10:28 ` [PATCH 4/5] sungem: " Ilya Shchepetkov
2012-08-14 10:28 ` [PATCH 5/5] net/hyperv: " Ilya Shchepetkov
2012-08-14 15:32   ` Haiyang Zhang
2012-08-14 21:00 ` [PATCH 0/5] " David Miller
2012-08-14 22:47   ` Ben Hutchings
2012-08-15 11:40     ` Bjørn Mork
2012-08-17  7:55       ` Ilya Shchepetkov
2012-08-17 16:20         ` Stephen Hemminger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120817092002.191a8869@nehalam.linuxnetplumber.net \
    --to=shemminger@vyatta.com \
    --cc=bhutchings@solarflare.com \
    --cc=bjorn@mork.no \
    --cc=davem@davemloft.net \
    --cc=ldv-project@ispras.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=shchepetkov@ispras.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.