Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 226980
b: refs/heads/master
c: 5c1168d
h: refs/heads/master
v: v3
  • Loading branch information
Yauheni Kaliuta authored and Greg Kroah-Hartman committed Dec 10, 2010
1 parent 422b744 commit f0a376b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ff176a4e2972bdc7a8d65cdcb0bd0d26ab1528cf
refs/heads/master: 5c1168dbc508282f7717a4472477d52d64403060
14 changes: 12 additions & 2 deletions trunk/drivers/usb/gadget/u_ether.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@ rx_submit(struct eth_dev *dev, struct usb_request *req, gfp_t gfp_flags)
size += out->maxpacket - 1;
size -= size % out->maxpacket;

if (dev->port_usb->is_fixed)
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");
Expand Down Expand Up @@ -578,12 +581,19 @@ 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->is_fixed &&
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)
if (req->zero && !dev->zlp && (length % in->maxpacket) == 0)
length++;

req->length = length;
Expand Down
4 changes: 4 additions & 0 deletions trunk/drivers/usb/gadget/u_ether.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ struct gether {

/* hooks for added framing, as needed for RNDIS and EEM. */
u32 header_len;
/* NCM requires fixed size bundles */
bool is_fixed;
u32 fixed_out_len;
u32 fixed_in_len;
struct sk_buff *(*wrap)(struct gether *port,
struct sk_buff *skb);
int (*unwrap)(struct gether *port,
Expand Down

0 comments on commit f0a376b

Please sign in to comment.