DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shreyansh Jain <shreyansh.jain@nxp.com>
To: dev@dpdk.org, ferruh.yigit@intel.com
Cc: thomas@monjalon.net, Hemant Agrawal <hemant.agrawal@nxp.com>
Subject: [dpdk-dev] [PATCH v2 14/15] net/dpaa2: support MBUF VLAN tci population from HW parser
Date: Wed, 26 Sep 2018 23:34:39 +0530	[thread overview]
Message-ID: <20180926180440.31726-15-shreyansh.jain@nxp.com> (raw)
In-Reply-To: <20180926180440.31726-1-shreyansh.jain@nxp.com>

From: Hemant Agrawal <hemant.agrawal@nxp.com>

This patch adds the support to update the mbuf vlan tci field
from the HW parse results in annotation area.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h | 40 ++++++++++++++
 drivers/net/dpaa2/dpaa2_rxtx.c               | 55 +++++++++++++-------
 2 files changed, 75 insertions(+), 20 deletions(-)

diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h b/drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h
index 779cdf2b2..adb730b71 100644
--- a/drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h
+++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni_annot.h
@@ -213,6 +213,46 @@ struct dpaa2_annot_hdr {
 #define DPAA2_L3_IPv6_UDP (L3_IPV6_1_PRESENT | L3_IPV6_1_UNICAST | \
 	L3_PROTO_UDP_PRESENT | L4_UNKNOWN_PROTOCOL)
 
+/**
+ * Macros to get values in word5
+ */
+#define SHIM_OFFSET_1(var)		((uint64_t)(var) & 0xFF00000000000000)
+#define SHIM_OFFSET_2(var)		((uint64_t)(var) & 0x00FF000000000000)
+#define IP_PID_OFFSET(var)		((uint64_t)(var) & 0x0000FF0000000000)
+#define ETH_OFFSET(var)			((uint64_t)(var) & 0x000000FF00000000)
+#define LLC_SNAP_OFFSET(var)		((uint64_t)(var) & 0x00000000FF000000)
+#define VLAN_TCI_OFFSET_1(var)		((uint64_t)(var) & 0x0000000000FF0000)
+#define VLAN_TCI_OFFSET_N(var)		((uint64_t)(var) & 0x000000000000FF00)
+#define LAST_ETYPE_OFFSET(var)		((uint64_t)(var) & 0x00000000000000FF)
+
+/**
+ * Macros to get values in word6
+ */
+#define PPPOE_OFFSET(var)		((uint64_t)(var) & 0xFF00000000000000)
+#define MPLS_OFFSET_1(var)		((uint64_t)(var) & 0x00FF000000000000)
+#define MPLS_OFFSET_N(var)		((uint64_t)(var) & 0x0000FF0000000000)
+#define ARP_OR_IP_OFFSET_1(var)		((uint64_t)(var) & 0x000000FF00000000)
+#define IP_N_OR_MIN_ENCAP_OFFSET(var)	((uint64_t)(var) & 0x00000000FF000000)
+#define GRE_OFFSET(var)			((uint64_t)(var) & 0x0000000000FF0000)
+#define L4_OFFSET(var)			((uint64_t)(var) & 0x000000000000FF00)
+#define GTP_OR_ESP_OR_IPSEC_OFFSET(var)	((uint64_t)(var) & 0x00000000000000FF)
+
+/**
+ * Macros to get values in word7
+ */
+#define IPV6_ROUTING_HDR_OFFSET_1(var)	((uint64_t)(var) & 0xFF00000000000000)
+#define IPV6_ROUTING_HDR_OFFSET_2(var)	((uint64_t)(var) & 0x00FF000000000000)
+#define NEXT_HDR_OFFSET(var)		((uint64_t)(var) & 0x0000FF0000000000)
+#define IPV6_FRAG_OFFSET(var)		((uint64_t)(var) & 0x000000FF00000000)
+#define GROSS_RUNNING_SUM(var)		((uint64_t)(var) & 0x00000000FFFF0000)
+#define RUNNING_SUM(var)		((uint64_t)(var) & 0x000000000000FFFF)
+
+/**
+ * Macros to get values in word8
+ */
+#define PARSE_ERROR_CODE(var)		((uint64_t)(var) & 0xFF00000000000000)
+#define SOFT_PARSING_CONTEXT(var)	((uint64_t)(var) & 0x00FFFFFFFFFFFFFF)
+
 /* 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 fcd48b389..bc8b9ff89 100644
--- a/drivers/net/dpaa2/dpaa2_rxtx.c
+++ b/drivers/net/dpaa2/dpaa2_rxtx.c
@@ -25,6 +25,10 @@
 #include "dpaa2_ethdev.h"
 #include "base/dpaa2_hw_dpni_annot.h"
 
+static inline uint32_t __attribute__((hot))
+dpaa2_dev_rx_parse_slow(struct rte_mbuf *mbuf,
+			struct dpaa2_annot_hdr *annotation);
+
 #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); \
@@ -40,8 +44,6 @@ dpaa2_dev_rx_parse_new(struct rte_mbuf *m, const struct qbman_fd *fd)
 {
 	uint16_t frc = DPAA2_GET_FD_FRC_PARSE_SUM(fd);
 
-	DPAA2_PMD_DP_DEBUG("frc = 0x%x\t", frc);
-
 	m->packet_type = RTE_PTYPE_UNKNOWN;
 	switch (frc) {
 	case DPAA2_PKT_TYPE_ETHER:
@@ -95,31 +97,45 @@ dpaa2_dev_rx_parse_new(struct rte_mbuf *m, const struct qbman_fd *fd)
 		m->packet_type = RTE_PTYPE_L2_ETHER |
 			RTE_PTYPE_L3_IPV6 | RTE_PTYPE_L4_ICMP;
 		break;
-	case DPAA2_PKT_TYPE_VLAN_1:
-	case DPAA2_PKT_TYPE_VLAN_2:
-		m->ol_flags |= PKT_RX_VLAN;
-		break;
-	/* More switch cases can be added */
-	/* TODO: Add handling for checksum error check from FRC */
 	default:
-		m->packet_type = RTE_PTYPE_UNKNOWN;
+		m->packet_type = dpaa2_dev_rx_parse_slow(m,
+		  (void *)((size_t)DPAA2_IOVA_TO_VADDR(DPAA2_GET_FD_ADDR(fd))
+			 + DPAA2_FD_PTA_SIZE));
 	}
 	m->hash.rss = fd->simple.flc_hi;
 	m->ol_flags |= PKT_RX_RSS_HASH;
 }
 
 static inline uint32_t __attribute__((hot))
-dpaa2_dev_rx_parse_slow(struct dpaa2_annot_hdr *annotation)
+dpaa2_dev_rx_parse_slow(struct rte_mbuf *mbuf,
+			struct dpaa2_annot_hdr *annotation)
 {
 	uint32_t pkt_type = RTE_PTYPE_UNKNOWN;
+	uint16_t *vlan_tci;
+
+	DPAA2_PMD_DP_DEBUG("(slow parse)annotation(3)=0x%" PRIx64 "\t"
+			"(4)=0x%" PRIx64 "\t",
+			annotation->word3, annotation->word4);
+
+	if (BIT_ISSET_AT_POS(annotation->word3, L2_VLAN_1_PRESENT)) {
+		vlan_tci = rte_pktmbuf_mtod_offset(mbuf, uint16_t *,
+			(VLAN_TCI_OFFSET_1(annotation->word5) >> 16));
+		mbuf->vlan_tci = rte_be_to_cpu_16(*vlan_tci);
+		mbuf->ol_flags |= PKT_RX_VLAN;
+		pkt_type |= RTE_PTYPE_L2_ETHER_VLAN;
+	} else if (BIT_ISSET_AT_POS(annotation->word3, L2_VLAN_N_PRESENT)) {
+		vlan_tci = rte_pktmbuf_mtod_offset(mbuf, uint16_t *,
+			(VLAN_TCI_OFFSET_1(annotation->word5) >> 16));
+		mbuf->vlan_tci = rte_be_to_cpu_16(*vlan_tci);
+		mbuf->ol_flags |= PKT_RX_VLAN | PKT_RX_QINQ;
+		pkt_type |= RTE_PTYPE_L2_ETHER_QINQ;
+	}
 
-	DPAA2_PMD_DP_DEBUG("(slow parse) Annotation = 0x%" PRIx64 "\t",
-			   annotation->word4);
 	if (BIT_ISSET_AT_POS(annotation->word3, L2_ARP_PRESENT)) {
-		pkt_type = RTE_PTYPE_L2_ETHER_ARP;
+		pkt_type |= RTE_PTYPE_L2_ETHER_ARP;
 		goto parse_done;
 	} else if (BIT_ISSET_AT_POS(annotation->word3, L2_ETH_MAC_PRESENT)) {
-		pkt_type = RTE_PTYPE_L2_ETHER;
+		pkt_type |= RTE_PTYPE_L2_ETHER;
 	} else {
 		goto parse_done;
 	}
@@ -179,16 +195,15 @@ dpaa2_dev_rx_parse(struct rte_mbuf *mbuf, void *hw_annot_addr)
 	DPAA2_PMD_DP_DEBUG("(fast parse) Annotation = 0x%" PRIx64 "\t",
 			   annotation->word4);
 
-	/* Check offloads first */
-	if (BIT_ISSET_AT_POS(annotation->word3,
-			     L2_VLAN_1_PRESENT | L2_VLAN_N_PRESENT))
-		mbuf->ol_flags |= PKT_RX_VLAN;
-
 	if (BIT_ISSET_AT_POS(annotation->word8, DPAA2_ETH_FAS_L3CE))
 		mbuf->ol_flags |= PKT_RX_IP_CKSUM_BAD;
 	else if (BIT_ISSET_AT_POS(annotation->word8, DPAA2_ETH_FAS_L4CE))
 		mbuf->ol_flags |= PKT_RX_L4_CKSUM_BAD;
 
+	/* Check detailed parsing requirement */
+	if (annotation->word3 & 0x7FFFFC3FFFF)
+		return dpaa2_dev_rx_parse_slow(mbuf, annotation);
+
 	/* Return some common types from parse processing */
 	switch (annotation->word4) {
 	case DPAA2_L3_IPv4:
@@ -211,7 +226,7 @@ dpaa2_dev_rx_parse(struct rte_mbuf *mbuf, void *hw_annot_addr)
 		break;
 	}
 
-	return dpaa2_dev_rx_parse_slow(annotation);
+	return dpaa2_dev_rx_parse_slow(mbuf, annotation);
 }
 
 static inline struct rte_mbuf *__attribute__((hot))
-- 
2.17.1

  parent reply	other threads:[~2018-09-26 18:06 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-17 10:36 [dpdk-dev] [PATCH 00/11] Upgrade DPAA2 FW and other feature/bug fixes Shreyansh Jain
2018-09-17 10:36 ` [dpdk-dev] [PATCH 01/11] bus/fslmc: upgrade mc FW APIs to 10.10.0 Shreyansh Jain
2018-09-17 10:36 ` [dpdk-dev] [PATCH 02/11] bus/fslmc: upgrade qdma " Shreyansh Jain
2018-09-17 10:36 ` [dpdk-dev] [PATCH 03/11] net/dpaa2: upgrade dpni to " Shreyansh Jain
2018-09-17 10:36 ` [dpdk-dev] [PATCH 04/11] crypto/dpaa2_sec: upgarde " Shreyansh Jain
2018-09-17 10:36 ` [dpdk-dev] [PATCH 05/11] bus/fslmc: support memory backed portals with QBMAN 5.0 Shreyansh Jain
2018-09-17 10:36 ` [dpdk-dev] [PATCH 06/11] bus/fslmc: support 32 enq and deq for LX2 platform Shreyansh Jain
2018-09-17 10:36 ` [dpdk-dev] [PATCH 07/11] bus/fslmc: disable annotation prefetch for LX2 Shreyansh Jain
2018-09-17 10:36 ` [dpdk-dev] [PATCH 08/11] net/dpaa2: fix IOVA conversion for congestion memory Shreyansh Jain
2018-09-17 10:36 ` [dpdk-dev] [PATCH 09/11] net/dpaa2: read hardware provided MAC for DPNI devices Shreyansh Jain
2018-09-17 10:36 ` [dpdk-dev] [PATCH 10/11] net/dpaa2: add per queue stats get and reset support Shreyansh Jain
2018-09-17 10:36 ` [dpdk-dev] [PATCH 11/11] net/dpaa2: fix VLAN filter enablement Shreyansh Jain
2018-09-26 18:04 ` [dpdk-dev] [PATCH v2 00/15] Upgrade DPAA2 FW and other feature/bug fixes Shreyansh Jain
2018-09-26 18:04   ` [dpdk-dev] [PATCH v2 01/15] net/dpaa2: fix IOVA conversion for congestion memory Shreyansh Jain
2018-09-26 18:04   ` [dpdk-dev] [PATCH v2 02/15] net/dpaa2: fix VLAN filter enablement Shreyansh Jain
2018-09-26 18:04   ` [dpdk-dev] [PATCH v2 03/15] bus/fslmc: upgrade mc FW APIs to 10.10.0 Shreyansh Jain
2018-09-26 18:04   ` [dpdk-dev] [PATCH v2 04/15] net/dpaa2: upgrade dpni to " Shreyansh Jain
2018-09-26 18:04   ` [dpdk-dev] [PATCH v2 05/15] crypto/dpaa2_sec: upgarde " Shreyansh Jain
2018-09-26 18:04   ` [dpdk-dev] [PATCH v2 06/15] bus/fslmc: support memory backed portals with QBMAN 5.0 Shreyansh Jain
2018-09-26 18:04   ` [dpdk-dev] [PATCH v2 07/15] bus/fslmc: support 32 enq and deq for LX2 platform Shreyansh Jain
2018-09-26 18:04   ` [dpdk-dev] [PATCH v2 08/15] bus/fslmc: disable annotation prefetch for LX2 Shreyansh Jain
2018-09-26 18:04   ` [dpdk-dev] [PATCH v2 09/15] net/dpaa2: read hardware provided MAC for DPNI devices Shreyansh Jain
2018-09-26 18:04   ` [dpdk-dev] [PATCH v2 10/15] net/dpaa2: add per queue stats get and reset support Shreyansh Jain
2018-09-26 18:04   ` [dpdk-dev] [PATCH v2 11/15] net/dpaa2: update RSS value in mbuf for lx2 platform Shreyansh Jain
2018-09-26 18:04   ` [dpdk-dev] [PATCH v2 12/15] net/dpaa2: optimize the fd reset in Tx path Shreyansh Jain
2018-09-26 18:04   ` [dpdk-dev] [PATCH v2 13/15] net/dpaa2: enhance the queue memory cleanup routines Shreyansh Jain
2018-09-26 18:04   ` Shreyansh Jain [this message]
2018-09-26 18:04   ` [dpdk-dev] [PATCH v2 15/15] net/dpaa2: support Rx checksum offload in slow parsing Shreyansh Jain
2018-10-12  9:32   ` [dpdk-dev] [PATCH v2 00/15] Upgrade DPAA2 FW and other feature/bug fixes Shreyansh Jain
2018-10-12  9:42     ` Shreyansh Jain
2018-10-12 10:16     ` Thomas Monjalon
2018-10-12 10:04   ` [dpdk-dev] [PATCH v3 " Shreyansh Jain
2018-10-12 10:04     ` [dpdk-dev] [PATCH v3 01/15] net/dpaa2: fix IOVA conversion for congestion memory Shreyansh Jain
2018-10-12 10:04     ` [dpdk-dev] [PATCH v3 02/15] net/dpaa2: fix VLAN filter enablement Shreyansh Jain
2018-10-12 10:04     ` [dpdk-dev] [PATCH v3 03/15] bus/fslmc: upgrade mc FW APIs to 10.10.0 Shreyansh Jain
2018-10-12 10:04     ` [dpdk-dev] [PATCH v3 04/15] net/dpaa2: upgrade dpni to " Shreyansh Jain
2018-10-12 10:04     ` [dpdk-dev] [PATCH v3 05/15] crypto/dpaa2_sec: upgarde " Shreyansh Jain
2018-10-12 10:04     ` [dpdk-dev] [PATCH v3 06/15] bus/fslmc: support memory backed portals with QBMAN 5.0 Shreyansh Jain
2018-10-12 10:04     ` [dpdk-dev] [PATCH v3 07/15] bus/fslmc: support 32 enq and deq for LX2 platform Shreyansh Jain
2018-10-12 10:04     ` [dpdk-dev] [PATCH v3 08/15] bus/fslmc: disable annotation prefetch for LX2 Shreyansh Jain
2018-10-12 10:04     ` [dpdk-dev] [PATCH v3 09/15] net/dpaa2: read hardware provided MAC for DPNI devices Shreyansh Jain
2018-10-12 10:04     ` [dpdk-dev] [PATCH v3 10/15] net/dpaa2: add per queue stats get and reset support Shreyansh Jain
2018-10-12 10:04     ` [dpdk-dev] [PATCH v3 11/15] net/dpaa2: update RSS value in mbuf for lx2 platform Shreyansh Jain
2018-10-12 10:04     ` [dpdk-dev] [PATCH v3 12/15] net/dpaa2: optimize the fd reset in Tx path Shreyansh Jain
2018-10-12 10:04     ` [dpdk-dev] [PATCH v3 13/15] net/dpaa2: enhance the queue memory cleanup routines Shreyansh Jain
2018-10-12 10:04     ` [dpdk-dev] [PATCH v3 14/15] net/dpaa2: support MBUF VLAN tci population from HW parser Shreyansh Jain
2018-10-12 10:04     ` [dpdk-dev] [PATCH v3 15/15] net/dpaa2: support Rx checksum offload in slow parsing Shreyansh Jain
2018-10-16 10:24     ` [dpdk-dev] [PATCH v3 00/15] Upgrade DPAA2 FW and other feature/bug fixes Thomas Monjalon

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=20180926180440.31726-15-shreyansh.jain@nxp.com \
    --to=shreyansh.jain@nxp.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=thomas@monjalon.net \
    /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).