]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests: drv-net: gro: always wait for FIN in the capacity test
authorJakub Kicinski <kuba@kernel.org>
Thu, 2 Apr 2026 20:59:55 +0000 (13:59 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 3 Apr 2026 22:05:43 +0000 (15:05 -0700)
The new capacity/order test exits as soon as it sees the expected
packet sequence. This may allow the "flushing" FIN packet to spill
over to the next test. Let's always wait for the FIN before exiting.

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

index 27ccd742615a3c0c228c6db22d1f6429e7c15ccd..f05398c18e0c8227f3608f97c524f35261ed20ff 100644 (file)
@@ -1154,7 +1154,7 @@ static void check_capacity_pkts(int fd)
        memset(coalesced, 0, sizeof(coalesced));
        memset(flow_order, -1, sizeof(flow_order));
 
-       while (total_data < num_flows * CAPACITY_PAYLOAD_LEN * 2) {
+       while (1) {
                ip_ext_len = 0;
                pkt_size = recv(fd, buffer, IP_MAXPACKET + ETH_HLEN + 1, 0);
                if (pkt_size < 0)
@@ -1167,7 +1167,6 @@ static void check_capacity_pkts(int fd)
 
                tcph = (struct tcphdr *)(buffer + tcp_offset + ip_ext_len);
 
-               /* FIN packet terminates reception */
                if (tcph->fin)
                        break;
 
@@ -1189,7 +1188,13 @@ static void check_capacity_pkts(int fd)
                        data_len = pkt_size - total_hdr_len - ip_ext_len;
                }
 
-               flow_order[num_pkt] = flow_id;
+               if (num_pkt < num_flows * 2) {
+                       flow_order[num_pkt] = flow_id;
+               } else if (num_pkt == num_flows * 2) {
+                       vlog("More packets than expected (%d)\n",
+                            num_flows * 2);
+                       fail_reason = fail_reason ?: "too many packets";
+               }
                coalesced[flow_id] = data_len;
 
                if (data_len == CAPACITY_PAYLOAD_LEN * 2) {