diff mbox series

IB/mlx4: Utilize macro to calculate SQ spare size

Message ID 20181211083647.20931-1-yuval.shaia@oracle.com (mailing list archive)
State Accepted
Commit 350b4c8ac1b4c07909ab7f8ad4303fff2505ab7c
Delegated to: Jason Gunthorpe
Headers show
Series IB/mlx4: Utilize macro to calculate SQ spare size | expand

Commit Message

Yuval Shaia Dec. 11, 2018, 8:36 a.m. UTC
The macro MLX4_IB_SQ_HEADROOM calculates the spare room needed to be
left. Use it instead of hard-coding the HW prefetch size.

Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
---
 drivers/infiniband/hw/mlx4/qp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Leon Romanovsky Dec. 12, 2018, 1:56 p.m. UTC | #1
On Tue, Dec 11, 2018 at 10:36:47AM +0200, Yuval Shaia wrote:
> The macro MLX4_IB_SQ_HEADROOM calculates the spare room needed to be
> left. Use it instead of hard-coding the HW prefetch size.
>
> Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
> ---
>  drivers/infiniband/hw/mlx4/qp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>

Thanks, Yuval
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Jason Gunthorpe Dec. 18, 2018, 9:39 p.m. UTC | #2
On Tue, Dec 11, 2018 at 10:36:47AM +0200, Yuval Shaia wrote:
> The macro MLX4_IB_SQ_HEADROOM calculates the spare room needed to be
> left. Use it instead of hard-coding the HW prefetch size.
> 
> Signed-off-by: Yuval Shaia <yuval.shaia@oracle.com>
> Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
> ---
>  drivers/infiniband/hw/mlx4/qp.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Applied to for-next

Thanks,
Jason
diff mbox series

Patch

diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index 0711ca1dfb8f..fd95699cae35 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -401,7 +401,7 @@  static int set_kernel_sq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap,
 	 * We need to leave 2 KB + 1 WR of headroom in the SQ to
 	 * allow HW to prefetch.
 	 */
-	qp->sq_spare_wqes = (2048 >> qp->sq.wqe_shift) + 1;
+	qp->sq_spare_wqes = MLX4_IB_SQ_HEADROOM(qp->sq.wqe_shift);
 	qp->sq.wqe_cnt = roundup_pow_of_two(cap->max_send_wr +
 					    qp->sq_spare_wqes);