Skip to content

Commit 78ed28e

Browse files
PatrisiousHaddadjgunthorpe
authored andcommitted
RDMA/mlx5: Round max_rd_atomic/max_dest_rd_atomic up instead of down
After the cited commit below max_dest_rd_atomic and max_rd_atomic values are being rounded down to the next power of 2. As opposed to the old behavior and mlx4 driver where they used to be rounded up instead. In order to stay consistent with older code and other drivers, revert to using fls round function which rounds up to the next power of 2. Fixes: f18e26a ("RDMA/mlx5: Convert modify QP to use MLX5_SET macros") Link: https://patch.msgid.link/r/d85515d6ef21a2fa8ef4c8293dce9b58df8a6297.1728550179.git.leon@kernel.org Signed-off-by: Patrisious Haddad <[email protected]> Reviewed-by: Maher Sanalla <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 89f8c6f commit 78ed28e

File tree

1 file changed

+2
-2
lines changed
  • drivers/infiniband/hw/mlx5

1 file changed

+2
-2
lines changed

drivers/infiniband/hw/mlx5/qp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4268,14 +4268,14 @@ static int __mlx5_ib_modify_qp(struct ib_qp *ibqp,
42684268
MLX5_SET(qpc, qpc, retry_count, attr->retry_cnt);
42694269

42704270
if (attr_mask & IB_QP_MAX_QP_RD_ATOMIC && attr->max_rd_atomic)
4271-
MLX5_SET(qpc, qpc, log_sra_max, ilog2(attr->max_rd_atomic));
4271+
MLX5_SET(qpc, qpc, log_sra_max, fls(attr->max_rd_atomic - 1));
42724272

42734273
if (attr_mask & IB_QP_SQ_PSN)
42744274
MLX5_SET(qpc, qpc, next_send_psn, attr->sq_psn);
42754275

42764276
if (attr_mask & IB_QP_MAX_DEST_RD_ATOMIC && attr->max_dest_rd_atomic)
42774277
MLX5_SET(qpc, qpc, log_rra_max,
4278-
ilog2(attr->max_dest_rd_atomic));
4278+
fls(attr->max_dest_rd_atomic - 1));
42794279

42804280
if (attr_mask & (IB_QP_ACCESS_FLAGS | IB_QP_MAX_DEST_RD_ATOMIC)) {
42814281
err = set_qpc_atomic_flags(qp, attr, attr_mask, qpc);

0 commit comments

Comments
 (0)