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 2/7] net/mlx5: use standard IP protocol numbers
Date: Mon, 8 Oct 2018 18:02:11 +0000	[thread overview]
Message-ID: <20181008180150.39273-3-yskoh@mellanox.com> (raw)
In-Reply-To: <20181008180150.39273-1-yskoh@mellanox.com>

Fixes: 0f8775dd8f1c ("net/mlx5: add support for multiple flow drivers")
Cc: Ori Kam <orika@mellanox.com>

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow.c       | 9 +++++----
 drivers/net/mlx5/mlx5_flow.h       | 9 ++++-----
 drivers/net/mlx5/mlx5_flow_verbs.c | 7 ++++---
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 8007bf10f..ef5e4684f 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -3,6 +3,7 @@
  * Copyright 2016 Mellanox Technologies, Ltd
  */
 
+#include <netinet/in.h>
 #include <sys/queue.h>
 #include <stdalign.h>
 #include <stdint.h>
@@ -1188,7 +1189,7 @@ mlx5_flow_validate_item_udp(const struct rte_flow_item *item,
 	const int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL);
 	int ret;
 
-	if (target_protocol != 0xff && target_protocol != MLX5_IP_PROTOCOL_UDP)
+	if (target_protocol != 0xff && target_protocol != IPPROTO_UDP)
 		return rte_flow_error_set(error, ENOTSUP,
 					  RTE_FLOW_ERROR_TYPE_ITEM, item,
 					  "protocol filtering not compatible"
@@ -1239,7 +1240,7 @@ mlx5_flow_validate_item_tcp(const struct rte_flow_item *item,
 	const int tunnel = !!(item_flags & MLX5_FLOW_LAYER_TUNNEL);
 	int ret;
 
-	if (target_protocol != 0xff && target_protocol != MLX5_IP_PROTOCOL_TCP)
+	if (target_protocol != 0xff && target_protocol != IPPROTO_TCP)
 		return rte_flow_error_set(error, ENOTSUP,
 					  RTE_FLOW_ERROR_TYPE_ITEM, item,
 					  "protocol filtering not compatible"
@@ -1459,7 +1460,7 @@ mlx5_flow_validate_item_gre(const struct rte_flow_item *item,
 	const struct rte_flow_item_gre *mask = item->mask;
 	int ret;
 
-	if (target_protocol != 0xff && target_protocol != MLX5_IP_PROTOCOL_GRE)
+	if (target_protocol != 0xff && target_protocol != IPPROTO_GRE)
 		return rte_flow_error_set(error, ENOTSUP,
 					  RTE_FLOW_ERROR_TYPE_ITEM, item,
 					  "protocol filtering not compatible"
@@ -1516,7 +1517,7 @@ mlx5_flow_validate_item_mpls(const struct rte_flow_item *item __rte_unused,
 	const struct rte_flow_item_mpls *mask = item->mask;
 	int ret;
 
-	if (target_protocol != 0xff && target_protocol != MLX5_IP_PROTOCOL_MPLS)
+	if (target_protocol != 0xff && target_protocol != IPPROTO_MPLS)
 		return rte_flow_error_set(error, ENOTSUP,
 					  RTE_FLOW_ERROR_TYPE_ITEM, item,
 					  "protocol filtering not compatible"
diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h
index 79d4a2619..1ac871b3a 100644
--- a/drivers/net/mlx5/mlx5_flow.h
+++ b/drivers/net/mlx5/mlx5_flow.h
@@ -5,6 +5,7 @@
 #ifndef RTE_PMD_MLX5_FLOW_H_
 #define RTE_PMD_MLX5_FLOW_H_
 
+#include <netinet/in.h>
 #include <sys/queue.h>
 #include <stdalign.h>
 #include <stdint.h>
@@ -78,11 +79,9 @@
 #define MLX5_ACTION_OF_SET_VLAN_VID (1u << 9)
 #define MLX5_ACTION_OF_SET_VLAN_PCP (1u << 10)
 
-/* possible L3 layers protocols filtering. */
-#define MLX5_IP_PROTOCOL_TCP 6
-#define MLX5_IP_PROTOCOL_UDP 17
-#define MLX5_IP_PROTOCOL_GRE 47
-#define MLX5_IP_PROTOCOL_MPLS 147
+#ifndef IPPROTO_MPLS
+#define IPPROTO_MPLS 137
+#endif
 
 /* Internent Protocol versions. */
 #define MLX5_VXLAN 4789
diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c
index 05ab5fdad..076bb39e6 100644
--- a/drivers/net/mlx5/mlx5_flow_verbs.c
+++ b/drivers/net/mlx5/mlx5_flow_verbs.c
@@ -2,6 +2,7 @@
  * Copyright 2018 Mellanox Technologies, Ltd
  */
 
+#include <netinet/in.h>
 #include <sys/queue.h>
 #include <stdalign.h>
 #include <stdint.h>
@@ -683,11 +684,11 @@ flow_verbs_translate_item_gre(const struct rte_flow_item *item __rte_unused,
 	if (*item_flags & MLX5_FLOW_LAYER_OUTER_L3_IPV4)
 		flow_verbs_item_gre_ip_protocol_update(verbs->attr,
 						       IBV_FLOW_SPEC_IPV4_EXT,
-						       MLX5_IP_PROTOCOL_GRE);
+						       IPPROTO_GRE);
 	else
 		flow_verbs_item_gre_ip_protocol_update(verbs->attr,
 						       IBV_FLOW_SPEC_IPV6,
-						       MLX5_IP_PROTOCOL_GRE);
+						       IPPROTO_GRE);
 	flow_verbs_spec_add(dev_flow, &tunnel, size);
 	verbs->attr->priority = MLX5_PRIORITY_MAP_L2;
 	*item_flags |= MLX5_FLOW_LAYER_GRE;
@@ -1091,7 +1092,7 @@ flow_verbs_validate(struct rte_eth_dev *dev,
 			if (ret < 0)
 				return ret;
 			if (next_protocol != 0xff &&
-			    next_protocol != MLX5_IP_PROTOCOL_MPLS)
+			    next_protocol != IPPROTO_MPLS)
 				return rte_flow_error_set
 					(error, ENOTSUP,
 					 RTE_FLOW_ERROR_TYPE_ITEM, items,
-- 
2.11.0

  parent reply	other threads:[~2018-10-08 18:02 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-08 18:02 [dpdk-dev] [PATCH 0/7] net/mlx5: fixes for the new flow engine Yongseok Koh
2018-10-08 18:02 ` [dpdk-dev] [PATCH 1/7] net/mlx5: fix wrong flow action macro usage Yongseok Koh
2018-10-09  7:45   ` Ori Kam
2018-10-08 18:02 ` Yongseok Koh [this message]
2018-10-09  7:37   ` [dpdk-dev] [PATCH 2/7] net/mlx5: use standard IP protocol numbers Ori Kam
2018-10-09  8:02     ` Yongseok Koh
2018-10-09 15:39   ` Ferruh Yigit
2018-10-08 18:02 ` [dpdk-dev] [PATCH 3/7] net/mlx5: rename flow macros Yongseok Koh
2018-10-09  7:43   ` Ori Kam
2018-10-09  8:05     ` Yongseok Koh
2018-10-09  8:17     ` Yongseok Koh
2018-10-10 11:57   ` Ferruh Yigit
2018-10-08 18:02 ` [dpdk-dev] [PATCH 4/7] net/mlx5: fix validation of VLAN ID in flow spec Yongseok Koh
2018-10-09  7:47   ` Ori Kam
2018-10-09 15:44     ` Ferruh Yigit
2018-10-08 18:02 ` [dpdk-dev] [PATCH 5/7] net/mlx5: fix flow validation for no fate action Yongseok Koh
2018-10-09  7:49   ` Ori Kam
2018-10-10 12:24     ` Ferruh Yigit
2018-10-08 18:02 ` [dpdk-dev] [PATCH 6/7] net/mlx5: add missing VLAN action constraints Yongseok Koh
2018-10-08 19:48   ` Or Gerlitz
2018-10-08 18:02 ` [dpdk-dev] [PATCH 7/7] net/mlx5: fix errno values for flow engine Yongseok Koh
2018-10-09  7:53   ` Ori Kam
2018-10-10 12:59     ` Ferruh Yigit
2018-10-09  8:58 ` [dpdk-dev] [PATCH 0/7] net/mlx5: fixes for the new " Shahaf Shuler
2018-10-09 15:49   ` Ferruh Yigit
2018-10-10  5:57     ` Shahaf Shuler
2018-10-10 10:57       ` Ferruh Yigit
2018-10-10 13:01         ` 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=20181008180150.39273-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).