diff options
author | Bruce A. Mah <bmah@es.net> | 2013-12-19 13:37:50 -0800 |
---|---|---|
committer | Bruce A. Mah <bmah@es.net> | 2013-12-19 13:37:50 -0800 |
commit | dcd7b32b155ada9aa64521db9c6bd9dc5fec8926 (patch) | |
tree | ef002d2db91312aa74b2375c5865a3491695a648 /src/tcp_info.c | |
parent | 310bd9241032db214eb28a0c5c1c7b60c4a4fd25 (diff) | |
download | iperf3-dcd7b32b155ada9aa64521db9c6bd9dc5fec8926.tar.gz |
Follow-on to 4cfce137e89c based on some feedback and experience.
Rip out the tcpi_sacked support...it doesn't really keep a cumulative
total of SACKs received like we thought it did (it's instantaneous
state).
Convert tcpi_snd_cwnd (originally expressed in segments) to octets before
printing.
Re-work internal APIs for functions to get stuff out of tcp_info...rather
than doing a getsockopt() call per value, grab the values out of a
saved copy of the tcp_info structure (which we were getting in almost
every case anyway).
Issue: 99 (Additional TCP_INFO items)
Diffstat (limited to 'src/tcp_info.c')
-rw-r--r-- | src/tcp_info.c | 63 |
1 files changed, 9 insertions, 54 deletions
diff --git a/src/tcp_info.c b/src/tcp_info.c index 01f1acb..dd07ef3 100644 --- a/src/tcp_info.c +++ b/src/tcp_info.c @@ -86,80 +86,35 @@ save_tcpinfo(struct iperf_stream *sp, struct iperf_interval_results *irp) /*************************************************************/ long -get_total_retransmits(int socket) +get_total_retransmits(struct iperf_interval_results *irp) { -#if defined(linux) || defined(__FreeBSD__) - struct tcp_info ti; - socklen_t l = sizeof(ti); - - if (getsockopt(socket, IPPROTO_TCP, TCP_INFO, (void *)&ti, &l) < 0) - return -1; - #if defined(linux) && defined(TCP_MD5SIG) - return ti.tcpi_total_retrans; + return irp->tcpInfo.tcpi_total_retrans; #else #if defined(__FreeBSD__) && __FreeBSD_version >= 600000 - return ti.__tcpi_retransmits; + return irp->tcpInfo.__tcpi_retransmits; #else return -1; #endif #endif - -#else - return -1; -#endif -} - -/*************************************************************/ -long -get_sacks(int socket) -{ -#if defined(linux) || defined(__FreeBSD__) - struct tcp_info ti; - socklen_t l = sizeof(ti); - - if (getsockopt(socket, IPPROTO_TCP, TCP_INFO, (void *)&ti, &l) < 0) - return -1; - -#if defined(linux) && defined(TCP_MD5SIG) - return ti.tcpi_sacked; -#else -#if defined(__FreeBSD__) && __FreeBSD_version >= 600000 - return ti.__tcpi_sacked; -#else - return -1; -#endif -#endif - -#else - return -1; -#endif } /*************************************************************/ +/* + * Return snd_cwnd in octets. + */ long -get_snd_cwnd(int socket) +get_snd_cwnd(struct iperf_interval_results *irp) { -#if defined(linux) || defined(__FreeBSD__) - struct tcp_info ti; - socklen_t l = sizeof(ti); - - if (getsockopt(socket, IPPROTO_TCP, TCP_INFO, (void *)&ti, &l) < 0) - return -1; - #if defined(linux) && defined(TCP_MD5SIG) - return ti.tcpi_snd_cwnd; + return irp->tcpInfo.tcpi_snd_cwnd * irp->tcpInfo.tcpi_snd_mss; #else #if defined(__FreeBSD__) && __FreeBSD_version >= 600000 - return ti.tcpi_snd_cwnd; + return irp->tcpInfo.tcpi_snd_cwnd * irp->tcpInfo.tcpi_snd_mss; #else return -1; #endif #endif - -#else - return -1; -#endif } #ifdef notdef |