Changeset 31833


Ignore:
Timestamp:
Apr 8, 2017, 12:48:24 AM (3 weeks ago)
Author:
brainslayer
Message:

update iperf

Location:
src/router/iperf
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • src/router/iperf/LICENSE

    r29428 r31833  
    1 "iperf, Copyright (c) 2014-2016, The Regents of the University of California,
     1"iperf, Copyright (c) 2014-2017, The Regents of the University of California,
    22through Lawrence Berkeley National Laboratory (subject to receipt of any
    33required approvals from the U.S. Dept. of Energy).  All rights reserved."
  • src/router/iperf/README.md

    r29428 r31833  
    145145------------
    146146
    147 * UDP performance: Some problems have been noticed with iperf3 on the
    148 ESnet 100G testbed at high UDP rates (above 10Gbps).  The symptom is
    149 that on any particular run of iperf3 the receiver reports a loss rate
    150 of about 20%, regardless of the -b option used on the client side.
    151 This problem appears not to be iperf3-specific, and may be due to the
    152 placement of the iperf3 process on a CPU and its relation to the
    153 inbound NIC.  In some cases this problem can be mitigated by an
    154 appropriate use of the CPU affinity (-A) option.  (Issue #55)
     147A set of known issues is maintained on the iperf3 Web pages:
    155148
    156 * The -Z flag sometimes causes the iperf3 client to hang on OSX.
    157 (Issue #129)
    158 
    159 * When specifying the socket buffer size using the "-w" flag on Linux, Linux
    160 doubles the value you pass in. (You can see this using iperf3's debug flag).
    161 But then the CWND does not actually ramp up to the doubled value, but only
    162 to about 75% of the doubled value. This appears to be by design.
    163 
    164 * Although the "-w" flag is documented as setting the (TCP) window
    165 size, it is also used to set the socket buffer size.  This has been
    166 shown to be helpful with high-bitrate UDP tests.
    167 
    168 * On some platforms, it might be necessary to invoke "ldconfig"
    169 manually after doing a "make install" before the iperf3 executable can
    170 find its shared library.  (Issue #153)
    171 
    172 * The results printed on the server side at the end of a test do not
    173 correctly reflect the client-side measurements.  This is due to the
    174 ordering of computing and transferring results between the client
    175 and server.  (Issue #293)
    176 
    177 * The server could have a very short measurement reporting interval at
    178 the end of a test (particularly a UDP test), containing few or no
    179 packets.  This issue is due to an artifact of timing between the
    180 client and server.  (Issue #278)
     149http://software.es.net/iperf/dev.html#known-issues
    181150
    182151Links
     
    195164---------
    196165
    197 iperf, Copyright (c) 2014-2016, The Regents of the University of
     166iperf, Copyright (c) 2014-2017, The Regents of the University of
    198167California, through Lawrence Berkeley National Laboratory (subject
    199168to receipt of any required approvals from the U.S. Dept. of
  • src/router/iperf/RELEASE_NOTES

    r30862 r31833  
     1== iperf 3.1.7 2017-03-06 ==
     2
     3iperf 3.1.7 is functionally identical to iperf 3.1.6.  Its only
     4changes consist of updated documentation files and text in the RPM
     5spec file.
     6
     7== iperf 3.1.6 2017-02-02 ==
     8
     9The release notes for iperf 3.1.6 describe changes, including bug
     10fixes and new functionality, made since iperf 3.1.5.
     11
     12* User-visible changes
     13
     14  * Specifying --fq-rate or --no-fq-socket-pacing on a system where
     15    these options are not supported now generate an error instead of a
     16    warning.  This change makes diagnosing issues related to pacing
     17    more apparent.
     18
     19  * Fixed a bug where two recently-added diagnostic messages spammed
     20    the JSON output on UDP tests.
     21
     22== iperf 3.1.5 2017-01-12 ==
     23
     24The release notes for iperf 3.1.5 describe changes, including bug
     25fixes and new functionality, made since iperf 3.1.4.
     26
     27Compatibility note: Fair-queueing is now specified differently in
     28iperf 3.1.5 than in prior versions (which include 3.1.3 and 3.1.4).
     29
     30Compatibility note: UDP tests may yield different results from all
     31prior versions of iperf3 (through 3.1.4) due to the new default UDP
     32sending size.
     33
     34* User-visible changes
     35
     36  * The fair-queueing per-socket based pacing available on recent
     37    Linux systems has been reimplemented with a different user
     38    interface (#325, #467, #488).  The --bandwidth command-line flag
     39    now controls only the application-level pacing, as was the case in
     40    iperf 3.1.2 and all earlier versions.  Fair-queueing per-socket
     41    based pacing is now controlled via a new --fq-rate command-line
     42    flag.  Note that TCP and UDP tests may use --bandwidth, --fq-rate,
     43    both flags, or neither flag.  SCTP tests currently support
     44    --bandwidth only.  The --no-fq-socket-pacing flag, which was
     45    introduced in iperf 3.1.3, has now been deprecated, and is
     46    equivalent to --fq-rate=0.  iperf3 now reacts more gracefully if
     47    --no-fq-socket-pacing or --fq-rate are specified on platforms that
     48    don't support these options.
     49
     50    For UDP tests, note that the default --bandwidth is 1 Mbps.  Using
     51    the fair-queueing-based pacing will probably require explicitly
     52    setting both --bandwidth and --fq-rate, preferably to the same
     53    value.  (While setting different values for --bandwidth and
     54    --fq-rate can certainly be done, the results can range from
     55    entertaining to perplexing.)
     56
     57  * iperf3 now chooses a more sane default UDP send size (#496, #498).
     58    The former default (8KB) caused IP packet fragmentation on paths
     59    having smaller MTUs (including any Ethernet network not configured
     60    for jumbo frames).  This could have effects ranging from increased
     61    burstiness, to packet loss, to complete failure of the test.
     62    iperf3 now attempts to use the MSS of the control connection to
     63    determine a default UDP send size if no sending length was
     64    explicitly specified with --length.
     65
     66  * Several checks are now made when setting the socket buffer sizes
     67    with the -w option, to verify that the settings have been applied
     68    correctly.  The results of these checks can been seen when the
     69    --debug flag is specified.  (#356)
     70
     71  * A --forceflush flag has been added to flush the output stream
     72    after every statistics reporting interval.
     73
     74* Developer-visible changes
     75
     76  * A systemd service file has been added (#340, #430).
     77
    178== iperf 3.1.4 2016-10-31 ==
    279
  • src/router/iperf/configure

    r30863 r31833  
    11#! /bin/sh
    22# Guess values for system-dependent variables and create Makefiles.
    3 # Generated by GNU Autoconf 2.69 for iperf 3.1.4.
     3# Generated by GNU Autoconf 2.69 for iperf 3.1.7.
    44#
    55# Report bugs to <https://github.com/esnet/iperf>.
     
    591591PACKAGE_NAME='iperf'
    592592PACKAGE_TARNAME='iperf'
    593 PACKAGE_VERSION='3.1.4'
    594 PACKAGE_STRING='iperf 3.1.4'
     593PACKAGE_VERSION='3.1.7'
     594PACKAGE_STRING='iperf 3.1.7'
    595595PACKAGE_BUGREPORT='https://github.com/esnet/iperf'
    596596PACKAGE_URL='http://software.es.net/iperf/'
     
    13141314  # This message is too long to be a string in the A/UX 3.1 sh.
    13151315  cat <<_ACEOF
    1316 \`configure' configures iperf 3.1.4 to adapt to many kinds of systems.
     1316\`configure' configures iperf 3.1.7 to adapt to many kinds of systems.
    13171317
    13181318Usage: $0 [OPTION]... [VAR=VALUE]...
     
    13841384if test -n "$ac_init_help"; then
    13851385  case $ac_init_help in
    1386      short | recursive ) echo "Configuration of iperf 3.1.4:";;
     1386     short | recursive ) echo "Configuration of iperf 3.1.7:";;
    13871387   esac
    13881388  cat <<\_ACEOF
     
    14931493if $ac_init_version; then
    14941494  cat <<\_ACEOF
    1495 iperf configure 3.1.4
     1495iperf configure 3.1.7
    14961496generated by GNU Autoconf 2.69
    14971497
     
    18621862running configure, to aid debugging if configure makes a mistake.
    18631863
    1864 It was created by iperf $as_me 3.1.4, which was
     1864It was created by iperf $as_me 3.1.7, which was
    18651865generated by GNU Autoconf 2.69.  Invocation command line was
    18661866
     
    27372737# Define the identity of the package.
    27382738 PACKAGE='iperf'
    2739  VERSION='3.1.4'
     2739 VERSION='3.1.7'
    27402740
    27412741
     
    1281512815# values after options handling.
    1281612816ac_log="
    12817 This file was extended by iperf $as_me 3.1.4, which was
     12817This file was extended by iperf $as_me 3.1.7, which was
    1281812818generated by GNU Autoconf 2.69.  Invocation command line was
    1281912819
     
    1288212882ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
    1288312883ac_cs_version="\\
    12884 iperf config.status 3.1.4
     12884iperf config.status 3.1.7
    1288512885configured by $0, generated by GNU Autoconf 2.69,
    1288612886  with options \\"\$ac_cs_config\\"
  • src/router/iperf/configure.ac

    r30862 r31833  
    1 # iperf, Copyright (c) 2014, 2015, 2016, The Regents of the University of
     1# iperf, Copyright (c) 2014, 2015, 2016, 2017, The Regents of the University of
    22# California, through Lawrence Berkeley National Laboratory (subject
    33# to receipt of any required approvals from the U.S. Dept. of
     
    2525
    2626# Initialize the autoconf system for the specified tool, version and mailing list
    27 AC_INIT(iperf, 3.1.4, https://github.com/esnet/iperf, iperf, http://software.es.net/iperf/)
     27AC_INIT(iperf, 3.1.7, https://github.com/esnet/iperf, iperf, http://software.es.net/iperf/)
    2828AC_LANG(C)
    2929
  • src/router/iperf/docs/invoking.rst

    r27749 r31833  
    8383   send output to a log file.
    8484
     85   --forceflush
     86   force flushing output at every interval. Used to avoid buffering when sending
     87   output to pipe.
     88
    8589   â€d, ‐‐debug
    8690   emit  debugging  output.  Primarily (perhaps exclusively) of use
  • src/router/iperf/iperf3.spec.in

    r27748 r31833  
    1515
    1616%description
    17 Iperf is a tool to measure maximum TCP bandwidth, allowing the tuning of
    18 various parameters and UDP characteristics. Iperf reports bandwidth, delay
    19 jitter, data-gram loss.
     17iperf3 is a tool for active measurements of the maximum achievable
     18bandwidth between two IP hosts.  It supports tuning of various
     19parameters related to timing, protocols, and buffers.  For each test,
     20it reports the bandwidth, loss, and other parameters.
    2021
    2122%package        devel
  • src/router/iperf/src/iperf.h

    r30862 r31833  
    11/*
    2  * iperf, Copyright (c) 2014, 2015, 2016, The Regents of the University of
     2 * iperf, Copyright (c) 2014, 2015, 2016, 2017, The Regents of the University of
    33 * California, through Lawrence Berkeley National Laboratory (subject
    44 * to receipt of any required approvals from the U.S. Dept. of
     
    111111    int       socket_bufsize;       /* window size for TCP */
    112112    int       blksize;              /* size of read/writes (-l) */
    113     uint64_t  rate;                 /* target data rate */
     113    uint64_t  rate;                 /* target data rate for application pacing*/
     114    uint64_t  fqrate;               /* target data rate for FQ pacing*/
    114115    int       burst;                /* packets per burst */
    115116    int       mss;                  /* for TCP MSS */
     
    232233    int       prot_listener;
    233234
     235    int       ctrl_sck_mss;                     /* MSS for the control channel */
     236
    234237    /* boolean variables for Options */
    235238    int       daemon;                           /* -D option */
     
    243246    int       get_server_output;                /* --get-server-output */
    244247    int       udp_counters_64bit;               /* --use-64-bit-udp-counters */
    245     int       no_fq_socket_pacing;        /* --no-fq-socket-pacing */
     248    int       forceflush; /* --forceflush - flushing output at every interval */
    246249    int       multisend;
    247250
     
    310313#define SEC_TO_NS 1000000000LL  /* too big for enum/const on some platforms */
    311314#define MAX_RESULT_STRING 4096
     315
     316#define UDP_BUFFER_EXTRA 1024
    312317
    313318/* constants for command line arg sanity checks */
  • src/router/iperf/src/iperf3.1

    r30191 r31833  
    1 .TH IPERF 1 "October 2015" ESnet "User Manuals"
     1.TH IPERF3 1 "January 2017" ESnet "User Manuals"
    22.SH NAME
    33iperf3 \- perform network throughput tests
     
    5959send output to a log file.
    6060.TP
     61.BR --forceflush " "
     62force flushing output at every interval.
     63Used to avoid buffering when sending output to pipe.
     64.TP
    6165.BR -d ", " --debug " "
    6266emit debugging output.
     
    104108Setting the target bandwidth to 0 will disable bandwidth limits
    105109(particularly useful for UDP tests).
    106 On platforms supporting the \fCSO_MAX_PACING_RATE\fR socket option
    107 (currently only Linux), fair-queueing socket-level pacing, implemented in
    108 the kernel, will be used.
    109 On other platforms, iperf3 will implement its own rate control.
     110This bandwidth limit is implemented internally inside iperf3, and is
     111available on all platforms.
     112Compare with the \--fq-rate flag.
     113.TP
     114.BR --fq-rate " \fIn\fR[KM]"
     115Set a rate to be used with fair-queueing based socket-level pacing,
     116in bits per second.
     117This pacing (if specified) will be in addition to any pacing due to
     118iperf3's internal bandwidth pacing (\-b flag), and both can be
     119specified for the same test.
     120Only available on platforms supporting the
     121\fCSO_MAX_PACING_RATE\fR socket option (currently only Linux).
     122The default is no fair-queueing based pacing.
    110123.TP
    111124.BR --no-fq-socket-pacing
    112 disable the use of fair-queueing based socket-level pacing with the -b
    113 option, and rely on iperf3's internal rate control.
     125This option is deprecated and will be removed.
     126It is equivalent to specifying --fq-rate=0.
    114127.TP
    115128.BR -t ", " --time " \fIn\fR"
     
    123136.TP
    124137.BR -l ", " --length " \fIn\fR[KM]"
    125 length of buffer to read or write (default 128 KB for TCP, 8KB for UDP)
     138length of buffer to read or write.  For TCP tests, the default value
     139is 128KB.
     140In the case of UDP, iperf3 tries to dynamically determine a reasonable
     141sending size based on the path MTU; if that cannot be determined it
     142uses 1460 bytes as a sending size.
     143For SCTP tests, the default size is 64KB.
    126144.TP
    127145.BR --cport " \fIport\fR"
  • src/router/iperf/src/iperf_api.c

    r30862 r31833  
    11/*
    2  * iperf, Copyright (c) 2014, 2015, 2016, The Regents of the University of
     2 * iperf, Copyright (c) 2014-2017, The Regents of the University of
    33 * California, through Lawrence Berkeley National Laboratory (subject
    44 * to receipt of any required approvals from the U.S. Dept. of
     
    128128
    129129int
     130iperf_get_control_socket_mss(struct iperf_test *ipt)
     131{
     132    return ipt->ctrl_sck_mss;
     133}
     134
     135int
    130136iperf_get_test_omit(struct iperf_test *ipt)
    131137{
     
    145151}
    146152
     153uint64_t
     154iperf_get_test_fqrate(struct iperf_test *ipt)
     155{
     156    return ipt->settings->fqrate;
     157}
     158
    147159int
    148160iperf_get_test_burst(struct iperf_test *ipt)
     
    271283}
    272284
    273 int
    274 iperf_get_no_fq_socket_pacing(struct iperf_test *ipt)
    275 {
    276     return ipt->no_fq_socket_pacing;
    277 }
    278 
    279285/************** Setter routines for some fields inside iperf_test *************/
    280286
     
    331337{
    332338    ipt->settings->rate = rate;
     339}
     340
     341void
     342iperf_set_test_fqrate(struct iperf_test *ipt, uint64_t fqrate)
     343{
     344    ipt->settings->fqrate = fqrate;
    333345}
    334346
     
    446458{
    447459    ipt->one_off = one_off;
    448 }
    449 
    450 void
    451 iperf_set_no_fq_socket_pacing(struct iperf_test *ipt, int no_pacing)
    452 {
    453     ipt->no_fq_socket_pacing = no_pacing;
    454460}
    455461
     
    545551    struct sockaddr_in6 *sa_in6P;
    546552    socklen_t len;
    547     int opt;
    548553
    549554    now_secs = time((time_t*) 0);
     
    586591                cJSON_AddNumberToObject(test->json_start, "tcp_mss", test->settings->mss);
    587592            else {
    588                 len = sizeof(opt);
    589                 getsockopt(test->ctrl_sck, IPPROTO_TCP, TCP_MAXSEG, &opt, &len);
    590                 cJSON_AddNumberToObject(test->json_start, "tcp_mss_default", opt);
     593                cJSON_AddNumberToObject(test->json_start, "tcp_mss_default", test->ctrl_sck_mss);
    591594            }
    592595        }
     
    597600                iprintf(test, "      TCP MSS: %d\n", test->settings->mss);
    598601            else {
    599                 len = sizeof(opt);
    600                 getsockopt(test->ctrl_sck, IPPROTO_TCP, TCP_MAXSEG, &opt, &len);
    601                 iprintf(test, "      TCP MSS: %d (default)\n", opt);
     602                iprintf(test, "      TCP MSS: %d (default)\n", test->ctrl_sck_mss);
    602603            }
    603604        }
     
    666667        {"pidfile", required_argument, NULL, 'I'},
    667668        {"logfile", required_argument, NULL, OPT_LOGFILE},
     669        {"forceflush", no_argument, NULL, OPT_FORCEFLUSH},
    668670        {"get-server-output", no_argument, NULL, OPT_GET_SERVER_OUTPUT},
    669671        {"udp-counters-64bit", no_argument, NULL, OPT_UDP_COUNTERS_64BIT},
    670         {"no-fq-socket-pacing", no_argument, NULL, OPT_NO_FQ_SOCKET_PACING},
     672        {"no-fq-socket-pacing", no_argument, NULL, OPT_NO_FQ_SOCKET_PACING},
     673        {"fq-rate", required_argument, NULL, OPT_FQ_RATE},
    671674        {"debug", no_argument, NULL, 'd'},
    672675        {"help", no_argument, NULL, 'h'},
     
    941944                test->logfile = strdup(optarg);
    942945                break;
     946            case OPT_FORCEFLUSH:
     947                test->forceflush = 1;
     948                break;
    943949            case OPT_GET_SERVER_OUTPUT:
    944950                test->get_server_output = 1;
     
    950956            case OPT_NO_FQ_SOCKET_PACING:
    951957#if defined(HAVE_SO_MAX_PACING_RATE)
    952                 test->no_fq_socket_pacing = 1;
     958                printf("Warning:  --no-fq-socket-pacing is deprecated\n");
     959                test->settings->fqrate = 0;
     960                client_flag = 1;
     961#else /* HAVE_SO_MAX_PACING_RATE */
     962                i_errno = IEUNIMP;
     963                return -1;
     964#endif
     965                break;
     966            case OPT_FQ_RATE:
     967#if defined(HAVE_SO_MAX_PACING_RATE)
     968                test->settings->fqrate = unit_atof_rate(optarg);
     969                client_flag = 1;
    953970#else /* HAVE_SO_MAX_PACING_RATE */
    954971                i_errno = IEUNIMP;
     
    9881005    if (blksize == 0) {
    9891006        if (test->protocol->id == Pudp)
    990             blksize = DEFAULT_UDP_BLKSIZE;
     1007            blksize = 0;        /* try to dynamically determine from MSS */
    9911008        else if (test->protocol->id == Psctp)
    9921009            blksize = DEFAULT_SCTP_BLKSIZE;
     
    9941011            blksize = DEFAULT_TCP_BLKSIZE;
    9951012    }
    996     if (blksize <= 0 || blksize > MAX_BLOCKSIZE) {
     1013    if ((test->protocol->id != Pudp && blksize <= 0)
     1014        || blksize > MAX_BLOCKSIZE) {
    9971015        i_errno = IEBLOCKSIZE;
    9981016        return -1;
     
    10871105        streams_active = 0;
    10881106        SLIST_FOREACH(sp, &test->streams, streams) {
    1089             if (! test->no_fq_socket_pacing ||
    1090                 (sp->green_light &&
     1107            if ((sp->green_light &&
    10911108                 (write_setP == NULL || FD_ISSET(sp->socket, write_setP)))) {
    10921109                if ((r = sp->snd(sp)) < 0) {
     
    13211338        if (test->settings->rate)
    13221339            cJSON_AddNumberToObject(j, "bandwidth", test->settings->rate);
     1340        if (test->settings->fqrate)
     1341            cJSON_AddNumberToObject(j, "fqrate", test->settings->fqrate);
    13231342        if (test->settings->burst)
    13241343            cJSON_AddNumberToObject(j, "burst", test->settings->burst);
     
    13371356        if (test->udp_counters_64bit)
    13381357            cJSON_AddNumberToObject(j, "udp_counters_64bit", iperf_get_test_udp_counters_64bit(test));
    1339         if (test->no_fq_socket_pacing)
    1340             cJSON_AddNumberToObject(j, "no_fq_socket_pacing", iperf_get_no_fq_socket_pacing(test));
    13411358
    13421359        cJSON_AddStringToObject(j, "client_version", IPERF_VERSION);
     
    14031420        if ((j_p = cJSON_GetObjectItem(j, "bandwidth")) != NULL)
    14041421            test->settings->rate = j_p->valueint;
     1422        if ((j_p = cJSON_GetObjectItem(j, "fqrate")) != NULL)
     1423            test->settings->fqrate = j_p->valueint;
    14051424        if ((j_p = cJSON_GetObjectItem(j, "burst")) != NULL)
    14061425            test->settings->burst = j_p->valueint;
     
    14191438        if ((j_p = cJSON_GetObjectItem(j, "udp_counters_64bit")) != NULL)
    14201439            iperf_set_test_udp_counters_64bit(test, 1);
    1421         if ((j_p = cJSON_GetObjectItem(j, "no_fq_socket_pacing")) != NULL)
    1422             iperf_set_no_fq_socket_pacing(test, 1);
    14231440       
    14241441        if (test->sender && test->protocol->id == Ptcp && has_tcpinfo_retransmits())
     
    18561873    testp->num_streams = 1;
    18571874
    1858 #if ! defined(HAVE_SO_MAX_PACING_RATE)
    1859     testp->no_fq_socket_pacing = 1;
    1860 #endif
    1861 
    18621875    testp->settings->domain = AF_UNSPEC;
    18631876    testp->settings->unit_format = 'a';
     
    18651878    testp->settings->blksize = DEFAULT_TCP_BLKSIZE;
    18661879    testp->settings->rate = 0;
     1880    testp->settings->fqrate = 0;
    18671881    testp->settings->burst = 0;
    18681882    testp->settings->mss = 0;
     
    26942708    }
    26952709
    2696     if (test->logfile)
     2710    if (test->logfile || test->forceflush)
    26972711        iflush(test);
    26982712}
  • src/router/iperf/src/iperf_api.h

    r30191 r31833  
    11/*
    2  * iperf, Copyright (c) 2014, 2015, 2016, The Regents of the University of
     2 * iperf, Copyright (c) 2014-2017, The Regents of the University of
    33 * California, through Lawrence Berkeley National Laboratory (subject
    44 * to receipt of any required approvals from the U.S. Dept. of
     
    4040#define Pudp SOCK_DGRAM
    4141#define Psctp 12
    42 #define DEFAULT_UDP_BLKSIZE 8192
     42#define DEFAULT_UDP_BLKSIZE 1460 /* default is dynamically set, else this */
    4343#define DEFAULT_TCP_BLKSIZE (128 * 1024)  /* default read/write block size */
    4444#define DEFAULT_SCTP_BLKSIZE (64 * 1024)
     
    5151#define OPT_CLIENT_PORT 5
    5252#define OPT_NUMSTREAMS 6
    53 #define OPT_NO_FQ_SOCKET_PACING 9
     53#define OPT_FORCEFLUSH 7
     54#define OPT_NO_FQ_SOCKET_PACING 9 /* UNUSED */
     55#define OPT_FQ_RATE 10
    5456
    5557/* states */
     
    334336    IESETSCTPBINDX= 139,    // Unable to process sctp_bindx() parameters
    335337    IESETPACING= 140,       // Unable to set socket pacing rate
     338    IESETBUF2= 141,         // Socket buffer size incorrect (written value != read value)
    336339    /* Stream errors */
    337340    IECREATESTREAM = 200,   // Unable to create a new stream (check herror/perror)
  • src/router/iperf/src/iperf_client_api.c

    r30862 r31833  
    11/*
    2  * iperf, Copyright (c) 2014, 2015, 2016, The Regents of the University of
     2 * iperf, Copyright (c) 2014-2017, The Regents of the University of
    33 * California, through Lawrence Berkeley National Laboratory (subject
    44 * to receipt of any required approvals from the U.S. Dept. of
     
    7676            }
    7777            {
    78                 int len = TCP_CA_NAME_MAX;
     78                socklen_t len = TCP_CA_NAME_MAX;
    7979                char ca[TCP_CA_NAME_MAX + 1];
    8080                if (getsockopt(s, IPPROTO_TCP, TCP_CONGESTION, ca, &len) < 0) {
     
    335335    FD_SET(test->ctrl_sck, &test->read_set);
    336336    if (test->ctrl_sck > test->max_fd) test->max_fd = test->ctrl_sck;
     337
     338    int opt;
     339    socklen_t len;
     340
     341    len = sizeof(opt);
     342    if (getsockopt(test->ctrl_sck, IPPROTO_TCP, TCP_MAXSEG, &opt, &len) < 0) {
     343        test->ctrl_sck_mss = 0;
     344    }
     345    else {
     346        test->ctrl_sck_mss = opt;
     347    }
     348
     349    if (test->verbose) {
     350        printf("Control connection MSS %d\n", test->ctrl_sck_mss);
     351    }
     352
     353    /*
     354     * If we're doing a UDP test and the block size wasn't explicitly
     355     * set, then use the known MSS of the control connection to pick
     356     * an appropriate default.  If we weren't able to get the
     357     * MSS for some reason, then default to something that should
     358     * work on non-jumbo-frame Ethernet networks.  The goal is to
     359     * pick a reasonable default that is large but should get from
     360     * sender to receiver without any IP fragmentation.
     361     *
     362     * We assume that the control connection is routed the same as the
     363     * data packets (thus has the same PMTU).  Also in the case of
     364     * --reverse tests, we assume that the MTU is the same in both
     365     * directions.  Note that even if the algorithm guesses wrong,
     366     * the user always has the option to override.
     367     */
     368    if (test->protocol->id == Pudp) {
     369        if (test->settings->blksize == 0) {
     370            if (test->ctrl_sck_mss) {
     371                test->settings->blksize = test->ctrl_sck_mss;
     372            }
     373            else {
     374                test->settings->blksize = DEFAULT_UDP_BLKSIZE;
     375            }
     376            if (test->verbose) {
     377                printf("Setting UDP block size to %d\n", test->settings->blksize);
     378            }
     379        }
     380
     381        /*
     382         * Regardless of whether explicitly or implicitly set, if the
     383         * block size is larger than the MSS, print a warning.
     384         */
     385        if (test->settings->blksize > test->ctrl_sck_mss) {
     386            char str[128];
     387            snprintf(str, sizeof(str),
     388                     "Warning:  UDP block size %d exceeds TCP MSS %d, may result in fragmentation / drops", test->settings->blksize, test->ctrl_sck_mss);
     389            warning(str);
     390        }
     391    }
    337392
    338393    return 0;
  • src/router/iperf/src/iperf_error.c

    r30191 r31833  
    360360            perr = 1;
    361361            break;
     362        case IESETBUF2:
     363            snprintf(errstr, len, "socket buffer size not set correctly");
     364            break;
     365       
    362366    }
    363367
  • src/router/iperf/src/iperf_locale.c

    r30191 r31833  
    109109                           "  -J, --json                output in JSON format\n"
    110110                           "  --logfile f               send output to a log file\n"
     111                           "  --forceflush              force flushing output at every interval\n"
    111112                           "  -d, --debug               emit debugging output\n"
    112113                           "  -v, --version             show version information and quit\n"
     
    128129                           "                            (default %d Mbit/sec for UDP, unlimited for TCP)\n"
    129130                           "                            (optional slash and packet count for burst mode)\n"
     131#if defined(HAVE_SO_MAX_PACING_RATE)
     132                           "  --fq-rate #[KMG]          enable fair-queuing based socket pacing in\n"
     133                           "                            bits/sec (Linux only)\n"
     134#endif
    130135                           "  -t, --time      #         time in seconds to transmit for (default %d secs)\n"
    131136                           "  -n, --bytes     #[KMG]    number of bytes to transmit (instead of -t)\n"
    132137                           "  -k, --blockcount #[KMG]   number of blocks (packets) to transmit (instead of -t or -n)\n"
    133138                           "  -l, --len       #[KMG]    length of buffer to read or write\n"
    134                            "                            (default %d KB for TCP, %d KB for UDP)\n"
     139                           "                            (default %d KB for TCP, dynamic or %d for UDP)\n"
    135140                           "  --cport         <port>    bind to a specific client port (TCP and UDP, default: ephemeral port)\n"
    136141                           "  -P, --parallel  #         number of parallel client streams to run\n"
     
    153158                           "  --get-server-output       get results from server\n"
    154159                           "  --udp-counters-64bit      use 64-bit counters in UDP test packets\n"
    155 #if defined(HAVE_SO_MAX_PACING_RATE)
    156                            "  --no-fq-socket-pacing     disable fair-queuing based socket pacing\n"
    157                            "                            (Linux only)\n"
    158 #endif
    159160
    160161#ifdef NOT_YET_SUPPORTED /* still working on these */
  • src/router/iperf/src/iperf_tcp.c

    r30862 r31833  
    237237        }
    238238#if defined(HAVE_SO_MAX_PACING_RATE)
    239     /* If socket pacing is available and not disabled, try it. */
    240     if (! test->no_fq_socket_pacing) {
     239    /* If fq socket pacing is specified, enable it. */
     240    if (test->settings->fqrate) {
    241241        /* Convert bits per second to bytes per second */
     242        unsigned int fqrate = test->settings->fqrate / 8;
     243        if (fqrate > 0) {
     244            if (test->debug) {
     245                printf("Setting fair-queue socket pacing to %u\n", fqrate);
     246            }
     247            if (setsockopt(s, SOL_SOCKET, SO_MAX_PACING_RATE, &fqrate, sizeof(fqrate)) < 0) {
     248                warning("Unable to set socket pacing");
     249            }
     250        }
     251    }
     252#endif /* HAVE_SO_MAX_PACING_RATE */
     253    {
    242254        unsigned int rate = test->settings->rate / 8;
    243255        if (rate > 0) {
    244256            if (test->debug) {
    245                 printf("Setting fair-queue socket pacing to %u\n", rate);
    246             }
    247             if (setsockopt(s, SOL_SOCKET, SO_MAX_PACING_RATE, &rate, sizeof(rate)) < 0) {
    248                 warning("Unable to set socket pacing, using application pacing instead");
    249                 test->no_fq_socket_pacing = 1;
    250             }
    251         }
    252     }
    253 #endif /* HAVE_SO_MAX_PACING_RATE */
     257                printf("Setting application pacing to %u\n", rate);
     258            }
     259        }
     260    }
    254261        opt = 1;
    255262        if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)) < 0) {
     
    318325    char portstr[6];
    319326    int s, opt;
     327    socklen_t optlen;
    320328    int saved_errno;
    321329
     
    407415        }
    408416    }
     417
     418    /* Read back and verify the sender socket buffer size */
     419    optlen = sizeof(opt);
     420    if (getsockopt(s, SOL_SOCKET, SO_SNDBUF, &opt, &optlen) < 0) {
     421        saved_errno = errno;
     422        close(s);
     423        freeaddrinfo(server_res);
     424        errno = saved_errno;
     425        i_errno = IESETBUF;
     426        return -1;
     427    }
    409428    if (test->debug) {
    410         socklen_t optlen = sizeof(opt);
    411         if (getsockopt(s, SOL_SOCKET, SO_SNDBUF, &opt, &optlen) < 0) {
    412             saved_errno = errno;
    413             close(s);
    414             freeaddrinfo(server_res);
    415             errno = saved_errno;
    416             i_errno = IESETBUF;
    417             return -1;
    418         }
    419         printf("SO_SNDBUF is %u\n", opt);
    420     }
     429        printf("SNDBUF is %u, expecting %u\n", opt, test->settings->socket_bufsize);
     430    }
     431    if (test->settings->socket_bufsize && test->settings->socket_bufsize > opt) {
     432        i_errno = IESETBUF2;
     433        return -1;
     434    }
     435
     436    /* Read back and verify the receiver socket buffer size */
     437    optlen = sizeof(opt);
     438    if (getsockopt(s, SOL_SOCKET, SO_RCVBUF, &opt, &optlen) < 0) {
     439        saved_errno = errno;
     440        close(s);
     441        freeaddrinfo(server_res);
     442        errno = saved_errno;
     443        i_errno = IESETBUF;
     444        return -1;
     445    }
     446    if (test->debug) {
     447        printf("RCVBUF is %u, expecting %u\n", opt, test->settings->socket_bufsize);
     448    }
     449    if (test->settings->socket_bufsize && test->settings->socket_bufsize > opt) {
     450        i_errno = IESETBUF2;
     451        return -1;
     452    }
     453
    421454#if defined(HAVE_FLOWLABEL)
    422455    if (test->settings->flowlabel) {
     
    465498
    466499#if defined(HAVE_SO_MAX_PACING_RATE)
    467     /* If socket pacing is available and not disabled, try it. */
    468     if (! test->no_fq_socket_pacing) {
     500    /* If socket pacing is specified try to enable it. */
     501    if (test->settings->fqrate) {
    469502        /* Convert bits per second to bytes per second */
     503        unsigned int fqrate = test->settings->fqrate / 8;
     504        if (fqrate > 0) {
     505            if (test->debug) {
     506                printf("Setting fair-queue socket pacing to %u\n", fqrate);
     507            }
     508            if (setsockopt(s, SOL_SOCKET, SO_MAX_PACING_RATE, &fqrate, sizeof(fqrate)) < 0) {
     509                warning("Unable to set socket pacing");
     510            }
     511        }
     512    }
     513#endif /* HAVE_SO_MAX_PACING_RATE */
     514    {
    470515        unsigned int rate = test->settings->rate / 8;
    471516        if (rate > 0) {
    472517            if (test->debug) {
    473                 printf("Socket pacing set to %u\n", rate);
    474             }
    475             if (setsockopt(s, SOL_SOCKET, SO_MAX_PACING_RATE, &rate, sizeof(rate)) < 0) {
    476                 warning("Unable to set socket pacing, using application pacing instead");
    477                 test->no_fq_socket_pacing = 1;
    478             }
    479         }
    480     }
    481 #endif /* HAVE_SO_MAX_PACING_RATE */
     518                printf("Setting application pacing to %u\n", rate);
     519            }
     520        }
     521    }
    482522
    483523    if (connect(s, (struct sockaddr *) server_res->ai_addr, server_res->ai_addrlen) < 0 && errno != EINPROGRESS) {
  • src/router/iperf/src/iperf_udp.c

    r30191 r31833  
    11/*
    2  * iperf, Copyright (c) 2014, 2016, The Regents of the University of
     2 * iperf, Copyright (c) 2014, 2016, 2017, The Regents of the University of
    33 * California, through Lawrence Berkeley National Laboratory (subject
    44 * to receipt of any required approvals from the U.S. Dept. of
     
    195195
    196196/*
    197  * iperf_udp_accept
    198  *
    199  * Accepts a new UDP "connection"
    200  */
    201 int
    202 iperf_udp_accept(struct iperf_test *test)
    203 {
    204     struct sockaddr_storage sa_peer;
    205     int       buf;
    206     socklen_t len;
    207     int       sz, s;
    208 
    209     /*
    210      * Get the current outstanding socket.  This socket will be used to handle
    211      * data transfers and a new "listening" socket will be created.
    212      */
    213     s = test->prot_listener;
    214 
    215     /*
    216      * Grab the UDP packet sent by the client.  From that we can extract the
    217      * client's address, and then use that information to bind the remote side
    218      * of the socket to the client.
    219      */
    220     len = sizeof(sa_peer);
    221     if ((sz = recvfrom(test->prot_listener, &buf, sizeof(buf), 0, (struct sockaddr *) &sa_peer, &len)) < 0) {
    222         i_errno = IESTREAMACCEPT;
    223         return -1;
    224     }
    225 
    226     if (connect(s, (struct sockaddr *) &sa_peer, len) < 0) {
    227         i_errno = IESTREAMACCEPT;
    228         return -1;
    229     }
     197 * Set and verify socket buffer sizes.
     198 * Return 0 if no error, -1 if an error, +1 if socket buffers are
     199 * potentially too small to hold a message.
     200 */
     201int
     202iperf_udp_buffercheck(struct iperf_test *test, int s)
     203{
     204    int rc = 0;
    230205
    231206    /*
     
    234209     */
    235210    int opt;
     211    socklen_t optlen;
     212   
    236213    if ((opt = test->settings->socket_bufsize)) {
    237214        if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, &opt, sizeof(opt)) < 0) {
     
    245222    }
    246223
     224    /* Read back and verify the sender socket buffer size */
     225    optlen = sizeof(opt);
     226    if (getsockopt(s, SOL_SOCKET, SO_SNDBUF, &opt, &optlen) < 0) {
     227        i_errno = IESETBUF;
     228        return -1;
     229    }
     230    if (test->debug) {
     231        printf("SNDBUF is %u, expecting %u\n", opt, test->settings->socket_bufsize);
     232    }
     233    if (test->settings->socket_bufsize && test->settings->socket_bufsize > opt) {
     234        i_errno = IESETBUF2;
     235        return -1;
     236    }
     237    if (test->settings->blksize > opt) {
     238        char str[80];
     239        snprintf(str, sizeof(str),
     240                 "Block size %d > sending socket buffer size %d",
     241                 test->settings->blksize, opt);
     242        warning(str);
     243        rc = 1;
     244    }
     245
     246    /* Read back and verify the receiver socket buffer size */
     247    optlen = sizeof(opt);
     248    if (getsockopt(s, SOL_SOCKET, SO_RCVBUF, &opt, &optlen) < 0) {
     249        i_errno = IESETBUF;
     250        return -1;
     251    }
     252    if (test->debug) {
     253        printf("RCVBUF is %u, expecting %u\n", opt, test->settings->socket_bufsize);
     254    }
     255    if (test->settings->socket_bufsize && test->settings->socket_bufsize > opt) {
     256        i_errno = IESETBUF2;
     257        return -1;
     258    }
     259    if (test->settings->blksize > opt) {
     260        char str[80];
     261        snprintf(str, sizeof(str),
     262                 "Block size %d > receiving socket buffer size %d",
     263                 test->settings->blksize, opt);
     264        warning(str);
     265        rc = 1;
     266    }
     267    return rc;
     268}
     269
     270/*
     271 * iperf_udp_accept
     272 *
     273 * Accepts a new UDP "connection"
     274 */
     275int
     276iperf_udp_accept(struct iperf_test *test)
     277{
     278    struct sockaddr_storage sa_peer;
     279    int       buf;
     280    socklen_t len;
     281    int       sz, s;
     282    int       rc;
     283
     284    /*
     285     * Get the current outstanding socket.  This socket will be used to handle
     286     * data transfers and a new "listening" socket will be created.
     287     */
     288    s = test->prot_listener;
     289
     290    /*
     291     * Grab the UDP packet sent by the client.  From that we can extract the
     292     * client's address, and then use that information to bind the remote side
     293     * of the socket to the client.
     294     */
     295    len = sizeof(sa_peer);
     296    if ((sz = recvfrom(test->prot_listener, &buf, sizeof(buf), 0, (struct sockaddr *) &sa_peer, &len)) < 0) {
     297        i_errno = IESTREAMACCEPT;
     298        return -1;
     299    }
     300
     301    if (connect(s, (struct sockaddr *) &sa_peer, len) < 0) {
     302        i_errno = IESTREAMACCEPT;
     303        return -1;
     304    }
     305
     306    /* Check and set socket buffer sizes */
     307    rc = iperf_udp_buffercheck(test, s);
     308    if (rc < 0)
     309        /* error */
     310        return rc;
     311    /*
     312     * If the socket buffer was too small, but it was the default
     313     * size, then try explicitly setting it to something larger.
     314     */
     315    if (rc > 0) {
     316        if (test->settings->socket_bufsize == 0) {
     317            int bufsize = test->settings->blksize + UDP_BUFFER_EXTRA;
     318            printf("Increasing socket buffer size to %d\n",
     319                bufsize);
     320            test->settings->socket_bufsize = bufsize;
     321            rc = iperf_udp_buffercheck(test, s);
     322            if (rc < 0)
     323                return rc;
     324        }
     325    }
     326       
    247327#if defined(HAVE_SO_MAX_PACING_RATE)
    248     /* If socket pacing is available and not disabled, try it. */
    249     if (! test->no_fq_socket_pacing) {
     328    /* If socket pacing is specified, try it. */
     329    if (test->settings->fqrate) {
    250330        /* Convert bits per second to bytes per second */
     331        unsigned int fqrate = test->settings->fqrate / 8;
     332        if (fqrate > 0) {
     333            if (test->debug) {
     334                printf("Setting fair-queue socket pacing to %u\n", fqrate);
     335            }
     336            if (setsockopt(s, SOL_SOCKET, SO_MAX_PACING_RATE, &fqrate, sizeof(fqrate)) < 0) {
     337                warning("Unable to set socket pacing");
     338            }
     339        }
     340    }
     341#endif /* HAVE_SO_MAX_PACING_RATE */
     342    {
    251343        unsigned int rate = test->settings->rate / 8;
    252344        if (rate > 0) {
    253345            if (test->debug) {
    254                 printf("Setting fair-queue socket pacing to %u\n", rate);
    255             }
    256             if (setsockopt(s, SOL_SOCKET, SO_MAX_PACING_RATE, &rate, sizeof(rate)) < 0) {
    257                 warning("Unable to set socket pacing, using application pacing instead");
    258                 test->no_fq_socket_pacing = 1;
     346                printf("Setting application pacing to %u\n", rate);
    259347            }
    260348        }
    261349    }
    262 #endif /* HAVE_SO_MAX_PACING_RATE */
    263350
    264351    /*
     
    321408    struct timeval tv;
    322409#endif
     410    int rc;
    323411
    324412    /* Create and bind our local socket. */
     
    328416    }
    329417
    330     /*
    331      * Set socket buffer size if requested.  Do this for both sending and
    332      * receiving so that we can cover both normal and --reverse operation.
    333      */
    334     int opt;
    335     if ((opt = test->settings->socket_bufsize)) {
    336         if (setsockopt(s, SOL_SOCKET, SO_RCVBUF, &opt, sizeof(opt)) < 0) {
    337             i_errno = IESETBUF;
    338             return -1;
    339         }
    340         if (setsockopt(s, SOL_SOCKET, SO_SNDBUF, &opt, sizeof(opt)) < 0) {
    341             i_errno = IESETBUF;
    342             return -1;
    343         }
    344     }
    345 
     418    /* Check and set socket buffer sizes */
     419    rc = iperf_udp_buffercheck(test, s);
     420    if (rc < 0)
     421        /* error */
     422        return rc;
     423    /*
     424     * If the socket buffer was too small, but it was the default
     425     * size, then try explicitly setting it to something larger.
     426     */
     427    if (rc > 0) {
     428        if (test->settings->socket_bufsize == 0) {
     429            int bufsize = test->settings->blksize + UDP_BUFFER_EXTRA;
     430            printf("Increasing socket buffer size to %d\n",
     431                bufsize);
     432            test->settings->socket_bufsize = bufsize;
     433            rc = iperf_udp_buffercheck(test, s);
     434            if (rc < 0)
     435                return rc;
     436        }
     437    }
     438       
    346439#if defined(HAVE_SO_MAX_PACING_RATE)
    347440    /* If socket pacing is available and not disabled, try it. */
    348     if (! test->no_fq_socket_pacing) {
     441    if (test->settings->fqrate) {
    349442        /* Convert bits per second to bytes per second */
     443        unsigned int fqrate = test->settings->fqrate / 8;
     444        if (fqrate > 0) {
     445            if (test->debug) {
     446                printf("Setting fair-queue socket pacing to %u\n", fqrate);
     447            }
     448            if (setsockopt(s, SOL_SOCKET, SO_MAX_PACING_RATE, &fqrate, sizeof(fqrate)) < 0) {
     449                warning("Unable to set socket pacing");
     450            }
     451        }
     452    }
     453#endif /* HAVE_SO_MAX_PACING_RATE */
     454    {
    350455        unsigned int rate = test->settings->rate / 8;
    351456        if (rate > 0) {
    352457            if (test->debug) {
    353                 printf("Setting fair-queue socket pacing to %u\n", rate);
    354             }
    355             if (setsockopt(s, SOL_SOCKET, SO_MAX_PACING_RATE, &rate, sizeof(rate)) < 0) {
    356                 warning("Unable to set socket pacing, using application pacing instead");
    357                 test->no_fq_socket_pacing = 1;
     458                printf("Setting application pacing to %u\n", rate);
    358459            }
    359460        }
    360461    }
    361 #endif /* HAVE_SO_MAX_PACING_RATE */
    362462
    363463#ifdef SO_RCVTIMEO
Note: See TracChangeset for help on using the changeset viewer.