linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mlx4: set carrier off after register netdev
@ 2012-10-05 18:28 Min Zhang
  2012-10-05 20:53 ` Ben Hutchings
  0 siblings, 1 reply; 3+ messages in thread
From: Min Zhang @ 2012-10-05 18:28 UTC (permalink / raw)
  To: netdev; +Cc: linux-kernel

ifconfig mlx4_en port reported RUNNING even though the link was down.

mlx4_en_init_netdev didn't initialize the dev operstate properly so
the operstate stayed as default IF_OPER_UNKNOWN, then ifconfig treated
the UNKNOWN as RUNNING state for backward compatiblity per RFC2863.

The fix calls netif_carrier_off which is supposed to set operstate
after register_netdev. Calling it before register_netdev has no effect
since the dev->state is still NETREG_UNINITIALIZED

Tested by removing the physical link signal to the mellanox 10G port,
modprobe mlx4_en, then ifconfig up. Verify there is no RUNNING status.

Signed-off-by: Min Zhang <mzhang@mvista.com>
---
 drivers/net/ethernet/mellanox/mlx4/en_netdev.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
index c96113b..8c562f7a 100644
--- a/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
+++ b/drivers/net/ethernet/mellanox/mlx4/en_netdev.c
@@ -1306,12 +1306,12 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
 
 	mdev->pndev[port] = dev;
 
-	netif_carrier_off(dev);
 	err = register_netdev(dev);
 	if (err) {
 		mlx4_err(mdev, "Netdev registration failed for port %d\n", port);
 		goto out;
 	}
+	netif_carrier_off(dev);
 
 	en_warn(priv, "Using %d TX rings\n", prof->tx_ring_num);
 	en_warn(priv, "Using %d RX rings\n", prof->rx_ring_num);
-- 
1.7.7.4


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

* Re: [PATCH] mlx4: set carrier off after register netdev
  2012-10-05 18:28 [PATCH] mlx4: set carrier off after register netdev Min Zhang
@ 2012-10-05 20:53 ` Ben Hutchings
  2012-10-06  0:02   ` Min Zhang
  0 siblings, 1 reply; 3+ messages in thread
From: Ben Hutchings @ 2012-10-05 20:53 UTC (permalink / raw)
  To: Min Zhang; +Cc: netdev, linux-kernel

On Fri, 2012-10-05 at 11:28 -0700, Min Zhang wrote:
> ifconfig mlx4_en port reported RUNNING even though the link was down.
> 
> mlx4_en_init_netdev didn't initialize the dev operstate properly so
> the operstate stayed as default IF_OPER_UNKNOWN, then ifconfig treated
> the UNKNOWN as RUNNING state for backward compatiblity per RFC2863.
> 
> The fix calls netif_carrier_off which is supposed to set operstate
> after register_netdev. Calling it before register_netdev has no effect
> since the dev->state is still NETREG_UNINITIALIZED
> 
> Tested by removing the physical link signal to the mellanox 10G port,
> modprobe mlx4_en, then ifconfig up. Verify there is no RUNNING status.
[...]

This was supposed to be fixed by:

commit 8f4cccbbd92f2ad0ddbbc498ef7cee2a1c3defe9
Author: Ben Hutchings <bhutchings@solarflare.com>
Date:   Mon Aug 20 22:16:51 2012 +0100

    net: Set device operstate at registration time

Does that not work for mlx4_en, for some reason?

Ben.

-- 
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


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

* Re: [PATCH] mlx4: set carrier off after register netdev
  2012-10-05 20:53 ` Ben Hutchings
@ 2012-10-06  0:02   ` Min Zhang
  0 siblings, 0 replies; 3+ messages in thread
From: Min Zhang @ 2012-10-06  0:02 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: netdev, linux-kernel


On Fri, 5 Oct 2012, Ben Hutchings wrote:

> On Fri, 2012-10-05 at 11:28 -0700, Min Zhang wrote:
> > ifconfig mlx4_en port reported RUNNING even though the link was down.
> > 
> > mlx4_en_init_netdev didn't initialize the dev operstate properly so
> > the operstate stayed as default IF_OPER_UNKNOWN, then ifconfig treated
> > the UNKNOWN as RUNNING state for backward compatiblity per RFC2863.
> > 
> > The fix calls netif_carrier_off which is supposed to set operstate
> > after register_netdev. Calling it before register_netdev has no effect
> > since the dev->state is still NETREG_UNINITIALIZED
> > 
> > Tested by removing the physical link signal to the mellanox 10G port,
> > modprobe mlx4_en, then ifconfig up. Verify there is no RUNNING status.
> [...]
> 
> This was supposed to be fixed by:
> 
> commit 8f4cccbbd92f2ad0ddbbc498ef7cee2a1c3defe9
> Author: Ben Hutchings <bhutchings@solarflare.com>
> Date:   Mon Aug 20 22:16:51 2012 +0100
> 
>     net: Set device operstate at registration time
> 
> Does that not work for mlx4_en, for some reason?
> 
> Ben.
> 
> -- 
> Ben Hutchings, Staff Engineer, Solarflare
> Not speaking for my employer; that's the marketing department's job.
> They asked us to note that Solarflare product names are trademarked.
>

Indeed, commit 8f4cccbbd92f2ad0ddbbc498ef7cee2a1c3defe9 does fix the issue 
in mlx4. I didn't have the newest net/core. Therefore ignore my mlx4 fix. 

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

end of thread, other threads:[~2012-10-06  0:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-05 18:28 [PATCH] mlx4: set carrier off after register netdev Min Zhang
2012-10-05 20:53 ` Ben Hutchings
2012-10-06  0:02   ` Min Zhang

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).