DPDK patches and discussions
 help / color / mirror / Atom feed
From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: <dev@dpdk.org>
Cc: <ferruh.yigit@intel.com>, <shreyansh.jain@nxp.com>,
	Nipun Gupta <nipun.gupta@nxp.com>
Subject: [dpdk-dev] [PATCH 13/14] net/dpaa2: optimize Tx path for best case
Date: Fri, 8 Dec 2017 10:51:26 +0530	[thread overview]
Message-ID: <1512710487-32388-14-git-send-email-hemant.agrawal@nxp.com> (raw)
In-Reply-To: <1512710487-32388-1-git-send-email-hemant.agrawal@nxp.com>

From: Nipun Gupta <nipun.gupta@nxp.com>

This patch handles the non-sg packets in more optimized way.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 drivers/bus/fslmc/portal/dpaa2_hw_pvt.h |  2 ++
 drivers/net/dpaa2/dpaa2_rxtx.c          | 44 +++++++++++++++++++++++----------
 2 files changed, 33 insertions(+), 13 deletions(-)

diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
index c29d7f3..fd9e656 100644
--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
+++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h
@@ -204,6 +204,8 @@ enum qbman_fd_format {
 } while (0)
 #define DPAA2_SET_FD_LEN(fd, length)	((fd)->simple.len = length)
 #define DPAA2_SET_FD_BPID(fd, bpid)	((fd)->simple.bpid_offset |= bpid)
+#define DPAA2_SET_ONLY_FD_BPID(fd, bpid) \
+	((fd)->simple.bpid_offset = bpid)
 #define DPAA2_SET_FD_IVP(fd)   (((fd)->simple.bpid_offset |= 0x00004000))
 #define DPAA2_SET_FD_OFFSET(fd, offset)	\
 	(((fd)->simple.bpid_offset |= (uint32_t)(offset) << 16))
diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
index 5c75cfa..e8edc67 100644
--- a/drivers/net/dpaa2/dpaa2_rxtx.c
+++ b/drivers/net/dpaa2/dpaa2_rxtx.c
@@ -50,6 +50,14 @@
 #include "dpaa2_ethdev.h"
 #include "base/dpaa2_hw_dpni_annot.h"
 
+#define DPAA2_MBUF_TO_CONTIG_FD(_mbuf, _fd, _bpid)  do { \
+	DPAA2_SET_FD_ADDR(_fd, DPAA2_MBUF_VADDR_TO_IOVA(_mbuf)); \
+	DPAA2_SET_FD_LEN(_fd, _mbuf->data_len); \
+	DPAA2_SET_ONLY_FD_BPID(_fd, _bpid); \
+	DPAA2_SET_FD_OFFSET(_fd, _mbuf->data_off); \
+	DPAA2_SET_FD_ASAL(_fd, DPAA2_ASAL_VAL); \
+} while (0)
+
 static inline void __attribute__((hot))
 dpaa2_dev_rx_parse_frc(struct rte_mbuf *m, uint16_t frc)
 {
@@ -436,11 +444,7 @@ eth_mbuf_to_fd(struct rte_mbuf *mbuf,
 	/*Resetting the buffer pool id and offset field*/
 	fd->simple.bpid_offset = 0;
 
-	DPAA2_SET_FD_ADDR(fd, DPAA2_MBUF_VADDR_TO_IOVA(mbuf));
-	DPAA2_SET_FD_LEN(fd, mbuf->data_len);
-	DPAA2_SET_FD_BPID(fd, bpid);
-	DPAA2_SET_FD_OFFSET(fd, mbuf->data_off);
-	DPAA2_SET_FD_ASAL(fd, DPAA2_ASAL_VAL);
+	DPAA2_MBUF_TO_CONTIG_FD(mbuf, fd, bpid);
 
 	PMD_TX_LOG(DEBUG, "mbuf =%p, mbuf->buf_addr =%p, off = %d,"
 		"fd_off=%d fd =%lx, meta = %d  bpid =%d, len=%d\n",
@@ -497,11 +501,7 @@ eth_copy_mbuf_to_fd(struct rte_mbuf *mbuf,
 	/*Resetting the buffer pool id and offset field*/
 	fd->simple.bpid_offset = 0;
 
-	DPAA2_SET_FD_ADDR(fd, DPAA2_MBUF_VADDR_TO_IOVA(m));
-	DPAA2_SET_FD_LEN(fd, mbuf->data_len);
-	DPAA2_SET_FD_BPID(fd, bpid);
-	DPAA2_SET_FD_OFFSET(fd, mbuf->data_off);
-	DPAA2_SET_FD_ASAL(fd, DPAA2_ASAL_VAL);
+	DPAA2_MBUF_TO_CONTIG_FD(m, fd, bpid);
 
 	PMD_TX_LOG(DEBUG, " mbuf %p BMAN buf addr %p",
 		   (void *)mbuf, mbuf->buf_addr);
@@ -721,8 +721,26 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 			fd_arr[loop].simple.frc = 0;
 			DPAA2_RESET_FD_CTRL((&fd_arr[loop]));
 			DPAA2_SET_FD_FLC((&fd_arr[loop]), NULL);
-			if (RTE_MBUF_DIRECT(*bufs)) {
+			if (likely(RTE_MBUF_DIRECT(*bufs))) {
 				mp = (*bufs)->pool;
+				/* Check the basic scenario and set
+				 * the FD appropriately here itself.
+				 */
+				if (likely(mp && mp->ops_index ==
+				    priv->bp_list->dpaa2_ops_index &&
+				    (*bufs)->nb_segs == 1 &&
+				    rte_mbuf_refcnt_read((*bufs)) == 1)) {
+					if (unlikely((*bufs)->ol_flags
+						& PKT_TX_VLAN_PKT)) {
+						ret = rte_vlan_insert(bufs);
+						if (ret)
+							goto send_n_return;
+					}
+					DPAA2_MBUF_TO_CONTIG_FD((*bufs),
+					&fd_arr[loop], mempool_to_bpid(mp));
+					bufs++;
+					continue;
+				}
 			} else {
 				mi = rte_mbuf_from_indirect(*bufs);
 				mp = mi->pool;
@@ -771,9 +789,9 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 		}
 
 		num_tx += frames_to_send;
-		dpaa2_q->tx_pkts += frames_to_send;
 		nb_pkts -= frames_to_send;
 	}
+	dpaa2_q->tx_pkts += num_tx;
 	return num_tx;
 
 send_n_return:
@@ -786,9 +804,9 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts)
 							&fd_arr[i], loop - i);
 		}
 		num_tx += loop;
-		dpaa2_q->tx_pkts += loop;
 	}
 skip_tx:
+	dpaa2_q->tx_pkts += num_tx;
 	return num_tx;
 }
 
-- 
2.7.4

  parent reply	other threads:[~2017-12-08  5:22 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-08  5:21 [dpdk-dev] [PATCH 00/14] DPAA2 PMD fixes and enhancements Hemant Agrawal
2017-12-08  5:21 ` [dpdk-dev] [PATCH 01/14] bus/fslmc: fix the cplusplus macro closure Hemant Agrawal
2017-12-08  5:21 ` [dpdk-dev] [PATCH 02/14] drivers: change the deprecated memseg physaddr to iova Hemant Agrawal
2017-12-08  5:29   ` santosh
2017-12-08  5:21 ` [dpdk-dev] [PATCH 03/14] bus/fslmc: add support for dynamic iova for DPAA2 devices Hemant Agrawal
2017-12-12  0:52   ` Ferruh Yigit
2017-12-08  5:21 ` [dpdk-dev] [PATCH 04/14] net/dpaa2: link status check as driver flag Hemant Agrawal
2017-12-08  5:21 ` [dpdk-dev] [PATCH 05/14] bus/fslmc: expose platform soc value register Hemant Agrawal
2017-12-08  5:21 ` [dpdk-dev] [PATCH 06/14] bus/fslmc: add braces for pointers in macros Hemant Agrawal
2017-12-12  0:52   ` Ferruh Yigit
2017-12-12  5:22     ` Hemant Agrawal
2017-12-08  5:21 ` [dpdk-dev] [PATCH 07/14] bus/fslmc: add qman HW fq query count API Hemant Agrawal
2017-12-08  5:21 ` [dpdk-dev] [PATCH 08/14] net/dpaa2: add Rx queue count support Hemant Agrawal
2017-12-12  1:28   ` Stephen Hemminger
2017-12-12  5:14     ` Hemant Agrawal
2017-12-08  5:21 ` [dpdk-dev] [PATCH 09/14] net/dpaa2: align the frame size in MTU set Hemant Agrawal
2017-12-08  5:21 ` [dpdk-dev] [PATCH 10/14] net/dpaa2: add VLAN insert offload Hemant Agrawal
2017-12-08  5:21 ` [dpdk-dev] [PATCH 11/14] net/dpaa2: add parse function for LX2 device Hemant Agrawal
2017-12-08  5:21 ` [dpdk-dev] [PATCH 12/14] net/dpaa2: optimize Rx path packet parsing Hemant Agrawal
2017-12-08  5:21 ` Hemant Agrawal [this message]
2017-12-08  5:21 ` [dpdk-dev] [PATCH 14/14] net/dpaa2: prefetch the parse results from next fd Hemant Agrawal
2017-12-12  0:53 ` [dpdk-dev] [PATCH 00/14] DPAA2 PMD fixes and enhancements 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=1512710487-32388-14-git-send-email-hemant.agrawal@nxp.com \
    --to=hemant.agrawal@nxp.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=nipun.gupta@nxp.com \
    --cc=shreyansh.jain@nxp.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).