Commit bf3b4f06 authored by Bart Van Assche's avatar Bart Van Assche Committed by Jason Gunthorpe

IB/mlx5: Do not use hw_access_flags for be and CPU data

Avoid that sparse reports the following for the mlx5 driver:

drivers/infiniband/hw/mlx5/qp.c:2671:34: warning: invalid assignment: |=
drivers/infiniband/hw/mlx5/qp.c:2671:34:    left side has type restricted __be32
drivers/infiniband/hw/mlx5/qp.c:2671:34:    right side has type int
drivers/infiniband/hw/mlx5/qp.c:2679:34: warning: invalid assignment: |=
drivers/infiniband/hw/mlx5/qp.c:2679:34:    left side has type restricted __be32
drivers/infiniband/hw/mlx5/qp.c:2679:34:    right side has type int
drivers/infiniband/hw/mlx5/qp.c:2680:34: warning: invalid assignment: |=
drivers/infiniband/hw/mlx5/qp.c:2680:34:    left side has type restricted __be32
drivers/infiniband/hw/mlx5/qp.c:2680:34:    right side has type int
drivers/infiniband/hw/mlx5/qp.c:2684:34: warning: invalid assignment: |=
drivers/infiniband/hw/mlx5/qp.c:2684:34:    left side has type restricted __be32
drivers/infiniband/hw/mlx5/qp.c:2684:34:    right side has type int
drivers/infiniband/hw/mlx5/qp.c:2686:28: warning: cast from restricted __be32
drivers/infiniband/hw/mlx5/qp.c:2686:28: warning: incorrect type in argument 1 (different base types)
drivers/infiniband/hw/mlx5/qp.c:2686:28:    expected unsigned int [usertype] val
drivers/infiniband/hw/mlx5/qp.c:2686:28:    got restricted __be32 [usertype]
drivers/infiniband/hw/mlx5/qp.c:2686:28: warning: cast from restricted __be32
drivers/infiniband/hw/mlx5/qp.c:2686:28: warning: cast from restricted __be32
drivers/infiniband/hw/mlx5/qp.c:2686:28: warning: cast from restricted __be32
drivers/infiniband/hw/mlx5/qp.c:2686:28: warning: cast from restricted __be32

This patch does not change any functionality.

Fixes: a60109dc ("IB/mlx5: Add support for extended atomic operations")
Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
Acked-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent b0bad9ad
...@@ -2747,10 +2747,10 @@ int mlx5_ib_destroy_qp(struct ib_qp *qp) ...@@ -2747,10 +2747,10 @@ int mlx5_ib_destroy_qp(struct ib_qp *qp)
static int to_mlx5_access_flags(struct mlx5_ib_qp *qp, static int to_mlx5_access_flags(struct mlx5_ib_qp *qp,
const struct ib_qp_attr *attr, const struct ib_qp_attr *attr,
int attr_mask, __be32 *hw_access_flags) int attr_mask, __be32 *hw_access_flags_be)
{ {
u8 dest_rd_atomic; u8 dest_rd_atomic;
u32 access_flags; u32 access_flags, hw_access_flags = 0;
struct mlx5_ib_dev *dev = to_mdev(qp->ibqp.device); struct mlx5_ib_dev *dev = to_mdev(qp->ibqp.device);
...@@ -2768,7 +2768,7 @@ static int to_mlx5_access_flags(struct mlx5_ib_qp *qp, ...@@ -2768,7 +2768,7 @@ static int to_mlx5_access_flags(struct mlx5_ib_qp *qp,
access_flags &= IB_ACCESS_REMOTE_WRITE; access_flags &= IB_ACCESS_REMOTE_WRITE;
if (access_flags & IB_ACCESS_REMOTE_READ) if (access_flags & IB_ACCESS_REMOTE_READ)
*hw_access_flags |= MLX5_QP_BIT_RRE; hw_access_flags |= MLX5_QP_BIT_RRE;
if (access_flags & IB_ACCESS_REMOTE_ATOMIC) { if (access_flags & IB_ACCESS_REMOTE_ATOMIC) {
int atomic_mode; int atomic_mode;
...@@ -2776,14 +2776,14 @@ static int to_mlx5_access_flags(struct mlx5_ib_qp *qp, ...@@ -2776,14 +2776,14 @@ static int to_mlx5_access_flags(struct mlx5_ib_qp *qp,
if (atomic_mode < 0) if (atomic_mode < 0)
return -EOPNOTSUPP; return -EOPNOTSUPP;
*hw_access_flags |= MLX5_QP_BIT_RAE; hw_access_flags |= MLX5_QP_BIT_RAE;
*hw_access_flags |= atomic_mode << MLX5_ATOMIC_MODE_OFFSET; hw_access_flags |= atomic_mode << MLX5_ATOMIC_MODE_OFFSET;
} }
if (access_flags & IB_ACCESS_REMOTE_WRITE) if (access_flags & IB_ACCESS_REMOTE_WRITE)
*hw_access_flags |= MLX5_QP_BIT_RWE; hw_access_flags |= MLX5_QP_BIT_RWE;
*hw_access_flags = cpu_to_be32(*hw_access_flags); *hw_access_flags_be = cpu_to_be32(hw_access_flags);
return 0; return 0;
} }
...@@ -3484,7 +3484,7 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp, ...@@ -3484,7 +3484,7 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp,
} }
if (attr_mask & (IB_QP_ACCESS_FLAGS | IB_QP_MAX_DEST_RD_ATOMIC)) { if (attr_mask & (IB_QP_ACCESS_FLAGS | IB_QP_MAX_DEST_RD_ATOMIC)) {
__be32 access_flags = 0; __be32 access_flags;
err = to_mlx5_access_flags(qp, attr, attr_mask, &access_flags); err = to_mlx5_access_flags(qp, attr, attr_mask, &access_flags);
if (err) if (err)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment