summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorthorpej <thorpej@NetBSD.org>2008-04-08 01:03:58 +0000
committerthorpej <thorpej@NetBSD.org>2008-04-08 01:03:58 +0000
commitf5c68c0b9fc4ff7e896f0f6d757995c19351d8a7 (patch)
treeb2d38957962ebc8a6d489268c1105d29a7ebcbc7 /sys
parent27b03461ec930d8ba4c9885fa97fb79a0fa310fd (diff)
Change TCP stats from a structure to an array of uint64_t's.
Note: This is ABI-compatible with the old tcpstat structure; old netstat binaries will continue to work properly.
Diffstat (limited to 'sys')
-rw-r--r--sys/dist/pf/net/pf.c6
-rw-r--r--sys/netinet/tcp_input.c156
-rw-r--r--sys/netinet/tcp_output.c32
-rw-r--r--sys/netinet/tcp_subr.c16
-rw-r--r--sys/netinet/tcp_timer.c20
-rw-r--r--sys/netinet/tcp_usrreq.c8
-rw-r--r--sys/netinet/tcp_var.h173
7 files changed, 203 insertions, 208 deletions
diff --git a/sys/dist/pf/net/pf.c b/sys/dist/pf/net/pf.c
index 1da6880a2ec..dfd02ff06c9 100644
--- a/sys/dist/pf/net/pf.c
+++ b/sys/dist/pf/net/pf.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pf.c,v 1.47 2008/04/07 06:31:27 thorpej Exp $ */
+/* $NetBSD: pf.c,v 1.48 2008/04/08 01:03:58 thorpej Exp $ */
/* $OpenBSD: pf.c,v 1.487 2005/04/22 09:53:18 dhartmei Exp $ */
/*
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pf.c,v 1.47 2008/04/07 06:31:27 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pf.c,v 1.48 2008/04/08 01:03:58 thorpej Exp $");
#include "bpfilter.h"
#include "pflog.h"
@@ -5829,7 +5829,7 @@ pf_check_proto_cksum(struct mbuf *m, int off, int len, u_int8_t p,
#endif
switch (p) {
case IPPROTO_TCP:
- tcpstat.tcps_rcvbadsum++;
+ tcpstat[TCP_STAT_RCVBADSUM]++;
break;
case IPPROTO_UDP:
udpstat[UDP_STAT_BADSUM]++;
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 60d18bf3cb6..fe0c82f6d8f 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_input.c,v 1.282 2008/03/01 14:16:52 rmind Exp $ */
+/* $NetBSD: tcp_input.c,v 1.283 2008/04/08 01:03:58 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -152,7 +152,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.282 2008/03/01 14:16:52 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_input.c,v 1.283 2008/04/08 01:03:58 thorpej Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@@ -579,8 +579,8 @@ tcp_reass(struct tcpcb *tp, const struct tcphdr *th, struct mbuf *m, int *tlen)
*/
if (SEQ_LEQ(q->ipqe_seq, pkt_seq) &&
SEQ_GEQ(q->ipqe_seq + q->ipqe_len, pkt_seq + pkt_len)) {
- tcpstat.tcps_rcvduppack++;
- tcpstat.tcps_rcvdupbyte += pkt_len;
+ tcpstat[TCP_STAT_RCVDUPPACK]++;
+ tcpstat[TCP_STAT_RCVDUPBYTE] += pkt_len;
tcp_new_dsack(tp, pkt_seq, pkt_len);
m_freem(m);
if (tiqe != NULL) {
@@ -723,7 +723,7 @@ tcp_reass(struct tcpcb *tp, const struct tcphdr *th, struct mbuf *m, int *tlen)
if (tiqe == NULL) {
tiqe = tcpipqent_alloc();
if (tiqe == NULL) {
- tcpstat.tcps_rcvmemdrop++;
+ tcpstat[TCP_STAT_RCVMEMDROP]++;
m_freem(m);
return (0);
}
@@ -732,11 +732,11 @@ tcp_reass(struct tcpcb *tp, const struct tcphdr *th, struct mbuf *m, int *tlen)
/*
* Update the counters.
*/
- tcpstat.tcps_rcvoopack++;
- tcpstat.tcps_rcvoobyte += rcvoobyte;
+ tcpstat[TCP_STAT_RCVOOPACK]++;
+ tcpstat[TCP_STAT_RCVOOBYTE] += rcvoobyte;
if (rcvpartdupbyte) {
- tcpstat.tcps_rcvpartduppack++;
- tcpstat.tcps_rcvpartdupbyte += rcvpartdupbyte;
+ tcpstat[TCP_STAT_RCVPARTDUPPACK]++;
+ tcpstat[TCP_STAT_RCVPARTDUPBYTE] += rcvpartdupbyte;
}
/*
@@ -814,7 +814,7 @@ tcp6_input(struct mbuf **mp, int *offp, int proto)
struct ip6_hdr *ip6;
if (m->m_len < sizeof(struct ip6_hdr)) {
if ((m = m_pullup(m, sizeof(struct ip6_hdr))) == NULL) {
- tcpstat.tcps_rcvshort++;
+ tcpstat[TCP_STAT_RCVSHORT]++;
return IPPROTO_DONE;
}
}
@@ -974,7 +974,7 @@ tcp_input_checksum(int af, struct mbuf *m, const struct tcphdr *th,
return 0;
badcsum:
- tcpstat.tcps_rcvbadsum++;
+ tcpstat[TCP_STAT_RCVBADSUM]++;
return -1;
}
@@ -1016,7 +1016,7 @@ tcp_input(struct mbuf *m, ...)
(void)va_arg(ap, int); /* ignore value, advance ap */
va_end(ap);
- tcpstat.tcps_rcvtotal++;
+ tcpstat[TCP_STAT_RCVTOTAL]++;
bzero(&opti, sizeof(opti));
opti.ts_present = 0;
@@ -1059,7 +1059,7 @@ tcp_input(struct mbuf *m, ...)
IP6_EXTHDR_GET(th, struct tcphdr *, m, toff,
sizeof(struct tcphdr));
if (th == NULL) {
- tcpstat.tcps_rcvshort++;
+ tcpstat[TCP_STAT_RCVSHORT]++;
return;
}
/* We do the checksum after PCB lookup... */
@@ -1077,7 +1077,7 @@ tcp_input(struct mbuf *m, ...)
IP6_EXTHDR_GET(th, struct tcphdr *, m, toff,
sizeof(struct tcphdr));
if (th == NULL) {
- tcpstat.tcps_rcvshort++;
+ tcpstat[TCP_STAT_RCVSHORT]++;
return;
}
@@ -1129,7 +1129,7 @@ tcp_input(struct mbuf *m, ...)
*/
off = th->th_off << 2;
if (off < sizeof (struct tcphdr) || off > tlen) {
- tcpstat.tcps_rcvbadoff++;
+ tcpstat[TCP_STAT_RCVBADOFF]++;
goto drop;
}
tlen -= off;
@@ -1144,7 +1144,7 @@ tcp_input(struct mbuf *m, ...)
if (off > sizeof (struct tcphdr)) {
IP6_EXTHDR_GET(th, struct tcphdr *, m, toff, off);
if (th == NULL) {
- tcpstat.tcps_rcvshort++;
+ tcpstat[TCP_STAT_RCVSHORT]++;
return;
}
/*
@@ -1188,7 +1188,7 @@ findpcb:
inp = in_pcblookup_connect(&tcbtable, ip->ip_src, th->th_sport,
ip->ip_dst, th->th_dport);
if (inp == 0) {
- ++tcpstat.tcps_pcbhashmiss;
+ tcpstat[TCP_STAT_PCBHASHMISS]++;
inp = in_pcblookup_bind(&tcbtable, ip->ip_dst, th->th_dport);
}
#ifdef INET6
@@ -1205,7 +1205,7 @@ findpcb:
in6p = in6_pcblookup_connect(&tcbtable, &s,
th->th_sport, &d, th->th_dport, 0);
if (in6p == 0) {
- ++tcpstat.tcps_pcbhashmiss;
+ tcpstat[TCP_STAT_PCBHASHMISS]++;
in6p = in6_pcblookup_bind(&tcbtable, &d,
th->th_dport, 0);
}
@@ -1217,7 +1217,7 @@ findpcb:
if (inp == 0 && in6p == 0)
#endif
{
- ++tcpstat.tcps_noport;
+ tcpstat[TCP_STAT_NOPORT]++;
if (tcp_log_refused &&
(tiflags & (TH_RST|TH_ACK|TH_SYN)) == TH_SYN) {
tcp4_log_refused(ip, th);
@@ -1255,12 +1255,12 @@ findpcb:
in6p = in6_pcblookup_connect(&tcbtable, &ip6->ip6_src,
th->th_sport, &ip6->ip6_dst, th->th_dport, faith);
if (in6p == NULL) {
- ++tcpstat.tcps_pcbhashmiss;
+ tcpstat[TCP_STAT_PCBHASHMISS]++;
in6p = in6_pcblookup_bind(&tcbtable, &ip6->ip6_dst,
th->th_dport, faith);
}
if (in6p == NULL) {
- ++tcpstat.tcps_noport;
+ tcpstat[TCP_STAT_NOPORT]++;
if (tcp_log_refused &&
(tiflags & (TH_RST|TH_ACK|TH_SYN)) == TH_SYN) {
tcp6_log_refused(ip6, th);
@@ -1588,7 +1588,7 @@ findpcb:
i = 1;
}
if (i) {
- tcpstat.tcps_badsyn++;
+ tcpstat[TCP_STAT_BADSYN]++;
goto drop;
}
}
@@ -1643,10 +1643,10 @@ after_listen:
switch (iptos & IPTOS_ECN_MASK) {
case IPTOS_ECN_CE:
tp->t_flags |= TF_ECN_SND_ECE;
- tcpstat.tcps_ecn_ce++;
+ tcpstat[TCP_STAT_ECN_CE]++;
break;
case IPTOS_ECN_ECT0:
- tcpstat.tcps_ecn_ect++;
+ tcpstat[TCP_STAT_ECN_ECT]++;
break;
case IPTOS_ECN_ECT1:
/* XXX: ignore for now -- rpaulo */
@@ -1725,7 +1725,7 @@ after_listen:
/*
* this is a pure ack for outstanding data.
*/
- ++tcpstat.tcps_predack;
+ tcpstat[TCP_STAT_PREDACK]++;
if (ts_rtt)
tcp_xmit_timer(tp, ts_rtt);
else if (tp->t_rtttime &&
@@ -1733,8 +1733,8 @@ after_listen:
tcp_xmit_timer(tp,
tcp_now - tp->t_rtttime);
acked = th->th_ack - tp->snd_una;
- tcpstat.tcps_rcvackpack++;
- tcpstat.tcps_rcvackbyte += acked;
+ tcpstat[TCP_STAT_RCVACKPACK]++;
+ tcpstat[TCP_STAT_RCVACKBYTE] += acked;
nd6_hint(tp);
if (acked > (tp->t_lastoff - tp->t_inoff))
@@ -1783,10 +1783,10 @@ after_listen:
* with nothing on the reassembly queue and
* we have enough buffer space to take it.
*/
- ++tcpstat.tcps_preddat;
+ tcpstat[TCP_STAT_PREDDAT]++;
tp->rcv_nxt += tlen;
- tcpstat.tcps_rcvpack++;
- tcpstat.tcps_rcvbyte += tlen;
+ tcpstat[TCP_STAT_RCVPACK]++;
+ tcpstat[TCP_STAT_RCVBYTE] += tlen;
nd6_hint(tp);
/*
@@ -1929,7 +1929,7 @@ after_listen:
if ((tiflags & TH_ECE) && tcp_do_ecn) {
tp->t_flags |= TF_ECN_PERMIT;
- tcpstat.tcps_ecn_shs++;
+ tcpstat[TCP_STAT_ECN_SHS]++;
}
}
@@ -1960,7 +1960,7 @@ after_listen:
tcp_rmx_rtt(tp);
if (tiflags & TH_ACK) {
- tcpstat.tcps_connects++;
+ tcpstat[TCP_STAT_CONNECTS]++;
soisconnected(so);
tcp_established(tp);
/* Do window scaling on this connection? */
@@ -1992,8 +1992,8 @@ after_listen:
m_adj(m, -todrop);
tlen = tp->rcv_wnd;
tiflags &= ~TH_FIN;
- tcpstat.tcps_rcvpackafterwin++;
- tcpstat.tcps_rcvbyteafterwin += todrop;
+ tcpstat[TCP_STAT_RCVPACKAFTERWIN]++;
+ tcpstat[TCP_STAT_RCVBYTEAFTERWIN] += todrop;
}
tp->snd_wl1 = th->th_seq - 1;
tp->rcv_up = th->th_seq;
@@ -2040,9 +2040,9 @@ after_listen:
*/
tp->ts_recent = 0;
} else {
- tcpstat.tcps_rcvduppack++;
- tcpstat.tcps_rcvdupbyte += tlen;
- tcpstat.tcps_pawsdrop++;
+ tcpstat[TCP_STAT_RCVDUPPACK]++;
+ tcpstat[TCP_STAT_RCVDUPBYTE] += tlen;
+ tcpstat[TCP_STAT_PAWSDROP]++;
tcp_new_dsack(tp, th->th_seq, tlen);
goto dropafterack;
}
@@ -2079,8 +2079,8 @@ after_listen:
tp->t_flags |= TF_ACKNOW;
todrop = tlen;
dupseg = true;
- tcpstat.tcps_rcvdupbyte += todrop;
- tcpstat.tcps_rcvduppack++;
+ tcpstat[TCP_STAT_RCVDUPPACK]++;
+ tcpstat[TCP_STAT_RCVDUPBYTE] += todrop;
} else if ((tiflags & TH_RST) &&
th->th_seq != tp->last_ack_sent) {
/*
@@ -2089,8 +2089,8 @@ after_listen:
*/
goto dropafterack_ratelim;
} else {
- tcpstat.tcps_rcvpartduppack++;
- tcpstat.tcps_rcvpartdupbyte += todrop;
+ tcpstat[TCP_STAT_RCVPARTDUPPACK]++;
+ tcpstat[TCP_STAT_RCVPARTDUPBYTE] += todrop;
}
tcp_new_dsack(tp, th->th_seq, todrop);
hdroptlen += todrop; /*drop from head afterwards*/
@@ -2111,7 +2111,7 @@ after_listen:
if ((so->so_state & SS_NOFDREF) &&
tp->t_state > TCPS_CLOSE_WAIT && tlen) {
tp = tcp_close(tp);
- tcpstat.tcps_rcvafterclose++;
+ tcpstat[TCP_STAT_RCVAFTERCLOSE]++;
goto dropwithreset;
}
@@ -2121,7 +2121,7 @@ after_listen:
*/
todrop = (th->th_seq + tlen) - (tp->rcv_nxt+tp->rcv_wnd);
if (todrop > 0) {
- tcpstat.tcps_rcvpackafterwin++;
+ tcpstat[TCP_STAT_RCVPACKAFTERWIN]++;
if (todrop >= tlen) {
/*
* The segment actually starts after the window.
@@ -2129,7 +2129,7 @@ after_listen:
* th->th_seq - tp->rcv_nxt - tp->rcv_wnd >= 0
* th->th_seq >= tp->rcv_nxt + tp->rcv_wnd
*/
- tcpstat.tcps_rcvbyteafterwin += tlen;
+ tcpstat[TCP_STAT_RCVBYTEAFTERWIN] += tlen;
/*
* If a new connection request is received
* while in TIME_WAIT, drop the old connection
@@ -2159,11 +2159,11 @@ after_listen:
*/
if (tp->rcv_wnd == 0 && th->th_seq == tp->rcv_nxt) {
tp->t_flags |= TF_ACKNOW;
- tcpstat.tcps_rcvwinprobe++;
+ tcpstat[TCP_STAT_RCVWINPROBE]++;
} else
goto dropafterack;
} else
- tcpstat.tcps_rcvbyteafterwin += todrop;
+ tcpstat[TCP_STAT_RCVBYTEAFTERWIN] += todrop;
m_adj(m, -todrop);
tlen -= todrop;
tiflags &= ~(TH_PUSH|TH_FIN);
@@ -2221,7 +2221,7 @@ after_listen:
so->so_error = ECONNRESET;
close:
tp->t_state = TCPS_CLOSED;
- tcpstat.tcps_drops++;
+ tcpstat[TCP_STAT_DROPS]++;
tp = tcp_close(tp);
goto drop;
@@ -2277,7 +2277,7 @@ after_listen:
if (SEQ_GT(tp->snd_una, th->th_ack) ||
SEQ_GT(th->th_ack, tp->snd_max))
goto dropwithreset;
- tcpstat.tcps_connects++;
+ tcpstat[TCP_STAT_CONNECTS]++;
soisconnected(so);
tcp_established(tp);
/* Do window scaling? */
@@ -2310,7 +2310,7 @@ after_listen:
if (SEQ_LEQ(th->th_ack, tp->snd_una)) {
if (tlen == 0 && !dupseg && tiwin == tp->snd_wnd) {
- tcpstat.tcps_rcvdupack++;
+ tcpstat[TCP_STAT_RCVDUPPACK]++;
/*
* If we have outstanding data (other than
* a window probe), this is a completely
@@ -2370,12 +2370,12 @@ after_listen:
else
tp->t_congctl->fast_retransmit_newack(tp, th);
if (SEQ_GT(th->th_ack, tp->snd_max)) {
- tcpstat.tcps_rcvacktoomuch++;
+ tcpstat[TCP_STAT_RCVACKTOOMUCH]++;
goto dropafterack;
}
acked = th->th_ack - tp->snd_una;
- tcpstat.tcps_rcvackpack++;
- tcpstat.tcps_rcvackbyte += acked;
+ tcpstat[TCP_STAT_RCVACKPACK]++;
+ tcpstat[TCP_STAT_RCVACKBYTE] += acked;
/*
* If we have a timestamp reply, update smoothed
@@ -2509,7 +2509,7 @@ step6:
/* keep track of pure window updates */
if (tlen == 0 &&
tp->snd_wl2 == th->th_ack && tiwin > tp->snd_wnd)
- tcpstat.tcps_rcvwinupd++;
+ tcpstat[TCP_STAT_RCVWINUPD]++;
tp->snd_wnd = tiwin;
tp->snd_wl1 = th->th_seq;
tp->snd_wl2 = th->th_ack;
@@ -2609,8 +2609,8 @@ dodata: /* XXX */
tcp_setup_ack(tp, th);
tp->rcv_nxt += tlen;
tiflags = th->th_flags & TH_FIN;
- tcpstat.tcps_rcvpack++;
- tcpstat.tcps_rcvbyte += tlen;
+ tcpstat[TCP_STAT_RCVPACK]++;
+ tcpstat[TCP_STAT_RCVBYTE] += tlen;
nd6_hint(tp);
if (so->so_state & SS_CANTRCVMORE)
m_freem(m);
@@ -2705,7 +2705,7 @@ badsyn:
/*
* Received a bad SYN. Increment counters and dropwithreset.
*/
- tcpstat.tcps_badsyn++;
+ tcpstat[TCP_STAT_BADSYN]++;
tp = NULL;
goto dropwithreset;
@@ -3112,7 +3112,7 @@ tcp_dooptions(struct tcpcb *tp, const u_char *cp, int cnt,
tcp_fields_to_host(th);
if (bcmp(sig, sigp, TCP_SIGLEN)) {
- tcpstat.tcps_badsig++;
+ tcpstat[TCP_STAT_BADSIG]++;
if (sav == NULL)
return (-1);
#ifdef FAST_IPSEC
@@ -3122,7 +3122,7 @@ tcp_dooptions(struct tcpcb *tp, const u_char *cp, int cnt,
#endif
return (-1);
} else
- tcpstat.tcps_goodsig++;
+ tcpstat[TCP_STAT_GOODSIG]++;
key_sa_recordxfer(sav, m);
#ifdef FAST_IPSEC
@@ -3176,7 +3176,7 @@ tcp_xmit_timer(struct tcpcb *tp, uint32_t rtt)
{
int32_t delta;
- tcpstat.tcps_rttupdated++;
+ tcpstat[TCP_STAT_RTTUPDATED]++;
if (tp->t_srtt != 0) {
/*
* srtt is stored as fixed point with 3 bits after the
@@ -3363,7 +3363,7 @@ syn_cache_insert(struct syn_cache *sc, struct tcpcb *tp)
*/
s = splsoftnet();
if (scp->sch_length >= tcp_syn_bucket_limit) {
- tcpstat.tcps_sc_bucketoverflow++;
+ tcpstat[TCP_STAT_SC_BUCKETOVERFLOW]++;
/*
* The bucket is full. Toss the oldest element in the
* bucket. This will be the first entry in the bucket.
@@ -3382,7 +3382,7 @@ syn_cache_insert(struct syn_cache *sc, struct tcpcb *tp)
} else if (syn_cache_count >= tcp_syn_cache_limit) {
struct syn_cache_head *scp2, *sce;
- tcpstat.tcps_sc_overflowed++;
+ tcpstat[TCP_STAT_SC_OVERFLOWED]++;
/*
* The cache is full. Toss the oldest entry in the
* first non-empty bucket we can find.
@@ -3430,7 +3430,7 @@ syn_cache_insert(struct syn_cache *sc, struct tcpcb *tp)
scp->sch_length++;
syn_cache_count++;
- tcpstat.tcps_sc_added++;
+ tcpstat[TCP_STAT_SC_ADDED]++;
splx(s);
}
@@ -3449,7 +3449,7 @@ syn_cache_timer(void *arg)
callout_ack(&sc->sc_timer);
if (__predict_false(sc->sc_flags & SCF_DEAD)) {
- tcpstat.tcps_sc_delayed_free++;
+ tcpstat[TCP_STAT_SC_DELAYED_FREE]++;
callout_destroy(&sc->sc_timer);
pool_put(&syn_cache_pool, sc);
splx(s);
@@ -3470,7 +3470,7 @@ syn_cache_timer(void *arg)
if (sc->sc_rxttot >= tcp_keepinit)
goto dropit;
- tcpstat.tcps_sc_retransmitted++;
+ tcpstat[TCP_STAT_SC_RETRANSMITTED]++;
(void) syn_cache_respond(sc, NULL);
/* Advance the timer back-off. */
@@ -3481,7 +3481,7 @@ syn_cache_timer(void *arg)
return;
dropit:
- tcpstat.tcps_sc_timed_out++;
+ tcpstat[TCP_STAT_SC_TIMED_OUT]++;
syn_cache_rm(sc);
syn_cache_put(sc); /* calls pool_put but see spl above */
splx(s);
@@ -3804,7 +3804,7 @@ syn_cache_get(struct sockaddr *src, struct sockaddr *dst,
tcp_rcvseqinit(tp);
tp->t_state = TCPS_SYN_RECEIVED;
TCP_TIMER_ARM(tp, TCPT_KEEP, tp->t_keepinit);
- tcpstat.tcps_accepts++;
+ tcpstat[TCP_STAT_ACCEPTS]++;
if ((sc->sc_flags & SCF_SACK_PERMIT) && tcp_do_sack)
tp->t_flags |= TF_WILL_SACK;
@@ -3858,7 +3858,7 @@ syn_cache_get(struct sockaddr *src, struct sockaddr *dst,
tp->t_partialacks = -1;
tp->t_dupacks = 0;
- tcpstat.tcps_sc_completed++;
+ tcpstat[TCP_STAT_SC_COMPLETED]++;
s = splsoftnet();
syn_cache_put(sc);
splx(s);
@@ -3872,7 +3872,7 @@ abort:
s = splsoftnet();
syn_cache_put(sc);
splx(s);
- tcpstat.tcps_sc_aborted++;
+ tcpstat[TCP_STAT_SC_ABORTED]++;
return ((struct socket *)(-1));
}
@@ -3899,7 +3899,7 @@ syn_cache_reset(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th)
return;
}
syn_cache_rm(sc);
- tcpstat.tcps_sc_reset++;
+ tcpstat[TCP_STAT_SC_RESET]++;
syn_cache_put(sc); /* calls pool_put but see spl above */
splx(s);
}
@@ -3938,7 +3938,7 @@ syn_cache_unreach(const struct sockaddr *src, const struct sockaddr *dst,
}
syn_cache_rm(sc);
- tcpstat.tcps_sc_unreach++;
+ tcpstat[TCP_STAT_SC_UNREACH]++;
syn_cache_put(sc); /* calls pool_put but see spl above */
splx(s);
}
@@ -4023,7 +4023,7 @@ syn_cache_add(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th,
* as a retransmission (XXX though maybe we should).
*/
if ((sc = syn_cache_lookup(src, dst, &scp)) != NULL) {
- tcpstat.tcps_sc_dupesyn++;
+ tcpstat[TCP_STAT_SC_DUPESYN]++;
if (ipopts) {
/*
* If we were remembering a previous source route,
@@ -4035,8 +4035,8 @@ syn_cache_add(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th,
}
sc->sc_timestamp = tb.ts_recent;
if (syn_cache_respond(sc, m) == 0) {
- tcpstat.tcps_sndacks++;
- tcpstat.tcps_sndtotal++;
+ tcpstat[TCP_STAT_SNDACKS]++;
+ tcpstat[TCP_STAT_SNDTOTAL]++;
}
return (1);
}
@@ -4144,13 +4144,13 @@ syn_cache_add(struct sockaddr *src, struct sockaddr *dst, struct tcphdr *th,
sc->sc_tp = tp;
if (syn_cache_respond(sc, m) == 0) {
syn_cache_insert(sc, tp);
- tcpstat.tcps_sndacks++;
- tcpstat.tcps_sndtotal++;
+ tcpstat[TCP_STAT_SNDACKS]++;
+ tcpstat[TCP_STAT_SNDTOTAL]++;
} else {
s = splsoftnet();
syn_cache_put(sc);
splx(s);
- tcpstat.tcps_sc_dropped++;
+ tcpstat[TCP_STAT_SC_DROPPED]++;
}
return (1);
}
@@ -4318,7 +4318,7 @@ syn_cache_respond(struct syn_cache *sc, struct mbuf *m)
if ((sc->sc_flags & SCF_ECN_PERMIT) && tp &&
SEQ_GEQ(tp->snd_nxt, tp->snd_max)) {
th->th_flags |= TH_ECE;
- tcpstat.tcps_ecn_shs++;
+ tcpstat[TCP_STAT_ECN_SHS]++;
/*
* draft-ietf-tcpm-ecnsyn-00.txt
@@ -4355,7 +4355,7 @@ syn_cache_respond(struct syn_cache *sc, struct mbuf *m)
break;
#endif
}
- tcpstat.tcps_ecn_ect++;
+ tcpstat[TCP_STAT_ECN_ECT]++;
}
#ifdef TCP_SIGNATURE
diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c
index 477d377813e..e809704c51f 100644
--- a/sys/netinet/tcp_output.c
+++ b/sys/netinet/tcp_output.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_output.c,v 1.164 2008/01/14 04:19:10 dyoung Exp $ */
+/* $NetBSD: tcp_output.c,v 1.165 2008/04/08 01:03:58 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -142,7 +142,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.164 2008/01/14 04:19:10 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.165 2008/04/08 01:03:58 thorpej Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@@ -446,13 +446,13 @@ tcp_build_datapkt(struct tcpcb *tp, struct socket *so, int off,
struct mbuf *m, *m0;
if (tp->t_force && len == 1)
- tcpstat.tcps_sndprobe++;
+ tcpstat[TCP_STAT_SNDPROBE]++;
else if (SEQ_LT(tp->snd_nxt, tp->snd_max)) {
- tcpstat.tcps_sndrexmitpack++;
- tcpstat.tcps_sndrexmitbyte += len;
+ tcpstat[TCP_STAT_SNDREXMITPACK]++;
+ tcpstat[TCP_STAT_SNDREXMITBYTE] += len;
} else {
- tcpstat.tcps_sndpack++;
- tcpstat.tcps_sndbyte += len;
+ tcpstat[TCP_STAT_SNDPACK]++;
+ tcpstat[TCP_STAT_SNDBYTE] += len;
}
#ifdef notyet
if ((m = m_copypack(so->so_snd.sb_mb, off,
@@ -1264,13 +1264,13 @@ send:
flags |= TH_PUSH;
} else {
if (tp->t_flags & TF_ACKNOW)
- tcpstat.tcps_sndacks++;
+ tcpstat[TCP_STAT_SNDACKS]++;
else if (flags & (TH_SYN|TH_FIN|TH_RST))
- tcpstat.tcps_sndctrl++;
+ tcpstat[TCP_STAT_SNDCTRL]++;
else if (SEQ_GT(tp->snd_up, tp->snd_una))
- tcpstat.tcps_sndurg++;
+ tcpstat[TCP_STAT_SNDURG]++;
else
- tcpstat.tcps_sndwinup++;
+ tcpstat[TCP_STAT_SNDWINUP]++;
MGETHDR(m, M_DONTWAIT, MT_HEADER);
if (m != NULL && max_linkhdr + hdrlen > MHLEN) {
@@ -1356,7 +1356,7 @@ send:
break;
#endif
}
- tcpstat.tcps_ecn_ect++;
+ tcpstat[TCP_STAT_ECN_ECT]++;
}
/*
@@ -1520,7 +1520,7 @@ send:
if (tp->t_rtttime == 0) {
tp->t_rtttime = tcp_now;
tp->t_rtseq = startseq;
- tcpstat.tcps_segstimed++;
+ tcpstat[TCP_STAT_SEGSTIMED]++;
}
}
@@ -1641,7 +1641,7 @@ timer:
if (error) {
out:
if (error == ENOBUFS) {
- tcpstat.tcps_selfquench++;
+ tcpstat[TCP_STAT_SELFQUENCH]++;
#ifdef INET
if (tp->t_inpcb)
tcp_quench(tp->t_inpcb, 0);
@@ -1671,9 +1671,9 @@ out:
if (packetlen > tp->t_pmtud_mtu_sent)
tp->t_pmtud_mtu_sent = packetlen;
- tcpstat.tcps_sndtotal++;
+ tcpstat[TCP_STAT_SNDTOTAL]++;
if (tp->t_flags & TF_DELACK)
- tcpstat.tcps_delack++;
+ tcpstat[TCP_STAT_DELACK]++;
/*
* Data sent (as far as we can tell).
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index c07c83b5a1b..594c99d724b 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_subr.c,v 1.225 2008/03/27 00:18:56 cube Exp $ */
+/* $NetBSD: tcp_subr.c,v 1.226 2008/04/08 01:03:58 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -98,7 +98,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.225 2008/03/27 00:18:56 cube Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.226 2008/04/08 01:03:58 thorpej Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@@ -170,7 +170,7 @@ __KERNEL_RCSID(0, "$NetBSD: tcp_subr.c,v 1.225 2008/03/27 00:18:56 cube Exp $");
struct inpcbtable tcbtable; /* head of queue of active tcpcb's */
-struct tcpstat tcpstat; /* tcp statistics */
+uint64_t tcpstat[TCP_NSTATS]; /* tcp statistics */
u_int32_t tcp_now; /* for RFC 1323 timestamps */
/* patchable/settable parameters for tcp */
@@ -1094,9 +1094,9 @@ tcp_drop(struct tcpcb *tp, int errno)
if (TCPS_HAVERCVDSYN(tp->t_state)) {
tp->t_state = TCPS_CLOSED;
(void) tcp_output(tp);
- tcpstat.tcps_drops++;
+ tcpstat[TCP_STAT_DROPS]++;
} else
- tcpstat.tcps_conndrops++;
+ tcpstat[TCP_STAT_CONNDROPS]++;
if (errno == ETIMEDOUT && tp->t_softerror)
errno = tp->t_softerror;
so->so_error = errno;
@@ -1122,7 +1122,7 @@ tcp_isdead(struct tcpcb *tp)
if (tcp_timers_invoking(tp) > 0)
/* not quite there yet -- count separately? */
return dead;
- tcpstat.tcps_delayed_free++;
+ tcpstat[TCP_STAT_DELAYED_FREE]++;
for (i = 0; i < TCPT_NTIMERS; i++)
callout_destroy(&tp->t_timer[i]);
callout_destroy(&tp->t_delack_ch);
@@ -1275,7 +1275,7 @@ tcp_close(struct tcpcb *tp)
in6_pcbdetach(in6p);
}
#endif
- tcpstat.tcps_closed++;
+ tcpstat[TCP_STAT_CLOSED]++;
return ((struct tcpcb *)0);
}
@@ -1342,7 +1342,7 @@ tcp_drain(void)
if (tcp_reass_lock_try(tp) == 0)
continue;
if (tcp_freeq(tp))
- tcpstat.tcps_connsdrained++;
+ tcpstat[TCP_STAT_CONNSDRAINED]++;
TCP_REASS_UNLOCK(tp);
}
}
diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c
index 5ab8eb641a8..fa20d0eb1d8 100644
--- a/sys/netinet/tcp_timer.c
+++ b/sys/netinet/tcp_timer.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_timer.c,v 1.77 2007/06/20 15:29:18 christos Exp $ */
+/* $NetBSD: tcp_timer.c,v 1.78 2008/04/08 01:03:58 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -100,7 +100,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_timer.c,v 1.77 2007/06/20 15:29:18 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_timer.c,v 1.78 2008/04/08 01:03:58 thorpej Exp $");
#include "opt_inet.h"
#include "opt_tcp_debug.h"
@@ -349,12 +349,12 @@ tcp_timer_rexmt(void *arg)
if (++tp->t_rxtshift > TCP_MAXRXTSHIFT) {
tp->t_rxtshift = TCP_MAXRXTSHIFT;
- tcpstat.tcps_timeoutdrop++;
+ tcpstat[TCP_STAT_TIMEOUTDROP]++;
tp = tcp_drop(tp, tp->t_softerror ?
tp->t_softerror : ETIMEDOUT);
goto out;
}
- tcpstat.tcps_rexmttimeo++;
+ tcpstat[TCP_STAT_REXMTTIMEO]++;
rto = TCP_REXMTVAL(tp);
if (rto < tp->t_rttmin)
rto = tp->t_rttmin;
@@ -371,7 +371,7 @@ tcp_timer_rexmt(void *arg)
* value here...
*/
if (tp->t_mtudisc && tp->t_rxtshift > TCP_MAXRXTSHIFT / 6) {
- tcpstat.tcps_pmtublackhole++;
+ tcpstat[TCP_STAT_PMTUBLACKHOLE]++;
#ifdef INET
/* try turning PMTUD off */
@@ -486,11 +486,11 @@ tcp_timer_persist(void *arg)
if (tp->t_rxtshift == TCP_MAXRXTSHIFT &&
((tcp_now - tp->t_rcvtime) >= tcp_maxpersistidle ||
(tcp_now - tp->t_rcvtime) >= rto * tcp_totbackoff)) {
- tcpstat.tcps_persistdrops++;
+ tcpstat[TCP_STAT_PERSISTDROPS]++;
tp = tcp_drop(tp, ETIMEDOUT);
goto out;
}
- tcpstat.tcps_persisttimeo++;
+ tcpstat[TCP_STAT_PERSISTTIMEO]++;
tcp_setpersist(tp);
tp->t_force = 1;
(void) tcp_output(tp);
@@ -531,7 +531,7 @@ tcp_timer_keep(void *arg)
* or drop connection if idle for too long.
*/
- tcpstat.tcps_keeptimeo++;
+ tcpstat[TCP_STAT_KEEPTIMEO]++;
if (TCPS_HAVEESTABLISHED(tp->t_state) == 0)
goto dropit;
#ifdef INET
@@ -561,7 +561,7 @@ tcp_timer_keep(void *arg)
* by the protocol spec, this requires the
* correspondent TCP to respond.
*/
- tcpstat.tcps_keepprobe++;
+ tcpstat[TCP_STAT_KEEPPROBE]++;
if (tcp_compat_42) {
/*
* The keepalive packet must have nonzero
@@ -588,7 +588,7 @@ tcp_timer_keep(void *arg)
return;
dropit:
- tcpstat.tcps_keepdrops++;
+ tcpstat[TCP_STAT_KEEPDROPS]++;
(void) tcp_drop(tp, ETIMEDOUT);
splx(s);
}
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index 34eb9491b24..b9990c3a6b8 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_usrreq.c,v 1.140 2007/12/16 14:12:35 elad Exp $ */
+/* $NetBSD: tcp_usrreq.c,v 1.141 2008/04/08 01:03:58 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -102,7 +102,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.140 2007/12/16 14:12:35 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.141 2008/04/08 01:03:58 thorpej Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@@ -436,7 +436,7 @@ tcp_usrreq(struct socket *so, int req,
(TCP_MAXWIN << tp->request_r_scale) < sb_max)
tp->request_r_scale++;
soisconnecting(so);
- tcpstat.tcps_connattempt++;
+ tcpstat[TCP_STAT_CONNATTEMPT]++;
tp->t_state = TCPS_SYN_SENT;
TCP_TIMER_ARM(tp, TCPT_KEEP, tp->t_keepinit);
tp->iss = tcp_new_iss(tp, 0);
@@ -1959,7 +1959,7 @@ sysctl_net_inet_tcp_setup2(struct sysctllog **clog, int pf, const char *pfname,
CTLFLAG_PERMANENT,
CTLTYPE_STRUCT, "stats",
SYSCTL_DESCR("TCP statistics"),
- NULL, 0, &tcpstat, sizeof(tcpstat),
+ NULL, 0, tcpstat, sizeof(tcpstat),
CTL_NET, pf, IPPROTO_TCP, TCPCTL_STATS,
CTL_EOL);
#ifdef TCP_DEBUG
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index b0119be3401..1411900c6f0 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -1,4 +1,4 @@
-/* $NetBSD: tcp_var.h,v 1.153 2008/02/29 07:39:17 matt Exp $ */
+/* $NetBSD: tcp_var.h,v 1.154 2008/04/08 01:03:58 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -567,96 +567,91 @@ struct syn_cache_head {
/*
* TCP statistics.
- * Many of these should be kept per connection,
- * but that's inconvenient at the moment.
+ * Each counter is an unsigned 64-bit value.
+ *
+ * Many of these should be kept per connection, but that's inconvenient
+ * at the moment.
*/
-struct tcpstat {
- u_quad_t tcps_connattempt; /* connections initiated */
- u_quad_t tcps_accepts; /* connections accepted */
- u_quad_t tcps_connects; /* connections established */
- u_quad_t tcps_drops; /* connections dropped */
- u_quad_t tcps_conndrops; /* embryonic connections dropped */
- u_quad_t tcps_closed; /* conn. closed (includes drops) */
- u_quad_t tcps_segstimed; /* segs where we tried to get rtt */
- u_quad_t tcps_rttupdated; /* times we succeeded */
- u_quad_t tcps_delack; /* delayed acks sent */
- u_quad_t tcps_timeoutdrop; /* conn. dropped in rxmt timeout */
- u_quad_t tcps_rexmttimeo; /* retransmit timeouts */
- u_quad_t tcps_persisttimeo; /* persist timeouts */
- u_quad_t tcps_keeptimeo; /* keepalive timeouts */
- u_quad_t tcps_keepprobe; /* keepalive probes sent */
- u_quad_t tcps_keepdrops; /* connections dropped in keepalive */
- u_quad_t tcps_persistdrops; /* connections dropped in persist */
- u_quad_t tcps_connsdrained; /* connections drained due to memory
+#define TCP_STAT_CONNATTEMPT 0 /* connections initiated */
+#define TCP_STAT_ACCEPTS 1 /* connections accepted */
+#define TCP_STAT_CONNECTS 2 /* connections established */
+#define TCP_STAT_DROPS 3 /* connections dropped */
+#define TCP_STAT_CONNDROPS 4 /* embryonic connections dropped */
+#define TCP_STAT_CLOSED 5 /* conn. closed (includes drops) */
+#define TCP_STAT_SEGSTIMED 6 /* segs where we tried to get rtt */
+#define TCP_STAT_RTTUPDATED 7 /* times we succeeded */
+#define TCP_STAT_DELACK 8 /* delayed ACKs sent */
+#define TCP_STAT_TIMEOUTDROP 9 /* conn. dropped in rxmt timeout */
+#define TCP_STAT_REXMTTIMEO 10 /* retransmit timeouts */
+#define TCP_STAT_PERSISTTIMEO 11 /* persist timeouts */
+#define TCP_STAT_KEEPTIMEO 12 /* keepalive timeouts */
+#define TCP_STAT_KEEPPROBE 13 /* keepalive probes sent */
+#define TCP_STAT_KEEPDROPS 14 /* connections dropped in keepalive */
+#define TCP_STAT_PERSISTDROPS 15 /* connections dropped in persist */
+#define TCP_STAT_CONNSDRAINED 16 /* connections drained due to memory
shortage */
- u_quad_t tcps_pmtublackhole; /* PMTUD blackhole detected */
-
- u_quad_t tcps_sndtotal; /* total packets sent */
- u_quad_t tcps_sndpack; /* data packets sent */
- u_quad_t tcps_sndbyte; /* data bytes sent */
- u_quad_t tcps_sndrexmitpack; /* data packets retransmitted */
- u_quad_t tcps_sndrexmitbyte; /* data bytes retransmitted */
- u_quad_t tcps_sndacks; /* ack-only packets sent */
- u_quad_t tcps_sndprobe; /* window probes sent */
- u_quad_t tcps_sndurg; /* packets sent with URG only */
- u_quad_t tcps_sndwinup; /* window update-only packets sent */
- u_quad_t tcps_sndctrl; /* control (SYN|FIN|RST) packets sent */
-
- u_quad_t tcps_rcvtotal; /* total packets received */
- u_quad_t tcps_rcvpack; /* packets received in sequence */
- u_quad_t tcps_rcvbyte; /* bytes received in sequence */
- u_quad_t tcps_rcvbadsum; /* packets received with ccksum errs */
- u_quad_t tcps_rcvbadoff; /* packets received with bad offset */
- u_quad_t tcps_rcvmemdrop; /* packets dropped for lack of memory */
- u_quad_t tcps_rcvshort; /* packets received too short */
- u_quad_t tcps_rcvduppack; /* duplicate-only packets received */
- u_quad_t tcps_rcvdupbyte; /* duplicate-only bytes received */
- u_quad_t tcps_rcvpartduppack; /* packets with some duplicate data */
- u_quad_t tcps_rcvpartdupbyte; /* dup. bytes in part-dup. packets */
- u_quad_t tcps_rcvoopack; /* out-of-order packets received */
- u_quad_t tcps_rcvoobyte; /* out-of-order bytes received */
- u_quad_t tcps_rcvpackafterwin; /* packets with data after window */
- u_quad_t tcps_rcvbyteafterwin; /* bytes rcvd after window */
- u_quad_t tcps_rcvafterclose; /* packets rcvd after "close" */
- u_quad_t tcps_rcvwinprobe; /* rcvd window probe packets */
- u_quad_t tcps_rcvdupack; /* rcvd duplicate acks */
- u_quad_t tcps_rcvacktoomuch; /* rcvd acks for unsent data */
- u_quad_t tcps_rcvackpack; /* rcvd ack packets */
- u_quad_t tcps_rcvackbyte; /* bytes acked by rcvd acks */
- u_quad_t tcps_rcvwinupd; /* rcvd window update packets */
- u_quad_t tcps_pawsdrop; /* segments dropped due to PAWS */
- u_quad_t tcps_predack; /* times hdr predict ok for acks */
- u_quad_t tcps_preddat; /* times hdr predict ok for data pkts */
-
- u_quad_t tcps_pcbhashmiss; /* input packets missing pcb hash */
- u_quad_t tcps_noport; /* no socket on port */
- u_quad_t tcps_badsyn; /* received ack for which we have
+#define TCP_STAT_PMTUBLACKHOLE 17 /* PMTUD blackhole detected */
+#define TCP_STAT_SNDTOTAL 18 /* total packets sent */
+#define TCP_STAT_SNDPACK 19 /* data packlets sent */
+#define TCP_STAT_SNDBYTE 20 /* data bytes sent */
+#define TCP_STAT_SNDREXMITPACK 21 /* data packets retransmitted */
+#define TCP_STAT_SNDREXMITBYTE 22 /* data bytes retransmitted */
+#define TCP_STAT_SNDACKS 23 /* ACK-only packets sent */
+#define TCP_STAT_SNDPROBE 24 /* window probes sent */
+#define TCP_STAT_SNDURG 25 /* packets sent with URG only */
+#define TCP_STAT_SNDWINUP 26 /* window update-only packets sent */
+#define TCP_STAT_SNDCTRL 27 /* control (SYN|FIN|RST) packets sent */
+#define TCP_STAT_RCVTOTAL 28 /* total packets received */
+#define TCP_STAT_RCVPACK 29 /* packets received in sequence */
+#define TCP_STAT_RCVBYTE 30 /* bytes received in sequence */
+#define TCP_STAT_RCVBADSUM 31 /* packets received with cksum errs */
+#define TCP_STAT_RCVBADOFF 32 /* packets received with bad offset */
+#define TCP_STAT_RCVMEMDROP 33 /* packets dropped for lack of memory */
+#define TCP_STAT_RCVSHORT 34 /* packets received too short */
+#define TCP_STAT_RCVDUPPACK 35 /* duplicate-only packets received */
+#define TCP_STAT_RCVDUPBYTE 36 /* duplicate-only bytes received */
+#define TCP_STAT_RCVPARTDUPPACK 37 /* packets with some duplicate data */
+#define TCP_STAT_RCVPARTDUPBYTE 38 /* dup. bytes in part-dup. packets */
+#define TCP_STAT_RCVOOPACK 39 /* out-of-order packets received */
+#define TCP_STAT_RCVOOBYTE 40 /* out-of-order bytes received */
+#define TCP_STAT_RCVPACKAFTERWIN 41 /* packets with data after window */
+#define TCP_STAT_RCVBYTEAFTERWIN 42 /* bytes received after window */
+#define TCP_STAT_RCVAFTERCLOSE 43 /* packets received after "close" */
+#define TCP_STAT_RCVWINPROBE 44 /* rcvd window probe packets */
+#define TCP_STAT_RCVDUPACK 45 /* rcvd duplicate ACKs */
+#define TCP_STAT_RCVACKTOOMUCH 46 /* rcvd ACKs for unsent data */
+#define TCP_STAT_RCVACKPACK 47 /* rcvd ACK packets */
+#define TCP_STAT_RCVACKBYTE 48 /* bytes ACKed by rcvd ACKs */
+#define TCP_STAT_RCVWINUPD 49 /* rcvd window update packets */
+#define TCP_STAT_PAWSDROP 50 /* segments dropped due to PAWS */
+#define TCP_STAT_PREDACK 51 /* times hdr predict OK for ACKs */
+#define TCP_STAT_PREDDAT 52 /* times hdr predict OK for data pkts */
+#define TCP_STAT_PCBHASHMISS 53 /* input packets missing PCB hash */
+#define TCP_STAT_NOPORT 54 /* no socket on port */
+#define TCP_STAT_BADSYN 55 /* received ACK for which we have
no SYN in compressed state */
- u_quad_t tcps_delayed_free; /* delayed pool_put() of tcpcb */
-
- /* These statistics deal with the SYN cache. */
- u_quad_t tcps_sc_added; /* # of entries added */
- u_quad_t tcps_sc_completed; /* # of connections completed */
- u_quad_t tcps_sc_timed_out; /* # of entries timed out */
- u_quad_t tcps_sc_overflowed; /* # dropped due to overflow */
- u_quad_t tcps_sc_reset; /* # dropped due to RST */
- u_quad_t tcps_sc_unreach; /* # dropped due to ICMP unreach */
- u_quad_t tcps_sc_bucketoverflow;/* # dropped due to bucket overflow */
- u_quad_t tcps_sc_aborted; /* # of entries aborted (no mem) */
- u_quad_t tcps_sc_dupesyn; /* # of duplicate SYNs received */
- u_quad_t tcps_sc_dropped; /* # of SYNs dropped (no route/mem) */
- u_quad_t tcps_sc_collisions; /* # of hash collisions */
- u_quad_t tcps_sc_retransmitted; /* # of retransmissions */
- u_quad_t tcps_sc_delayed_free; /* # of delayed pool_put()s */
-
- u_quad_t tcps_selfquench; /* # of ENOBUFS we get on output */
- u_quad_t tcps_badsig; /* # of drops due to bad signature */
- u_quad_t tcps_goodsig; /* # of packets with good signature */
-
- u_quad_t tcps_ecn_shs; /* # of sucessful ECN handshakes */
- u_quad_t tcps_ecn_ce; /* # of packets with CE bit */
- u_quad_t tcps_ecn_ect; /* # of packets with ECT(0) bit */
-};
+#define TCP_STAT_DELAYED_FREE 56 /* delayed pool_put() of tcpcb */
+#define TCP_STAT_SC_ADDED 57 /* # of sc entries added */
+#define TCP_STAT_SC_COMPLETED 58 /* # of sc connections completed */
+#define TCP_STAT_SC_TIMED_OUT 59 /* # of sc entries timed out */
+#define TCP_STAT_SC_OVERFLOWED 60 /* # of sc drops due to overflow */
+#define TCP_STAT_SC_RESET 61 /* # of sc drops due to RST */
+#define TCP_STAT_SC_UNREACH 62 /* # of sc drops due to ICMP unreach */
+#define TCP_STAT_SC_BUCKETOVERFLOW 63 /* # of sc drops due to bucket ovflow */
+#define TCP_STAT_SC_ABORTED 64 /* # of sc entries aborted (no mem) */
+#define TCP_STAT_SC_DUPESYN 65 /* # of duplicate SYNs received */
+#define TCP_STAT_SC_DROPPED 66 /* # of SYNs dropped (no route/mem) */
+#define TCP_STAT_SC_COLLISIONS 67 /* # of sc hash collisions */
+#define TCP_STAT_SC_RETRANSMITTED 68 /* # of sc retransmissions */
+#define TCP_STAT_SC_DELAYED_FREE 69 /* # of delayed pool_put()s */
+#define TCP_STAT_SELFQUENCH 70 /* # of ENOBUFS we get on output */
+#define TCP_STAT_BADSIG 71 /* # of drops due to bad signature */
+#define TCP_STAT_GOODSIG 72 /* # of packets with good signature */
+#define TCP_STAT_ECN_SHS 73 /* # of successful ECN handshakes */
+#define TCP_STAT_ECN_CE 74 /* # of packets with CE bit */
+#define TCP_STAT_ECN_ECT 75 /* # of packets with ECT(0) bit */
+
+#define TCP_NSTATS 76
/*
* Names for TCP sysctl objects.
@@ -739,7 +734,7 @@ struct tcpstat {
#ifdef _KERNEL
extern struct inpcbtable tcbtable; /* head of queue of active tcpcb's */
-extern struct tcpstat tcpstat; /* tcp statistics */
+extern uint64_t tcpstat[TCP_NSTATS]; /* tcp statistics */
extern u_int32_t tcp_now; /* for RFC 1323 timestamps */
extern int tcp_do_rfc1323; /* enabled/disabled? */
extern int tcp_do_sack; /* SACK enabled/disabled? */