Skip to content

Commit

Permalink
bnxt_re/lib: Fix the toggle bit changes in resize cq path
Browse files Browse the repository at this point in the history
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: d5d79c8 ("bnxt_re/lib: Get the shared CQ toggle page")
Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
  • Loading branch information
selvintxavier committed Feb 13, 2024
1 parent 0ffe03e commit 4a85843
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
10 changes: 7 additions & 3 deletions providers/bnxt_re/db.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions providers/bnxt_re/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
15 changes: 9 additions & 6 deletions providers/bnxt_re/verbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 4a85843

Please sign in to comment.