Skip to content

Commit 6b6c71e

Browse files
committed
Merge tag 'thunderbolt-for-v5.9-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into usb-linus
Mika writes: thunderbolt: Fixes for v5.9-rc4 This includes two fixes, one that fixes a regression around reboot and other that uses a correct link rate when USB3 bandwidth is reclaimed when the link is not up. Both have been in linux-next with no reported issues. * tag 'thunderbolt-for-v5.9-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt: thunderbolt: Use maximum USB3 link rate when reclaiming if link is not up thunderbolt: Disable ports that are not implemented
2 parents f75aef3 + 813050e commit 6b6c71e

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

drivers/thunderbolt/switch.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,7 @@ static int tb_init_port(struct tb_port *port)
684684
if (res == -ENODEV) {
685685
tb_dbg(port->sw->tb, " Port %d: not implemented\n",
686686
port->port);
687+
port->disabled = true;
687688
return 0;
688689
}
689690
return res;

drivers/thunderbolt/tb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ struct tb_switch {
186186
* @cap_adap: Offset of the adapter specific capability (%0 if not present)
187187
* @cap_usb4: Offset to the USB4 port capability (%0 if not present)
188188
* @port: Port number on switch
189-
* @disabled: Disabled by eeprom
189+
* @disabled: Disabled by eeprom or enabled but not implemented
190190
* @bonded: true if the port is bonded (two lanes combined as one)
191191
* @dual_link_port: If the switch is connected using two ports, points
192192
* to the other port.

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)