[PATCH v3] USB: Extend usb_device_speed with new value USB_SPEED_SUPER_PLUS_BY2
Thinh Nguyen
Thinh.Nguyen at synopsys.com
Fri Sep 1 14:56:33 PDT 2023
Hi,
Please Cc me for changes related to dwc3.
On Sat, Sep 02, 2023, Dingyan Li wrote:
> Currently there are there major generations when speaking of
> USB_SPEED_SUPER_PLUS devices. However, they actually stands
> for different physical speeds. GEN_2x2 means 20Gbps, while
> the others mean 10Gbps. So in order to confirm 20Gbps, both
> speed and generation need ti be checked. This causes a trouble
> for ioctl USBDEVFS_GET_SPEED since it can only return speed
> value to userspace.
>
> In order not to add a new ioctl to get ssp generation, extending
> usb_device_speed is a good option. The side effect is that
> USB_SPEED_SUPER_PLUS has been used in lots of places and
> it also takes some effort to go through all of them and check
> whether the new speed should be used too.
>
> Besides, as suggested by Alen, ssp_rate is not a proper name,
> change it to ssp_gen. And change all functions/struct fileds
> ended with ssp_rate to ssp_gen. And there is also some code
> refactor to reduce duplicate definition of strings and increase
> the utilization of commonly defined utilities.
>
> Signed-off-by: Dingyan Li <18500469033 at 163.com>
Why not spell out the whole thing instead of USB_SPEED_SUPER_PLUS_BY2
(ie. USB_SPEED_SUPER_PLUS_GEN_2x2) as you intended instead of just the
lane count.
There are SuperSpeed Plus generation _and_ lane count. That's why I
didn't name "usb_ssp_gen" that only reflects the generation and not the
lane count. Also, I didn't extend usb_device_speed because gen XxY are
all a single speed: SuperSpeed Plus.
If you're planning to do it this way, why not add the other speeds (such
as gen 1x2) to usb_device_speed enum too? Then we can drop the
usb_ssp_rate enum. If we're going to check multiple enum for SuperSpeed
Plus, we probably need a usb_device_is_superspeed_plus() function.
Now we need to audit all the greater/lesser speed checks that use < or >
to make sure that they are used how they were intended to.
Since these changes are not simple and will touch on multiple places,
please split this patch out.
Thanks,
Thinh
More information about the Linux-mediatek
mailing list