* [PATCH 0/2] ethdev: fix fast-path ops on a stopped port
@ 2026-06-16 9:42 Maxime Leroy
2026-06-16 9:42 ` [PATCH 1/2] ethdev: keep fast-path ops valid after port stop Maxime Leroy
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Maxime Leroy @ 2026-06-16 9:42 UTC (permalink / raw)
To: dev; +Cc: Maxime Leroy
Two small fixes for fast-path ops on a stopped port:
patch 1 stops rte_eth_rx_queue_count() from dereferencing NULL after a port
stop, patch 2 makes the dummy queue count return 0 (empty queue) instead of
-ENOTSUP.
Maxime Leroy (2):
ethdev: keep fast-path ops valid after port stop
ethdev: return 0 from dummy queue count
lib/ethdev/ethdev_driver.c | 2 +-
lib/ethdev/ethdev_private.c | 7 +++++++
2 files changed, 8 insertions(+), 1 deletion(-)
--
2.43.0
^ permalink raw reply [flat|nested] 6+ messages in thread* [PATCH 1/2] ethdev: keep fast-path ops valid after port stop 2026-06-16 9:42 [PATCH 0/2] ethdev: fix fast-path ops on a stopped port Maxime Leroy @ 2026-06-16 9:42 ` Maxime Leroy 2026-06-16 9:42 ` [PATCH 2/2] ethdev: return 0 from dummy queue count Maxime Leroy 2026-06-17 4:02 ` [PATCH 0/2] ethdev: fix fast-path ops on a stopped port fengchengwen 2 siblings, 0 replies; 6+ messages in thread From: Maxime Leroy @ 2026-06-16 9:42 UTC (permalink / raw) To: dev Cc: Maxime Leroy, stable, Morten Brørup, Thomas Monjalon, Andrew Rybchenko, Sunil Kumar Kori eth_dev_fp_ops_reset() restores a port's fast-path ops on stop/release via a compound literal, so every field it omits is zeroed to NULL. It sets only rx_pkt_burst/tx_pkt_burst (and the rxq/txq data), leaving rx_queue_count, tx_queue_count, rx/tx_descriptor_status, tx_pkt_prepare and the recycle callbacks NULL. In non-debug builds these ops are reached through an unguarded indirect call (the NULL check exists only under RTE_ETHDEV_DEBUG_RX/TX). So a thread calling e.g. rte_eth_rx_queue_count() on a port being stopped dereferences NULL and crashes, while the same race on rte_eth_rx_burst() is harmless because the burst ops are reset to dummies. A poll-mode worker re-checking rx_queue_count before arming the Rx interrupt and sleeping hits exactly this. Reset these non-burst ops to the same dummies eth_dev_set_dummy_fops() installs, so a stopped port behaves like a freshly allocated one: every fast-path op is a safe no-op, none is NULL. Fixes: 066f3d9cc21c ("ethdev: remove callback checks from fast path") Cc: stable@dpdk.org Signed-off-by: Maxime Leroy <maxime@leroys.fr> Acked-by: Morten Brørup <mb@smartsharesystems.com> --- lib/ethdev/ethdev_private.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/ethdev/ethdev_private.c b/lib/ethdev/ethdev_private.c index 72a0723846..75ea3eedff 100644 --- a/lib/ethdev/ethdev_private.c +++ b/lib/ethdev/ethdev_private.c @@ -263,6 +263,13 @@ eth_dev_fp_ops_reset(struct rte_eth_fp_ops *fpo) *fpo = (struct rte_eth_fp_ops) { .rx_pkt_burst = dummy_eth_rx_burst, .tx_pkt_burst = dummy_eth_tx_burst, + .tx_pkt_prepare = rte_eth_tx_pkt_prepare_dummy, + .rx_queue_count = rte_eth_queue_count_dummy, + .tx_queue_count = rte_eth_queue_count_dummy, + .rx_descriptor_status = rte_eth_descriptor_status_dummy, + .tx_descriptor_status = rte_eth_descriptor_status_dummy, + .recycle_tx_mbufs_reuse = rte_eth_recycle_tx_mbufs_reuse_dummy, + .recycle_rx_descriptors_refill = rte_eth_recycle_rx_descriptors_refill_dummy, .rxq = { .data = (void **)&dummy_queues_array[port_id], .clbk = dummy_data, -- 2.43.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] ethdev: return 0 from dummy queue count 2026-06-16 9:42 [PATCH 0/2] ethdev: fix fast-path ops on a stopped port Maxime Leroy 2026-06-16 9:42 ` [PATCH 1/2] ethdev: keep fast-path ops valid after port stop Maxime Leroy @ 2026-06-16 9:42 ` Maxime Leroy 2026-06-16 9:54 ` Morten Brørup 2026-06-16 14:07 ` Stephen Hemminger 2026-06-17 4:02 ` [PATCH 0/2] ethdev: fix fast-path ops on a stopped port fengchengwen 2 siblings, 2 replies; 6+ messages in thread From: Maxime Leroy @ 2026-06-16 9:42 UTC (permalink / raw) To: dev Cc: Maxime Leroy, stable, Stephen Hemminger, Thomas Monjalon, Andrew Rybchenko, Sunil Kumar Kori, Morten Brørup The dummy rx_queue_count/tx_queue_count callback returned -ENOTSUP. On a port that is not started (freshly allocated, or stopped once the fast-path ops are reset to dummies) there are no packets queued, so the truthful answer is 0, not an error: querying the count is not an unsupported operation. This also matches the dummy Rx/Tx burst, which reports 0 packets. A poll-mode worker checking rte_eth_rx_queue_count() across a concurrent port stop then sees an empty queue instead of a negative error. Fixes: 066f3d9cc21c ("ethdev: remove callback checks from fast path") Cc: stable@dpdk.org Suggested-by: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: Maxime Leroy <maxime@leroys.fr> --- lib/ethdev/ethdev_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ethdev/ethdev_driver.c b/lib/ethdev/ethdev_driver.c index 70ddce5bfc..eab5c15d12 100644 --- a/lib/ethdev/ethdev_driver.c +++ b/lib/ethdev/ethdev_driver.c @@ -875,7 +875,7 @@ RTE_EXPORT_INTERNAL_SYMBOL(rte_eth_queue_count_dummy) int rte_eth_queue_count_dummy(void *queue __rte_unused) { - return -ENOTSUP; + return 0; } RTE_EXPORT_INTERNAL_SYMBOL(rte_eth_descriptor_status_dummy) -- 2.43.0 ^ permalink raw reply related [flat|nested] 6+ messages in thread
* RE: [PATCH 2/2] ethdev: return 0 from dummy queue count 2026-06-16 9:42 ` [PATCH 2/2] ethdev: return 0 from dummy queue count Maxime Leroy @ 2026-06-16 9:54 ` Morten Brørup 2026-06-16 14:07 ` Stephen Hemminger 1 sibling, 0 replies; 6+ messages in thread From: Morten Brørup @ 2026-06-16 9:54 UTC (permalink / raw) To: Maxime Leroy, dev Cc: stable, Stephen Hemminger, Thomas Monjalon, Andrew Rybchenko, Sunil Kumar Kori > From: Maxime Leroy [mailto:maxime.leroys@gmail.com] On Behalf Of Maxime > Leroy > Sent: Tuesday, 16 June 2026 11.43 > > The dummy rx_queue_count/tx_queue_count callback returned -ENOTSUP. On > a > port that is not started (freshly allocated, or stopped once the fast- > path > ops are reset to dummies) there are no packets queued, so the truthful > answer is 0, not an error: querying the count is not an unsupported > operation. This also matches the dummy Rx/Tx burst, which reports 0 > packets. > > A poll-mode worker checking rte_eth_rx_queue_count() across a > concurrent > port stop then sees an empty queue instead of a negative error. > > Fixes: 066f3d9cc21c ("ethdev: remove callback checks from fast path") > Cc: stable@dpdk.org > > Suggested-by: Stephen Hemminger <stephen@networkplumber.org> > Signed-off-by: Maxime Leroy <maxime@leroys.fr> > --- Acked-by: Morten Brørup <mb@smartsharesystems.com> ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] ethdev: return 0 from dummy queue count 2026-06-16 9:42 ` [PATCH 2/2] ethdev: return 0 from dummy queue count Maxime Leroy 2026-06-16 9:54 ` Morten Brørup @ 2026-06-16 14:07 ` Stephen Hemminger 1 sibling, 0 replies; 6+ messages in thread From: Stephen Hemminger @ 2026-06-16 14:07 UTC (permalink / raw) To: Maxime Leroy Cc: dev, stable, Thomas Monjalon, Andrew Rybchenko, Sunil Kumar Kori, Morten Brørup On Tue, 16 Jun 2026 11:42:58 +0200 Maxime Leroy <maxime@leroys.fr> wrote: > The dummy rx_queue_count/tx_queue_count callback returned -ENOTSUP. On a > port that is not started (freshly allocated, or stopped once the fast-path > ops are reset to dummies) there are no packets queued, so the truthful > answer is 0, not an error: querying the count is not an unsupported > operation. This also matches the dummy Rx/Tx burst, which reports 0 > packets. > > A poll-mode worker checking rte_eth_rx_queue_count() across a concurrent > port stop then sees an empty queue instead of a negative error. > > Fixes: 066f3d9cc21c ("ethdev: remove callback checks from fast path") > Cc: stable@dpdk.org > > Suggested-by: Stephen Hemminger <stephen@networkplumber.org> > Signed-off-by: Maxime Leroy <maxime@leroys.fr> Acked-by: Stephen Hemminger <stephen@networkplumber.org> ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/2] ethdev: fix fast-path ops on a stopped port 2026-06-16 9:42 [PATCH 0/2] ethdev: fix fast-path ops on a stopped port Maxime Leroy 2026-06-16 9:42 ` [PATCH 1/2] ethdev: keep fast-path ops valid after port stop Maxime Leroy 2026-06-16 9:42 ` [PATCH 2/2] ethdev: return 0 from dummy queue count Maxime Leroy @ 2026-06-17 4:02 ` fengchengwen 2 siblings, 0 replies; 6+ messages in thread From: fengchengwen @ 2026-06-17 4:02 UTC (permalink / raw) To: Maxime Leroy, dev Series-acked-by: Chengwen Feng <fengchengwen@huawei.com> On 6/16/2026 5:42 PM, Maxime Leroy wrote: > Two small fixes for fast-path ops on a stopped port: > patch 1 stops rte_eth_rx_queue_count() from dereferencing NULL after a port > stop, patch 2 makes the dummy queue count return 0 (empty queue) instead of > -ENOTSUP. > > Maxime Leroy (2): > ethdev: keep fast-path ops valid after port stop > ethdev: return 0 from dummy queue count > > lib/ethdev/ethdev_driver.c | 2 +- > lib/ethdev/ethdev_private.c | 7 +++++++ > 2 files changed, 8 insertions(+), 1 deletion(-) > ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-06-17 4:02 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-06-16 9:42 [PATCH 0/2] ethdev: fix fast-path ops on a stopped port Maxime Leroy 2026-06-16 9:42 ` [PATCH 1/2] ethdev: keep fast-path ops valid after port stop Maxime Leroy 2026-06-16 9:42 ` [PATCH 2/2] ethdev: return 0 from dummy queue count Maxime Leroy 2026-06-16 9:54 ` Morten Brørup 2026-06-16 14:07 ` Stephen Hemminger 2026-06-17 4:02 ` [PATCH 0/2] ethdev: fix fast-path ops on a stopped port fengchengwen
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.