diff options
author | glebius <glebius@FreeBSD.org> | 2016-01-27 00:48:05 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2016-01-27 00:48:05 +0000 |
commit | ccaed9e02be515e0496ee4dc90e02aac28c3485a (patch) | |
tree | 8522dd948ed8660720e0cc3e190afbaf008d19d2 | |
parent | 9487eaf98f45a433931bad91a3463694f5423688 (diff) | |
download | FreeBSD-src-ccaed9e02be515e0496ee4dc90e02aac28c3485a.zip FreeBSD-src-ccaed9e02be515e0496ee4dc90e02aac28c3485a.tar.gz |
Grab a snap amount of TCP connections in syncache from tcpstat.
-rw-r--r-- | sys/netinet/tcp_subr.c | 5 | ||||
-rw-r--r-- | sys/netinet/tcp_syncache.c | 19 | ||||
-rw-r--r-- | sys/netinet/tcp_syncache.h | 1 |
3 files changed, 3 insertions, 22 deletions
diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index b16f540..0d16330 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1590,7 +1590,8 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS) * resource-intensive to repeat twice on every request. */ if (req->oldptr == NULL) { - n = V_tcbinfo.ipi_count + syncache_pcbcount(); + n = V_tcbinfo.ipi_count + + TCPSTAT_FETCH(tcps_states[TCPS_SYN_RECEIVED]); n += imax(n / 8, 10); req->oldidx = 2 * (sizeof xig) + n * sizeof(struct xtcpcb); return (0); @@ -1607,7 +1608,7 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS) n = V_tcbinfo.ipi_count; INP_LIST_RUNLOCK(&V_tcbinfo); - m = syncache_pcbcount(); + m = TCPSTAT_FETCH(tcps_states[TCPS_SYN_RECEIVED]); error = sysctl_wire_old_buffer(req, 2 * (sizeof xig) + (n + m) * sizeof(struct xtcpcb)); diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c index 45e00e9..0ff7318 100644 --- a/sys/netinet/tcp_syncache.c +++ b/sys/netinet/tcp_syncache.c @@ -2100,25 +2100,6 @@ syncookie_reseed(void *arg) } /* - * Returns the current number of syncache entries. This number - * will probably change before you get around to calling - * syncache_pcblist. - */ -int -syncache_pcbcount(void) -{ - struct syncache_head *sch; - int count, i; - - for (count = 0, i = 0; i < V_tcp_syncache.hashsize; i++) { - /* No need to lock for a read. */ - sch = &V_tcp_syncache.hashbase[i]; - count += sch->sch_length; - } - return count; -} - -/* * Exports the syncache entries to userland so that netstat can display * them alongside the other sockets. This function is intended to be * called only from tcp_pcblist. diff --git a/sys/netinet/tcp_syncache.h b/sys/netinet/tcp_syncache.h index 9fcbbec..6b12c13 100644 --- a/sys/netinet/tcp_syncache.h +++ b/sys/netinet/tcp_syncache.h @@ -46,7 +46,6 @@ int syncache_add(struct in_conninfo *, struct tcpopt *, void *, void *); void syncache_chkrst(struct in_conninfo *, struct tcphdr *); void syncache_badack(struct in_conninfo *); -int syncache_pcbcount(void); int syncache_pcblist(struct sysctl_req *req, int max_pcbs, int *pcbs_exported); struct syncache { |