Re: [PATCH v4 6/6] usb: gadget: uvc: add configfs option for sg support

From: Greg Kroah-Hartman
Date: Sat Oct 22 2022 - 07:41:33 EST


On Tue, Oct 18, 2022 at 04:50:42PM -0500, Dan Vacura wrote:
> The scatter gather support doesn't appear to work well with some UDC hw.
> Add the ability to turn off the feature depending on the controller in
> use or other platform quirks. The default is for the uvc gadget to
> support sg as long as the UDC hw supports it.
>
> The specific failure was with the dwc3 controller, but fixes and
> improvements are pending for those failures. This capability is now
> more intended for future unexpected failures or poor sg support on a
> given platform.
>
> Signed-off-by: Dan Vacura <w36195@xxxxxxxxxxxx>

Again, this should be dynamic. Can't we detect this based on the packet
size and either do sg or not?

If the UDC hardware says it is supported, it should be supported.
Otherwise we need to fix the UDC hardware or it saying it is allowed.

> --- a/Documentation/usb/gadget-testing.rst
> +++ b/Documentation/usb/gadget-testing.rst
> @@ -796,6 +796,10 @@ The uvc function provides these attributes in its function directory:
> function_name name of the interface
> req_int_skip_div divisor of total requests to aid in calculating
> interrupt frequency, 0 indicates all interrupt
> + sg_supported allow for scatter gather to be used if the UDC
> + hw supports it, this is default on and only
> + intended to be temporally turned off if a given
> + platform doesn't work well with scatter gather

How do you know if it "doesn't work well"?

That's vague and not good and nothing we want to support for forever,
sorry.

thanks,

greg k-h