* [PATCH] net/bonding: clamp Rx free threshold for small rings
@ 2026-02-24 12:13 Bruce Richardson
2026-02-24 12:48 ` Morten Brørup
2026-02-25 17:01 ` Stephen Hemminger
0 siblings, 2 replies; 4+ messages in thread
From: Bruce Richardson @ 2026-02-24 12:13 UTC (permalink / raw)
To: dev
Cc: Bruce Richardson, stable, Chas Williams, Min Hu (Connor),
Chaoyong He, Long Wu
The bonding driver creates a minimal-sized Rx ring as part of the setup,
using the driver default parameters as it does so. However, for some
cases the default values need adjustment for absolute minimal sized
rings which can cause failures - for example, having an free threshold
of 32 is too large for a ring of size 64.
Unfortunately, the drivers themselves cannot properly handle this by
adjusting their defaults because:
a) the defaults are returned from info_get which gets called before the
desired ring-size is known
b) the replacement of the NULL rxconf value, which indicates use of
defaults, happens at the ethdev level, so the driver is unaware of the
source of the requested parameters - whether they are explicitly set by
the user or substituted by ethdev layer.
Therefore, we modify the bonding PMD to clamp the free thresh value to
ring_size / 4 which should work in all cases.
Fixes: 4da0705bf896 ("net/bonding: fix dedicated queue setup")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/net/bonding/rte_eth_bond_pmd.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index b7bab6bc99..96725071da 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -1701,11 +1701,18 @@ member_configure_slow_queue(struct rte_eth_dev *bonding_eth_dev,
if (member_info.rx_desc_lim.nb_min != 0)
nb_rx_desc = member_info.rx_desc_lim.nb_min;
- /* Configure slow Rx queue */
+ /* Configure slow Rx queue.
+ * Use explicit conf rather than NULL so we can clamp rx_free_thresh:
+ * with a minimum-sized ring the default rx_free_thresh may be too large
+ * for some drivers to work correctly, so clamp it to ring_size / 4.
+ */
+ struct rte_eth_rxconf slow_rx_conf = member_info.default_rxconf;
+ if (slow_rx_conf.rx_free_thresh > nb_rx_desc / 4)
+ slow_rx_conf.rx_free_thresh = nb_rx_desc / 4;
errval = rte_eth_rx_queue_setup(member_eth_dev->data->port_id,
internals->mode4.dedicated_queues.rx_qid, nb_rx_desc,
rte_eth_dev_socket_id(member_eth_dev->data->port_id),
- NULL, port->slow_pool);
+ &slow_rx_conf, port->slow_pool);
if (errval != 0) {
RTE_BOND_LOG(ERR,
"rte_eth_rx_queue_setup: port=%d queue_id %d, err (%d)",
--
2.51.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH] net/bonding: clamp Rx free threshold for small rings
2026-02-24 12:13 [PATCH] net/bonding: clamp Rx free threshold for small rings Bruce Richardson
@ 2026-02-24 12:48 ` Morten Brørup
2026-02-24 13:53 ` Bruce Richardson
2026-02-25 17:01 ` Stephen Hemminger
1 sibling, 1 reply; 4+ messages in thread
From: Morten Brørup @ 2026-02-24 12:48 UTC (permalink / raw)
To: Bruce Richardson, dev
Cc: stable, Chas Williams, Min Hu (Connor), Chaoyong He, Long Wu
> From: Bruce Richardson [mailto:bruce.richardson@intel.com]
> Sent: Tuesday, 24 February 2026 13.14
>
> The bonding driver creates a minimal-sized Rx ring as part of the
> setup,
> using the driver default parameters as it does so. However, for some
> cases the default values need adjustment for absolute minimal sized
> rings which can cause failures - for example, having an free threshold
> of 32 is too large for a ring of size 64.
>
> Unfortunately, the drivers themselves cannot properly handle this by
> adjusting their defaults because:
> a) the defaults are returned from info_get which gets called before the
> desired ring-size is known
> b) the replacement of the NULL rxconf value, which indicates use of
> defaults, happens at the ethdev level, so the driver is unaware of the
> source of the requested parameters - whether they are explicitly set by
> the user or substituted by ethdev layer.
>
> Therefore, we modify the bonding PMD to clamp the free thresh value to
> ring_size / 4 which should work in all cases.
I have complained about the inability to rely on drivers' capability reporting in edge cases before.
Here's another reason for complaining about it.
It's not easy pleasing everyone. ;-)
From an application perspective, this is black magic, and should be documented.
E.g. like:
https://elixir.bootlin.com/dpdk/v25.11/source/lib/ethdev/rte_ethdev.h#L6322
Anyway, this patch is better than being broken, so:
Acked-by: Morten Brørup <mb@smartsharesystems.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net/bonding: clamp Rx free threshold for small rings
2026-02-24 12:48 ` Morten Brørup
@ 2026-02-24 13:53 ` Bruce Richardson
0 siblings, 0 replies; 4+ messages in thread
From: Bruce Richardson @ 2026-02-24 13:53 UTC (permalink / raw)
To: Morten Brørup
Cc: dev, stable, Chas Williams, Min Hu (Connor), Chaoyong He, Long Wu
On Tue, Feb 24, 2026 at 01:48:24PM +0100, Morten Brørup wrote:
> > From: Bruce Richardson [mailto:bruce.richardson@intel.com]
> > Sent: Tuesday, 24 February 2026 13.14
> >
> > The bonding driver creates a minimal-sized Rx ring as part of the
> > setup,
> > using the driver default parameters as it does so. However, for some
> > cases the default values need adjustment for absolute minimal sized
> > rings which can cause failures - for example, having an free threshold
> > of 32 is too large for a ring of size 64.
> >
> > Unfortunately, the drivers themselves cannot properly handle this by
> > adjusting their defaults because:
> > a) the defaults are returned from info_get which gets called before the
> > desired ring-size is known
> > b) the replacement of the NULL rxconf value, which indicates use of
> > defaults, happens at the ethdev level, so the driver is unaware of the
> > source of the requested parameters - whether they are explicitly set by
> > the user or substituted by ethdev layer.
> >
> > Therefore, we modify the bonding PMD to clamp the free thresh value to
> > ring_size / 4 which should work in all cases.
>
> I have complained about the inability to rely on drivers' capability reporting in edge cases before.
> Here's another reason for complaining about it.
> It's not easy pleasing everyone. ;-)
>
> From an application perspective, this is black magic, and should be documented.
> E.g. like:
> https://elixir.bootlin.com/dpdk/v25.11/source/lib/ethdev/rte_ethdev.h#L6322
>
> Anyway, this patch is better than being broken, so:
> Acked-by: Morten Brørup <mb@smartsharesystems.com>
>
Thanks for the ack.
My preferred solution was originally to add a parameter to the rx_setup
callback from ethdev to let drivers know that there was a null parameter
passed in rather than explicit values. However, that was a LOT of churn in
the code for something so small as this.
In terms of documenting this, the affected Intel drivers now print explicit
error messages telling the user what to fix. I'm still uncertain whether
just fixing this on the fly might be a better solution than failing config,
but given that this is likely an edge case, easily fixed in apps due to
(hopefully) clear error reporting, I've taken the approach in this patch as
the least intrusive, while still reasonable, fix for the specific scenario
using the bonding driver.
/Bruce
PS: I'm surprised this hasn't been flagged as broken before, since before
commit 93de214d5eb6 ("net/intel: improve Rx descriptor ring size checks")
from last December, the invalid config was silently accepted by Intel
drivers and then the ethdev would fail to receive after doing ring
wrap-around.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net/bonding: clamp Rx free threshold for small rings
2026-02-24 12:13 [PATCH] net/bonding: clamp Rx free threshold for small rings Bruce Richardson
2026-02-24 12:48 ` Morten Brørup
@ 2026-02-25 17:01 ` Stephen Hemminger
1 sibling, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2026-02-25 17:01 UTC (permalink / raw)
To: Bruce Richardson
Cc: dev, stable, Chas Williams, Min Hu (Connor), Chaoyong He, Long Wu
On Tue, 24 Feb 2026 12:13:58 +0000
Bruce Richardson <bruce.richardson@intel.com> wrote:
> The bonding driver creates a minimal-sized Rx ring as part of the setup,
> using the driver default parameters as it does so. However, for some
> cases the default values need adjustment for absolute minimal sized
> rings which can cause failures - for example, having an free threshold
> of 32 is too large for a ring of size 64.
>
> Unfortunately, the drivers themselves cannot properly handle this by
> adjusting their defaults because:
> a) the defaults are returned from info_get which gets called before the
> desired ring-size is known
> b) the replacement of the NULL rxconf value, which indicates use of
> defaults, happens at the ethdev level, so the driver is unaware of the
> source of the requested parameters - whether they are explicitly set by
> the user or substituted by ethdev layer.
>
> Therefore, we modify the bonding PMD to clamp the free thresh value to
> ring_size / 4 which should work in all cases.
>
> Fixes: 4da0705bf896 ("net/bonding: fix dedicated queue setup")
> Cc: stable@dpdk.org
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
Queued to next-net
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-02-25 17:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-24 12:13 [PATCH] net/bonding: clamp Rx free threshold for small rings Bruce Richardson
2026-02-24 12:48 ` Morten Brørup
2026-02-24 13:53 ` Bruce Richardson
2026-02-25 17:01 ` Stephen Hemminger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox