summaryrefslogtreecommitdiff
path: root/drivers/net/mlx5/mlx5_flow_dv.c
diff options
context:
space:
mode:
authorYongseok Koh <yskoh@mellanox.com>2018-10-23 16:52:12 +0000
committerFerruh Yigit <ferruh.yigit@intel.com>2018-10-26 22:14:06 +0200
commit6949c43c147c504087f367ee0c42939809a6473e (patch)
tree1ae5ff463eac8314ecf3d7d01399649ebf4b2546 /drivers/net/mlx5/mlx5_flow_dv.c
parent31b1999991a2da281d799eaea1e58b3b4bfaa296 (diff)
downloaddpdk-next-eventdev-6949c43c147c504087f367ee0c42939809a6473e.zip
dpdk-next-eventdev-6949c43c147c504087f367ee0c42939809a6473e.tar.gz
dpdk-next-eventdev-6949c43c147c504087f367ee0c42939809a6473e.tar.xz
net/mlx5: fix item validation in Direct Verbs
1) remove MPLS item in validation as it doesn't have a translator. 2) add missing NVGRE item to validation 3) match switch-case order between validation and translation. Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items") Fixes: 3d69434113d1 ("net/mlx5: add Direct Verbs validation function") Signed-off-by: Yongseok Koh <yskoh@mellanox.com> Acked-by: Ori Kam <orika@mellanox.com>
Diffstat (limited to 'drivers/net/mlx5/mlx5_flow_dv.c')
-rw-r--r--drivers/net/mlx5/mlx5_flow_dv.c50
1 files changed, 20 insertions, 30 deletions
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 57884e9..1560340 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -225,6 +225,17 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
((const struct rte_flow_item_ipv6 *)
items->spec)->hdr.proto;
break;
+ case RTE_FLOW_ITEM_TYPE_TCP:
+ ret = mlx5_flow_validate_item_tcp
+ (items, item_flags,
+ next_protocol,
+ &rte_flow_item_tcp_mask,
+ error);
+ if (ret < 0)
+ return ret;
+ item_flags |= tunnel ? MLX5_FLOW_LAYER_INNER_L4_TCP :
+ MLX5_FLOW_LAYER_OUTER_L4_TCP;
+ break;
case RTE_FLOW_ITEM_TYPE_UDP:
ret = mlx5_flow_validate_item_udp(items, item_flags,
next_protocol,
@@ -234,16 +245,13 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
item_flags |= tunnel ? MLX5_FLOW_LAYER_INNER_L4_UDP :
MLX5_FLOW_LAYER_OUTER_L4_UDP;
break;
- case RTE_FLOW_ITEM_TYPE_TCP:
- ret = mlx5_flow_validate_item_tcp
- (items, item_flags,
- next_protocol,
- &rte_flow_item_tcp_mask,
- error);
+ case RTE_FLOW_ITEM_TYPE_GRE:
+ case RTE_FLOW_ITEM_TYPE_NVGRE:
+ ret = mlx5_flow_validate_item_gre(items, item_flags,
+ next_protocol, error);
if (ret < 0)
return ret;
- item_flags |= tunnel ? MLX5_FLOW_LAYER_INNER_L4_TCP :
- MLX5_FLOW_LAYER_OUTER_L4_TCP;
+ item_flags |= MLX5_FLOW_LAYER_GRE;
break;
case RTE_FLOW_ITEM_TYPE_VXLAN:
ret = mlx5_flow_validate_item_vxlan(items, item_flags,
@@ -260,21 +268,6 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr,
return ret;
item_flags |= MLX5_FLOW_LAYER_VXLAN_GPE;
break;
- case RTE_FLOW_ITEM_TYPE_GRE:
- ret = mlx5_flow_validate_item_gre(items, item_flags,
- next_protocol, error);
- if (ret < 0)
- return ret;
- item_flags |= MLX5_FLOW_LAYER_GRE;
- break;
- case RTE_FLOW_ITEM_TYPE_MPLS:
- ret = mlx5_flow_validate_item_mpls(items, item_flags,
- next_protocol,
- error);
- if (ret < 0)
- return ret;
- item_flags |= MLX5_FLOW_LAYER_MPLS;
- break;
case RTE_FLOW_ITEM_TYPE_META:
ret = flow_dv_validate_item_meta(dev, items, attr,
error);
@@ -982,9 +975,6 @@ flow_dv_create_item(void *matcher, void *key,
struct mlx5_flow_dv_matcher *tmatcher = matcher;
switch (item->type) {
- case RTE_FLOW_ITEM_TYPE_VOID:
- case RTE_FLOW_ITEM_TYPE_END:
- break;
case RTE_FLOW_ITEM_TYPE_ETH:
flow_dv_translate_item_eth(tmatcher->mask.buf, key, item,
inner);
@@ -1032,14 +1022,14 @@ flow_dv_create_item(void *matcher, void *key,
(IBV_RX_HASH_SRC_PORT_UDP |
IBV_RX_HASH_DST_PORT_UDP));
break;
- case RTE_FLOW_ITEM_TYPE_NVGRE:
- flow_dv_translate_item_nvgre(tmatcher->mask.buf, key, item,
- inner);
- break;
case RTE_FLOW_ITEM_TYPE_GRE:
flow_dv_translate_item_gre(tmatcher->mask.buf, key, item,
inner);
break;
+ case RTE_FLOW_ITEM_TYPE_NVGRE:
+ flow_dv_translate_item_nvgre(tmatcher->mask.buf, key, item,
+ inner);
+ break;
case RTE_FLOW_ITEM_TYPE_VXLAN:
case RTE_FLOW_ITEM_TYPE_VXLAN_GPE:
flow_dv_translate_item_vxlan(tmatcher->mask.buf, key, item,