From owner-svn-src-all@FreeBSD.ORG Wed Jun 19 21:50:17 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A0A4F43B; Wed, 19 Jun 2013 21:50:17 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 92983115F; Wed, 19 Jun 2013 21:50:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r5JLoHik056939; Wed, 19 Jun 2013 21:50:17 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r5JLoHNc056937; Wed, 19 Jun 2013 21:50:17 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201306192150.r5JLoHNc056937@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 19 Jun 2013 21:50:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r252009 - head/sys/netinet6 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Jun 2013 21:50:17 -0000 Author: ae Date: Wed Jun 19 21:50:17 2013 New Revision: 252009 URL: http://svnweb.freebsd.org/changeset/base/252009 Log: Use PIM6STAT_INC() and MRT6STAT_INC() macros for IPv6 multicast statistics accounting. MFC after: 2 weeks Modified: head/sys/netinet6/ip6_mroute.c Modified: head/sys/netinet6/ip6_mroute.c ============================================================================== --- head/sys/netinet6/ip6_mroute.c Wed Jun 19 20:56:44 2013 (r252008) +++ head/sys/netinet6/ip6_mroute.c Wed Jun 19 21:50:17 2013 (r252009) @@ -162,6 +162,7 @@ SYSCTL_STRUCT(_net_inet6_ip6, OID_AUTO, &mrt6stat, mrt6stat, "Multicast Routing Statistics (struct mrt6stat, netinet6/ip6_mroute.h)"); +#define MRT6STAT_INC(name) mrt6stat.name += 1 #define NO_RTE_FOUND 0x1 #define RTE_FOUND 0x2 @@ -251,8 +252,9 @@ static mifi_t reg_mif_num = (mifi_t)-1; static struct pim6stat pim6stat; SYSCTL_STRUCT(_net_inet6_pim, PIM6CTL_STATS, stats, CTLFLAG_RW, &pim6stat, pim6stat, - "PIM Statistics (struct pim6stat, netinet6/pim_var.h)"); + "PIM Statistics (struct pim6stat, netinet6/pim6_var.h)"); +#define PIM6STAT_INC(name) pim6stat.name += 1 static VNET_DEFINE(int, pim6); #define V_pim6 VNET(pim6) @@ -270,7 +272,7 @@ static VNET_DEFINE(int, pim6); #define MF6CFIND(o, g, rt) do { \ struct mf6c *_rt = mf6ctable[MF6CHASH(o,g)]; \ rt = NULL; \ - mrt6stat.mrt6s_mfc_lookups++; \ + MRT6STAT_INC(mrt6s_mfc_lookups); \ while (_rt) { \ if (IN6_ARE_ADDR_EQUAL(&_rt->mf6c_origin.sin6_addr, &(o)) && \ IN6_ARE_ADDR_EQUAL(&_rt->mf6c_mcastgrp.sin6_addr, &(g)) && \ @@ -281,7 +283,7 @@ static VNET_DEFINE(int, pim6); _rt = _rt->mf6c_next; \ } \ if (rt == NULL) { \ - mrt6stat.mrt6s_mfc_misses++; \ + MRT6STAT_INC(mrt6s_mfc_misses); \ } \ } while (/*CONSTCOND*/ 0) @@ -1142,7 +1144,7 @@ X_ip6_mforward(struct ip6_hdr *ip6, stru GET_TIME(tp); #endif /* UPCALL_TIMING */ - mrt6stat.mrt6s_no_route++; + MRT6STAT_INC(mrt6s_no_route); #ifdef MRT6DEBUG if (V_mrt6debug & (DEBUG_FORWARD | DEBUG_MFC)) log(LOG_DEBUG, "ip6_mforward: no rte s %s g %s\n", @@ -1269,7 +1271,7 @@ X_ip6_mforward(struct ip6_hdr *ip6, stru if (socket_send(V_ip6_mrouter, mm, &sin6) < 0) { log(LOG_WARNING, "ip6_mforward: ip6_mrouter " "socket queue full\n"); - mrt6stat.mrt6s_upq_sockfull++; + MRT6STAT_INC(mrt6s_upq_sockfull); free(rte, M_MRTABLE6); m_freem(mb0); free(rt, M_MRTABLE6); @@ -1277,7 +1279,7 @@ X_ip6_mforward(struct ip6_hdr *ip6, stru return (ENOBUFS); } - mrt6stat.mrt6s_upcalls++; + MRT6STAT_INC(mrt6s_upcalls); /* insert new entry at head of hash chain */ bzero(rt, sizeof(*rt)); @@ -1303,7 +1305,7 @@ X_ip6_mforward(struct ip6_hdr *ip6, stru for (p = &rt->mf6c_stall; *p != NULL; p = &(*p)->next) if (++npkts > MAX_UPQ6) { - mrt6stat.mrt6s_upq_ovflw++; + MRT6STAT_INC(mrt6s_upq_ovflw); free(rte, M_MRTABLE6); m_freem(mb0); MFC6_UNLOCK(); @@ -1372,7 +1374,7 @@ expire_upcalls(void *unused) free(rte, M_MRTABLE6); rte = n; } while (rte != NULL); - mrt6stat.mrt6s_cache_cleanups++; + MRT6STAT_INC(mrt6s_cache_cleanups); n6expire[i]--; *nptr = mfc->mf6c_next; @@ -1428,7 +1430,7 @@ ip6_mdq(struct mbuf *m, struct ifnet *if ifp->if_index, mifi, mif6table[mifi].m6_ifp->if_index); #endif - mrt6stat.mrt6s_wrong_if++; + MRT6STAT_INC(mrt6s_wrong_if); rt->mf6c_wrong_if++; /* * If we are doing PIM processing, and we are forwarding @@ -1501,14 +1503,14 @@ ip6_mdq(struct mbuf *m, struct ifnet *if break; } - mrt6stat.mrt6s_upcalls++; + MRT6STAT_INC(mrt6s_upcalls); if (socket_send(V_ip6_mrouter, mm, &sin6) < 0) { #ifdef MRT6DEBUG if (V_mrt6debug) log(LOG_WARNING, "mdq, ip6_mrouter socket queue full\n"); #endif - ++mrt6stat.mrt6s_upq_sockfull; + MRT6STAT_INC(mrt6s_upq_sockfull); return (ENOBUFS); } /* if socket Q full */ } /* if PIM */ @@ -1696,7 +1698,7 @@ register_send(struct ip6_hdr *ip6, struc ip6_sprintf(ip6bufd, &ip6->ip6_dst)); } #endif - ++pim6stat.pim6s_snd_registers; + PIM6STAT_INC(pim6s_snd_registers); /* Make a copy of the packet to send to the user level process. */ mm = m_gethdr(M_NOWAIT, MT_DATA); @@ -1730,7 +1732,7 @@ register_send(struct ip6_hdr *ip6, struc im6->im6_mif = mif - mif6table; /* iif info is not given for reg. encap.n */ - mrt6stat.mrt6s_upcalls++; + MRT6STAT_INC(mrt6s_upcalls); if (socket_send(V_ip6_mrouter, mm, &sin6) < 0) { #ifdef MRT6DEBUG @@ -1738,7 +1740,7 @@ register_send(struct ip6_hdr *ip6, struc log(LOG_WARNING, "register_send: ip6_mrouter socket queue full\n"); #endif - ++mrt6stat.mrt6s_upq_sockfull; + MRT6STAT_INC(mrt6s_upq_sockfull); return (ENOBUFS); } return (0); @@ -1779,7 +1781,7 @@ pim6_input(struct mbuf **mp, int *offp, int minlen; int off = *offp; - ++pim6stat.pim6s_rcv_total; + PIM6STAT_INC(pim6s_rcv_total); ip6 = mtod(m, struct ip6_hdr *); pimlen = m->m_pkthdr.len - *offp; @@ -1788,7 +1790,7 @@ pim6_input(struct mbuf **mp, int *offp, * Validate lengths */ if (pimlen < PIM_MINLEN) { - ++pim6stat.pim6s_rcv_tooshort; + PIM6STAT_INC(pim6s_rcv_tooshort); #ifdef MRT6DEBUG if (V_mrt6debug & DEBUG_PIM) log(LOG_DEBUG,"pim6_input: PIM packet too short\n"); @@ -1821,7 +1823,7 @@ pim6_input(struct mbuf **mp, int *offp, #else IP6_EXTHDR_GET(pim, struct pim *, m, off, minlen); if (pim == NULL) { - pim6stat.pim6s_rcv_tooshort++; + PIM6STAT_INC(pim6s_rcv_tooshort); return (IPPROTO_DONE); } #endif @@ -1841,7 +1843,7 @@ pim6_input(struct mbuf **mp, int *offp, cksumlen = pimlen; if (in6_cksum(m, IPPROTO_PIM, off, cksumlen)) { - ++pim6stat.pim6s_rcv_badsum; + PIM6STAT_INC(pim6s_rcv_badsum); #ifdef MRT6DEBUG if (V_mrt6debug & DEBUG_PIM) log(LOG_DEBUG, @@ -1855,7 +1857,7 @@ pim6_input(struct mbuf **mp, int *offp, /* PIM version check */ if (pim->pim_ver != PIM_VERSION) { - ++pim6stat.pim6s_rcv_badversion; + PIM6STAT_INC(pim6s_rcv_badversion); #ifdef MRT6DEBUG log(LOG_ERR, "pim6_input: incorrect version %d, expecting %d\n", @@ -1881,7 +1883,7 @@ pim6_input(struct mbuf **mp, int *offp, char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN]; #endif - ++pim6stat.pim6s_rcv_registers; + PIM6STAT_INC(pim6s_rcv_registers); if ((reg_mif_num >= nummifs) || (reg_mif_num == (mifi_t) -1)) { #ifdef MRT6DEBUG @@ -1903,8 +1905,8 @@ pim6_input(struct mbuf **mp, int *offp, * Validate length */ if (pimlen < PIM6_REG_MINLEN) { - ++pim6stat.pim6s_rcv_tooshort; - ++pim6stat.pim6s_rcv_badregisters; + PIM6STAT_INC(pim6s_rcv_tooshort); + PIM6STAT_INC(pim6s_rcv_badregisters); #ifdef MRT6DEBUG log(LOG_ERR, "pim6_input: register packet size too " @@ -1928,7 +1930,7 @@ pim6_input(struct mbuf **mp, int *offp, /* verify the version number of the inner packet */ if ((eip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) { - ++pim6stat.pim6s_rcv_badregisters; + PIM6STAT_INC(pim6s_rcv_badregisters); #ifdef MRT6DEBUG log(LOG_DEBUG, "pim6_input: invalid IP version (%d) " "of the inner packet\n", @@ -1940,7 +1942,7 @@ pim6_input(struct mbuf **mp, int *offp, /* verify the inner packet is destined to a mcast group */ if (!IN6_IS_ADDR_MULTICAST(&eip6->ip6_dst)) { - ++pim6stat.pim6s_rcv_badregisters; + PIM6STAT_INC(pim6s_rcv_badregisters); #ifdef MRT6DEBUG if (V_mrt6debug & DEBUG_PIM) log(LOG_DEBUG,