All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nf-next 1/4] netfilter: flowtable: consolidate net_device field in nft_forward_info struct
Date: Sat, 25 Jul 2026 12:20:20 +0200	[thread overview]
Message-ID: <amSN5P0T6PB_ji6C@lore-desk> (raw)
In-Reply-To: <20260723174952.329650-2-pablo@netfilter.org>

[-- Attachment #1: Type: text/plain, Size: 3088 bytes --]

> info->indev and info->outdev refer to the same device, a single
> info->dev field is sufficient.
> 
> While at it, remove unused router parameter from the flowtable path
> discovery function.
> 
> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>

> ---
>  net/netfilter/nf_flow_table_path.c | 20 ++++++++------------
>  1 file changed, 8 insertions(+), 12 deletions(-)
> 
> diff --git a/net/netfilter/nf_flow_table_path.c b/net/netfilter/nf_flow_table_path.c
> index 98c03b487f52..261bb44d08eb 100644
> --- a/net/netfilter/nf_flow_table_path.c
> +++ b/net/netfilter/nf_flow_table_path.c
> @@ -42,8 +42,7 @@ static bool nft_is_valid_ether_device(const struct net_device *dev)
>  	return true;
>  }
>  
> -static int nft_dev_fill_forward_path(const struct nf_flow_route *route,
> -				     const struct dst_entry *dst_cache,
> +static int nft_dev_fill_forward_path(const struct dst_entry *dst_cache,
>  				     const struct nf_conn *ct,
>  				     enum ip_conntrack_dir dir, u8 *ha,
>  				     struct net_device_path_stack *stack)
> @@ -76,8 +75,7 @@ static int nft_dev_fill_forward_path(const struct nf_flow_route *route,
>  }
>  
>  struct nft_forward_info {
> -	const struct net_device *indev;
> -	const struct net_device *outdev;
> +	const struct net_device *dev;
>  	struct id {
>  		__u16	id;
>  		__be16	proto;
> @@ -109,7 +107,7 @@ static int nft_dev_path_info(const struct net_device_path_stack *stack,
>  		case DEV_PATH_VLAN:
>  		case DEV_PATH_PPPOE:
>  		case DEV_PATH_TUN:
> -			info->indev = path->dev;
> +			info->dev = path->dev;
>  			if (is_zero_ether_addr(info->h_source))
>  				memcpy(info->h_source, path->dev->dev_addr, ETH_ALEN);
>  
> @@ -179,10 +177,9 @@ static int nft_dev_path_info(const struct net_device_path_stack *stack,
>  			return -1;
>  		}
>  	}
> -	info->outdev = info->indev;
>  
>  	if (nf_flowtable_hw_offload(flowtable) &&
> -	    nft_is_valid_ether_device(info->indev))
> +	    nft_is_valid_ether_device(info->dev))
>  		info->xmit_type = FLOW_OFFLOAD_XMIT_DIRECT;
>  
>  	return 0;
> @@ -255,17 +252,16 @@ static int nft_dev_forward_path(const struct nft_pktinfo *pkt,
>  	unsigned char ha[ETH_ALEN];
>  	int i;
>  
> -	if (nft_dev_fill_forward_path(route, dst, ct, dir, ha, &stack) < 0 ||
> +	if (nft_dev_fill_forward_path(dst, ct, dir, ha, &stack) < 0 ||
>  	    nft_dev_path_info(&stack, &info, ha, &ft->data) < 0)
>  		return -ENOENT;
>  
> -	if (!nft_flowtable_find_dev(info.indev, ft))
> +	if (!nft_flowtable_find_dev(info.dev, ft))
>  		return -ENOENT;
>  
> -	if (info.outdev)
> -		route->tuple[dir].out.ifindex = info.outdev->ifindex;
> +	route->tuple[!dir].in.ifindex = info.dev->ifindex;
> +	route->tuple[dir].out.ifindex = info.dev->ifindex;
>  
> -	route->tuple[!dir].in.ifindex = info.indev->ifindex;
>  	for (i = 0; i < info.num_encaps; i++) {
>  		route->tuple[!dir].in.encap[i].id = info.encap[i].id;
>  		route->tuple[!dir].in.encap[i].proto = info.encap[i].proto;
> -- 
> 2.47.3
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2026-07-25 10:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23 17:49 [PATCH nf-next 0/4] flowtable: pass dst_entry from ipip tunnel Pablo Neira Ayuso
2026-07-23 17:49 ` [PATCH nf-next 1/4] netfilter: flowtable: consolidate net_device field in nft_forward_info struct Pablo Neira Ayuso
2026-07-25 10:20   ` Lorenzo Bianconi [this message]
2026-07-23 17:49 ` [PATCH nf-next 2/4] netfilter: flowtable: consolidate flowtable device check Pablo Neira Ayuso
2026-07-25 10:25   ` Lorenzo Bianconi
2026-07-23 17:49 ` [PATCH nf-next 3/4] net: pass dst via net_device_path in dev_fill_forward_path() Pablo Neira Ayuso
2026-07-25 10:56   ` Lorenzo Bianconi
2026-07-23 17:49 ` [PATCH nf-next 4/4] netfilter: flowtable: release tunnel route on error when building forward path Pablo Neira Ayuso
2026-07-25 11:05   ` 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=amSN5P0T6PB_ji6C@lore-desk \
    --to=lorenzo@kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.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 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.