summaryrefslogtreecommitdiff
path: root/drivers/thunderbolt/tb.c
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2020-03-28 12:52:31 +0200
committerMika Westerberg <mika.westerberg@linux.intel.com>2020-06-22 19:58:20 +0300
commit7c0ee8fd3bd7b5be6024f1839e9c26d1c9570e82 (patch)
tree649fa849194ce5517061466e97557796e431b081 /drivers/thunderbolt/tb.c
parent9cac51a049dbbca0b078bb9cffa7a8d928cf0f06 (diff)
thunderbolt: Report consumed bandwidth in both directions
Whereas DisplayPort bandwidth is consumed only in one direction (from DP IN adapter to DP OUT adapter), USB3 adds separate bandwidth for both upstream and downstream directions. For this reason extend the tunnel consumed bandwidth routines to support both directions and implement this for DP. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/thunderbolt/tb.c')
-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 9dbdb11685fa..53f9673c1395 100644
--- a/drivers/thunderbolt/tb.c
+++ b/drivers/thunderbolt/tb.c
@@ -535,7 +535,7 @@ static int tb_available_bw(struct tb_cm *tcm, struct tb_port *in,
{
struct tb_switch *sw = out->sw;
struct tb_tunnel *tunnel;
- int bw, available_bw = 40000;
+ int ret, bw, available_bw = 40000;
while (sw && sw != in->sw) {
bw = sw->link_speed * sw->link_width * 1000; /* Mb/s */
@@ -553,9 +553,10 @@ static int tb_available_bw(struct tb_cm *tcm, struct tb_port *in,
if (!tb_tunnel_switch_on_path(tunnel, sw))
continue;
- consumed_bw = tb_tunnel_consumed_bandwidth(tunnel);
- if (consumed_bw < 0)
- return consumed_bw;
+ ret = tb_tunnel_consumed_bandwidth(tunnel, NULL,
+ &consumed_bw);
+ if (ret)
+ return ret;
bw -= consumed_bw;
}