Re: [PATCH] usbip: Fix the error limitation on max_hw_sectors for usbip device

From: Shuah Khan
Date: Fri Feb 21 2025 - 11:51:46 EST


On 2/19/25 02:25, Zongmin Zhou wrote:
From: Zongmin Zhou <zhouzongmin@xxxxxxxxxx>

This patch fixes an issue that usb device through usbip protocol,
the max_hw_sectors will be limited to 512,and then
read/write rate of high speed USB devices will be limited.

After the commit d74ffae8b8dd ("usb-storage: Add a limitation
for blk_queue_max_hw_sectors()") is applied,
This issue happened on the swiotlb enabled environment.
This commit will checks the maximum size of a mapping for the device,
and adjusts the max_hw_sectors.On vhci-hcd driver,
the dma mask setting follows the platform device default setting(32-bit).
So dma_addressing_limited() will be true,then the maximum mapping size
use the swiotlb max mapping size(512).The max_hw_sectors reset to 512.

To fix this issue,have to get the dma mask bit that
the real USB controllers support,and set this value on vhci-hcd driver,
usbip device will get the correct max_hw_sectors.

I don't have objections to this change. This does change
the API between the kernel and user-space and requires more
testing with mispatched kernel and user-space.

Can you give me more details on testing you have done with
the revision mismatches environments?

Also this would require bumping up the version on kernel and
user-space sides.

thanks,
-- Shuah