Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Mar 2021 20:45:47 GMT
From:      Navdeep Parhar <np@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 3cc6f777befc - main - cxgbe(4): create a separate helper routine to write the global RSS key.
Message-ID:  <202103192045.12JKjlvk021195@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by np:

URL: https://cgit.FreeBSD.org/src/commit/?id=3cc6f777befc2e494b39a4c0dcd91aaf99267f40

commit 3cc6f777befc2e494b39a4c0dcd91aaf99267f40
Author:     Navdeep Parhar <np@FreeBSD.org>
AuthorDate: 2021-03-19 20:28:11 +0000
Commit:     Navdeep Parhar <np@FreeBSD.org>
CommitDate: 2021-03-19 20:35:30 +0000

    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.
    
    MFC after:      1 week
    Sponsored by:   Chelsio Communications
---
 sys/dev/cxgbe/t4_main.c | 32 ++++++++++++++++++++------------
 1 file changed, 20 insertions(+), 12 deletions(-)

diff --git a/sys/dev/cxgbe/t4_main.c b/sys/dev/cxgbe/t4_main.c
index a61110e99e34..12efa8042b64 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,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202103192045.12JKjlvk021195>