Skip to content

Commit 8f28b17

Browse files
Leon Romanovskyjgunthorpe
authored andcommitted
RDMA/mlx4: Ensure that maximal send/receive SGE less than supported by HW
In calculating the global maximum number of the Scatter/Gather elements supported, the following four maximum parameters must be taken into consideration: max_sg_rq, max_sg_sq, max_desc_sz_rq and max_desc_sz_sq. However instead of bringing this complexity to query_device, which still won't be sufficient anyway (the calculations are dependent on QP type), the safer approach will be to restore old code, which will give us 32 SGEs. Fixes: 33023fb ("IB/core: add max_send_sge and max_recv_sge attributes") Reported-by: Chuck Lever <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 954a8e3 commit 8f28b17

File tree

1 file changed

+5
-3
lines changed
  • drivers/infiniband/hw/mlx4

1 file changed

+5
-3
lines changed

drivers/infiniband/hw/mlx4/main.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -517,9 +517,11 @@ static int mlx4_ib_query_device(struct ib_device *ibdev,
517517
props->page_size_cap = dev->dev->caps.page_size_cap;
518518
props->max_qp = dev->dev->quotas.qp;
519519
props->max_qp_wr = dev->dev->caps.max_wqes - MLX4_IB_SQ_MAX_SPARE;
520-
props->max_send_sge = dev->dev->caps.max_sq_sg;
521-
props->max_recv_sge = dev->dev->caps.max_rq_sg;
522-
props->max_sge_rd = MLX4_MAX_SGE_RD;
520+
props->max_send_sge =
521+
min(dev->dev->caps.max_sq_sg, dev->dev->caps.max_rq_sg);
522+
props->max_recv_sge =
523+
min(dev->dev->caps.max_sq_sg, dev->dev->caps.max_rq_sg);
524+
props->max_sge_rd = MLX4_MAX_SGE_RD;
523525
props->max_cq = dev->dev->quotas.cq;
524526
props->max_cqe = dev->dev->caps.max_cqes;
525527
props->max_mr = dev->dev->quotas.mpt;

0 commit comments

Comments
 (0)