Author: np
Date: Fri Oct  2 05:59:55 2020
New Revision: 366354
URL: https://svnweb.freebsd.org/changeset/base/366354

Log:
  cxgbe(4): validate largest_rx_cluster and safest_rx_cluster.
  
  These tunables can only be set to a valid cluster size (2K, 4K, 9K, or
  16K) as documented in the man page.  Anything else could lead to a
  panic on interface up.
  
  Reported by:  mav@
  MFC after:    1 week
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/t4_sge.c

Modified: head/sys/dev/cxgbe/t4_sge.c
==============================================================================
--- head/sys/dev/cxgbe/t4_sge.c Fri Oct  2 01:25:08 2020        (r366353)
+++ head/sys/dev/cxgbe/t4_sge.c Fri Oct  2 05:59:55 2020        (r366354)
@@ -542,6 +542,28 @@ t4_sge_modload(void)
                tscale = 1;
        }
 
+       if (largest_rx_cluster != MCLBYTES &&
+#if MJUMPAGESIZE != MCLBYTES
+           largest_rx_cluster != MJUMPAGESIZE &&
+#endif
+           largest_rx_cluster != MJUM9BYTES &&
+           largest_rx_cluster != MJUM16BYTES) {
+               printf("Invalid hw.cxgbe.largest_rx_cluster value (%d),"
+                   " using %d instead.\n", largest_rx_cluster, MJUM16BYTES);
+               largest_rx_cluster = MJUM16BYTES;
+       }
+
+       if (safest_rx_cluster != MCLBYTES &&
+#if MJUMPAGESIZE != MCLBYTES
+           safest_rx_cluster != MJUMPAGESIZE &&
+#endif
+           safest_rx_cluster != MJUM9BYTES &&
+           safest_rx_cluster != MJUM16BYTES) {
+               printf("Invalid hw.cxgbe.safest_rx_cluster value (%d),"
+                   " using %d instead.\n", safest_rx_cluster, MJUMPAGESIZE);
+               safest_rx_cluster = MJUMPAGESIZE;
+       }
+
        extfree_refs = counter_u64_alloc(M_WAITOK);
        extfree_rels = counter_u64_alloc(M_WAITOK);
        pullups = counter_u64_alloc(M_WAITOK);
_______________________________________________
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