Introduce TCP segmentation offload (TSO) support for xsc PMD. Signed-off-by: Rong Qian <qi...@yunsilicon.com> Signed-off-by: Renyong Wan <wa...@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