From 6958bbf168b98d4b8a70ef9cf01445b28ff778b0 Mon Sep 17 00:00:00 2001 From: rwatson Date: Sun, 12 Apr 2009 11:53:12 +0000 Subject: Commit file omitted in r190962: Update stats in struct udpstat using two new macros, UDPSTAT_ADD() and UDPSTAT_INC(), rather than directly manipulating the fields across the kernel. This will make it easier to change the implementation of these statistics, such as using per-CPU versions of the data structures. MFC after: 3 days --- sys/netinet6/udp6_usrreq.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'sys/netinet6/udp6_usrreq.c') diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c index 05d48f5..566cf92 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -166,7 +166,7 @@ udp6_append(struct inpcb *inp, struct mbuf *n, int off, m_freem(n); if (opts) m_freem(opts); - V_udpstat.udps_fullsock++; + UDPSTAT_INC(udps_fullsock); } else sorwakeup_locked(so); } @@ -202,7 +202,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto) return (IPPROTO_DONE); #endif - V_udpstat.udps_ipackets++; + UDPSTAT_INC(udps_ipackets); /* * Destination port of 0 is illegal, based on RFC768. @@ -214,7 +214,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto) ulen = ntohs((u_short)uh->uh_ulen); if (plen != ulen) { - V_udpstat.udps_badlen++; + UDPSTAT_INC(udps_badlen); goto badunlocked; } @@ -222,11 +222,11 @@ udp6_input(struct mbuf **mp, int *offp, int proto) * Checksum extended UDP header and data. */ if (uh->uh_sum == 0) { - V_udpstat.udps_nosum++; + UDPSTAT_INC(udps_nosum); goto badunlocked; } if (in6_cksum(m, IPPROTO_UDP, off, ulen) != 0) { - V_udpstat.udps_badsum++; + UDPSTAT_INC(udps_badsum); goto badunlocked; } @@ -327,8 +327,8 @@ udp6_input(struct mbuf **mp, int *offp, int proto) * to send an ICMP Port Unreachable for a broadcast * or multicast datgram.) */ - V_udpstat.udps_noport++; - V_udpstat.udps_noportmcast++; + UDPSTAT_INC(udps_noport); + UDPSTAT_INC(udps_noportmcast); goto badheadlocked; } INP_RLOCK(last); @@ -365,10 +365,10 @@ udp6_input(struct mbuf **mp, int *offp, int proto) ip6_sprintf(ip6bufs, &ip6->ip6_src), ntohs(uh->uh_sport)); } - V_udpstat.udps_noport++; + UDPSTAT_INC(udps_noport); if (m->m_flags & M_MCAST) { printf("UDP6: M_MCAST is set in a unicast packet.\n"); - V_udpstat.udps_noportmcast++; + UDPSTAT_INC(udps_noportmcast); goto badheadlocked; } INP_INFO_RUNLOCK(&V_udbinfo); @@ -719,7 +719,7 @@ udp6_output(struct inpcb *inp, struct mbuf *m, struct sockaddr *addr6, flags = 0; - V_udpstat.udps_opackets++; + UDPSTAT_INC(udps_opackets); error = ip6_output(m, optp, NULL, flags, inp->in6p_moptions, NULL, inp); break; -- cgit v1.1