mirror of https://gitee.com/openkylin/linux.git
usb: gadget: u_ether: conditionally align transfer size
Unless HW sets quirk_ep_out_aligned_size, gadget driver shouldn't make any efforts towards aligning transfers. If the UDC needs, it *must* set the quirk flag. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
This commit is contained in:
parent
fea14e68ff
commit
387f869d25
|
@ -178,6 +178,7 @@ static void rx_complete(struct usb_ep *ep, struct usb_request *req);
|
|||
static int
|
||||
rx_submit(struct eth_dev *dev, struct usb_request *req, gfp_t gfp_flags)
|
||||
{
|
||||
struct usb_gadget *g = dev->gadget;
|
||||
struct sk_buff *skb;
|
||||
int retval = -ENOMEM;
|
||||
size_t size = 0;
|
||||
|
@ -209,8 +210,11 @@ rx_submit(struct eth_dev *dev, struct usb_request *req, gfp_t gfp_flags)
|
|||
*/
|
||||
size += sizeof(struct ethhdr) + dev->net->mtu + RX_EXTRA;
|
||||
size += dev->port_usb->header_len;
|
||||
size += out->maxpacket - 1;
|
||||
size -= size % out->maxpacket;
|
||||
|
||||
if (g->quirk_ep_out_aligned_size) {
|
||||
size += out->maxpacket - 1;
|
||||
size -= size % out->maxpacket;
|
||||
}
|
||||
|
||||
if (dev->port_usb->is_fixed)
|
||||
size = max_t(size_t, size, dev->port_usb->fixed_out_len);
|
||||
|
|
Loading…
Reference in New Issue