From patchwork Wed Feb 24 12:42:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 386844 Delivered-To: patch@linaro.org Received: by 2002:a02:290e:0:0:0:0:0 with SMTP id p14csp342089jap; Wed, 24 Feb 2021 04:44:17 -0800 (PST) X-Google-Smtp-Source: ABdhPJwwRhEXql5XpByi//90mvgkhCDRFnFBfqgWqnvISyK1u3TDCfyWQ0DYM23zASjZ3GPpN3gf X-Received: by 2002:aa7:da4b:: with SMTP id w11mr24480575eds.66.1614170657419; Wed, 24 Feb 2021 04:44:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614170657; cv=none; d=google.com; s=arc-20160816; b=0q6XTi3GV9foHt3PpHSEMXPCSIFtlTuz7rBDZrbSVMiB8PQysobVCHjDxODA9xHrlu E4Y/8q5urPd+KWavomtQctHOe8YBDoxqVIWJJ+CcxMpLKIt8Rj2vM947yjDPZPDVKh5E G+wIWTtpiND1hxxxQoqslXsW6lBCBs5O41+TCP8U2GmpZ/s1apOLvywN9c509vcx33IC 7Qn7kIxPMQsk8cg5GU3eJrFnFTMMy/2+ZdK7rAZVWS4Qs86tVuVDu+pOJMT0RHp9YHtq hwoTk6A7T8j4CNmPUHdpoaQI9f3wTODJmBr2CmtPLLn4bHsxFNwxXfHd+vkQSmBauoYM 1ujQ== 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=QVrT/IjaKUSROkVjF+ntYXizs4SFF5t88pSiV9zi9Dk=; b=IocHy5jcWcM7VQ+NFxUegI+vRY8BDUQai+fSXyx2TGYmu57HfYuJ0YnGQaSlwX/LoR o4vKH3DQFaA75pIVjesJSCHd3I3YlF62V1VRgYUXLLFmdn4qou2r5nv/dJUsl7nxiAwL 6ENDBeTaEOCyrQFPRjeuYgEKlnZYMqovhoRBY0HY5+KRL1qKE6v2YaN5fAeR+K2M+hRo gviYqqqtDCWZ8Kbglc1qVIHA3mpnkaq1KUT6fEwsuOAadi1/1jQIbC3BFXG/A7o+w2nV tfci0QHqzDFsa5t7vy3cQtuyts9nH6GPPRKMi81ExXu9yiGH/hn9fDzOo7x+qdCWHWfZ dTWQ== 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 h27si1242665ejd.660.2021.02.24.04.44.17; Wed, 24 Feb 2021 04:44:17 -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 CB486160860; Wed, 24 Feb 2021 13:43:30 +0100 (CET) Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by mails.dpdk.org (Postfix) with ESMTP id C389F160840 for ; Wed, 24 Feb 2021 13:43:23 +0100 (CET) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 9A59D1A0391; Wed, 24 Feb 2021 13:43:23 +0100 (CET) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 0A0B21A039A; Wed, 24 Feb 2021 13:43:21 +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 6B8CE40328; Wed, 24 Feb 2021 13:43:17 +0100 (CET) From: Hemant Agrawal To: dev@dpdk.org Cc: ferruh.yigit@intel.com, Nipun Gupta , Sachin Saxena Date: Wed, 24 Feb 2021 18:12:54 +0530 Message-Id: <20210224124311.29799-7-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 06/23] 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 Signed-off-by: Sachin Saxena Acked-by: Hemant Agrawal --- drivers/net/dpaa2/dpaa2_rxtx.c | 42 ++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) -- 2.17.1 diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c index c11ed0ee61..7deba3aed3 100644 --- a/drivers/net/dpaa2/dpaa2_rxtx.c +++ b/drivers/net/dpaa2/dpaa2_rxtx.c @@ -450,6 +450,9 @@ eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf, } } cur_seg = cur_seg->next; + } else if (RTE_MBUF_HAS_EXTBUF(cur_seg)) { + DPAA2_SET_FLE_IVP(sge); + cur_seg = cur_seg->next; } else { /* Get owner MBUF from indirect buffer */ mi = rte_mbuf_from_indirect(cur_seg); @@ -494,6 +497,8 @@ eth_mbuf_to_fd(struct rte_mbuf *mbuf, DPAA2_SET_FD_IVP(fd); rte_mbuf_refcnt_update(mbuf, -1); } + } else if (RTE_MBUF_HAS_EXTBUF(mbuf)) { + DPAA2_SET_FD_IVP(fd); } else { struct rte_mbuf *mi; @@ -1065,6 +1070,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 +1154,24 @@ 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))) { + 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 +1244,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 +1279,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; }