Skip to content

Commit

Permalink
Merge pull request #1531 from selvintxavier/pbuf_optimization
Browse files Browse the repository at this point in the history
bnxt_re/lib: Avoid getting push buffer from data path.
  • Loading branch information
rleon authored Dec 19, 2024
2 parents c1b7eff + 0fe89fc commit fb965e2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions providers/bnxt_re/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ struct bnxt_re_qp {
uint32_t tbl_indx;
uint32_t sq_psn;
uint32_t pending_db;
void *pbuf;
uint64_t wqe_cnt;
uint16_t mtu;
uint16_t qpst;
Expand Down
10 changes: 6 additions & 4 deletions providers/bnxt_re/verbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1557,6 +1557,7 @@ struct ibv_qp *bnxt_re_create_qp(struct ibv_pd *ibvpd,
if (qp->cctx->gen_p5_p7 && cntx->udpi.wcdpi) {
qp->push_st_en = 1;
qp->max_push_sz = BNXT_RE_MAX_INLINE_SIZE;
qp->pbuf = bnxt_re_get_pbuf(&qp->push_st_en, cntx);
}

return &qp->ibvqp;
Expand Down Expand Up @@ -1628,6 +1629,10 @@ int bnxt_re_destroy_qp(struct ibv_qp *ibvqp)
if (status)
return status;

if (qp->pbuf) {
bnxt_re_put_pbuf(qp->cntx, qp->pbuf);
qp->pbuf = NULL;
}
bnxt_re_cleanup_cq(qp, qp->rcq);
bnxt_re_cleanup_cq(qp, qp->scq);
mem = qp->mem;
Expand Down Expand Up @@ -1740,7 +1745,7 @@ static int bnxt_re_required_slots(struct bnxt_re_qp *qp, struct ibv_send_wr *wr,
return -EINVAL;
ilsize = align(ilsize, sizeof(struct bnxt_re_sge));
if (qp->push_st_en && ilsize <= qp->max_push_sz)
*pbuf = bnxt_re_get_pbuf(&qp->push_st_en, qp->cntx);
*pbuf = qp->pbuf;
wqe_byte = (ilsize + bnxt_re_get_sqe_hdr_sz());
} else {
wqe_byte = bnxt_re_calc_wqe_sz(wr->num_sge);
Expand Down Expand Up @@ -2065,7 +2070,6 @@ int bnxt_re_post_send(struct ibv_qp *ibvqp, struct ibv_send_wr *wr,
ring_db = false;
pbuf->tail = *sq->dbtail;
bnxt_re_fill_push_wcb(qp, pbuf, idx);
bnxt_re_put_pbuf(qp->cntx, pbuf);
pbuf = NULL;
}

Expand All @@ -2081,8 +2085,6 @@ int bnxt_re_post_send(struct ibv_qp *ibvqp, struct ibv_send_wr *wr,
if (ring_db)
bnxt_re_ring_sq_db(qp);

if (pbuf)
bnxt_re_put_pbuf(qp->cntx, pbuf);

pthread_spin_unlock(&sq->qlock);
return ret;
Expand Down

0 comments on commit fb965e2

Please sign in to comment.