diff options
author | Mika Westerberg <mika.westerberg@linux.intel.com> | 2020-06-24 20:45:03 +0200 |
---|---|---|
committer | Mika Westerberg <mika.westerberg@linux.intel.com> | 2020-08-25 10:29:01 +0200 |
commit | 813050e0a9b871ac575abfd3d321f74916df609d (patch) | |
tree | 0ddc32ed10b78bcf40ffafa282670793bcbb70c6 /drivers/thunderbolt/tunnel.c | |
parent | thunderbolt: Disable ports that are not implemented (diff) | |
download | linux-813050e0a9b871ac575abfd3d321f74916df609d.tar.xz linux-813050e0a9b871ac575abfd3d321f74916df609d.zip |
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: 0bd680cd900c ("thunderbolt: Add USB3 bandwidth management")
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/thunderbolt/tunnel.c')
-rw-r--r-- | drivers/thunderbolt/tunnel.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/thunderbolt/tunnel.c b/drivers/thunderbolt/tunnel.c index 2aae2c76d880..d50e5b93632a 100644 --- a/drivers/thunderbolt/tunnel.c +++ b/drivers/thunderbolt/tunnel.c @@ -951,10 +951,18 @@ static void tb_usb3_reclaim_available_bandwidth(struct tb_tunnel *tunnel, int ret, max_rate, allocate_up, allocate_down; ret = usb4_usb3_port_actual_link_rate(tunnel->src_port); - if (ret <= 0) { - tb_tunnel_warn(tunnel, "tunnel is not up\n"); + if (ret < 0) { + tb_tunnel_warn(tunnel, "failed to read actual link rate\n"); return; + } else if (!ret) { + /* Use maximum link rate if the link valid is not set */ + ret = usb4_usb3_port_max_link_rate(tunnel->src_port); + if (ret < 0) { + tb_tunnel_warn(tunnel, "failed to read maximum link rate\n"); + return; + } } + /* * 90% of the max rate can be allocated for isochronous * transfers. |