Message ID | 1396990288-10692-1-git-send-email-fw@strlen.de |
---|---|
State | Changes Requested, archived |
Delegated to: | David Miller |
Headers | show |
From: Florian Westphal <fw@strlen.de> Date: Tue, 8 Apr 2014 22:51:28 +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: de960aa9ab4d ("net: add and use skb_gso_transport_seglen()") > Cc: Eric Dumazet <eric.dumazet@gmail.com> > Reported-by: Tobias Brunner <tobias@strongswan.org> > Signed-off-by: Florian Westphal <fw@strlen.de> I agree completely with the fix, but not necessarily with the Fixes: tag. All that commit did was move the code to a common location, it always had this bug. I suppose you could list the subsequent commit, the one that started using this helper in the IP forwarding code, as what this "Fixes". Thanks Florian. -- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
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);
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: de960aa9ab4d ("net: add and use skb_gso_transport_seglen()") Cc: Eric Dumazet <eric.dumazet@gmail.com> Reported-by: Tobias Brunner <tobias@strongswan.org> Signed-off-by: Florian Westphal <fw@strlen.de> --- net/core/skbuff.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)