Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Apr 2009 11:53:12 +0000 (UTC)
From:      Robert Watson <rwatson@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r190963 - head/sys/netinet6
Message-ID:  <200904121153.n3CBrC5i024178@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rwatson
Date: Sun Apr 12 11:53:12 2009
New Revision: 190963
URL: http://svn.freebsd.org/changeset/base/190963

Log:
  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

Modified:
  head/sys/netinet6/udp6_usrreq.c

Modified: head/sys/netinet6/udp6_usrreq.c
==============================================================================
--- head/sys/netinet6/udp6_usrreq.c	Sun Apr 12 11:42:40 2009	(r190962)
+++ head/sys/netinet6/udp6_usrreq.c	Sun Apr 12 11:53:12 2009	(r190963)
@@ -166,7 +166,7 @@ udp6_append(struct inpcb *inp, struct mb
 		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, 
 		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, 
 	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, 
 	 * 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, 
 			 * 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, 
 			    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 mb
 
 		flags = 0;
 
-		V_udpstat.udps_opackets++;
+		UDPSTAT_INC(udps_opackets);
 		error = ip6_output(m, optp, NULL, flags, inp->in6p_moptions,
 		    NULL, inp);
 		break;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200904121153.n3CBrC5i024178>