PERFORCE change 112911 for review
Marko Zec
zec at FreeBSD.org
Sun Jan 14 18:56:43 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=112911
Change 112911 by zec at zec_tca51 on 2007/01/14 18:56:38
Use a separate rtq_timer callout handle for each vnet instance.
Cought by: change 112910
Affected files ...
.. //depot/projects/vimage/src/sys/netinet/in_rmx.c#3 edit
.. //depot/projects/vimage/src/sys/netinet/vinet.h#7 edit
Differences ...
==== //depot/projects/vimage/src/sys/netinet/in_rmx.c#3 (text+ko) ====
@@ -57,6 +57,7 @@
#include <net/vnet.h>
#include <net/if.h>
#include <net/route.h>
+#include <netinet/vinet.h>
#include <netinet/in.h>
#include <netinet/in_var.h>
#include <netinet/ip_var.h>
@@ -253,20 +254,29 @@
}
#define RTQ_TIMEOUT 60*10 /* run no less than once every ten minutes */
-static int rtq_timeout = RTQ_TIMEOUT;
+#ifndef VIMAGE
+static int rtq_timeout;
static struct callout rtq_timer;
+#endif
static void
in_rtqtimo(void *rock)
{
+ CURVNETB_SET_QUIET((struct vnet_base *) rock);
+ INIT_VNET_NET((struct vnet_base *) rock);
+ INIT_VNET_INET((struct vnet_base *) rock);
+#ifdef VIMAGE
+ struct radix_node_head *rnh = V_rt_tables[AF_INET];
+#else
struct radix_node_head *rnh = rock;
+#endif
struct rtqk_arg arg;
struct timeval atv;
static time_t last_adjusted_timeout = 0;
arg.found = arg.killed = 0;
arg.rnh = rnh;
- arg.nextstop = time_uptime + rtq_timeout;
+ arg.nextstop = time_uptime + V_rtq_timeout;
arg.draining = arg.updating = 0;
RADIX_NODE_HEAD_LOCK(rnh);
rnh->rnh_walktree(rnh, in_rtqkill, &arg);
@@ -281,7 +291,7 @@
* hard.
*/
if ((arg.found - arg.killed > rtq_toomany) &&
- (time_uptime - last_adjusted_timeout >= rtq_timeout) &&
+ (time_uptime - last_adjusted_timeout >= V_rtq_timeout) &&
rtq_reallyold > rtq_minreallyold) {
rtq_reallyold = 2 * rtq_reallyold / 3;
if (rtq_reallyold < rtq_minreallyold) {
@@ -302,7 +312,8 @@
atv.tv_usec = 0;
atv.tv_sec = arg.nextstop - time_uptime;
- callout_reset(&rtq_timer, tvtohz(&atv), in_rtqtimo, rock);
+ callout_reset(&V_rtq_timer, tvtohz(&atv), in_rtqtimo, rock);
+ CURVNETB_RESTORE();
}
void
@@ -329,6 +340,7 @@
in_inithead(void **head, int off)
{
INIT_VNET_NET(curvnetb);
+ INIT_VNET_INET(curvnetb);
struct radix_node_head *rnh;
if (!rn_inithead(head, off))
@@ -337,12 +349,17 @@
if (head != (void **)&V_rt_tables[AF_INET]) /* BOGUS! */
return 1; /* only do this for the real routing table */
+ V_rtq_timeout = RTQ_TIMEOUT;
rnh = *head;
rnh->rnh_addaddr = in_addroute;
rnh->rnh_matchaddr = in_matroute;
rnh->rnh_close = in_clsroute;
- callout_init(&rtq_timer, CALLOUT_MPSAFE);
+ callout_init(&V_rtq_timer, CALLOUT_MPSAFE);
+#ifdef VIMAGE
+ in_rtqtimo(curvnetb); /* kick off timeout first time */
+#else
in_rtqtimo(rnh); /* kick off timeout first time */
+#endif
return 1;
}
==== //depot/projects/vimage/src/sys/netinet/vinet.h#7 (text+ko) ====
@@ -95,6 +95,9 @@
struct igmpstat _igmpstat;
SLIST_HEAD(, router_info) _router_info_head;
+
+ int _rtq_timeout;
+ struct callout _rtq_timer;
};
extern struct vnet_inet vnet_inet_0;
@@ -149,4 +152,7 @@
#define V_router_info_head VNET_INET(router_info_head)
+#define V_rtq_timeout VNET_INET(rtq_timeout)
+#define V_rtq_timer VNET_INET(rtq_timer)
+
#endif /* !_NETINET_VINET_H_ */
More information about the p4-projects
mailing list