DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Renyong Wan" <wanry@yunsilicon.com>
To: <dev@dpdk.org>
Cc: <thomas@monjalon.net>, <stephen@networkplumber.org>,
	 <qianr@yunsilicon.com>, <nana@yunsilicon.com>,
	<zhangxx@yunsilicon.com>,  <xudw@yunsilicon.com>,
	<jacky@yunsilicon.com>, <weihg@yunsilicon.com>,
	 <zhenghy@yunsilicon.com>
Subject: [PATCH 02/14] net/xsc: add TSO support
Date: Fri, 29 Aug 2025 16:24:10 +0800	[thread overview]
Message-ID: <20250829082409.24369-3-wanry@yunsilicon.com> (raw)
In-Reply-To: <20250829082406.24369-1-wanry@yunsilicon.com>

Introduce TCP segmentation offload (TSO) support for xsc PMD.

Signed-off-by: Rong Qian <qianr@yunsilicon.com>
Signed-off-by: Renyong Wan <wanry@yunsilicon.com>
---
 doc/guides/nics/features/xsc.ini |  1 +
 drivers/net/xsc/xsc_ethdev.c     |  3 +--
 drivers/net/xsc/xsc_tx.c         | 12 +++++++-----
 drivers/net/xsc/xsc_tx.h         |  3 +--
 drivers/net/xsc/xsc_vfio.c       |  4 +++-
 5 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/doc/guides/nics/features/xsc.ini b/doc/guides/nics/features/xsc.ini
index e0f7b0bc1f..3b02289764 100644
--- a/doc/guides/nics/features/xsc.ini
+++ b/doc/guides/nics/features/xsc.ini
@@ -5,6 +5,7 @@
 ;
 [Features]
 MTU update           = Y
+TSO                  = Y
 RSS hash             = Y
 RSS key update       = Y
 RSS reta update      = Y
diff --git a/drivers/net/xsc/xsc_ethdev.c b/drivers/net/xsc/xsc_ethdev.c
index 79c4e13cd4..9a70be0543 100644
--- a/drivers/net/xsc/xsc_ethdev.c
+++ b/drivers/net/xsc/xsc_ethdev.c
@@ -223,7 +223,6 @@ xsc_txq_start(struct xsc_ethdev_priv *priv)
 {
 	struct xsc_txq_data *txq_data;
 	struct rte_eth_dev *dev = priv->eth_dev;
-	uint64_t offloads = dev->data->dev_conf.txmode.offloads;
 	uint16_t i;
 	int ret;
 	size_t size;
@@ -239,7 +238,7 @@ xsc_txq_start(struct xsc_ethdev_priv *priv)
 		if (txq_data == NULL)
 			goto error;
 		xsc_txq_elts_alloc(txq_data);
-		ret = xsc_txq_obj_new(priv->xdev, txq_data, offloads, i);
+		ret = xsc_txq_obj_new(priv->xdev, txq_data, i);
 		if (ret < 0)
 			goto error;
 		dev->data->tx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED;
diff --git a/drivers/net/xsc/xsc_tx.c b/drivers/net/xsc/xsc_tx.c
index d1a0f3284b..07888a5641 100644
--- a/drivers/net/xsc/xsc_tx.c
+++ b/drivers/net/xsc/xsc_tx.c
@@ -26,8 +26,7 @@ xsc_txq_elts_alloc(struct xsc_txq_data *txq_data)
 }
 
 int
-xsc_txq_obj_new(struct xsc_dev *xdev, struct xsc_txq_data *txq_data,
-		uint64_t offloads, uint16_t idx)
+xsc_txq_obj_new(struct xsc_dev *xdev, struct xsc_txq_data *txq_data, uint16_t idx)
 {
 	int ret = 0;
 	struct xsc_tx_cq_params cq_params = {0};
@@ -57,7 +56,7 @@ xsc_txq_obj_new(struct xsc_dev *xdev, struct xsc_txq_data *txq_data,
 		    txq_data->cq_db, txq_data->cqn);
 
 	qp_params.cq = txq_data->cq;
-	qp_params.tx_offloads = offloads;
+	qp_params.tx_offloads = txq_data->offloads;
 	qp_params.port_id = txq_data->port_id;
 	qp_params.qp_id = idx;
 	qp_params.elts_n = txq_data->elts_n;
@@ -76,6 +75,7 @@ xsc_txq_obj_new(struct xsc_dev *xdev, struct xsc_txq_data *txq_data,
 	txq_data->wqe_m = txq_data->wqe_s - 1;
 	txq_data->wqe_ds_n = rte_log2_u32(xdev->hwinfo.send_seg_num);
 	txq_data->qp_db =  qp_info.qp_db;
+	txq_data->tso_en = qp_info.tso_en ? 1 : 0;
 
 	txq_data->cq_ci = 0;
 	txq_data->cq_pi = 0;
@@ -83,9 +83,11 @@ xsc_txq_obj_new(struct xsc_dev *xdev, struct xsc_txq_data *txq_data,
 	txq_data->wqe_pi = 0;
 	txq_data->wqe_comp = 0;
 
-	PMD_DRV_LOG(INFO, "Create tx qp, wqe_s:%d, wqe_n:%d, qp_db=%p, qpn:%u",
+	PMD_DRV_LOG(INFO, "Create tx qp, wqe_s:%d, wqe_n:%d, qp_db=%p, qpn:%u, %s",
 		    txq_data->wqe_s, txq_data->wqe_n,
-		    txq_data->qp_db, txq_data->qpn);
+		    txq_data->qp_db, txq_data->qpn,
+		    txq_data->tso_en ? "tso" : "non-tso");
+
 	return 0;
 
 error:
diff --git a/drivers/net/xsc/xsc_tx.h b/drivers/net/xsc/xsc_tx.h
index 88419dd3a0..a6a034a8ea 100644
--- a/drivers/net/xsc/xsc_tx.h
+++ b/drivers/net/xsc/xsc_tx.h
@@ -53,8 +53,7 @@ struct __rte_cache_aligned xsc_txq_data {
 };
 
 uint16_t xsc_tx_burst(void *dpdk_txq, struct rte_mbuf **pkts, uint16_t pkts_n);
-int xsc_txq_obj_new(struct xsc_dev *xdev, struct xsc_txq_data *txq_data,
-		    uint64_t offloads, uint16_t idx);
+int xsc_txq_obj_new(struct xsc_dev *xdev, struct xsc_txq_data *txq_data, uint16_t idx);
 void xsc_txq_elts_alloc(struct xsc_txq_data *txq_data);
 void xsc_txq_obj_release(struct xsc_dev *xdev, struct xsc_txq_data *txq_data);
 void xsc_txq_elts_free(struct xsc_txq_data *txq_data);
diff --git a/drivers/net/xsc/xsc_vfio.c b/drivers/net/xsc/xsc_vfio.c
index 857fa449f0..f61cf92569 100644
--- a/drivers/net/xsc/xsc_vfio.c
+++ b/drivers/net/xsc/xsc_vfio.c
@@ -649,6 +649,7 @@ xsc_vfio_tx_qp_create(struct xsc_dev *xdev, struct xsc_tx_qp_params *qp_params,
 	uint64_t iova;
 	char name[RTE_ETH_NAME_MAX_LEN] = {0};
 	void *cmd_buf = NULL;
+	bool tso_en = !!(qp_params->tx_offloads & RTE_ETH_TX_OFFLOAD_TCP_TSO);
 
 	qp = rte_zmalloc(NULL, sizeof(struct xsc_vfio_qp), 0);
 	if (qp == NULL) {
@@ -689,7 +690,7 @@ xsc_vfio_tx_qp_create(struct xsc_dev *xdev, struct xsc_tx_qp_params *qp_params,
 	in->hdr.opcode = rte_cpu_to_be_16(XSC_CMD_OP_CREATE_QP);
 	in->req.input_qpn = 0;
 	in->req.pa_num = rte_cpu_to_be_16(pa_num);
-	in->req.qp_type = XSC_QUEUE_TYPE_RAW_TX;
+	in->req.qp_type = tso_en ? XSC_QUEUE_TYPE_RAW_TSO : XSC_QUEUE_TYPE_RAW_TX;
 	in->req.log_sq_sz = log_sq_sz;
 	in->req.log_rq_sz = log_rq_sz;
 	in->req.dma_direct = 0;
@@ -717,6 +718,7 @@ xsc_vfio_tx_qp_create(struct xsc_dev *xdev, struct xsc_tx_qp_params *qp_params,
 	qp_info->qpn = qp->qpn;
 	qp_info->wqes = (struct xsc_wqe *)qp->mz->addr;
 	qp_info->wqe_n = rte_log2_u32(wqe_s);
+	qp_info->tso_en = tso_en ? 1 : 0;
 
 	if (xsc_dev_is_vf(xdev))
 		qp_info->qp_db = (uint32_t *)((uint8_t *)xdev->bar_addr + XSC_VF_TX_DB_ADDR);
-- 
2.25.1

  parent reply	other threads:[~2025-08-29  8:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-29  8:24 [PATCH 00/14] net/xsc: PMD updates Renyong Wan
2025-08-29  8:24 ` [PATCH 01/14] net/xsc: add FW version get support Renyong Wan
2025-08-29  8:24 ` Renyong Wan [this message]
2025-08-29  8:24 ` [PATCH 03/14] net/xsc: support module EEPROM dump Renyong Wan
2025-08-29  8:24 ` [PATCH 04/14] net/xsc: support promiscuous mode Renyong Wan
2025-08-29  8:24 ` [PATCH 05/14] net/xsc: add link status support Renyong Wan
2025-08-29  8:24 ` [PATCH 06/14] net/xsc: add link status event support Renyong Wan
2025-08-29  8:24 ` [PATCH 07/14] net/xsc: add FEC get and set support Renyong Wan
2025-08-29  8:24 ` [PATCH 08/14] net/xsc: optimize RSS queue creation Renyong Wan
2025-08-29  8:24 ` [PATCH 09/14] net/xsc: optimize QP and CQ memory allocation Renyong Wan
2025-08-29  8:24 ` [PATCH 10/14] net/xsc: optimize Rx path Renyong Wan
2025-08-29  8:24 ` [PATCH 11/14] net/xsc: optimize stop and close Renyong Wan
2025-08-29  8:24 ` [PATCH 12/14] net/xsc: support per port for multi-process Renyong Wan
2025-08-29  8:24 ` [PATCH 13/14] net/xsc: fix uninitialized value Renyong Wan
2025-08-29  8:24 ` [PATCH 14/14] net/xsc: update release notes for xsc PMD Renyong Wan

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=20250829082409.24369-3-wanry@yunsilicon.com \
    --to=wanry@yunsilicon.com \
    --cc=dev@dpdk.org \
    --cc=jacky@yunsilicon.com \
    --cc=nana@yunsilicon.com \
    --cc=qianr@yunsilicon.com \
    --cc=stephen@networkplumber.org \
    --cc=thomas@monjalon.net \
    --cc=weihg@yunsilicon.com \
    --cc=xudw@yunsilicon.com \
    --cc=zhangxx@yunsilicon.com \
    --cc=zhenghy@yunsilicon.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;
as well as URLs for NNTP newsgroup(s).