summaryrefslogtreecommitdiffstats
path: root/drivers/thunderbolt/tb.c
diff options
context:
space:
mode:
authorGil Fine <gil.fine@linux.intel.com>2024-02-11 23:33:25 +0100
committerMika Westerberg <mika.westerberg@linux.intel.com>2024-04-12 08:43:32 +0200
commit6016137a964b67a6ac8afb9071ef6e83777afca6 (patch)
treeb808affd9a2df2bd53d8193e96d44ecf134fdf2a /drivers/thunderbolt/tb.c
parentthunderbolt: Enable NVM upgrade support on Intel Maple Ridge (diff)
downloadlinux-6016137a964b67a6ac8afb9071ef6e83777afca6.tar.xz
linux-6016137a964b67a6ac8afb9071ef6e83777afca6.zip
thunderbolt: Fix calculation of consumed USB3 bandwidth on a path
Currently, when setup a new USB3 tunnel that is starting from downstream USB3 adapter of first depth router (or deeper), to upstream USB3 adapter of a second depth router (or deeper), we calculate consumed bandwidth. For this calculation we take into account first USB3 tunnel consumed bandwidth while we shouldn't, because we just recalculating the first USB3 tunnel allocated bandwidth. Fix that, so that more bandwidth is available for the new USB3 tunnel being setup. While there, fix the kernel-doc to decribe more accurately the purpose of the function. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to '')
-rw-r--r--drivers/thunderbolt/tb.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
index c5ce7a694b27..ec8c4ef5e3ba 100644
--- a/drivers/thunderbolt/tb.c
+++ b/drivers/thunderbolt/tb.c
@@ -498,8 +498,9 @@ static struct tb_tunnel *tb_find_first_usb3_tunnel(struct tb *tb,
* @consumed_down: Consumed downstream bandwidth (Mb/s)
*
* Calculates consumed USB3 and PCIe bandwidth at @port between path
- * from @src_port to @dst_port. Does not take tunnel starting from
- * @src_port and ending from @src_port into account.
+ * from @src_port to @dst_port. Does not take USB3 tunnel starting from
+ * @src_port and ending on @src_port into account because that bandwidth is
+ * already included in as part of the "first hop" USB3 tunnel.
*/
static int tb_consumed_usb3_pcie_bandwidth(struct tb *tb,
struct tb_port *src_port,
@@ -514,8 +515,8 @@ static int tb_consumed_usb3_pcie_bandwidth(struct tb *tb,
*consumed_up = *consumed_down = 0;
tunnel = tb_find_first_usb3_tunnel(tb, src_port, dst_port);
- if (tunnel && tunnel->src_port != src_port &&
- tunnel->dst_port != dst_port) {
+ if (tunnel && !tb_port_is_usb3_down(src_port) &&
+ !tb_port_is_usb3_up(dst_port)) {
int ret;
ret = tb_tunnel_consumed_bandwidth(tunnel, consumed_up,