aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSepherosa Ziehau <sephe@FreeBSD.org>2016-09-19 06:46:22 +0000
committerSepherosa Ziehau <sephe@FreeBSD.org>2016-09-19 06:46:22 +0000
commit7547506a7910476d632a46bb252aaad78d08a046 (patch)
tree2f5ce64394bf49529cbae5642c7ac8bb661b7bf3
parent3ba0c99044f478a014ee6e3385f4d5f70e15c07a (diff)
downloadsrc-7547506a7910476d632a46bb252aaad78d08a046.tar.gz
src-7547506a7910476d632a46bb252aaad78d08a046.zip
hyperv/hn: Apply RSS indirect table fixup before configure RNDIS RSS.
MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D7916
Notes
Notes: svn path=/head/; revision=305960
-rw-r--r--sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
index faec5fae571f..7f541beef1e0 100644
--- a/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
+++ b/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
@@ -428,6 +428,26 @@ hn_rss_reconfig(struct hn_softc *sc)
return (0);
}
+static void
+hn_rss_ind_fixup(struct hn_softc *sc, int nchan)
+{
+ struct ndis_rssprm_toeplitz *rss = &sc->hn_rss;
+ int i;
+
+ /*
+ * Check indirect table to make sure that all channels in it
+ * can be used.
+ */
+ for (i = 0; i < NDIS_HASH_INDCNT; ++i) {
+ if (rss->rss_ind[i] >= nchan) {
+ if_printf(sc->hn_ifp,
+ "RSS indirect table %d fixup: %u -> %d\n",
+ i, rss->rss_ind[i], nchan - 1);
+ rss->rss_ind[i] = nchan - 1;
+ }
+ }
+}
+
static int
hn_ifmedia_upd(struct ifnet *ifp __unused)
{
@@ -2112,6 +2132,7 @@ hn_rss_ind_sysctl(SYSCTL_HANDLER_ARGS)
if (error)
goto back;
+ hn_rss_ind_fixup(sc, sc->hn_rx_ring_inuse);
error = hn_rss_reconfig(sc);
back:
HN_UNLOCK(sc);
@@ -3265,6 +3286,13 @@ hn_synth_attach(struct hn_softc *sc, int mtu)
/* TODO: Take ndis_rss_caps.ndis_nind into account. */
for (i = 0; i < NDIS_HASH_INDCNT; ++i)
rss->rss_ind[i] = i % nchan;
+ } else {
+ /*
+ * # of usable channels may be changed, so we have to
+ * make sure that all entries in RSS indirect table
+ * are valid.
+ */
+ hn_rss_ind_fixup(sc, nchan);
}
error = hn_rndis_conf_rss(sc, NDIS_RSS_FLAG_NONE);