git: cfdca95f7834 - main - if_bnxt: Add support for RSS on Thor
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 04 Nov 2022 22:55:51 UTC
The branch main has been updated by imp:
URL: https://cgit.FreeBSD.org/src/commit/?id=cfdca95f7834d2c10749fb14e12495d8aa7d1be0
commit cfdca95f7834d2c10749fb14e12495d8aa7d1be0
Author: Sumit Saxena <sumit.saxena@broadcom.com>
AuthorDate: 2022-11-04 22:21:20 +0000
Commit: Warner Losh <imp@FreeBSD.org>
CommitDate: 2022-11-04 22:21:20 +0000
if_bnxt: Add support for RSS on Thor
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36442
---
sys/dev/bnxt/bnxt_hwrm.c | 9 +++++----
sys/dev/bnxt/if_bnxt.c | 28 +++++++++++++++++++---------
2 files changed, 24 insertions(+), 13 deletions(-)
diff --git a/sys/dev/bnxt/bnxt_hwrm.c b/sys/dev/bnxt/bnxt_hwrm.c
index 91e6865449ac..ebcfc5ef03ff 100644
--- a/sys/dev/bnxt/bnxt_hwrm.c
+++ b/sys/dev/bnxt/bnxt_hwrm.c
@@ -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));
}
diff --git a/sys/dev/bnxt/if_bnxt.c b/sys/dev/bnxt/if_bnxt.c
index 6b4e7b516b67..c63b47da4a89 100644
--- a/sys/dev/bnxt/if_bnxt.c
+++ b/sys/dev/bnxt/if_bnxt.c
@@ -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 @@ skip_def_cp_ring:
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);