diff options
Diffstat (limited to 'drivers/usb/gadget/u_ether.c')
-rw-r--r-- | drivers/usb/gadget/u_ether.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c index fbe86ca95802..e3454fe46b47 100644 --- a/drivers/usb/gadget/u_ether.c +++ b/drivers/usb/gadget/u_ether.c | |||
@@ -240,6 +240,9 @@ rx_submit(struct eth_dev *dev, struct usb_request *req, gfp_t gfp_flags) | |||
240 | size += out->maxpacket - 1; | 240 | size += out->maxpacket - 1; |
241 | size -= size % out->maxpacket; | 241 | size -= size % out->maxpacket; |
242 | 242 | ||
243 | if (dev->port_usb->is_fixed) | ||
244 | size = max(size, dev->port_usb->fixed_out_len); | ||
245 | |||
243 | skb = alloc_skb(size + NET_IP_ALIGN, gfp_flags); | 246 | skb = alloc_skb(size + NET_IP_ALIGN, gfp_flags); |
244 | if (skb == NULL) { | 247 | if (skb == NULL) { |
245 | DBG(dev, "no rx skb\n"); | 248 | DBG(dev, "no rx skb\n"); |
@@ -578,12 +581,19 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb, | |||
578 | req->context = skb; | 581 | req->context = skb; |
579 | req->complete = tx_complete; | 582 | req->complete = tx_complete; |
580 | 583 | ||
584 | /* NCM requires no zlp if transfer is dwNtbInMaxSize */ | ||
585 | if (dev->port_usb->is_fixed && | ||
586 | length == dev->port_usb->fixed_in_len && | ||
587 | (length % in->maxpacket) == 0) | ||
588 | req->zero = 0; | ||
589 | else | ||
590 | req->zero = 1; | ||
591 | |||
581 | /* use zlp framing on tx for strict CDC-Ether conformance, | 592 | /* use zlp framing on tx for strict CDC-Ether conformance, |
582 | * though any robust network rx path ignores extra padding. | 593 | * though any robust network rx path ignores extra padding. |
583 | * and some hardware doesn't like to write zlps. | 594 | * and some hardware doesn't like to write zlps. |
584 | */ | 595 | */ |
585 | req->zero = 1; | 596 | if (req->zero && !dev->zlp && (length % in->maxpacket) == 0) |
586 | if (!dev->zlp && (length % in->maxpacket) == 0) | ||
587 | length++; | 597 | length++; |
588 | 598 | ||
589 | req->length = length; | 599 | req->length = length; |