if_bnxt: Add support for RSS on Thor

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36442
This commit is contained in:
Sumit Saxena 2022-11-04 16:21:20 -06:00 committed by Warner Losh
parent 6033382aab
commit cfdca95f78
2 changed files with 24 additions and 13 deletions

View File

@ -1494,16 +1494,17 @@ bnxt_hwrm_rss_cfg(struct bnxt_softc *softc, struct bnxt_vnic_info *vnic,
{
struct hwrm_vnic_rss_cfg_input req = {0};
/* TBD */
if (BNXT_CHIP_P5(softc))
return 0;
bnxt_hwrm_cmd_hdr_init(softc, &req, HWRM_VNIC_RSS_CFG);
req.hash_type = htole32(hash_type);
req.ring_grp_tbl_addr = htole64(vnic->rss_grp_tbl.idi_paddr);
req.hash_key_tbl_addr = htole64(vnic->rss_hash_key_tbl.idi_paddr);
req.rss_ctx_idx = htole16(vnic->rss_id);
req.hash_mode_flags = HWRM_FUNC_SPD_CFG_INPUT_HASH_MODE_FLAGS_DEFAULT;
if (BNXT_CHIP_P5(softc)) {
req.vnic_id = htole16(vnic->id);
req.ring_table_pair_index = 0x0;
}
return hwrm_send_message(softc, &req, sizeof(req));
}

View File

@ -1719,6 +1719,23 @@ bnxt_func_reset(struct bnxt_softc *softc)
return;
}
static void
bnxt_rss_grp_tbl_init(struct bnxt_softc *softc)
{
uint16_t *rgt = (uint16_t *) softc->vnic_info.rss_grp_tbl.idi_vaddr;
int i, j;
for (i = 0, j = 0; i < HW_HASH_INDEX_SIZE; i++) {
if (BNXT_CHIP_P5(softc)) {
rgt[i++] = htole16(softc->rx_rings[j].phys_id);
rgt[i] = htole16(softc->rx_cp_rings[j].ring.phys_id);
} else {
rgt[i] = htole16(softc->grp_info[j].grp_id);
}
if (++j == softc->nrxqsets)
j = 0;
}
}
/* Device configuration */
static void
@ -1726,7 +1743,7 @@ bnxt_init(if_ctx_t ctx)
{
struct bnxt_softc *softc = iflib_get_softc(ctx);
struct ifmediareq ifmr;
int i, j;
int i;
int rc;
if (!BNXT_CHIP_P5(softc)) {
@ -1837,14 +1854,7 @@ bnxt_init(if_ctx_t ctx)
if (rc)
goto fail;
/* Enable RSS on the VNICs */
for (i = 0, j = 0; i < HW_HASH_INDEX_SIZE; i++) {
((uint16_t *)
softc->vnic_info.rss_grp_tbl.idi_vaddr)[i] =
htole16(softc->grp_info[j].grp_id);
if (++j == softc->nrxqsets)
j = 0;
}
bnxt_rss_grp_tbl_init(softc);
rc = bnxt_hwrm_rss_cfg(softc, &softc->vnic_info,
softc->vnic_info.rss_hash_type);