[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZG2236VbHkOpjau2@corigine.com>
Date: Wed, 24 May 2023 09:03:59 +0200
From: Simon Horman <simon.horman@...igine.com>
To: Shradha Gupta <shradhagupta@...ux.microsoft.com>
Cc: linux-kernel@...r.kernel.org, linux-hyperv@...r.kernel.org,
netdev@...r.kernel.org, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
"K. Y. Srinivasan" <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Wei Liu <wei.liu@...nel.org>, Dexuan Cui <decui@...rosoft.com>,
Long Li <longli@...rosoft.com>,
Michael Kelley <mikelley@...rosoft.com>,
"David S. Miller" <davem@...emloft.net>
Subject: Re: [PATCH] hv_netvsc: Allocate rx indirection table size dynamically
On Tue, May 23, 2023 at 10:57:24PM -0700, Shradha Gupta wrote:
> Allocate the size of rx indirection table dynamically in netvsc
> from the value of size provided by OID_GEN_RECEIVE_SCALE_CAPABILITIES
> query instead of using a constant value of ITAB_NUM.
>
> Signed-off-by: Shradha Gupta <shradhagupta@...ux.microsoft.com>
Hi Shradha,
thanks for your patch.
> @@ -1548,6 +1548,21 @@ struct netvsc_device *rndis_filter_device_add(struct hv_device *dev,
> if (ret || rsscap.num_recv_que < 2)
> goto out;
>
> + if (rsscap.num_indirect_tabent &&
> + rsscap.num_indirect_tabent <= ITAB_NUM_MAX) {
nit: the line above is not indented correctly,
it should line up with the inside of the opening parentheses
on the preceding line.
Also, I don't think the curly-brackets are needed.
if (rsscap.num_indirect_tabent &&
rsscap.num_indirect_tabent <= ITAB_NUM_MAX) {
> + ndc->rx_table_sz = rsscap.num_indirect_tabent;
> + } else {
> + ndc->rx_table_sz = ITAB_NUM;
> + }
> +
> + ndc->rx_table = kzalloc(sizeof(u16) * ndc->rx_table_sz,
> + GFP_KERNEL);
> + if (ndc->rx_table) {
More importantly, it looks like the condition is inverted here.
Which seems unlikely to lead to anything good happening.
if (!ndc->rx_table) {
> + netdev_err(net, "Error in allocating rx indirection table of size %d\n",
> + ndc->rx_table_sz);
> + goto out;
> + }
> +
> /* This guarantees that num_possible_rss_qs <= num_online_cpus */
> num_possible_rss_qs = min_t(u32, num_online_cpus(),
> rsscap.num_recv_que);
> @@ -1558,7 +1573,7 @@ struct netvsc_device *rndis_filter_device_add(struct hv_device *dev,
> net_device->num_chn = min(net_device->max_chn, device_info->num_chn);
>
> if (!netif_is_rxfh_configured(net)) {
> - for (i = 0; i < ITAB_NUM; i++)
> + for (i = 0; i < ndc->rx_table_sz; i++)
> ndc->rx_table[i] = ethtool_rxfh_indir_default(
> i, net_device->num_chn);
> }
--
pw-bot: cr
Powered by blists - more mailing lists