From owner-svn-src-head@FreeBSD.ORG Sun Mar 18 11:23:41 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B64DB106566B; Sun, 18 Mar 2012 11:23:41 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8C8DE8FC17; Sun, 18 Mar 2012 11:23:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2IBNfbk016908; Sun, 18 Mar 2012 11:23:41 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2IBNfYS016905; Sun, 18 Mar 2012 11:23:41 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <201203181123.q2IBNfYS016905@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Sun, 18 Mar 2012 11:23:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233113 - head/sys/net X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2012 11:23:41 -0000 Author: bz Date: Sun Mar 18 11:23:40 2012 New Revision: 233113 URL: http://svn.freebsd.org/changeset/base/233113 Log: 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 thet 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. Ok.ed by: julian, hrs, melifaro MFC after: 2 weeks Modified: head/sys/net/route.c head/sys/net/route.h Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Sun Mar 18 10:45:36 2012 (r233112) +++ head/sys/net/route.c Sun Mar 18 11:23:40 2012 (r233113) @@ -68,6 +68,24 @@ #include +/* 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_UINT(_net, OID_AUTO, fibs, CTLFLAG_RD, &rt_numfibs, 0, ""); /* Modified: head/sys/net/route.h ============================================================================== --- head/sys/net/route.h Sun Mar 18 10:45:36 2012 (r233112) +++ head/sys/net/route.h Sun Mar 18 11:23:40 2012 (r233113) @@ -90,27 +90,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 */ /*