DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Medvedkin, Vladimir" <vladimir.medvedkin@intel.com>
To: Bruce Richardson <bruce.richardson@intel.com>, <dev@dpdk.org>
Cc: <anatoly.burakov@intel.com>, <stable@dpdk.org>,
	Jingjing Wu <jingjing.wu@intel.com>,
	Praveen Shetty <praveen.shetty@intel.com>,
	"Xiaoyun Li" <xiaoyun.li@intel.com>,
	Beilei Xing <beilei.xing@intel.com>,
	Junfeng Guo <junfengg@nvidia.com>
Subject: Re: [PATCH] net/idpf: fix Tx of large mbuf segments
Date: Tue, 30 Jun 2026 18:35:18 +0100	[thread overview]
Message-ID: <7be25168-9dbc-4a8a-a4be-58c3367435ad@intel.com> (raw)
In-Reply-To: <20260626134440.2108591-1-bruce.richardson@intel.com>

Hi Bruce,

There is possible tx ring overflow after a new internal loop is added.
I'd suggest to add into account "nb_used" by moving "if (txq->nb_tx_free 
< tx_pkt->nb_segs)" check right after "nb_used" was calculated.

On 6/26/2026 2:43 PM, Bruce Richardson wrote:
> 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: rework implementation based on changes to the idpf driver
>      since v1 was submitted.
> ---
>   drivers/net/intel/idpf/idpf_common_rxtx.c | 37 ++++++++++++++++++++---
>   1 file changed, 32 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/intel/idpf/idpf_common_rxtx.c b/drivers/net/intel/idpf/idpf_common_rxtx.c
> index a123d969ee..8aa61a2af4 100644
> --- a/drivers/net/intel/idpf/idpf_common_rxtx.c
> +++ b/drivers/net/intel/idpf/idpf_common_rxtx.c
> @@ -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)

-- 
Regards,
Vladimir


  reply	other threads:[~2026-06-30 17:35 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 [this message]
2026-07-01  8:23   ` [PATCH v2] " Bruce Richardson
2026-07-01  8:44     ` 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=7be25168-9dbc-4a8a-a4be-58c3367435ad@intel.com \
    --to=vladimir.medvedkin@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=junfengg@nvidia.com \
    --cc=praveen.shetty@intel.com \
    --cc=stable@dpdk.org \
    --cc=xiaoyun.li@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