Skip to content

Commit 3c1cb4d

Browse files
Paolo Abenidavem330
authored andcommitted
net/ipv4: add dst cache support for gre lwtunnels
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>
1 parent 468dfff commit 3c1cb4d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

net/ipv4/ip_gre.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -540,9 +540,16 @@ static void gre_fb_xmit(struct sk_buff *skb, struct net_device *dev)
540540
goto err_free_skb;
541541

542542
key = &tun_info->key;
543-
rt = gre_get_rt(skb, dev, &fl, key);
544-
if (IS_ERR(rt))
545-
goto err_free_skb;
543+
rt = !skb->mark ? dst_cache_get_ip4(&tun_info->dst_cache, &fl.saddr) :
544+
NULL;
545+
if (!rt) {
546+
rt = gre_get_rt(skb, dev, &fl, key);
547+
if (IS_ERR(rt))
548+
goto err_free_skb;
549+
if (!skb->mark)
550+
dst_cache_set_ip4(&tun_info->dst_cache, &rt->dst,
551+
fl.saddr);
552+
}
546553

547554
tunnel_hlen = ip_gre_calc_hlen(key->tun_flags);
548555

0 commit comments

Comments
 (0)