mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-01 06:33:07 +00:00
thunderbolt: Use tb_tunnel_dbg() where possible to make logging more consistent
This makes it easier to find out the tunnel in question. Also drop a couple of lines that generate duplicate information. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
This commit is contained in:
parent
6ed0b900d8
commit
fe8a0293c9
1 changed files with 30 additions and 35 deletions
|
@ -614,8 +614,9 @@ static int tb_dp_xchg_caps(struct tb_tunnel *tunnel)
|
||||||
|
|
||||||
in_rate = tb_dp_cap_get_rate(in_dp_cap);
|
in_rate = tb_dp_cap_get_rate(in_dp_cap);
|
||||||
in_lanes = tb_dp_cap_get_lanes(in_dp_cap);
|
in_lanes = tb_dp_cap_get_lanes(in_dp_cap);
|
||||||
tb_port_dbg(in, "maximum supported bandwidth %u Mb/s x%u = %u Mb/s\n",
|
tb_tunnel_dbg(tunnel,
|
||||||
in_rate, in_lanes, tb_dp_bandwidth(in_rate, in_lanes));
|
"DP IN maximum supported bandwidth %u Mb/s x%u = %u Mb/s\n",
|
||||||
|
in_rate, in_lanes, tb_dp_bandwidth(in_rate, in_lanes));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If the tunnel bandwidth is limited (max_bw is set) then see
|
* If the tunnel bandwidth is limited (max_bw is set) then see
|
||||||
|
@ -624,8 +625,9 @@ static int tb_dp_xchg_caps(struct tb_tunnel *tunnel)
|
||||||
out_rate = tb_dp_cap_get_rate(out_dp_cap);
|
out_rate = tb_dp_cap_get_rate(out_dp_cap);
|
||||||
out_lanes = tb_dp_cap_get_lanes(out_dp_cap);
|
out_lanes = tb_dp_cap_get_lanes(out_dp_cap);
|
||||||
bw = tb_dp_bandwidth(out_rate, out_lanes);
|
bw = tb_dp_bandwidth(out_rate, out_lanes);
|
||||||
tb_port_dbg(out, "maximum supported bandwidth %u Mb/s x%u = %u Mb/s\n",
|
tb_tunnel_dbg(tunnel,
|
||||||
out_rate, out_lanes, bw);
|
"DP OUT maximum supported bandwidth %u Mb/s x%u = %u Mb/s\n",
|
||||||
|
out_rate, out_lanes, bw);
|
||||||
|
|
||||||
if (in->sw->config.depth < out->sw->config.depth)
|
if (in->sw->config.depth < out->sw->config.depth)
|
||||||
max_bw = tunnel->max_down;
|
max_bw = tunnel->max_down;
|
||||||
|
@ -639,13 +641,14 @@ static int tb_dp_xchg_caps(struct tb_tunnel *tunnel)
|
||||||
out_rate, out_lanes, &new_rate,
|
out_rate, out_lanes, &new_rate,
|
||||||
&new_lanes);
|
&new_lanes);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
tb_port_info(out, "not enough bandwidth for DP tunnel\n");
|
tb_tunnel_info(tunnel, "not enough bandwidth\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
new_bw = tb_dp_bandwidth(new_rate, new_lanes);
|
new_bw = tb_dp_bandwidth(new_rate, new_lanes);
|
||||||
tb_port_dbg(out, "bandwidth reduced to %u Mb/s x%u = %u Mb/s\n",
|
tb_tunnel_dbg(tunnel,
|
||||||
new_rate, new_lanes, new_bw);
|
"bandwidth reduced to %u Mb/s x%u = %u Mb/s\n",
|
||||||
|
new_rate, new_lanes, new_bw);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set new rate and number of lanes before writing it to
|
* Set new rate and number of lanes before writing it to
|
||||||
|
@ -662,7 +665,7 @@ static int tb_dp_xchg_caps(struct tb_tunnel *tunnel)
|
||||||
*/
|
*/
|
||||||
if (tb_route(out->sw) && tb_switch_is_titan_ridge(out->sw)) {
|
if (tb_route(out->sw) && tb_switch_is_titan_ridge(out->sw)) {
|
||||||
out_dp_cap |= DP_COMMON_CAP_LTTPR_NS;
|
out_dp_cap |= DP_COMMON_CAP_LTTPR_NS;
|
||||||
tb_port_dbg(out, "disabling LTTPR\n");
|
tb_tunnel_dbg(tunnel, "disabling LTTPR\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
return tb_port_write(in, &out_dp_cap, TB_CFG_PORT,
|
return tb_port_write(in, &out_dp_cap, TB_CFG_PORT,
|
||||||
|
@ -712,8 +715,8 @@ static int tb_dp_bandwidth_alloc_mode_enable(struct tb_tunnel *tunnel)
|
||||||
lanes = min(in_lanes, out_lanes);
|
lanes = min(in_lanes, out_lanes);
|
||||||
tmp = tb_dp_bandwidth(rate, lanes);
|
tmp = tb_dp_bandwidth(rate, lanes);
|
||||||
|
|
||||||
tb_port_dbg(in, "non-reduced bandwidth %u Mb/s x%u = %u Mb/s\n", rate,
|
tb_tunnel_dbg(tunnel, "non-reduced bandwidth %u Mb/s x%u = %u Mb/s\n",
|
||||||
lanes, tmp);
|
rate, lanes, tmp);
|
||||||
|
|
||||||
ret = usb4_dp_port_set_nrd(in, rate, lanes);
|
ret = usb4_dp_port_set_nrd(in, rate, lanes);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -728,15 +731,15 @@ static int tb_dp_bandwidth_alloc_mode_enable(struct tb_tunnel *tunnel)
|
||||||
rate = min(in_rate, out_rate);
|
rate = min(in_rate, out_rate);
|
||||||
tmp = tb_dp_bandwidth(rate, lanes);
|
tmp = tb_dp_bandwidth(rate, lanes);
|
||||||
|
|
||||||
tb_port_dbg(in,
|
tb_tunnel_dbg(tunnel,
|
||||||
"maximum bandwidth through allocation mode %u Mb/s x%u = %u Mb/s\n",
|
"maximum bandwidth through allocation mode %u Mb/s x%u = %u Mb/s\n",
|
||||||
rate, lanes, tmp);
|
rate, lanes, tmp);
|
||||||
|
|
||||||
for (granularity = 250; tmp / granularity > 255 && granularity <= 1000;
|
for (granularity = 250; tmp / granularity > 255 && granularity <= 1000;
|
||||||
granularity *= 2)
|
granularity *= 2)
|
||||||
;
|
;
|
||||||
|
|
||||||
tb_port_dbg(in, "granularity %d Mb/s\n", granularity);
|
tb_tunnel_dbg(tunnel, "granularity %d Mb/s\n", granularity);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns -EINVAL if granularity above is outside of the
|
* Returns -EINVAL if granularity above is outside of the
|
||||||
|
@ -756,7 +759,7 @@ static int tb_dp_bandwidth_alloc_mode_enable(struct tb_tunnel *tunnel)
|
||||||
else
|
else
|
||||||
estimated_bw = tunnel->max_up;
|
estimated_bw = tunnel->max_up;
|
||||||
|
|
||||||
tb_port_dbg(in, "estimated bandwidth %d Mb/s\n", estimated_bw);
|
tb_tunnel_dbg(tunnel, "estimated bandwidth %d Mb/s\n", estimated_bw);
|
||||||
|
|
||||||
ret = usb4_dp_port_set_estimated_bandwidth(in, estimated_bw);
|
ret = usb4_dp_port_set_estimated_bandwidth(in, estimated_bw);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -767,7 +770,7 @@ static int tb_dp_bandwidth_alloc_mode_enable(struct tb_tunnel *tunnel)
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
tb_port_dbg(in, "bandwidth allocation mode enabled\n");
|
tb_tunnel_dbg(tunnel, "bandwidth allocation mode enabled\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -788,7 +791,7 @@ static int tb_dp_init(struct tb_tunnel *tunnel)
|
||||||
if (!usb4_dp_port_bandwidth_mode_supported(in))
|
if (!usb4_dp_port_bandwidth_mode_supported(in))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
tb_port_dbg(in, "bandwidth allocation mode supported\n");
|
tb_tunnel_dbg(tunnel, "bandwidth allocation mode supported\n");
|
||||||
|
|
||||||
ret = usb4_dp_port_set_cm_id(in, tb->index);
|
ret = usb4_dp_port_set_cm_id(in, tb->index);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
@ -805,7 +808,7 @@ static void tb_dp_deinit(struct tb_tunnel *tunnel)
|
||||||
return;
|
return;
|
||||||
if (usb4_dp_port_bandwidth_mode_enabled(in)) {
|
if (usb4_dp_port_bandwidth_mode_enabled(in)) {
|
||||||
usb4_dp_port_set_cm_bandwidth_mode_supported(in, false);
|
usb4_dp_port_set_cm_bandwidth_mode_supported(in, false);
|
||||||
tb_port_dbg(in, "bandwidth allocation mode disabled\n");
|
tb_tunnel_dbg(tunnel, "bandwidth allocation mode disabled\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -921,9 +924,6 @@ static int tb_dp_bandwidth_mode_consumed_bandwidth(struct tb_tunnel *tunnel,
|
||||||
if (allocated_bw == max_bw)
|
if (allocated_bw == max_bw)
|
||||||
allocated_bw = ret;
|
allocated_bw = ret;
|
||||||
|
|
||||||
tb_port_dbg(in, "consumed bandwidth through allocation mode %d Mb/s\n",
|
|
||||||
allocated_bw);
|
|
||||||
|
|
||||||
if (in->sw->config.depth < out->sw->config.depth) {
|
if (in->sw->config.depth < out->sw->config.depth) {
|
||||||
*consumed_up = 0;
|
*consumed_up = 0;
|
||||||
*consumed_down = allocated_bw;
|
*consumed_down = allocated_bw;
|
||||||
|
@ -1006,9 +1006,6 @@ static int tb_dp_alloc_bandwidth(struct tb_tunnel *tunnel, int *alloc_up,
|
||||||
/* Now we can use BW mode registers to figure out the bandwidth */
|
/* Now we can use BW mode registers to figure out the bandwidth */
|
||||||
/* TODO: need to handle discovery too */
|
/* TODO: need to handle discovery too */
|
||||||
tunnel->bw_mode = true;
|
tunnel->bw_mode = true;
|
||||||
|
|
||||||
tb_port_dbg(in, "allocated bandwidth through allocation mode %d Mb/s\n",
|
|
||||||
tmp);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1035,8 +1032,7 @@ static int tb_dp_read_dprx(struct tb_tunnel *tunnel, u32 *rate, u32 *lanes,
|
||||||
*rate = tb_dp_cap_get_rate(val);
|
*rate = tb_dp_cap_get_rate(val);
|
||||||
*lanes = tb_dp_cap_get_lanes(val);
|
*lanes = tb_dp_cap_get_lanes(val);
|
||||||
|
|
||||||
tb_port_dbg(in, "consumed bandwidth through DPRX %d Mb/s\n",
|
tb_tunnel_dbg(tunnel, "DPRX read done\n");
|
||||||
tb_dp_bandwidth(*rate, *lanes));
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
usleep_range(100, 150);
|
usleep_range(100, 150);
|
||||||
|
@ -1073,9 +1069,6 @@ static int tb_dp_read_cap(struct tb_tunnel *tunnel, unsigned int cap, u32 *rate,
|
||||||
|
|
||||||
*rate = tb_dp_cap_get_rate(val);
|
*rate = tb_dp_cap_get_rate(val);
|
||||||
*lanes = tb_dp_cap_get_lanes(val);
|
*lanes = tb_dp_cap_get_lanes(val);
|
||||||
|
|
||||||
tb_port_dbg(in, "bandwidth from %#x capability %d Mb/s\n", cap,
|
|
||||||
tb_dp_bandwidth(*rate, *lanes));
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1253,8 +1246,9 @@ static void tb_dp_dump(struct tb_tunnel *tunnel)
|
||||||
rate = tb_dp_cap_get_rate(dp_cap);
|
rate = tb_dp_cap_get_rate(dp_cap);
|
||||||
lanes = tb_dp_cap_get_lanes(dp_cap);
|
lanes = tb_dp_cap_get_lanes(dp_cap);
|
||||||
|
|
||||||
tb_port_dbg(in, "maximum supported bandwidth %u Mb/s x%u = %u Mb/s\n",
|
tb_tunnel_dbg(tunnel,
|
||||||
rate, lanes, tb_dp_bandwidth(rate, lanes));
|
"DP IN maximum supported bandwidth %u Mb/s x%u = %u Mb/s\n",
|
||||||
|
rate, lanes, tb_dp_bandwidth(rate, lanes));
|
||||||
|
|
||||||
out = tunnel->dst_port;
|
out = tunnel->dst_port;
|
||||||
|
|
||||||
|
@ -1265,8 +1259,9 @@ static void tb_dp_dump(struct tb_tunnel *tunnel)
|
||||||
rate = tb_dp_cap_get_rate(dp_cap);
|
rate = tb_dp_cap_get_rate(dp_cap);
|
||||||
lanes = tb_dp_cap_get_lanes(dp_cap);
|
lanes = tb_dp_cap_get_lanes(dp_cap);
|
||||||
|
|
||||||
tb_port_dbg(out, "maximum supported bandwidth %u Mb/s x%u = %u Mb/s\n",
|
tb_tunnel_dbg(tunnel,
|
||||||
rate, lanes, tb_dp_bandwidth(rate, lanes));
|
"DP OUT maximum supported bandwidth %u Mb/s x%u = %u Mb/s\n",
|
||||||
|
rate, lanes, tb_dp_bandwidth(rate, lanes));
|
||||||
|
|
||||||
if (tb_port_read(in, &dp_cap, TB_CFG_PORT,
|
if (tb_port_read(in, &dp_cap, TB_CFG_PORT,
|
||||||
in->cap_adap + DP_REMOTE_CAP, 1))
|
in->cap_adap + DP_REMOTE_CAP, 1))
|
||||||
|
@ -1275,8 +1270,8 @@ static void tb_dp_dump(struct tb_tunnel *tunnel)
|
||||||
rate = tb_dp_cap_get_rate(dp_cap);
|
rate = tb_dp_cap_get_rate(dp_cap);
|
||||||
lanes = tb_dp_cap_get_lanes(dp_cap);
|
lanes = tb_dp_cap_get_lanes(dp_cap);
|
||||||
|
|
||||||
tb_port_dbg(in, "reduced bandwidth %u Mb/s x%u = %u Mb/s\n",
|
tb_tunnel_dbg(tunnel, "reduced bandwidth %u Mb/s x%u = %u Mb/s\n",
|
||||||
rate, lanes, tb_dp_bandwidth(rate, lanes));
|
rate, lanes, tb_dp_bandwidth(rate, lanes));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue