From patchwork Wed Jan 20 14:27:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 367042 Delivered-To: patch@linaro.org Received: by 2002:a17:906:24d5:0:0:0:0 with SMTP id f21csp227531ejb; Wed, 20 Jan 2021 06:38:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJw6BWXS9Q5LrpJe9JG+Yn/xcpTbTTL50pAQBfjMS6ruCO4oCFQVseujzNNEHtaIQjnEKI3b X-Received: by 2002:a05:6402:3589:: with SMTP id y9mr7692700edc.344.1611153534138; Wed, 20 Jan 2021 06:38:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611153534; cv=none; d=google.com; s=arc-20160816; b=WTADv1U60cB9SThrgEhZ7mWxAKS2gbZZjAkVXrRHtci60HfL7rH8DDIP6B5qzJf0co Ibp+J6zvoWpz0ZdmaVhIiZ0JZTbhYJgxkJcwALRWnLhgnck6Q3SDvSXHVvmyV1LU3M9P pdQe6iKKKEbYkTw0UwSHGr6BUlZTP5mqOgHnE4kXDYMXGfWtfeuR9OacH0PYtxpjZJGa PXEq2SOmprHR+4dToMggMFvX7MMb/jhzdEzCUInFPcfH3Fdpd0ahEgQzVcuXdDdalN12 gaNbfqVixqIz3KprM3KEE9cQxwgsVusCS1UnFYIuWufpENQmOg7XHupbNJ9fgNEujcM2 N/RQ== 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:to:from; bh=Yie+G+rgwN4mTjKDuLcs38iD8MBEwcoB5Er54TTlG3Q=; b=Dgsc7JmFabhnar+yl6UsGvDgZclrqCJdO52F3w0A6MdM8Asr1Vl/K+vWvp4RJRKP/X shbJSWHDXPu2zvVhTzyDeRUTq30txiZUMee12KFb5G+BsHL19jnflocmXzq6NLiNNCXa GoZEhn2EpMHd1skGDM7Rk0s3VmMjvQXAEMWzjqqh2KJumyBT7pULTdnJNk+j2XdCPYzG hEcNCfMZ739CnwlcPp+n9xYk8BjvDUJmx1slf6eLivyRDOlbMQIKSDB9HOyM+Wtc4BVV AAxH3RCLCOLb3mg63T2grgYpTC1Hi2+zxYgLLM6GXWZ9+4pe8LQWnDhbtVGNo5v/pZ0E IowA== 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 x19si926512edr.378.2021.01.20.06.38.53; Wed, 20 Jan 2021 06:38:54 -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 F2143140DC2; Wed, 20 Jan 2021 15:38:25 +0100 (CET) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) by mails.dpdk.org (Postfix) with ESMTP id 983F6140D47 for ; Wed, 20 Jan 2021 15:38:20 +0100 (CET) Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 5C4472014E3; Wed, 20 Jan 2021 15:38:20 +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 1A84D2014DD; Wed, 20 Jan 2021 15:38:19 +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 17A7F40324; Wed, 20 Jan 2021 15:38:17 +0100 (CET) From: Hemant Agrawal To: dev@dpdk.org, ferruh.yigit@intel.com Date: Wed, 20 Jan 2021 19:57:19 +0530 Message-Id: <20210120142723.14090-5-hemant.agrawal@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210120142723.14090-1-hemant.agrawal@nxp.com> References: <20210120142723.14090-1-hemant.agrawal@nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Subject: [dpdk-dev] [PATCH 4/7] net/dpaa2: support external buffers in Tx 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" From: Nipun Gupta This patch support tx of external allocated buffers. Signed-off-by: Nipun Gupta Acked-by: Hemant Agrawal --- drivers/net/dpaa2/dpaa2_rxtx.c | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) -- 2.17.1 diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c index 7d2a7809d3..de297d8274 100644 --- a/drivers/net/dpaa2/dpaa2_rxtx.c +++ b/drivers/net/dpaa2/dpaa2_rxtx.c @@ -1065,6 +1065,7 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) struct rte_eth_dev_data *eth_data = dpaa2_q->eth_data; struct dpaa2_dev_priv *priv = eth_data->dev_private; uint32_t flags[MAX_TX_RING_SLOTS] = {0}; + struct rte_mbuf **orig_bufs = bufs; if (unlikely(!DPAA2_PER_LCORE_DPIO)) { ret = dpaa2_affine_qbman_swp(); @@ -1148,6 +1149,25 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) mi = rte_mbuf_from_indirect(*bufs); mp = mi->pool; } + + if (unlikely(RTE_MBUF_HAS_EXTBUF(*bufs))) { + rte_mbuf_refcnt_update(*bufs, 1); + if (unlikely((*bufs)->nb_segs > 1)) { + if (eth_mbuf_to_sg_fd(*bufs, + &fd_arr[loop], + mp, 0)) + goto send_n_return; + } else { + eth_mbuf_to_fd(*bufs, + &fd_arr[loop], 0); + } + bufs++; +#ifdef RTE_LIBRTE_IEEE1588 + enable_tx_tstamp(&fd_arr[loop]); +#endif + continue; + } + /* Not a hw_pkt pool allocated frame */ if (unlikely(!mp || !priv->bp_list)) { DPAA2_PMD_ERR("Err: No buffer pool attached"); @@ -1220,6 +1240,15 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) nb_pkts -= loop; } dpaa2_q->tx_pkts += num_tx; + + loop = 0; + while (loop < num_tx) { + if (unlikely(RTE_MBUF_HAS_EXTBUF(*orig_bufs))) + rte_pktmbuf_free(*orig_bufs); + orig_bufs++; + loop++; + } + return num_tx; send_n_return: @@ -1246,6 +1275,15 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) } skip_tx: dpaa2_q->tx_pkts += num_tx; + + loop = 0; + while (loop < num_tx) { + if (unlikely(RTE_MBUF_HAS_EXTBUF(*orig_bufs))) + rte_pktmbuf_free(*orig_bufs); + orig_bufs++; + loop++; + } + return num_tx; }