DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: vladimir.medvedkin@intel.com,
	Bruce Richardson <bruce.richardson@intel.com>,
	stable@dpdk.org
Subject: [PATCH v2] net/idpf: fix Tx of large mbuf segments
Date: Wed,  1 Jul 2026 09:23:37 +0100	[thread overview]
Message-ID: <20260701082337.3176970-1-bruce.richardson@intel.com> (raw)
In-Reply-To: <20260626134440.2108591-1-bruce.richardson@intel.com>

When TSO is enabled, and we get a packet to transmit where an individual
mbuf segment is longer than 16k, we need to split that segment across
multiple Tx descriptors. This support is present in the single-queue
mode of idpf - since it shares common code with the other Intel drivers
-  but was missing from the splitq path.

This patch adds the proper data path handling. Previous work ensured
that the descriptor count calculation took over-sized segments into
account but the actual descriptor writing part was overlooked.

Fixes: 770f4dfe0f79 ("net/idpf: support basic Tx data path")
Fixes: 2904020f8313 ("net/intel: add common function to calculate needed descs")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
V2: change check for number of free descriptor slots to use the correct
    count, rather than just the number of mbuf segments passed
---
 drivers/net/intel/idpf/idpf_common_rxtx.c | 43 ++++++++++++++++++-----
 1 file changed, 35 insertions(+), 8 deletions(-)

diff --git a/drivers/net/intel/idpf/idpf_common_rxtx.c b/drivers/net/intel/idpf/idpf_common_rxtx.c
index a123d969ee..2c87e02c98 100644
--- a/drivers/net/intel/idpf/idpf_common_rxtx.c
+++ b/drivers/net/intel/idpf/idpf_common_rxtx.c
@@ -952,9 +952,6 @@ idpf_dp_splitq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 				idpf_split_tx_free(txq->complq);
 		}
 
-		if (txq->nb_tx_free < tx_pkt->nb_segs)
-			break;
-
 		cmd_dtype = 0;
 		ol_flags = tx_pkt->ol_flags;
 		tx_offload.l2_len = tx_pkt->l2_len;
@@ -976,6 +973,9 @@ idpf_dp_splitq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		else
 			nb_used = tx_pkt->nb_segs + nb_ctx;
 
+		if (txq->nb_tx_free < nb_used)
+			break;
+
 		if (ol_flags & CI_TX_CKSUM_OFFLOAD_MASK)
 			cmd_dtype = IDPF_TXD_FLEX_FLOW_CMD_CS_EN;
 
@@ -994,16 +994,43 @@ idpf_dp_splitq_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,
 		uint16_t first_sw_id = sw_id;
 
 		do {
+			uint16_t slen = tx_pkt->data_len;
+			rte_iova_t buf_dma_addr = rte_mbuf_data_iova(tx_pkt);
+
+			/* Split segment across multiple descriptors if needed
+			 * for TSO packets where segment exceeds max buf size.
+			 */
+			while ((ol_flags & RTE_MBUF_F_TX_TCP_SEG) &&
+					unlikely(slen > CI_MAX_DATA_PER_TXD)) {
+				txd = &txr[tx_id];
+				txn = &sw_ring[txe->next_id];
+				txe->mbuf = NULL;
+
+				txd->buf_addr = rte_cpu_to_le_64(buf_dma_addr);
+				txd->qw1.cmd_dtype = cmd_dtype |
+					IDPF_TX_DESC_DTYPE_FLEX_FLOW_SCHE;
+				txd->qw1.rxr_bufsize = CI_MAX_DATA_PER_TXD;
+				txd->qw1.compl_tag = sw_id;
+
+				buf_dma_addr += CI_MAX_DATA_PER_TXD;
+				slen -= CI_MAX_DATA_PER_TXD;
+
+				tx_id++;
+				if (tx_id == txq->nb_tx_desc)
+					tx_id = 0;
+				sw_id = txe->next_id;
+				txe = txn;
+			}
+
 			txd = &txr[tx_id];
 			txn = &sw_ring[txe->next_id];
 			txe->mbuf = tx_pkt;
 
 			/* Setup TX descriptor */
-			txd->buf_addr =
-				rte_cpu_to_le_64(rte_mbuf_data_iova(tx_pkt));
-			cmd_dtype |= IDPF_TX_DESC_DTYPE_FLEX_FLOW_SCHE;
-			txd->qw1.cmd_dtype = cmd_dtype;
-			txd->qw1.rxr_bufsize = tx_pkt->data_len;
+			txd->buf_addr = rte_cpu_to_le_64(buf_dma_addr);
+			txd->qw1.cmd_dtype = cmd_dtype |
+				IDPF_TX_DESC_DTYPE_FLEX_FLOW_SCHE;
+			txd->qw1.rxr_bufsize = slen;
 			txd->qw1.compl_tag = sw_id;
 			tx_id++;
 			if (tx_id == txq->nb_tx_desc)
-- 
2.53.0


  parent reply	other threads:[~2026-07-01  8:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-03 15:00 [PATCH] net/idpf: handle Tx of mbuf segments larger than 16k Bruce Richardson
2026-03-04  9:53 ` Bruce Richardson
2026-03-06 13:45 ` Burakov, Anatoly
2026-03-06 14:03   ` Burakov, Anatoly
2026-03-06 14:16     ` Burakov, Anatoly
2026-06-26 13:43 ` [PATCH] net/idpf: fix Tx of large mbuf segments Bruce Richardson
2026-06-30 17:35   ` Medvedkin, Vladimir
2026-07-01  8:23   ` Bruce Richardson [this message]
2026-07-01  8:44     ` [PATCH v2] " Medvedkin, Vladimir
2026-07-01  9:47       ` Bruce Richardson

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=20260701082337.3176970-1-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    --cc=vladimir.medvedkin@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox