[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <A1F3067C9B68744AA19F6802BAB8FFDC0DDFD867@TK5EX14MBXC223.redmond.corp.microsoft.com>
Date: Tue, 14 Aug 2012 15:32:34 +0000
From: Haiyang Zhang <haiyangz@...rosoft.com>
To: Ilya Shchepetkov <shchepetkov@...ras.ru>,
KY Srinivasan <kys@...rosoft.com>
CC: "David S. Miller" <davem@...emloft.net>,
"devel@...uxdriverproject.org" <devel@...uxdriverproject.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"ldv-project@...ras.ru" <ldv-project@...ras.ru>
Subject: RE: [PATCH 5/5] net/hyperv: Call netif_carrier_off() after
register_netdev()
> -----Original Message-----
> From: Ilya Shchepetkov [mailto:shchepetkov@...ras.ru]
> Sent: Tuesday, August 14, 2012 6:29 AM
> To: KY Srinivasan
> Cc: Ilya Shchepetkov; Haiyang Zhang; David S. Miller;
> devel@...uxdriverproject.org; netdev@...r.kernel.org; linux-
> kernel@...r.kernel.org; ldv-project@...ras.ru
> Subject: [PATCH 5/5] net/hyperv: Call netif_carrier_off() after
> register_netdev()
>
> For carrier detection to work properly when binding the driver with a
> cable unplugged, netif_carrier_off() should be called after
> register_netdev(), not before.
>
> Calling netif_carrier_off() before register_netdev() was causing the
> network interface to miss a linkwatch pending event leading to an
> inconsistent state if the link is not up when interface is initialized.
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Signed-off-by: Ilya Shchepetkov <shchepetkov@...ras.ru>
> ---
> drivers/net/hyperv/netvsc_drv.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/hyperv/netvsc_drv.c
> b/drivers/net/hyperv/netvsc_drv.c
> index 8c5a1c4..5734ad0 100644
> --- a/drivers/net/hyperv/netvsc_drv.c
> +++ b/drivers/net/hyperv/netvsc_drv.c
> @@ -416,9 +416,6 @@ static int netvsc_probe(struct hv_device *dev,
> if (!net)
> return -ENOMEM;
>
> - /* Set initial state */
> - netif_carrier_off(net);
> -
> net_device_ctx = netdev_priv(net);
> net_device_ctx->device_ctx = dev;
> hv_set_drvdata(dev, net);
> @@ -441,6 +438,9 @@ static int netvsc_probe(struct hv_device *dev,
> goto out;
> }
>
> + /* Set initial state */
> + netif_carrier_off(net);
> +
> /* Notify the netvsc driver of the new device */
> device_info.ring_size = ring_size;
> ret = rndis_filter_device_add(dev, &device_info);
Thanks.
Reviewed-by: Haiyang Zhang <haiyangz@...rosoft.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists