Re: [PATCH rdma-core 2/4] mlx5: Implement ibv_query_qp_data_in_order() verb

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 09, 2021 at 06:59:30PM +0300, Yishai Hadas wrote:
> From: Patrisious Haddad <phaddad@xxxxxxxxxx>
> 
> Implement the ibv_query_qp_data_in_order() verb by using DEVX to read
> from firmware the 'in_order_data' capability.
> 
> Signed-off-by: Patrisious Haddad <phaddad@xxxxxxxxxx>
> Reviewed-by: Maor Gottlieb <maorg@xxxxxxxxxx>
> Signed-off-by: Yishai Hadas <yishaih@xxxxxxxxxx>
> ---
>  providers/mlx5/mlx5.c     |  1 +
>  providers/mlx5/mlx5.h     |  3 +++
>  providers/mlx5/mlx5_ifc.h | 39 +++++++++++++++++++++++++++++++--
>  providers/mlx5/verbs.c    | 55 +++++++++++++++++++++++++++++++++++++++++++++++
>  4 files changed, 96 insertions(+), 2 deletions(-)

<...>

> +int mlx5_query_qp_data_in_order(struct ibv_qp *qp, enum ibv_wr_opcode op,
> +				uint32_t flags)
> +{
> +	uint32_t in_qp[DEVX_ST_SZ_DW(query_qp_in)] = {};
> +	uint32_t out_qp[DEVX_ST_SZ_DW(query_qp_out)] = {};
> +	struct mlx5_context *mctx = to_mctx(qp->context);
> +	struct mlx5_qp *mqp = to_mqp(qp);
> +	int ret;
> +
> +/* Currently this API is only supported for x86 architectures since most
> + * non-x86 platforms are known to be OOO and need to do a per-platform study.
> + */
> +#if !defined(__i386__) && !defined(__x86_64__)
> +	return 0;
> +#endif

Does it compile without warnings/errors on such platforms?
You have "return 0;" in the middle of function, so the right thing to do
it is to write with "#if ..." over function or inside like below, as
long as "#else" exists.

int mlx5_query_qp_data_in_order(struct ibv_qp *qp, enum ibv_wr_opcode op,
				uint32_t flags)
{
#if !defined(__i386__) && !defined(__x86_64__)
	/* Currently this API is only supported for x86 architectures since most
	 * non-x86 platforms are known to be OOO and need to do a per-platform study.
	 */
	 return 0;
#else
.....
#endif

> +
> +	if (flags || !mctx->qp_data_in_order_cap)
> +		return 0;
> +
> +	if (mqp->dc_type == MLX5DV_DCTYPE_DCT)
> +		return query_dct_in_order(qp);
> +
> +	if (qp->state != IBV_QPS_RTS)
> +		return 0;
> +
> +	DEVX_SET(query_qp_in, in_qp, opcode, MLX5_CMD_OP_QUERY_QP);
> +	DEVX_SET(query_qp_in, in_qp, qpn, qp->qp_num);
> +	ret = mlx5dv_devx_qp_query(qp, in_qp, sizeof(in_qp), out_qp,
> +				   sizeof(out_qp));
> +	if (ret)
> +		return 0;
> +
> +	return DEVX_GET(query_qp_out, out_qp, qpc.data_in_order);
> +}
> +

Thanks



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux