Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftests: drv-net: gro: increase the rcvbuf size

The gro.py test (testing software GRO) is slightly flaky when
running against fbnic. We see one flake per roughly 20 runs in NIPA,
mostly in ipip.large, and always including some EAGAIN:

# Shouldn't coalesce if exceed IP max pkt size: Test succeeded
# Expected {65475 899 }, Total 2 packets
# Received {65475 899 }, Total 2 packets.
# Expected {64576 900 900 }, Total 3 packets
# Received {64576 /home/virtme/testing/wt-24/tools/testing/selftests/drivers/net/gro: could not receive: Resource temporarily unavailable

The test sends 2 large frames (64k + change). Looks like the default
packet socket rcvbuf (~200kB) may not be large enough to hold them.
Bump the rcvbuf to 1MB.

Add a debug print showing socket statistics to make debugging this
issue easier in the future. Without the rcvbuf increase we see:

# Shouldn't coalesce if exceed IP max pkt size: Test succeeded
# Expected {65475 899 }, Total 2 packets
# Received {65475 899 }, Total 2 packets.
# Expected {64576 900 900 }, Total 3 packets
# Received {64576 Socket stats: packets=7, drops=3
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# /home/virtme/testing/wt-24/tools/testing/selftests/drivers/net/gro: could not receive: Resource temporarily unavailable

Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20260107232557.2147760-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+24 -1
+24 -1
tools/testing/selftests/drivers/net/gro.c
··· 926 926 error(1, errno, "cannot set timeout, setsockopt failed"); 927 927 } 928 928 929 + static void set_rcvbuf(int fd) 930 + { 931 + int bufsize = 1 * 1024 * 1024; /* 1 MB */ 932 + 933 + if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &bufsize, sizeof(bufsize))) 934 + error(1, errno, "cannot set rcvbuf size, setsockopt failed"); 935 + } 936 + 937 + static void recv_error(int fd, int rcv_errno) 938 + { 939 + struct tpacket_stats stats; 940 + socklen_t len; 941 + 942 + len = sizeof(stats); 943 + if (getsockopt(fd, SOL_PACKET, PACKET_STATISTICS, &stats, &len)) 944 + error(1, errno, "can't get stats"); 945 + 946 + fprintf(stderr, "Socket stats: packets=%u, drops=%u\n", 947 + stats.tp_packets, stats.tp_drops); 948 + error(1, rcv_errno, "could not receive"); 949 + } 950 + 929 951 static void check_recv_pkts(int fd, int *correct_payload, 930 952 int correct_num_pkts) 931 953 { ··· 972 950 ip_ext_len = 0; 973 951 pkt_size = recv(fd, buffer, IP_MAXPACKET + ETH_HLEN + 1, 0); 974 952 if (pkt_size < 0) 975 - error(1, errno, "could not receive"); 953 + recv_error(fd, errno); 976 954 977 955 if (iph->version == 4) 978 956 ip_ext_len = (iph->ihl - 5) * 4; ··· 1148 1126 error(1, 0, "socket creation"); 1149 1127 setup_sock_filter(rxfd); 1150 1128 set_timeout(rxfd); 1129 + set_rcvbuf(rxfd); 1151 1130 bind_packetsocket(rxfd); 1152 1131 1153 1132 ksft_ready();