From 0ddd11437a9abc940061cbb2a046105413b9d6bf Mon Sep 17 00:00:00 2001 From: Yongseok Koh Date: Wed, 24 Oct 2018 15:36:15 +0300 Subject: [PATCH] net/mlx5: fix bit width of item and action flags Most of the code uses uint64_t for MLX5_FLOW_LAYER_* and MLX5_FLOW_ACTION_*, but there're some code using uint32_t. Fixes: 2ed2fe5f0a9c ("net/mlx5: rewrite IP address UDP/TCP port by E-Switch") Fixes: 57123c00c1b8 ("net/mlx5: add Linux TC flower driver for E-Switch flow") Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items") Fixes: 3d69434113d1 ("net/mlx5: add Direct Verbs validation function") Fixes: 84c406e74524 ("net/mlx5: add flow translate function") Fixes: 23c1d42c7138 ("net/mlx5: split flow validation to dedicated function") Signed-off-by: Yongseok Koh Acked-by: Shahaf Shuler --- drivers/net/mlx5/mlx5_flow.c | 2 +- drivers/net/mlx5/mlx5_flow.h | 6 +++--- drivers/net/mlx5/mlx5_flow_dv.c | 4 ++-- drivers/net/mlx5/mlx5_flow_tcf.c | 6 +++--- drivers/net/mlx5/mlx5_flow_verbs.c | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index b1708563dc..280af0abce 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -477,7 +477,7 @@ mlx5_flow_item_acceptable(const struct rte_flow_item *item, */ uint64_t mlx5_flow_hashfields_adjust(struct mlx5_flow *dev_flow, - int tunnel __rte_unused, uint32_t layer_types, + int tunnel __rte_unused, uint64_t layer_types, uint64_t hash_fields) { struct rte_flow *flow = dev_flow->flow; diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h index 4b1f36fa98..61299d66b3 100644 --- a/drivers/net/mlx5/mlx5_flow.h +++ b/drivers/net/mlx5/mlx5_flow.h @@ -215,7 +215,7 @@ struct mlx5_flow_verbs { struct mlx5_flow { LIST_ENTRY(mlx5_flow) next; struct rte_flow *flow; /**< Pointer to the main flow. */ - uint32_t layers; + uint64_t layers; /**< Bit-fields of present layers, see MLX5_FLOW_LAYER_*. */ union { #ifdef HAVE_IBV_FLOW_DV_SUPPORT @@ -251,7 +251,7 @@ struct rte_flow { uint16_t (*queue)[]; /**< Destination queues to redirect traffic to. */ LIST_HEAD(dev_flows, mlx5_flow) dev_flows; /**< Device flows that are part of the flow. */ - uint32_t actions; + uint64_t actions; /**< Bit-fields of detected actions, see MLX5_FLOW_ACTION_*. */ }; typedef int (*mlx5_flow_validate_t)(struct rte_eth_dev *dev, @@ -293,7 +293,7 @@ struct mlx5_flow_driver_ops { /* mlx5_flow.c */ uint64_t mlx5_flow_hashfields_adjust(struct mlx5_flow *dev_flow, int tunnel, - uint32_t layer_types, + uint64_t layer_types, uint64_t hash_fields); uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority, uint32_t subpriority); diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 53e9a170c3..8f729f44f8 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -165,8 +165,8 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, struct rte_flow_error *error) { int ret; - uint32_t action_flags = 0; - uint32_t item_flags = 0; + uint64_t action_flags = 0; + uint64_t item_flags = 0; int tunnel = 0; uint8_t next_protocol = 0xff; int actions_n = 0; diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c index dca9f71aa2..719fb10632 100644 --- a/drivers/net/mlx5/mlx5_flow_tcf.c +++ b/drivers/net/mlx5/mlx5_flow_tcf.c @@ -963,8 +963,8 @@ flow_tcf_validate(struct rte_eth_dev *dev, const struct rte_flow_action_set_ipv4 *set_ipv4; const struct rte_flow_action_set_ipv6 *set_ipv6; } conf; - uint32_t item_flags = 0; - uint32_t action_flags = 0; + uint64_t item_flags = 0; + uint64_t action_flags = 0; uint8_t next_protocol = -1; unsigned int tcm_ifindex = 0; uint8_t pedit_validated = 0; @@ -1181,7 +1181,7 @@ flow_tcf_validate(struct rte_eth_dev *dev, } for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) { unsigned int i; - uint32_t current_action_flag = 0; + uint64_t current_action_flag = 0; switch (actions->type) { case RTE_FLOW_ACTION_TYPE_VOID: diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c index a435d65082..81bc39f9c4 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -1114,8 +1114,8 @@ flow_verbs_validate(struct rte_eth_dev *dev, struct rte_flow_error *error) { int ret; - uint32_t action_flags = 0; - uint32_t item_flags = 0; + uint64_t action_flags = 0; + uint64_t item_flags = 0; int tunnel = 0; uint8_t next_protocol = 0xff; -- 2.20.1