Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/mlx5/mlx5_core/mlx5_mr.c
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | void mlx5_init_mr_table(struct mlx5_core_dev *dev) | ||||
INIT_RADIX_TREE(&table->tree, GFP_ATOMIC); | INIT_RADIX_TREE(&table->tree, GFP_ATOMIC); | ||||
} | } | ||||
void mlx5_cleanup_mr_table(struct mlx5_core_dev *dev) | void mlx5_cleanup_mr_table(struct mlx5_core_dev *dev) | ||||
{ | { | ||||
} | } | ||||
int mlx5_core_create_mkey_cb(struct mlx5_core_dev *dev, | int mlx5_core_create_mkey_cb(struct mlx5_core_dev *dev, | ||||
struct mlx5_core_mr *mkey, | struct mlx5_core_mkey *mkey, | ||||
struct mlx5_async_ctx *async_ctx, u32 *in, | struct mlx5_async_ctx *async_ctx, u32 *in, | ||||
int inlen, u32 *out, int outlen, | int inlen, u32 *out, int outlen, | ||||
mlx5_async_cbk_t callback, | mlx5_async_cbk_t callback, | ||||
struct mlx5_async_work *context) | struct mlx5_async_work *context) | ||||
{ | { | ||||
struct mlx5_mr_table *table = &dev->priv.mr_table; | struct mlx5_mr_table *table = &dev->priv.mr_table; | ||||
u32 lout[MLX5_ST_SZ_DW(create_mkey_out)] = {0}; | u32 lout[MLX5_ST_SZ_DW(create_mkey_out)] = {0}; | ||||
u32 mkey_index; | u32 mkey_index; | ||||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | if (err) { | ||||
mlx5_core_destroy_mkey(dev, mkey); | mlx5_core_destroy_mkey(dev, mkey); | ||||
} | } | ||||
return err; | return err; | ||||
} | } | ||||
EXPORT_SYMBOL(mlx5_core_create_mkey_cb); | EXPORT_SYMBOL(mlx5_core_create_mkey_cb); | ||||
int mlx5_core_create_mkey(struct mlx5_core_dev *dev, | int mlx5_core_create_mkey(struct mlx5_core_dev *dev, | ||||
struct mlx5_core_mr *mkey, | struct mlx5_core_mkey *mkey, | ||||
u32 *in, int inlen) | u32 *in, int inlen) | ||||
{ | { | ||||
return mlx5_core_create_mkey_cb(dev, mkey, NULL, in, inlen, | return mlx5_core_create_mkey_cb(dev, mkey, NULL, in, inlen, | ||||
NULL, 0, NULL, NULL); | NULL, 0, NULL, NULL); | ||||
} | } | ||||
EXPORT_SYMBOL(mlx5_core_create_mkey); | EXPORT_SYMBOL(mlx5_core_create_mkey); | ||||
int mlx5_core_destroy_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mkey) | int mlx5_core_destroy_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mkey *mkey) | ||||
{ | { | ||||
struct mlx5_mr_table *table = &dev->priv.mr_table; | struct mlx5_mr_table *table = &dev->priv.mr_table; | ||||
u32 out[MLX5_ST_SZ_DW(destroy_mkey_out)] = {0}; | u32 out[MLX5_ST_SZ_DW(destroy_mkey_out)] = {0}; | ||||
u32 in[MLX5_ST_SZ_DW(destroy_mkey_in)] = {0}; | u32 in[MLX5_ST_SZ_DW(destroy_mkey_in)] = {0}; | ||||
struct mlx5_core_mr *deleted_mr; | struct mlx5_core_mkey *deleted_mr; | ||||
unsigned long flags; | unsigned long flags; | ||||
spin_lock_irqsave(&table->lock, flags); | spin_lock_irqsave(&table->lock, flags); | ||||
deleted_mr = radix_tree_delete(&table->tree, mlx5_mkey_to_idx(mkey->key)); | deleted_mr = radix_tree_delete(&table->tree, mlx5_mkey_to_idx(mkey->key)); | ||||
spin_unlock_irqrestore(&table->lock, flags); | spin_unlock_irqrestore(&table->lock, flags); | ||||
if (!deleted_mr) { | if (!deleted_mr) { | ||||
mlx5_core_warn(dev, "failed radix tree delete of mr 0x%x\n", mkey->key); | mlx5_core_warn(dev, "failed radix tree delete of mr 0x%x\n", mkey->key); | ||||
return -ENOENT; | return -ENOENT; | ||||
} | } | ||||
MLX5_SET(destroy_mkey_in, in, opcode, MLX5_CMD_OP_DESTROY_MKEY); | 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)); | MLX5_SET(destroy_mkey_in, in, mkey_index, mlx5_mkey_to_idx(mkey->key)); | ||||
return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); | return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); | ||||
} | } | ||||
EXPORT_SYMBOL(mlx5_core_destroy_mkey); | EXPORT_SYMBOL(mlx5_core_destroy_mkey); | ||||
int mlx5_core_query_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *mkey, | int mlx5_core_query_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mkey *mkey, | ||||
u32 *out, int outlen) | u32 *out, int outlen) | ||||
{ | { | ||||
u32 in[MLX5_ST_SZ_DW(query_mkey_in)] = {0}; | u32 in[MLX5_ST_SZ_DW(query_mkey_in)] = {0}; | ||||
memset(out, 0, outlen); | memset(out, 0, outlen); | ||||
MLX5_SET(query_mkey_in, in, opcode, MLX5_CMD_OP_QUERY_MKEY); | MLX5_SET(query_mkey_in, in, opcode, MLX5_CMD_OP_QUERY_MKEY); | ||||
MLX5_SET(query_mkey_in, in, mkey_index, mlx5_mkey_to_idx(mkey->key)); | MLX5_SET(query_mkey_in, in, mkey_index, mlx5_mkey_to_idx(mkey->key)); | ||||
return mlx5_cmd_exec(dev, in, sizeof(in), out, outlen); | return mlx5_cmd_exec(dev, in, sizeof(in), out, outlen); | ||||
} | } | ||||
EXPORT_SYMBOL(mlx5_core_query_mkey); | EXPORT_SYMBOL(mlx5_core_query_mkey); | ||||
int mlx5_core_dump_fill_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mr *_mkey, | int mlx5_core_dump_fill_mkey(struct mlx5_core_dev *dev, struct mlx5_core_mkey *_mkey, | ||||
u32 *mkey) | u32 *mkey) | ||||
{ | { | ||||
u32 out[MLX5_ST_SZ_DW(query_special_contexts_out)] = {0}; | u32 out[MLX5_ST_SZ_DW(query_special_contexts_out)] = {0}; | ||||
u32 in[MLX5_ST_SZ_DW(query_special_contexts_in)] = {0}; | u32 in[MLX5_ST_SZ_DW(query_special_contexts_in)] = {0}; | ||||
int err; | int err; | ||||
MLX5_SET(query_special_contexts_in, in, opcode, | MLX5_SET(query_special_contexts_in, in, opcode, | ||||
MLX5_CMD_OP_QUERY_SPECIAL_CONTEXTS); | MLX5_CMD_OP_QUERY_SPECIAL_CONTEXTS); | ||||
▲ Show 20 Lines • Show All 54 Lines • Show Last 20 Lines |