Skip to content

Commit

Permalink
bnxt_re/lib: Add GenP7 device ID
Browse files Browse the repository at this point in the history
Add Gen P7 device ID. Enable GenP7 check to support
P7 adapters along with P5 adapters.

Signed-off-by: Selvin Xavier <[email protected]>
  • Loading branch information
selvintxavier committed Dec 19, 2023
1 parent 265e49a commit cef835d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
13 changes: 12 additions & 1 deletion providers/bnxt_re/main.c
Expand Up @@ -121,13 +121,24 @@ static const struct verbs_context_ops bnxt_re_cntx_ops = {
.free_context = bnxt_re_free_context,
};

static inline bool bnxt_re_is_chip_gen_p7(struct bnxt_re_chip_ctx *cctx)
{
return (cctx->chip_num == CHIP_NUM_58818 ||
cctx->chip_num == CHIP_NUM_57608);
}

static bool bnxt_re_is_chip_gen_p5(struct bnxt_re_chip_ctx *cctx)
{
return (cctx->chip_num == CHIP_NUM_57508 ||
cctx->chip_num == CHIP_NUM_57504 ||
cctx->chip_num == CHIP_NUM_57502);
}

static inline bool bnxt_re_is_chip_gen_p5_p7(struct bnxt_re_chip_ctx *cctx)
{
return bnxt_re_is_chip_gen_p5(cctx) || bnxt_re_is_chip_gen_p7(cctx);
}

static int bnxt_re_alloc_map_dbr_page(struct ibv_context *ibvctx)
{
struct bnxt_re_context *cntx = to_bnxt_re_context(ibvctx);
Expand Down Expand Up @@ -199,7 +210,7 @@ static struct verbs_context *bnxt_re_alloc_context(struct ibv_device *vdev,
cntx->cctx.chip_metal = (resp.chip_id0 >>
BNXT_RE_CHIP_ID0_CHIP_MET_SFT) &
0xFF;
cntx->cctx.gen_p5 = bnxt_re_is_chip_gen_p5(&cntx->cctx);
cntx->cctx.gen_p5_p7 = bnxt_re_is_chip_gen_p5_p7(&cntx->cctx);
}

if (resp.comp_mask & BNXT_RE_UCNTX_CMASK_HAVE_MODE)
Expand Down
6 changes: 5 additions & 1 deletion providers/bnxt_re/main.h
Expand Up @@ -62,6 +62,9 @@
#define CHIP_NUM_57508 0x1750
#define CHIP_NUM_57504 0x1751
#define CHIP_NUM_57502 0x1752
#define CHIP_NUM_58818 0xd818
#define CHIP_NUM_57608 0x1760

#define BNXT_RE_MAX_DO_PACING 0xFFFF
#define BNXT_NSEC_PER_SEC 1000000000UL
#define BNXT_RE_PAGE_MASK(pg_size) (~((__u64)(pg_size) - 1))
Expand All @@ -70,7 +73,8 @@ struct bnxt_re_chip_ctx {
__u16 chip_num;
__u8 chip_rev;
__u8 chip_metal;
__u8 gen_p5;
__u8 gen_p5_p7;
__u8 gen_p7;
};

struct bnxt_re_dpi {
Expand Down
12 changes: 6 additions & 6 deletions providers/bnxt_re/verbs.c
Expand Up @@ -190,7 +190,7 @@ struct ibv_pd *bnxt_re_alloc_pd(struct ibv_context *ibvctx)
goto fail;
if (bnxt_re_is_wcdpi_enabled(cntx)) {
bnxt_re_alloc_map_push_page(ibvctx);
if (cntx->cctx.gen_p5 && cntx->udpi.wcdpi)
if (cntx->cctx.gen_p5_p7 && cntx->udpi.wcdpi)
bnxt_re_init_pbuf_list(cntx);
}
}
Expand Down Expand Up @@ -1183,7 +1183,7 @@ static int bnxt_re_alloc_queues(struct bnxt_re_context *cntx,
que->diff = (diff * que->esize) / que->stride;

/* psn_depth extra entries of size que->stride */
psn_size = qp->cctx->gen_p5 ? sizeof(struct bnxt_re_psns_ext) :
psn_size = qp->cctx->gen_p5_p7 ? sizeof(struct bnxt_re_psns_ext) :
sizeof(struct bnxt_re_psns);
psn_depth = (nswr * psn_size) / que->stride;
if ((nswr * psn_size) % que->stride)
Expand Down Expand Up @@ -1212,7 +1212,7 @@ static int bnxt_re_alloc_queues(struct bnxt_re_context *cntx,
swque = qp->jsqq->swque;
for (indx = 0 ; indx < nswr; indx++, psns++)
swque[indx].psns = psns;
if (qp->cctx->gen_p5) {
if (qp->cctx->gen_p5_p7) {
for (indx = 0 ; indx < nswr; indx++, psns_ext++) {
swque[indx].psns_ext = psns_ext;
swque[indx].psns = (struct bnxt_re_psns *)psns_ext;
Expand Down Expand Up @@ -1343,7 +1343,7 @@ struct ibv_qp *bnxt_re_create_qp(struct ibv_pd *ibvpd,
fque_init_node(&qp->snode);
fque_init_node(&qp->rnode);

if (qp->cctx->gen_p5 && cntx->udpi.wcdpi) {
if (qp->cctx->gen_p5_p7 && cntx->udpi.wcdpi) {
qp->push_st_en = 1;
qp->max_push_sz = BNXT_RE_MAX_INLINE_SIZE;
}
Expand Down Expand Up @@ -1617,7 +1617,7 @@ static void bnxt_re_fill_psns(struct bnxt_re_qp *qp, struct bnxt_re_wrid *wrid,
memset(psns, 0, sizeof(*psns));
psns->opc_spsn = htole32(opc_spsn);
psns->flg_npsn = htole32(flg_npsn);
if (qp->cctx->gen_p5)
if (qp->cctx->gen_p5_p7)
psns_ext->st_slot_idx = wrid->st_slot_idx;
}

Expand Down Expand Up @@ -1826,7 +1826,7 @@ int bnxt_re_post_send(struct ibv_qp *ibvqp, struct ibv_send_wr *wr,
qp->wqe_cnt++;
wr = wr->next;

if (unlikely(!qp->cntx->cctx.gen_p5 && qp->wqe_cnt == BNXT_RE_UD_QP_HW_STALL &&
if (unlikely(!qp->cntx->cctx.gen_p5_p7 && qp->wqe_cnt == BNXT_RE_UD_QP_HW_STALL &&
qp->qptyp == IBV_QPT_UD))
bnxt_re_force_rts2rts(qp);
}
Expand Down

0 comments on commit cef835d

Please sign in to comment.