Skip to content

Commit 634c579

Browse files
Mahesh Vardhamanaiahrolandd
authored andcommitted
RDMA/ocrdma: Correct queue SGE calculation
Fix max sge calculation for sq, rq, srq for all hardware types. Signed-off-by: Mahesh Vardhamanaiah <[email protected]> Signed-off-by: Roland Dreier <[email protected]>
1 parent 07bb542 commit 634c579

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

drivers/infiniband/hw/ocrdma/ocrdma.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ struct ocrdma_dev_attr {
6161
u32 max_inline_data;
6262
int max_send_sge;
6363
int max_recv_sge;
64+
int max_srq_sge;
6465
int max_mr;
6566
u64 max_mr_size;
6667
u32 max_num_mr_pbl;

drivers/infiniband/hw/ocrdma/ocrdma_hw.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,6 +1002,9 @@ static void ocrdma_get_attr(struct ocrdma_dev *dev,
10021002
attr->max_recv_sge = (rsp->max_write_send_sge &
10031003
OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_MASK) >>
10041004
OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_SHIFT;
1005+
attr->max_srq_sge = (rsp->max_srq_rqe_sge &
1006+
OCRDMA_MBX_QUERY_CFG_MAX_SRQ_SGE_MASK) >>
1007+
OCRDMA_MBX_QUERY_CFG_MAX_SRQ_SGE_OFFSET;
10051008
attr->max_ord_per_qp = (rsp->max_ird_ord_per_qp &
10061009
OCRDMA_MBX_QUERY_CFG_MAX_ORD_PER_QP_MASK) >>
10071010
OCRDMA_MBX_QUERY_CFG_MAX_ORD_PER_QP_SHIFT;

drivers/infiniband/hw/ocrdma/ocrdma_sli.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,9 @@ enum {
418418

419419
OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_SHIFT = 0,
420420
OCRDMA_MBX_QUERY_CFG_MAX_SEND_SGE_MASK = 0xFFFF,
421+
OCRDMA_MBX_QUERY_CFG_MAX_WRITE_SGE_SHIFT = 16,
422+
OCRDMA_MBX_QUERY_CFG_MAX_WRITE_SGE_MASK = 0xFFFF <<
423+
OCRDMA_MBX_QUERY_CFG_MAX_WRITE_SGE_SHIFT,
421424

422425
OCRDMA_MBX_QUERY_CFG_MAX_ORD_PER_QP_SHIFT = 0,
423426
OCRDMA_MBX_QUERY_CFG_MAX_ORD_PER_QP_MASK = 0xFFFF,

drivers/infiniband/hw/ocrdma/ocrdma_verbs.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ int ocrdma_query_device(struct ib_device *ibdev, struct ib_device_attr *attr)
8383
IB_DEVICE_SHUTDOWN_PORT |
8484
IB_DEVICE_SYS_IMAGE_GUID |
8585
IB_DEVICE_LOCAL_DMA_LKEY;
86-
attr->max_sge = dev->attr.max_send_sge;
87-
attr->max_sge_rd = dev->attr.max_send_sge;
86+
attr->max_sge = min(dev->attr.max_send_sge, dev->attr.max_srq_sge);
87+
attr->max_sge_rd = 0;
8888
attr->max_cq = dev->attr.max_cq;
8989
attr->max_cqe = dev->attr.max_cqe;
9090
attr->max_mr = dev->attr.max_mr;
@@ -97,7 +97,7 @@ int ocrdma_query_device(struct ib_device *ibdev, struct ib_device_attr *attr)
9797
min(dev->attr.max_ord_per_qp, dev->attr.max_ird_per_qp);
9898
attr->max_qp_init_rd_atom = dev->attr.max_ord_per_qp;
9999
attr->max_srq = (dev->attr.max_qp - 1);
100-
attr->max_srq_sge = attr->max_sge;
100+
attr->max_srq_sge = attr->max_srq_sge;
101101
attr->max_srq_wr = dev->attr.max_rqe;
102102
attr->local_ca_ack_delay = dev->attr.local_ca_ack_delay;
103103
attr->max_fast_reg_page_list_len = 0;

0 commit comments

Comments
 (0)