]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests: drv-net: gro: add data burst test case
authorJakub Kicinski <kuba@kernel.org>
Thu, 2 Apr 2026 20:59:53 +0000 (13:59 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 3 Apr 2026 22:05:42 +0000 (15:05 -0700)
Add a test trying to induce a GRO context timeout followed
by another sequence of packets for the same flow. The second
burst arrives 100ms after the first one so any implementation
(SW or HW) must time out waiting at that point. We expect both
bursts to be aggregated successfully but separately.

Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20260402210000.1512696-2-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/drivers/net/gro.py
tools/testing/selftests/net/lib/gro.c

index 70709bf670c70fd1b562b02efd16e747f9796020..10da5d4bee9b9415c8bef2a46234a81d4e699f25 100755 (executable)
@@ -289,7 +289,7 @@ def _gro_variants():
 
     # Tests that work for all protocols
     common_tests = [
-        "data_same", "data_lrg_sml", "data_sml_lrg",
+        "data_same", "data_lrg_sml", "data_sml_lrg", "data_burst",
         "ack",
         "flags_psh", "flags_syn", "flags_rst", "flags_urg", "flags_cwr",
         "tcp_csum", "tcp_seq", "tcp_ts", "tcp_opt",
index 3e611ae25f615cc836a7dc47d2f8eb7e41dbf7ba..4d002af4a7aadaa9c33dda4864614dfe948e62d2 100644 (file)
@@ -12,6 +12,7 @@
  *   - data_same:    same size packets coalesce
  *   - data_lrg_sml: large then small coalesces
  *   - data_sml_lrg: small then large doesn't coalesce
+ *   - data_burst:   two bursts of two, separated by 100ms
  *
  * ack:
  *  Pure ACK does not coalesce.
@@ -1298,6 +1299,21 @@ static void gro_sender(void)
        } else if (strcmp(testname, "data_sml_lrg") == 0) {
                send_data_pkts(txfd, &daddr, PAYLOAD_LEN / 2, PAYLOAD_LEN);
                write_packet(txfd, fin_pkt, total_hdr_len, &daddr);
+       } else if (strcmp(testname, "data_burst") == 0) {
+               static char buf[MAX_HDR_LEN + PAYLOAD_LEN];
+
+               create_packet(buf, 0, 0, PAYLOAD_LEN, 0);
+               write_packet(txfd, buf, total_hdr_len + PAYLOAD_LEN, &daddr);
+               create_packet(buf, PAYLOAD_LEN, 0, PAYLOAD_LEN, 0);
+               write_packet(txfd, buf, total_hdr_len + PAYLOAD_LEN, &daddr);
+
+               usleep(100 * 1000); /* 100ms */
+               create_packet(buf, PAYLOAD_LEN * 2, 0, PAYLOAD_LEN, 0);
+               write_packet(txfd, buf, total_hdr_len + PAYLOAD_LEN, &daddr);
+               create_packet(buf, PAYLOAD_LEN * 3, 0, PAYLOAD_LEN, 0);
+               write_packet(txfd, buf, total_hdr_len + PAYLOAD_LEN, &daddr);
+
+               write_packet(txfd, fin_pkt, total_hdr_len, &daddr);
 
        /* ack test */
        } else if (strcmp(testname, "ack") == 0) {
@@ -1463,6 +1479,11 @@ static void gro_receiver(void)
                correct_payload[0] = PAYLOAD_LEN / 2;
                correct_payload[1] = PAYLOAD_LEN;
                check_recv_pkts(rxfd, correct_payload, 2);
+       } else if (strcmp(testname, "data_burst") == 0) {
+               printf("two bursts of two data packets: ");
+               correct_payload[0] = PAYLOAD_LEN * 2;
+               correct_payload[1] = PAYLOAD_LEN * 2;
+               check_recv_pkts(rxfd, correct_payload, 2);
 
        /* ack test */
        } else if (strcmp(testname, "ack") == 0) {