aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/bnxt_re/qplib_fp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/hw/bnxt_re/qplib_fp.c')
-rw-r--r--drivers/infiniband/hw/bnxt_re/qplib_fp.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/bnxt_re/qplib_fp.c b/drivers/infiniband/hw/bnxt_re/qplib_fp.c
index f05500bcdcf1..9af1514e5944 100644
--- a/drivers/infiniband/hw/bnxt_re/qplib_fp.c
+++ b/drivers/infiniband/hw/bnxt_re/qplib_fp.c
@@ -1128,6 +1128,11 @@ int bnxt_qplib_post_send(struct bnxt_qplib_qp *qp,
1128 } 1128 }
1129 /* Each SGE entry = 1 WQE size16 */ 1129 /* Each SGE entry = 1 WQE size16 */
1130 wqe_size16 = wqe->num_sge; 1130 wqe_size16 = wqe->num_sge;
1131 /* HW requires wqe size has room for atleast one SGE even if
1132 * none was supplied by ULP
1133 */
1134 if (!wqe->num_sge)
1135 wqe_size16++;
1131 } 1136 }
1132 1137
1133 /* Specifics */ 1138 /* Specifics */
@@ -1364,6 +1369,11 @@ int bnxt_qplib_post_recv(struct bnxt_qplib_qp *qp,
1364 rqe->flags = wqe->flags; 1369 rqe->flags = wqe->flags;
1365 rqe->wqe_size = wqe->num_sge + 1370 rqe->wqe_size = wqe->num_sge +
1366 ((offsetof(typeof(*rqe), data) + 15) >> 4); 1371 ((offsetof(typeof(*rqe), data) + 15) >> 4);
1372 /* HW requires wqe size has room for atleast one SGE even if none
1373 * was supplied by ULP
1374 */
1375 if (!wqe->num_sge)
1376 rqe->wqe_size++;
1367 1377
1368 /* Supply the rqe->wr_id index to the wr_id_tbl for now */ 1378 /* Supply the rqe->wr_id index to the wr_id_tbl for now */
1369 rqe->wr_id[0] = cpu_to_le32(sw_prod); 1379 rqe->wr_id[0] = cpu_to_le32(sw_prod);
@@ -1885,6 +1895,25 @@ flush_rq:
1885 return rc; 1895 return rc;
1886} 1896}
1887 1897
1898bool bnxt_qplib_is_cq_empty(struct bnxt_qplib_cq *cq)
1899{
1900 struct cq_base *hw_cqe, **hw_cqe_ptr;
1901 unsigned long flags;
1902 u32 sw_cons, raw_cons;
1903 bool rc = true;
1904
1905 spin_lock_irqsave(&cq->hwq.lock, flags);
1906 raw_cons = cq->hwq.cons;
1907 sw_cons = HWQ_CMP(raw_cons, &cq->hwq);
1908 hw_cqe_ptr = (struct cq_base **)cq->hwq.pbl_ptr;
1909 hw_cqe = &hw_cqe_ptr[CQE_PG(sw_cons)][CQE_IDX(sw_cons)];
1910
1911 /* Check for Valid bit. If the CQE is valid, return false */
1912 rc = !CQE_CMP_VALID(hw_cqe, raw_cons, cq->hwq.max_elements);
1913 spin_unlock_irqrestore(&cq->hwq.lock, flags);
1914 return rc;
1915}
1916
1888static int bnxt_qplib_cq_process_res_raweth_qp1(struct bnxt_qplib_cq *cq, 1917static int bnxt_qplib_cq_process_res_raweth_qp1(struct bnxt_qplib_cq *cq,
1889 struct cq_res_raweth_qp1 *hwcqe, 1918 struct cq_res_raweth_qp1 *hwcqe,
1890 struct bnxt_qplib_cqe **pcqe, 1919 struct bnxt_qplib_cqe **pcqe,