summaryrefslogtreecommitdiffstats
path: root/sys/netinet/udp_usrreq.c
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2009-04-12 11:42:40 +0000
committerrwatson <rwatson@FreeBSD.org>2009-04-12 11:42:40 +0000
commit5dc0256f1481f91aa761b11afb7454bdcbb19b7d (patch)
tree1c2af20a61d5cccd88db042b98dc9009fe9c5206 /sys/netinet/udp_usrreq.c
parentf4376efe43486d410755216aacd2459e2c05a8c3 (diff)
downloadFreeBSD-src-5dc0256f1481f91aa761b11afb7454bdcbb19b7d.zip
FreeBSD-src-5dc0256f1481f91aa761b11afb7454bdcbb19b7d.tar.gz
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
Diffstat (limited to 'sys/netinet/udp_usrreq.c')
-rw-r--r--sys/netinet/udp_usrreq.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 2b92e24..084b485 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -254,7 +254,7 @@ udp_append(struct inpcb *inp, struct ip *ip, 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);
}
@@ -276,7 +276,7 @@ udp_input(struct mbuf *m, int off)
#endif
ifp = m->m_pkthdr.rcvif;
- V_udpstat.udps_ipackets++;
+ UDPSTAT_INC(udps_ipackets);
/*
* Strip IP options, if any; should skip this, make available to
@@ -294,7 +294,7 @@ udp_input(struct mbuf *m, int off)
ip = mtod(m, struct ip *);
if (m->m_len < iphlen + sizeof(struct udphdr)) {
if ((m = m_pullup(m, iphlen + sizeof(struct udphdr))) == 0) {
- V_udpstat.udps_hdrops++;
+ UDPSTAT_INC(udps_hdrops);
return;
}
ip = mtod(m, struct ip *);
@@ -324,7 +324,7 @@ udp_input(struct mbuf *m, int off)
len = ntohs((u_short)uh->uh_ulen);
if (ip->ip_len != len) {
if (len > ip->ip_len || len < sizeof(struct udphdr)) {
- V_udpstat.udps_badlen++;
+ UDPSTAT_INC(udps_badlen);
goto badunlocked;
}
m_adj(m, len - ip->ip_len);
@@ -364,12 +364,12 @@ udp_input(struct mbuf *m, int off)
bcopy(b, ((struct ipovly *)ip)->ih_x1, 9);
}
if (uh_sum) {
- V_udpstat.udps_badsum++;
+ UDPSTAT_INC(udps_badsum);
m_freem(m);
return;
}
} else
- V_udpstat.udps_nosum++;
+ UDPSTAT_INC(udps_nosum);
#ifdef IPFIREWALL_FORWARD
/*
@@ -442,7 +442,7 @@ udp_input(struct mbuf *m, int off)
IPSTAT_INC(ips_notmember);
if (blocked == MCAST_NOTSMEMBER ||
blocked == MCAST_MUTED)
- V_udpstat.udps_filtermcast++;
+ UDPSTAT_INC(udps_filtermcast);
INP_RUNLOCK(inp);
continue;
}
@@ -494,7 +494,7 @@ udp_input(struct mbuf *m, int off)
* to send an ICMP Port Unreachable for a broadcast
* or multicast datgram.)
*/
- V_udpstat.udps_noportbcast++;
+ UDPSTAT_INC(udps_noportbcast);
goto badheadlocked;
}
if (last->inp_ppcb == NULL) {
@@ -531,9 +531,9 @@ udp_input(struct mbuf *m, int off)
buf, ntohs(uh->uh_dport), inet_ntoa(ip->ip_src),
ntohs(uh->uh_sport));
}
- V_udpstat.udps_noport++;
+ UDPSTAT_INC(udps_noport);
if (m->m_flags & (M_BCAST | M_MCAST)) {
- V_udpstat.udps_noportbcast++;
+ UDPSTAT_INC(udps_noportbcast);
goto badheadlocked;
}
if (V_udp_blackhole)
@@ -1072,7 +1072,7 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct sockaddr *addr,
((struct ip *)ui)->ip_len = sizeof (struct udpiphdr) + len;
((struct ip *)ui)->ip_ttl = inp->inp_ip_ttl; /* XXX */
((struct ip *)ui)->ip_tos = inp->inp_ip_tos; /* XXX */
- V_udpstat.udps_opackets++;
+ UDPSTAT_INC(udps_opackets);
if (unlock_udbinfo == 2)
INP_INFO_WUNLOCK(&V_udbinfo);
OpenPOWER on IntegriCloud