Re: [PATCH net-next v7 3/3] selftests/net: add flush id selftests

From: Willem de Bruijn
Date: Sat Apr 13 2024 - 20:56:09 EST


Richard Gobert wrote:
> Added flush id selftests to test different cases where DF flag is set or
> unset and id value changes in the following packets. All cases where the
> packets should coalesce or should not coalesce are tested.
>
> Signed-off-by: Richard Gobert <richardbgobert@xxxxxxxxx>

Thanks for adding tests. Minor point below only. The tests pass both
before and after your series, right? Then immediately a nice
validation that the optimization has no unintended side-effects.

> ---
> tools/testing/selftests/net/gro.c | 144 ++++++++++++++++++++++++++++++
> 1 file changed, 144 insertions(+)
>
> diff --git a/tools/testing/selftests/net/gro.c b/tools/testing/selftests/net/gro.c
> index 353e1e867fbb..74ab06953c38 100644
> --- a/tools/testing/selftests/net/gro.c
> +++ b/tools/testing/selftests/net/gro.c
> @@ -617,6 +617,120 @@ static void add_ipv6_exthdr(void *buf, void *optpkt, __u8 exthdr_type, char *ext
> iph->payload_len = htons(ntohs(iph->payload_len) + MIN_EXTHDR_SIZE);
> }
>
> +static void fix_ip4_checksum(struct iphdr *iph)
> +{
> + iph->check = 0;
> + iph->check = checksum_fold(iph, sizeof(struct iphdr), 0);
> +}
> +
> +static void send_flush_id_case(int fd, struct sockaddr_ll *daddr, int tcase)
> +{
> + bool send_three = false;
> + static char buf1[MAX_HDR_LEN + PAYLOAD_LEN];
> + static char buf2[MAX_HDR_LEN + PAYLOAD_LEN];
> + static char buf3[MAX_HDR_LEN + PAYLOAD_LEN];
> +
> + create_packet(buf1, 0, 0, PAYLOAD_LEN, 0);
> + create_packet(buf2, PAYLOAD_LEN, 0, PAYLOAD_LEN, 0);
> + create_packet(buf3, PAYLOAD_LEN * 2, 0, PAYLOAD_LEN, 0);
> +
> + struct iphdr *iph1 = (struct iphdr *)(buf1 + ETH_HLEN);
> + struct iphdr *iph2 = (struct iphdr *)(buf2 + ETH_HLEN);
> + struct iphdr *iph3 = (struct iphdr *)(buf3 + ETH_HLEN);
> +

minor: variable defintions before code, and reverse chrismas tree.