Commit cd4fedf9 authored by Parav Pandit's avatar Parav Pandit Committed by Roland Dreier

RDMA/ocrdma: Correct queue free count math

Correct queue free count math for SQ, RQ for all hardware type.
Update user-kernel ABI interface.
Signed-off-by: default avatarParav Pandit <parav.pandit@emulex.com>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent c23ddf78
...@@ -231,7 +231,6 @@ struct ocrdma_qp_hwq_info { ...@@ -231,7 +231,6 @@ struct ocrdma_qp_hwq_info {
u32 entry_size; u32 entry_size;
u32 max_cnt; u32 max_cnt;
u32 max_wqe_idx; u32 max_wqe_idx;
u32 free_delta;
u16 dbid; /* qid, where to ring the doorbell. */ u16 dbid; /* qid, where to ring the doorbell. */
u32 len; u32 len;
dma_addr_t pa; dma_addr_t pa;
......
...@@ -101,8 +101,6 @@ struct ocrdma_create_qp_uresp { ...@@ -101,8 +101,6 @@ struct ocrdma_create_qp_uresp {
u32 rsvd1; u32 rsvd1;
u32 num_wqe_allocated; u32 num_wqe_allocated;
u32 num_rqe_allocated; u32 num_rqe_allocated;
u32 free_wqe_delta;
u32 free_rqe_delta;
u32 db_sq_offset; u32 db_sq_offset;
u32 db_rq_offset; u32 db_rq_offset;
u32 db_shift; u32 db_shift;
...@@ -126,8 +124,7 @@ struct ocrdma_create_srq_uresp { ...@@ -126,8 +124,7 @@ struct ocrdma_create_srq_uresp {
u32 db_rq_offset; u32 db_rq_offset;
u32 db_shift; u32 db_shift;
u32 free_rqe_delta; u64 rsvd2;
u32 rsvd2;
u64 rsvd3; u64 rsvd3;
} __packed; } __packed;
......
...@@ -1990,19 +1990,12 @@ static void ocrdma_get_create_qp_rsp(struct ocrdma_create_qp_rsp *rsp, ...@@ -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_wqe_allocated = 1 << max_wqe_allocated;
max_rqe_allocated = 1 << ((u16)rsp->max_wqe_rqe); 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_cnt = max_wqe_allocated;
qp->sq.max_wqe_idx = max_wqe_allocated - 1; qp->sq.max_wqe_idx = max_wqe_allocated - 1;
if (!attrs->srq) { if (!attrs->srq) {
qp->rq.max_cnt = max_rqe_allocated; qp->rq.max_cnt = max_rqe_allocated;
qp->rq.max_wqe_idx = max_rqe_allocated - 1; qp->rq.max_wqe_idx = max_rqe_allocated - 1;
qp->rq.free_delta = 1;
} }
} }
......
...@@ -940,8 +940,6 @@ static int ocrdma_copy_qp_uresp(struct ocrdma_qp *qp, ...@@ -940,8 +940,6 @@ static int ocrdma_copy_qp_uresp(struct ocrdma_qp *qp,
uresp.db_rq_offset = OCRDMA_DB_RQ_OFFSET; uresp.db_rq_offset = OCRDMA_DB_RQ_OFFSET;
uresp.db_shift = 16; uresp.db_shift = 16;
} }
uresp.free_wqe_delta = qp->sq.free_delta;
uresp.free_rqe_delta = qp->rq.free_delta;
if (qp->dpp_enabled) { if (qp->dpp_enabled) {
uresp.dpp_credit = dpp_credit_lmt; uresp.dpp_credit = dpp_credit_lmt;
...@@ -1307,8 +1305,6 @@ static int ocrdma_hwq_free_cnt(struct ocrdma_qp_hwq_info *q) ...@@ -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; free_cnt = (q->max_cnt - q->head) + q->tail;
else else
free_cnt = q->tail - q->head; free_cnt = q->tail - q->head;
if (q->free_delta)
free_cnt -= q->free_delta;
return free_cnt; return free_cnt;
} }
...@@ -1501,7 +1497,6 @@ static int ocrdma_copy_srq_uresp(struct ocrdma_srq *srq, struct ib_udata *udata) ...@@ -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); (srq->pd->id * srq->dev->nic_info.db_page_size);
uresp.db_page_size = 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.num_rqe_allocated = srq->rq.max_cnt;
uresp.free_rqe_delta = 1;
if (srq->dev->nic_info.dev_family == OCRDMA_GEN2_FAMILY) { if (srq->dev->nic_info.dev_family == OCRDMA_GEN2_FAMILY) {
uresp.db_rq_offset = OCRDMA_DB_GEN2_RQ1_OFFSET; uresp.db_rq_offset = OCRDMA_DB_GEN2_RQ1_OFFSET;
uresp.db_shift = 24; uresp.db_shift = 24;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment