From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yongseok Koh Subject: [PATCH 2/7] net/mlx5: use standard IP protocol numbers Date: Mon, 8 Oct 2018 18:02:11 +0000 Message-ID: <20181008180150.39273-3-yskoh@mellanox.com> References: <20181008180150.39273-1-yskoh@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Cc: "dev@dpdk.org" , Yongseok Koh , Ori Kam To: Shahaf Shuler Return-path: Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-eopbgr70049.outbound.protection.outlook.com [40.107.7.49]) by dpdk.org (Postfix) with ESMTP id 34DAF1B415 for ; Mon, 8 Oct 2018 20:02:13 +0200 (CEST) In-Reply-To: <20181008180150.39273-1-yskoh@mellanox.com> Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Fixes: 0f8775dd8f1c ("net/mlx5: add support for multiple flow drivers") Cc: Ori Kam Signed-off-by: Yongseok Koh --- 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 */ =20 +#include #include #include #include @@ -1188,7 +1189,7 @@ mlx5_flow_validate_item_udp(const struct rte_flow_ite= m *item, const int tunnel =3D !!(item_flags & MLX5_FLOW_LAYER_TUNNEL); int ret; =20 - if (target_protocol !=3D 0xff && target_protocol !=3D MLX5_IP_PROTOCOL_UD= P) + if (target_protocol !=3D 0xff && target_protocol !=3D 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_ite= m *item, const int tunnel =3D !!(item_flags & MLX5_FLOW_LAYER_TUNNEL); int ret; =20 - if (target_protocol !=3D 0xff && target_protocol !=3D MLX5_IP_PROTOCOL_TC= P) + if (target_protocol !=3D 0xff && target_protocol !=3D 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_ite= m *item, const struct rte_flow_item_gre *mask =3D item->mask; int ret; =20 - if (target_protocol !=3D 0xff && target_protocol !=3D MLX5_IP_PROTOCOL_GR= E) + if (target_protocol !=3D 0xff && target_protocol !=3D 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_it= em *item __rte_unused, const struct rte_flow_item_mpls *mask =3D item->mask; int ret; =20 - if (target_protocol !=3D 0xff && target_protocol !=3D MLX5_IP_PROTOCOL_MP= LS) + if (target_protocol !=3D 0xff && target_protocol !=3D 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_ =20 +#include #include #include #include @@ -78,11 +79,9 @@ #define MLX5_ACTION_OF_SET_VLAN_VID (1u << 9) #define MLX5_ACTION_OF_SET_VLAN_PCP (1u << 10) =20 -/* 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 =20 /* Internent Protocol versions. */ #define MLX5_VXLAN 4789 diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flo= w_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 */ =20 +#include #include #include #include @@ -683,11 +684,11 @@ flow_verbs_translate_item_gre(const struct rte_flow_i= tem *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 =3D MLX5_PRIORITY_MAP_L2; *item_flags |=3D MLX5_FLOW_LAYER_GRE; @@ -1091,7 +1092,7 @@ flow_verbs_validate(struct rte_eth_dev *dev, if (ret < 0) return ret; if (next_protocol !=3D 0xff && - next_protocol !=3D MLX5_IP_PROTOCOL_MPLS) + next_protocol !=3D IPPROTO_MPLS) return rte_flow_error_set (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, items, --=20 2.11.0