From: Yauheni Kaliuta <yauheni.kaliuta@xxxxxxxxx> Signed-off-by: Yauheni Kaliuta <yauheni.kaliuta@xxxxxxxxx> --- drivers/usb/gadget/u_ether.c | 11 ++++++++++- drivers/usb/gadget/u_ether.h | 3 +++ 2 files changed, 13 insertions(+), 1 deletions(-) diff --git a/drivers/usb/gadget/u_ether.c b/drivers/usb/gadget/u_ether.c index 84ca195..4b1daee 100644 --- a/drivers/usb/gadget/u_ether.c +++ b/drivers/usb/gadget/u_ether.c @@ -239,6 +239,8 @@ rx_submit(struct eth_dev *dev, struct usb_request *req, gfp_t gfp_flags) size += out->maxpacket - 1; size -= size % out->maxpacket; + size = max(size, dev->port_usb->fixed_out_len); + skb = alloc_skb(size + NET_IP_ALIGN, gfp_flags); if (skb == NULL) { DBG(dev, "no rx skb\n"); @@ -577,11 +579,18 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb, req->context = skb; req->complete = tx_complete; + /* NCM requires no zlp if transfer is dwNtbInMaxSize */ + if (dev->port_usb->fixed_in_len && + length == dev->port_usb->fixed_in_len && + (length % in->maxpacket) == 0) + req->zero = 0; + else + req->zero = 1; + /* use zlp framing on tx for strict CDC-Ether conformance, * though any robust network rx path ignores extra padding. * and some hardware doesn't like to write zlps. */ - req->zero = 1; if (!dev->zlp && (length % in->maxpacket) == 0) length++; diff --git a/drivers/usb/gadget/u_ether.h b/drivers/usb/gadget/u_ether.h index 3c8c0c9..e97c71b 100644 --- a/drivers/usb/gadget/u_ether.h +++ b/drivers/usb/gadget/u_ether.h @@ -62,6 +62,9 @@ struct gether { /* hooks for added framing, as needed for RNDIS and EEM. */ u32 header_len; + /* NCM requires fixed size bundles */ + u32 fixed_out_len; + u32 fixed_in_len; struct sk_buff *(*wrap)(struct gether *port, struct sk_buff *skb); int (*unwrap)(struct gether *port, -- 1.7.0.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html