DPDK patches and discussions
 help / color / mirror / Atom feed
From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: dev@dpdk.org, ferruh.yigit@intel.com
Cc: Apeksha Gupta <apeksha.gupta@nxp.com>
Subject: [dpdk-dev] [PATCH 2/2] net/dpaa2: support MPLS distribution
Date: Wed, 20 Jan 2021 11:52:38 +0530	[thread overview]
Message-ID: <20210120062238.18721-2-hemant.agrawal@nxp.com> (raw)
In-Reply-To: <20210120062238.18721-1-hemant.agrawal@nxp.com>

From: Apeksha Gupta <apeksha.gupta@nxp.com>

add support for MPLS based distribution is supported.

Signed-off-by: Apeksha Gupta <apeksha.gupta@nxp.com>
---
 drivers/net/dpaa2/base/dpaa2_hw_dpni.c | 45 ++++++++++++++++++++++++--
 drivers/net/dpaa2/dpaa2_ethdev.h       |  3 +-
 drivers/net/dpaa2/dpaa2_rxtx.c         |  4 +++
 drivers/net/dpaa2/mc/fsl_net.h         |  5 +++
 4 files changed, 53 insertions(+), 4 deletions(-)

diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
index 25b1d2bb6d..e543b73981 100644
--- a/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
+++ b/drivers/net/dpaa2/base/dpaa2_hw_dpni.c
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-3-Clause
  *
  *   Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved.
- *   Copyright 2016-2019 NXP
+ *   Copyright 2016-2021 NXP
  *
  */
 
@@ -194,9 +194,11 @@ dpaa2_distset_to_dpkg_profile_cfg(
 		uint64_t req_dist_set,
 		struct dpkg_profile_cfg *kg_cfg)
 {
-	uint32_t loop = 0, i = 0, dist_field = 0;
+	uint32_t loop = 0, i = 0;
+	uint64_t dist_field = 0;
 	int l2_configured = 0, l3_configured = 0;
 	int l4_configured = 0, sctp_configured = 0;
+	int mpls_configured = 0;
 
 	memset(kg_cfg, 0, sizeof(struct dpkg_profile_cfg));
 	while (req_dist_set) {
@@ -220,6 +222,43 @@ dpaa2_distset_to_dpkg_profile_cfg(
 				i++;
 			break;
 
+			case ETH_RSS_MPLS:
+
+				if (mpls_configured)
+					break;
+				mpls_configured = 1;
+
+				kg_cfg->extracts[i].extract.from_hdr.prot =
+					NET_PROT_MPLS;
+				kg_cfg->extracts[i].extract.from_hdr.field =
+					NH_FLD_MPLS_MPLSL_1;
+				kg_cfg->extracts[i].type =
+					DPKG_EXTRACT_FROM_HDR;
+				kg_cfg->extracts[i].extract.from_hdr.type =
+					DPKG_FULL_FIELD;
+				i++;
+
+				kg_cfg->extracts[i].extract.from_hdr.prot =
+					NET_PROT_MPLS;
+				kg_cfg->extracts[i].extract.from_hdr.field =
+					NH_FLD_MPLS_MPLSL_2;
+				kg_cfg->extracts[i].type =
+					DPKG_EXTRACT_FROM_HDR;
+				kg_cfg->extracts[i].extract.from_hdr.type =
+					DPKG_FULL_FIELD;
+				i++;
+
+				kg_cfg->extracts[i].extract.from_hdr.prot =
+					NET_PROT_MPLS;
+				kg_cfg->extracts[i].extract.from_hdr.field =
+					NH_FLD_MPLS_MPLSL_N;
+				kg_cfg->extracts[i].type =
+					DPKG_EXTRACT_FROM_HDR;
+				kg_cfg->extracts[i].extract.from_hdr.type =
+					DPKG_FULL_FIELD;
+				i++;
+				break;
+
 			case ETH_RSS_IPV4:
 			case ETH_RSS_FRAG_IPV4:
 			case ETH_RSS_NONFRAG_IPV4_OTHER:
@@ -326,7 +365,7 @@ dpaa2_distset_to_dpkg_profile_cfg(
 
 			default:
 				DPAA2_PMD_WARN(
-					     "Unsupported flow dist option %x",
+				      "unsupported flow dist option 0x%" PRIx64,
 					     dist_field);
 				return -EINVAL;
 			}
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h
index cacb11bd3e..bb49fa9a38 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.h
+++ b/drivers/net/dpaa2/dpaa2_ethdev.h
@@ -65,7 +65,8 @@
 	ETH_RSS_IP | \
 	ETH_RSS_UDP | \
 	ETH_RSS_TCP | \
-	ETH_RSS_SCTP)
+	ETH_RSS_SCTP | \
+	ETH_RSS_MPLS)
 
 /* LX2 FRC Parsed values (Little Endian) */
 #define DPAA2_PKT_TYPE_ETHER		0x0060
diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c
index 9cca6d16c3..6b4526cd2d 100644
--- a/drivers/net/dpaa2/dpaa2_rxtx.c
+++ b/drivers/net/dpaa2/dpaa2_rxtx.c
@@ -166,6 +166,10 @@ dpaa2_dev_rx_parse_slow(struct rte_mbuf *mbuf,
 		goto parse_done;
 	}
 
+	if (BIT_ISSET_AT_POS(annotation->word3, L2_MPLS_1_PRESENT |
+				L2_MPLS_N_PRESENT))
+		pkt_type |= RTE_PTYPE_L2_ETHER_MPLS;
+
 	if (BIT_ISSET_AT_POS(annotation->word4, L3_IPV4_1_PRESENT |
 			     L3_IPV4_N_PRESENT)) {
 		pkt_type |= RTE_PTYPE_L3_IPV4;
diff --git a/drivers/net/dpaa2/mc/fsl_net.h b/drivers/net/dpaa2/mc/fsl_net.h
index 3eaad2f717..2d26d5d6c3 100644
--- a/drivers/net/dpaa2/mc/fsl_net.h
+++ b/drivers/net/dpaa2/mc/fsl_net.h
@@ -343,6 +343,11 @@
 /***************************  GTP fields  ************************************/
 #define NH_FLD_GTP_TEID                       (1)
 
+/***************************  MPLS fields  ************************************/
+#define NH_FLD_MPLS_MPLSL_1			(1)
+#define NH_FLD_MPLS_MPLSL_2			(NH_FLD_MPLS_MPLSL_1 << 1)
+#define NH_FLD_MPLS_MPLSL_N			(NH_FLD_MPLS_MPLSL_1 << 2)
+
 /* Protocol options */
 
 /* Ethernet options */
-- 
2.17.1


  reply	other threads:[~2021-01-20  6:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-20  6:22 [dpdk-dev] [PATCH 1/2] ethdev: add MPLS RSS offload type Hemant Agrawal
2021-01-20  6:22 ` Hemant Agrawal [this message]
2021-01-27 12:05   ` [dpdk-dev] [PATCH 2/2] net/dpaa2: support MPLS distribution Ferruh Yigit
2021-01-27 11:59 ` [dpdk-dev] [PATCH 1/2] ethdev: add MPLS RSS offload type Ferruh Yigit
2021-01-27 12:26 ` 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=20210120062238.18721-2-hemant.agrawal@nxp.com \
    --to=hemant.agrawal@nxp.com \
    --cc=apeksha.gupta@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).