]> git.karo-electronics.de Git - linux-beck.git/commitdiff
net: cdc_ncm: no point in filling up the NTBs if we send ZLPs
authorBjørn Mork <bjorn@mork.no>
Fri, 1 Nov 2013 10:16:49 +0000 (11:16 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sat, 2 Nov 2013 06:02:03 +0000 (02:02 -0400)
Padding NTBs to max size is part of the support for devices
optimizing their DMA transfers. This optimization depends on
max sized NTBs not being ZLP terminated. So we are much better
off dropping the padding if we are going to send a ZLP anyway.

Cc: Alexey Orishko <alexey.orishko@gmail.com>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/usb/cdc_ncm.c

index 5aa3e60851d0f76a0092c6edba9f7e3ff91ce9e7..42c86200f0760ad16d494cf5dabbdf8b70677f0e 100644 (file)
@@ -800,8 +800,12 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign)
         * would be more efficient for USB HS mobile device with DMA
         * engine to receive a full size NTB, than canceling DMA
         * transfer and receiving a short packet.
+        *
+        * This optimization support is pointless if we end up sending
+        * a ZLP after full sized NTBs.
         */
-       if (skb_out->len > CDC_NCM_MIN_TX_PKT)
+       if (!(dev->driver_info->flags & FLAG_SEND_ZLP) &&
+           skb_out->len > CDC_NCM_MIN_TX_PKT)
                memset(skb_put(skb_out, ctx->tx_max - skb_out->len), 0,
                       ctx->tx_max - skb_out->len);
        else if ((skb_out->len % dev->maxpacket) == 0)