[dpdk-dev] [PATCH 2/7] net/mlx5: use standard IP protocol numbers
Yongseok Koh
yskoh at mellanox.com
Tue Oct 9 10:02:02 CEST 2018
> On Oct 9, 2018, at 12:37 AM, Ori Kam <orika at mellanox.com> wrote:
>
> Hi,
> PSB
>
>> -----Original Message-----
>> From: Yongseok Koh
>> Sent: Monday, October 8, 2018 9:02 PM
>> To: Shahaf Shuler <shahafs at mellanox.com>
>> Cc: dev at dpdk.org; Yongseok Koh <yskoh at mellanox.com>; Ori Kam
>> <orika at mellanox.com>
>> Subject: [PATCH 2/7] net/mlx5: use standard IP protocol numbers
>>
>> Fixes: 0f8775dd8f1c ("net/mlx5: add support for multiple flow drivers")
>
> I don't think this is a fix since there is no issue with the implementation,
> you are just beautify the code.
-#define MLX5_IP_PROTOCOL_MPLS 147
MPLS protocol number was wrong, it should be 137
Thanks,
Yongseok
> Otherwise
> Acked-by: Ori Kam <orika at mellanox.com>
>
>> Cc: Ori Kam <orika at mellanox.com>
>>
>> Signed-off-by: Yongseok Koh <yskoh at 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
>
More information about the dev
mailing list