From: Jakub Kicinski <kuba@kernel.org>
To: lorenzo@kernel.org
Cc: Jakub Kicinski <kuba@kernel.org>,
shuah@kernel.org, kadlec@netfilter.org, edumazet@google.com,
dsahern@kernel.org, davem@davemloft.net,
netfilter-devel@vger.kernel.org, fw@strlen.de,
coreteam@netfilter.org, netdev@vger.kernel.org, phil@nwl.cc,
horms@kernel.org, linux-kselftest@vger.kernel.org,
pablo@netfilter.org, pabeni@redhat.com
Subject: Re: [nf-next,v3,4/5] netfilter: flowtable: Add IP6IP6 tx sw acceleration
Date: Sat, 17 Jan 2026 15:05:27 -0800 [thread overview]
Message-ID: <20260117230527.992716-1-kuba@kernel.org> (raw)
In-Reply-To: <20260116-b4-flowtable-offload-ip6ip6-v3-4-c1fcad85a905@kernel.org>
This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
For local reproduction steps see https://netdev-ai.bots.linux.dev/ai-local.html
---
netfilter: flowtable: Add IP6IP6 tx sw acceleration
This patch adds software acceleration for the TX path of IP6IP6 tunnels
using the netfilter flowtable infrastructure.
> diff --git a/net/netfilter/nf_flow_table_ip.c b/net/netfilter/nf_flow_table_ip.c
> index 73ec8cb88285..f72fcb85c318 100644
> --- a/net/netfilter/nf_flow_table_ip.c
> +++ b/net/netfilter/nf_flow_table_ip.c
[ ... ]
> +static int nf_flow_tunnel_ip6ip6_push(struct net *net, struct sk_buff *skb,
> + struct flow_offload_tuple *tuple,
> + struct in6_addr **ip6_daddr)
> +{
> + struct ipv6hdr *ip6h = (struct ipv6hdr *)skb_network_header(skb);
> + int err, mtu, encap_limit = IPV6_DEFAULT_TNL_ENCAP_LIMIT;
[ ... ]
> + if (encap_limit > 0) {
> + struct ipv6_tel_txoption opt = {
[ ... ]
> + hopt = skb_push(skb, ipv6_optlen(opt.ops.dst1opt));
This pushes 8 bytes for the destination options header.
> + memcpy(hopt, opt.ops.dst1opt, ipv6_optlen(opt.ops.dst1opt));
> + hopt->nexthdr = IPPROTO_IPV6;
> + proto = NEXTHDR_DEST;
> + }
> +
> + skb_push(skb, sizeof(*ip6h));
And this pushes another 40 bytes for the IPv6 header.
So total encapsulation overhead is 48 bytes when encap_limit is enabled
(which is the default, since IPV6_DEFAULT_TNL_ENCAP_LIMIT is non-zero).
[ ... ]
> @@ -923,6 +1012,9 @@ static int nf_flow_offload_ipv6_forward(struct nf_flowtable_ctx *ctx,
> flow = container_of(tuplehash, struct flow_offload, tuplehash[dir]);
>
> mtu = flow->tuplehash[dir].tuple.mtu + ctx->offset;
> + if (flow->tuplehash[!dir].tuple.tun_num)
> + mtu -= sizeof(*ip6h);
^^^^^^^^^^^^
Should this also subtract 8 bytes for the destination options header when
encap_limit is enabled? The MTU calculation here only accounts for the
40-byte IPv6 header, but nf_flow_tunnel_ip6ip6_push() adds 48 bytes total
(40 for the IPv6 header plus 8 for the encap_limit destination options).
The reference implementation in ip6_tnl_xmit() subtracts both:
mtu = dst_mtu(dst) - eth_hlen - psh_hlen - t->tun_hlen;
if (encap_limit >= 0) {
max_headroom += 8;
mtu -= 8;
}
Without accounting for the extra 8 bytes here, packets in the size range
(mtu-48, mtu-40] could pass the MTU check but produce oversized packets
after encapsulation.
> +
> if (unlikely(nf_flow_exceeds_mtu(skb, mtu)))
> return 0;
[ ... ]
next prev parent reply other threads:[~2026-01-17 23:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-16 8:13 [PATCH nf-next v3 0/5] Add IP6IP6 flowtable SW acceleration Lorenzo Bianconi
2026-01-16 8:13 ` [PATCH nf-next v3 1/5] netfilter: Add ctx pointer in nf_flow_skb_encap_protocol/nf_flow_ip4_tunnel_proto signature Lorenzo Bianconi
2026-01-16 8:13 ` [PATCH nf-next v3 2/5] netfilter: Introduce tunnel metadata info in nf_flowtable_ctx struct Lorenzo Bianconi
2026-01-16 8:13 ` [PATCH nf-next v3 3/5] netfilter: flowtable: Add IP6IP6 rx sw acceleration Lorenzo Bianconi
2026-01-17 23:05 ` [nf-next,v3,3/5] " Jakub Kicinski
2026-01-16 8:13 ` [PATCH nf-next v3 4/5] netfilter: flowtable: Add IP6IP6 tx " Lorenzo Bianconi
2026-01-17 23:05 ` Jakub Kicinski [this message]
2026-01-16 8:13 ` [PATCH nf-next v3 5/5] selftests: netfilter: nft_flowtable.sh: Add IP6IP6 flowtable selftest Lorenzo Bianconi
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=20260117230527.992716-1-kuba@kernel.org \
--to=kuba@kernel.org \
--cc=coreteam@netfilter.org \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=horms@kernel.org \
--cc=kadlec@netfilter.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
--cc=phil@nwl.cc \
--cc=shuah@kernel.org \
/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