usb: hub: Fix link power management max exit latency (MEL) calculations
authorMathias Nyman <mathias.nyman@linux.intel.com>
Thu, 15 Jul 2021 15:01:21 +0000 (18:01 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 21 Jul 2021 07:11:19 +0000 (09:11 +0200)
commit1bf2761c837571a66ec290fb66c90413821ffda2
tree36d1a8934d4f12c6734dd36e7dd3f0adacb89b84
parent57560ee95cb7f91cf0bc31d4ae8276e0dcfe17aa
usb: hub: Fix link power management max exit latency (MEL) calculations

Maximum Exit Latency (MEL) value is used by host to know how much in
advance it needs to start waking up a U1/U2 suspended link in order to
service a periodic transfer in time.

Current MEL calculation only includes the time to wake up the path from
U1/U2 to U0. This is called tMEL1 in USB 3.1 section C 1.5.2

Total MEL = tMEL1 + tMEL2 +tMEL3 + tMEL4 which should additinally include:
- tMEL2 which is the time it takes for PING message to reach device
- tMEL3 time for device to process the PING and submit a PING_RESPONSE
- tMEL4 time for PING_RESPONSE to traverse back upstream to host.

Add the missing tMEL2, tMEL3 and tMEL4 to MEL calculation.

Cc: <stable@kernel.org> # v3.5
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20210715150122.1995966-1-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/hub.c