net/mlx5: fix flow priorities probing error path
authorViacheslav Ovsiienko <viacheslavo@mellanox.com>
Thu, 21 Feb 2019 09:02:16 +0000 (09:02 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 8 Mar 2019 16:52:22 +0000 (17:52 +0100)
The mlx5 PMD probes the Verbs flow priorities supported with
ibv_create_flow() function. If rdma-core or kernel fails for
some reason, the returned error causes the drop queue is not
destroyed, and pd is locked by not freed resource.

Also the mlx5_flow_discover_priorities() returned negative value
as error, and this code was reported "as is", without sign
changing (eventually causing assert(err > 0)).

Fixes: 2815702baea7 ("net/mlx5: replace verbs priorities by flow")
Cc: stable@dpdk.org
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
drivers/net/mlx5/mlx5.c
drivers/net/mlx5/mlx5_flow.c

index 9706e35..740c5e2 100644 (file)
@@ -1243,8 +1243,10 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev,
        priv->config = config;
        /* Supported Verbs flow priority number detection. */
        err = mlx5_flow_discover_priorities(eth_dev);
-       if (err < 0)
+       if (err < 0) {
+               err = -err;
                goto error;
+       }
        priv->config.flow_prio = err;
        /*
         * Once the device is added to the list of memory event
index 9314e3a..dea38e2 100644 (file)
@@ -350,6 +350,7 @@ mlx5_flow_discover_priorities(struct rte_eth_dev *dev)
                claim_zero(mlx5_glue->destroy_flow(flow));
                priority = vprio[i];
        }
+       mlx5_hrxq_drop_release(dev);
        switch (priority) {
        case 8:
                priority = RTE_DIM(priority_map_3);
@@ -361,10 +362,9 @@ mlx5_flow_discover_priorities(struct rte_eth_dev *dev)
                rte_errno = ENOTSUP;
                DRV_LOG(ERR,
                        "port %u verbs maximum priority: %d expected 8/16",
-                       dev->data->port_id, vprio[i]);
+                       dev->data->port_id, priority);
                return -rte_errno;
        }
-       mlx5_hrxq_drop_release(dev);
        DRV_LOG(INFO, "port %u flow maximum priority: %d",
                dev->data->port_id, priority);
        return priority;