From 4a858438346793e0ebcbafd51bb86226c1528571 Mon Sep 17 00:00:00 2001 From: Selvin Xavier Date: Tue, 13 Feb 2024 02:56:28 -0800 Subject: [PATCH] bnxt_re/lib: Fix the toggle bit changes in resize cq path Toggle bit to be used in cut off ack Doorbell needs to be copied from the Cut off CQ entry. Fix the same. Also, format the variable declarations to reverse xmas tree style. Fixes: d5d79c8f50cb ("bnxt_re/lib: Get the shared CQ toggle page") Signed-off-by: Selvin Xavier --- providers/bnxt_re/db.c | 10 +++++++--- providers/bnxt_re/main.h | 1 + providers/bnxt_re/verbs.c | 15 +++++++++------ 3 files changed, 17 insertions(+), 9 deletions(-) diff --git a/providers/bnxt_re/db.c b/providers/bnxt_re/db.c index fe2134219..4f50d8de7 100644 --- a/providers/bnxt_re/db.c +++ b/providers/bnxt_re/db.c @@ -182,9 +182,13 @@ void bnxt_re_ring_cq_arm_db(struct bnxt_re_cq *cq, uint8_t aflag) struct bnxt_re_db_hdr hdr; uint32_t *pgptr; - pgptr = (uint32_t *)cq->toggle_map; - if (pgptr) - toggle = *pgptr; + if (aflag == BNXT_RE_QUE_TYPE_CQ_CUT_ACK) { + toggle = cq->resize_tog; + } else { + pgptr = (uint32_t *)cq->toggle_map; + if (pgptr) + toggle = *pgptr; + } bnxt_re_do_pacing(cq->cntx, &cq->rand); epoch = (cq->cqq.flags & BNXT_RE_FLAG_EPOCH_HEAD_MASK) << BNXT_RE_DB_EPOCH_HEAD_SHIFT; diff --git a/providers/bnxt_re/main.h b/providers/bnxt_re/main.h index 2afbabde0..2830aa680 100644 --- a/providers/bnxt_re/main.h +++ b/providers/bnxt_re/main.h @@ -105,6 +105,7 @@ struct bnxt_re_cq { uint32_t mem_handle; void *toggle_map; uint32_t toggle_size; + uint8_t resize_tog; bool deffered_db_sup; uint32_t hw_cqes; }; diff --git a/providers/bnxt_re/verbs.c b/providers/bnxt_re/verbs.c index 4f307981e..986b6036e 100644 --- a/providers/bnxt_re/verbs.c +++ b/providers/bnxt_re/verbs.c @@ -788,23 +788,24 @@ static inline void bnxt_re_check_and_ring_cq_db(struct bnxt_re_cq *cq, static int bnxt_re_poll_one(struct bnxt_re_cq *cq, int nwc, struct ibv_wc *wc, uint32_t *resize) { + int type, cnt = 0, dqed = 0, hw_polled = 0; struct bnxt_re_queue *cqq = &cq->cqq; - struct bnxt_re_qp *qp; - struct bnxt_re_bcqe *hdr; struct bnxt_re_req_cqe *scqe; struct bnxt_re_ud_cqe *rcqe; - void *cqe; uint64_t *qp_handle = NULL; - int type, cnt = 0, dqed = 0, hw_polled = 0; + struct bnxt_re_bcqe *hdr; + struct bnxt_re_qp *qp; uint8_t pcqe = false; + uint32_t flg_val; + void *cqe; while (nwc) { cqe = cqq->va + cqq->head * bnxt_re_get_cqe_sz(); hdr = cqe + sizeof(struct bnxt_re_req_cqe); if (!bnxt_re_is_cqe_valid(cq, hdr)) break; - type = (le32toh(hdr->flg_st_typ_ph) >> - BNXT_RE_BCQE_TYPE_SHIFT) & BNXT_RE_BCQE_TYPE_MASK; + flg_val = le32toh(hdr->flg_st_typ_ph); + type = (flg_val >> BNXT_RE_BCQE_TYPE_SHIFT) & BNXT_RE_BCQE_TYPE_MASK; switch (type) { case BNXT_RE_WC_TYPE_SEND: scqe = cqe; @@ -838,6 +839,8 @@ static int bnxt_re_poll_one(struct bnxt_re_cq *cq, int nwc, struct ibv_wc *wc, break; case BNXT_RE_WC_TYPE_COFF: /* Stop further processing and return */ + cq->resize_tog = (flg_val >> BNXT_RE_BCQE_RESIZE_TOG_SHIFT) + & BNXT_RE_BCQE_RESIZE_TOG_MASK; bnxt_re_resize_cq_complete(cq); if (resize) *resize = 1;