Re: [PATCH 2/2] usb: hub: Disable USB 3 device initiated lpm if exit latency is too high

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 15, 2021 at 04:15:44PM +0300, Mathias Nyman wrote:
> The device initiated link power management U1/U2 states should not be
> enabled in case the system exit latency plus one bus interval (125us) is
> greater than the shortest service interval of any periodic endpoint.
> 
> This is the case for both U1 and U2 sytstem exit latencies and link states.
> 
> See USB 3.2 section 9.4.9 "Set Feature" for more details
> 
> If host initiated lpm is enabled but device initiated is not due to exit
> latency limitations then still set the udev->usb3_lpm_ux_enabled flag so
> that sysfs users can see the link may go to U1/U2.
> 
> Signed-off-by: Mathias Nyman <mathias.nyman@xxxxxxxxxxxxxxx>
> ---
>  drivers/usb/core/hub.c | 68 ++++++++++++++++++++++++++++++++++--------
>  1 file changed, 56 insertions(+), 12 deletions(-)

Do either of these need to go to older kernels?

> 
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index a35d0bedafa3..63e150982da9 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -4116,6 +4116,47 @@ static int usb_set_lpm_timeout(struct usb_device *udev,
>  	return 0;
>  }
>  
> +/*
> + * Don't allow device intiated U1/U2 if the system exit latency + one bus
> + * interval is greater than the minimum service interval of any active
> + * periodic endpoint. See USB 3.2 section 9.4.9
> + */
> +static bool usb_device_may_initiate_lpm(struct usb_device *udev,
> +					enum usb3_link_state state)
> +{
> +	unsigned long long sel;		/* us */

Do you mean u64 here?  If so, you might want to use that :)

thanks,

greg k-h



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux