Hi,

It turns out that the last time anyone looked at this constant was
before 1994 and it's very likely time to turn it into a kernel
tunable.  On hosts that have a high rate of packet transmission
packets can be dropped at the interface queue because this value is
too small.  Rather than make a sweeping code change I propose the
following change to the macro and updating a couple of places in the
IP and IPv6 stacks that were using this macro to set their own global
variables.

I have tested this in my test lab at work, it is not as yet in
production at my day job, but will be soon.

Best,
George


Index: netinet/ip_input.c
===================================================================
--- netinet/ip_input.c  (revision 183299)
+++ netinet/ip_input.c  (working copy)
@@ -133,7 +133,6 @@
 struct pfil_head inet_pfil_hook;       /* Packet filter hooks */
 
 static struct  ifqueue ipintrq;
-static int     ipqmaxlen = IFQ_MAXLEN;
 
 extern struct domain inetdomain;
 extern struct protosw inetsw[];
@@ -265,7 +264,7 @@
 
        /* Initialize various other remaining things. */
        ip_id = time_second & 0xffff;
-       ipintrq.ifq_maxlen = ipqmaxlen;
+       ipintrq.ifq_maxlen = IFQ_MAXLEN;
        mtx_init(&ipintrq.ifq_mtx, "ip_inq", NULL, MTX_DEF);
        netisr_register(NETISR_IP, ip_input, &ipintrq, NETISR_MPSAFE);
 }
Index: net/if.c
===================================================================
--- net/if.c    (revision 183299)
+++ net/if.c    (working copy)
@@ -135,7 +135,14 @@
 #endif
 
 int    if_index = 0;
-int    ifqmaxlen = IFQ_MAXLEN;
+
+int ifqmaxlen = 50;
+TUNABLE_INT("net.ifqmaxlen", &ifqmaxlen);
+
+SYSCTL_INT(_net, OID_AUTO, ifqmaxlen, CTLFLAG_RD,
+          &ifqmaxlen, 0,
+          "interface queue length");
+
 struct ifnethead ifnet;        /* depend on static init XXX */
 struct ifgrouphead ifg_head;
 struct mtx ifnet_lock;
Index: net/if.h
===================================================================
--- net/if.h    (revision 183299)
+++ net/if.h    (working copy)
@@ -221,7 +221,7 @@
 #define        IFCAP_WOL       (IFCAP_WOL_UCAST | IFCAP_WOL_MCAST | 
IFCAP_WOL_MAGIC)
 #define        IFCAP_TOE       (IFCAP_TOE4 | IFCAP_TOE6)
 
-#define        IFQ_MAXLEN      50
+#define        IFQ_MAXLEN      ifqmaxlen
 #define        IFNET_SLOWHZ    1               /* granularity is 1 second */
 
 /*
Index: netinet6/ip6_input.c
===================================================================
--- netinet6/ip6_input.c        (revision 183299)
+++ netinet6/ip6_input.c        (working copy)
@@ -115,7 +115,6 @@
 
 u_char ip6_protox[IPPROTO_MAX];
 static struct ifqueue ip6intrq;
-static int ip6qmaxlen = IFQ_MAXLEN;
 struct in6_ifaddr *in6_ifaddr;
 
 extern struct callout in6_tmpaddrtimer_ch;
@@ -178,7 +177,7 @@
                printf("%s: WARNING: unable to register pfil hook, "
                        "error %d\n", __func__, i);
 
-       ip6intrq.ifq_maxlen = ip6qmaxlen;
+       ip6intrq.ifq_maxlen = IFQ_MAXLEN;
        mtx_init(&ip6intrq.ifq_mtx, "ip6_inq", NULL, MTX_DEF);
        netisr_register(NETISR_IPV6, ip6_input, &ip6intrq, 0);
        scope6_init();
_______________________________________________
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "[EMAIL PROTECTED]"

Reply via email to