Skip to content

Commit db63e48

Browse files
wdebruijdavem330
authored andcommitted
selftests: extend zerocopy tests to udp
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>
1 parent 52900d2 commit db63e48

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

tools/testing/selftests/net/msg_zerocopy.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,12 +651,13 @@ static void do_flush_datagram(int fd, int type)
651651

652652
static void do_rx(int domain, int type, int protocol)
653653
{
654+
const int cfg_receiver_wait_ms = 400;
654655
uint64_t tstop;
655656
int fd;
656657

657658
fd = do_setup_rx(domain, type, protocol);
658659

659-
tstop = gettimeofday_ms() + cfg_runtime_ms;
660+
tstop = gettimeofday_ms() + cfg_runtime_ms + cfg_receiver_wait_ms;
660661
do {
661662
if (type == SOCK_STREAM)
662663
do_flush_tcp(fd);

tools/testing/selftests/net/msg_zerocopy.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ readonly path_sysctl_mem="net.core.optmem_max"
2525
if [[ "$#" -eq "0" ]]; then
2626
$0 4 tcp -t 1
2727
$0 6 tcp -t 1
28+
$0 4 udp -t 1
29+
$0 6 udp -t 1
2830
echo "OK. All tests passed"
2931
exit 0
3032
fi

tools/testing/selftests/net/udpgso_bench.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ run_udp() {
3535

3636
echo "udp gso"
3737
run_in_netns ${args} -S 0
38+
39+
echo "udp gso zerocopy"
40+
run_in_netns ${args} -S 0 -z
3841
}
3942

4043
run_tcp() {

0 commit comments

Comments
 (0)