aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2014-04-09 04:28:50 -0400
committerDavid S. Miller <davem@davemloft.net>2014-04-10 21:41:25 -0400
commit6d39d589bb76ee8a1c6cde6822006ae0053decff (patch)
tree1b54b48a6b8c3b95df7f6fadc6741e4683c70dc0 /net
parentf34c4a35d87949fbb0e0f31eba3c054e9f8199ba (diff)
net: core: don't account for udp header size when computing seglen
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/core/skbuff.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 30c7d35dd862..57e225c8914e 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -3937,12 +3937,14 @@ EXPORT_SYMBOL_GPL(skb_scrub_packet);
3937unsigned int skb_gso_transport_seglen(const struct sk_buff *skb) 3937unsigned int skb_gso_transport_seglen(const struct sk_buff *skb)
3938{ 3938{
3939 const struct skb_shared_info *shinfo = skb_shinfo(skb); 3939 const struct skb_shared_info *shinfo = skb_shinfo(skb);
3940 unsigned int hdr_len;
3941 3940
3942 if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6))) 3941 if (likely(shinfo->gso_type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6)))
3943 hdr_len = tcp_hdrlen(skb); 3942 return tcp_hdrlen(skb) + shinfo->gso_size;
3944 else 3943
3945 hdr_len = sizeof(struct udphdr); 3944 /* UFO sets gso_size to the size of the fragmentation
3946 return hdr_len + shinfo->gso_size; 3945 * payload, i.e. the size of the L4 (UDP) header is already
3946 * accounted for.
3947 */
3948 return shinfo->gso_size;
3947} 3949}
3948EXPORT_SYMBOL_GPL(skb_gso_transport_seglen); 3950EXPORT_SYMBOL_GPL(skb_gso_transport_seglen);