[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <MWHPR21MB0479BE1317BC37659BAE913CCAA60@MWHPR21MB0479.namprd21.prod.outlook.com>
Date: Wed, 19 Jul 2017 19:06:08 +0000
From: Haiyang Zhang <haiyangz@...rosoft.com>
To: Stephen Hemminger <stephen@...workplumber.org>,
KY Srinivasan <kys@...rosoft.com>,
Stephen Hemminger <sthemmin@...rosoft.com>
CC: "devel@...uxdriverproject.org" <devel@...uxdriverproject.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>
Subject: RE: [PATCH net-next 3/8] netvsc: change order of steps in setting
queues
> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen@...workplumber.org]
> Sent: Wednesday, July 19, 2017 2:53 PM
> To: KY Srinivasan <kys@...rosoft.com>; Haiyang Zhang
> <haiyangz@...rosoft.com>; Stephen Hemminger <sthemmin@...rosoft.com>
> Cc: devel@...uxdriverproject.org; netdev@...r.kernel.org
> Subject: [PATCH net-next 3/8] netvsc: change order of steps in setting
> queues
>
> This fixes the error unwind logic for incorrect number of queues.
> If netif_set_real_num_XX_queues failed then rndis_filter_device_add
> would have been called twice. Since input arguments are already
> ranged checked this is a hypothetical only problem, not possible
> in actual code.
>
> Signed-off-by: Stephen Hemminger <sthemmin@...rosoft.com>
> ---
> drivers/net/hyperv/netvsc_drv.c | 8 +++-----
> 1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/hyperv/netvsc_drv.c
> b/drivers/net/hyperv/netvsc_drv.c
> index e8e82a6a4b1a..91637336d1fb 100644
> --- a/drivers/net/hyperv/netvsc_drv.c
> +++ b/drivers/net/hyperv/netvsc_drv.c
> @@ -724,17 +724,15 @@ static int netvsc_set_queues(struct net_device
> *net, struct hv_device *dev,
> device_info.ring_size = ring_size;
> device_info.max_num_vrss_chns = num_chn;
>
> - ret = rndis_filter_device_add(dev, &device_info);
> - if (ret)
> - return ret;
> -
> ret = netif_set_real_num_tx_queues(net, num_chn);
> if (ret)
> return ret;
>
> ret = netif_set_real_num_rx_queues(net, num_chn);
> + if (ret)
> + return ret;
>
> - return ret;
> + return rndis_filter_device_add(dev, &device_info);
> }
The existing code has a bug here. After rndis_filter_device_add(),
the number of queues granted by the host may change:
net_device->num_chn = 1 +
init_packet->msg.v5_msg.subchn_comp.num_subchannels;
So we should call rndis_filter_device_add() first, then
assign net_device->num_chn to "real number tx queues".
Thanks,
- Haiyang
Powered by blists - more mailing lists