From 0efc99bed3a0a78a02d55da02cedb5028dbcd6f1 Mon Sep 17 00:00:00 2001 From: Ophir Munk Date: Tue, 5 May 2020 06:16:07 +0000 Subject: [PATCH] net/mlx5: fix flow rules with Verbs The flow_verbs_translate() function accumulates hash fields while iterating through the flow items (SRC_IPV4, DST_IPV4, SRC_IPV6, DST_IPV6, SRC_PORT_TCP, DST_PORT_TCP, SRC_PORT_UDP, DST_PORT_UDP). Before this commit the dev_flow handle structure was reused in each new flow_verbs_translate() call, however the dev_flow->hash_fields variable was not reset before each call. As a result hash_fields from previous calls remained present in the current flow which lead to invalid combinations (e.g. simultaneous IPv4 and IPv6 specs). This scenario happens for example in the next flows sequence, when running in verbs mode (dv_flow_en=0). flow create 0 ingress group 0 pattern eth / ipv4 / end flow create 0 ingress group 0 pattern eth / ipv6 / end The fix is to reset dev_flow->hash_fields in flow_verbs_prepare(). Fixes: e7bfa3596a0a ("net/mlx5: separate the flow handle resource") Signed-off-by: Ophir Munk Acked-by: Matan Azrad --- drivers/net/mlx5/mlx5_flow_verbs.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/mlx5/mlx5_flow_verbs.c b/drivers/net/mlx5/mlx5_flow_verbs.c index 7efd97f547..4659f0a7f7 100644 --- a/drivers/net/mlx5/mlx5_flow_verbs.c +++ b/drivers/net/mlx5/mlx5_flow_verbs.c @@ -1539,6 +1539,7 @@ flow_verbs_prepare(struct rte_eth_dev *dev, dev_flow->verbs.size = 0; dev_flow->verbs.attr.num_of_specs = 0; dev_flow->ingress = attr->ingress; + dev_flow->hash_fields = 0; /* Need to set transfer attribute: not supported in Verbs mode. */ return dev_flow; } -- 2.20.1