Not a full test-case yet, but allows triggering the UDP GSO code path. Signed-off-by: Paolo Abeni <pab...@redhat.com> --- tools/testing/selftests/net/udpgso_bench_rx.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/net/udpgso_bench_rx.c b/tools/testing/selftests/net/udpgso_bench_rx.c index 727cf67a3f75..f8bb7ea6bd25 100644 --- a/tools/testing/selftests/net/udpgso_bench_rx.c +++ b/tools/testing/selftests/net/udpgso_bench_rx.c @@ -31,9 +31,14 @@ #include <sys/wait.h> #include <unistd.h> +#ifndef UDP_SEGMENT +#define UDP_SEGMENT 103 +#endif + static int cfg_port = 8000; static bool cfg_tcp; static bool cfg_verify; +static bool cfg_gro_segment; static bool interrupted; static unsigned long packets, bytes; @@ -199,10 +204,13 @@ static void parse_opts(int argc, char **argv) { int c; - while ((c = getopt(argc, argv, "ptv")) != -1) { + while ((c = getopt(argc, argv, "p:Stv")) != -1) { switch (c) { case 'p': - cfg_port = htons(strtoul(optarg, NULL, 0)); + cfg_port = strtoul(optarg, NULL, 0); + break; + case 'S': + cfg_gro_segment = true; break; case 't': cfg_tcp = true; @@ -227,6 +235,12 @@ static void do_recv(void) fd = do_socket(cfg_tcp); + if (cfg_gro_segment) { + int val = 1; + if (setsockopt(fd, IPPROTO_UDP, UDP_SEGMENT, &val, sizeof(val))) + error(1, errno, "setsockopt UDP_SEGMENT"); + } + treport = gettimeofday_ms() + 1000; do { do_poll(fd); -- 2.17.1