From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Richard Gobert <richardbgobert@gmail.com>, netdev@vger.kernel.org
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
pabeni@redhat.com, horms@kernel.org, corbet@lwn.net,
saeedm@nvidia.com, tariqt@nvidia.com, mbloch@nvidia.com,
leon@kernel.org, ecree.xilinx@gmail.com, dsahern@kernel.org,
ncardwell@google.com, kuniyu@google.com, shuah@kernel.org,
sdf@fomichev.me, aleksander.lobakin@intel.com,
florian.fainelli@broadcom.com, willemdebruijn.kernel@gmail.com,
alexander.duyck@gmail.com, linux-kernel@vger.kernel.org,
linux-net-drivers@amd.com,
Richard Gobert <richardbgobert@gmail.com>
Subject: Re: [PATCH net-next v4 5/5] selftests/net: test ipip packets in gro.sh
Date: Tue, 02 Sep 2025 14:34:36 -0400 [thread overview]
Message-ID: <willemdebruijn.kernel.2bc58f76bed9b@gmail.com> (raw)
In-Reply-To: <20250901113826.6508-6-richardbgobert@gmail.com>
Richard Gobert wrote:
> Add IPIP test-cases to the GRO selftest.
>
> This selftest already contains IP ID test-cases. They are now
> also tested for encapsulated packets.
>
> This commit also fixes ipip packet generation in the test.
>
> Signed-off-by: Richard Gobert <richardbgobert@gmail.com>
> ---
> tools/testing/selftests/net/gro.c | 49 ++++++++++++++++++++++++------
> tools/testing/selftests/net/gro.sh | 5 +--
> 2 files changed, 42 insertions(+), 12 deletions(-)
>
> diff --git a/tools/testing/selftests/net/gro.c b/tools/testing/selftests/net/gro.c
> index 3d4a82a2607c..451dc1c1eac5 100644
> --- a/tools/testing/selftests/net/gro.c
> +++ b/tools/testing/selftests/net/gro.c
> @@ -93,6 +93,7 @@ static bool tx_socket = true;
> static int tcp_offset = -1;
> static int total_hdr_len = -1;
> static int ethhdr_proto = -1;
> +static bool ipip;
> static const int num_flush_id_cases = 6;
>
> static void vlog(const char *fmt, ...)
> @@ -114,7 +115,9 @@ static void setup_sock_filter(int fd)
> int ipproto_off, opt_ipproto_off;
> int next_off;
>
> - if (proto == PF_INET)
> + if (ipip)
> + next_off = sizeof(struct iphdr) + offsetof(struct iphdr, protocol);
> + else if (proto == PF_INET)
> next_off = offsetof(struct iphdr, protocol);
> else
> next_off = offsetof(struct ipv6hdr, nexthdr);
> @@ -244,7 +247,7 @@ static void fill_datalinklayer(void *buf)
> eth->h_proto = ethhdr_proto;
> }
>
> -static void fill_networklayer(void *buf, int payload_len)
> +static void fill_networklayer(void *buf, int payload_len, int protocol)
> {
> struct ipv6hdr *ip6h = buf;
> struct iphdr *iph = buf;
> @@ -254,7 +257,7 @@ static void fill_networklayer(void *buf, int payload_len)
>
> ip6h->version = 6;
> ip6h->payload_len = htons(sizeof(struct tcphdr) + payload_len);
> - ip6h->nexthdr = IPPROTO_TCP;
> + ip6h->nexthdr = protocol;
> ip6h->hop_limit = 8;
> if (inet_pton(AF_INET6, addr6_src, &ip6h->saddr) != 1)
> error(1, errno, "inet_pton source ip6");
> @@ -266,7 +269,7 @@ static void fill_networklayer(void *buf, int payload_len)
> iph->version = 4;
> iph->ihl = 5;
> iph->ttl = 8;
> - iph->protocol = IPPROTO_TCP;
> + iph->protocol = protocol;
> iph->tot_len = htons(sizeof(struct tcphdr) +
> payload_len + sizeof(struct iphdr));
> iph->frag_off = htons(0x4000); /* DF = 1, MF = 0 */
> @@ -313,9 +316,19 @@ static void create_packet(void *buf, int seq_offset, int ack_offset,
> {
> memset(buf, 0, total_hdr_len);
> memset(buf + total_hdr_len, 'a', payload_len);
> +
> fill_transportlayer(buf + tcp_offset, seq_offset, ack_offset,
> payload_len, fin);
> - fill_networklayer(buf + ETH_HLEN, payload_len);
> +
> + if (ipip) {
> + fill_networklayer(buf + ETH_HLEN + sizeof(struct iphdr),
> + payload_len, IPPROTO_TCP);
> + fill_networklayer(buf + ETH_HLEN, payload_len + sizeof(struct iphdr),
> + IPPROTO_IPIP);
if respinning, minor request to insert in the order of the headers,
so IPIP first.
> + } else {
> + fill_networklayer(buf + ETH_HLEN, payload_len, IPPROTO_TCP);
> + }
> +
> fill_datalinklayer(buf);
> }
>
> diff --git a/tools/testing/selftests/net/gro.sh b/tools/testing/selftests/net/gro.sh
> index 9e3f186bc2a1..d16ec365b3cf 100755
> --- a/tools/testing/selftests/net/gro.sh
> +++ b/tools/testing/selftests/net/gro.sh
> @@ -4,7 +4,7 @@
> readonly SERVER_MAC="aa:00:00:00:00:02"
> readonly CLIENT_MAC="aa:00:00:00:00:01"
> readonly TESTS=("data" "ack" "flags" "tcp" "ip" "large")
> -readonly PROTOS=("ipv4" "ipv6")
> +readonly PROTOS=("ipv4" "ipv6" "ipip")
> dev=""
> test="all"
> proto="ipv4"
> @@ -31,7 +31,8 @@ run_test() {
> 1>>log.txt
> wait "${server_pid}"
> exit_code=$?
> - if [[ ${test} == "large" && -n "${KSFT_MACHINE_SLOW}" && \
> + if [[ ( ${test} == "large" || ${protocol} == "ipip" ) && \
> + -n "${KSFT_MACHINE_SLOW}" && \
> ${exit_code} -ne 0 ]]; then
> echo "Ignoring errors due to slow environment" 1>&2
> exit_code=0
If you can no longer reproduce the need for this, and we see no
reason analytically why ipip would be more flaky than ipv4, then
please drop this. Else some future time we'll be scratching our heads
why this is here but will be afraid to touch it.
prev parent reply other threads:[~2025-09-02 18:34 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-01 11:38 [PATCH net-next v4 0/5] net: gso: restore outer ip ids correctly Richard Gobert
2025-09-01 11:38 ` [PATCH net-next v4 1/5] net: gro: remove is_ipv6 from napi_gro_cb Richard Gobert
2025-09-02 17:56 ` Willem de Bruijn
2025-09-01 11:38 ` [PATCH net-next v4 2/5] net: gro: only merge packets with incrementing or fixed outer ids Richard Gobert
2025-09-02 18:08 ` Willem de Bruijn
2025-09-01 11:38 ` [PATCH net-next v4 3/5] net: gso: restore ids of outer ip headers correctly Richard Gobert
2025-09-01 21:15 ` Edward Cree
2025-09-02 18:22 ` Willem de Bruijn
2025-09-01 11:38 ` [PATCH net-next v4 4/5] net: gro: remove unnecessary df checks Richard Gobert
2025-09-02 18:27 ` Willem de Bruijn
2025-09-01 11:38 ` [PATCH net-next v4 5/5] selftests/net: test ipip packets in gro.sh Richard Gobert
2025-09-02 18:34 ` Willem de Bruijn [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=willemdebruijn.kernel.2bc58f76bed9b@gmail.com \
--to=willemdebruijn.kernel@gmail.com \
--cc=aleksander.lobakin@intel.com \
--cc=alexander.duyck@gmail.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=ecree.xilinx@gmail.com \
--cc=edumazet@google.com \
--cc=florian.fainelli@broadcom.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-net-drivers@amd.com \
--cc=mbloch@nvidia.com \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardbgobert@gmail.com \
--cc=saeedm@nvidia.com \
--cc=sdf@fomichev.me \
--cc=shuah@kernel.org \
--cc=tariqt@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).