diff options
author | Navdeep Parhar <np@FreeBSD.org> | 2021-03-19 20:28:11 +0000 |
---|---|---|
committer | Navdeep Parhar <np@FreeBSD.org> | 2021-05-16 03:10:57 +0000 |
commit | 139c8bd6f3da4c3cd32ddf1934094436f403e5ed (patch) | |
tree | 4d4a0b8ad503b8c1a8677ae96adf52a1f60706c0 | |
parent | d9eb1e0c90849b9f0f65a8dc9261ae0f187d5ff8 (diff) | |
download | src-139c8bd6f3da4c3cd32ddf1934094436f403e5ed.tar.gz src-139c8bd6f3da4c3cd32ddf1934094436f403e5ed.zip |
cxgbe(4): create a separate helper routine to write the global RSS key.
While here, make sure only the PF driver attempts to program the global
RSS key (with options RSS). The VF driver doesn't have access to those
device registers.
Sponsored by: Chelsio Communications
(cherry picked from commit 3cc6f777befc2e494b39a4c0dcd91aaf99267f40)
-rw-r--r-- | sys/dev/cxgbe/t4_main.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c index 7f25d0f7bcff..67b42dc297b3 100644 --- a/sys/dev/cxgbe/t4_main.c +++ b/sys/dev/cxgbe/t4_main.c @@ -5810,14 +5810,28 @@ t4_setup_intr_handlers(struct adapter *sc) return (0); } -int -adapter_full_init(struct adapter *sc) +static void +write_global_rss_key(struct adapter *sc) { - int rc, i; #ifdef RSS + int i; uint32_t raw_rss_key[RSS_KEYSIZE / sizeof(uint32_t)]; uint32_t rss_key[RSS_KEYSIZE / sizeof(uint32_t)]; + + CTASSERT(RSS_KEYSIZE == 40); + + rss_getkey((void *)&raw_rss_key[0]); + for (i = 0; i < nitems(rss_key); i++) { + rss_key[i] = htobe32(raw_rss_key[nitems(rss_key) - 1 - i]); + } + t4_write_rss_key(sc, &rss_key[0], -1, 1); #endif +} + +int +adapter_full_init(struct adapter *sc) +{ + int rc, i; ASSERT_SYNCHRONIZED_OP(sc); ADAPTER_LOCK_ASSERT_NOTOWNED(sc); @@ -5843,17 +5857,11 @@ adapter_full_init(struct adapter *sc) taskqueue_start_threads(&sc->tq[i], 1, PI_NET, "%s tq%d", device_get_nameunit(sc->dev), i); } -#ifdef RSS - MPASS(RSS_KEYSIZE == 40); - rss_getkey((void *)&raw_rss_key[0]); - for (i = 0; i < nitems(rss_key); i++) { - rss_key[i] = htobe32(raw_rss_key[nitems(rss_key) - 1 - i]); - } - t4_write_rss_key(sc, &rss_key[0], -1, 1); -#endif - if (!(sc->flags & IS_VF)) + if (!(sc->flags & IS_VF)) { + write_global_rss_key(sc); t4_intr_enable(sc); + } #ifdef KERN_TLS if (sc->flags & KERN_TLS_OK) callout_reset_sbt(&sc->ktls_tick, SBT_1MS, 0, ktls_tick, sc, |