Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F170633620
D59451.id185940.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
8 KB
Referenced Files
None
Subscribers
None
D59451.id185940.diff
View Options
diff --git a/sys/netinet/in_kdtrace.h b/sys/netinet/in_kdtrace.h
--- a/sys/netinet/in_kdtrace.h
+++ b/sys/netinet/in_kdtrace.h
@@ -251,9 +251,6 @@
SDT_PROBE_DECLARE(mib, tcp, count, tcps_predack);
SDT_PROBE_DECLARE(mib, tcp, count, tcps_preddat);
SDT_PROBE_DECLARE(mib, tcp, count, tcps_pcbcachemiss);
-SDT_PROBE_DECLARE(mib, tcp, count, tcps_cachedrtt);
-SDT_PROBE_DECLARE(mib, tcp, count, tcps_cachedrttvar);
-SDT_PROBE_DECLARE(mib, tcp, count, tcps_cachedssthresh);
SDT_PROBE_DECLARE(mib, tcp, count, tcps_usedrtt);
SDT_PROBE_DECLARE(mib, tcp, count, tcps_usedrttvar);
SDT_PROBE_DECLARE(mib, tcp, count, tcps_usedssthresh);
@@ -281,8 +278,17 @@
SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_spurcookie);
SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_failcookie);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_hc_hits);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_hc_misses);
SDT_PROBE_DECLARE(mib, tcp, count, tcps_hc_added);
SDT_PROBE_DECLARE(mib, tcp, count, tcps_hc_bucketoverflow);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_hc_allocfail);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_cachedrtt);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_cachedrttvar);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_cachedssthresh);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_cachedcwnd);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_cachedsendpipe);
+SDT_PROBE_DECLARE(mib, tcp, count, tcps_cachedrecvpipe);
SDT_PROBE_DECLARE(mib, tcp, count, tcps_finwait2_drops);
diff --git a/sys/netinet/in_kdtrace.c b/sys/netinet/in_kdtrace.c
--- a/sys/netinet/in_kdtrace.c
+++ b/sys/netinet/in_kdtrace.c
@@ -259,9 +259,6 @@
MIB_PROBE_TCP(tcps_predack);
MIB_PROBE_TCP(tcps_preddat);
MIB_PROBE_TCP(tcps_pcbackemiss);
-MIB_PROBE_TCP(tcps_cachedrtt);
-MIB_PROBE_TCP(tcps_cachedrttvar);
-MIB_PROBE_TCP(tcps_cachedssthresh);
MIB_PROBE_TCP(tcps_usedrtt);
MIB_PROBE_TCP(tcps_usedrttvar);
MIB_PROBE_TCP(tcps_usedssthresh);
@@ -289,8 +286,17 @@
MIB_PROBE_TCP(tcps_sc_spurcookie);
MIB_PROBE_TCP(tcps_sc_failcookie);
+MIB_PROBE_TCP(tcps_hc_hits);
+MIB_PROBE_TCP(tcps_hc_misses);
MIB_PROBE_TCP(tcps_hc_added);
MIB_PROBE_TCP(tcps_hc_bucketoverflow);
+MIB_PROBE_TCP(tcps_hc_allocfail);
+MIB_PROBE_TCP(tcps_cachedrtt);
+MIB_PROBE_TCP(tcps_cachedrttvar);
+MIB_PROBE_TCP(tcps_cachedssthresh);
+MIB_PROBE_TCP(tcps_cachedcwnd);
+MIB_PROBE_TCP(tcps_cachedsendpipe);
+MIB_PROBE_TCP(tcps_cachedrecvpipe);
MIB_PROBE_TCP(tcps_finwait2_drops);
diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c
--- a/sys/netinet/tcp_hostcache.c
+++ b/sys/netinet/tcp_hostcache.c
@@ -362,8 +362,11 @@
#ifdef TCP_HC_COUNTERS
hc_entry->hc_hits++;
#endif
- } else
+ TCPSTAT_INC(tcps_hc_hits);
+ } else {
smr_exit(V_tcp_hostcache.smr);
+ TCPSTAT_INC(tcps_hc_misses);
+ }
return (hc_entry);
}
@@ -527,6 +530,7 @@
hc_entry = uma_zalloc_smr(V_tcp_hostcache.zone, M_NOWAIT);
if (hc_entry == NULL) {
THC_UNLOCK(hc_head);
+ TCPSTAT_INC(tcps_hc_allocfail);
return;
}
@@ -584,7 +588,7 @@
v = ((uint64_t)hc_entry->hc_cwnd +
(uint64_t)hcm->hc_cwnd) / 2;
atomic_store_32(&hc_entry->hc_cwnd, v);
- /* TCPSTAT_INC(tcps_cachedcwnd); */
+ TCPSTAT_INC(tcps_cachedcwnd);
}
if (hcm->hc_sendpipe != 0) {
if (hc_entry->hc_sendpipe == 0)
@@ -593,7 +597,7 @@
v = ((uint64_t)hc_entry->hc_sendpipe +
(uint64_t)hcm->hc_sendpipe) / 2;
atomic_store_32(&hc_entry->hc_sendpipe, v);
- /* TCPSTAT_INC(tcps_cachedsendpipe); */
+ TCPSTAT_INC(tcps_cachedsendpipe);
}
if (hcm->hc_recvpipe != 0) {
if (hc_entry->hc_recvpipe == 0)
@@ -602,7 +606,7 @@
v = ((uint64_t)hc_entry->hc_recvpipe +
(uint64_t)hcm->hc_recvpipe) / 2;
atomic_store_32(&hc_entry->hc_recvpipe, v);
- /* TCPSTAT_INC(tcps_cachedrecvpipe); */
+ TCPSTAT_INC(tcps_cachedrecvpipe);
}
/*
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -1022,9 +1022,6 @@
uint64_t tcps_predack; /* times hdr predict ok for acks */
uint64_t tcps_preddat; /* times hdr predict ok for data pkts */
uint64_t tcps_pcbcachemiss;
- uint64_t tcps_cachedrtt; /* times cached RTT in route updated */
- uint64_t tcps_cachedrttvar; /* times cached rttvar updated */
- uint64_t tcps_cachedssthresh; /* times cached ssthresh updated */
uint64_t tcps_usedrtt; /* times RTT initialized from route */
uint64_t tcps_usedrttvar; /* times RTTVAR initialized from rt */
uint64_t tcps_usedssthresh; /* times ssthresh initialized from rt*/
@@ -1052,8 +1049,18 @@
uint64_t tcps_sc_spurcookie; /* SYN cookie spurious, rejected */
uint64_t tcps_sc_failcookie; /* SYN cookie failed, rejected */
+ /* TCP host cache */
+ uint64_t tcps_hc_hits;
+ uint64_t tcps_hc_misses;
uint64_t tcps_hc_added; /* entry added to hostcache */
uint64_t tcps_hc_bucketoverflow;/* hostcache per bucket limit hit */
+ uint64_t tcps_hc_allocfail; /* hostcache zone full */
+ uint64_t tcps_cachedrtt; /* times cached RTT in route updated */
+ uint64_t tcps_cachedrttvar; /* times cached rttvar updated */
+ uint64_t tcps_cachedssthresh; /* times cached ssthresh updated */
+ uint64_t tcps_cachedcwnd; /* times cached congestion window */
+ uint64_t tcps_cachedsendpipe; /* times cached send buffer size */
+ uint64_t tcps_cachedrecvpipe; /* times cached recv buffer size */
uint64_t tcps_finwait2_drops; /* Drop FIN_WAIT_2 connection after time limit */
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c
--- a/usr.bin/netstat/inet.c
+++ b/usr.bin/netstat/inet.c
@@ -612,6 +612,8 @@
xo_emit(m, (uintmax_t )tcpstat.f, plural(tcpstat.f))
#define p1a(f, m) if (tcpstat.f || sflag <= 1) \
xo_emit(m, (uintmax_t )tcpstat.f)
+#define p1b(f, m) if (tcpstat.f || sflag <= 1) \
+ xo_emit(m, (uintmax_t )tcpstat.f, plurales(tcpstat.f))
#define p2(f1, f2, m) if (tcpstat.f1 || tcpstat.f2 || sflag <= 1) \
xo_emit(m, (uintmax_t )tcpstat.f1, plural(tcpstat.f1), \
(uintmax_t )tcpstat.f2, plural(tcpstat.f2))
@@ -714,23 +716,9 @@
"{N:/ignored RSTs in the window%s}\n");
p(tcps_connects, "\t{:connections-established/%ju} "
"{N:/connection%s established (including accepts)}\n");
- p(tcps_usedrtt, "\t\t{:connections-hostcache-rtt/%ju} "
- "{N:/time%s used RTT from hostcache}\n");
- p(tcps_usedrttvar, "\t\t{:connections-hostcache-rttvar/%ju} "
- "{N:/time%s used RTT variance from hostcache}\n");
- p(tcps_usedssthresh, "\t\t{:connections-hostcache-ssthresh/%ju} "
- "{N:/time%s used slow-start threshold from hostcache}\n");
p2(tcps_closed, tcps_drops, "\t{:connections-closed/%ju} "
"{N:/connection%s closed (including} "
"{:connection-drops/%ju} {N:/drop%s})\n");
- p(tcps_cachedrtt, "\t\t{:connections-updated-rtt-on-close/%ju} "
- "{N:/connection%s updated cached RTT on close}\n");
- p(tcps_cachedrttvar, "\t\t"
- "{:connections-updated-variance-on-close/%ju} "
- "{N:/connection%s updated cached RTT variance on close}\n");
- p(tcps_cachedssthresh, "\t\t"
- "{:connections-updated-ssthresh-on-close/%ju} "
- "{N:/connection%s updated cached ssthresh on close}\n");
p(tcps_conndrops, "\t{:embryonic-connections-dropped/%ju} "
"{N:/embryonic connection%s dropped}\n");
p2(tcps_rttupdated, tcps_segstimed, "\t{:segments-updated-rtt/%ju} "
@@ -800,8 +788,37 @@
p3(tcps_hc_added, "\t{:entries-added/%ju} "
"{N:/hostcache entr%s added}\n");
- p1a(tcps_hc_bucketoverflow, "\t\t{:buffer-overflows/%ju} "
- "{N:/bucket overflow}\n");
+ p(tcps_hc_hits, "\t\t{:cache-hits/%ju} "
+ "{N:/cache lookup hit%s}\n");
+ p1b(tcps_hc_misses, "\t\t{:cache-misses/%ju} "
+ "{N:/cache lookup miss%s}\n");
+ p(tcps_hc_bucketoverflow, "\t\t{:bucket-overflows/%ju} "
+ "{N:/bucket overflow%s}\n");
+ p(tcps_hc_allocfail, "\t\t{:allocation-failures/%ju} "
+ "{N:/allocation failure%s}\n");
+ p(tcps_cachedrtt, "\t\t{:connections-updated-rtt-on-close/%ju} "
+ "{N:/connection%s updated cached RTT on close}\n");
+ p(tcps_usedrtt, "\t\t{:connections-hostcache-rtt/%ju} "
+ "{N:/time%s used RTT from hostcache}\n");
+ p(tcps_cachedrttvar, "\t\t"
+ "{:connections-updated-variance-on-close/%ju} "
+ "{N:/connection%s updated cached RTT variance on close}\n");
+ p(tcps_usedrttvar, "\t\t{:connections-hostcache-rttvar/%ju} "
+ "{N:/time%s used RTT variance from hostcache}\n");
+ p(tcps_cachedssthresh, "\t\t"
+ "{:connections-updated-ssthresh-on-close/%ju} "
+ "{N:/connection%s updated cached ssthresh on close}\n");
+ p(tcps_usedssthresh, "\t\t{:connections-hostcache-ssthresh/%ju} "
+ "{N:/time%s used slow-start threshold from hostcache}\n");
+ p(tcps_cachedcwnd, "\t\t"
+ "{:connections-updated-cwnd-on-close/%ju} "
+ "{N:/connection%s updated cached congestion windows on close}\n");
+ p(tcps_cachedsendpipe, "\t\t"
+ "{:connections-updated-send-space-on-close/%ju} "
+ "{N:/connection%s updated cached send buffer space on close}\n");
+ p(tcps_cachedrecvpipe, "\t\t"
+ "{:connections-updated-recv-space-on-close/%ju} "
+ "{N:/connection%s updated cached recv buffer space on close}\n");
xo_close_container("hostcache");
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Sep 6, 5:56 PM (1 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
38425877
Default Alt Text
D59451.id185940.diff (8 KB)
Attached To
Mode
D59451: tcp: collect and report more statistics on the TCP host cache
Attached
Detach File
Event Timeline
Log In to Comment