public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] selftests: drv-net: gro: increase the rcvbuf size
@ 2026-01-07 23:25 Jakub Kicinski
  2026-01-07 23:51 ` Willem de Bruijn
  2026-01-10  1:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Jakub Kicinski @ 2026-01-07 23:25 UTC (permalink / raw)
  To: davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, Jakub Kicinski,
	willemb, anubhavsinggh, mohsin.bashr, shuah, linux-kselftest

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

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: willemb@google.com
CC: anubhavsinggh@google.com
CC: mohsin.bashr@gmail.com
CC: shuah@kernel.org
CC: linux-kselftest@vger.kernel.org
---
 tools/testing/selftests/drivers/net/gro.c | 25 ++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/drivers/net/gro.c b/tools/testing/selftests/drivers/net/gro.c
index e894037d2e3e..751a8103f408 100644
--- a/tools/testing/selftests/drivers/net/gro.c
+++ b/tools/testing/selftests/drivers/net/gro.c
@@ -926,6 +926,28 @@ static void set_timeout(int fd)
 		error(1, errno, "cannot set timeout, setsockopt failed");
 }
 
+static void set_rcvbuf(int fd)
+{
+	int bufsize = 1 * 1024 * 1024; /* 1 MB */
+
+	if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &bufsize, sizeof(bufsize)))
+		error(1, errno, "cannot set rcvbuf size, setsockopt failed");
+}
+
+static void recv_error(int fd, int rcv_errno)
+{
+	struct tpacket_stats stats;
+	socklen_t len;
+
+	len = sizeof(stats);
+	if (getsockopt(fd, SOL_PACKET, PACKET_STATISTICS, &stats, &len))
+		error(1, errno, "can't get stats");
+
+	fprintf(stderr, "Socket stats: packets=%u, drops=%u\n",
+		stats.tp_packets, stats.tp_drops);
+	error(1, rcv_errno, "could not receive");
+}
+
 static void check_recv_pkts(int fd, int *correct_payload,
 			    int correct_num_pkts)
 {
@@ -950,7 +972,7 @@ static void check_recv_pkts(int fd, int *correct_payload,
 		ip_ext_len = 0;
 		pkt_size = recv(fd, buffer, IP_MAXPACKET + ETH_HLEN + 1, 0);
 		if (pkt_size < 0)
-			error(1, errno, "could not receive");
+			recv_error(fd, errno);
 
 		if (iph->version == 4)
 			ip_ext_len = (iph->ihl - 5) * 4;
@@ -1126,6 +1148,7 @@ static void gro_receiver(void)
 		error(1, 0, "socket creation");
 	setup_sock_filter(rxfd);
 	set_timeout(rxfd);
+	set_rcvbuf(rxfd);
 	bind_packetsocket(rxfd);
 
 	ksft_ready();
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] selftests: drv-net: gro: increase the rcvbuf size
  2026-01-07 23:25 [PATCH net-next] selftests: drv-net: gro: increase the rcvbuf size Jakub Kicinski
@ 2026-01-07 23:51 ` Willem de Bruijn
  2026-01-10  1:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Willem de Bruijn @ 2026-01-07 23:51 UTC (permalink / raw)
  To: Jakub Kicinski, davem
  Cc: netdev, edumazet, pabeni, andrew+netdev, horms, Jakub Kicinski,
	willemb, anubhavsinggh, mohsin.bashr, shuah, linux-kselftest

Jakub Kicinski wrote:
> 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
> 
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

Reviewed-by: Willem de Bruijn <willemb@google.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] selftests: drv-net: gro: increase the rcvbuf size
  2026-01-07 23:25 [PATCH net-next] selftests: drv-net: gro: increase the rcvbuf size Jakub Kicinski
  2026-01-07 23:51 ` Willem de Bruijn
@ 2026-01-10  1:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-01-10  1:40 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms, willemb,
	anubhavsinggh, mohsin.bashr, shuah, linux-kselftest

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed,  7 Jan 2026 15:25:57 -0800 you wrote:
> 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
> 
> [...]

Here is the summary with links:
  - [net-next] selftests: drv-net: gro: increase the rcvbuf size
    https://git.kernel.org/netdev/net-next/c/a0ac0ff38276

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-01-10  1:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-07 23:25 [PATCH net-next] selftests: drv-net: gro: increase the rcvbuf size Jakub Kicinski
2026-01-07 23:51 ` Willem de Bruijn
2026-01-10  1:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox