Commit 2b3a6239 authored by Gil Fine's avatar Gil Fine Committed by Mika Westerberg

thunderbolt: Disable PCIe extended encapsulation upon teardown properly

In case of PCIe tunnel teardown (including if caused by router unplug),
PCIe extended encapsulation bit should be cleared in downstream and
upstream routers accordingly.
Signed-off-by: default avatarGil Fine <gil.fine@linux.intel.com>
Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
parent 54967f41
...@@ -173,16 +173,28 @@ static int tb_pci_set_ext_encapsulation(struct tb_tunnel *tunnel, bool enable) ...@@ -173,16 +173,28 @@ static int tb_pci_set_ext_encapsulation(struct tb_tunnel *tunnel, bool enable)
int ret; int ret;
/* Only supported of both routers are at least USB4 v2 */ /* Only supported of both routers are at least USB4 v2 */
if (tb_port_get_link_generation(port) < 4) if ((usb4_switch_version(tunnel->src_port->sw) < 2) ||
(usb4_switch_version(tunnel->dst_port->sw) < 2))
return 0;
if (enable && tb_port_get_link_generation(port) < 4)
return 0; return 0;
ret = usb4_pci_port_set_ext_encapsulation(tunnel->src_port, enable); ret = usb4_pci_port_set_ext_encapsulation(tunnel->src_port, enable);
if (ret) if (ret)
return ret; return ret;
/*
* Downstream router could be unplugged so disable of encapsulation
* in upstream router is still possible.
*/
ret = usb4_pci_port_set_ext_encapsulation(tunnel->dst_port, enable); ret = usb4_pci_port_set_ext_encapsulation(tunnel->dst_port, enable);
if (ret) if (ret) {
return ret; if (enable)
return ret;
if (ret != -ENODEV)
return ret;
}
tb_tunnel_dbg(tunnel, "extended encapsulation %s\n", tb_tunnel_dbg(tunnel, "extended encapsulation %s\n",
str_enabled_disabled(enable)); str_enabled_disabled(enable));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment