PERFORCE change 40409 for review
Sam Leffler
sam at FreeBSD.org
Fri Oct 24 10:54:31 PDT 2003
http://perforce.freebsd.org/chv.cgi?CH=40409
Change 40409 by sam at sam_ebb on 2003/10/24 10:53:49
o add locking around changes to the routing table reference count
o dump routing table entry when hitting a reference with a bad
reference count
o fix comments that still talk about spl's
o remove duplicate DUMMYNET_DEBUG define
Affected files ...
.. //depot/projects/netperf/sys/netinet/ip_dummynet.c#12 edit
Differences ...
==== //depot/projects/netperf/sys/netinet/ip_dummynet.c#12 (text+ko) ====
@@ -39,10 +39,7 @@
* + scheduler and dummynet functions;
* + configuration and initialization.
*
- * NOTA BENE: critical sections are protected by splimp()/splx()
- * pairs. One would think that splnet() is enough as for most of
- * the netinet code, but it is not so because when used with
- * bridging, dummynet is invoked at splimp().
+ * NOTA BENE: critical sections are protected by the "dummynet lock".
*
* Most important Changes:
*
@@ -152,7 +149,6 @@
CTLFLAG_RD, &red_max_pkt_size, 0, "RED Max packet size");
#endif
-#define DUMMYNET_DEBUG
#ifdef DUMMYNET_DEBUG
int dummynet_debug = 0;
#ifdef SYSCTL_NODE
@@ -194,10 +190,13 @@
{
if (rt == NULL)
return ;
- if (rt->rt_refcnt <= 0)
+ RT_LOCK(rt);
+ if (rt->rt_refcnt <= 0) {
printf("dummynet: warning, refcnt now %ld, decreasing\n",
rt->rt_refcnt);
- RTFREE(rt);
+ rt_print(rt); /* XXX */
+ }
+ RTFREE_LOCKED(rt);
}
/*
@@ -1198,11 +1197,13 @@
* a pointer into *ro so it needs to be updated.
*/
pkt->ro = *(fwa->ro);
- if (fwa->ro->ro_rt)
+ if (fwa->ro->ro_rt) {
+ RT_LOCK(fwa->ro->ro_rt);
fwa->ro->ro_rt->rt_refcnt++ ;
+ RT_UNLOCK(fwa->ro->ro_rt);
+ }
if (fwa->dst == (struct sockaddr_in *)&fwa->ro->ro_dst) /* dst points into ro */
fwa->dst = (struct sockaddr_in *)&(pkt->ro.ro_dst) ;
-
pkt->dn_dst = fwa->dst;
pkt->flags = fwa->flags;
}
More information about the p4-projects
mailing list