net/mlx5: fix environment variable recovery
authorViacheslav Ovsiienko <viacheslavo@mellanox.com>
Wed, 13 Nov 2019 16:24:50 +0000 (16:24 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 20 Nov 2019 16:36:05 +0000 (17:36 +0100)
The state of environment variable MLX5_BF_SHUT_UP was not
recovered correctly if there was no tx_db_nc devarg specified.

Fixes: 8409a28573d3 ("net/mlx5: control transmit doorbell register mapping")
Cc: stable@dpdk.org
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
drivers/net/mlx5/mlx5.c

index 2096ee4..35baaf7 100644 (file)
@@ -448,12 +448,9 @@ mlx5_config_doorbell_mapping_env(const struct mlx5_dev_config *config)
 }
 
 static void
-mlx5_restore_doorbell_mapping_env(const struct mlx5_dev_config *config,
-                                 int value)
+mlx5_restore_doorbell_mapping_env(int value)
 {
        assert(rte_eal_process_type() == RTE_PROC_PRIMARY);
-       if (config->dbnc == MLX5_ARG_UNSET)
-               return;
        /* Restore the original environment variable state. */
        if (value == MLX5_ARG_UNSET)
                unsetenv(MLX5_SHUT_UP_BF);
@@ -530,7 +527,7 @@ mlx5_alloc_shared_ibctx(const struct mlx5_dev_spawn_data *spawn,
                sh->devx = 1;
                DRV_LOG(DEBUG, "DevX is supported");
                /* The device is created, no need for environment. */
-               mlx5_restore_doorbell_mapping_env(config, dbmap_env);
+               mlx5_restore_doorbell_mapping_env(dbmap_env);
        } else {
                /* The environment variable is still configured. */
                sh->ctx = mlx5_glue->open_device(spawn->ibv_dev);
@@ -539,10 +536,9 @@ mlx5_alloc_shared_ibctx(const struct mlx5_dev_spawn_data *spawn,
                 * The environment variable is not needed anymore,
                 * all device creation attempts are completed.
                 */
-               mlx5_restore_doorbell_mapping_env(config, dbmap_env);
-               if (!sh->ctx) {
+               mlx5_restore_doorbell_mapping_env(dbmap_env);
+               if (!sh->ctx)
                        goto error;
-               }
                DRV_LOG(DEBUG, "DevX is NOT supported");
        }
        err = mlx5_glue->query_device_ex(sh->ctx, NULL, &sh->device_attr);