thunderbolt: Add support for lane bonding
Lane bonding allows aggregating two 10/20 Gb/s (depending on the generation) lanes into a single 20/40 Gb/s bonded link. This allows sharing the full bandwidth more efficiently. In order to establish lane bonding we need to check that lane bonding is possible through link controller and that both ends of the link actually supports 2x widths. This also means that all the paths should be established through the primary port so update tb_path_alloc() to handle this as well. Lane bonding is supported starting from Falcon Ridge (2nd generation) controllers. We also expose the current speed and number of lanes under each device except the host router following similar attribute naming than USB bus. Expose speed and number of lanes for both directions to allow possibility of asymmetric link in the future. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
This commit is contained in:
@@ -177,3 +177,31 @@ int tb_lc_set_sleep(struct tb_switch *sw)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* tb_lc_lane_bonding_possible() - Is lane bonding possible towards switch
|
||||
* @sw: Switch to check
|
||||
*
|
||||
* Checks whether conditions for lane bonding from parent to @sw are
|
||||
* possible.
|
||||
*/
|
||||
bool tb_lc_lane_bonding_possible(struct tb_switch *sw)
|
||||
{
|
||||
struct tb_port *up;
|
||||
int cap, ret;
|
||||
u32 val;
|
||||
|
||||
if (sw->generation < 2)
|
||||
return false;
|
||||
|
||||
up = tb_upstream_port(sw);
|
||||
cap = find_port_lc_cap(up);
|
||||
if (cap < 0)
|
||||
return false;
|
||||
|
||||
ret = tb_sw_read(sw, &val, TB_CFG_SWITCH, cap + TB_LC_PORT_ATTR, 1);
|
||||
if (ret)
|
||||
return false;
|
||||
|
||||
return !!(val & TB_LC_PORT_ATTR_BE);
|
||||
}
|
||||
|
Reference in New Issue
Block a user