Date: Wed, 29 Oct 2003 11:21:17 -0800 (PST) From: John Baldwin <jhb@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 40769 for review Message-ID: <200310291921.h9TJLHhN044205@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=40769 Change 40769 by jhb@jhb_blue on 2003/10/29 11:20:37 IFC @40767. Affected files ... .. //depot/projects/power/sys/netinet/ip_dummynet.c#3 integrate .. //depot/projects/power/sys/netinet/ip_mroute.c#3 integrate Differences ... ==== //depot/projects/power/sys/netinet/ip_dummynet.c#3 (text+ko) ==== @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $FreeBSD: src/sys/netinet/ip_dummynet.c,v 1.70 2003/10/16 16:21:25 sam Exp $ + * $FreeBSD: src/sys/netinet/ip_dummynet.c,v 1.71 2003/10/29 19:03:58 sam Exp $ */ #define DUMMYNET_DEBUG @@ -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 @@ -180,7 +176,7 @@ static int config_pipe(struct dn_pipe *p); static int ip_dn_ctl(struct sockopt *sopt); -static void rt_unref(struct rtentry *); +static void rt_unref(struct rtentry *, const char *); static void dummynet(void *); static void dummynet_flush(void); void dummynet_drain(void); @@ -190,14 +186,16 @@ int if_tx_rdy(struct ifnet *ifp); static void -rt_unref(struct rtentry *rt) +rt_unref(struct rtentry *rt, const char *where) { if (rt == NULL) return ; - if (rt->rt_refcnt <= 0) - printf("dummynet: warning, refcnt now %ld, decreasing\n", - rt->rt_refcnt); - RTFREE(rt); + RT_LOCK(rt); + if (rt->rt_refcnt <= 0) { + printf("dummynet: warning, refcnt now %ld, decreasing (%s)\n", + rt->rt_refcnt, where); + } + RTFREE_LOCKED(rt); } /* @@ -452,7 +450,7 @@ switch (pkt->dn_dir) { case DN_TO_IP_OUT: (void)ip_output((struct mbuf *)pkt, NULL, NULL, 0, NULL, NULL); - rt_unref (pkt->ro.ro_rt) ; + rt_unref (pkt->ro.ro_rt, __func__) ; break ; case DN_TO_IP_IN : @@ -1198,11 +1196,15 @@ * a pointer into *ro so it needs to be updated. */ pkt->ro = *(fwa->ro); - if (fwa->ro->ro_rt) - fwa->ro->ro_rt->rt_refcnt++ ; + if (pkt->ro.ro_rt) { + RT_LOCK(pkt->ro.ro_rt); + pkt->ro.ro_rt->rt_refcnt++ ; + KASSERT(pkt->ro.ro_rt->rt_refcnt > 0, + ("bogus refcnt %ld", pkt->ro.ro_rt->rt_refcnt)); + RT_UNLOCK(pkt->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; } @@ -1303,7 +1305,7 @@ */ #define DN_FREE_PKT(pkt) { \ struct dn_pkt *n = pkt ; \ - rt_unref ( n->ro.ro_rt ) ; \ + rt_unref ( n->ro.ro_rt, __func__ ) ; \ m_freem(n->dn_m); \ pkt = DN_NEXT(n) ; \ free(n, M_DUMMYNET) ; } ==== //depot/projects/power/sys/netinet/ip_mroute.c#3 (text+ko) ==== @@ -17,7 +17,7 @@ * and PIM-SMv2 and PIM-DM support, advanced API support, * bandwidth metering and signaling * - * $FreeBSD: src/sys/netinet/ip_mroute.c,v 1.93 2003/10/24 00:09:18 sam Exp $ + * $FreeBSD: src/sys/netinet/ip_mroute.c,v 1.94 2003/10/29 19:15:00 sam Exp $ */ #include "opt_mac.h" @@ -661,11 +661,15 @@ VIF_LOCK(); if (encap_cookie) { - encap_detach(encap_cookie); + const struct encaptab *c = encap_cookie; encap_cookie = NULL; + encap_detach(c); } + VIF_UNLOCK(); + callout_stop(&tbf_reprocess_ch); + VIF_LOCK(); /* * For each phyint in use, disable promiscuous reception of all IP * multicasts. @@ -691,11 +695,11 @@ /* * Free all multicast forwarding cache entries. */ - MFC_LOCK(); callout_stop(&expire_upcalls_ch); callout_stop(&bw_upcalls_ch); callout_stop(&bw_meter_ch); + MFC_LOCK(); for (i = 0; i < MFCTBLSIZ; i++) { for (rt = mfctable[i]; rt != NULL; ) { struct mfc *nr = rt->mfc_next;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200310291921.h9TJLHhN044205>