All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta.com>
To: David Miller <davem@davemloft.net>
Cc: anirban.chakraborty@qlogic.com, netdev@vger.kernel.org,
	amit.salecha@qlogic.com
Subject: Re: [PATCH net-next 5/7] qlcnic: fix default operating state of interface
Date: Fri, 17 Jun 2011 12:00:12 -0700	[thread overview]
Message-ID: <20110617120012.6feb524d@nehalam.ftrdhcpuser.net> (raw)
In-Reply-To: <20110617.001035.1602476678651330954.davem@davemloft.net>

On Fri, 17 Jun 2011 00:10:35 -0400 (EDT)
David Miller <davem@davemloft.net> wrote:

> From: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
> Date: Thu, 16 Jun 2011 13:37:36 -0700
> 
> > From: Amit Kumar Salecha <amit.salecha@qlogic.com>
> > 
> > Currently interface shows status as RUNNING, even if there is no link.
> > To fix this, netif_carrier_off should be called after register_netdev().
> > 
> > netif_carrier_off calls linkwatch_fire_event(dev); only if netdev is registered,
> > otherwise it skips. linkwatch_fire_event set default state of nic interface.
> > 
> > Signed-off-by: Amit Kumar Salecha <amit.salecha@qlogic.com>
> > Signed-off-by: Anirban Chakraborty <anirban.chakraborty@qlogic.com>
> 
> You cannot do this.
> 
> The exact second that register_netdev() is called, the device can
> be brought up asynchronously and the link brought into the up state.
> 
> Your netif_carrier_off() call will race with this.
> 
> This is why no other (properly functioning) driver does what you're
> trying to do here.

The proper place to do this is in the open() routine.
When device is not open, the carrier state is undefined; and devices
that are trying to save power turn off PHY when device is not in use.

Therefore the open() routine should ensure that the carrier is in
the proper state when returning. Just doing something like:

static int qlcnic_open() {
...
	netif_carrier_off()

        err = __qlcnic_up();
	...
}

static int __qlcnic_up() {
	...
	(lots of tests)
	...

        netif_carrier_on();
	adapter->reset_context = 0;
	set_bit(__QLCNIC_DEV_UP, &adapter->state);
	return 0;
}

  reply	other threads:[~2011-06-17 19:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-16 20:37 [PATCH net-next 1/7] qlcnic: Add capability to take FW dump deterministically Anirban Chakraborty
2011-06-16 20:37 ` [PATCH net-next 2/7] qlcnic: Remove holding api lock while taking the dump Anirban Chakraborty
2011-06-16 20:37 ` [PATCH net-next 3/7] qlcnic: Add code to tune FW dump Anirban Chakraborty
2011-06-16 20:37 ` [PATCH net-next 4/7] qlcnic: fix initial number of msix entries in adapter Anirban Chakraborty
2011-06-16 20:37 ` [PATCH net-next 5/7] qlcnic: fix default operating state of interface Anirban Chakraborty
2011-06-17  4:10   ` David Miller
2011-06-17 19:00     ` Stephen Hemminger [this message]
2011-06-22  7:01       ` Amit Salecha
2011-06-20  4:14     ` Anirban Chakraborty
2011-06-16 20:37 ` [PATCH net-next 6/7] qlcnic: Add support to enable/disable FW dump capability Anirban Chakraborty
2011-06-16 20:37 ` [PATCH net-next 7/7] qlcnic: multi protocol internal loopback support added Anirban Chakraborty
2011-06-16 20:37 ` [PATCH net-next 0/7] qlcnic: Misc. fixes and loopback support Anirban Chakraborty

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=20110617120012.6feb524d@nehalam.ftrdhcpuser.net \
    --to=shemminger@vyatta.com \
    --cc=amit.salecha@qlogic.com \
    --cc=anirban.chakraborty@qlogic.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /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.