Re: [PATCH rdma-next 14/18] RDMA/mlx5: Process create QP flags in one place

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

 



On Mon, Apr 20, 2020 at 06:11:01PM +0300, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@xxxxxxxxxxxx>
>
> create_flags is checked in too many places and scattered across all
> the code, consolidate all the checks inside one function, so we will
> be easily see the flow. As part of such change, delete unreachable code,
> because IB/core is responsible sanitize the input.
>
> Reviewed-by: Maor Gottlieb <maorg@xxxxxxxxxxxx>
> Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx>
> ---
>  drivers/infiniband/hw/mlx5/qp.c | 200 ++++++++++++++++----------------
>  1 file changed, 101 insertions(+), 99 deletions(-)

<...>

> +static int process_create_flags(struct mlx5_ib_dev *dev, struct mlx5_ib_qp *qp,
> +				struct ib_qp_init_attr *attr)
> +{
> +	enum ib_qp_type qp_type = attr->qp_type;
> +	struct mlx5_core_dev *mdev = dev->mdev;
> +	int create_flags = attr->create_flags;
> +	bool cond;
> +
> +	if (qp->qp_sub_type == MLX5_IB_QPT_DCT)
> +		return (create_flags) ? -EINVAL : 0;
> +
> +	if (qp_type == IB_QPT_RAW_PACKET)
> +		return (attr->rwq_ind_tbl && create_flags) ? -EINVAL : 0;

This line is needed to be:
+       if (qp_type == IB_QPT_RAW_PACKET && attr->rwq_ind_tbl)
+               return (create_flags) ? -EINVAL : 0;

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