* [PATCH] drivers/net: fix Tx packet prepare
@ 2025-11-19 13:03 Thomas Monjalon
2025-11-19 13:19 ` Morten Brørup
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Monjalon @ 2025-11-19 13:03 UTC (permalink / raw)
To: dev
Cc: Jiawen Wu, Xingui Yang, Chengwen Feng, Zaiyu Wang,
Christian Koue Muf, Serhii Iliushyk, Cristian Dumitrescu,
Jian Wang, Andrew Rybchenko, Morten Brørup,
Sunil Kumar Kori
After removing callback checks from ethdev fast path,
some drivers crashed because tx_pkt_prepare was set to NULL.
Some drivers (hns3, ngbe, txgbe) need to use rte_eth_tx_pkt_prepare_dummy
when configuring queues.
Other drivers (ntnic, softnic) does not need to set tx_pkt_prepare
as it was set by eth_dev_set_dummy_fops() called by rte_eth_dev_allocate().
Bugzilla ID: 1834
Fixes: 066f3d9cc21c ("ethdev: remove callback checks from fast path")
Reported-by: Jiawen Wu <jiawenwu@trustnetic.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
drivers/net/hns3/hns3_rxtx.c | 4 ++--
drivers/net/ngbe/ngbe_rxtx.c | 2 +-
drivers/net/ntnic/ntnic_ethdev.c | 1 -
drivers/net/softnic/rte_eth_softnic.c | 1 -
drivers/net/txgbe/txgbe_rxtx.c | 2 +-
5 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c
index df703134be..3a99923220 100644
--- a/drivers/net/hns3/hns3_rxtx.c
+++ b/drivers/net/hns3/hns3_rxtx.c
@@ -4561,7 +4561,7 @@ hns3_set_rxtx_function(struct rte_eth_dev *eth_dev)
} else {
eth_dev->rx_pkt_burst = rte_eth_pkt_burst_dummy;
eth_dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
- eth_dev->tx_pkt_prepare = NULL;
+ eth_dev->tx_pkt_prepare = rte_eth_tx_pkt_prepare_dummy;
}
hns3_trace_rxtx_function(eth_dev);
@@ -4917,7 +4917,7 @@ void
hns3_stop_tx_datapath(struct rte_eth_dev *dev)
{
dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
- dev->tx_pkt_prepare = NULL;
+ dev->tx_pkt_prepare = rte_eth_tx_pkt_prepare_dummy;
hns3_eth_dev_fp_ops_config(dev);
if (rte_eal_process_type() == RTE_PROC_SECONDARY)
diff --git a/drivers/net/ngbe/ngbe_rxtx.c b/drivers/net/ngbe/ngbe_rxtx.c
index 66d72c88df..91e215694c 100644
--- a/drivers/net/ngbe/ngbe_rxtx.c
+++ b/drivers/net/ngbe/ngbe_rxtx.c
@@ -1921,7 +1921,7 @@ ngbe_set_tx_function(struct rte_eth_dev *dev, struct ngbe_tx_queue *txq)
if (txq->offloads == 0 &&
txq->tx_free_thresh >= RTE_PMD_NGBE_TX_MAX_BURST) {
PMD_INIT_LOG(DEBUG, "Using simple tx code path");
- dev->tx_pkt_prepare = NULL;
+ dev->tx_pkt_prepare = rte_eth_tx_pkt_prepare_dummy;
if (txq->tx_free_thresh <= RTE_NGBE_TX_MAX_FREE_BUF_SZ &&
rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128 &&
(rte_eal_process_type() != RTE_PROC_PRIMARY ||
diff --git a/drivers/net/ntnic/ntnic_ethdev.c b/drivers/net/ntnic/ntnic_ethdev.c
index 23c3452d2d..89e751e7e0 100644
--- a/drivers/net/ntnic/ntnic_ethdev.c
+++ b/drivers/net/ntnic/ntnic_ethdev.c
@@ -2561,7 +2561,6 @@ nthw_pci_dev_init(struct rte_pci_device *pci_dev)
NT_LOG_DBGX(DBG, NTNIC, "Setting up RX functions for SCG");
eth_dev->rx_pkt_burst = eth_dev_rx_scg;
eth_dev->tx_pkt_burst = eth_dev_tx_scg;
- eth_dev->tx_pkt_prepare = NULL;
struct rte_eth_link pmd_link;
pmd_link.link_speed = RTE_ETH_SPEED_NUM_NONE;
diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c
index 91a1c3a98e..868e194509 100644
--- a/drivers/net/softnic/rte_eth_softnic.c
+++ b/drivers/net/softnic/rte_eth_softnic.c
@@ -312,7 +312,6 @@ pmd_ethdev_register(struct rte_vdev_device *vdev,
/* dev */
dev->rx_pkt_burst = pmd_rx_pkt_burst;
dev->tx_pkt_burst = pmd_tx_pkt_burst;
- dev->tx_pkt_prepare = NULL;
dev->dev_ops = &pmd_ops;
dev->device = &vdev->device;
diff --git a/drivers/net/txgbe/txgbe_rxtx.c b/drivers/net/txgbe/txgbe_rxtx.c
index 78199ea00b..e2cd9b8841 100644
--- a/drivers/net/txgbe/txgbe_rxtx.c
+++ b/drivers/net/txgbe/txgbe_rxtx.c
@@ -2344,7 +2344,7 @@ txgbe_set_tx_function(struct rte_eth_dev *dev, struct txgbe_tx_queue *txq)
#endif
txq->tx_free_thresh >= RTE_PMD_TXGBE_TX_MAX_BURST) {
PMD_INIT_LOG(DEBUG, "Using simple tx code path");
- dev->tx_pkt_prepare = NULL;
+ dev->tx_pkt_prepare = rte_eth_tx_pkt_prepare_dummy;
if (txq->tx_free_thresh <= RTE_TXGBE_TX_MAX_FREE_BUF_SZ &&
rte_vect_get_max_simd_bitwidth() >= RTE_VECT_SIMD_128 &&
(rte_eal_process_type() != RTE_PROC_PRIMARY ||
--
2.51.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] drivers/net: fix Tx packet prepare
2025-11-19 13:03 [PATCH] drivers/net: fix Tx packet prepare Thomas Monjalon
@ 2025-11-19 13:19 ` Morten Brørup
2025-11-19 13:44 ` Thomas Monjalon
0 siblings, 1 reply; 4+ messages in thread
From: Morten Brørup @ 2025-11-19 13:19 UTC (permalink / raw)
To: Thomas Monjalon, dev
Cc: Jiawen Wu, Xingui Yang, Chengwen Feng, Zaiyu Wang,
Christian Koue Muf, Serhii Iliushyk, Cristian Dumitrescu,
Jian Wang, Andrew Rybchenko, Sunil Kumar Kori
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Wednesday, 19 November 2025 14.04
>
> After removing callback checks from ethdev fast path,
> some drivers crashed because tx_pkt_prepare was set to NULL.
>
> Some drivers (hns3, ngbe, txgbe) need to use
> rte_eth_tx_pkt_prepare_dummy
> when configuring queues.
> Other drivers (ntnic, softnic) does not need to set tx_pkt_prepare
> as it was set by eth_dev_set_dummy_fops() called by
> rte_eth_dev_allocate().
>
> Bugzilla ID: 1834
> Fixes: 066f3d9cc21c ("ethdev: remove callback checks from fast path")
>
> Reported-by: Jiawen Wu <jiawenwu@trustnetic.com>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
Searching for "tx_pkt_prepare = NULL;" finds a few more, but they are all in driver cleanup functions, so...
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drivers/net: fix Tx packet prepare
2025-11-19 13:19 ` Morten Brørup
@ 2025-11-19 13:44 ` Thomas Monjalon
2025-11-19 13:50 ` Morten Brørup
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Monjalon @ 2025-11-19 13:44 UTC (permalink / raw)
To: Morten Brørup
Cc: dev, Jiawen Wu, Xingui Yang, Chengwen Feng, Zaiyu Wang,
Christian Koue Muf, Serhii Iliushyk, Cristian Dumitrescu,
Jian Wang, Andrew Rybchenko, Sunil Kumar Kori
19/11/2025 14:19, Morten Brørup:
> > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > Sent: Wednesday, 19 November 2025 14.04
> >
> > After removing callback checks from ethdev fast path,
> > some drivers crashed because tx_pkt_prepare was set to NULL.
> >
> > Some drivers (hns3, ngbe, txgbe) need to use
> > rte_eth_tx_pkt_prepare_dummy
> > when configuring queues.
> > Other drivers (ntnic, softnic) does not need to set tx_pkt_prepare
> > as it was set by eth_dev_set_dummy_fops() called by
> > rte_eth_dev_allocate().
> >
> > Bugzilla ID: 1834
> > Fixes: 066f3d9cc21c ("ethdev: remove callback checks from fast path")
> >
> > Reported-by: Jiawen Wu <jiawenwu@trustnetic.com>
> > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > ---
>
> Searching for "tx_pkt_prepare = NULL;" finds a few more, but they are all in driver cleanup functions, so...
> Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
Yes I am working on the cleanup side.
But there is no bug in cleanup, it will be a cleanup of cleanup ;)
So cleanup will be handled after 25.11 release.
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] drivers/net: fix Tx packet prepare
2025-11-19 13:44 ` Thomas Monjalon
@ 2025-11-19 13:50 ` Morten Brørup
0 siblings, 0 replies; 4+ messages in thread
From: Morten Brørup @ 2025-11-19 13:50 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, Jiawen Wu, Xingui Yang, Chengwen Feng, Zaiyu Wang,
Christian Koue Muf, Serhii Iliushyk, Cristian Dumitrescu,
Jian Wang, Andrew Rybchenko, Sunil Kumar Kori
> From: Thomas Monjalon [mailto:thomas@monjalon.net]
> Sent: Wednesday, 19 November 2025 14.44
>
> 19/11/2025 14:19, Morten Brørup:
> > > From: Thomas Monjalon [mailto:thomas@monjalon.net]
> > > Sent: Wednesday, 19 November 2025 14.04
> > >
> > > After removing callback checks from ethdev fast path,
> > > some drivers crashed because tx_pkt_prepare was set to NULL.
> > >
> > > Some drivers (hns3, ngbe, txgbe) need to use
> > > rte_eth_tx_pkt_prepare_dummy
> > > when configuring queues.
> > > Other drivers (ntnic, softnic) does not need to set tx_pkt_prepare
> > > as it was set by eth_dev_set_dummy_fops() called by
> > > rte_eth_dev_allocate().
> > >
> > > Bugzilla ID: 1834
> > > Fixes: 066f3d9cc21c ("ethdev: remove callback checks from fast
> path")
> > >
> > > Reported-by: Jiawen Wu <jiawenwu@trustnetic.com>
> > > Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> > > ---
> >
> > Searching for "tx_pkt_prepare = NULL;" finds a few more, but they are
> all in driver cleanup functions, so...
> > Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
>
> Yes I am working on the cleanup side.
> But there is no bug in cleanup, it will be a cleanup of cleanup ;)
Agree.
I should have been more clear in my review comment:
The ones I found in driver cleanup functions don't cause problems, so I consider this patch complete.
> So cleanup will be handled after 25.11 release.
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-11-19 13:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-11-19 13:03 [PATCH] drivers/net: fix Tx packet prepare Thomas Monjalon
2025-11-19 13:19 ` Morten Brørup
2025-11-19 13:44 ` Thomas Monjalon
2025-11-19 13:50 ` Morten Brørup
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).