Author: rwatson
Date: Mon Jun  1 15:03:58 2009
New Revision: 193230
URL: http://svn.freebsd.org/changeset/base/193230

Log:
  Garbage collect NETISR_POLL and NETISR_POLLMORE, which are no longer
  required for options DEVICE_POLLING.
  
  De-fragment the NETISR_ constant space and lower NETISR_MAXPROT from
  32 to 16 -- when sizing queue arrays using this compile-time constant,
  significant amounts of memory are saved.
  
  Warn on the console when tunable values for netisr are automatically
  adjusted during boot due to exceeding limits, invalid values, or as a
  result of DEVICE_POLLING.

Modified:
  head/sys/net/netisr.c
  head/sys/net/netisr.h

Modified: head/sys/net/netisr.c
==============================================================================
--- head/sys/net/netisr.c       Mon Jun  1 14:20:13 2009        (r193229)
+++ head/sys/net/netisr.c       Mon Jun  1 15:03:58 2009        (r193230)
@@ -201,7 +201,7 @@ struct netisr_proto {
        u_int            np_policy;     /* Work placement policy. */
 };
 
-#define        NETISR_MAXPROT          32              /* Compile-time limit. 
*/
+#define        NETISR_MAXPROT          16              /* Compile-time limit. 
*/
 
 /*
  * The np array describes all registered protocols, indexed by protocol
@@ -1045,20 +1045,31 @@ netisr_init(void *arg)
        KASSERT(curcpu == 0, ("%s: not on CPU 0", __func__));
 
        NETISR_LOCK_INIT();
-       if (netisr_maxthreads < 1)
+       if (netisr_maxthreads < 1) {
+               printf("netisr2: forcing maxthreads to 1\n");
                netisr_maxthreads = 1;
-       if (netisr_maxthreads > MAXCPU)
+       }
+       if (netisr_maxthreads > MAXCPU) {
+               printf("netisr2: forcing maxthreads to %d\n", MAXCPU);
                netisr_maxthreads = MAXCPU;
-       if (netisr_defaultqlimit > netisr_maxqlimit)
+       }
+       if (netisr_defaultqlimit > netisr_maxqlimit) {
+               printf("netisr2: forcing defaultqlimit to %d\n",
+                   netisr_maxqlimit);
                netisr_defaultqlimit = netisr_maxqlimit;
+       }
 #ifdef DEVICE_POLLING
        /*
         * The device polling code is not yet aware of how to deal with
         * multiple netisr threads, so for the time being compiling in device
         * polling disables parallel netisr workers.
         */
-       netisr_maxthreads = 1;
-       netisr_bindthreads = 0;
+       if (netisr_maxthreads != 1 || netisr_bindthreads != 0) {
+               printf("netisr2: forcing maxthreads to 1 and bindthreads to "
+                   "0 for device polling\n");
+               netisr_maxthreads = 1;
+               netisr_bindthreads = 0;
+       }
 #endif
 
        netisr_start_swi(curcpu, pcpu_find(curcpu));

Modified: head/sys/net/netisr.h
==============================================================================
--- head/sys/net/netisr.h       Mon Jun  1 14:20:13 2009        (r193229)
+++ head/sys/net/netisr.h       Mon Jun  1 15:03:58 2009        (r193230)
@@ -39,19 +39,17 @@
  * Historically, this was implemented by the BSD software ISR facility; it is
  * now implemented via a software ithread (SWI).
  */
-#define        NETISR_POLL     0               /* polling callback, must be 
first */
-#define        NETISR_IP       2               /* same as AF_INET */
-#define        NETISR_IGMP     3               /* IGMPv3 output queue */
-#define        NETISR_ROUTE    14              /* routing socket */
-#define        NETISR_AARP     15              /* Appletalk ARP */
-#define        NETISR_ATALK2   16              /* Appletalk phase 2 */
-#define        NETISR_ATALK1   17              /* Appletalk phase 1 */
-#define        NETISR_ARP      18              /* same as AF_LINK */
-#define        NETISR_IPX      23              /* same as AF_IPX */
-#define        NETISR_ETHER    24              /* ethernet input */
-#define        NETISR_IPV6     27
-#define        NETISR_NATM     28
-#define        NETISR_POLLMORE 31              /* polling callback, must be 
last */
+#define        NETISR_IP       1
+#define        NETISR_IGMP     2               /* IGMPv3 output queue */
+#define        NETISR_ROUTE    3               /* routing socket */
+#define        NETISR_AARP     4               /* Appletalk ARP */
+#define        NETISR_ATALK2   5               /* Appletalk phase 2 */
+#define        NETISR_ATALK1   6               /* Appletalk phase 1 */
+#define        NETISR_ARP      7               /* same as AF_LINK */
+#define        NETISR_IPX      8               /* same as AF_IPX */
+#define        NETISR_ETHER    9               /* ethernet input */
+#define        NETISR_IPV6     10
+#define        NETISR_NATM     11
 
 /*-
  * Protocols express ordering constraints and affinity preferences by
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to