summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorNavdeep Parhar <np@FreeBSD.org>2020-10-02 05:59:55 +0000
committerNavdeep Parhar <np@FreeBSD.org>2020-10-02 05:59:55 +0000
commit7676c62aa3fa9a7665278ecf32e732219ea279e6 (patch)
treedca1bff367b010e15d7c40e5e97ecaa15f24bf7d /sys
parent11322826a4045db30dccd9705783278ad3e8ca76 (diff)
downloadsrc-test2-7676c62aa3fa9a7665278ecf32e732219ea279e6.tar.gz
src-test2-7676c62aa3fa9a7665278ecf32e732219ea279e6.zip
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
Notes
Notes: svn path=/head/; revision=366354
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/cxgbe/t4_sge.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/sys/dev/cxgbe/t4_sge.c b/sys/dev/cxgbe/t4_sge.c
index a1e5f28df63d..904797051544 100644
--- a/sys/dev/cxgbe/t4_sge.c
+++ b/sys/dev/cxgbe/t4_sge.c
@@ -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);