Netdev List
 help / color / mirror / Atom feed
From: "Björn Töpel" <bjorn@kernel.org>
To: netdev-bot+sashiko@kernel.org
Cc: alexanderduyck@fb.com, kuba@kernel.org, kernel-team@meta.com,
	andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
	pabeni@redhat.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, mohsin.bashr@gmail.com,
	mike.marciniszyn@gmail.com, joe@dama.to
Subject: Re: [PATCH net] eth: fbnic: Avoid rounding zero ring sizes
Date: Fri, 18 Sep 2026 13:45:56 +0200	[thread overview]
Message-ID: <87qziqrde3.fsf@all.your.base.are.belong.to.us> (raw)
In-Reply-To: <178971206933.22033.236948278674126701@kernel.org>

netdev-bot+sashiko@kernel.org writes:

>> diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c b/drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c
>> index 0e47088ec44ba..8954fcd08cb31 100644
>> --- a/drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c
>> +++ b/drivers/net/ethernet/meta/fbnic/fbnic_ethtool.c
>> @@ -334,11 +334,6 @@ fbnic_set_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring,
>>  	struct fbnic_net *clone;
>>  	int err;
>>  
>> -	ring->rx_pending	= roundup_pow_of_two(ring->rx_pending);
>> -	ring->rx_mini_pending	= roundup_pow_of_two(ring->rx_mini_pending);
>> -	ring->rx_jumbo_pending	= roundup_pow_of_two(ring->rx_jumbo_pending);
>> -	ring->tx_pending	= roundup_pow_of_two(ring->tx_pending);
>> -
>>  	/* These are absolute minimums allowing the device and driver to operate
>>  	 * but not necessarily guarantee reasonable performance. Settings below
>>  	 * Rx queue size of 128 and BDQs smaller than 64 are likely suboptimal
>
> [Severity: Medium]
> With the roundup moved below the checks, the minimum-size test in
> fbnic_set_ringparam() now compares the raw userspace request rather than
> the rounded value.  Does this reject nonzero sizes that used to be
> accepted?
>
> The effective minimums all evaluate to 64:
>
> drivers/net/ethernet/meta/fbnic/fbnic_txrx.h:
>     #define FBNIC_TX_DESC_MIN	roundup_pow_of_two(FBNIC_TX_DESC_WAKEUP)
>     #define FBNIC_RX_DESC_MIN	roundup_pow_of_two(FBNIC_MAX_RX_PKT_DESC * 2)
>     #define FBNIC_QUEUE_SIZE_MIN		64u
>
> FBNIC_RX_DESC_MIN is 16 and FBNIC_TX_DESC_MIN is 64 for the common
> MAX_SKB_FRAGS == 17, so max(FBNIC_QUEUE_SIZE_MIN, ...) is 64 in every
> case.
>
> Previously a request like "ethtool -G ethX tx 40" was rounded to 64 first
> and then passed the check, ending up with a 64-entry ring.  Now the check
> sees 40 and returns -EINVAL with "requested ring size too small".  The
> same applies to any rx, rx-mini or rx-jumbo value in 33..63.
>
> The ethtool core does not enforce a minimum, it only validates the maxima:
>
> net/ethtool/rings.c:ethnl_set_rings() {
> 	...
> 	/* ensure new ring parameters are within limits */
> 	if (ringparam.rx_pending > ringparam.rx_max_pending)
> 	...
> }
>
> and ethtool_set_ringparam() in net/ethtool/ioctl.c does the same, so those
> values do reach the driver unchanged.

Indeed. V2!

Björn

      reply	other threads:[~2026-09-18 11:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-15 18:12 [PATCH net] eth: fbnic: Avoid rounding zero ring sizes Björn Töpel
2026-09-18  6:14 ` netdev-bot+sashiko
2026-09-18 11:45   ` Björn Töpel [this message]

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=87qziqrde3.fsf@all.your.base.are.belong.to.us \
    --to=bjorn@kernel.org \
    --cc=alexanderduyck@fb.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=joe@dama.to \
    --cc=kernel-team@meta.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.marciniszyn@gmail.com \
    --cc=mohsin.bashr@gmail.com \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /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