aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/usb/ax88179_178a.c
diff options
context:
space:
mode:
authorEric Dumazet2013-08-01 06:49:52 -0700
committerDavid S. Miller2013-08-03 21:55:52 -0700
commitf27070158d6754765f2f5fd1617e8e42a0ea2318 (patch)
treee203a11394a14d0a4659933e6210e7bfe0f50661 /drivers/net/usb/ax88179_178a.c
parent0e76a3a587fc7abda2badf249053b427baad255e (diff)
ax88179_178a: avoid copy of tx tcp packets
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. Lets use the simple and approved way. dev->needed_headroom being 8, all frames should have 8 bytes of headroom, so the extra copy should be unlikely anyway. This patch should improve performance for TCP xmits. Reported-by: Ming Lei <ming.lei@canonical.com> Tested-by: Ming Lei <ming.lei@canonical.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb/ax88179_178a.c')
-rw-r--r--drivers/net/usb/ax88179_178a.c21
1 files changed, 4 insertions, 17 deletions
diff --git a/drivers/net/usb/ax88179_178a.c b/drivers/net/usb/ax88179_178a.c
index 5a468f317ca5..fb0caa289d0b 100644
--- a/drivers/net/usb/ax88179_178a.c
+++ b/drivers/net/usb/ax88179_178a.c
@@ -1169,31 +1169,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);