From: Tathagat Priyadarshi <tathagat.dpdk@gmail.com>
To: dev@dpdk.org
Cc: weh@microsoft.com, longli@microsoft.com,
stephen@networkplumber.org, stable@dpdk.org
Subject: [PATCH v3 1/2] net/mana: fix transmit burst error handling
Date: Tue, 27 Oct 2026 18:21:14 +0000 [thread overview]
Message-ID: <20261027182115.3666158-2-tathagat.dpdk@gmail.com> (raw)
In-Reply-To: <20261027182115.3666158-1-tathagat.dpdk@gmail.com>
mana_tx_burst() skipped, using continue, a packet that exceeded the
segment limit or whose SGL could not be populated. rte_eth_tx_burst()
callers treat the return value as a contiguous prefix of consumed
packets, so later packets were posted while the caller considered them
unsent and freed them, and their completions then freed them again.
Drop such a packet instead: count it in stats.errors, free it and
include it in the returned count. Return early only when the ring is
full, since a packet that fails validation would fail again on every
retry and stall applications that loop until all packets are sent.
sgl.gdma_sgl[] holds MAX_SGL_ENTRIES_FOR_TRANSMIT entries, but
max_send_sge comes from the device and was not limited, so a packet with
more segments could write past the array. Reject such packets and limit
the advertised nb_seg_max and nb_mtu_seg_max to the same value.
Fixes: 7f322844f427 ("net/mana: send packets")
Fixes: d878cb09501d ("net/mana: report device info")
Cc: stable@dpdk.org
Signed-off-by: Tathagat Priyadarshi <tathagat.dpdk@gmail.com>
---
v2:
- Drop unsendable packets and return a separate consumed count (nb_done)
instead of breaking out of the burst; break only when the ring is full.
- Move MAX_SGL_ENTRIES_FOR_TRANSMIT clamp from patch 2 to patch 1, and
clamp dev_info nb_seg_max and nb_mtu_seg_max.
drivers/net/mana/mana.c | 4 ++--
drivers/net/mana/tx.c | 18 ++++++++++++++----
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/drivers/net/mana/mana.c b/drivers/net/mana/mana.c
index 30b0ce90d6..5ddbbdc3d0 100644
--- a/drivers/net/mana/mana.c
+++ b/drivers/net/mana/mana.c
@@ -410,9 +410,9 @@ mana_dev_info_get(struct rte_eth_dev *dev,
dev_info->tx_desc_lim.nb_max = RTE_MIN(priv->max_tx_desc, UINT16_MAX);
dev_info->tx_desc_lim.nb_align = MIN_BUFFERS_PER_QUEUE;
dev_info->tx_desc_lim.nb_seg_max =
- RTE_MIN(priv->max_send_sge, UINT16_MAX);
+ RTE_MIN(priv->max_send_sge, MAX_SGL_ENTRIES_FOR_TRANSMIT);
dev_info->tx_desc_lim.nb_mtu_seg_max =
- RTE_MIN(priv->max_send_sge, UINT16_MAX);
+ RTE_MIN(priv->max_send_sge, MAX_SGL_ENTRIES_FOR_TRANSMIT);
/* Speed */
dev_info->speed_capa = RTE_ETH_LINK_SPEED_100G;
diff --git a/drivers/net/mana/tx.c b/drivers/net/mana/tx.c
index 10f2212b5d..16e63e89c9 100644
--- a/drivers/net/mana/tx.c
+++ b/drivers/net/mana/tx.c
@@ -192,6 +192,7 @@ mana_tx_burst(void *dpdk_txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
int ret;
void *db_page;
uint16_t pkt_sent = 0;
+ uint16_t nb_done = 0;
uint32_t num_comp, i;
uint32_t expected = 0;
#ifdef RTE_ARCH_32
@@ -278,10 +279,11 @@ mana_tx_burst(void *dpdk_txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
break;
/* Drop the packet if it exceeds max segments */
- if (m_pkt->nb_segs > priv->max_send_sge) {
+ if (unlikely(m_pkt->nb_segs > priv->max_send_sge ||
+ m_pkt->nb_segs > MAX_SGL_ENTRIES_FOR_TRANSMIT)) {
DP_LOG(ERR, "send packet segments %d exceeding max",
m_pkt->nb_segs);
- continue;
+ goto drop;
}
/* Fill in the oob */
@@ -432,7 +434,7 @@ mana_tx_burst(void *dpdk_txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
/* Skip this packet if we can't populate all segments */
if (seg_idx != m_pkt->nb_segs)
- continue;
+ goto drop;
/* If we can at least queue post two WQEs and there are at
* least two packets to send, use TX CQE suppression for the
@@ -477,6 +479,7 @@ mana_tx_burst(void *dpdk_txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
txq->desc_ring_len++;
pkt_sent++;
+ nb_done++;
DP_LOG(DEBUG, "nb_pkts %u pkt[%d] sent",
nb_pkts, pkt_idx);
@@ -499,6 +502,13 @@ mana_tx_burst(void *dpdk_txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
pkt_idx, ret);
break;
}
+
+ continue;
+
+drop:
+ txq->stats.errors++;
+ rte_pktmbuf_free(m_pkt);
+ nb_done++;
}
/* Ring hardware door bell */
@@ -523,5 +533,5 @@ mana_tx_burst(void *dpdk_txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
rte_atomic_fetch_and_explicit(&txq->burst_state, ~(uint32_t)1,
rte_memory_order_release);
- return pkt_sent;
+ return nb_done;
}
--
2.43.0
next prev parent reply other threads:[~2026-10-28 9:01 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-12 7:36 [PATCH 0/2] net/mana: fix transmit burst and add hardware TSO support Tathagat Priyadarshi
2026-10-12 7:36 ` [PATCH 1/2] net/mana: fix transmit burst error handling Tathagat Priyadarshi
2026-10-12 7:36 ` [PATCH 2/2] net/mana: add hardware TSO support Tathagat Priyadarshi
2026-10-12 21:37 ` [PATCH 0/2] net/mana: fix transmit burst and " Stephen Hemminger
2026-10-26 21:21 ` [PATCH v2 0/2] net/mana: fix tx burst error handling and add " Tathagat Priyadarshi
2026-10-26 21:21 ` [PATCH v2 1/2] net/mana: fix transmit burst error handling Tathagat Priyadarshi
2026-10-26 21:21 ` [PATCH v2 2/2] net/mana: add hardware TSO support Tathagat Priyadarshi
2026-10-27 14:02 ` [PATCH v2 0/2] net/mana: fix tx burst error handling and add " Stephen Hemminger
2026-10-27 18:21 ` [PATCH v3 " Tathagat Priyadarshi
2026-10-27 18:21 ` Tathagat Priyadarshi [this message]
2026-10-27 18:21 ` [PATCH v3 2/2] net/mana: add hardware " Tathagat Priyadarshi
2026-10-28 14:00 ` [PATCH v3 0/2] net/mana: fix tx burst error handling and add " Stephen Hemminger
2026-10-28 19:37 ` Tathagat Priyadarshi
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=20261027182115.3666158-2-tathagat.dpdk@gmail.com \
--to=tathagat.dpdk@gmail.com \
--cc=dev@dpdk.org \
--cc=longli@microsoft.com \
--cc=stable@dpdk.org \
--cc=stephen@networkplumber.org \
--cc=weh@microsoft.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 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.