* [PATCH v2] net: core: don't account for udp header size when computing seglen
@ 2014-04-09 8:28 Florian Westphal
2014-04-11 1:42 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Florian Westphal @ 2014-04-09 8:28 UTC (permalink / raw)
To: netdev; +Cc: Florian Westphal, Eric Dumazet
In case of tcp, gso_size contains the tcpmss.
For UFO (udp fragmentation offloading) skbs, gso_size is the fragment
payload size, i.e. we must not account for udp header size.
Otherwise, when using virtio drivers, a to-be-forwarded UFO GSO packet
will be needlessly fragmented in the forward path, because we think its
individual segments are too large for the outgoing link.
Fixes: fe6cc55f3a9a053 ("net: ip, ipv6: handle gso skbs in forwarding path")
Cc: Eric Dumazet <eric.dumazet@gmail.com>
Reported-by: Tobias Brunner <tobias@strongswan.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
---
changes since v1:
- update 'Fixes:' tag.
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 30c7d35..57e225c 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -3937,12 +3937,14 @@ EXPORT_SYMBOL_GPL(skb_scrub_packet);
unsigned int skb_gso_transport_seglen(const struct sk_buff *skb)
{
const struct skb_shared_info *shinfo = skb_shinfo(skb);
- unsigned int hdr_len;
if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)))
- hdr_len = tcp_hdrlen(skb);
- else
- hdr_len = sizeof(struct udphdr);
- return hdr_len + shinfo->gso_size;
+ return tcp_hdrlen(skb) + shinfo->gso_size;
+
+ /* UFO sets gso_size to the size of the fragmentation
+ * payload, i.e. the size of the L4 (UDP) header is already
+ * accounted for.
+ */
+ return shinfo->gso_size;
}
EXPORT_SYMBOL_GPL(skb_gso_transport_seglen);
--
1.8.1.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] net: core: don't account for udp header size when computing seglen
2014-04-09 8:28 [PATCH v2] net: core: don't account for udp header size when computing seglen Florian Westphal
@ 2014-04-11 1:42 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-04-11 1:42 UTC (permalink / raw)
To: fw; +Cc: netdev, eric.dumazet
From: Florian Westphal <fw@strlen.de>
Date: Wed, 9 Apr 2014 10:28:50 +0200
> In case of tcp, gso_size contains the tcpmss.
>
> For UFO (udp fragmentation offloading) skbs, gso_size is the fragment
> payload size, i.e. we must not account for udp header size.
>
> Otherwise, when using virtio drivers, a to-be-forwarded UFO GSO packet
> will be needlessly fragmented in the forward path, because we think its
> individual segments are too large for the outgoing link.
>
> Fixes: fe6cc55f3a9a053 ("net: ip, ipv6: handle gso skbs in forwarding path")
> Cc: Eric Dumazet <eric.dumazet@gmail.com>
> Reported-by: Tobias Brunner <tobias@strongswan.org>
> Signed-off-by: Florian Westphal <fw@strlen.de>
> ---
> changes since v1:
> - update 'Fixes:' tag.
Applied and queued up for -stable, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-04-11 1:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-09 8:28 [PATCH v2] net: core: don't account for udp header size when computing seglen Florian Westphal
2014-04-11 1:42 ` 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).