Message ID | 1375364992.10515.141.camel@edumazet-glaptop |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
On Thu, 2013-08-01 at 06:49 -0700, Eric Dumazet wrote: > From: Eric Dumazet <edumazet@google.com> > > ax88179_tx_fixup() has quite complex code trying to push 8 bytes > of control data (len/mss), but fails to do it properly for TCP packets, > incurring an extra copy and point of memory allocation failure. I forgot to say this patch is for net-next, but depends on following fix from net tree being applied. commit 20f0170377264e8449b6987041f0bcc4d746d3ed ("usbnet: do not pretend to support SG/TSO") -- 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
From: Eric Dumazet <eric.dumazet@gmail.com> Date: Thu, 01 Aug 2013 06:52:45 -0700 > On Thu, 2013-08-01 at 06:49 -0700, Eric Dumazet wrote: >> From: Eric Dumazet <edumazet@google.com> >> >> ax88179_tx_fixup() has quite complex code trying to push 8 bytes >> of control data (len/mss), but fails to do it properly for TCP packets, >> incurring an extra copy and point of memory allocation failure. > > I forgot to say this patch is for net-next, but depends on following fix > from net tree being applied. > > commit 20f0170377264e8449b6987041f0bcc4d746d3ed > ("usbnet: do not pretend to support SG/TSO") Thanks for letting me know. Applied, thanks Eric. -- 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/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c index 2bc87e3..e2120d6 100644 --- a/drivers/net/usb/ax88179_178a.c +++ b/drivers/net/usb/ax88179_178a.c @@ -1166,31 +1166,18 @@ ax88179_tx_fixup(struct usbnet *dev, struct sk_buff *skb, gfp_t flags) int frame_size = dev->maxpacket; int mss = skb_shinfo(skb)->gso_size; int headroom; - int tailroom; tx_hdr1 = skb->len; tx_hdr2 = mss; if (((skb->len + 8) % frame_size) == 0) tx_hdr2 |= 0x80008000; /* Enable padding */ - headroom = skb_headroom(skb); - tailroom = skb_tailroom(skb); + headroom = skb_headroom(skb) - 8; - if (!skb_header_cloned(skb) && - !skb_cloned(skb) && - (headroom + tailroom) >= 8) { - if (headroom < 8) { - skb->data = memmove(skb->head + 8, skb->data, skb->len); - skb_set_tail_pointer(skb, skb->len); - } - } else { - struct sk_buff *skb2; - - skb2 = skb_copy_expand(skb, 8, 0, flags); + if ((skb_header_cloned(skb) || headroom < 0) && + pskb_expand_head(skb, headroom < 0 ? 8 : 0, 0, GFP_ATOMIC)) { dev_kfree_skb_any(skb); - skb = skb2; - if (!skb) - return NULL; + return NULL; } skb_push(skb, 4);