From: Jakub Kicinski <kuba@kernel.org>
To: Shradha Gupta <shradhagupta@linux.microsoft.com>
Cc: linux-hyperv@vger.kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org,
"K. Y. Srinivasan" <kys@microsoft.com>,
Haiyang Zhang <haiyangz@microsoft.com>,
Wei Liu <wei.liu@kernel.org>, Dexuan Cui <decui@microsoft.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>, Long Li <longli@microsoft.com>,
Ajay Sharma <sharmaajay@microsoft.com>,
Simon Horman <horms@kernel.org>,
Konstantin Taranov <kotaranov@microsoft.com>,
Souradeep Chakrabarti <schakrabarti@linux.microsoft.com>,
Erick Archer <erick.archer@outlook.com>,
Pavan Chebbi <pavan.chebbi@broadcom.com>,
Ahmed Zaki <ahmed.zaki@intel.com>,
Colin Ian King <colin.i.king@gmail.com>,
Shradha Gupta <shradhagupta@microsoft.com>
Subject: Re: [PATCH net-next v3] net: mana: Implement get_ringparam/set_ringparam for mana
Date: Fri, 16 Aug 2024 18:58:05 -0700 [thread overview]
Message-ID: <20240816185805.60e16145@kernel.org> (raw)
In-Reply-To: <1723805303-11432-1-git-send-email-shradhagupta@linux.microsoft.com>
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.
> + 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.
> + 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.
--
pw-bot: cr
next prev parent reply other threads:[~2024-08-17 1:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-16 10:48 [PATCH net-next v3] net: mana: Implement get_ringparam/set_ringparam for mana Shradha Gupta
2024-08-17 1:58 ` Jakub Kicinski [this message]
2024-08-19 15:41 ` Shradha Gupta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240816185805.60e16145@kernel.org \
--to=kuba@kernel.org \
--cc=ahmed.zaki@intel.com \
--cc=colin.i.king@gmail.com \
--cc=davem@davemloft.net \
--cc=decui@microsoft.com \
--cc=edumazet@google.com \
--cc=erick.archer@outlook.com \
--cc=haiyangz@microsoft.com \
--cc=horms@kernel.org \
--cc=kotaranov@microsoft.com \
--cc=kys@microsoft.com \
--cc=linux-hyperv@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=longli@microsoft.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pavan.chebbi@broadcom.com \
--cc=schakrabarti@linux.microsoft.com \
--cc=sharmaajay@microsoft.com \
--cc=shradhagupta@linux.microsoft.com \
--cc=shradhagupta@microsoft.com \
--cc=wei.liu@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).