Date: Fri, 2 Oct 2020 05:59:55 +0000 (UTC) From: Navdeep Parhar <np@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r366354 - head/sys/dev/cxgbe Message-ID: <202010020559.0925xtB9027273@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202010020559.0925xtB9027273>