Commit 74bddb36 authored by Jason Gunthorpe's avatar Jason Gunthorpe
Browse files

RDMA/mlx5: Delete struct mlx5_priv->mkey_table

parent 806b101b
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -90,8 +90,6 @@ static void reg_mr_callback(int status, struct mlx5_async_work *context)
	struct mlx5_cache_ent *ent = &cache->ent[c];
	u8 key;
	unsigned long flags;
	struct xarray *mkeys = &dev->mdev->priv.mkey_table;
	int err;

	spin_lock_irqsave(&ent->lock, flags);
	ent->pending--;
@@ -118,13 +116,6 @@ static void reg_mr_callback(int status, struct mlx5_async_work *context)
	ent->size++;
	spin_unlock_irqrestore(&ent->lock, flags);

	xa_lock_irqsave(mkeys, flags);
	err = xa_err(__xa_store(mkeys, mlx5_base_mkey(mr->mmkey.key),
				&mr->mmkey, GFP_ATOMIC));
	xa_unlock_irqrestore(mkeys, flags);
	if (err)
		pr_err("Error inserting to mkey tree. 0x%x\n", -err);

	if (!completion_done(&ent->compl))
		complete(&ent->compl);
}
+0 −4
Original line number Diff line number Diff line
@@ -837,8 +837,6 @@ static int mlx5_init_once(struct mlx5_core_dev *dev)

	mlx5_init_qp_table(dev);

	mlx5_init_mkey_table(dev);

	mlx5_init_reserved_gids(dev);

	mlx5_init_clock(dev);
@@ -896,7 +894,6 @@ err_rl_cleanup:
err_tables_cleanup:
	mlx5_geneve_destroy(dev->geneve);
	mlx5_vxlan_destroy(dev->vxlan);
	mlx5_cleanup_mkey_table(dev);
	mlx5_cleanup_qp_table(dev);
	mlx5_cq_debugfs_cleanup(dev);
	mlx5_events_cleanup(dev);
@@ -924,7 +921,6 @@ static void mlx5_cleanup_once(struct mlx5_core_dev *dev)
	mlx5_vxlan_destroy(dev->vxlan);
	mlx5_cleanup_clock(dev);
	mlx5_cleanup_reserved_gids(dev);
	mlx5_cleanup_mkey_table(dev);
	mlx5_cleanup_qp_table(dev);
	mlx5_cq_debugfs_cleanup(dev);
	mlx5_events_cleanup(dev);
+1 −27
Original line number Diff line number Diff line
@@ -36,16 +36,6 @@
#include <linux/mlx5/cmd.h>
#include "mlx5_core.h"

void mlx5_init_mkey_table(struct mlx5_core_dev *dev)
{
	xa_init_flags(&dev->priv.mkey_table, XA_FLAGS_LOCK_IRQ);
}

void mlx5_cleanup_mkey_table(struct mlx5_core_dev *dev)
{
	WARN_ON(!xa_empty(&dev->priv.mkey_table));
}

int mlx5_core_create_mkey_cb(struct mlx5_core_dev *dev,
			     struct mlx5_core_mkey *mkey,
			     struct mlx5_async_ctx *async_ctx, u32 *in,
@@ -54,7 +44,6 @@ int mlx5_core_create_mkey_cb(struct mlx5_core_dev *dev,
			     struct mlx5_async_work *context)
{
	u32 lout[MLX5_ST_SZ_DW(create_mkey_out)] = {0};
	struct xarray *mkeys = &dev->priv.mkey_table;
	u32 mkey_index;
	void *mkc;
	int err;
@@ -84,16 +73,7 @@ int mlx5_core_create_mkey_cb(struct mlx5_core_dev *dev,

	mlx5_core_dbg(dev, "out 0x%x, key 0x%x, mkey 0x%x\n",
		      mkey_index, key, mkey->key);

	err = xa_err(xa_store_irq(mkeys, mlx5_base_mkey(mkey->key), mkey,
				  GFP_KERNEL));
	if (err) {
		mlx5_core_warn(dev, "failed xarray insert of mkey 0x%x, %d\n",
			       mlx5_base_mkey(mkey->key), err);
		mlx5_core_destroy_mkey(dev, mkey);
	}

	return err;
	return 0;
}
EXPORT_SYMBOL(mlx5_core_create_mkey_cb);

@@ -111,12 +91,6 @@ int mlx5_core_destroy_mkey(struct mlx5_core_dev *dev,
{
	u32 out[MLX5_ST_SZ_DW(destroy_mkey_out)] = {0};
	u32 in[MLX5_ST_SZ_DW(destroy_mkey_in)]   = {0};
	struct xarray *mkeys = &dev->priv.mkey_table;
	unsigned long flags;

	xa_lock_irqsave(mkeys, flags);
	__xa_erase(mkeys, mlx5_base_mkey(mkey->key));
	xa_unlock_irqrestore(mkeys, flags);

	MLX5_SET(destroy_mkey_in, in, opcode, MLX5_CMD_OP_DESTROY_MKEY);
	MLX5_SET(destroy_mkey_in, in, mkey_index, mlx5_mkey_to_idx(mkey->key));
+0 −4
Original line number Diff line number Diff line
@@ -556,8 +556,6 @@ struct mlx5_priv {
	struct dentry	       *cmdif_debugfs;
	/* end: qp staff */

	struct xarray           mkey_table;

	/* start: alloc staff */
	/* protect buffer alocation according to numa node */
	struct mutex            alloc_mutex;
@@ -942,8 +940,6 @@ struct mlx5_cmd_mailbox *mlx5_alloc_cmd_mailbox_chain(struct mlx5_core_dev *dev,
						      gfp_t flags, int npages);
void mlx5_free_cmd_mailbox_chain(struct mlx5_core_dev *dev,
				 struct mlx5_cmd_mailbox *head);
void mlx5_init_mkey_table(struct mlx5_core_dev *dev);
void mlx5_cleanup_mkey_table(struct mlx5_core_dev *dev);
int mlx5_core_create_mkey_cb(struct mlx5_core_dev *dev,
			     struct mlx5_core_mkey *mkey,
			     struct mlx5_async_ctx *async_ctx, u32 *in,