Skip to content

Commit 02d064d

Browse files
Anubhav Singhkuba-moo
authored andcommitted
selftests/net: fix out-of-order delivery of FIN in gro:tcp test
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: 7d15750 ("selftests/net: GRO coalesce test") Reviewed-by: Willem de Bruijn <willemb@google.com> Signed-off-by: Anubhav Singh <anubhavsinggh@google.com> Link: https://patch.msgid.link/20251030062818.1562228-1-anubhavsinggh@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 3d18a84 commit 02d064d

File tree

1 file changed

+8
-0
lines changed
  • tools/testing/selftests/net

1 file changed

+8
-0
lines changed

tools/testing/selftests/net/gro.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -989,6 +989,7 @@ static void check_recv_pkts(int fd, int *correct_payload,
989989

990990
static void gro_sender(void)
991991
{
992+
const int fin_delay_us = 100 * 1000;
992993
static char fin_pkt[MAX_HDR_LEN];
993994
struct sockaddr_ll daddr = {};
994995
int txfd = -1;
@@ -1032,15 +1033,22 @@ static void gro_sender(void)
10321033
write_packet(txfd, fin_pkt, total_hdr_len, &daddr);
10331034
} else if (strcmp(testname, "tcp") == 0) {
10341035
send_changed_checksum(txfd, &daddr);
1036+
/* Adding sleep before sending FIN so that it is not
1037+
* received prior to other packets.
1038+
*/
1039+
usleep(fin_delay_us);
10351040
write_packet(txfd, fin_pkt, total_hdr_len, &daddr);
10361041

10371042
send_changed_seq(txfd, &daddr);
1043+
usleep(fin_delay_us);
10381044
write_packet(txfd, fin_pkt, total_hdr_len, &daddr);
10391045

10401046
send_changed_ts(txfd, &daddr);
1047+
usleep(fin_delay_us);
10411048
write_packet(txfd, fin_pkt, total_hdr_len, &daddr);
10421049

10431050
send_diff_opt(txfd, &daddr);
1051+
usleep(fin_delay_us);
10441052
write_packet(txfd, fin_pkt, total_hdr_len, &daddr);
10451053
} else if (strcmp(testname, "ip") == 0) {
10461054
send_changed_ECN(txfd, &daddr);

0 commit comments

Comments
 (0)