src/dpdk/drivers/common/mlx5/mlx5_common_mp.c
int
mlx5_mp_req_verbs_cmd_fd(struct mlx5_mp_id *mp_id)
{
	struct rte_mp_msg mp_req;
	struct rte_mp_msg *mp_res;
	struct rte_mp_reply mp_rep;
	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_VERBS_CMD_FD);
	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);
		return -rte_errno;
	}
	MLX5_ASSERT(mp_rep.nb_received == 1);
	mp_res = &mp_rep.msgs[0];
	res = (struct mlx5_mp_param *)mp_res->param;
	if (res->result) {
		rte_errno = -res->result;
		DRV_LOG(ERR,
			"port %u failed to get command FD from primary process",
			mp_id->port_id);
		ret = -rte_errno;
		goto exit;
	}
	MLX5_ASSERT(mp_res->num_fds == 1);
	ret = mp_res->fds[0];
	DRV_LOG(DEBUG, "port %u command FD from primary is %d",
		mp_id->port_id, ret);
exit:
	mlx5_free(mp_rep.msgs);
	return ret;
}
/**
 * Request Verbs command file descriptor for mmap to the primary process.
 *
 * @param[in] mp_id
 *   ID of the MP process.
 *
 * @return
 *   fd on success, a negative errno value otherwise and rte_errno is set.
 */
Request Verbs command file descriptor for mmap to the primary process.
@param[in] mp_id
ID of the MP process.

@return
fd on success, a negative errno value otherwise and rte_errno is set.
Request Verbs command file descriptor for mmap to the primary process . @param [ in ] mp_id ID of the MP process . @return fd on success a negative errno value otherwise and rte_errno is set .
int
mlx5_mp_req_verbs_cmd_fd(struct mlx5_mp_id *mp_id)
{
	struct rte_mp_msg mp_req;
	struct rte_mp_msg *mp_res;
	struct rte_mp_reply mp_rep;
	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_VERBS_CMD_FD);
	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);
		return -rte_errno;
	}
	MLX5_ASSERT(mp_rep.nb_received == 1);
	mp_res = &mp_rep.msgs[0];
	res = (struct mlx5_mp_param *)mp_res->param;
	if (res->result) {
		rte_errno = -res->result;
		DRV_LOG(ERR,
			"port %u failed to get command FD from primary process",
			mp_id->port_id);
		ret = -rte_errno;
		goto exit;
	}
	MLX5_ASSERT(mp_res->num_fds == 1);
	ret = mp_res->fds[0];
	DRV_LOG(DEBUG, "port %u command FD from primary is %d",
		mp_id->port_id, ret);
exit:
	mlx5_free(mp_rep.msgs);
	return ret;
}
int mlx5_mp_req_verbs_cmd_fd ( struct mlx5_mp_id * mp_id ) { struct rte_mp_msg mp_req ; struct rte_mp_msg * mp_res ; struct rte_mp_reply mp_rep ; 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_VERBS_CMD_FD ) ; ret = rte_mp_request_sync ( & mp_req , & mp_rep , & ts ) ; if ( ret ) { DRV_LOG ( ERR , " " , mp_id -> port_id ) ; return - rte_errno ; } MLX5_ASSERT ( mp_rep . nb_received == 1 ) ; mp_res = & mp_rep . msgs [ 0 ] ; res = ( struct mlx5_mp_param * ) mp_res -> param ; if ( res -> result ) { rte_errno = - res -> result ; DRV_LOG ( ERR , " " , mp_id -> port_id ) ; ret = - rte_errno ; goto exit ; } MLX5_ASSERT ( mp_res -> num_fds == 1 ) ; ret = mp_res -> fds [ 0 ] ; DRV_LOG ( DEBUG , " " , mp_id -> port_id , ret ) ; exit : mlx5_free ( mp_rep . msgs ) ; return ret ; }
Request Verbs command file descriptor for mmap to the primary process.
Request Verbs command file descriptor for mmap to the primary process .