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 12/14] net/dpaa2: optimize Rx path packet parsing
Date: Fri, 8 Dec 2017 10:51:25 +0530	[thread overview]
Message-ID: <1512710487-32388-13-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>

Parsing the annotation has multiple if checks in the data path.
These are reduced for common cases like IPv4/IPv6 and UDP/TCP
packets to enhance performance of these generic cases.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
---
 drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h | 20 +++++++++++++
 drivers/net/dpaa2/dpaa2_rxtx.c               | 43 ++++++++++++++++++++++++----
 2 files changed, 58 insertions(+), 5 deletions(-)

diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h b/drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h
index e68febf..88a9d49 100644
--- a/drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h
+++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h
@@ -219,6 +219,26 @@ struct dpaa2_annot_hdr {
 #define L5_SOFT_PARSING_ERROR			BIT_POS(1)
 #define L3_IPV6_ROUTE_HDR_PRESENT		BIT_POS(0)
 
+#define DPAA2_L3_IPv4 (L3_IPV4_1_PRESENT | L3_IPV4_1_UNICAST | \
+	L3_IP_1_UNKNOWN_PROTOCOL | L3_IP_UNKNOWN_PROTOCOL)
+
+#define DPAA2_L3_IPv6 (L3_IPV6_1_PRESENT | L3_IPV6_1_UNICAST | \
+	L3_IP_1_UNKNOWN_PROTOCOL | L3_IP_UNKNOWN_PROTOCOL)
+
+#define DPAA2_L3_IPv4_TCP (L3_IPV4_1_PRESENT | L3_IPV4_1_UNICAST | \
+	L3_PROTO_TCP_PRESENT | L3_PROTO_TCP_CTRL_BIT_6_TO_11_PRESENT | \
+	L4_UNKNOWN_PROTOCOL)
+
+#define DPAA2_L3_IPv4_UDP (L3_IPV4_1_PRESENT | L3_IPV4_1_UNICAST | \
+	L3_PROTO_UDP_PRESENT | L4_UNKNOWN_PROTOCOL)
+
+#define DPAA2_L3_IPv6_TCP (L3_IPV6_1_PRESENT | L3_IPV6_1_UNICAST | \
+	L3_PROTO_TCP_PRESENT | L3_PROTO_TCP_CTRL_BIT_6_TO_11_PRESENT | \
+	L4_UNKNOWN_PROTOCOL)
+
+#define DPAA2_L3_IPv6_UDP (L3_IPV6_1_PRESENT | L3_IPV6_1_UNICAST | \
+	L3_PROTO_UDP_PRESENT | L4_UNKNOWN_PROTOCOL)
+
 /* Debug frame, otherwise supposed to be discarded */
 #define DPAA2_ETH_FAS_DISC	      0x80000000
 /* MACSEC frame */
diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
index 3b58a48..5c75cfa 100644
--- a/drivers/net/dpaa2/dpaa2_rxtx.c
+++ b/drivers/net/dpaa2/dpaa2_rxtx.c
@@ -120,14 +120,13 @@ dpaa2_dev_rx_parse_frc(struct rte_mbuf *m, uint16_t frc)
 }
 
 static inline uint32_t __attribute__((hot))
-dpaa2_dev_rx_parse(uint64_t hw_annot_addr)
+dpaa2_dev_rx_parse_slow(uint64_t hw_annot_addr)
 {
 	uint32_t pkt_type = RTE_PTYPE_UNKNOWN;
 	struct dpaa2_annot_hdr *annotation =
 			(struct dpaa2_annot_hdr *)hw_annot_addr;
 
 	PMD_RX_LOG(DEBUG, "annotation = 0x%lx   ", annotation->word4);
-
 	if (BIT_ISSET_AT_POS(annotation->word3, L2_ARP_PRESENT)) {
 		pkt_type = RTE_PTYPE_L2_ETHER_ARP;
 		goto parse_done;
@@ -183,6 +182,41 @@ dpaa2_dev_rx_parse(uint64_t hw_annot_addr)
 	return pkt_type;
 }
 
+
+static inline uint32_t __attribute__((hot))
+dpaa2_dev_rx_parse(uint64_t hw_annot_addr)
+{
+	struct dpaa2_annot_hdr *annotation =
+			(struct dpaa2_annot_hdr *)hw_annot_addr;
+
+	PMD_RX_LOG(DEBUG, "annotation = 0x%lx   ", annotation->word4);
+
+	/* Return some common types from parse processing */
+	switch (annotation->word4) {
+	case DPAA2_L3_IPv4:
+		return RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4;
+	case DPAA2_L3_IPv6:
+		return  RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6;
+	case DPAA2_L3_IPv4_TCP:
+		return  RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4 |
+				RTE_PTYPE_L4_TCP;
+	case DPAA2_L3_IPv4_UDP:
+		return  RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4 |
+				RTE_PTYPE_L4_UDP;
+	case DPAA2_L3_IPv6_TCP:
+		return  RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6 |
+				RTE_PTYPE_L4_TCP;
+	case DPAA2_L3_IPv6_UDP:
+		return  RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6 |
+				RTE_PTYPE_L4_UDP;
+	default:
+		PMD_RX_LOG(DEBUG, "Slow parse the parsing results\n");
+		break;
+	}
+
+	return dpaa2_dev_rx_parse_slow(hw_annot_addr);
+}
+
 static inline void __attribute__((hot))
 dpaa2_dev_rx_offload(uint64_t hw_annot_addr, struct rte_mbuf *mbuf)
 {
@@ -279,6 +313,8 @@ eth_fd_to_mbuf(const struct qbman_fd *fd)
 	mbuf->data_off = DPAA2_GET_FD_OFFSET(fd);
 	mbuf->data_len = DPAA2_GET_FD_LEN(fd);
 	mbuf->pkt_len = mbuf->data_len;
+	mbuf->next = NULL;
+	rte_mbuf_refcnt_set(mbuf, 1);
 
 	/* Parse the packet */
 	/* parse results for LX2 are there in FRC field of FD.
@@ -297,9 +333,6 @@ eth_fd_to_mbuf(const struct qbman_fd *fd)
 			     DPAA2_FD_PTA_SIZE, mbuf);
 	}
 
-	mbuf->next = NULL;
-	rte_mbuf_refcnt_set(mbuf, 1);
-
 	PMD_RX_LOG(DEBUG, "to mbuf - mbuf =%p, mbuf->buf_addr =%p, off = %d,"
 		"fd_off=%d fd =%lx, meta = %d  bpid =%d, len=%d\n",
 		mbuf, mbuf->buf_addr, mbuf->data_off,
-- 
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 ` Hemant Agrawal [this message]
2017-12-08  5:21 ` [dpdk-dev] [PATCH 13/14] net/dpaa2: optimize Tx path for best case Hemant Agrawal
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-13-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).