netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] ip_tunnel: Add dst_cache management lwtunnel_state of ip tunnel
@ 2019-02-21 15:41 wenxu
  2019-02-22  0:23 ` kbuild test robot
  2019-02-22  0:29 ` kbuild test robot
  0 siblings, 2 replies; 3+ messages in thread
From: wenxu @ 2019-02-21 15:41 UTC (permalink / raw)
  To: netdev, davem

From: wenxu <wenxu@ucloud.cn>

The lwtunnel_state 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/ipv4/ip_tunnel_core.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/net/ipv4/ip_tunnel_core.c b/net/ipv4/ip_tunnel_core.c
index 9a0e67b..6168b90 100644
--- a/net/ipv4/ip_tunnel_core.c
+++ b/net/ipv4/ip_tunnel_core.c
@@ -252,6 +252,12 @@ static int ip_tun_build_state(struct nlattr *attr,
 
 	tun_info = lwt_tun_info(new_state);
 
+	err = dst_cache_init(&tun_info->dst_cache, GFP_ATOMIC);
+	if (err) {
+		lwtstate_free(new_state);
+		return err;
+	}
+
 	if (tb[LWTUNNEL_IP_ID])
 		tun_info->key.tun_id = nla_get_be64(tb[LWTUNNEL_IP_ID]);
 
@@ -278,6 +284,13 @@ static int ip_tun_build_state(struct nlattr *attr,
 	return 0;
 }
 
+static int ip_tun_destroy_state(struct lwtunnel_state *lwtstate)
+{
+	struct ip_tunnel_info *tun_info = lwt_tun_info(lwtstate);
+
+	dst_cache_destroy(&tun_info->dst_cache);
+}
+
 static int ip_tun_fill_encap_info(struct sk_buff *skb,
 				  struct lwtunnel_state *lwtstate)
 {
@@ -313,6 +326,7 @@ static int ip_tun_cmp_encap(struct lwtunnel_state *a, struct lwtunnel_state *b)
 
 static const struct lwtunnel_encap_ops ip_tun_lwt_ops = {
 	.build_state = ip_tun_build_state,
+	.destroy_state = ip_tun_destroy_state,
 	.fill_encap = ip_tun_fill_encap_info,
 	.get_encap_size = ip_tun_encap_nlsize,
 	.cmp_encap = ip_tun_cmp_encap,
-- 
1.8.3.1


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

* Re: [PATCH net-next] ip_tunnel: Add dst_cache management lwtunnel_state of ip tunnel
  2019-02-21 15:41 [PATCH net-next] ip_tunnel: Add dst_cache management lwtunnel_state of ip tunnel wenxu
@ 2019-02-22  0:23 ` kbuild test robot
  2019-02-22  0:29 ` kbuild test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2019-02-22  0:23 UTC (permalink / raw)
  To: wenxu; +Cc: kbuild-all, netdev, davem

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

Hi wenxu,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/wenxu-ucloud-cn/ip_tunnel-Add-dst_cache-management-lwtunnel_state-of-ip-tunnel/20190222-074749
config: i386-randconfig-x007-201907 (attached as .config)
compiler: gcc-8 (Debian 8.2.0-20) 8.2.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   net//ipv4/ip_tunnel_core.c: In function 'ip_tun_destroy_state':
>> net//ipv4/ip_tunnel_core.c:292:1: warning: no return statement in function returning non-void [-Wreturn-type]
    }
    ^
   net//ipv4/ip_tunnel_core.c: At top level:
>> net//ipv4/ip_tunnel_core.c:329:19: error: initialization of 'void (*)(struct lwtunnel_state *)' from incompatible pointer type 'int (*)(struct lwtunnel_state *)' [-Werror=incompatible-pointer-types]
     .destroy_state = ip_tun_destroy_state,
                      ^~~~~~~~~~~~~~~~~~~~
   net//ipv4/ip_tunnel_core.c:329:19: note: (near initialization for 'ip_tun_lwt_ops.destroy_state')
   cc1: some warnings being treated as errors

vim +329 net//ipv4/ip_tunnel_core.c

   286	
   287	static int ip_tun_destroy_state(struct lwtunnel_state *lwtstate)
   288	{
   289		struct ip_tunnel_info *tun_info = lwt_tun_info(lwtstate);
   290	
   291		dst_cache_destroy(&tun_info->dst_cache);
 > 292	}
   293	
   294	static int ip_tun_fill_encap_info(struct sk_buff *skb,
   295					  struct lwtunnel_state *lwtstate)
   296	{
   297		struct ip_tunnel_info *tun_info = lwt_tun_info(lwtstate);
   298	
   299		if (nla_put_be64(skb, LWTUNNEL_IP_ID, tun_info->key.tun_id,
   300				 LWTUNNEL_IP_PAD) ||
   301		    nla_put_in_addr(skb, LWTUNNEL_IP_DST, tun_info->key.u.ipv4.dst) ||
   302		    nla_put_in_addr(skb, LWTUNNEL_IP_SRC, tun_info->key.u.ipv4.src) ||
   303		    nla_put_u8(skb, LWTUNNEL_IP_TOS, tun_info->key.tos) ||
   304		    nla_put_u8(skb, LWTUNNEL_IP_TTL, tun_info->key.ttl) ||
   305		    nla_put_be16(skb, LWTUNNEL_IP_FLAGS, tun_info->key.tun_flags))
   306			return -ENOMEM;
   307	
   308		return 0;
   309	}
   310	
   311	static int ip_tun_encap_nlsize(struct lwtunnel_state *lwtstate)
   312	{
   313		return nla_total_size_64bit(8)	/* LWTUNNEL_IP_ID */
   314			+ nla_total_size(4)	/* LWTUNNEL_IP_DST */
   315			+ nla_total_size(4)	/* LWTUNNEL_IP_SRC */
   316			+ nla_total_size(1)	/* LWTUNNEL_IP_TOS */
   317			+ nla_total_size(1)	/* LWTUNNEL_IP_TTL */
   318			+ nla_total_size(2);	/* LWTUNNEL_IP_FLAGS */
   319	}
   320	
   321	static int ip_tun_cmp_encap(struct lwtunnel_state *a, struct lwtunnel_state *b)
   322	{
   323		return memcmp(lwt_tun_info(a), lwt_tun_info(b),
   324			      sizeof(struct ip_tunnel_info));
   325	}
   326	
   327	static const struct lwtunnel_encap_ops ip_tun_lwt_ops = {
   328		.build_state = ip_tun_build_state,
 > 329		.destroy_state = ip_tun_destroy_state,
   330		.fill_encap = ip_tun_fill_encap_info,
   331		.get_encap_size = ip_tun_encap_nlsize,
   332		.cmp_encap = ip_tun_cmp_encap,
   333		.owner = THIS_MODULE,
   334	};
   335	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 30912 bytes --]

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

* Re: [PATCH net-next] ip_tunnel: Add dst_cache management lwtunnel_state of ip tunnel
  2019-02-21 15:41 [PATCH net-next] ip_tunnel: Add dst_cache management lwtunnel_state of ip tunnel wenxu
  2019-02-22  0:23 ` kbuild test robot
@ 2019-02-22  0:29 ` kbuild test robot
  1 sibling, 0 replies; 3+ messages in thread
From: kbuild test robot @ 2019-02-22  0:29 UTC (permalink / raw)
  To: wenxu; +Cc: kbuild-all, netdev, davem

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

Hi wenxu,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/wenxu-ucloud-cn/ip_tunnel-Add-dst_cache-management-lwtunnel_state-of-ip-tunnel/20190222-074749
config: nds32-allyesconfig (attached as .config)
compiler: nds32le-linux-gcc (GCC) 6.4.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        GCC_VERSION=6.4.0 make.cross ARCH=nds32 

All errors (new ones prefixed by >>):

   net//ipv4/ip_tunnel_core.c: In function 'ip_tun_destroy_state':
   net//ipv4/ip_tunnel_core.c:292:1: warning: no return statement in function returning non-void [-Wreturn-type]
    }
    ^
   net//ipv4/ip_tunnel_core.c: At top level:
>> net//ipv4/ip_tunnel_core.c:329:19: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
     .destroy_state = ip_tun_destroy_state,
                      ^~~~~~~~~~~~~~~~~~~~
   net//ipv4/ip_tunnel_core.c:329:19: note: (near initialization for 'ip_tun_lwt_ops.destroy_state')
   cc1: some warnings being treated as errors

vim +329 net//ipv4/ip_tunnel_core.c

   286	
   287	static int ip_tun_destroy_state(struct lwtunnel_state *lwtstate)
   288	{
   289		struct ip_tunnel_info *tun_info = lwt_tun_info(lwtstate);
   290	
   291		dst_cache_destroy(&tun_info->dst_cache);
 > 292	}
   293	
   294	static int ip_tun_fill_encap_info(struct sk_buff *skb,
   295					  struct lwtunnel_state *lwtstate)
   296	{
   297		struct ip_tunnel_info *tun_info = lwt_tun_info(lwtstate);
   298	
   299		if (nla_put_be64(skb, LWTUNNEL_IP_ID, tun_info->key.tun_id,
   300				 LWTUNNEL_IP_PAD) ||
   301		    nla_put_in_addr(skb, LWTUNNEL_IP_DST, tun_info->key.u.ipv4.dst) ||
   302		    nla_put_in_addr(skb, LWTUNNEL_IP_SRC, tun_info->key.u.ipv4.src) ||
   303		    nla_put_u8(skb, LWTUNNEL_IP_TOS, tun_info->key.tos) ||
   304		    nla_put_u8(skb, LWTUNNEL_IP_TTL, tun_info->key.ttl) ||
   305		    nla_put_be16(skb, LWTUNNEL_IP_FLAGS, tun_info->key.tun_flags))
   306			return -ENOMEM;
   307	
   308		return 0;
   309	}
   310	
   311	static int ip_tun_encap_nlsize(struct lwtunnel_state *lwtstate)
   312	{
   313		return nla_total_size_64bit(8)	/* LWTUNNEL_IP_ID */
   314			+ nla_total_size(4)	/* LWTUNNEL_IP_DST */
   315			+ nla_total_size(4)	/* LWTUNNEL_IP_SRC */
   316			+ nla_total_size(1)	/* LWTUNNEL_IP_TOS */
   317			+ nla_total_size(1)	/* LWTUNNEL_IP_TTL */
   318			+ nla_total_size(2);	/* LWTUNNEL_IP_FLAGS */
   319	}
   320	
   321	static int ip_tun_cmp_encap(struct lwtunnel_state *a, struct lwtunnel_state *b)
   322	{
   323		return memcmp(lwt_tun_info(a), lwt_tun_info(b),
   324			      sizeof(struct ip_tunnel_info));
   325	}
   326	
   327	static const struct lwtunnel_encap_ops ip_tun_lwt_ops = {
   328		.build_state = ip_tun_build_state,
 > 329		.destroy_state = ip_tun_destroy_state,
   330		.fill_encap = ip_tun_fill_encap_info,
   331		.get_encap_size = ip_tun_encap_nlsize,
   332		.cmp_encap = ip_tun_cmp_encap,
   333		.owner = THIS_MODULE,
   334	};
   335	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 49937 bytes --]

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

end of thread, other threads:[~2019-02-22  0:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-21 15:41 [PATCH net-next] ip_tunnel: Add dst_cache management lwtunnel_state of ip tunnel wenxu
2019-02-22  0:23 ` kbuild test robot
2019-02-22  0:29 ` kbuild test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).