Skip to content

Commit

Permalink
net/ipv4: add dst cache support for gre lwtunnels
Browse files Browse the repository at this point in the history
In case of UDP traffic with datagram length below MTU this
gives about 4% performance increase

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>
  • Loading branch information
Paolo Abeni authored and David S. Miller committed Feb 17, 2016
1 parent 468dfff commit 3c1cb4d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions net/ipv4/ip_gre.c
Original file line number Diff line number Diff line change
Expand Up @@ -540,9 +540,16 @@ 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;
rt = !skb->mark ? dst_cache_get_ip4(&tun_info->dst_cache, &fl.saddr) :
NULL;
if (!rt) {
rt = gre_get_rt(skb, dev, &fl, key);
if (IS_ERR(rt))
goto err_free_skb;
if (!skb->mark)
dst_cache_set_ip4(&tun_info->dst_cache, &rt->dst,
fl.saddr);
}

tunnel_hlen = ip_gre_calc_hlen(key->tun_flags);

Expand Down

0 comments on commit 3c1cb4d

Please sign in to comment.