svn commit: r190948 - in head/sys: contrib/pf/net dev/cxgb/ulp/tom
netinet
Robert Watson
rwatson at FreeBSD.org
Sat Apr 11 22:07:21 UTC 2009
Author: rwatson
Date: Sat Apr 11 22:07:19 2009
New Revision: 190948
URL: http://svn.freebsd.org/changeset/base/190948
Log:
Update stats in struct tcpstat using two new macros, TCPSTAT_ADD() and
TCPSTAT_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/contrib/pf/net/pf.c
head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c
head/sys/netinet/tcp_hostcache.c
head/sys/netinet/tcp_input.c
head/sys/netinet/tcp_output.c
head/sys/netinet/tcp_reass.c
head/sys/netinet/tcp_sack.c
head/sys/netinet/tcp_subr.c
head/sys/netinet/tcp_syncache.c
head/sys/netinet/tcp_timer.c
head/sys/netinet/tcp_timewait.c
head/sys/netinet/tcp_usrreq.c
head/sys/netinet/tcp_var.h
Modified: head/sys/contrib/pf/net/pf.c
==============================================================================
--- head/sys/contrib/pf/net/pf.c Sat Apr 11 22:01:40 2009 (r190947)
+++ head/sys/contrib/pf/net/pf.c Sat Apr 11 22:07:19 2009 (r190948)
@@ -6291,7 +6291,7 @@ pf_route(struct mbuf **m, struct pf_rule
}
/* Update relevant hardware checksum stats for TCP/UDP */
if (m0->m_pkthdr.csum_flags & M_TCPV4_CSUM_OUT)
- V_tcpstat.tcps_outhwcsum++;
+ TCPSTAT_INC(tcpstat.tcps_outhwcsum);
else if (m0->m_pkthdr.csum_flags & M_UDPV4_CSUM_OUT)
V_udpstat.udps_outhwcsum++;
error = (*ifp->if_output)(ifp, m0, sintosa(dst), NULL);
@@ -6635,7 +6635,7 @@ pf_check_proto_cksum(struct mbuf *m, int
case IPPROTO_TCP:
{
INIT_VNET_INET(curvnet);
- V_tcpstat.tcps_rcvbadsum++;
+ TCPSTAT_INC(tcps_rcvbadsum);
break;
}
case IPPROTO_UDP:
@@ -6741,7 +6741,7 @@ pf_check_proto_cksum(struct mbuf *m, int
m->m_pkthdr.csum_flags |= flag_bad;
switch (p) {
case IPPROTO_TCP:
- V_tcpstat.tcps_rcvbadsum++;
+ TCPSTAT_INC(tcps_rcvbadsum);
break;
case IPPROTO_UDP:
V_udpstat.udps_badsum++;
Modified: head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c
==============================================================================
--- head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c Sat Apr 11 22:01:40 2009 (r190947)
+++ head/sys/dev/cxgb/ulp/tom/cxgb_cpl_io.c Sat Apr 11 22:07:19 2009 (r190948)
@@ -3829,7 +3829,7 @@ socket_act_establish(struct socket *so,
#endif
toep->tp_state = tp->t_state;
- V_tcpstat.tcps_connects++;
+ TCPSTAT_INC(tcps_connects);
}
Modified: head/sys/netinet/tcp_hostcache.c
==============================================================================
--- head/sys/netinet/tcp_hostcache.c Sat Apr 11 22:01:40 2009 (r190947)
+++ head/sys/netinet/tcp_hostcache.c Sat Apr 11 22:07:19 2009 (r190948)
@@ -341,7 +341,7 @@ tcp_hc_insert(struct in_conninfo *inc)
TAILQ_REMOVE(&hc_head->hch_bucket, hc_entry, rmx_q);
V_tcp_hostcache.hashbase[hash].hch_length--;
V_tcp_hostcache.cache_count--;
- V_tcpstat.tcps_hc_bucketoverflow++;
+ TCPSTAT_INC(tcps_hc_bucketoverflow);
#if 0
uma_zfree(V_tcp_hostcache.zone, hc_entry);
#endif
@@ -373,7 +373,7 @@ tcp_hc_insert(struct in_conninfo *inc)
TAILQ_INSERT_HEAD(&hc_head->hch_bucket, hc_entry, rmx_q);
V_tcp_hostcache.hashbase[hash].hch_length++;
V_tcp_hostcache.cache_count++;
- V_tcpstat.tcps_hc_added++;
+ TCPSTAT_INC(tcps_hc_added);
return hc_entry;
}
@@ -508,7 +508,7 @@ tcp_hc_update(struct in_conninfo *inc, s
else
hc_entry->rmx_rtt =
(hc_entry->rmx_rtt + hcml->rmx_rtt) / 2;
- V_tcpstat.tcps_cachedrtt++;
+ TCPSTAT_INC(tcps_cachedrtt);
}
if (hcml->rmx_rttvar != 0) {
if (hc_entry->rmx_rttvar == 0)
@@ -516,7 +516,7 @@ tcp_hc_update(struct in_conninfo *inc, s
else
hc_entry->rmx_rttvar =
(hc_entry->rmx_rttvar + hcml->rmx_rttvar) / 2;
- V_tcpstat.tcps_cachedrttvar++;
+ TCPSTAT_INC(tcps_cachedrttvar);
}
if (hcml->rmx_ssthresh != 0) {
if (hc_entry->rmx_ssthresh == 0)
@@ -524,7 +524,7 @@ tcp_hc_update(struct in_conninfo *inc, s
else
hc_entry->rmx_ssthresh =
(hc_entry->rmx_ssthresh + hcml->rmx_ssthresh) / 2;
- V_tcpstat.tcps_cachedssthresh++;
+ TCPSTAT_INC(tcps_cachedssthresh);
}
if (hcml->rmx_bandwidth != 0) {
if (hc_entry->rmx_bandwidth == 0)
@@ -532,7 +532,7 @@ tcp_hc_update(struct in_conninfo *inc, s
else
hc_entry->rmx_bandwidth =
(hc_entry->rmx_bandwidth + hcml->rmx_bandwidth) / 2;
- /* V_tcpstat.tcps_cachedbandwidth++; */
+ /* TCPSTAT_INC(tcps_cachedbandwidth); */
}
if (hcml->rmx_cwnd != 0) {
if (hc_entry->rmx_cwnd == 0)
@@ -540,7 +540,7 @@ tcp_hc_update(struct in_conninfo *inc, s
else
hc_entry->rmx_cwnd =
(hc_entry->rmx_cwnd + hcml->rmx_cwnd) / 2;
- /* V_tcpstat.tcps_cachedcwnd++; */
+ /* TCPSTAT_INC(tcps_cachedcwnd); */
}
if (hcml->rmx_sendpipe != 0) {
if (hc_entry->rmx_sendpipe == 0)
@@ -548,7 +548,7 @@ tcp_hc_update(struct in_conninfo *inc, s
else
hc_entry->rmx_sendpipe =
(hc_entry->rmx_sendpipe + hcml->rmx_sendpipe) /2;
- /* V_tcpstat.tcps_cachedsendpipe++; */
+ /* TCPSTAT_INC(tcps_cachedsendpipe); */
}
if (hcml->rmx_recvpipe != 0) {
if (hc_entry->rmx_recvpipe == 0)
@@ -556,7 +556,7 @@ tcp_hc_update(struct in_conninfo *inc, s
else
hc_entry->rmx_recvpipe =
(hc_entry->rmx_recvpipe + hcml->rmx_recvpipe) /2;
- /* V_tcpstat.tcps_cachedrecvpipe++; */
+ /* TCPSTAT_INC(tcps_cachedrecvpipe); */
}
TAILQ_REMOVE(&hc_entry->rmx_head->hch_bucket, hc_entry, rmx_q);
Modified: head/sys/netinet/tcp_input.c
==============================================================================
--- head/sys/netinet/tcp_input.c Sat Apr 11 22:01:40 2009 (r190947)
+++ head/sys/netinet/tcp_input.c Sat Apr 11 22:07:19 2009 (r190948)
@@ -352,7 +352,7 @@ tcp_input(struct mbuf *m, int off0)
#endif
to.to_flags = 0;
- V_tcpstat.tcps_rcvtotal++;
+ TCPSTAT_INC(tcps_rcvtotal);
if (isipv6) {
#ifdef INET6
@@ -360,7 +360,7 @@ tcp_input(struct mbuf *m, int off0)
ip6 = mtod(m, struct ip6_hdr *);
tlen = sizeof(*ip6) + ntohs(ip6->ip6_plen) - off0;
if (in6_cksum(m, IPPROTO_TCP, off0, tlen)) {
- V_tcpstat.tcps_rcvbadsum++;
+ TCPSTAT_INC(tcps_rcvbadsum);
goto drop;
}
th = (struct tcphdr *)((caddr_t)ip6 + off0);
@@ -392,7 +392,7 @@ tcp_input(struct mbuf *m, int off0)
if (m->m_len < sizeof (struct tcpiphdr)) {
if ((m = m_pullup(m, sizeof (struct tcpiphdr)))
== NULL) {
- V_tcpstat.tcps_rcvshort++;
+ TCPSTAT_INC(tcps_rcvshort);
return;
}
}
@@ -426,7 +426,7 @@ tcp_input(struct mbuf *m, int off0)
th->th_sum = in_cksum(m, len);
}
if (th->th_sum) {
- V_tcpstat.tcps_rcvbadsum++;
+ TCPSTAT_INC(tcps_rcvbadsum);
goto drop;
}
/* Re-initialization for later version check */
@@ -446,7 +446,7 @@ tcp_input(struct mbuf *m, int off0)
*/
off = th->th_off << 2;
if (off < sizeof (struct tcphdr) || off > tlen) {
- V_tcpstat.tcps_rcvbadoff++;
+ TCPSTAT_INC(tcps_rcvbadoff);
goto drop;
}
tlen -= off; /* tlen is used instead of ti->ti_len */
@@ -461,7 +461,7 @@ tcp_input(struct mbuf *m, int off0)
if (m->m_len < sizeof(struct ip) + off) {
if ((m = m_pullup(m, sizeof (struct ip) + off))
== NULL) {
- V_tcpstat.tcps_rcvshort++;
+ TCPSTAT_INC(tcps_rcvshort);
return;
}
ip = mtod(m, struct ip *);
@@ -860,7 +860,7 @@ findpcb:
log(LOG_DEBUG, "%s; %s: Listen socket: "
"SYN is missing, segment ignored\n",
s, __func__);
- V_tcpstat.tcps_badsyn++;
+ TCPSTAT_INC(tcps_badsyn);
goto dropunlock;
}
/*
@@ -872,7 +872,7 @@ findpcb:
"SYN|ACK invalid, segment rejected\n",
s, __func__);
syncache_badack(&inc); /* XXX: Not needed! */
- V_tcpstat.tcps_badsyn++;
+ TCPSTAT_INC(tcps_badsyn);
rstreason = BANDLIM_RST_OPENPORT;
goto dropwithreset;
}
@@ -892,7 +892,7 @@ findpcb:
log(LOG_DEBUG, "%s; %s: Listen socket: "
"SYN|FIN segment ignored (based on "
"sysctl setting)\n", s, __func__);
- V_tcpstat.tcps_badsyn++;
+ TCPSTAT_INC(tcps_badsyn);
goto dropunlock;
}
/*
@@ -1155,13 +1155,13 @@ tcp_do_segment(struct mbuf *m, struct tc
switch (iptos & IPTOS_ECN_MASK) {
case IPTOS_ECN_CE:
tp->t_flags |= TF_ECN_SND_ECE;
- V_tcpstat.tcps_ecn_ce++;
+ TCPSTAT_INC(tcps_ecn_ce);
break;
case IPTOS_ECN_ECT0:
- V_tcpstat.tcps_ecn_ect0++;
+ TCPSTAT_INC(tcps_ecn_ect0);
break;
case IPTOS_ECN_ECT1:
- V_tcpstat.tcps_ecn_ect1++;
+ TCPSTAT_INC(tcps_ecn_ect1);
break;
}
@@ -1174,7 +1174,7 @@ tcp_do_segment(struct mbuf *m, struct tc
*/
if ((thflags & TH_ECE) &&
SEQ_LEQ(th->th_ack, tp->snd_recover)) {
- V_tcpstat.tcps_ecn_rcwnd++;
+ TCPSTAT_INC(tcps_ecn_rcwnd);
tcp_congestion_exp(tp);
}
}
@@ -1291,14 +1291,14 @@ tcp_do_segment(struct mbuf *m, struct tc
__func__, ti_locked);
ti_locked = TI_UNLOCKED;
- ++V_tcpstat.tcps_predack;
+ TCPSTAT_INC(tcps_predack);
/*
* "bad retransmit" recovery.
*/
if (tp->t_rxtshift == 1 &&
ticks < tp->t_badrxtwin) {
- ++V_tcpstat.tcps_sndrexmitbad;
+ TCPSTAT_INC(tcps_sndrexmitbad);
tp->snd_cwnd = tp->snd_cwnd_prev;
tp->snd_ssthresh =
tp->snd_ssthresh_prev;
@@ -1334,8 +1334,8 @@ tcp_do_segment(struct mbuf *m, struct tc
}
tcp_xmit_bandwidth_limit(tp, th->th_ack);
acked = th->th_ack - tp->snd_una;
- V_tcpstat.tcps_rcvackpack++;
- V_tcpstat.tcps_rcvackbyte += acked;
+ TCPSTAT_INC(tcps_rcvackpack);
+ TCPSTAT_ADD(tcps_rcvackbyte, acked);
sbdrop(&so->so_snd, acked);
if (SEQ_GT(tp->snd_una, tp->snd_recover) &&
SEQ_LEQ(th->th_ack, tp->snd_recover))
@@ -1396,7 +1396,7 @@ tcp_do_segment(struct mbuf *m, struct tc
/* Clean receiver SACK report if present */
if ((tp->t_flags & TF_SACK_PERMIT) && tp->rcv_numsacks)
tcp_clean_sackreport(tp);
- ++V_tcpstat.tcps_preddat;
+ TCPSTAT_INC(tcps_preddat);
tp->rcv_nxt += tlen;
/*
* Pull snd_wl1 up to prevent seq wrap relative to
@@ -1408,8 +1408,8 @@ tcp_do_segment(struct mbuf *m, struct tc
* rcv_nxt.
*/
tp->rcv_up = tp->rcv_nxt;
- V_tcpstat.tcps_rcvpack++;
- V_tcpstat.tcps_rcvbyte += tlen;
+ TCPSTAT_INC(tcps_rcvpack);
+ TCPSTAT_ADD(tcps_rcvbyte, tlen);
ND6_HINT(tp); /* Some progress has been made */
#ifdef TCPDEBUG
if (so->so_options & SO_DEBUG)
@@ -1559,7 +1559,7 @@ tcp_do_segment(struct mbuf *m, struct tc
tp->irs = th->th_seq;
tcp_rcvseqinit(tp);
if (thflags & TH_ACK) {
- V_tcpstat.tcps_connects++;
+ TCPSTAT_INC(tcps_connects);
soisconnected(so);
#ifdef MAC
SOCK_LOCK(so);
@@ -1585,7 +1585,7 @@ tcp_do_segment(struct mbuf *m, struct tc
if ((thflags & TH_ECE) && V_tcp_do_ecn) {
tp->t_flags |= TF_ECN_PERMIT;
- V_tcpstat.tcps_ecn_shs++;
+ TCPSTAT_INC(tcps_ecn_shs);
}
/*
@@ -1635,8 +1635,8 @@ tcp_do_segment(struct mbuf *m, struct tc
m_adj(m, -todrop);
tlen = tp->rcv_wnd;
thflags &= ~TH_FIN;
- V_tcpstat.tcps_rcvpackafterwin++;
- V_tcpstat.tcps_rcvbyteafterwin += todrop;
+ TCPSTAT_INC(tcps_rcvpackafterwin);
+ TCPSTAT_ADD(tcps_rcvbyteafterwin, todrop);
}
tp->snd_wl1 = th->th_seq - 1;
tp->rcv_up = th->th_seq;
@@ -1740,7 +1740,7 @@ tcp_do_segment(struct mbuf *m, struct tc
SEQ_LEQ(th->th_seq, tp->rcv_nxt + 1)) &&
!(SEQ_GEQ(th->th_seq, tp->last_ack_sent - 1) &&
SEQ_LEQ(th->th_seq, tp->last_ack_sent + 1))) {
- V_tcpstat.tcps_badrst++;
+ TCPSTAT_INC(tcps_badrst);
goto drop;
}
/* FALLTHROUGH */
@@ -1755,7 +1755,7 @@ tcp_do_segment(struct mbuf *m, struct tc
INP_INFO_WLOCK_ASSERT(&V_tcbinfo);
tp->t_state = TCPS_CLOSED;
- V_tcpstat.tcps_drops++;
+ TCPSTAT_INC(tcps_drops);
tp = tcp_close(tp);
break;
@@ -1795,9 +1795,9 @@ tcp_do_segment(struct mbuf *m, struct tc
*/
tp->ts_recent = 0;
} else {
- V_tcpstat.tcps_rcvduppack++;
- V_tcpstat.tcps_rcvdupbyte += tlen;
- V_tcpstat.tcps_pawsdrop++;
+ TCPSTAT_INC(tcps_rcvduppack);
+ TCPSTAT_ADD(tcps_rcvdupbyte, tlen);
+ TCPSTAT_INC(tcps_pawsdrop);
if (tlen)
goto dropafterack;
goto drop;
@@ -1845,11 +1845,11 @@ tcp_do_segment(struct mbuf *m, struct tc
*/
tp->t_flags |= TF_ACKNOW;
todrop = tlen;
- V_tcpstat.tcps_rcvduppack++;
- V_tcpstat.tcps_rcvdupbyte += todrop;
+ TCPSTAT_INC(tcps_rcvduppack);
+ TCPSTAT_ADD(tcps_rcvdupbyte, todrop);
} else {
- V_tcpstat.tcps_rcvpartduppack++;
- V_tcpstat.tcps_rcvpartdupbyte += todrop;
+ TCPSTAT_INC(tcps_rcvpartduppack);
+ TCPSTAT_ADD(tcps_rcvpartdupbyte, todrop);
}
drop_hdrlen += todrop; /* drop from the top afterwards */
th->th_seq += todrop;
@@ -1881,7 +1881,7 @@ tcp_do_segment(struct mbuf *m, struct tc
free(s, M_TCPLOG);
}
tp = tcp_close(tp);
- V_tcpstat.tcps_rcvafterclose++;
+ TCPSTAT_INC(tcps_rcvafterclose);
rstreason = BANDLIM_UNLIMITED;
goto dropwithreset;
}
@@ -1892,9 +1892,9 @@ tcp_do_segment(struct mbuf *m, struct tc
*/
todrop = (th->th_seq + tlen) - (tp->rcv_nxt + tp->rcv_wnd);
if (todrop > 0) {
- V_tcpstat.tcps_rcvpackafterwin++;
+ TCPSTAT_INC(tcps_rcvpackafterwin);
if (todrop >= tlen) {
- V_tcpstat.tcps_rcvbyteafterwin += tlen;
+ TCPSTAT_ADD(tcps_rcvbyteafterwin, tlen);
/*
* If window is closed can only take segments at
* window edge, and have to drop data and PUSH from
@@ -1904,11 +1904,11 @@ tcp_do_segment(struct mbuf *m, struct tc
*/
if (tp->rcv_wnd == 0 && th->th_seq == tp->rcv_nxt) {
tp->t_flags |= TF_ACKNOW;
- V_tcpstat.tcps_rcvwinprobe++;
+ TCPSTAT_INC(tcps_rcvwinprobe);
} else
goto dropafterack;
} else
- V_tcpstat.tcps_rcvbyteafterwin += todrop;
+ TCPSTAT_ADD(tcps_rcvbyteafterwin, todrop);
m_adj(m, -todrop);
tlen -= todrop;
thflags &= ~(TH_PUSH|TH_FIN);
@@ -1981,7 +1981,7 @@ tcp_do_segment(struct mbuf *m, struct tc
*/
case TCPS_SYN_RECEIVED:
- V_tcpstat.tcps_connects++;
+ TCPSTAT_INC(tcps_connects);
soisconnected(so);
/* Do window scaling? */
if ((tp->t_flags & (TF_RCVD_SCALE|TF_REQ_SCALE)) ==
@@ -2027,7 +2027,7 @@ tcp_do_segment(struct mbuf *m, struct tc
case TCPS_CLOSING:
case TCPS_LAST_ACK:
if (SEQ_GT(th->th_ack, tp->snd_max)) {
- V_tcpstat.tcps_rcvacktoomuch++;
+ TCPSTAT_INC(tcps_rcvacktoomuch);
goto dropafterack;
}
if ((tp->t_flags & TF_SACK_PERMIT) &&
@@ -2036,7 +2036,7 @@ tcp_do_segment(struct mbuf *m, struct tc
tcp_sack_doack(tp, &to, th->th_ack);
if (SEQ_LEQ(th->th_ack, tp->snd_una)) {
if (tlen == 0 && tiwin == tp->snd_wnd) {
- V_tcpstat.tcps_rcvdupack++;
+ TCPSTAT_INC(tcps_rcvdupack);
/*
* If we have outstanding data (other than
* a window probe), this is a completely
@@ -2119,7 +2119,8 @@ tcp_do_segment(struct mbuf *m, struct tc
tcp_timer_activate(tp, TT_REXMT, 0);
tp->t_rtttime = 0;
if (tp->t_flags & TF_SACK_PERMIT) {
- V_tcpstat.tcps_sack_recovery_episode++;
+ TCPSTAT_INC(
+ tcps_sack_recovery_episode);
tp->sack_newdata = tp->snd_nxt;
tp->snd_cwnd = tp->t_maxseg;
(void) tcp_output(tp);
@@ -2241,8 +2242,8 @@ process_ACK:
INP_WLOCK_ASSERT(tp->t_inpcb);
acked = th->th_ack - tp->snd_una;
- V_tcpstat.tcps_rcvackpack++;
- V_tcpstat.tcps_rcvackbyte += acked;
+ TCPSTAT_INC(tcps_rcvackpack);
+ TCPSTAT_ADD(tcps_rcvackbyte, acked);
/*
* If we just performed our first retransmit, and the ACK
@@ -2252,7 +2253,7 @@ process_ACK:
* we left off.
*/
if (tp->t_rxtshift == 1 && ticks < tp->t_badrxtwin) {
- ++V_tcpstat.tcps_sndrexmitbad;
+ TCPSTAT_INC(tcps_sndrexmitbad);
tp->snd_cwnd = tp->snd_cwnd_prev;
tp->snd_ssthresh = tp->snd_ssthresh_prev;
tp->snd_recover = tp->snd_recover_prev;
@@ -2476,7 +2477,7 @@ step6:
/* keep track of pure window updates */
if (tlen == 0 &&
tp->snd_wl2 == th->th_ack && tiwin > tp->snd_wnd)
- V_tcpstat.tcps_rcvwinupd++;
+ TCPSTAT_INC(tcps_rcvwinupd);
tp->snd_wnd = tiwin;
tp->snd_wl1 = th->th_seq;
tp->snd_wl2 = th->th_ack;
@@ -2586,8 +2587,8 @@ dodata: /* XXX */
tp->t_flags |= TF_ACKNOW;
tp->rcv_nxt += tlen;
thflags = th->th_flags & TH_FIN;
- V_tcpstat.tcps_rcvpack++;
- V_tcpstat.tcps_rcvbyte += tlen;
+ TCPSTAT_INC(tcps_rcvpack);
+ TCPSTAT_ADD(tcps_rcvbyte, tlen);
ND6_HINT(tp);
SOCKBUF_LOCK(&so->so_rcv);
if (so->so_rcv.sb_state & SBS_CANTRCVMORE)
@@ -2940,7 +2941,7 @@ tcp_dooptions(struct tcpopt *to, u_char
to->to_flags |= TOF_SACK;
to->to_nsacks = (optlen - 2) / TCPOLEN_SACK;
to->to_sacks = cp + 2;
- V_tcpstat.tcps_sack_rcv_blocks++;
+ TCPSTAT_INC(tcps_sack_rcv_blocks);
break;
default:
continue;
@@ -2995,7 +2996,7 @@ tcp_xmit_timer(struct tcpcb *tp, int rtt
INP_WLOCK_ASSERT(tp->t_inpcb);
- V_tcpstat.tcps_rttupdated++;
+ TCPSTAT_INC(tcps_rttupdated);
tp->t_rttupdated++;
if (tp->t_srtt != 0) {
/*
@@ -3317,10 +3318,10 @@ tcp_mss(struct tcpcb *tp, int offer)
if (tp->t_srtt == 0 && (rtt = metrics.rmx_rtt)) {
tp->t_srtt = rtt;
tp->t_rttbest = tp->t_srtt + TCP_RTT_SCALE;
- V_tcpstat.tcps_usedrtt++;
+ TCPSTAT_INC(tcps_usedrtt);
if (metrics.rmx_rttvar) {
tp->t_rttvar = metrics.rmx_rttvar;
- V_tcpstat.tcps_usedrttvar++;
+ TCPSTAT_INC(tcps_usedrttvar);
} else {
/* default variation is +- 1 rtt */
tp->t_rttvar =
@@ -3338,7 +3339,7 @@ tcp_mss(struct tcpcb *tp, int offer)
* threshold to no less than 2*mss.
*/
tp->snd_ssthresh = max(2 * mss, metrics.rmx_ssthresh);
- V_tcpstat.tcps_usedssthresh++;
+ TCPSTAT_INC(tcps_usedssthresh);
}
if (metrics.rmx_bandwidth)
tp->snd_bandwidth = metrics.rmx_bandwidth;
Modified: head/sys/netinet/tcp_output.c
==============================================================================
--- head/sys/netinet/tcp_output.c Sat Apr 11 22:01:40 2009 (r190947)
+++ head/sys/netinet/tcp_output.c Sat Apr 11 22:07:19 2009 (r190948)
@@ -264,9 +264,9 @@ again:
if (len > 0) {
sack_rxmit = 1;
sendalot = 1;
- V_tcpstat.tcps_sack_rexmits++;
- V_tcpstat.tcps_sack_rexmit_bytes +=
- min(len, tp->t_maxseg);
+ TCPSTAT_INC(tcps_sack_rexmits);
+ TCPSTAT_ADD(tcps_sack_rexmit_bytes,
+ min(len, tp->t_maxseg));
}
}
after_sack_rexmit:
@@ -768,13 +768,13 @@ send:
u_int moff;
if ((tp->t_flags & TF_FORCEDATA) && len == 1)
- V_tcpstat.tcps_sndprobe++;
+ TCPSTAT_INC(tcps_sndprobe);
else if (SEQ_LT(tp->snd_nxt, tp->snd_max) || sack_rxmit) {
- V_tcpstat.tcps_sndrexmitpack++;
- V_tcpstat.tcps_sndrexmitbyte += len;
+ TCPSTAT_INC(tcps_sndrexmitpack);
+ TCPSTAT_ADD(tcps_sndrexmitbyte, len);
} else {
- V_tcpstat.tcps_sndpack++;
- V_tcpstat.tcps_sndbyte += len;
+ TCPSTAT_INC(tcps_sndpack);
+ TCPSTAT_ADD(tcps_sndbyte, len);
}
#ifdef notyet
if ((m = m_copypack(so->so_snd.sb_mb, off,
@@ -841,13 +841,13 @@ send:
} else {
SOCKBUF_UNLOCK(&so->so_snd);
if (tp->t_flags & TF_ACKNOW)
- V_tcpstat.tcps_sndacks++;
+ TCPSTAT_INC(tcps_sndacks);
else if (flags & (TH_SYN|TH_FIN|TH_RST))
- V_tcpstat.tcps_sndctrl++;
+ TCPSTAT_INC(tcps_sndctrl);
else if (SEQ_GT(tp->snd_up, tp->snd_una))
- V_tcpstat.tcps_sndurg++;
+ TCPSTAT_INC(tcps_sndurg);
else
- V_tcpstat.tcps_sndwinup++;
+ TCPSTAT_INC(tcps_sndwinup);
MGETHDR(m, M_DONTWAIT, MT_DATA);
if (m == NULL) {
@@ -919,7 +919,7 @@ send:
else
#endif
ip->ip_tos |= IPTOS_ECN_ECT0;
- V_tcpstat.tcps_ecn_ect0++;
+ TCPSTAT_INC(tcps_ecn_ect0);
}
/*
@@ -1085,7 +1085,7 @@ send:
if (tp->t_rtttime == 0) {
tp->t_rtttime = ticks;
tp->t_rtseq = startseq;
- V_tcpstat.tcps_segstimed++;
+ TCPSTAT_INC(tcps_segstimed);
}
}
@@ -1262,7 +1262,7 @@ out:
return (error);
}
}
- V_tcpstat.tcps_sndtotal++;
+ TCPSTAT_INC(tcps_sndtotal);
/*
* Data sent (as far as we can tell).
@@ -1437,7 +1437,7 @@ tcp_addoptions(struct tcpopt *to, u_char
optlen += TCPOLEN_SACK;
sack++;
}
- V_tcpstat.tcps_sack_send_blocks++;
+ TCPSTAT_INC(tcps_sack_send_blocks);
break;
}
default:
Modified: head/sys/netinet/tcp_reass.c
==============================================================================
--- head/sys/netinet/tcp_reass.c Sat Apr 11 22:01:40 2009 (r190947)
+++ head/sys/netinet/tcp_reass.c Sat Apr 11 22:07:19 2009 (r190948)
@@ -172,7 +172,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd
(V_tcp_reass_qsize + 1 >= V_tcp_reass_maxseg ||
tp->t_segqlen >= V_tcp_reass_maxqlen)) {
V_tcp_reass_overflows++;
- V_tcpstat.tcps_rcvmemdrop++;
+ TCPSTAT_INC(tcps_rcvmemdrop);
m_freem(m);
*tlenp = 0;
return (0);
@@ -184,7 +184,7 @@ tcp_reass(struct tcpcb *tp, struct tcphd
*/
te = uma_zalloc(V_tcp_reass_zone, M_NOWAIT);
if (te == NULL) {
- V_tcpstat.tcps_rcvmemdrop++;
+ TCPSTAT_INC(tcps_rcvmemdrop);
m_freem(m);
*tlenp = 0;
return (0);
@@ -212,8 +212,8 @@ tcp_reass(struct tcpcb *tp, struct tcphd
i = p->tqe_th->th_seq + p->tqe_len - th->th_seq;
if (i > 0) {
if (i >= *tlenp) {
- V_tcpstat.tcps_rcvduppack++;
- V_tcpstat.tcps_rcvdupbyte += *tlenp;
+ TCPSTAT_INC(tcps_rcvduppack);
+ TCPSTAT_ADD(tcps_rcvdupbyte, *tlenp);
m_freem(m);
uma_zfree(V_tcp_reass_zone, te);
tp->t_segqlen--;
@@ -231,8 +231,8 @@ tcp_reass(struct tcpcb *tp, struct tcphd
th->th_seq += i;
}
}
- V_tcpstat.tcps_rcvoopack++;
- V_tcpstat.tcps_rcvoobyte += *tlenp;
+ TCPSTAT_INC(tcps_rcvoopack);
+ TCPSTAT_ADD(tcps_rcvoobyte, *tlenp);
/*
* While we overlap succeeding segments trim them or,
Modified: head/sys/netinet/tcp_sack.c
==============================================================================
--- head/sys/netinet/tcp_sack.c Sat Apr 11 22:01:40 2009 (r190947)
+++ head/sys/netinet/tcp_sack.c Sat Apr 11 22:07:19 2009 (r190948)
@@ -260,7 +260,7 @@ tcp_sackhole_alloc(struct tcpcb *tp, tcp
if (tp->snd_numholes >= V_tcp_sack_maxholes ||
V_tcp_sack_globalholes >= V_tcp_sack_globalmaxholes) {
- V_tcpstat.tcps_sack_sboverflow++;
+ TCPSTAT_INC(tcps_sack_sboverflow);
return NULL;
}
Modified: head/sys/netinet/tcp_subr.c
==============================================================================
--- head/sys/netinet/tcp_subr.c Sat Apr 11 22:01:40 2009 (r190947)
+++ head/sys/netinet/tcp_subr.c Sat Apr 11 22:07:19 2009 (r190948)
@@ -764,9 +764,9 @@ tcp_drop(struct tcpcb *tp, int errno)
if (TCPS_HAVERCVDSYN(tp->t_state)) {
tp->t_state = TCPS_CLOSED;
(void) tcp_output_reset(tp);
- V_tcpstat.tcps_drops++;
+ TCPSTAT_INC(tcps_drops);
} else
- V_tcpstat.tcps_conndrops++;
+ TCPSTAT_INC(tcps_conndrops);
if (errno == ETIMEDOUT && tp->t_softerror)
errno = tp->t_softerror;
so->so_error = errno;
@@ -889,7 +889,7 @@ tcp_close(struct tcpcb *tp)
if (tp->t_state == TCPS_LISTEN)
tcp_offload_listen_close(tp);
in_pcbdrop(inp);
- V_tcpstat.tcps_closed++;
+ TCPSTAT_INC(tcps_closed);
KASSERT(inp->inp_socket != NULL, ("tcp_close: inp_socket NULL"));
so = inp->inp_socket;
soisdisconnected(so);
@@ -1638,7 +1638,7 @@ tcp_mtudisc(struct inpcb *inp, int errno
tp->t_maxseg = so->so_snd.sb_hiwat;
SOCKBUF_UNLOCK(&so->so_snd);
- V_tcpstat.tcps_mturesent++;
+ TCPSTAT_INC(tcps_mturesent);
tp->t_rtttime = 0;
tp->snd_nxt = tp->snd_una;
tcp_free_sackholes(tp);
Modified: head/sys/netinet/tcp_syncache.c
==============================================================================
--- head/sys/netinet/tcp_syncache.c Sat Apr 11 22:01:40 2009 (r190947)
+++ head/sys/netinet/tcp_syncache.c Sat Apr 11 22:07:19 2009 (r190948)
@@ -294,7 +294,7 @@ syncache_insert(struct syncache *sc, str
("sch->sch_length incorrect"));
sc2 = TAILQ_LAST(&sch->sch_bucket, sch_head);
syncache_drop(sc2, sch);
- V_tcpstat.tcps_sc_bucketoverflow++;
+ TCPSTAT_INC(tcps_sc_bucketoverflow);
}
/* Put it into the bucket. */
@@ -309,7 +309,7 @@ syncache_insert(struct syncache *sc, str
SCH_UNLOCK(sch);
V_tcp_syncache.cache_count++;
- V_tcpstat.tcps_sc_added++;
+ TCPSTAT_INC(tcps_sc_added);
}
/*
@@ -398,7 +398,7 @@ syncache_timer(void *xsch)
free(s, M_TCPLOG);
}
syncache_drop(sc, sch);
- V_tcpstat.tcps_sc_stale++;
+ TCPSTAT_INC(tcps_sc_stale);
continue;
}
if ((s = tcp_log_addrs(&sc->sc_inc, NULL, NULL, NULL))) {
@@ -409,7 +409,7 @@ syncache_timer(void *xsch)
}
(void) syncache_respond(sc);
- V_tcpstat.tcps_sc_retransmitted++;
+ TCPSTAT_INC(tcps_sc_retransmitted);
syncache_timeout(sc, sch, 0);
}
if (!TAILQ_EMPTY(&(sch)->sch_bucket))
@@ -489,7 +489,7 @@ syncache_chkrst(struct in_conninfo *inc,
if ((s = tcp_log_addrs(inc, th, NULL, NULL)))
log(LOG_DEBUG, "%s; %s: Spurious RST with ACK, SYN or "
"FIN flag set, segment ignored\n", s, __func__);
- V_tcpstat.tcps_badrst++;
+ TCPSTAT_INC(tcps_badrst);
goto done;
}
@@ -506,7 +506,7 @@ syncache_chkrst(struct in_conninfo *inc,
log(LOG_DEBUG, "%s; %s: Spurious RST without matching "
"syncache entry (possibly syncookie only), "
"segment ignored\n", s, __func__);
- V_tcpstat.tcps_badrst++;
+ TCPSTAT_INC(tcps_badrst);
goto done;
}
@@ -530,13 +530,13 @@ syncache_chkrst(struct in_conninfo *inc,
log(LOG_DEBUG, "%s; %s: Our SYN|ACK was rejected, "
"connection attempt aborted by remote endpoint\n",
s, __func__);
- V_tcpstat.tcps_sc_reset++;
+ TCPSTAT_INC(tcps_sc_reset);
} else {
if ((s = tcp_log_addrs(inc, th, NULL, NULL)))
log(LOG_DEBUG, "%s; %s: RST with invalid SEQ %u != "
"IRS %u (+WND %u), segment ignored\n",
s, __func__, th->th_seq, sc->sc_irs, sc->sc_wnd);
- V_tcpstat.tcps_badrst++;
+ TCPSTAT_INC(tcps_badrst);
}
done:
@@ -556,7 +556,7 @@ syncache_badack(struct in_conninfo *inc)
SCH_LOCK_ASSERT(sch);
if (sc != NULL) {
syncache_drop(sc, sch);
- V_tcpstat.tcps_sc_badack++;
+ TCPSTAT_INC(tcps_sc_badack);
}
SCH_UNLOCK(sch);
}
@@ -590,7 +590,7 @@ syncache_unreach(struct in_conninfo *inc
goto done;
}
syncache_drop(sc, sch);
- V_tcpstat.tcps_sc_unreach++;
+ TCPSTAT_INC(tcps_sc_unreach);
done:
SCH_UNLOCK(sch);
}
@@ -622,7 +622,7 @@ syncache_socket(struct syncache *sc, str
* have the peer retransmit its SYN again after its
* RTO and try again.
*/
- V_tcpstat.tcps_listendrop++;
+ TCPSTAT_INC(tcps_listendrop);
if ((s = tcp_log_addrs(&sc->sc_inc, NULL, NULL, NULL))) {
log(LOG_DEBUG, "%s; %s: Socket create failed "
"due to limits or memory shortage\n",
@@ -792,7 +792,7 @@ syncache_socket(struct syncache *sc, str
INP_WUNLOCK(inp);
- V_tcpstat.tcps_accepts++;
+ TCPSTAT_INC(tcps_accepts);
return (so);
abort:
@@ -912,9 +912,9 @@ syncache_expand(struct in_conninfo *inc,
*lsop = syncache_socket(sc, *lsop, m);
if (*lsop == NULL)
- V_tcpstat.tcps_sc_aborted++;
+ TCPSTAT_INC(tcps_sc_aborted);
else
- V_tcpstat.tcps_sc_completed++;
+ TCPSTAT_INC(tcps_sc_completed);
/* how do we find the inp for the new socket? */
if (sc != &scs)
@@ -1046,7 +1046,7 @@ _syncache_add(struct in_conninfo *inc, s
sc->sc_tu->tu_syncache_event(TOE_SC_ENTRY_PRESENT,
sc->sc_toepcb);
#endif
- V_tcpstat.tcps_sc_dupsyn++;
+ TCPSTAT_INC(tcps_sc_dupsyn);
if (ipopts) {
/*
* If we were remembering a previous source route,
@@ -1081,8 +1081,8 @@ _syncache_add(struct in_conninfo *inc, s
if (!TOEPCB_ISSET(sc) && syncache_respond(sc) == 0) {
sc->sc_rxmits = 0;
syncache_timeout(sc, sch, 1);
- V_tcpstat.tcps_sndacks++;
- V_tcpstat.tcps_sndtotal++;
+ TCPSTAT_INC(tcps_sndacks);
+ TCPSTAT_INC(tcps_sndtotal);
}
SCH_UNLOCK(sch);
goto done;
@@ -1095,7 +1095,7 @@ _syncache_add(struct in_conninfo *inc, s
* Treat this as if the cache was full; drop the oldest
* entry and insert the new one.
*/
- V_tcpstat.tcps_sc_zonefail++;
+ TCPSTAT_INC(tcps_sc_zonefail);
if ((sc = TAILQ_LAST(&sch->sch_bucket, sch_head)) != NULL)
syncache_drop(sc, sch);
sc = uma_zalloc(V_tcp_syncache.zone, M_NOWAIT | M_ZERO);
@@ -1233,12 +1233,12 @@ _syncache_add(struct in_conninfo *inc, s
syncache_free(sc);
else if (sc != &scs)
syncache_insert(sc, sch); /* locks and unlocks sch */
- V_tcpstat.tcps_sndacks++;
- V_tcpstat.tcps_sndtotal++;
+ TCPSTAT_INC(tcps_sndacks);
+ TCPSTAT_INC(tcps_sndtotal);
} else {
if (sc != &scs)
syncache_free(sc);
- V_tcpstat.tcps_sc_dropped++;
+ TCPSTAT_INC(tcps_sc_dropped);
}
done:
@@ -1351,7 +1351,7 @@ syncache_respond(struct syncache *sc)
if (sc->sc_flags & SCF_ECN) {
th->th_flags |= TH_ECE;
- V_tcpstat.tcps_ecn_shs++;
+ TCPSTAT_INC(tcps_ecn_shs);
}
/* Tack on the TCP options. */
@@ -1584,7 +1584,7 @@ syncookie_generate(struct syncache_head
sc->sc_tsoff = data - ticks; /* after XOR */
}
- V_tcpstat.tcps_sc_sendcookie++;
+ TCPSTAT_INC(tcps_sc_sendcookie);
}
static struct syncache *
@@ -1687,7 +1687,7 @@ syncookie_lookup(struct in_conninfo *inc
sc->sc_rxmits = 0;
sc->sc_peer_mss = tcp_sc_msstab[mss];
- V_tcpstat.tcps_sc_recvcookie++;
+ TCPSTAT_INC(tcps_sc_recvcookie);
return (sc);
}
Modified: head/sys/netinet/tcp_timer.c
==============================================================================
--- head/sys/netinet/tcp_timer.c Sat Apr 11 22:01:40 2009 (r190947)
+++ head/sys/netinet/tcp_timer.c Sat Apr 11 22:07:19 2009 (r190948)
@@ -191,7 +191,7 @@ tcp_timer_delack(void *xtp)
callout_deactivate(&tp->t_timers->tt_delack);
tp->t_flags |= TF_ACKNOW;
- V_tcpstat.tcps_delack++;
+ TCPSTAT_INC(tcps_delack);
(void) tcp_output(tp);
INP_WUNLOCK(inp);
CURVNET_RESTORE();
@@ -250,7 +250,7 @@ tcp_timer_2msl(void *xtp)
if (tcp_fast_finwait2_recycle && tp->t_state == TCPS_FIN_WAIT_2 &&
tp->t_inpcb && tp->t_inpcb->inp_socket &&
(tp->t_inpcb->inp_socket->so_rcv.sb_state & SBS_CANTRCVMORE)) {
- V_tcpstat.tcps_finwait2_drops++;
+ TCPSTAT_INC(tcps_finwait2_drops);
tp = tcp_close(tp);
} else {
if (tp->t_state != TCPS_TIME_WAIT &&
@@ -313,7 +313,7 @@ tcp_timer_keep(void *xtp)
* Keep-alive timer went off; send something
* or drop connection if idle for too long.
*/
- V_tcpstat.tcps_keeptimeo++;
+ TCPSTAT_INC(tcps_keeptimeo);
if (tp->t_state < TCPS_ESTABLISHED)
goto dropit;
if ((always_keepalive || inp->inp_socket->so_options & SO_KEEPALIVE) &&
@@ -332,7 +332,7 @@ tcp_timer_keep(void *xtp)
* by the protocol spec, this requires the
* correspondent TCP to respond.
*/
- V_tcpstat.tcps_keepprobe++;
+ TCPSTAT_INC(tcps_keepprobe);
t_template = tcpip_maketemplate(inp);
if (t_template) {
tcp_respond(tp, t_template->tt_ipgen,
@@ -355,7 +355,7 @@ tcp_timer_keep(void *xtp)
return;
dropit:
- V_tcpstat.tcps_keepdrops++;
+ TCPSTAT_INC(tcps_keepdrops);
tp = tcp_drop(tp, ETIMEDOUT);
#ifdef TCPDEBUG
@@ -409,7 +409,7 @@ tcp_timer_persist(void *xtp)
* Persistance timer into zero window.
* Force a byte to be output, if possible.
*/
- V_tcpstat.tcps_persisttimeo++;
+ TCPSTAT_INC(tcps_persisttimeo);
/*
* Hack: if the peer is dead/unreachable, we do not
* time out if the window is closed. After a full
@@ -420,7 +420,7 @@ tcp_timer_persist(void *xtp)
if (tp->t_rxtshift == TCP_MAXRXTSHIFT &&
((ticks - tp->t_rcvtime) >= tcp_maxpersistidle ||
(ticks - tp->t_rcvtime) >= TCP_REXMTVAL(tp) * tcp_totbackoff)) {
- V_tcpstat.tcps_persistdrop++;
+ TCPSTAT_INC(tcps_persistdrop);
tp = tcp_drop(tp, ETIMEDOUT);
goto out;
}
@@ -487,7 +487,7 @@ tcp_timer_rexmt(void * xtp)
*/
if (++tp->t_rxtshift > TCP_MAXRXTSHIFT) {
tp->t_rxtshift = TCP_MAXRXTSHIFT;
- V_tcpstat.tcps_timeoutdrop++;
+ TCPSTAT_INC(tcps_timeoutdrop);
tp = tcp_drop(tp, tp->t_softerror ?
tp->t_softerror : ETIMEDOUT);
goto out;
@@ -513,7 +513,7 @@ tcp_timer_rexmt(void * xtp)
tp->t_flags &= ~TF_WASFRECOVERY;
tp->t_badrxtwin = ticks + (tp->t_srtt >> (TCP_RTT_SHIFT + 1));
}
- V_tcpstat.tcps_rexmttimeo++;
+ TCPSTAT_INC(tcps_rexmttimeo);
if (tp->t_state == TCPS_SYN_SENT)
rexmt = TCP_REXMTVAL(tp) * tcp_syn_backoff[tp->t_rxtshift];
else
Modified: head/sys/netinet/tcp_timewait.c
==============================================================================
--- head/sys/netinet/tcp_timewait.c Sat Apr 11 22:01:40 2009 (r190947)
+++ head/sys/netinet/tcp_timewait.c Sat Apr 11 22:07:19 2009 (r190948)
@@ -472,7 +472,7 @@ tcp_twclose(struct tcptw *tw, int reuse)
}
} else
in_pcbfree(inp);
- V_tcpstat.tcps_closed++;
+ TCPSTAT_INC(tcps_closed);
crfree(tw->tw_cred);
tw->tw_cred = NULL;
if (reuse)
@@ -567,10 +567,10 @@ tcp_twrespond(struct tcptw *tw, int flag
NULL, inp);
}
if (flags & TH_ACK)
- V_tcpstat.tcps_sndacks++;
+ TCPSTAT_INC(tcps_sndacks);
else
- V_tcpstat.tcps_sndctrl++;
- V_tcpstat.tcps_sndtotal++;
+ TCPSTAT_INC(tcps_sndctrl);
+ TCPSTAT_INC(tcps_sndtotal);
return (error);
}
Modified: head/sys/netinet/tcp_usrreq.c
==============================================================================
--- head/sys/netinet/tcp_usrreq.c Sat Apr 11 22:01:40 2009 (r190947)
+++ head/sys/netinet/tcp_usrreq.c Sat Apr 11 22:07:19 2009 (r190948)
@@ -1113,7 +1113,7 @@ tcp_connect(struct tcpcb *tp, struct soc
tp->request_r_scale++;
soisconnecting(so);
- V_tcpstat.tcps_connattempt++;
+ TCPSTAT_INC(tcps_connattempt);
tp->t_state = TCPS_SYN_SENT;
tcp_timer_activate(tp, TT_KEEP, tcp_keepinit);
tp->iss = tcp_new_isn(tp);
@@ -1177,7 +1177,7 @@ tcp6_connect(struct tcpcb *tp, struct so
tp->request_r_scale++;
soisconnecting(so);
- V_tcpstat.tcps_connattempt++;
+ TCPSTAT_INC(tcps_connattempt);
tp->t_state = TCPS_SYN_SENT;
tcp_timer_activate(tp, TT_KEEP, tcp_keepinit);
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-all
mailing list