Commit bd60438e authored by Willem de Bruijn's avatar Willem de Bruijn Committed by David S. Miller

selftests/net: report rcv_mss in tcp_mmap

tcp_mmap tests TCP_ZEROCOPY_RECEIVE. If 0% of data is received using
mmap, this may be due to mss. Report rcv_mss to identify this cause.

Output of a run failed due to too small mss:

    received 32768 MB (0 % mmap'ed) in 8.40458 s, 32.7057 Gbit
      cpu usage user:0.027922 sys:8.21126, 251.44 usec per MB, 3252 c-switches, rcv_mss 1428

Output on a successful run:

    received 32768 MB (99.9507 % mmap'ed) in 4.69023 s, 58.6064 Gbit
      cpu usage user:0.029172 sys:2.56105, 79.0473 usec per MB, 57591 c-switches, rcv_mss 4096
Suggested-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarWillem de Bruijn <willemb@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 27bcd122
......@@ -153,6 +153,19 @@ static void *mmap_large_buffer(size_t need, size_t *allocated)
return buffer;
}
static uint32_t tcp_info_get_rcv_mss(int fd)
{
socklen_t sz = sizeof(struct tcp_info);
struct tcp_info info;
if (getsockopt(fd, IPPROTO_TCP, TCP_INFO, &info, &sz)) {
fprintf(stderr, "Error fetching TCP_INFO\n");
return 0;
}
return info.tcpi_rcv_mss;
}
void *child_thread(void *arg)
{
unsigned char digest[SHA256_DIGEST_LENGTH];
......@@ -288,7 +301,7 @@ void *child_thread(void *arg)
total_usec = 1000000*ru.ru_utime.tv_sec + ru.ru_utime.tv_usec +
1000000*ru.ru_stime.tv_sec + ru.ru_stime.tv_usec;
printf("received %lg MB (%lg %% mmap'ed) in %lg s, %lg Gbit\n"
" cpu usage user:%lg sys:%lg, %lg usec per MB, %lu c-switches\n",
" cpu usage user:%lg sys:%lg, %lg usec per MB, %lu c-switches, rcv_mss %u\n",
total / (1024.0 * 1024.0),
100.0*total_mmap/total,
(double)delta_usec / 1000000.0,
......@@ -296,7 +309,8 @@ void *child_thread(void *arg)
(double)ru.ru_utime.tv_sec + (double)ru.ru_utime.tv_usec / 1000000.0,
(double)ru.ru_stime.tv_sec + (double)ru.ru_stime.tv_usec / 1000000.0,
(double)total_usec/mb,
ru.ru_nvcsw);
ru.ru_nvcsw,
tcp_info_get_rcv_mss(fd));
}
error:
munmap(buffer, buffer_sz);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment