Skip to content

Commit 1186f86

Browse files
AlanSterngregkh
authored andcommitted
UAS: Revert commit 3ae62a4 ("UAS: fix alignment of scatter/gather segments")
Commit 3ae62a4 ("UAS: fix alignment of scatter/gather segments"), copying a similar commit for usb-storage, attempted to solve a problem involving scatter-gather I/O and USB/IP by setting the virt_boundary_mask for mass-storage devices. However, it now turns out that the analogous change in usb-storage interacted badly with commit 09324d3 ("block: force an unlimited segment size on queues with a virt boundary"), which was added later. A typical error message is: ehci-pci 0000:00:13.2: swiotlb buffer is full (sz: 327680 bytes), total 32768 (slots), used 97 (slots) There is no longer any reason to keep the virt_boundary_mask setting in the uas driver. It was needed in the first place only for handling devices with a block size smaller than the maxpacket size and where the host controller was not capable of fully general scatter-gather operation (that is, able to merge two SG segments into a single USB packet). But: High-speed or slower connections never use a bulk maxpacket value larger than 512; The SCSI layer does not handle block devices with a block size smaller than 512 bytes; All the host controllers capable of SuperSpeed operation can handle fully general SG; Since commit ea44d19 ("usbip: Implement SG support to vhci-hcd and stub driver") was merged, the USB/IP driver can also handle SG. Therefore all supported device/controller combinations should be okay with no need for any special virt_boundary_mask. So in order to head off potential problems similar to those affecting usb-storage, this patch reverts commit 3ae62a4. Signed-off-by: Alan Stern <[email protected]> CC: Oliver Neukum <[email protected]> CC: <[email protected]> Acked-by: Christoph Hellwig <[email protected]> Fixes: 3ae62a4 ("UAS: fix alignment of scatter/gather segments") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 9a97694 commit 1186f86

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

drivers/usb/storage/uas.c

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -789,29 +789,9 @@ static int uas_slave_alloc(struct scsi_device *sdev)
789789
{
790790
struct uas_dev_info *devinfo =
791791
(struct uas_dev_info *)sdev->host->hostdata;
792-
int maxp;
793792

794793
sdev->hostdata = devinfo;
795794

796-
/*
797-
* We have two requirements here. We must satisfy the requirements
798-
* of the physical HC and the demands of the protocol, as we
799-
* definitely want no additional memory allocation in this path
800-
* ruling out using bounce buffers.
801-
*
802-
* For a transmission on USB to continue we must never send
803-
* a package that is smaller than maxpacket. Hence the length of each
804-
* scatterlist element except the last must be divisible by the
805-
* Bulk maxpacket value.
806-
* If the HC does not ensure that through SG,
807-
* the upper layer must do that. We must assume nothing
808-
* about the capabilities off the HC, so we use the most
809-
* pessimistic requirement.
810-
*/
811-
812-
maxp = usb_maxpacket(devinfo->udev, devinfo->data_in_pipe, 0);
813-
blk_queue_virt_boundary(sdev->request_queue, maxp - 1);
814-
815795
/*
816796
* The protocol has no requirements on alignment in the strict sense.
817797
* Controllers may or may not have alignment restrictions.

0 commit comments

Comments
 (0)