From owner-p4-projects@FreeBSD.ORG Wed Oct 29 11:21:19 2003 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1F48116A4D1; Wed, 29 Oct 2003 11:21:19 -0800 (PST) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D21B116A4CF for ; Wed, 29 Oct 2003 11:21:18 -0800 (PST) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4070643F75 for ; Wed, 29 Oct 2003 11:21:18 -0800 (PST) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.12.9/8.12.9) with ESMTP id h9TJLIXJ044208 for ; Wed, 29 Oct 2003 11:21:18 -0800 (PST) (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.12.9/8.12.9/Submit) id h9TJLHhN044205 for perforce@freebsd.org; Wed, 29 Oct 2003 11:21:17 -0800 (PST) (envelope-from jhb@freebsd.org) Date: Wed, 29 Oct 2003 11:21:17 -0800 (PST) Message-Id: <200310291921.h9TJLHhN044205@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Subject: PERFORCE change 40769 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Oct 2003 19:21:19 -0000 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;