DPDK patches and discussions
 help / color / mirror / Atom feed
From: Yongseok Koh <yskoh@mellanox.com>
To: Shahaf Shuler <shahafs@mellanox.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, Yongseok Koh <yskoh@mellanox.com>,
	Ori Kam <orika@mellanox.com>
Subject: [dpdk-dev] [PATCH 3/5] net/mlx5: fix item validation in Direct Verbs
Date: Wed, 17 Oct 2018 02:07:55 +0000	[thread overview]
Message-ID: <20181017020739.11203-3-yskoh@mellanox.com> (raw)
In-Reply-To: <20181017020739.11203-1-yskoh@mellanox.com>

1) remove MPLS item in validation as it doesn't have a translator.

2) add missing NVGRE item to validation

3) match switch-case order between validation and translation.

Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items")
Fixes: 3d69434113d1 ("net/mlx5: add Direct Verbs validation function")
Cc: orika@mellanox.com

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow_dv.c | 50 +++++++++++++++++------------------------
 1 file changed, 20 insertions(+), 30 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 2b362dae11..ea8e1f4831 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -164,6 +164,17 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
 					((const struct rte_flow_item_ipv6 *)
 					 items->spec)->hdr.proto;
 			break;
+		case RTE_FLOW_ITEM_TYPE_TCP:
+			ret = mlx5_flow_validate_item_tcp
+						(items, item_flags,
+						 next_protocol,
+						 &rte_flow_item_tcp_mask,
+						 error);
+			if (ret < 0)
+				return ret;
+			item_flags |= tunnel ? MLX5_FLOW_LAYER_INNER_L4_TCP :
+					       MLX5_FLOW_LAYER_OUTER_L4_TCP;
+			break;
 		case RTE_FLOW_ITEM_TYPE_UDP:
 			ret = mlx5_flow_validate_item_udp(items, item_flags,
 							  next_protocol,
@@ -173,16 +184,13 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
 			item_flags |= tunnel ? MLX5_FLOW_LAYER_INNER_L4_UDP :
 					       MLX5_FLOW_LAYER_OUTER_L4_UDP;
 			break;
-		case RTE_FLOW_ITEM_TYPE_TCP:
-			ret = mlx5_flow_validate_item_tcp
-						(items, item_flags,
-						 next_protocol,
-						 &rte_flow_item_tcp_mask,
-						 error);
+		case RTE_FLOW_ITEM_TYPE_GRE:
+		case RTE_FLOW_ITEM_TYPE_NVGRE:
+			ret = mlx5_flow_validate_item_gre(items, item_flags,
+							  next_protocol, error);
 			if (ret < 0)
 				return ret;
-			item_flags |= tunnel ? MLX5_FLOW_LAYER_INNER_L4_TCP :
-					       MLX5_FLOW_LAYER_OUTER_L4_TCP;
+			item_flags |= MLX5_FLOW_LAYER_GRE;
 			break;
 		case RTE_FLOW_ITEM_TYPE_VXLAN:
 			ret = mlx5_flow_validate_item_vxlan(items, item_flags,
@@ -199,21 +207,6 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
 				return ret;
 			item_flags |= MLX5_FLOW_LAYER_VXLAN_GPE;
 			break;
-		case RTE_FLOW_ITEM_TYPE_GRE:
-			ret = mlx5_flow_validate_item_gre(items, item_flags,
-							  next_protocol, error);
-			if (ret < 0)
-				return ret;
-			item_flags |= MLX5_FLOW_LAYER_GRE;
-			break;
-		case RTE_FLOW_ITEM_TYPE_MPLS:
-			ret = mlx5_flow_validate_item_mpls(items, item_flags,
-							   next_protocol,
-							   error);
-			if (ret < 0)
-				return ret;
-			item_flags |= MLX5_FLOW_LAYER_MPLS;
-			break;
 		default:
 			return rte_flow_error_set(error, ENOTSUP,
 						  RTE_FLOW_ERROR_TYPE_ITEM,
@@ -879,9 +872,6 @@ flow_dv_create_item(void *matcher, void *key,
 	struct mlx5_flow_dv_matcher *tmatcher = matcher;
 
 	switch (item->type) {
-	case RTE_FLOW_ITEM_TYPE_VOID:
-	case RTE_FLOW_ITEM_TYPE_END:
-		break;
 	case RTE_FLOW_ITEM_TYPE_ETH:
 		flow_dv_translate_item_eth(tmatcher->mask.buf, key, item,
 					   inner);
@@ -929,14 +919,14 @@ flow_dv_create_item(void *matcher, void *key,
 						    (IBV_RX_HASH_SRC_PORT_UDP |
 						     IBV_RX_HASH_DST_PORT_UDP));
 		break;
-	case RTE_FLOW_ITEM_TYPE_NVGRE:
-		flow_dv_translate_item_nvgre(tmatcher->mask.buf, key, item,
-					     inner);
-		break;
 	case RTE_FLOW_ITEM_TYPE_GRE:
 		flow_dv_translate_item_gre(tmatcher->mask.buf, key, item,
 					   inner);
 		break;
+	case RTE_FLOW_ITEM_TYPE_NVGRE:
+		flow_dv_translate_item_nvgre(tmatcher->mask.buf, key, item,
+					     inner);
+		break;
 	case RTE_FLOW_ITEM_TYPE_VXLAN:
 	case RTE_FLOW_ITEM_TYPE_VXLAN_GPE:
 		flow_dv_translate_item_vxlan(tmatcher->mask.buf, key, item,
-- 
2.11.0

  parent reply	other threads:[~2018-10-17  2:07 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-17  2:07 [dpdk-dev] [PATCH 1/5] net/mlx5: add warning message for Direct Verbs flow Yongseok Koh
2018-10-17  2:07 ` [dpdk-dev] [PATCH 2/5] net/mlx5: fix UDP hash field flag in Direct Verbs Yongseok Koh
2018-10-17  5:11   ` Ori Kam
2018-10-17  2:07 ` Yongseok Koh [this message]
2018-10-17  2:07 ` [dpdk-dev] [PATCH 4/5] net/mlx5: fix wildcard item for " Yongseok Koh
2018-10-23  7:42   ` Shahaf Shuler
2018-10-23 15:25     ` Ori Kam
2018-10-23 17:22       ` Yongseok Koh
2018-10-17  2:07 ` [dpdk-dev] [PATCH 5/5] net/mlx5: fix flow mark ID conversion in " Yongseok Koh
2018-10-17  5:15   ` Ori Kam
2018-10-17  5:11 ` [dpdk-dev] [PATCH 1/5] net/mlx5: add warning message for Direct Verbs flow Ori Kam
2018-10-23 16:52 ` [dpdk-dev] [PATCH v2 0/5] net/mlx5: fixes " Yongseok Koh
2018-10-23 16:52   ` [dpdk-dev] [PATCH v2 1/5] net/mlx5: add warning message " Yongseok Koh
2018-10-23 16:52   ` [dpdk-dev] [PATCH v2 2/5] net/mlx5: fix UDP hash field flag in Direct Verbs Yongseok Koh
2018-10-23 16:52   ` [dpdk-dev] [PATCH v2 3/5] net/mlx5: fix item validation " Yongseok Koh
2018-10-23 16:52   ` [dpdk-dev] [PATCH v2 4/5] net/mlx5: fix wildcard item for " Yongseok Koh
2018-10-23 16:52   ` [dpdk-dev] [PATCH v2 5/5] net/mlx5: fix flow mark ID conversion in " Yongseok Koh
2018-10-24 12:30   ` [dpdk-dev] [PATCH v2 0/5] net/mlx5: fixes for Direct Verbs flow Shahaf Shuler

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=20181017020739.11203-3-yskoh@mellanox.com \
    --to=yskoh@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=orika@mellanox.com \
    --cc=shahafs@mellanox.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).