On Tue, 4 Mar 2014, Sarah Sharp wrote:
> Scatter-gather under xHCI seems to work fine on mass storage, but it
> fails with that particular ASIX device, because of how the xHCI driver
> sets up the buffers on the endpoint rings. We need to implement the TD
> fragment rules to avoid breaking this particular USB ethernet device.
> In the meantime, mass storage works fine with scatter-gather, so we
> don't want to lose hard drive performance.
>
> > Otherwise, it should be better to just
> > clear no_sg_constraint in xhcd, shouldn't it?
>
> We tried that. That's what commit 247bf557273d does. It clears
> no_sg_constraint for 1.0 xHCI hosts that need TD fragments (and thus
> would cause the ASIX chipsets to drop packets). However, we've found
> that commit breaks USB 3.0 mass storage devices.
>
> The block layer may submit scatter-gather lists with entries that
> are multiples of 512-byte blocks. That's fine for USB 2.0 devices,
> where the bulk endpoint max packet size is 512 bytes. But USB 3.0
> devices have bulk endpoints with a 1024 byte max packet size.
>
> That means when the block layer submits a scatter-gather list with one
> entry that includes, say, three 512-byte blocks, this code will reject
> the URB if it's submitted to a USB 3.0 bulk endpoint:
>
> int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
> {
> ...
> max = usb_endpoint_maxp(&ep->desc);
> ...
> } else if (urb->num_sgs && !urb->dev->bus->no_sg_constraint &&
> dev->speed != USB_SPEED_WIRELESS) {
> struct scatterlist *sg;
> int i;
>
> for_each_sg(urb->sg, sg, urb->num_sgs - 1, i)
> if (sg->length % max)
> return -EINVAL;
> }
>
> This results in failures with USB 3.0 drives. For me, a failure to
> auto-mount the device. For others, a read or write SCSI command
> failure. We can't introduce a regression in USB 3.0 mass storage in
> order to get better performance on one USB ethernet adapter.
It isn't a regression. Even without this test, the transfer will fail.
(Actually, depending on the details of your device, maybe it won't
fail. But it _should_!)
> Until we get TD fragments implemented, we need to revert the commit
> 3804fad45411 and commit 247bf557273d. That will mean USB 3.0 mass
> storage works again, and (unfortunately) the ASIX driver performance
> won't be as good until we implement TD fragments.
USB-3 mass storage won't work, even after you revert those two commits.
Alan Stern
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html