The xhci driver should send a zero length message if a bulk transfer is a multiple of the message size and the URB_ZERO_PACKET flag is set. Quite a few of the usb ethernet drivers generate requests with URB_ZERO_PACKET set, and at least some will fail to send some specific packet sizes (possibly locking up the transmit engine) if the zero length packet isn't sent. In other cases (eg the ax88179_178a USB3 Ge driver) the packet header has to be flagged and an extra byte added to the relevant transfers. The change needs to be done for both single buffer and scatter gather requests. In the existing code these are handled by separate, but very similar, functions. To avoid fixing this (and any other bugs twice) it seemed appropriate to merge the two functions. This can be done without adding any significant code to either version. For rev 1.00 controllers, the td_size in the earlier packets also has to be set allowing for the extra message. Patch 6/9 definitely gets this right, and is a lot simpler than the previous version. I'll admit these changes amount to a partial rewrite of the bulk transfer setup code. However the changes are isolated to that single function. Tested on an Intel v1.00 controller with the ax88179_178a and smsc95xx ethernet controller (the former patched so that it needs the ZLP). Verifying with extra traces that the ZLP are sent for ping -s $((1024-0x32)) (and 512-0x32 for the smsc95xx - which has the same red tape length). David Laight (9): [1/9] xhci: Remove debug code [2/9] xhci: Minor cleanups to queue_bulk_sg_tx() [3/9] xhci: Use a fast upper bound for the number of TRB for a SG request. [4/9] xhci: Simplify setting of TRB type and flags in queue_bulk_sg_tx() [5/9] xhci: Move fragment length calculation to top of loop in queue_bulk_sg_tx() [6/9] xhci: Use a much simpler algorithm for td_size on 1.0 hosts [7/9] xhci: Add support for URB_ZERO_PACKET to queue_bulk_sg_tx() [8/9] xhci: Common up setup of normal and scatter-gather transfers [9/9] xhci: Add num_trbs_for_buf() to count trbs needed for a buffer fragment drivers/usb/host/xhci-ring.c | 421 +++++++++++++++---------------------------- 1 file changed, 146 insertions(+), 275 deletions(-) -- 1.8.1.2 -- 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