From: Adrien Mazarguil Date: Thu, 26 Apr 2018 16:17:46 +0000 (+0200) Subject: net/mlx5: fix flow director rule deletion crash X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=6f2f4948b236;p=dpdk.git net/mlx5: fix flow director rule deletion crash Flow director rules matching traffic properties above layer 2 do not target a fixed hash Rx queue (HASH_RXQ_ETH), it actually depends on the highest protocol layer specified by each flow rule. mlx5_fdir_filter_delete() makes this wrong assumption and causes a crash when attempting to destroy flow rules with L3/L4 specifications. Fixes: 4c3e9bcdd52e ("net/mlx5: support flow director") Cc: stable@dpdk.org Signed-off-by: Adrien Mazarguil Acked-by: Nelio Laranjeiro --- diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c index c385f6ced1..129311d50b 100644 --- a/drivers/net/mlx5/mlx5_flow.c +++ b/drivers/net/mlx5/mlx5_flow.c @@ -3409,13 +3409,13 @@ mlx5_fdir_filter_delete(struct rte_eth_dev *dev, if (parser.drop) { struct ibv_flow_spec_action_drop *drop; - drop = (void *)((uintptr_t)parser.queue[HASH_RXQ_ETH].ibv_attr + - parser.queue[HASH_RXQ_ETH].offset); + drop = (void *)((uintptr_t)parser.queue[parser.layer].ibv_attr + + parser.queue[parser.layer].offset); *drop = (struct ibv_flow_spec_action_drop){ .type = IBV_FLOW_SPEC_ACTION_DROP, .size = sizeof(struct ibv_flow_spec_action_drop), }; - parser.queue[HASH_RXQ_ETH].ibv_attr->num_of_specs++; + parser.queue[parser.layer].ibv_attr->num_of_specs++; } TAILQ_FOREACH(flow, &priv->flows, next) { struct ibv_flow_attr *attr; @@ -3426,8 +3426,8 @@ mlx5_fdir_filter_delete(struct rte_eth_dev *dev, void *flow_spec; unsigned int specs_n; - attr = parser.queue[HASH_RXQ_ETH].ibv_attr; - flow_attr = flow->frxq[HASH_RXQ_ETH].ibv_attr; + attr = parser.queue[parser.layer].ibv_attr; + flow_attr = flow->frxq[parser.layer].ibv_attr; /* Compare first the attributes. */ if (memcmp(attr, flow_attr, sizeof(struct ibv_flow_attr))) continue;