* [PATCH] net/ena: fix out-of-bounds Tx prefetch
@ 2026-11-22 21:47 Wenyu Su
2026-11-23 18:57 ` Stephen Hemminger
0 siblings, 1 reply; 2+ messages in thread
From: Wenyu Su @ 2026-11-22 21:47 UTC (permalink / raw)
To: shaibran@amazon.com, evgenys@amazon.com, amitbern@amazon.com,
atrwajee@amazon.com
Cc: dev@dpdk.org, stable@dpdk.org, Jan Medala
The Tx prefetch uses the descriptor ring mask to index the
caller-provided packet array. This can read beyond the end of
the array near the end of a burst.
Only prefetch when the lookahead index is within the burst.
Fixes: 1173fca25af9 ("ena: add polling-mode driver")
Cc: stable@dpdk.org
Signed-off-by: Wenyu Su <priceclaptrap@hotmail.com>
---
.mailmap | 1 +
drivers/net/ena/ena_ethdev.c | 4 ++--
drivers/net/ena/ena_ethdev.h | 1 -
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/.mailmap b/.mailmap
index a0096fb97a..b0ac17ea0c 100644
--- a/.mailmap
+++ b/.mailmap
@@ -1874,6 +1874,7 @@ Wentao Cui <wentaoc@mellanox.com>
Wenwu Ma <wenwux.ma@intel.com>
Wenxiang Qian <leonwxqian@gmail.com>
Wenxuan Wu <wenxuanx.wu@intel.com>
+Wenyu Su <priceclaptrap@hotmail.com>
Wenzhuo Lu <wenzhuo.lu@intel.com>
Weqaar Janjua <weqaar.a.janjua@intel.com>
Wiktor Pilarczyk <wiktor.pilarczyk@intel.com>
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index c2d0194e51..7ea6deea70 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -3425,8 +3425,8 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
if (ena_xmit_mbuf(tx_ring, tx_pkts[sent_idx]))
break;
tx_ring->pkts_without_db = true;
- rte_prefetch0(tx_pkts[ENA_IDX_ADD_MASKED(sent_idx, 4,
- tx_ring->size_mask)]);
+ if (likely((sent_idx + 4) < nb_pkts))
+ rte_prefetch0(tx_pkts[sent_idx + 4]);
}
/* If there are ready packets to be xmitted... */
diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h
index b204b07767..bd25cff8ca 100644
--- a/drivers/net/ena/ena_ethdev.h
+++ b/drivers/net/ena/ena_ethdev.h
@@ -60,7 +60,6 @@
#define ENA_MAX_CUSTOMER_METRICS 6
#define ENA_IDX_NEXT_MASKED(idx, mask) (((idx) + 1) & (mask))
-#define ENA_IDX_ADD_MASKED(idx, n, mask) (((idx) + (n)) & (mask))
#define ENA_HASH_KEY_SIZE 40
--
2.39.5 (Apple Git-154)
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] net/ena: fix out-of-bounds Tx prefetch
2026-11-22 21:47 [PATCH] net/ena: fix out-of-bounds Tx prefetch Wenyu Su
@ 2026-11-23 18:57 ` Stephen Hemminger
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2026-11-23 18:57 UTC (permalink / raw)
To: Wenyu Su
Cc: shaibran@amazon.com, evgenys@amazon.com, amitbern@amazon.com,
atrwajee@amazon.com, dev@dpdk.org, stable@dpdk.org, Jan Medala
On Sun, 22 Nov 2026 21:47:23 +0000
Wenyu Su <PriceClaptrap@hotmail.com> wrote:
> The Tx prefetch uses the descriptor ring mask to index the
> caller-provided packet array. This can read beyond the end of
> the array near the end of a burst.
>
> Only prefetch when the lookahead index is within the burst.
>
> Fixes: 1173fca25af9 ("ena: add polling-mode driver")
> Cc: stable@dpdk.org
> Signed-off-by: Wenyu Su <priceclaptrap@hotmail.com>
> ---
Looks right, applied to next-net for 27.03
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-23 18:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-22 21:47 [PATCH] net/ena: fix out-of-bounds Tx prefetch Wenyu Su
2026-11-23 18:57 ` Stephen Hemminger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox