From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com, Hemant Agrawal <hemant.agrawal@nxp.com>
Subject: [dpdk-dev] [PATCH v3 07/23] net/dpaa: support external buffers in Tx
Date: Wed, 24 Feb 2021 18:12:55 +0530 [thread overview]
Message-ID: <20210224124311.29799-8-hemant.agrawal@nxp.com> (raw)
In-Reply-To: <20210224124311.29799-1-hemant.agrawal@nxp.com>
This patch support tx of external buffers
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
drivers/net/dpaa/dpaa_rxtx.c | 39 +++++++++++++++++++++++++++---------
drivers/net/dpaa/dpaa_rxtx.h | 8 +-------
2 files changed, 31 insertions(+), 16 deletions(-)
diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c
index e38fba23c0..423de40e95 100644
--- a/drivers/net/dpaa/dpaa_rxtx.c
+++ b/drivers/net/dpaa/dpaa_rxtx.c
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright 2016 Freescale Semiconductor, Inc. All rights reserved.
- * Copyright 2017,2019 NXP
+ * Copyright 2017,2019-2021 NXP
*
*/
@@ -334,7 +334,7 @@ dpaa_unsegmented_checksum(struct rte_mbuf *mbuf, struct qm_fd *fd_arr)
}
}
-struct rte_mbuf *
+static struct rte_mbuf *
dpaa_eth_sg_to_mbuf(const struct qm_fd *fd, uint32_t ifid)
{
struct dpaa_bp_info *bp_info = DPAA_BPID_TO_POOL_INFO(fd->bpid);
@@ -791,13 +791,12 @@ uint16_t dpaa_eth_queue_rx(void *q,
return num_rx;
}
-int
+static int
dpaa_eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf,
struct qm_fd *fd,
- uint32_t bpid)
+ struct dpaa_bp_info *bp_info)
{
struct rte_mbuf *cur_seg = mbuf, *prev_seg = NULL;
- struct dpaa_bp_info *bp_info = DPAA_BPID_TO_POOL_INFO(bpid);
struct rte_mbuf *temp, *mi;
struct qm_sg_entry *sg_temp, *sgt;
int i = 0;
@@ -840,7 +839,7 @@ dpaa_eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf,
fd->format = QM_FD_SG;
fd->addr = temp->buf_iova;
fd->offset = temp->data_off;
- fd->bpid = bpid;
+ fd->bpid = bp_info ? bp_info->bpid : 0xff;
fd->length20 = mbuf->pkt_len;
while (i < DPAA_SGT_MAX_ENTRIES) {
@@ -862,6 +861,9 @@ dpaa_eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf,
DPAA_MEMPOOL_TO_BPID(cur_seg->pool);
}
cur_seg = cur_seg->next;
+ } else if (RTE_MBUF_HAS_EXTBUF(cur_seg)) {
+ sg_temp->bpid = 0xff;
+ cur_seg = cur_seg->next;
} else {
/* Get owner MBUF from indirect buffer */
mi = rte_mbuf_from_indirect(cur_seg);
@@ -911,6 +913,9 @@ tx_on_dpaa_pool_unsegmented(struct rte_mbuf *mbuf,
*/
DPAA_MBUF_TO_CONTIG_FD(mbuf, fd_arr, bp_info->bpid);
}
+ } else if (RTE_MBUF_HAS_EXTBUF(mbuf)) {
+ DPAA_MBUF_TO_CONTIG_FD(mbuf, fd_arr,
+ bp_info ? bp_info->bpid : 0xff);
} else {
/* This is data-containing core mbuf: 'mi' */
mi = rte_mbuf_from_indirect(mbuf);
@@ -929,7 +934,8 @@ tx_on_dpaa_pool_unsegmented(struct rte_mbuf *mbuf,
* been released by BMAN.
*/
rte_mbuf_refcnt_update(mi, 1);
- DPAA_MBUF_TO_CONTIG_FD(mbuf, fd_arr, bp_info->bpid);
+ DPAA_MBUF_TO_CONTIG_FD(mbuf, fd_arr,
+ bp_info ? bp_info->bpid : 0xff);
}
rte_pktmbuf_free(mbuf);
}
@@ -951,7 +957,7 @@ tx_on_dpaa_pool(struct rte_mbuf *mbuf,
tx_on_dpaa_pool_unsegmented(mbuf, bp_info, fd_arr);
} else if (mbuf->nb_segs > 1 &&
mbuf->nb_segs <= DPAA_SGT_MAX_ENTRIES) {
- if (dpaa_eth_mbuf_to_sg_fd(mbuf, fd_arr, bp_info->bpid)) {
+ if (dpaa_eth_mbuf_to_sg_fd(mbuf, fd_arr, bp_info)) {
DPAA_PMD_DEBUG("Unable to create Scatter Gather FD");
return 1;
}
@@ -1055,6 +1061,7 @@ dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
uint16_t state;
int ret, realloc_mbuf = 0;
uint32_t seqn, index, flags[DPAA_TX_BURST_SIZE] = {0};
+ struct rte_mbuf **orig_bufs = bufs;
if (unlikely(!DPAA_PER_LCORE_PORTAL)) {
ret = rte_dpaa_portal_init((void *)0);
@@ -1112,6 +1119,11 @@ dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
mp = mi->pool;
}
+ if (unlikely(RTE_MBUF_HAS_EXTBUF(mbuf))) {
+ bp_info = NULL;
+ goto indirect_buf;
+ }
+
bp_info = DPAA_MEMPOOL_TO_POOL_INFO(mp);
if (unlikely(mp->ops_index != bp_info->dpaa_ops_index ||
realloc_mbuf == 1)) {
@@ -1130,7 +1142,7 @@ dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
mbuf = temp_mbuf;
realloc_mbuf = 0;
}
-
+indirect_buf:
state = tx_on_dpaa_pool(mbuf, bp_info,
&fd_arr[loop]);
if (unlikely(state)) {
@@ -1157,6 +1169,15 @@ dpaa_eth_queue_tx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs)
DPAA_DP_LOG(DEBUG, "Transmitted %d buffers on queue: %p", sent, q);
+
+ loop = 0;
+ while (loop < sent) {
+ if (unlikely(RTE_MBUF_HAS_EXTBUF(*orig_bufs)))
+ rte_pktmbuf_free(*orig_bufs);
+ orig_bufs++;
+ loop++;
+ }
+
return sent;
}
diff --git a/drivers/net/dpaa/dpaa_rxtx.h b/drivers/net/dpaa/dpaa_rxtx.h
index d9d7e04f5c..99e09196e9 100644
--- a/drivers/net/dpaa/dpaa_rxtx.h
+++ b/drivers/net/dpaa/dpaa_rxtx.h
@@ -1,7 +1,7 @@
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright 2016 Freescale Semiconductor, Inc. All rights reserved.
- * Copyright 2017,2020 NXP
+ * Copyright 2017,2020-2021 NXP
*
*/
@@ -279,12 +279,6 @@ uint16_t dpaa_eth_tx_drop_all(void *q __rte_unused,
struct rte_mbuf **bufs __rte_unused,
uint16_t nb_bufs __rte_unused);
-struct rte_mbuf *dpaa_eth_sg_to_mbuf(const struct qm_fd *fd, uint32_t ifid);
-
-int dpaa_eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf,
- struct qm_fd *fd,
- uint32_t bpid);
-
uint16_t dpaa_free_mbuf(const struct qm_fd *fd);
void dpaa_rx_cb(struct qman_fq **fq,
struct qm_dqrr_entry **dqrr, void **bufs, int num_bufs);
--
2.17.1
next prev parent reply other threads:[~2021-02-24 12:44 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-20 14:27 [dpdk-dev] [PATCH 0/7] NXP DPAAx ethernet PMD changes Hemant Agrawal
2021-01-20 14:27 ` [dpdk-dev] [PATCH 1/7] bus/fslmc: fix to use ci value for qbman 5.0 Hemant Agrawal
2021-02-02 11:36 ` Ferruh Yigit
2021-02-04 12:42 ` Hemant Agrawal
2021-01-20 14:27 ` [dpdk-dev] [PATCH 2/7] net/dpaa2: fix link get API implementation Hemant Agrawal
2021-01-20 14:27 ` [dpdk-dev] [PATCH 3/7] net/dpaa2: allocate SGT table from first segment Hemant Agrawal
2021-01-20 14:27 ` [dpdk-dev] [PATCH 4/7] net/dpaa2: support external buffers in Tx Hemant Agrawal
2021-01-20 14:27 ` [dpdk-dev] [PATCH 5/7] net/dpaa: " Hemant Agrawal
2021-01-20 14:27 ` [dpdk-dev] [PATCH 6/7] net/dpaa2: add traffic management driver Hemant Agrawal
2021-02-02 11:41 ` Ferruh Yigit
2021-02-04 10:47 ` Hemant Agrawal
2021-01-20 14:27 ` [dpdk-dev] [PATCH 7/7] net/dpaa2: add support to configure dpdmux max Rx frame len Hemant Agrawal
2021-02-02 11:38 ` Ferruh Yigit
2021-02-04 10:46 ` Hemant Agrawal
2021-01-20 14:27 ` [dpdk-dev] [PATCH 0/7] NXP DPAAx ethernet PMD changes Hemant Agrawal
2021-02-11 14:16 ` [dpdk-dev] [PATCH v2 00/20] " Hemant Agrawal
2021-02-11 14:16 ` [dpdk-dev] [PATCH v2 01/20] bus/fslmc: fix to use ci value for qbman 5.0 Hemant Agrawal
2021-02-11 14:16 ` [dpdk-dev] [PATCH v2 02/20] bus/dpaa: fix statistics reading Hemant Agrawal
2021-02-11 14:16 ` [dpdk-dev] [PATCH v2 03/20] net/dpaa2: fix link get API implementation Hemant Agrawal
2021-02-11 14:16 ` [dpdk-dev] [PATCH v2 04/20] net/dpaa: " Hemant Agrawal
2021-02-11 14:16 ` [dpdk-dev] [PATCH v2 05/20] net/dpaa2: allocate SGT table from first segment Hemant Agrawal
2021-02-11 14:16 ` [dpdk-dev] [PATCH v2 06/20] net/dpaa2: support external buffers in Tx Hemant Agrawal
2021-02-11 14:16 ` [dpdk-dev] [PATCH v2 07/20] net/dpaa: " Hemant Agrawal
2021-02-11 14:16 ` [dpdk-dev] [PATCH v2 08/20] net/dpaa2: add traffic management driver Hemant Agrawal
2021-02-11 14:16 ` [dpdk-dev] [PATCH v2 09/20] net/dpaa2: add support to configure dpdmux max Rx frame len Hemant Agrawal
2021-02-11 14:16 ` [dpdk-dev] [PATCH v2 10/20] net/dpaa2: add support for raw pattern in dpdmux Hemant Agrawal
2021-02-11 14:16 ` [dpdk-dev] [PATCH v2 11/20] net/dpaa2: dpdmux skip reset Hemant Agrawal
2021-02-11 14:16 ` [dpdk-dev] [PATCH v2 12/20] net/dpaa2: support dpdmux to not drop parse err pkts Hemant Agrawal
2021-02-11 14:16 ` [dpdk-dev] [PATCH v2 13/20] net/dpaa2: add device args for enable Tx confirmation Hemant Agrawal
2021-02-11 14:16 ` [dpdk-dev] [PATCH v2 14/20] net/dpaa2: optionally enable error queues Hemant Agrawal
2021-02-11 14:16 ` [dpdk-dev] [PATCH v2 15/20] mempool/dpaa2: support stats for secondary process Hemant Agrawal
2021-02-11 14:16 ` [dpdk-dev] [PATCH v2 16/20] net/dpaa: do not release the cgr ranges Hemant Agrawal
2021-02-11 14:16 ` [dpdk-dev] [PATCH v2 17/20] net/dpaa: prevent multiple mp config on an device Hemant Agrawal
2021-02-11 14:16 ` [dpdk-dev] [PATCH v2 18/20] bus/dpaa: secondary process init support Hemant Agrawal
2021-02-11 14:16 ` [dpdk-dev] [PATCH v2 19/20] bus/dpaa: support shared ethernet MAC interface Hemant Agrawal
2021-02-11 14:16 ` [dpdk-dev] [PATCH v2 20/20] bus/dpaa: enhance checks for bus and device detection Hemant Agrawal
2021-02-24 12:42 ` [dpdk-dev] [PATCH v3 00/23] NXP DPAAx ethernet PMD changes Hemant Agrawal
2021-02-24 12:42 ` [dpdk-dev] [PATCH v3 01/23] bus/fslmc: fix to use ci value for qbman 5.0 Hemant Agrawal
2021-02-24 12:42 ` [dpdk-dev] [PATCH v3 02/23] bus/dpaa: fix statistics reading Hemant Agrawal
2021-02-24 12:42 ` [dpdk-dev] [PATCH v3 03/23] net/dpaa2: fix link get API implementation Hemant Agrawal
2021-02-24 12:42 ` [dpdk-dev] [PATCH v3 04/23] net/dpaa: " Hemant Agrawal
2021-02-24 12:42 ` [dpdk-dev] [PATCH v3 05/23] net/dpaa2: allocate SGT table from first segment Hemant Agrawal
2021-02-24 12:42 ` [dpdk-dev] [PATCH v3 06/23] net/dpaa2: support external buffers in Tx Hemant Agrawal
2021-02-24 12:42 ` Hemant Agrawal [this message]
2021-02-24 12:42 ` [dpdk-dev] [PATCH v3 08/23] net/dpaa2: add traffic management driver Hemant Agrawal
2021-02-24 12:42 ` [dpdk-dev] [PATCH v3 09/23] net/dpaa2: add support to configure dpdmux max Rx frame len Hemant Agrawal
2021-02-24 17:22 ` Ferruh Yigit
2021-02-24 12:42 ` [dpdk-dev] [PATCH v3 10/23] net/dpaa2: add support for raw pattern in dpdmux Hemant Agrawal
2021-02-24 12:42 ` [dpdk-dev] [PATCH v3 11/23] net/dpaa2: dpdmux skip reset Hemant Agrawal
2021-02-24 12:43 ` [dpdk-dev] [PATCH v3 12/23] net/dpaa2: support dpdmux to not drop parse err pkts Hemant Agrawal
2021-02-24 12:43 ` [dpdk-dev] [PATCH v3 13/23] net/dpaa2: add device args for enable Tx confirmation Hemant Agrawal
2021-02-24 12:43 ` [dpdk-dev] [PATCH v3 14/23] net/dpaa2: optionally enable error queues Hemant Agrawal
2021-02-24 12:43 ` [dpdk-dev] [PATCH v3 15/23] net/dpaa2: change Tx queue congestion settings Hemant Agrawal
2021-02-24 12:43 ` [dpdk-dev] [PATCH v3 16/23] mempool/dpaa2: support stats for secondary process Hemant Agrawal
2021-02-24 12:43 ` [dpdk-dev] [PATCH v3 17/23] net/dpaa: do not release the cgr ranges Hemant Agrawal
2021-02-24 12:43 ` [dpdk-dev] [PATCH v3 18/23] net/dpaa: prevent multiple mp config on an device Hemant Agrawal
2021-02-24 12:43 ` [dpdk-dev] [PATCH v3 19/23] bus/dpaa: secondary process init support Hemant Agrawal
2021-02-24 12:43 ` [dpdk-dev] [PATCH v3 20/23] bus/dpaa: support shared ethernet MAC interface Hemant Agrawal
2021-02-24 12:43 ` [dpdk-dev] [PATCH v3 21/23] bus/dpaa: enhance checks for bus and device detection Hemant Agrawal
2021-02-24 12:43 ` [dpdk-dev] [PATCH v3 22/23] net/dpaa2: add Rx buf size support Hemant Agrawal
2021-02-24 12:43 ` [dpdk-dev] [PATCH v3 23/23] net/dpaa: " Hemant Agrawal
2021-02-24 17:23 ` [dpdk-dev] [PATCH v3 00/23] NXP DPAAx ethernet PMD changes Ferruh Yigit
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=20210224124311.29799-8-hemant.agrawal@nxp.com \
--to=hemant.agrawal@nxp.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.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).