* [PATCH net v2] geneve: initialize needed_headroom
@ 2015-12-23 15:54 Paolo Abeni
2015-12-23 16:01 ` John W. Linville
2015-12-24 3:28 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Paolo Abeni @ 2015-12-23 15:54 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Pravin B Shelar, Jiri Benc, Jesse Gross,
Hannes Frederic Sowa
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: Paolo Abeni <pabeni@redhat.com>
Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
---
drivers/net/geneve.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index c2b79f5..58efdec 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -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_dev *t, *geneve = netdev_priv(dev);
bool tun_collect_md, tun_on_same_port;
- int err;
+ int err, encap_len;
if (!remote)
return -EINVAL;
@@ -1187,6 +1187,14 @@ static int geneve_configure(struct net *net, struct net_device *dev,
if (t)
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 (tun_on_same_port)
return -EPERM;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net v2] geneve: initialize needed_headroom
2015-12-23 15:54 [PATCH net v2] geneve: initialize needed_headroom Paolo Abeni
@ 2015-12-23 16:01 ` John W. Linville
2015-12-24 3:28 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: John W. Linville @ 2015-12-23 16:01 UTC (permalink / raw)
To: Paolo Abeni
Cc: netdev, David S. Miller, Pravin B Shelar, Jiri Benc, Jesse Gross,
Hannes Frederic Sowa
On Wed, Dec 23, 2015 at 04:54:27PM +0100, Paolo Abeni wrote:
> 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: Paolo Abeni <pabeni@redhat.com>
> Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
This time I really mean it... ;-)
Acked-by: John W. Linville <linville@tuxdriver.com>
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net v2] geneve: initialize needed_headroom
2015-12-23 15:54 [PATCH net v2] geneve: initialize needed_headroom Paolo Abeni
2015-12-23 16:01 ` John W. Linville
@ 2015-12-24 3:28 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-12-24 3:28 UTC (permalink / raw)
To: pabeni; +Cc: netdev, pshelar, jbenc, jesse, hannes
From: Paolo Abeni <pabeni@redhat.com>
Date: Wed, 23 Dec 2015 16:54:27 +0100
> 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: Paolo Abeni <pabeni@redhat.com>
> Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>
Applied, thank you.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-12-24 3:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-23 15:54 [PATCH net v2] geneve: initialize needed_headroom Paolo Abeni
2015-12-23 16:01 ` John W. Linville
2015-12-24 3:28 ` David Miller
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).