aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPaolo Abeni <pabeni@redhat.com>2016-02-12 09:43:57 -0500
committerDavid S. Miller <davem@davemloft.net>2016-02-16 20:21:48 -0500
commitd71785ffc7e7cae3fbdc4ea8a9d05b7a1c59f7b8 (patch)
tree142081880ca68e3f066df14ecfb2371b229e76fd /net
parent0c1d70af924b966cc71e9e48920b2b635441aa50 (diff)
net: add dst_cache to ovs vxlan lwtunnel
In case of UDP traffic with datagram length below MTU this give about 2% performance increase when tunneling over ipv4 and about 60% when tunneling over ipv6 Signed-off-by: Paolo Abeni <pabeni@redhat.com> Suggested-and-acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/dst.c10
-rw-r--r--net/openvswitch/Kconfig1
-rw-r--r--net/openvswitch/flow_netlink.c6
3 files changed, 16 insertions, 1 deletions
diff --git a/net/core/dst.c b/net/core/dst.c
index a1656e3b8d72..b5cbbe07f786 100644
--- a/net/core/dst.c
+++ b/net/core/dst.c
@@ -265,7 +265,7 @@ again:
265 lwtstate_put(dst->lwtstate); 265 lwtstate_put(dst->lwtstate);
266 266
267 if (dst->flags & DST_METADATA) 267 if (dst->flags & DST_METADATA)
268 kfree(dst); 268 metadata_dst_free((struct metadata_dst *)dst);
269 else 269 else
270 kmem_cache_free(dst->ops->kmem_cachep, dst); 270 kmem_cache_free(dst->ops->kmem_cachep, dst);
271 271
@@ -395,6 +395,14 @@ struct metadata_dst *metadata_dst_alloc(u8 optslen, gfp_t flags)
395} 395}
396EXPORT_SYMBOL_GPL(metadata_dst_alloc); 396EXPORT_SYMBOL_GPL(metadata_dst_alloc);
397 397
398void metadata_dst_free(struct metadata_dst *md_dst)
399{
400#ifdef CONFIG_DST_CACHE
401 dst_cache_destroy(&md_dst->u.tun_info.dst_cache);
402#endif
403 kfree(md_dst);
404}
405
398struct metadata_dst __percpu *metadata_dst_alloc_percpu(u8 optslen, gfp_t flags) 406struct metadata_dst __percpu *metadata_dst_alloc_percpu(u8 optslen, gfp_t flags)
399{ 407{
400 int cpu; 408 int cpu;
diff --git a/net/openvswitch/Kconfig b/net/openvswitch/Kconfig
index d143aa9f6654..cd5fd9d728a7 100644
--- a/net/openvswitch/Kconfig
+++ b/net/openvswitch/Kconfig
@@ -10,6 +10,7 @@ config OPENVSWITCH
10 select LIBCRC32C 10 select LIBCRC32C
11 select MPLS 11 select MPLS
12 select NET_MPLS_GSO 12 select NET_MPLS_GSO
13 select DST_CACHE
13 ---help--- 14 ---help---
14 Open vSwitch is a multilayer Ethernet switch targeted at virtualized 15 Open vSwitch is a multilayer Ethernet switch targeted at virtualized
15 environments. In addition to supporting a variety of features 16 environments. In addition to supporting a variety of features
diff --git a/net/openvswitch/flow_netlink.c b/net/openvswitch/flow_netlink.c
index d1bd4a45ca2d..58b8efc23668 100644
--- a/net/openvswitch/flow_netlink.c
+++ b/net/openvswitch/flow_netlink.c
@@ -1959,6 +1959,12 @@ static int validate_and_copy_set_tun(const struct nlattr *attr,
1959 if (!tun_dst) 1959 if (!tun_dst)
1960 return -ENOMEM; 1960 return -ENOMEM;
1961 1961
1962 err = dst_cache_init(&tun_dst->u.tun_info.dst_cache, GFP_KERNEL);
1963 if (err) {
1964 dst_release((struct dst_entry *)tun_dst);
1965 return err;
1966 }
1967
1962 a = __add_action(sfa, OVS_KEY_ATTR_TUNNEL_INFO, NULL, 1968 a = __add_action(sfa, OVS_KEY_ATTR_TUNNEL_INFO, NULL,
1963 sizeof(*ovs_tun), log); 1969 sizeof(*ovs_tun), log);
1964 if (IS_ERR(a)) { 1970 if (IS_ERR(a)) {