svn commit: r235104 - stable/8/sys/net

Bjoern A. Zeeb bz at FreeBSD.org
Sun May 6 20:26:29 UTC 2012


Author: bz
Date: Sun May  6 20:26:28 2012
New Revision: 235104
URL: http://svn.freebsd.org/changeset/base/235104

Log:
  MFC r233113:
  
   Hide kernel option ROUTETABLES evaluations in the implementation
   rather than the header file.  With this also move RT_MAXFIBS and
   RT_NUMFIBS into the implemantion to avoid further usage in other
   code. rt_numfibs is all that should be needed.
  
   This allows users to change the number of FIBs from 1..RT_MAXFIBS(16)
   dynamically using the tunable without the need to change the kernel
   config for the maximum anymore.  This means that the multi-FIB
   feature is now fully available with GENERIC kernels.
   The kernel option ROUTETABLES can still be used to set the default
   numbers of FIBs in absence of the tunable.

Modified:
  stable/8/sys/net/route.c
  stable/8/sys/net/route.h
Directory Properties:
  stable/8/sys/   (props changed)

Modified: stable/8/sys/net/route.c
==============================================================================
--- stable/8/sys/net/route.c	Sun May  6 20:26:22 2012	(r235103)
+++ stable/8/sys/net/route.c	Sun May  6 20:26:28 2012	(r235104)
@@ -68,6 +68,24 @@
 
 #include <vm/uma.h>
 
+/* We use 4 bits in the mbuf flags, thus we are limited to 16 FIBS. */
+#define	RT_MAXFIBS	16
+
+/* Kernel config default option. */
+#ifdef ROUTETABLES
+#if ROUTETABLES <= 0
+#error "ROUTETABLES defined too low"
+#endif
+#if ROUTETABLES > RT_MAXFIBS
+#error "ROUTETABLES defined too big"
+#endif
+#define	RT_NUMFIBS	ROUTETABLES
+#endif /* ROUTETABLES */
+/* Initialize to default if not otherwise set. */
+#ifndef	RT_NUMFIBS
+#define	RT_NUMFIBS	1
+#endif
+
 u_int rt_numfibs = RT_NUMFIBS;
 SYSCTL_INT(_net, OID_AUTO, fibs, CTLFLAG_RD, &rt_numfibs, 0, "");
 /*

Modified: stable/8/sys/net/route.h
==============================================================================
--- stable/8/sys/net/route.h	Sun May  6 20:26:22 2012	(r235103)
+++ stable/8/sys/net/route.h	Sun May  6 20:26:28 2012	(r235104)
@@ -86,27 +86,6 @@ struct rt_metrics {
 #define	RTM_RTTUNIT	1000000	/* units for rtt, rttvar, as units per sec */
 #define	RTTTOPRHZ(r)	((r) / (RTM_RTTUNIT / PR_SLOWHZ))
 
-/* MRT compile-time constants */
-#ifdef _KERNEL
- #ifndef ROUTETABLES
-  #define RT_NUMFIBS 1
-  #define RT_MAXFIBS 1
- #else
-  /* while we use 4 bits in the mbuf flags, we are limited to 16 */
-  #define RT_MAXFIBS 16
-  #if ROUTETABLES > RT_MAXFIBS
-   #define RT_NUMFIBS RT_MAXFIBS
-   #error "ROUTETABLES defined too big"
-  #else
-   #if ROUTETABLES == 0
-    #define RT_NUMFIBS 1
-   #else
-    #define RT_NUMFIBS ROUTETABLES
-   #endif
-  #endif
- #endif
-#endif
-
 #define	RT_DEFAULT_FIB	0	/* Explicitly mark fib=0 restricted cases */
 extern u_int rt_numfibs;	/* number fo usable routing tables */
 /*


More information about the svn-src-stable-8 mailing list