Skip to content

Commit 813050e

Browse files
committed
thunderbolt: Use maximum USB3 link rate when reclaiming if link is not up
If the USB3 link is not up the actual link rate is 0 so when reclaiming bandwidth we should look at maximum supported link rate instead. Cc: stable@vger.kernel.org Fixes: 0bd680c ("thunderbolt: Add USB3 bandwidth management") Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
1 parent 8824d19 commit 813050e

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

drivers/thunderbolt/tunnel.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -951,10 +951,18 @@ static void tb_usb3_reclaim_available_bandwidth(struct tb_tunnel *tunnel,
951951
int ret, max_rate, allocate_up, allocate_down;
952952

953953
ret = usb4_usb3_port_actual_link_rate(tunnel->src_port);
954-
if (ret <= 0) {
955-
tb_tunnel_warn(tunnel, "tunnel is not up\n");
954+
if (ret < 0) {
955+
tb_tunnel_warn(tunnel, "failed to read actual link rate\n");
956956
return;
957+
} else if (!ret) {
958+
/* Use maximum link rate if the link valid is not set */
959+
ret = usb4_usb3_port_max_link_rate(tunnel->src_port);
960+
if (ret < 0) {
961+
tb_tunnel_warn(tunnel, "failed to read maximum link rate\n");
962+
return;
963+
}
957964
}
965+
958966
/*
959967
* 90% of the max rate can be allocated for isochronous
960968
* transfers.

0 commit comments

Comments
 (0)