linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] selftests/net: fix out-of-order delivery of FIN in gro:tcp test
@ 2025-10-30  5:57 Anubhav Singh
  2025-10-30  6:28 ` [PATCH net v2] " Anubhav Singh
  0 siblings, 1 reply; 4+ messages in thread
From: Anubhav Singh @ 2025-10-30  5:57 UTC (permalink / raw)
  To: netdev, linux-kselftest
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Willem de Bruijn, Coco Li, Anubhav Singh

Due to the gro_sender sending data packets and FIN packets
in very quick succession, these are received almost simultaneously
by the gro_receiver. FIN packets are sometimes processed before the
data packets leading to intermittent (~1/100) test failures.

This change adds a delay of 100ms before sending FIN packets
in gro:tcp test to avoid the out-of-order delivery. The same
mitigation already exists for the gro:ip test.

Fixes: 7d1575014a63 ("selftests/net: GRO coalesce test")
Reviewed-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Anubhav Singh <anubhavsinggh@google.com>
---
 tools/testing/selftests/net/gro.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/testing/selftests/net/gro.c b/tools/testing/selftests/net/gro.c
index 2b1d9f2b3e9e..3fa63bd85dea 100644
--- a/tools/testing/selftests/net/gro.c
+++ b/tools/testing/selftests/net/gro.c
@@ -989,6 +989,7 @@ static void check_recv_pkts(int fd, int *correct_payload,
 
 static void gro_sender(void)
 {
+	const int fin_delay_us = 100 * 1000;
 	static char fin_pkt[MAX_HDR_LEN];
 	struct sockaddr_ll daddr = {};
 	int txfd = -1;
@@ -1032,15 +1033,22 @@ static void gro_sender(void)
 		write_packet(txfd, fin_pkt, total_hdr_len, &daddr);
 	} else if (strcmp(testname, "tcp") == 0) {
 		send_changed_checksum(txfd, &daddr);
+		/* Adding sleep before sending FIN so that it is not
+		 * received prior to other packets.
+		 */
+		usleep(fin_delay_us);
 		write_packet(txfd, fin_pkt, total_hdr_len, &daddr);
 
 		send_changed_seq(txfd, &daddr);
+		usleep(fin_delay_us);
 		write_packet(txfd, fin_pkt, total_hdr_len, &daddr);
 
 		send_changed_ts(txfd, &daddr);
+		usleep(fin_delay_us);
 		write_packet(txfd, fin_pkt, total_hdr_len, &daddr);
 
 		send_diff_opt(txfd, &daddr);
+		usleep(fin_delay_us);
 		write_packet(txfd, fin_pkt, total_hdr_len, &daddr);
 	} else if (strcmp(testname, "ip") == 0) {
 		send_changed_ECN(txfd, &daddr);
-- 
2.51.1.851.g4ebd6896fd-goog


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

* [PATCH net v2] selftests/net: fix out-of-order delivery of FIN in gro:tcp test
  2025-10-30  5:57 [PATCH net] selftests/net: fix out-of-order delivery of FIN in gro:tcp test Anubhav Singh
@ 2025-10-30  6:28 ` Anubhav Singh
  2025-10-30 12:26   ` Willem de Bruijn
  2025-11-01  0:40   ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 4+ messages in thread
From: Anubhav Singh @ 2025-10-30  6:28 UTC (permalink / raw)
  To: netdev, linux-kselftest
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Shuah Khan, Willem de Bruijn, Coco Li,
	Anubhav Singh

Due to the gro_sender sending data packets and FIN packets
in very quick succession, these are received almost simultaneously
by the gro_receiver. FIN packets are sometimes processed before the
data packets leading to intermittent (~1/100) test failures.

This change adds a delay of 100ms before sending FIN packets
in gro:tcp test to avoid the out-of-order delivery. The same
mitigation already exists for the gro:ip test.

Fixes: 7d1575014a63 ("selftests/net: GRO coalesce test")
Reviewed-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Anubhav Singh <anubhavsinggh@google.com>
---
Changes in v2:
 - Add 'Shuah Khan <shuah@kernel.org>' to the CC list.

 tools/testing/selftests/net/gro.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tools/testing/selftests/net/gro.c b/tools/testing/selftests/net/gro.c
index 2b1d9f2b3e9e..3fa63bd85dea 100644
--- a/tools/testing/selftests/net/gro.c
+++ b/tools/testing/selftests/net/gro.c
@@ -989,6 +989,7 @@ static void check_recv_pkts(int fd, int *correct_payload,
 
 static void gro_sender(void)
 {
+	const int fin_delay_us = 100 * 1000;
 	static char fin_pkt[MAX_HDR_LEN];
 	struct sockaddr_ll daddr = {};
 	int txfd = -1;
@@ -1032,15 +1033,22 @@ static void gro_sender(void)
 		write_packet(txfd, fin_pkt, total_hdr_len, &daddr);
 	} else if (strcmp(testname, "tcp") == 0) {
 		send_changed_checksum(txfd, &daddr);
+		/* Adding sleep before sending FIN so that it is not
+		 * received prior to other packets.
+		 */
+		usleep(fin_delay_us);
 		write_packet(txfd, fin_pkt, total_hdr_len, &daddr);
 
 		send_changed_seq(txfd, &daddr);
+		usleep(fin_delay_us);
 		write_packet(txfd, fin_pkt, total_hdr_len, &daddr);
 
 		send_changed_ts(txfd, &daddr);
+		usleep(fin_delay_us);
 		write_packet(txfd, fin_pkt, total_hdr_len, &daddr);
 
 		send_diff_opt(txfd, &daddr);
+		usleep(fin_delay_us);
 		write_packet(txfd, fin_pkt, total_hdr_len, &daddr);
 	} else if (strcmp(testname, "ip") == 0) {
 		send_changed_ECN(txfd, &daddr);
-- 
2.51.1.851.g4ebd6896fd-goog


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

* Re: [PATCH net v2] selftests/net: fix out-of-order delivery of FIN in gro:tcp test
  2025-10-30  6:28 ` [PATCH net v2] " Anubhav Singh
@ 2025-10-30 12:26   ` Willem de Bruijn
  2025-11-01  0:40   ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 4+ messages in thread
From: Willem de Bruijn @ 2025-10-30 12:26 UTC (permalink / raw)
  To: Anubhav Singh, netdev, linux-kselftest
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, Shuah Khan, Willem de Bruijn, Coco Li,
	Anubhav Singh

Anubhav Singh wrote:
> Due to the gro_sender sending data packets and FIN packets
> in very quick succession, these are received almost simultaneously
> by the gro_receiver. FIN packets are sometimes processed before the
> data packets leading to intermittent (~1/100) test failures.
> 
> This change adds a delay of 100ms before sending FIN packets
> in gro:tcp test to avoid the out-of-order delivery. The same
> mitigation already exists for the gro:ip test.
> 
> Fixes: 7d1575014a63 ("selftests/net: GRO coalesce test")
> Reviewed-by: Willem de Bruijn <willemb@google.com>
> Signed-off-by: Anubhav Singh <anubhavsinggh@google.com>
> ---
> Changes in v2:
>  - Add 'Shuah Khan <shuah@kernel.org>' to the CC list.

Remember to not repost within 24 hours:

https://kernel.org/doc/html/latest/process/maintainer-netdev.html#tl-dr

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

* Re: [PATCH net v2] selftests/net: fix out-of-order delivery of FIN in gro:tcp test
  2025-10-30  6:28 ` [PATCH net v2] " Anubhav Singh
  2025-10-30 12:26   ` Willem de Bruijn
@ 2025-11-01  0:40   ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-11-01  0:40 UTC (permalink / raw)
  To: Anubhav Singh
  Cc: netdev, linux-kselftest, davem, edumazet, kuba, pabeni, horms,
	shuah, willemb, lixiaoyan

Hello:

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

On Thu, 30 Oct 2025 06:28:18 +0000 you wrote:
> Due to the gro_sender sending data packets and FIN packets
> in very quick succession, these are received almost simultaneously
> by the gro_receiver. FIN packets are sometimes processed before the
> data packets leading to intermittent (~1/100) test failures.
> 
> This change adds a delay of 100ms before sending FIN packets
> in gro:tcp test to avoid the out-of-order delivery. The same
> mitigation already exists for the gro:ip test.
> 
> [...]

Here is the summary with links:
  - [net,v2] selftests/net: fix out-of-order delivery of FIN in gro:tcp test
    https://git.kernel.org/netdev/net/c/02d064de05b1

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] 4+ messages in thread

end of thread, other threads:[~2025-11-01  0:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-30  5:57 [PATCH net] selftests/net: fix out-of-order delivery of FIN in gro:tcp test Anubhav Singh
2025-10-30  6:28 ` [PATCH net v2] " Anubhav Singh
2025-10-30 12:26   ` Willem de Bruijn
2025-11-01  0: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;
as well as URLs for NNTP newsgroup(s).