aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjørn Mork <bjorn@mork.no>2013-11-01 06:16:49 -0400
committerDavid S. Miller <davem@davemloft.net>2013-11-02 02:02:03 -0400
commit4d619f625a6011618de9fccc4b282d314d792897 (patch)
tree6d5d366360ae74fe8cfde8a15170f25f9ae7df36
parent9fe0234c0bf8b3c412df0adc9ebbe6a1e95daf51 (diff)
net: cdc_ncm: no point in filling up the NTBs if we send ZLPs
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>
-rw-r--r--drivers/net/usb/cdc_ncm.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index 5aa3e60851d0..42c86200f076 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -800,8 +800,12 @@ cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign)
800 * would be more efficient for USB HS mobile device with DMA 800 * would be more efficient for USB HS mobile device with DMA
801 * engine to receive a full size NTB, than canceling DMA 801 * engine to receive a full size NTB, than canceling DMA
802 * transfer and receiving a short packet. 802 * transfer and receiving a short packet.
803 *
804 * This optimization support is pointless if we end up sending
805 * a ZLP after full sized NTBs.
803 */ 806 */
804 if (skb_out->len > CDC_NCM_MIN_TX_PKT) 807 if (!(dev->driver_info->flags & FLAG_SEND_ZLP) &&
808 skb_out->len > CDC_NCM_MIN_TX_PKT)
805 memset(skb_put(skb_out, ctx->tx_max - skb_out->len), 0, 809 memset(skb_put(skb_out, ctx->tx_max - skb_out->len), 0,
806 ctx->tx_max - skb_out->len); 810 ctx->tx_max - skb_out->len);
807 else if ((skb_out->len % dev->maxpacket) == 0) 811 else if ((skb_out->len % dev->maxpacket) == 0)