+/**
+ * Request Memory Region creation to the primary process.
+ *
+ * @param[in] dev
+ * Pointer to Ethernet structure.
+ * @param addr
+ * Target virtual address to register.
+ *
+ * @return
+ * 0 on success, a negative errno value otherwise and rte_errno is set.
+ */
+int
+mlx4_mp_req_mr_create(struct rte_eth_dev *dev, uintptr_t addr)
+{
+ struct rte_mp_msg mp_req;
+ struct rte_mp_msg *mp_res;
+ struct rte_mp_reply mp_rep;
+ struct mlx4_mp_param *req = (struct mlx4_mp_param *)mp_req.param;
+ struct mlx4_mp_param *res;
+ struct timespec ts = {.tv_sec = MLX4_MP_REQ_TIMEOUT_SEC, .tv_nsec = 0};
+ int ret;
+
+ MLX4_ASSERT(rte_eal_process_type() == RTE_PROC_SECONDARY);
+ mp_init_msg(dev, &mp_req, MLX4_MP_REQ_CREATE_MR);
+ req->args.addr = addr;
+ ret = rte_mp_request_sync(&mp_req, &mp_rep, &ts);
+ if (ret) {
+ ERROR("port %u request to primary process failed",
+ dev->data->port_id);
+ return -rte_errno;
+ }
+ MLX4_ASSERT(mp_rep.nb_received == 1);
+ mp_res = &mp_rep.msgs[0];
+ res = (struct mlx4_mp_param *)mp_res->param;
+ ret = res->result;
+ if (ret)
+ rte_errno = -ret;
+ free(mp_rep.msgs);
+ return ret;
+}
+