]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
net/mlx5e: Single bfreg (UAR) for all mlx5e SQs and netdevs
authorSaeed Mahameed <saeedm@mellanox.com>
Fri, 24 Mar 2017 21:52:05 +0000 (00:52 +0300)
committerDavid S. Miller <davem@davemloft.net>
Sat, 25 Mar 2017 02:11:45 +0000 (19:11 -0700)
One is sufficient since Blue Flame is not supported anymore.
This will also come in handy for switchdev mode to save resources, since
VF representors will use same single UAR as well for their own SQs.

Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx5/core/en.h
drivers/net/ethernet/mellanox/mlx5/core/en_common.c
drivers/net/ethernet/mellanox/mlx5/core/en_main.c
include/linux/mlx5/driver.h

index 85261e9ccf4a91b41c3b89cb3fa8f55ef62462c6..22e4bad03f057b021417c81063a8a15dbd473635 100644 (file)
@@ -483,7 +483,6 @@ struct mlx5e_sq {
 
        /* control path */
        struct mlx5_wq_ctrl        wq_ctrl;
-       struct mlx5_sq_bfreg       bfreg;
        struct mlx5e_channel      *channel;
        int                        tc;
        u32                        rate_limit;
index bd898d8deda0ce0c4d6dca7f1ac26722eacf96c4..20bdbe685795338409b9ab65f9d56a885ec7730a 100644 (file)
@@ -107,10 +107,18 @@ int mlx5e_create_mdev_resources(struct mlx5_core_dev *mdev)
                goto err_dealloc_transport_domain;
        }
 
+       err = mlx5_alloc_bfreg(mdev, &res->bfreg, false, false);
+       if (err) {
+               mlx5_core_err(mdev, "alloc bfreg failed, %d\n", err);
+               goto err_destroy_mkey;
+       }
+
        INIT_LIST_HEAD(&mdev->mlx5e_res.td.tirs_list);
 
        return 0;
 
+err_destroy_mkey:
+       mlx5_core_destroy_mkey(mdev, &res->mkey);
 err_dealloc_transport_domain:
        mlx5_core_dealloc_transport_domain(mdev, res->td.tdn);
 err_dealloc_pd:
@@ -122,6 +130,7 @@ void mlx5e_destroy_mdev_resources(struct mlx5_core_dev *mdev)
 {
        struct mlx5e_resources *res = &mdev->mlx5e_res;
 
+       mlx5_free_bfreg(mdev, &res->bfreg);
        mlx5_core_destroy_mkey(mdev, &res->mkey);
        mlx5_core_dealloc_transport_domain(mdev, res->td.tdn);
        mlx5_core_dealloc_pd(mdev, res->pdn);
index f9bcbd277adb779b7e5db9b67d5a9639821bf8cd..49c1769d13b9ee1a87a8ca4fc02c75d67c6d37fa 100644 (file)
@@ -1016,18 +1016,14 @@ static int mlx5e_create_sq(struct mlx5e_channel *c,
        sq->mkey_be   = c->mkey_be;
        sq->channel   = c;
        sq->tc        = tc;
+       sq->uar_map   = mdev->mlx5e_res.bfreg.map;
 
-       err = mlx5_alloc_bfreg(mdev, &sq->bfreg, false, false);
-       if (err)
-               return err;
-
-       sq->uar_map = sq->bfreg.map;
        param->wq.db_numa_node = cpu_to_node(c->cpu);
 
        err = mlx5_wq_cyc_create(mdev, &param->wq, sqc_wq, &sq->wq,
                                 &sq->wq_ctrl);
        if (err)
-               goto err_unmap_free_uar;
+               return err;
 
        sq->wq.db       = &sq->wq.db[MLX5_SND_DBR];
 
@@ -1053,20 +1049,13 @@ static int mlx5e_create_sq(struct mlx5e_channel *c,
 err_sq_wq_destroy:
        mlx5_wq_destroy(&sq->wq_ctrl);
 
-err_unmap_free_uar:
-       mlx5_free_bfreg(mdev, &sq->bfreg);
-
        return err;
 }
 
 static void mlx5e_destroy_sq(struct mlx5e_sq *sq)
 {
-       struct mlx5e_channel *c = sq->channel;
-       struct mlx5e_priv *priv = c->priv;
-
        mlx5e_free_sq_db(sq);
        mlx5_wq_destroy(&sq->wq_ctrl);
-       mlx5_free_bfreg(priv->mdev, &sq->bfreg);
 }
 
 static int mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param)
@@ -1103,7 +1092,7 @@ static int mlx5e_enable_sq(struct mlx5e_sq *sq, struct mlx5e_sq_param *param)
        MLX5_SET(sqc,  sqc, tis_lst_sz, param->type == MLX5E_SQ_ICO ? 0 : 1);
 
        MLX5_SET(wq,   wq, wq_type,       MLX5_WQ_TYPE_CYCLIC);
-       MLX5_SET(wq,   wq, uar_page,      sq->bfreg.index);
+       MLX5_SET(wq,   wq, uar_page,      mdev->mlx5e_res.bfreg.index);
        MLX5_SET(wq,   wq, log_wq_pg_sz,  sq->wq_ctrl.buf.page_shift -
                                          MLX5_ADAPTER_PAGE_SHIFT);
        MLX5_SET64(wq, wq, dbr_addr,      sq->wq_ctrl.db.dma);
index 2fcff6b4503f6a4824bea50c189b072ef6c486cb..f508646262305afe315f4532200dc979b05fddae 100644 (file)
@@ -728,6 +728,7 @@ struct mlx5e_resources {
        u32                        pdn;
        struct mlx5_td             td;
        struct mlx5_core_mkey      mkey;
+       struct mlx5_sq_bfreg       bfreg;
 };
 
 struct mlx5_core_dev {