Author: sephe
Date: Mon Sep 19 07:39:42 2016
New Revision: 305966
URL: https://svnweb.freebsd.org/changeset/base/305966

Log:
  hyperv/hn: Stringent RSS sysctl checks
  
  - Don't change RNDIS RSS configuration for RSS key sysctl, if the
    interface is not capable of RSS yet.
  - Don't change RSS indirect table (both cached one and RNDIS RSS
    configuration), if the interface is not capable of RSS yet.
  
  MFC after:    1 week
  Sponsored by: Microsoft
  Differential Revision:        https://reviews.freebsd.org/D7924

Modified:
  head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c

Modified: head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c
==============================================================================
--- head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Mon Sep 19 07:32:08 
2016        (r305965)
+++ head/sys/dev/hyperv/netvsc/hv_netvsc_drv_freebsd.c  Mon Sep 19 07:39:42 
2016        (r305966)
@@ -435,6 +435,8 @@ hn_rss_ind_fixup(struct hn_softc *sc, in
        struct ndis_rssprm_toeplitz *rss = &sc->hn_rss;
        int i;
 
+       KASSERT(nchan > 1, ("invalid # of channels %d", nchan));
+
        /*
         * Check indirect table to make sure that all channels in it
         * can be used.
@@ -2145,7 +2147,12 @@ hn_rss_key_sysctl(SYSCTL_HANDLER_ARGS)
        if (error)
                goto back;
 
-       error = hn_rss_reconfig(sc);
+       if (sc->hn_rx_ring_inuse > 1) {
+               error = hn_rss_reconfig(sc);
+       } else {
+               /* Not RSS capable, at least for now; just save the RSS key. */
+               error = 0;
+       }
 back:
        HN_UNLOCK(sc);
        return (error);
@@ -2163,6 +2170,15 @@ hn_rss_ind_sysctl(SYSCTL_HANDLER_ARGS)
        if (error || req->newptr == NULL)
                goto back;
 
+       /*
+        * Don't allow RSS indirect table change, if this interface is not
+        * RSS capable currently.
+        */
+       if (sc->hn_rx_ring_inuse == 1) {
+               error = EOPNOTSUPP;
+               goto back;
+       }
+
        error = SYSCTL_IN(req, sc->hn_rss.rss_ind, sizeof(sc->hn_rss.rss_ind));
        if (error)
                goto back;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to