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,3/5] netfilter: flowtable: Add IP6IP6 rx sw acceleration
Date: Sat, 17 Jan 2026 15:05:21 -0800 [thread overview]
Message-ID: <20260117230521.990884-1-kuba@kernel.org> (raw)
In-Reply-To: <20260116-b4-flowtable-offload-ip6ip6-v3-3-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 rx sw acceleration
This patch introduces software acceleration for the RX 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 7ee6b2e597c1..73ec8cb88285 100644
> --- a/net/netfilter/nf_flow_table_ip.c
> +++ b/net/netfilter/nf_flow_table_ip.c
[ ... ]
> @@ -326,10 +340,45 @@ static bool nf_flow_ip4_tunnel_proto(struct nf_flowtable_ctx *ctx,
> return true;
> }
>
> -static void nf_flow_ip4_tunnel_pop(struct nf_flowtable_ctx *ctx,
> - struct sk_buff *skb)
> +static bool nf_flow_ip6_tunnel_proto(struct nf_flowtable_ctx *ctx,
> + struct sk_buff *skb)
> +{
> +#if IS_ENABLED(CONFIG_IPV6)
> + struct ipv6hdr *ip6h, _ip6h;
> + __be16 frag_off;
> + u8 nexthdr;
> + int hdrlen;
> +
> + ip6h = skb_header_pointer(skb, ctx->offset, sizeof(*ip6h), &_ip6h);
> + if (!ip6h)
> + return false;
> +
> + if (ip6h->hop_limit <= 1)
> + return false;
> +
> + nexthdr = ipv6_hdr(skb)->nexthdr;
^^^^^^^^^^^^
When ctx->offset is non-zero (e.g., VLAN-encapsulated traffic where
nf_flow_skb_encap_protocol() sets ctx->offset += VLAN_HLEN), ip6h points
to the IPv6 header at ctx->offset, but ipv6_hdr(skb) returns
skb_network_header(skb) which is at offset 0.
Should this be ip6h->nexthdr instead of ipv6_hdr(skb)->nexthdr?
The IPv4 analog nf_flow_ip4_tunnel_proto() uses iph->protocol where iph
is calculated as (skb_network_header(skb) + ctx->offset), which correctly
accounts for the encapsulation offset.
> + hdrlen = ipv6_skip_exthdr(skb, sizeof(*ip6h) + ctx->offset, &nexthdr,
> + &frag_off);
> + if (hdrlen < 0)
> + return false;
> +
> + if (nexthdr == IPPROTO_IPV6) {
> + ctx->tun.hdr_size = hdrlen;
> + ctx->tun.proto = IPPROTO_IPV6;
> + }
> + ctx->offset += ctx->tun.hdr_size;
> +
> + return true;
> +#else
> + return false;
> +#endif /* IS_ENABLED(CONFIG_IPV6) */
> +}
[ ... ]
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 ` Jakub Kicinski [this message]
2026-01-16 8:13 ` [PATCH nf-next v3 4/5] netfilter: flowtable: Add IP6IP6 tx " Lorenzo Bianconi
2026-01-17 23:05 ` [nf-next,v3,4/5] " Jakub Kicinski
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=20260117230521.990884-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