common/mlx5: update log for DevX general command failure
[dpdk.git] / drivers / common / mlx5 / mlx5_common_mp.c
index 6dfc553..a7a671b 100644 (file)
@@ -16,8 +16,8 @@
 /**
  * Request Memory Region creation to the primary process.
  *
- * @param[in] mp_id
- *   ID of the MP process.
+ * @param cdev
+ *   Pointer to the mlx5 common device.
  * @param addr
  *   Target virtual address to register.
  *
  *   0 on success, a negative errno value otherwise and rte_errno is set.
  */
 int
-mlx5_mp_req_mr_create(struct mlx5_mp_id *mp_id, uintptr_t addr)
+mlx5_mp_req_mr_create(struct mlx5_common_device *cdev, uintptr_t addr)
 {
        struct rte_mp_msg mp_req;
        struct rte_mp_msg *mp_res;
        struct rte_mp_reply mp_rep;
        struct mlx5_mp_param *req = (struct mlx5_mp_param *)mp_req.param;
+       struct mlx5_mp_arg_mr_manage *arg = &req->args.mr_manage;
        struct mlx5_mp_param *res;
        struct timespec ts = {.tv_sec = MLX5_MP_REQ_TIMEOUT_SEC, .tv_nsec = 0};
        int ret;
 
        MLX5_ASSERT(rte_eal_process_type() == RTE_PROC_SECONDARY);
-       mp_init_msg(mp_id, &mp_req, MLX5_MP_REQ_CREATE_MR);
-       req->args.addr = addr;
+       mp_init_port_agnostic_msg(&mp_req, MLX5_MP_REQ_CREATE_MR);
+       arg->addr = addr;
+       arg->cdev = cdev;
        ret = rte_mp_request_sync(&mp_req, &mp_rep, &ts);
        if (ret) {
-               DRV_LOG(ERR, "port %u request to primary process failed",
-                       mp_id->port_id);
+               DRV_LOG(ERR, "Create MR request to primary process failed.");
                return -rte_errno;
        }
        MLX5_ASSERT(mp_rep.nb_received == 1);
@@ -55,27 +56,23 @@ mlx5_mp_req_mr_create(struct mlx5_mp_id *mp_id, uintptr_t addr)
 }
 
 /**
- * @param mp_id
- *   ID of the MP process.
- * @param share_cache
- *   Shared MR cache.
- * @param pd
- *   Protection domain.
+ * @param cdev
+ *   Pointer to the mlx5 common device.
  * @param mempool
  *   Mempool to register or unregister.
  * @param reg
  *   True to register the mempool, False to unregister.
  */
 int
-mlx5_mp_req_mempool_reg(struct mlx5_mp_id *mp_id,
-                       struct mlx5_mr_share_cache *share_cache, void *pd,
-                       struct rte_mempool *mempool, bool reg)
+mlx5_mp_req_mempool_reg(struct mlx5_common_device *cdev,
+                       struct rte_mempool *mempool, bool reg,
+                       bool is_extmem)
 {
        struct rte_mp_msg mp_req;
        struct rte_mp_msg *mp_res;
        struct rte_mp_reply mp_rep;
        struct mlx5_mp_param *req = (struct mlx5_mp_param *)mp_req.param;
-       struct mlx5_mp_arg_mempool_reg *arg = &req->args.mempool_reg;
+       struct mlx5_mp_arg_mr_manage *arg = &req->args.mr_manage;
        struct mlx5_mp_param *res;
        struct timespec ts = {.tv_sec = MLX5_MP_REQ_TIMEOUT_SEC, .tv_nsec = 0};
        enum mlx5_mp_req_type type;
@@ -84,14 +81,15 @@ mlx5_mp_req_mempool_reg(struct mlx5_mp_id *mp_id,
        MLX5_ASSERT(rte_eal_process_type() == RTE_PROC_SECONDARY);
        type = reg ? MLX5_MP_REQ_MEMPOOL_REGISTER :
                     MLX5_MP_REQ_MEMPOOL_UNREGISTER;
-       mp_init_msg(mp_id, &mp_req, type);
-       arg->share_cache = share_cache;
-       arg->pd = pd;
+       mp_init_port_agnostic_msg(&mp_req, type);
        arg->mempool = mempool;
+       arg->is_extmem = is_extmem;
+       arg->cdev = cdev;
        ret = rte_mp_request_sync(&mp_req, &mp_rep, &ts);
        if (ret) {
-               DRV_LOG(ERR, "port %u request to primary process failed",
-                       mp_id->port_id);
+               DRV_LOG(ERR,
+                       "Mempool %sregister request to primary process failed.",
+                       reg ? "" : "un");
                return -rte_errno;
        }
        MLX5_ASSERT(mp_rep.nb_received == 1);