Skip to content

Commit

Permalink
RDMA/ocrdma: Correct queue free count math
Browse files Browse the repository at this point in the history
Correct queue free count math for SQ, RQ for all hardware type.
Update user-kernel ABI interface.

Signed-off-by: Parav Pandit <parav.pandit@emulex.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
  • Loading branch information
Parav Pandit authored and Roland Dreier committed May 29, 2012
1 parent c23ddf7 commit cd4fedf
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 17 deletions.
1 change: 0 additions & 1 deletion drivers/infiniband/hw/ocrdma/ocrdma.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ struct ocrdma_qp_hwq_info {
u32 entry_size;
u32 max_cnt;
u32 max_wqe_idx;
u32 free_delta;
u16 dbid; /* qid, where to ring the doorbell. */
u32 len;
dma_addr_t pa;
Expand Down
5 changes: 1 addition & 4 deletions drivers/infiniband/hw/ocrdma/ocrdma_abi.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ struct ocrdma_create_qp_uresp {
u32 rsvd1;
u32 num_wqe_allocated;
u32 num_rqe_allocated;
u32 free_wqe_delta;
u32 free_rqe_delta;
u32 db_sq_offset;
u32 db_rq_offset;
u32 db_shift;
Expand All @@ -126,8 +124,7 @@ struct ocrdma_create_srq_uresp {
u32 db_rq_offset;
u32 db_shift;

u32 free_rqe_delta;
u32 rsvd2;
u64 rsvd2;
u64 rsvd3;
} __packed;

Expand Down
7 changes: 0 additions & 7 deletions drivers/infiniband/hw/ocrdma/ocrdma_hw.c
Original file line number Diff line number Diff line change
Expand Up @@ -1990,19 +1990,12 @@ static void ocrdma_get_create_qp_rsp(struct ocrdma_create_qp_rsp *rsp,
max_wqe_allocated = 1 << max_wqe_allocated;
max_rqe_allocated = 1 << ((u16)rsp->max_wqe_rqe);

if (qp->dev->nic_info.dev_family == OCRDMA_GEN2_FAMILY) {
qp->sq.free_delta = 0;
qp->rq.free_delta = 1;
} else
qp->sq.free_delta = 1;

qp->sq.max_cnt = max_wqe_allocated;
qp->sq.max_wqe_idx = max_wqe_allocated - 1;

if (!attrs->srq) {
qp->rq.max_cnt = max_rqe_allocated;
qp->rq.max_wqe_idx = max_rqe_allocated - 1;
qp->rq.free_delta = 1;
}
}

Expand Down
5 changes: 0 additions & 5 deletions drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -940,8 +940,6 @@ static int ocrdma_copy_qp_uresp(struct ocrdma_qp *qp,
uresp.db_rq_offset = OCRDMA_DB_RQ_OFFSET;
uresp.db_shift = 16;
}
uresp.free_wqe_delta = qp->sq.free_delta;
uresp.free_rqe_delta = qp->rq.free_delta;

if (qp->dpp_enabled) {
uresp.dpp_credit = dpp_credit_lmt;
Expand Down Expand Up @@ -1307,8 +1305,6 @@ static int ocrdma_hwq_free_cnt(struct ocrdma_qp_hwq_info *q)
free_cnt = (q->max_cnt - q->head) + q->tail;
else
free_cnt = q->tail - q->head;
if (q->free_delta)
free_cnt -= q->free_delta;
return free_cnt;
}

Expand Down Expand Up @@ -1501,7 +1497,6 @@ static int ocrdma_copy_srq_uresp(struct ocrdma_srq *srq, struct ib_udata *udata)
(srq->pd->id * srq->dev->nic_info.db_page_size);
uresp.db_page_size = srq->dev->nic_info.db_page_size;
uresp.num_rqe_allocated = srq->rq.max_cnt;
uresp.free_rqe_delta = 1;
if (srq->dev->nic_info.dev_family == OCRDMA_GEN2_FAMILY) {
uresp.db_rq_offset = OCRDMA_DB_GEN2_RQ1_OFFSET;
uresp.db_shift = 24;
Expand Down

0 comments on commit cd4fedf

Please sign in to comment.