From: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx> [ Upstream commit 956c3abe72fb6a651b8cf77c28462f7e5b6a48b1 ] This is useful when walking over upstream lane adapters over given path. Signed-off-by: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx> Signed-off-by: Qin Wan <qin.wan@xxxxxx> Signed-off-by: Alexandru Gagniuc <alexandru.gagniuc@xxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/thunderbolt/tb.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) --- a/drivers/thunderbolt/tb.h +++ b/drivers/thunderbolt/tb.h @@ -1076,6 +1076,21 @@ static inline bool tb_port_use_credit_al for ((p) = tb_next_port_on_path((src), (dst), NULL); (p); \ (p) = tb_next_port_on_path((src), (dst), (p))) +/** + * tb_for_each_upstream_port_on_path() - Iterate over each upstreamm port on path + * @src: Source port + * @dst: Destination port + * @p: Port used as iterator + * + * Walks over each upstream lane adapter on path from @src to @dst. + */ +#define tb_for_each_upstream_port_on_path(src, dst, p) \ + for ((p) = tb_next_port_on_path((src), (dst), NULL); (p); \ + (p) = tb_next_port_on_path((src), (dst), (p))) \ + if (!tb_port_is_null((p)) || !tb_is_upstream_port((p))) {\ + continue; \ + } else + int tb_port_get_link_speed(struct tb_port *port); int tb_port_get_link_generation(struct tb_port *port); int tb_port_get_link_width(struct tb_port *port); Patches currently in stable-queue which might be from alexandru.gagniuc@xxxxxx are queue-6.6/thunderbolt-introduce-tb_switch_depth.patch queue-6.6/thunderbolt-fix-debug-log-when-displayport-adapter-not-available-for-pairing.patch queue-6.6/thunderbolt-change-bandwidth-reservations-to-comply-usb4-v2.patch queue-6.6/thunderbolt-configure-asymmetric-link-if-needed-and-bandwidth-allows.patch queue-6.6/thunderbolt-make-is_gen4_link-available-to-the-rest-of-the-driver.patch queue-6.6/thunderbolt-add-support-for-asymmetric-link.patch queue-6.6/thunderbolt-introduce-tb_for_each_upstream_port_on_path.patch queue-6.6/thunderbolt-improve-displayport-tunnel-setup-process-to-be-more-robust.patch queue-6.6/thunderbolt-expose-tb_tunnel_xxx-log-macros-to-the-rest-of-the-driver.patch queue-6.6/thunderbolt-use-constants-for-path-weight-and-priority.patch queue-6.6/thunderbolt-introduce-tb_port_path_direction_downstream.patch queue-6.6/thunderbolt-use-weight-constants-in-tb_usb3_consumed_bandwidth.patch queue-6.6/thunderbolt-create-multiple-displayport-tunnels-if-there-are-more-dp-in-out-pairs.patch queue-6.6/thunderbolt-use-tb_tunnel_dbg-where-possible-to-make-logging-more-consistent.patch