From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: Paolo Abeni <pabeni@redhat.com>, netdev@vger.kernel.org
Cc: "David S. Miller" <davem@davemloft.net>,
Thomas Graf <tgraf@suug.ch>, Pravin B Shelar <pshelar@nicira.com>,
Jiri Benc <jbenc@redhat.com>,
Hannes Frederic Sowa <hannes@stressinduktion.org>,
Tom Herbert <therbert@google.com>
Subject: Re: [PATCH net-next 7/7] net/ipv4: add dst cache support for gre lwtunnels
Date: Thu, 11 Feb 2016 15:59:25 +0300 [thread overview]
Message-ID: <56BC85AD.4080408@cogentembedded.com> (raw)
In-Reply-To: <5ec1726778a0bb0e2e3768641d057595296cca56.1455184959.git.pabeni@redhat.com>
Hello.
On 2/11/2016 1:12 PM, Paolo Abeni wrote:
> In case of UDP traffic with datagram length below MTU this
> give about 4% performance increase
Gives.
> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
> Suggested-and-acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
> ---
> net/ipv4/ip_gre.c | 17 ++++++++++++++---
> 1 file changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
> index 7c51c4e..be6f3f6 100644
> --- a/net/ipv4/ip_gre.c
> +++ b/net/ipv4/ip_gre.c
> @@ -524,6 +524,7 @@ static void gre_fb_xmit(struct sk_buff *skb, struct net_device *dev)
> int tunnel_hlen;
> __be16 df, flags;
> int err;
> + bool use_cache;
DaveM prefers the declarations "sorted" from longest to shortest.
>
> tun_info = skb_tunnel_info(skb);
> if (unlikely(!tun_info || !(tun_info->mode & IP_TUNNEL_INFO_TX) ||
> @@ -531,9 +532,19 @@ static void gre_fb_xmit(struct sk_buff *skb, struct net_device *dev)
> goto err_free_skb;
>
> key = &tun_info->key;
> - rt = gre_get_rt(skb, dev, &fl, key);
> - if (IS_ERR(rt))
> - goto err_free_skb;
> +
> + use_cache = !skb->mark && tun_info->dst_cache;
> + rt = use_cache ? dst_cache_get_ip4(tun_info->dst_cache, &fl.saddr) :
> + NULL;
> +
Empty line hardly needed here.
> + if (!rt) {
> + rt = gre_get_rt(skb, dev, &fl, key);
> + if (IS_ERR(rt))
> + goto err_free_skb;
> + if (use_cache)
> + dst_cache_set_ip4(tun_info->dst_cache, &rt->dst,
> + fl.saddr);
> + }
>
> tunnel_hlen = ip_gre_calc_hlen(key->tun_flags);
>
MBR, Sergei
prev parent reply other threads:[~2016-02-11 12:59 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-11 10:11 [PATCH net-next 0/7] net: unify dst caching for tunnel devices Paolo Abeni
2016-02-11 10:11 ` [PATCH net-next 1/7] net: add dst_cache support Paolo Abeni
2016-02-11 10:11 ` [PATCH net-next 2/7] net: replace dst_cache ip6_tunnel implementation with the generic one Paolo Abeni
2016-02-11 10:11 ` [PATCH net-next 3/7] ip_tunnel: replace dst_cache with generic implementation Paolo Abeni
2016-02-11 10:12 ` [PATCH net-next 4/7] net: use dst_cache for vxlan device Paolo Abeni
2016-02-11 11:11 ` Jiri Benc
2016-02-11 10:12 ` [PATCH net-next 5/7] net: add dst_cache to ovs vxlan lwtunnel Paolo Abeni
2016-02-11 11:48 ` Jiri Benc
2016-02-11 10:12 ` [PATCH net-next 6/7] geneve: add dst caching support Paolo Abeni
2016-02-11 10:12 ` [PATCH net-next 7/7] net/ipv4: add dst cache support for gre lwtunnels Paolo Abeni
2016-02-11 12:59 ` Sergei Shtylyov [this message]
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=56BC85AD.4080408@cogentembedded.com \
--to=sergei.shtylyov@cogentembedded.com \
--cc=davem@davemloft.net \
--cc=hannes@stressinduktion.org \
--cc=jbenc@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pshelar@nicira.com \
--cc=tgraf@suug.ch \
--cc=therbert@google.com \
/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 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).