]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
udp: Record gso_segs when supporting UDP segmentation offload
authorAlexander Duyck <alexander.h.duyck@intel.com>
Mon, 7 May 2018 18:08:22 +0000 (11:08 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 9 May 2018 02:30:05 +0000 (22:30 -0400)
We need to record the number of segments that will be generated when this
frame is segmented. The expectation is that if gso_size is set then
gso_segs is set as well. Without this some drivers such as ixgbe get
confused if they attempt to offload this as they record 0 segments for the
entire packet instead of the correct value.

Reviewed-by: Eric Dumazet <edumazet@google.com>
Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/udp.c

index dd3102a37ef937283558f07983489b636edf4876..e07db83b311efd48d323e41242105a153fb1bbc8 100644 (file)
@@ -793,6 +793,8 @@ static int udp_send_skb(struct sk_buff *skb, struct flowi4 *fl4,
 
                skb_shinfo(skb)->gso_size = cork->gso_size;
                skb_shinfo(skb)->gso_type = SKB_GSO_UDP_L4;
+               skb_shinfo(skb)->gso_segs = DIV_ROUND_UP(len - sizeof(uh),
+                                                        cork->gso_size);
                goto csum_partial;
        }