From 20367e45f28185036d927d4b886af8162661639f Mon Sep 17 00:00:00 2001 From: Dekel Peled Date: Thu, 18 Jul 2019 22:42:23 +0300 Subject: [PATCH] net/mlx5: fix flow item flags bitmap In functions flow_dv_translate() and flow_dv_validate(), the flow items are scanned and each item is marked in item_flags bitmap. The code handling some of the items was ported from another project, where items are marked in a slightly different manner. This patch fixes the setting of items in bitmap, adapting it to the required manner. Fixes: d53aa89aea91 ("net/mlx5: support matching on ICMP/ICMP6") Fixes: 5865955ad994 ("net/mlx5: match GRE key and present bits") Fixes: 2e4c987aad91 ("net/mlx5: validate Direct Rule E-Switch") Cc: stable@dpdk.org Signed-off-by: Dekel Peled Acked-by: Viacheslav Ovsiienko Acked-by: Xiaoyu Min --- drivers/net/mlx5/mlx5_flow_dv.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c index 1d1ff909a5..afaa19c52e 100644 --- a/drivers/net/mlx5/mlx5_flow_dv.c +++ b/drivers/net/mlx5/mlx5_flow_dv.c @@ -2885,7 +2885,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, (dev, items, attr, item_flags, error); if (ret < 0) return ret; - last_item |= MLX5_FLOW_ITEM_PORT_ID; + last_item = MLX5_FLOW_ITEM_PORT_ID; break; case RTE_FLOW_ITEM_TYPE_ETH: ret = mlx5_flow_validate_item_eth(items, item_flags, @@ -2981,7 +2981,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, (items, item_flags, gre_item, error); if (ret < 0) return ret; - item_flags |= MLX5_FLOW_LAYER_GRE_KEY; + last_item = MLX5_FLOW_LAYER_GRE_KEY; break; case RTE_FLOW_ITEM_TYPE_VXLAN: ret = mlx5_flow_validate_item_vxlan(items, item_flags, @@ -3019,7 +3019,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, error); if (ret < 0) return ret; - item_flags |= MLX5_FLOW_LAYER_ICMP; + last_item = MLX5_FLOW_LAYER_ICMP; break; case RTE_FLOW_ITEM_TYPE_ICMP6: ret = mlx5_flow_validate_item_icmp6(items, item_flags, @@ -3027,7 +3027,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, error); if (ret < 0) return ret; - item_flags |= MLX5_FLOW_LAYER_ICMP6; + last_item = MLX5_FLOW_LAYER_ICMP6; break; default: return rte_flow_error_set(error, ENOTSUP, @@ -5045,7 +5045,7 @@ cnt_err: case RTE_FLOW_ITEM_TYPE_GRE_KEY: flow_dv_translate_item_gre_key(match_mask, match_value, items); - item_flags |= MLX5_FLOW_LAYER_GRE_KEY; + last_item = MLX5_FLOW_LAYER_GRE_KEY; break; case RTE_FLOW_ITEM_TYPE_NVGRE: flow_dv_translate_item_nvgre(match_mask, match_value, @@ -5075,12 +5075,12 @@ cnt_err: case RTE_FLOW_ITEM_TYPE_ICMP: flow_dv_translate_item_icmp(match_mask, match_value, items, tunnel); - item_flags |= MLX5_FLOW_LAYER_ICMP; + last_item = MLX5_FLOW_LAYER_ICMP; break; case RTE_FLOW_ITEM_TYPE_ICMP6: flow_dv_translate_item_icmp6(match_mask, match_value, items, tunnel); - item_flags |= MLX5_FLOW_LAYER_ICMP6; + last_item = MLX5_FLOW_LAYER_ICMP6; break; default: break; -- 2.20.1