selftests: extend zerocopy tests to udp
authorWillem de Bruijn <willemb@google.com>
Fri, 30 Nov 2018 20:32:41 +0000 (15:32 -0500)
committerDavid S. Miller <davem@davemloft.net>
Mon, 3 Dec 2018 23:58:32 +0000 (15:58 -0800)
Both msg_zerocopy and udpgso_bench have udp zerocopy variants.
Exercise these as part of the standard kselftest run.

With udp, msg_zerocopy has no control channel. Ensure that the
receiver exits after the sender by accounting for the initial
delay in starting them (in msg_zerocopy.sh).

Signed-off-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/net/msg_zerocopy.c
tools/testing/selftests/net/msg_zerocopy.sh
tools/testing/selftests/net/udpgso_bench.sh

index 406cc70c571dea0c1bfef19165e8cfa251a2cf39..4b02933cab8aa90e9f678739bfe9031a19079341 100644 (file)
@@ -651,12 +651,13 @@ static void do_flush_datagram(int fd, int type)
 
 static void do_rx(int domain, int type, int protocol)
 {
+       const int cfg_receiver_wait_ms = 400;
        uint64_t tstop;
        int fd;
 
        fd = do_setup_rx(domain, type, protocol);
 
-       tstop = gettimeofday_ms() + cfg_runtime_ms;
+       tstop = gettimeofday_ms() + cfg_runtime_ms + cfg_receiver_wait_ms;
        do {
                if (type == SOCK_STREAM)
                        do_flush_tcp(fd);
index c43c6debda06913ab54542e5fd91c33d4f23b297..825ffec85cea3e23cd672541bb331302f6c66aa0 100755 (executable)
@@ -25,6 +25,8 @@ readonly path_sysctl_mem="net.core.optmem_max"
 if [[ "$#" -eq "0" ]]; then
        $0 4 tcp -t 1
        $0 6 tcp -t 1
+       $0 4 udp -t 1
+       $0 6 udp -t 1
        echo "OK. All tests passed"
        exit 0
 fi
index 0f0628613f818d8bad788683e5ab5e4fb0b7277a..5670a9ffd8eb04775ec5dea21815057914e99ebc 100755 (executable)
@@ -35,6 +35,9 @@ run_udp() {
 
        echo "udp gso"
        run_in_netns ${args} -S 0
+
+       echo "udp gso zerocopy"
+       run_in_netns ${args} -S 0 -z
 }
 
 run_tcp() {