]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests: drv-net: gro: add 1 byte payload test
authorJakub Kicinski <kuba@kernel.org>
Thu, 2 Apr 2026 20:59:54 +0000 (13:59 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 3 Apr 2026 22:05:43 +0000 (15:05 -0700)
Small IPv4 packets get padded to 60B, this may break / confuse
some buggy implementations. Add a test to coalesce a 1B payload.
Keep this separate from the lrg_sml test because I suspect some
implementations may not handle this case (treat padded frames
as ineligible for coalescing).

Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20260402210000.1512696-3-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 10da5d4bee9b9415c8bef2a46234a81d4e699f25..73436d16b40dc1973bfe3737c4b4bb81bf0e4901 100755 (executable)
@@ -11,6 +11,7 @@ coalescing behavior.
 Test cases:
   - data_same: Same size data packets coalesce
   - data_lrg_sml: Large packet followed by smaller one coalesces
+  - data_lrg_1byte: Large packet followed by 1B one coalesces (Ethernet padding)
   - data_sml_lrg: Small packet followed by larger one doesn't coalesce
   - ack: Pure ACK packets do not coalesce
   - flags_psh: Packets with PSH flag don't coalesce
@@ -289,7 +290,8 @@ def _gro_variants():
 
     # Tests that work for all protocols
     common_tests = [
-        "data_same", "data_lrg_sml", "data_sml_lrg", "data_burst",
+        "data_same", "data_lrg_sml", "data_sml_lrg", "data_lrg_1byte",
+        "data_burst",
         "ack",
         "flags_psh", "flags_syn", "flags_rst", "flags_urg", "flags_cwr",
         "tcp_csum", "tcp_seq", "tcp_ts", "tcp_opt",
index 4d002af4a7aadaa9c33dda4864614dfe948e62d2..27ccd742615a3c0c228c6db22d1f6429e7c15ccd 100644 (file)
@@ -10,8 +10,9 @@
  *  packet coalesced: it can be smaller than the rest and coalesced
  *  as long as it is in the same flow.
  *   - data_same:    same size packets coalesce
- *   - data_lrg_sml: large then small coalesces
- *   - data_sml_lrg: small then large doesn't coalesce
+ *   - data_lrg_sml:   large then small coalesces
+ *   - data_lrg_1byte: large then 1 byte coalesces (Ethernet padding)
+ *   - data_sml_lrg:   small then large doesn't coalesce
  *   - data_burst:   two bursts of two, separated by 100ms
  *
  * ack:
@@ -1296,6 +1297,9 @@ static void gro_sender(void)
        } else if (strcmp(testname, "data_lrg_sml") == 0) {
                send_data_pkts(txfd, &daddr, PAYLOAD_LEN, PAYLOAD_LEN / 2);
                write_packet(txfd, fin_pkt, total_hdr_len, &daddr);
+       } else if (strcmp(testname, "data_lrg_1byte") == 0) {
+               send_data_pkts(txfd, &daddr, PAYLOAD_LEN, 1);
+               write_packet(txfd, fin_pkt, total_hdr_len, &daddr);
        } 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);
@@ -1474,6 +1478,10 @@ static void gro_receiver(void)
                printf("large data packets followed by a smaller one: ");
                correct_payload[0] = PAYLOAD_LEN * 1.5;
                check_recv_pkts(rxfd, correct_payload, 1);
+       } else if (strcmp(testname, "data_lrg_1byte") == 0) {
+               printf("large data packet followed by a 1 byte one: ");
+               correct_payload[0] = PAYLOAD_LEN + 1;
+               check_recv_pkts(rxfd, correct_payload, 1);
        } else if (strcmp(testname, "data_sml_lrg") == 0) {
                printf("small data packets followed by a larger one: ");
                correct_payload[0] = PAYLOAD_LEN / 2;