struct mlx5_mp_param *res = (struct mlx5_mp_param *)mp_res.param;
const struct mlx5_mp_param *param =
(const struct mlx5_mp_param *)mp_msg->param;
- const struct mlx5_mp_arg_mempool_reg *mpr;
- struct mlx5_mp_id mp_id;
+ const struct mlx5_mp_arg_mr_manage *mng = ¶m->args.mr_manage;
+ struct mr_cache_entry entry;
+ uint32_t lkey;
switch (param->type) {
+ case MLX5_MP_REQ_CREATE_MR:
+ mp_init_port_agnostic_msg(&mp_res, param->type);
+ lkey = mlx5_mr_create(mng->cdev, &mng->cdev->mr_scache, &entry,
+ mng->addr);
+ if (lkey == UINT32_MAX)
+ res->result = -rte_errno;
+ return rte_mp_reply(&mp_res, peer);
case MLX5_MP_REQ_MEMPOOL_REGISTER:
- mlx5_mp_id_init(&mp_id, param->port_id);
- mp_init_msg(&mp_id, &mp_res, param->type);
- mpr = ¶m->args.mempool_reg;
- res->result = mlx5_mr_mempool_register(mpr->share_cache,
- mpr->pd, mpr->mempool,
- NULL);
+ mp_init_port_agnostic_msg(&mp_res, param->type);
+ res->result = mlx5_mr_mempool_register(mng->cdev, mng->mempool,
+ mng->is_extmem);
return rte_mp_reply(&mp_res, peer);
case MLX5_MP_REQ_MEMPOOL_UNREGISTER:
- mlx5_mp_id_init(&mp_id, param->port_id);
- mp_init_msg(&mp_id, &mp_res, param->type);
- mpr = ¶m->args.mempool_reg;
- res->result = mlx5_mr_mempool_unregister(mpr->share_cache,
- mpr->mempool, NULL);
+ mp_init_port_agnostic_msg(&mp_res, param->type);
+ res->result = mlx5_mr_mempool_unregister(mng->cdev,
+ mng->mempool);
return rte_mp_reply(&mp_res, peer);
default:
return 1;
(const struct mlx5_mp_param *)mp_msg->param;
struct rte_eth_dev *dev;
struct mlx5_priv *priv;
- struct mr_cache_entry entry;
- uint32_t lkey;
+ struct mlx5_common_device *cdev;
int ret;
MLX5_ASSERT(rte_eal_process_type() == RTE_PROC_PRIMARY);
}
dev = &rte_eth_devices[param->port_id];
priv = dev->data->dev_private;
+ cdev = priv->sh->cdev;
switch (param->type) {
- case MLX5_MP_REQ_CREATE_MR:
- mp_init_msg(&priv->mp_id, &mp_res, param->type);
- lkey = mlx5_mr_create_primary(priv->sh->pd,
- &priv->sh->share_cache,
- &entry, param->args.addr,
- priv->config.mr_ext_memseg_en);
- if (lkey == UINT32_MAX)
- res->result = -rte_errno;
- ret = rte_mp_reply(&mp_res, peer);
- break;
case MLX5_MP_REQ_VERBS_CMD_FD:
mp_init_msg(&priv->mp_id, &mp_res, param->type);
mp_res.num_fds = 1;
- mp_res.fds[0] = ((struct ibv_context *)priv->sh->ctx)->cmd_fd;
+ mp_res.fds[0] = ((struct ibv_context *)cdev->ctx)->cmd_fd;
res->result = 0;
ret = rte_mp_reply(&mp_res, peer);
break;
mp_init_msg(&priv->mp_id, &mp_req, type);
if (type == MLX5_MP_REQ_START_RXTX) {
mp_req.num_fds = 1;
- mp_req.fds[0] = ((struct ibv_context *)priv->sh->ctx)->cmd_fd;
+ mp_req.fds[0] =
+ ((struct ibv_context *)priv->sh->cdev->ctx)->cmd_fd;
}
ret = rte_mp_request_sync(&mp_req, &mp_rep, &ts);
if (ret) {