* [PATCH net-next] netfilter: nft_tunnel: Add dst_cache support
@ 2019-02-22 9:00 wenxu
2019-03-01 13:28 ` Pablo Neira Ayuso
0 siblings, 1 reply; 3+ messages in thread
From: wenxu @ 2019-02-22 9:00 UTC (permalink / raw)
To: pablo; +Cc: netfilter-devel
From: wenxu <wenxu@ucloud.cn>
The metadata_dst is not init the dst_cache which make the
ip_md_tunnel_xmit can't use the dst_cache. It will lookup
route table every packets.
Signed-off-by: wenxu <wenxu@ucloud.cn>
---
net/netfilter/nft_tunnel.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/netfilter/nft_tunnel.c b/net/netfilter/nft_tunnel.c
index ea28588..b113fca 100644
--- a/net/netfilter/nft_tunnel.c
+++ b/net/netfilter/nft_tunnel.c
@@ -406,6 +406,13 @@ static int nft_tunnel_obj_init(const struct nft_ctx *ctx,
return -ENOMEM;
memcpy(&md->u.tun_info, &info, sizeof(info));
+#ifdef CONFIG_DST_CACHE
+ err = dst_cache_init(&md->u.tun_info.dst_cache, GFP_KERNEL);
+ if (err < 0) {
+ metadata_dst_free(md);
+ return err;
+ }
+#endif
ip_tunnel_info_opts_set(&md->u.tun_info, &priv->opts.u, priv->opts.len,
priv->opts.flags);
priv->md = md;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net-next] netfilter: nft_tunnel: Add dst_cache support
2019-02-22 9:00 [PATCH net-next] netfilter: nft_tunnel: Add dst_cache support wenxu
@ 2019-03-01 13:28 ` Pablo Neira Ayuso
0 siblings, 0 replies; 3+ messages in thread
From: Pablo Neira Ayuso @ 2019-03-01 13:28 UTC (permalink / raw)
To: wenxu; +Cc: netfilter-devel
On Fri, Feb 22, 2019 at 05:00:43PM +0800, wenxu@ucloud.cn wrote:
> From: wenxu <wenxu@ucloud.cn>
>
> The metadata_dst is not init the dst_cache which make the
> ip_md_tunnel_xmit can't use the dst_cache. It will lookup
> route table every packets.
Applied, thanks.
One comment below:
> Signed-off-by: wenxu <wenxu@ucloud.cn>
> ---
> net/netfilter/nft_tunnel.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/net/netfilter/nft_tunnel.c b/net/netfilter/nft_tunnel.c
> index ea28588..b113fca 100644
> --- a/net/netfilter/nft_tunnel.c
> +++ b/net/netfilter/nft_tunnel.c
> @@ -406,6 +406,13 @@ static int nft_tunnel_obj_init(const struct nft_ctx *ctx,
> return -ENOMEM;
>
> memcpy(&md->u.tun_info, &info, sizeof(info));
> +#ifdef CONFIG_DST_CACHE
To reduce ifdef pollution, it would be good to turn dst_cache_init()
into noop via static inline trick in case CONFIG_DST_CACHE=n.
BTW, I suspect net/sched/act_tunnel_key.c also needs a similar update.
> + err = dst_cache_init(&md->u.tun_info.dst_cache, GFP_KERNEL);
> + if (err < 0) {
> + metadata_dst_free(md);
> + return err;
> + }
> +#endif
> ip_tunnel_info_opts_set(&md->u.tun_info, &priv->opts.u, priv->opts.len,
> priv->opts.flags);
> priv->md = md;
> --
> 1.8.3.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH net-next] netfilter: nft_tunnel: Add dst_cache support
@ 2019-02-22 8:26 wenxu
0 siblings, 0 replies; 3+ messages in thread
From: wenxu @ 2019-02-22 8:26 UTC (permalink / raw)
To: pablo; +Cc: netdev
From: wenxu <wenxu@ucloud.cn>
The metadata_dst is not init the dst_cache which make the
ip_md_tunnel_xmit can't use the dst_cache. It will lookup
route table every packets.
Signed-off-by: wenxu <wenxu@ucloud.cn>
---
net/netfilter/nft_tunnel.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/netfilter/nft_tunnel.c b/net/netfilter/nft_tunnel.c
index ea28588..b113fca 100644
--- a/net/netfilter/nft_tunnel.c
+++ b/net/netfilter/nft_tunnel.c
@@ -406,6 +406,13 @@ static int nft_tunnel_obj_init(const struct nft_ctx *ctx,
return -ENOMEM;
memcpy(&md->u.tun_info, &info, sizeof(info));
+#ifdef CONFIG_DST_CACHE
+ err = dst_cache_init(&md->u.tun_info.dst_cache, GFP_KERNEL);
+ if (err < 0) {
+ metadata_dst_free(md);
+ return err;
+ }
+#endif
ip_tunnel_info_opts_set(&md->u.tun_info, &priv->opts.u, priv->opts.len,
priv->opts.flags);
priv->md = md;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-03-01 13:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-22 9:00 [PATCH net-next] netfilter: nft_tunnel: Add dst_cache support wenxu
2019-03-01 13:28 ` Pablo Neira Ayuso
-- strict thread matches above, loose matches on Subject: below --
2019-02-22 8:26 wenxu
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.