All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nf,v6 1/3] netfilter: flowtable: remove redundant ifidx field in tuple output union
@ 2026-11-20 22:52 Pablo Neira Ayuso
  2026-11-20 22:52 ` [PATCH nf,v6 2/3] netfilter: flowtable: cache destination hw address for XMIT_NEIGH type Pablo Neira Ayuso
  2026-11-20 22:52 ` [PATCH nf,v6 3/3] netfilter: flowtable: unify direct and neigh xmit path Pablo Neira Ayuso
  0 siblings, 2 replies; 8+ messages in thread
From: Pablo Neira Ayuso @ 2026-11-20 22:52 UTC (permalink / raw)
  To: netfilter-devel

The XMIT_NEIGH and XMIT_DIRECT types use an output ifidx field to
determine the destination netdevice. Remove the redundant ifidx field in
the flow_offload_tuple union that represents the output path, use the
existing struct.

No functional change, this is just a preparation patch.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
---
v6: no changes

 include/net/netfilter/nf_flow_table.h | 3 ---
 net/netfilter/nf_flow_table_core.c    | 2 +-
 net/netfilter/nf_flow_table_ip.c      | 4 ++--
 3 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/include/net/netfilter/nf_flow_table.h b/include/net/netfilter/nf_flow_table.h
index 5b22d31cb140..61ac43b17dc9 100644
--- a/include/net/netfilter/nf_flow_table.h
+++ b/include/net/netfilter/nf_flow_table.h
@@ -160,9 +160,6 @@ struct flow_offload_tuple {
 	struct dst_entry		*dst_cache;
 
 	union {
-		struct {
-			u32		ifidx;
-		};
 		struct {
 			u32		ifidx;
 			u8		h_source[ETH_ALEN];
diff --git a/net/netfilter/nf_flow_table_core.c b/net/netfilter/nf_flow_table_core.c
index 2aa2647ed9df..a7b4fc5766a9 100644
--- a/net/netfilter/nf_flow_table_core.c
+++ b/net/netfilter/nf_flow_table_core.c
@@ -142,7 +142,7 @@ static int flow_offload_fill_route(struct flow_offload *flow,
 		break;
 	case FLOW_OFFLOAD_XMIT_XFRM:
 	case FLOW_OFFLOAD_XMIT_NEIGH:
-		flow_tuple->ifidx = route->tuple[dir].out.ifindex;
+		flow_tuple->out.ifidx = route->tuple[dir].out.ifindex;
 		flow_tuple->dst_cache = dst;
 		flow_tuple->dst_cookie = flow_offload_dst_cookie(flow_tuple);
 		break;
diff --git a/net/netfilter/nf_flow_table_ip.c b/net/netfilter/nf_flow_table_ip.c
index 19cafae748ab..115c54ad4633 100644
--- a/net/netfilter/nf_flow_table_ip.c
+++ b/net/netfilter/nf_flow_table_ip.c
@@ -867,7 +867,7 @@ static int nf_flow_queue_xmit4(struct sk_buff *skb,
 	switch (tuplehash->tuple.xmit_type) {
 	case FLOW_OFFLOAD_XMIT_NEIGH:
 		rt = dst_rtable(tuplehash->tuple.dst_cache);
-		xmit.outdev = dev_get_by_index_rcu(state->net, tuplehash->tuple.ifidx);
+		xmit.outdev = dev_get_by_index_rcu(state->net, tuplehash->tuple.out.ifidx);
 		if (!xmit.outdev) {
 			flow_offload_teardown(flow);
 			return NF_DROP;
@@ -1196,7 +1196,7 @@ static int nf_flow_queue_xmit6(struct sk_buff *skb,
 	switch (tuplehash->tuple.xmit_type) {
 	case FLOW_OFFLOAD_XMIT_NEIGH:
 		rt = dst_rt6_info(tuplehash->tuple.dst_cache);
-		xmit.outdev = dev_get_by_index_rcu(state->net, tuplehash->tuple.ifidx);
+		xmit.outdev = dev_get_by_index_rcu(state->net, tuplehash->tuple.out.ifidx);
 		if (!xmit.outdev) {
 			flow_offload_teardown(flow);
 			return NF_DROP;
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* Re: [PATCH nf,v6 2/3] netfilter: flowtable: cache destination hw address for XMIT_NEIGH type
@ 2026-11-22 12:02 Julius Bairaktaris
  0 siblings, 0 replies; 8+ messages in thread
From: Julius Bairaktaris @ 2026-11-22 12:02 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: netfilter-devel

On Sun, Nov 22, 2026 at 01:57:13AM +0100, Pablo Neira Ayuso wrote:
> > > So you're suggesting nf_flow_dst_check_gc() should run for
> > > FLOW_OFFLOAD_XMIT_DIRECT too?

For a direct tuple that has a dst_cache, yes: the h_dest comparison,
which runs only for XMIT_NEIGH now. A tuple without a dst_cache has no
neighbour to look up.

> > This is what this patch does:
> >
> > [PATCH nf-next] netfilter: flowtable: teardown flow reaching bridge port on fdb updates
> >
> > Until that gets merged, stall is expected.

The fdb check does not see a MAC change: it looks up the old h_dest,
whose entry stays on the same port or ages out, and both keep the flow.
With v11 of the roaming series on top of your v6, the bridge cases with
no tunnel, IPIP and IP6IP6 still stall, 1 run each.

> Ah, I suspect you refer to the XMIT_DIRECT case when hw offload is
> enabled, which indeed have dst/neigh entries.

No, the software flowtable: the tunnel's underlay device is a bridge,
which makes the tuple direct, and flow_offload_fill_route() keeps its
dst_cache because the reply direction has a tunnel.

Julius

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-11-22 12:02 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20 22:52 [PATCH nf,v6 1/3] netfilter: flowtable: remove redundant ifidx field in tuple output union Pablo Neira Ayuso
2026-11-20 22:52 ` [PATCH nf,v6 2/3] netfilter: flowtable: cache destination hw address for XMIT_NEIGH type Pablo Neira Ayuso
2026-11-21 23:55   ` Julius Bairaktaris
2026-11-22  0:25     ` Pablo Neira Ayuso
2026-11-22  0:35       ` Pablo Neira Ayuso
2026-11-22  0:57         ` Pablo Neira Ayuso
2026-11-20 22:52 ` [PATCH nf,v6 3/3] netfilter: flowtable: unify direct and neigh xmit path Pablo Neira Ayuso
  -- strict thread matches above, loose matches on Subject: below --
2026-11-22 12:02 [PATCH nf,v6 2/3] netfilter: flowtable: cache destination hw address for XMIT_NEIGH type Julius Bairaktaris

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.