From patchwork Wed Feb 24 12:43:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 386850 Delivered-To: patch@linaro.org Received: by 2002:a02:290e:0:0:0:0:0 with SMTP id p14csp342585jap; Wed, 24 Feb 2021 04:45:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJznDo2fc/8ZjE08FK+JK1nOyveHGL22zFU5Yu823BIpkJRdtT3dVgmBkKtTrpNwH5sHkv27 X-Received: by 2002:a17:907:1187:: with SMTP id uz7mr30372706ejb.266.1614170708415; Wed, 24 Feb 2021 04:45:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614170708; cv=none; d=google.com; s=arc-20160816; b=XFOFXSQSkUuBm5RK6lz9zDRgYATYebbFTIzPnpyXug/Vf5oS4gU9XEjXqRl6F6SgZ5 nrTjtGY3lRaZ4DtLPjmuwaB5z062hLzV53dlgOMIuBOeE96DYNg2K1ERcGREKnof4f4U zyGmYrOht9NqEninRHI/Y9mBTDyLLOz/phK20Cpeqfs7UzusKPxLjMacXUKgo+V7wwoN oP48Daw8PhOxMljC1ZKCmaIT4CGyh6eXHFTOz3LpKsB8UAb/7HLZzHt97qzU5BsDOtfb s2bOD/jkkCDxDEKr7Stk7vbVHB8/jOihFT2E0pSxhHNEHZdRILRr83JX9iXnVOycHQm5 ZtEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:cc:to:from; bh=cCU4nSey+M6Q29r+sgS6WeHqFPqCx8nsFyKq4KhBzRM=; b=Y7cBgJ4RZTIvwgSgbvuW5ud+22UPFmQOA+OjmOrJ8DNT35uA4qxSF7HToj6JTurLdg 6pg54M1hI6kS59dJmVGCQejlcWpJZHitY4Tn4s36ThYtg/J2MJT6TUmad/zudtdDR06q xWV52wtu9L3vEUaJNNMRb/GxY2aDNx2k00lg73HcBSxu4TGkHkthgbTlfaAuyfbEbS5E 71DL3LP4q43jPIA0FX4a8V8mAm613OODqxJUlUFAqaD1mwEX+yUpn09BP/JGr8IWS9JA aN6Oz3sqmywX+FMfMsg8PJ7sOsSpL8iVrP8fxAx5ZoHQsBTqO4+LYEJVnQEuXEgBqoJy d1RA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from mails.dpdk.org (mails.dpdk.org. [217.70.189.124]) by mx.google.com with ESMTP id bx24si1202709ejb.98.2021.02.24.04.45.08; Wed, 24 Feb 2021 04:45:08 -0800 (PST) Received-SPF: pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) client-ip=217.70.189.124; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dev-bounces@dpdk.org designates 217.70.189.124 as permitted sender) smtp.mailfrom=dev-bounces@dpdk.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4D457160893; Wed, 24 Feb 2021 13:43:38 +0100 (CET) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by mails.dpdk.org (Postfix) with ESMTP id 0ADB516084B for ; Wed, 24 Feb 2021 13:43:27 +0100 (CET) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id D78982005AF; Wed, 24 Feb 2021 13:43:26 +0100 (CET) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 8905E20058F; Wed, 24 Feb 2021 13:43:24 +0100 (CET) Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.133.63]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id E900340281; Wed, 24 Feb 2021 13:43:21 +0100 (CET) From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Hemant Agrawal Date: Wed, 24 Feb 2021 18:13:01 +0530 Message-Id: <20210224124311.29799-14-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210224124311.29799-1-hemant.agrawal@nxp.com> References: <20210211141620.12482-1-hemant.agrawal@nxp.com> <20210224124311.29799-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH v3 13/23] net/dpaa2: add device args for enable Tx confirmation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add support for dev arg ``fslmc:dpni.1,drv_tx_conf=1`` It is optional for dpaa2 to use TX confirmation. DPAA2 can free the transmitted packets. However some use-case requires the TX confirmation to be explicit. Signed-off-by: Hemant Agrawal --- doc/guides/nics/dpaa2.rst | 4 ++++ drivers/net/dpaa2/dpaa2_ethdev.c | 35 +++++++++++++++++--------------- drivers/net/dpaa2/dpaa2_ethdev.h | 5 +++-- 3 files changed, 26 insertions(+), 18 deletions(-) -- 2.17.1 diff --git a/doc/guides/nics/dpaa2.rst b/doc/guides/nics/dpaa2.rst index 893e87e714..4eec8fcdd9 100644 --- a/doc/guides/nics/dpaa2.rst +++ b/doc/guides/nics/dpaa2.rst @@ -484,6 +484,10 @@ for details. of the packet pull command which is issued in the previous cycle. e.g. ``fslmc:dpni.1,drv_no_prefetch=1`` +* Use dev arg option ``drv_tx_conf=1`` to enable TX confirmation mode. + In this mode tx conf queues need to be polled to free the buffers. + e.g. ``fslmc:dpni.1,drv_tx_conf=1`` + Enabling logs ------------- diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 490eb4b3f4..4b3eb7f5c9 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -31,6 +31,7 @@ #define DRIVER_LOOPBACK_MODE "drv_loopback" #define DRIVER_NO_PREFETCH_MODE "drv_no_prefetch" +#define DRIVER_TX_CONF "drv_tx_conf" #define CHECK_INTERVAL 100 /* 100ms */ #define MAX_REPEAT_TIME 90 /* 9s (90 * 100ms) in total */ @@ -363,7 +364,7 @@ dpaa2_alloc_rx_tx_queues(struct rte_eth_dev *dev) PMD_INIT_FUNC_TRACE(); num_rxqueue_per_tc = (priv->nb_rx_queues / priv->num_rx_tc); - if (priv->tx_conf_en) + if (priv->flags & DPAA2_TX_CONF_ENABLE) tot_queues = priv->nb_rx_queues + 2 * priv->nb_tx_queues; else tot_queues = priv->nb_rx_queues + priv->nb_tx_queues; @@ -401,7 +402,7 @@ dpaa2_alloc_rx_tx_queues(struct rte_eth_dev *dev) goto fail_tx; } - if (priv->tx_conf_en) { + if (priv->flags & DPAA2_TX_CONF_ENABLE) { /*Setup tx confirmation queues*/ for (i = 0; i < priv->nb_tx_queues; i++) { mc_q->eth_data = dev->data; @@ -483,7 +484,7 @@ dpaa2_free_rx_tx_queues(struct rte_eth_dev *dev) dpaa2_q = (struct dpaa2_queue *)priv->tx_vq[i]; rte_free(dpaa2_q->cscn); } - if (priv->tx_conf_en) { + if (priv->flags & DPAA2_TX_CONF_ENABLE) { /* cleanup tx conf queue storage */ for (i = 0; i < priv->nb_tx_queues; i++) { dpaa2_q = (struct dpaa2_queue *) @@ -857,7 +858,7 @@ dpaa2_dev_tx_queue_setup(struct rte_eth_dev *dev, if (tx_queue_id == 0) { /*Set tx-conf and error configuration*/ - if (priv->tx_conf_en) + if (priv->flags & DPAA2_TX_CONF_ENABLE) ret = dpni_set_tx_confirmation_mode(dpni, CMD_PRI_LOW, priv->token, DPNI_CONF_AFFINE); @@ -918,7 +919,7 @@ dpaa2_dev_tx_queue_setup(struct rte_eth_dev *dev, dpaa2_q->cb_eqresp_free = dpaa2_dev_free_eqresp_buf; dev->data->tx_queues[tx_queue_id] = dpaa2_q; - if (priv->tx_conf_en) { + if (priv->flags & DPAA2_TX_CONF_ENABLE) { dpaa2_q->tx_conf_queue = dpaa2_tx_conf_q; options = options | DPNI_QUEUE_OPT_USER_CTX; tx_conf_cfg.user_context = (size_t)(dpaa2_q); @@ -2614,10 +2615,14 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev) priv->max_vlan_filters = attr.vlan_filter_entries; priv->flags = 0; #if defined(RTE_LIBRTE_IEEE1588) - priv->tx_conf_en = 1; -#else - priv->tx_conf_en = 0; + printf("DPDK IEEE1588 is enabled\n"); + priv->flags |= DPAA2_TX_CONF_ENABLE; #endif + /* Used with ``fslmc:dpni.1,drv_tx_conf=1`` */ + if (dpaa2_get_devargs(dev->devargs, DRIVER_TX_CONF)) { + priv->flags |= DPAA2_TX_CONF_ENABLE; + DPAA2_PMD_INFO("TX_CONF Enabled"); + } /* Allocate memory for hardware structure for queues */ ret = dpaa2_alloc_rx_tx_queues(eth_dev); @@ -2650,7 +2655,7 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev) /* ... tx buffer layout ... */ memset(&layout, 0, sizeof(struct dpni_buffer_layout)); - if (priv->tx_conf_en) { + if (priv->flags & DPAA2_TX_CONF_ENABLE) { layout.options = DPNI_BUF_LAYOUT_OPT_FRAME_STATUS | DPNI_BUF_LAYOUT_OPT_TIMESTAMP; layout.pass_timestamp = true; @@ -2667,13 +2672,11 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev) /* ... tx-conf and error buffer layout ... */ memset(&layout, 0, sizeof(struct dpni_buffer_layout)); - if (priv->tx_conf_en) { - layout.options = DPNI_BUF_LAYOUT_OPT_FRAME_STATUS | - DPNI_BUF_LAYOUT_OPT_TIMESTAMP; + if (priv->flags & DPAA2_TX_CONF_ENABLE) { + layout.options = DPNI_BUF_LAYOUT_OPT_TIMESTAMP; layout.pass_timestamp = true; - } else { - layout.options = DPNI_BUF_LAYOUT_OPT_FRAME_STATUS; } + layout.options |= DPNI_BUF_LAYOUT_OPT_FRAME_STATUS; layout.pass_frame_status = 1; ret = dpni_set_buffer_layout(dpni_dev, CMD_PRI_LOW, priv->token, DPNI_QUEUE_TX_CONFIRM, &layout); @@ -2807,7 +2810,6 @@ rte_dpaa2_probe(struct rte_dpaa2_driver *dpaa2_drv, eth_dev->data->dev_private = (void *)dev_priv; /* Store a pointer to eth_dev in dev_private */ dev_priv->eth_dev = eth_dev; - dev_priv->tx_conf_en = 0; } else { eth_dev = rte_eth_dev_attach_secondary(dpaa2_dev->device.name); if (!eth_dev) { @@ -2860,5 +2862,6 @@ static struct rte_dpaa2_driver rte_dpaa2_pmd = { RTE_PMD_REGISTER_DPAA2(net_dpaa2, rte_dpaa2_pmd); RTE_PMD_REGISTER_PARAM_STRING(net_dpaa2, DRIVER_LOOPBACK_MODE "= " - DRIVER_NO_PREFETCH_MODE "="); + DRIVER_NO_PREFETCH_MODE "=" + DRIVER_TX_CONF "="); RTE_LOG_REGISTER(dpaa2_logtype_pmd, pmd.net.dpaa2, NOTICE); diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h index 9837eb62c8..becdb50055 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.h +++ b/drivers/net/dpaa2/dpaa2_ethdev.h @@ -60,6 +60,8 @@ /* Disable RX tail drop, default is enable */ #define DPAA2_RX_TAILDROP_OFF 0x04 +/* Tx confirmation enabled */ +#define DPAA2_TX_CONF_ENABLE 0x08 #define DPAA2_RSS_OFFLOAD_ALL ( \ ETH_RSS_L2_PAYLOAD | \ @@ -152,14 +154,13 @@ struct dpaa2_dev_priv { void *tx_vq[MAX_TX_QUEUES]; struct dpaa2_bp_list *bp_list; /**