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, Jun Yang <jun.yang@nxp.com>
Subject: [dpdk-dev] [PATCH v2 22/29] net/dpaa2: support iscrimination between IPv4 and IPv6
Date: Tue,  7 Jul 2020 14:52:37 +0530
Message-ID: <20200707092244.12791-23-hemant.agrawal@nxp.com> (raw)
In-Reply-To: <20200707092244.12791-1-hemant.agrawal@nxp.com>

From: Jun Yang <jun.yang@nxp.com>

Discriminate between IPv4 and IPv6 in generic IP flow setup.

Signed-off-by: Jun Yang <jun.yang@nxp.com>
---
 drivers/net/dpaa2/dpaa2_flow.c | 153 +++++++++++++++++----------------
 1 file changed, 80 insertions(+), 73 deletions(-)

diff --git a/drivers/net/dpaa2/dpaa2_flow.c b/drivers/net/dpaa2/dpaa2_flow.c
index 95756bf7b..6f3139f86 100644
--- a/drivers/net/dpaa2/dpaa2_flow.c
+++ b/drivers/net/dpaa2/dpaa2_flow.c
@@ -1284,6 +1284,70 @@ dpaa2_configure_flow_vlan(struct rte_flow *flow,
 	return 0;
 }
 
+static int
+dpaa2_configure_flow_ip_discrimation(
+	struct dpaa2_dev_priv *priv, struct rte_flow *flow,
+	const struct rte_flow_item *pattern,
+	int *local_cfg,	int *device_configured,
+	uint32_t group)
+{
+	int index, ret;
+	struct proto_discrimination proto;
+
+	index = dpaa2_flow_extract_search(
+			&priv->extract.qos_key_extract.dpkg,
+			NET_PROT_ETH, NH_FLD_ETH_TYPE);
+	if (index < 0) {
+		ret = dpaa2_flow_proto_discrimination_extract(
+				&priv->extract.qos_key_extract,
+				RTE_FLOW_ITEM_TYPE_ETH);
+		if (ret) {
+			DPAA2_PMD_ERR(
+			"QoS Extract ETH_TYPE to discriminate IP failed.");
+			return -1;
+		}
+		(*local_cfg) |= DPAA2_QOS_TABLE_RECONFIGURE;
+	}
+
+	index = dpaa2_flow_extract_search(
+			&priv->extract.tc_key_extract[group].dpkg,
+			NET_PROT_ETH, NH_FLD_ETH_TYPE);
+	if (index < 0) {
+		ret = dpaa2_flow_proto_discrimination_extract(
+				&priv->extract.tc_key_extract[group],
+				RTE_FLOW_ITEM_TYPE_ETH);
+		if (ret) {
+			DPAA2_PMD_ERR(
+			"FS Extract ETH_TYPE to discriminate IP failed.");
+			return -1;
+		}
+		(*local_cfg) |= DPAA2_FS_TABLE_RECONFIGURE;
+	}
+
+	ret = dpaa2_flow_rule_move_ipaddr_tail(flow, priv, group);
+	if (ret) {
+		DPAA2_PMD_ERR(
+			"Move ipaddr before IP discrimination set failed");
+		return -1;
+	}
+
+	proto.type = RTE_FLOW_ITEM_TYPE_ETH;
+	if (pattern->type == RTE_FLOW_ITEM_TYPE_IPV4)
+		proto.eth_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4);
+	else
+		proto.eth_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV6);
+	ret = dpaa2_flow_proto_discrimination_rule(priv, flow, proto, group);
+	if (ret) {
+		DPAA2_PMD_ERR("IP discrimination rule set failed");
+		return -1;
+	}
+
+	(*device_configured) |= (*local_cfg);
+
+	return 0;
+}
+
+
 static int
 dpaa2_configure_flow_generic_ip(
 	struct rte_flow *flow,
@@ -1327,73 +1391,16 @@ dpaa2_configure_flow_generic_ip(
 	flow->tc_id = group;
 	flow->tc_index = attr->priority;
 
-	if (!spec_ipv4 && !spec_ipv6) {
-		/* Don't care any field of IP header,
-		 * only care IP protocol.
-		 * Example: flow create 0 ingress pattern ipv6 /
-		 */
-		/* Eth type is actually used for IP identification.
-		 */
-		/* TODO: Current design only supports Eth + IP,
-		 *  Eth + vLan + IP needs to add.
-		 */
-		struct proto_discrimination proto;
-
-		index = dpaa2_flow_extract_search(
-				&priv->extract.qos_key_extract.dpkg,
-				NET_PROT_ETH, NH_FLD_ETH_TYPE);
-		if (index < 0) {
-			ret = dpaa2_flow_proto_discrimination_extract(
-					&priv->extract.qos_key_extract,
-					RTE_FLOW_ITEM_TYPE_ETH);
-			if (ret) {
-				DPAA2_PMD_ERR(
-				"QoS Ext ETH_TYPE to discriminate IP failed.");
-
-				return -1;
-			}
-			local_cfg |= DPAA2_QOS_TABLE_RECONFIGURE;
-		}
-
-		index = dpaa2_flow_extract_search(
-				&priv->extract.tc_key_extract[group].dpkg,
-				NET_PROT_ETH, NH_FLD_ETH_TYPE);
-		if (index < 0) {
-			ret = dpaa2_flow_proto_discrimination_extract(
-					&priv->extract.tc_key_extract[group],
-					RTE_FLOW_ITEM_TYPE_ETH);
-			if (ret) {
-				DPAA2_PMD_ERR(
-				"FS Ext ETH_TYPE to discriminate IP failed");
-
-				return -1;
-			}
-			local_cfg |= DPAA2_FS_TABLE_RECONFIGURE;
-		}
-
-		ret = dpaa2_flow_rule_move_ipaddr_tail(flow, priv, group);
-		if (ret) {
-			DPAA2_PMD_ERR(
-			"Move ipaddr before IP discrimination set failed");
-			return -1;
-		}
-
-		proto.type = RTE_FLOW_ITEM_TYPE_ETH;
-		if (pattern->type == RTE_FLOW_ITEM_TYPE_IPV4)
-			proto.eth_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV4);
-		else
-			proto.eth_type = rte_cpu_to_be_16(RTE_ETHER_TYPE_IPV6);
-		ret = dpaa2_flow_proto_discrimination_rule(priv, flow,
-							proto, group);
-		if (ret) {
-			DPAA2_PMD_ERR("IP discrimination rule set failed");
-			return -1;
-		}
-
-		(*device_configured) |= local_cfg;
+	ret = dpaa2_configure_flow_ip_discrimation(priv,
+			flow, pattern, &local_cfg,
+			device_configured, group);
+	if (ret) {
+		DPAA2_PMD_ERR("IP discrimation failed!");
+		return -1;
+	}
 
+	if (!spec_ipv4 && !spec_ipv6)
 		return 0;
-	}
 
 	if (mask_ipv4) {
 		if (dpaa2_flow_extract_support((const uint8_t *)mask_ipv4,
@@ -1433,10 +1440,10 @@ dpaa2_configure_flow_generic_ip(
 				NET_PROT_IP, NH_FLD_IP_SRC);
 		if (index < 0) {
 			ret = dpaa2_flow_extract_add(
-						&priv->extract.qos_key_extract,
-						NET_PROT_IP,
-						NH_FLD_IP_SRC,
-						0);
+					&priv->extract.qos_key_extract,
+					NET_PROT_IP,
+					NH_FLD_IP_SRC,
+					0);
 			if (ret) {
 				DPAA2_PMD_ERR("QoS Extract add IP_SRC failed.");
 
@@ -1519,10 +1526,10 @@ dpaa2_configure_flow_generic_ip(
 			else
 				size = NH_FLD_IPV6_ADDR_SIZE;
 			ret = dpaa2_flow_extract_add(
-						&priv->extract.qos_key_extract,
-						NET_PROT_IP,
-						NH_FLD_IP_DST,
-						size);
+					&priv->extract.qos_key_extract,
+					NET_PROT_IP,
+					NH_FLD_IP_DST,
+					size);
 			if (ret) {
 				DPAA2_PMD_ERR("QoS Extract add IP_DST failed.");
 
-- 
2.17.1


  parent reply	other threads:[~2020-07-07  9:31 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-27 13:22 [dpdk-dev] [PATCH 00/37] NXP DPAAx enhancements Hemant Agrawal
2020-05-27 13:22 ` [dpdk-dev] [PATCH 01/37] bus/fslmc: fix getting the FD error Hemant Agrawal
2020-05-27 18:07   ` Akhil Goyal
2020-05-27 13:22 ` [dpdk-dev] [PATCH 02/37] net/dpaa: fix fd offset data type Hemant Agrawal
2020-05-27 18:08   ` Akhil Goyal
2020-05-27 13:22 ` [dpdk-dev] [PATCH 03/37] net/dpaa2: enable timestamp for Rx offload case as well Hemant Agrawal
2020-05-27 13:22 ` [dpdk-dev] [PATCH 04/37] bus/fslmc: combine thread specific variables Hemant Agrawal
2020-05-27 13:22 ` [dpdk-dev] [PATCH 05/37] bus/fslmc: rework portal allocation to a per thread basis Hemant Agrawal
2020-07-01  7:23   ` Ferruh Yigit
2020-05-27 13:22 ` [dpdk-dev] [PATCH 06/37] bus/fslmc: support handle portal alloc failure Hemant Agrawal
2020-05-27 13:22 ` [dpdk-dev] [PATCH 07/37] bus/fslmc: support portal migration Hemant Agrawal
2020-05-27 13:22 ` [dpdk-dev] [PATCH 08/37] bus/fslmc: rename the cinh read functions used for ls1088 Hemant Agrawal
2020-05-27 13:22 ` [dpdk-dev] [PATCH 09/37] net/dpaa: enable Tx queue taildrop Hemant Agrawal
2020-05-27 13:22 ` [dpdk-dev] [PATCH 10/37] net/dpaa: add 2.5G support Hemant Agrawal
2020-05-27 13:23 ` [dpdk-dev] [PATCH 11/37] net/dpaa: update process specific device info Hemant Agrawal
2020-05-27 13:23 ` [dpdk-dev] [PATCH 12/37] drivers: optimize thread local storage for dpaa Hemant Agrawal
2020-05-27 18:13   ` Akhil Goyal
2020-05-27 13:23 ` [dpdk-dev] [PATCH 13/37] bus/dpaa: enable link state interrupt Hemant Agrawal
2020-05-27 13:23 ` [dpdk-dev] [PATCH 14/37] bus/dpaa: enable set link status Hemant Agrawal
2020-05-27 13:23 ` [dpdk-dev] [PATCH 15/37] net/dpaa: add support for fmlib in dpdk Hemant Agrawal
2020-06-30 17:00   ` Ferruh Yigit
2020-07-01  4:18     ` Hemant Agrawal
2020-07-01  7:35       ` Ferruh Yigit
2020-05-27 13:23 ` [dpdk-dev] [PATCH 16/37] net/dpaa: add VSP support in FMLIB Hemant Agrawal
2020-05-27 13:23 ` [dpdk-dev] [PATCH 17/37] net/dpaa: add support for fmcless mode Hemant Agrawal
2020-06-30 17:01   ` Ferruh Yigit
2020-07-01  4:04     ` Hemant Agrawal
2020-07-01  7:37       ` Ferruh Yigit
2020-05-27 13:23 ` [dpdk-dev] [PATCH 18/37] bus/dpaa: add shared MAC support Hemant Agrawal
2020-05-27 13:23 ` [dpdk-dev] [PATCH 19/37] bus/dpaa: add Virtual Storage Profile port init Hemant Agrawal
2020-05-27 13:23 ` [dpdk-dev] [PATCH 20/37] net/dpaa: add support for Virtual Storage Profile Hemant Agrawal
2020-05-27 13:23 ` [dpdk-dev] [PATCH 21/37] net/dpaa: add fmc parser support for VSP Hemant Agrawal
2020-05-27 13:23 ` [dpdk-dev] [PATCH 22/37] net/dpaa: add RSS update func with FMCless Hemant Agrawal
2020-05-27 13:23 ` [dpdk-dev] [PATCH 23/37] net/dpaa2: dynamic flow control support Hemant Agrawal
2020-05-27 13:23 ` [dpdk-dev] [PATCH 24/37] net/dpaa2: key extracts of flow API Hemant Agrawal
2020-05-27 13:23 ` [dpdk-dev] [PATCH 25/37] net/dpaa2: sanity check for flow extracts Hemant Agrawal
2020-05-27 13:23 ` [dpdk-dev] [PATCH 26/37] net/dpaa2: free flow rule memory Hemant Agrawal
2020-05-27 13:23 ` [dpdk-dev] [PATCH 27/37] net/dpaa2: flow QoS or FS table entry indexing Hemant Agrawal
2020-05-27 13:23 ` [dpdk-dev] [PATCH 28/37] net/dpaa2: define the size of table entry Hemant Agrawal
2020-05-27 13:23 ` [dpdk-dev] [PATCH 29/37] net/dpaa2: log of flow extracts and rules Hemant Agrawal
2020-05-27 13:23 ` [dpdk-dev] [PATCH 30/37] net/dpaa2: discrimination between IPv4 and IPv6 Hemant Agrawal
2020-05-27 13:23 ` [dpdk-dev] [PATCH 31/37] net/dpaa2: distribution size set on multiple TCs Hemant Agrawal
2020-05-27 13:23 ` [dpdk-dev] [PATCH 32/37] net/dpaa2: index of queue action for flow Hemant Agrawal
2020-05-27 13:23 ` [dpdk-dev] [PATCH 33/37] net/dpaa2: flow data sanity check Hemant Agrawal
2020-05-27 13:23 ` [dpdk-dev] [PATCH 34/37] net/dpaa2: flow API QoS setup follows FS setup Hemant Agrawal
2020-05-27 13:23 ` [dpdk-dev] [PATCH 35/37] net/dpaa2: flow API FS miss action configuration Hemant Agrawal
2020-05-27 13:23 ` [dpdk-dev] [PATCH 36/37] net/dpaa2: configure per class distribution size Hemant Agrawal
2020-05-27 13:23 ` [dpdk-dev] [PATCH 37/37] net/dpaa2: support raw flow classification Hemant Agrawal
2020-06-30 17:01 ` [dpdk-dev] [PATCH 00/37] NXP DPAAx enhancements Ferruh Yigit
2020-07-01  4:08   ` Hemant Agrawal
2020-07-07  9:22 ` [dpdk-dev] [PATCH v2 00/29] " Hemant Agrawal
2020-07-07  9:22   ` [dpdk-dev] [PATCH v2 01/29] bus/fslmc: fix getting the FD error Hemant Agrawal
2020-07-07  9:22   ` [dpdk-dev] [PATCH v2 02/29] net/dpaa: fix fd offset data type Hemant Agrawal
2020-07-07  9:22   ` [dpdk-dev] [PATCH v2 03/29] net/dpaa2: enable timestamp for Rx offload case as well Hemant Agrawal
2020-07-11 13:46     ` Thomas Monjalon
2020-07-13  3:47       ` Hemant Agrawal
2020-07-07  9:22   ` [dpdk-dev] [PATCH v2 04/29] bus/fslmc: combine thread specific variables Hemant Agrawal
2020-07-07  9:22   ` [dpdk-dev] [PATCH v2 05/29] bus/fslmc: rework portal allocation to a per thread basis Hemant Agrawal
2020-07-07  9:22   ` [dpdk-dev] [PATCH v2 06/29] bus/fslmc: support handle portal alloc failure Hemant Agrawal
2020-07-07  9:22   ` [dpdk-dev] [PATCH v2 07/29] bus/fslmc: support portal migration Hemant Agrawal
2020-07-07  9:22   ` [dpdk-dev] [PATCH v2 08/29] bus/fslmc: rename the cinh read functions used for ls1088 Hemant Agrawal
2020-07-07  9:22   ` [dpdk-dev] [PATCH v2 09/29] net/dpaa: enable Tx queue taildrop Hemant Agrawal
2020-07-07  9:22   ` [dpdk-dev] [PATCH v2 10/29] net/dpaa: add 2.5G support Hemant Agrawal
2020-07-07  9:22   ` [dpdk-dev] [PATCH v2 11/29] net/dpaa: update process specific device info Hemant Agrawal
2020-07-07  9:22   ` [dpdk-dev] [PATCH v2 12/29] drivers: optimize thread local storage for dpaa Hemant Agrawal
2020-07-07  9:22   ` [dpdk-dev] [PATCH v2 13/29] bus/dpaa: enable link state interrupt Hemant Agrawal
2020-07-07  9:22   ` [dpdk-dev] [PATCH v2 14/29] bus/dpaa: enable set link status Hemant Agrawal
2020-07-07  9:22   ` [dpdk-dev] [PATCH v2 15/29] net/dpaa2: support dynamic flow control Hemant Agrawal
2020-07-07  9:22   ` [dpdk-dev] [PATCH v2 16/29] net/dpaa2: support key extracts of flow API Hemant Agrawal
2020-07-07  9:22   ` [dpdk-dev] [PATCH v2 17/29] net/dpaa2: add sanity check for flow extracts Hemant Agrawal
2020-07-07  9:22   ` [dpdk-dev] [PATCH v2 18/29] net/dpaa2: free flow rule memory Hemant Agrawal
2020-07-07  9:22   ` [dpdk-dev] [PATCH v2 19/29] net/dpaa2: support QoS or FS table entry indexing Hemant Agrawal
2020-07-07  9:22   ` [dpdk-dev] [PATCH v2 20/29] net/dpaa2: define the size of table entry Hemant Agrawal
2020-07-07  9:22   ` [dpdk-dev] [PATCH v2 21/29] net/dpaa2: add logging of flow extracts and rules Hemant Agrawal
2020-07-07  9:22   ` Hemant Agrawal [this message]
2020-07-07  9:22   ` [dpdk-dev] [PATCH v2 23/29] net/dpaa2: support distribution size set on multiple TCs Hemant Agrawal
2020-07-07  9:22   ` [dpdk-dev] [PATCH v2 24/29] net/dpaa2: support ndex of queue action for flow Hemant Agrawal
2020-07-07  9:22   ` [dpdk-dev] [PATCH v2 25/29] net/dpaa2: add flow data sanity check Hemant Agrawal
2020-07-07  9:22   ` [dpdk-dev] [PATCH v2 26/29] net/dpaa2: modify flow API QoS setup to follow FS setup Hemant Agrawal
2020-07-07  9:22   ` [dpdk-dev] [PATCH v2 27/29] net/dpaa2: support flow API FS miss action configuration Hemant Agrawal
2020-07-07  9:22   ` [dpdk-dev] [PATCH v2 28/29] net/dpaa2: configure per class distribution size Hemant Agrawal
2020-07-07  9:22   ` [dpdk-dev] [PATCH v2 29/29] net/dpaa2: support raw flow classification Hemant Agrawal
2020-07-09  1:54   ` [dpdk-dev] [PATCH v2 00/29] NXP DPAAx 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=20200707092244.12791-23-hemant.agrawal@nxp.com \
    --to=hemant.agrawal@nxp.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jun.yang@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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git