Commit 184fc8b5 authored by Paolo Abeni's avatar Paolo Abeni Committed by David S. Miller

geneve: initialize needed_headroom

Currently the needed_headroom field for the geneve device is left
to the default value.

This patch set it to space required for basic geneve encapsulation,
so that we can avoid the skb head re-allocation on xmit.

This give a 6% speedup for unsegment traffic on geneve tunnel.

v1 -> v2:
  - add ETH_HLEN for the lower device to the needed headroom
Signed-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
Acked-by: default avatarHannes Frederic Sowa <hannes@stressinduktion.org>
Acked-by: default avatarJohn W. Linville <linville@tuxdriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c1a9a291
...@@ -1155,7 +1155,7 @@ static int geneve_configure(struct net *net, struct net_device *dev, ...@@ -1155,7 +1155,7 @@ static int geneve_configure(struct net *net, struct net_device *dev,
struct geneve_net *gn = net_generic(net, geneve_net_id); struct geneve_net *gn = net_generic(net, geneve_net_id);
struct geneve_dev *t, *geneve = netdev_priv(dev); struct geneve_dev *t, *geneve = netdev_priv(dev);
bool tun_collect_md, tun_on_same_port; bool tun_collect_md, tun_on_same_port;
int err; int err, encap_len;
if (!remote) if (!remote)
return -EINVAL; return -EINVAL;
...@@ -1187,6 +1187,14 @@ static int geneve_configure(struct net *net, struct net_device *dev, ...@@ -1187,6 +1187,14 @@ static int geneve_configure(struct net *net, struct net_device *dev,
if (t) if (t)
return -EBUSY; return -EBUSY;
/* make enough headroom for basic scenario */
encap_len = GENEVE_BASE_HLEN + ETH_HLEN;
if (remote->sa.sa_family == AF_INET)
encap_len += sizeof(struct iphdr);
else
encap_len += sizeof(struct ipv6hdr);
dev->needed_headroom = encap_len + ETH_HLEN;
if (metadata) { if (metadata) {
if (tun_on_same_port) if (tun_on_same_port)
return -EPERM; return -EPERM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment