[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240819154125.GA22003@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net>
Date: Mon, 19 Aug 2024 08:41:25 -0700
From: Shradha Gupta <shradhagupta@...ux.microsoft.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: linux-hyperv@...r.kernel.org, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-rdma@...r.kernel.org,
"K. Y. Srinivasan" <kys@...rosoft.com>,
Haiyang Zhang <haiyangz@...rosoft.com>,
Wei Liu <wei.liu@...nel.org>, Dexuan Cui <decui@...rosoft.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
Long Li <longli@...rosoft.com>,
Ajay Sharma <sharmaajay@...rosoft.com>,
Simon Horman <horms@...nel.org>,
Konstantin Taranov <kotaranov@...rosoft.com>,
Souradeep Chakrabarti <schakrabarti@...ux.microsoft.com>,
Erick Archer <erick.archer@...look.com>,
Pavan Chebbi <pavan.chebbi@...adcom.com>,
Ahmed Zaki <ahmed.zaki@...el.com>,
Colin Ian King <colin.i.king@...il.com>,
Shradha Gupta <shradhagupta@...rosoft.com>
Subject: Re: [PATCH net-next v3] net: mana: Implement
get_ringparam/set_ringparam for mana
On Fri, Aug 16, 2024 at 06:58:05PM -0700, Jakub Kicinski wrote:
> On Fri, 16 Aug 2024 03:48:23 -0700 Shradha Gupta wrote:
> > + old_tx = apc->tx_queue_size;
> > + old_rx = apc->rx_queue_size;
> > + new_tx = clamp_t(u32, ring->tx_pending, MIN_TX_BUFFERS_PER_QUEUE, MAX_TX_BUFFERS_PER_QUEUE);
> > + new_rx = clamp_t(u32, ring->rx_pending, MIN_RX_BUFFERS_PER_QUEUE, MAX_RX_BUFFERS_PER_QUEUE);
>
> You can min(), the max side of clam is unnecessary. Core code won't let
> user requests above max provided by "get" thru.
>
oh okay, got it. Will change this
> > + if (!is_power_of_2(new_tx)) {
> > + netdev_err(ndev, "%s:Tx:%d not supported. Needs to be a power of 2\n",
> > + __func__, new_tx);
> > + return -EINVAL;
> > + }
>
> The power of 2 vs clamp is a bit odd.
> On one hand you clamp the values to what's supported automatically.
> On the other you hard reject values which are not power of 2.
> Why not round them up?
>
> IDK whether checking or auto-correction is better, but mixing the two
> is odd.
>
That seems right. I will round up the value to nearest power of two, in
the range. Thanks
> > + if (!is_power_of_2(new_rx)) {
> > + netdev_err(ndev, "%s:Rx:%d not supported. Needs to be a power of 2\n",
> > + __func__, new_rx);
>
> Instead of printing please use the extack passed in as an argument.
sure, working on it.
> --
> pw-bot: cr
Powered by blists - more mailing lists