Lines Matching refs:tunnel

115 		struct tb_tunnel *tunnel = NULL;  in tb_discover_tunnels()  local
119 tunnel = tb_tunnel_discover_dp(tb, port); in tb_discover_tunnels()
123 tunnel = tb_tunnel_discover_pci(tb, port); in tb_discover_tunnels()
127 tunnel = tb_tunnel_discover_usb3(tb, port); in tb_discover_tunnels()
134 if (!tunnel) in tb_discover_tunnels()
137 if (tb_tunnel_is_pci(tunnel)) { in tb_discover_tunnels()
138 struct tb_switch *parent = tunnel->dst_port->sw; in tb_discover_tunnels()
140 while (parent != tunnel->src_port->sw) { in tb_discover_tunnels()
144 } else if (tb_tunnel_is_dp(tunnel)) { in tb_discover_tunnels()
146 pm_runtime_get_sync(&tunnel->src_port->sw->dev); in tb_discover_tunnels()
147 pm_runtime_get_sync(&tunnel->dst_port->sw->dev); in tb_discover_tunnels()
150 list_add_tail(&tunnel->list, &tcm->tunnel_list); in tb_discover_tunnels()
267 struct tb_tunnel *tunnel; in tb_find_tunnel() local
269 list_for_each_entry(tunnel, &tcm->tunnel_list, list) { in tb_find_tunnel()
270 if (tunnel->type == type && in tb_find_tunnel()
271 ((src_port && src_port == tunnel->src_port) || in tb_find_tunnel()
272 (dst_port && dst_port == tunnel->dst_port))) { in tb_find_tunnel()
273 return tunnel; in tb_find_tunnel()
312 struct tb_tunnel *tunnel; in tb_available_bandwidth() local
317 tunnel = tb_find_first_usb3_tunnel(tb, src_port, dst_port); in tb_available_bandwidth()
318 if (tunnel) { in tb_available_bandwidth()
319 ret = tb_tunnel_consumed_bandwidth(tunnel, &usb3_consumed_up, in tb_available_bandwidth()
358 list_for_each_entry(tunnel, &tcm->tunnel_list, list) { in tb_available_bandwidth()
361 if (!tb_tunnel_is_dp(tunnel)) in tb_available_bandwidth()
364 if (!tb_tunnel_port_on_path(tunnel, port)) in tb_available_bandwidth()
367 ret = tb_tunnel_consumed_bandwidth(tunnel, in tb_available_bandwidth()
404 struct tb_tunnel *tunnel; in tb_release_unused_usb3_bandwidth() local
406 tunnel = tb_find_first_usb3_tunnel(tb, src_port, dst_port); in tb_release_unused_usb3_bandwidth()
407 return tunnel ? tb_tunnel_release_unused_bandwidth(tunnel) : 0; in tb_release_unused_usb3_bandwidth()
414 struct tb_tunnel *tunnel; in tb_reclaim_usb3_bandwidth() local
416 tunnel = tb_find_first_usb3_tunnel(tb, src_port, dst_port); in tb_reclaim_usb3_bandwidth()
417 if (!tunnel) in tb_reclaim_usb3_bandwidth()
426 ret = tb_available_bandwidth(tb, tunnel->src_port, tunnel->dst_port, in tb_reclaim_usb3_bandwidth()
436 tb_tunnel_reclaim_available_bandwidth(tunnel, &available_up, &available_down); in tb_reclaim_usb3_bandwidth()
445 struct tb_tunnel *tunnel; in tb_tunnel_usb3() local
493 tunnel = tb_tunnel_alloc_usb3(tb, up, down, available_up, in tb_tunnel_usb3()
495 if (!tunnel) { in tb_tunnel_usb3()
500 if (tb_tunnel_activate(tunnel)) { in tb_tunnel_usb3()
507 list_add_tail(&tunnel->list, &tcm->tunnel_list); in tb_tunnel_usb3()
514 tb_tunnel_free(tunnel); in tb_tunnel_usb3()
681 static void tb_deactivate_and_free_tunnel(struct tb_tunnel *tunnel) in tb_deactivate_and_free_tunnel() argument
686 if (!tunnel) in tb_deactivate_and_free_tunnel()
689 tb_tunnel_deactivate(tunnel); in tb_deactivate_and_free_tunnel()
690 list_del(&tunnel->list); in tb_deactivate_and_free_tunnel()
692 tb = tunnel->tb; in tb_deactivate_and_free_tunnel()
693 src_port = tunnel->src_port; in tb_deactivate_and_free_tunnel()
694 dst_port = tunnel->dst_port; in tb_deactivate_and_free_tunnel()
696 switch (tunnel->type) { in tb_deactivate_and_free_tunnel()
722 tb_tunnel_free(tunnel); in tb_deactivate_and_free_tunnel()
731 struct tb_tunnel *tunnel; in tb_free_invalid_tunnels() local
734 list_for_each_entry_safe(tunnel, n, &tcm->tunnel_list, list) { in tb_free_invalid_tunnels()
735 if (tb_tunnel_is_invalid(tunnel)) in tb_free_invalid_tunnels()
736 tb_deactivate_and_free_tunnel(tunnel); in tb_free_invalid_tunnels()
857 struct tb_tunnel *tunnel; in tb_tunnel_dp() local
930 tunnel = tb_tunnel_alloc_dp(tb, in, out, available_up, available_down); in tb_tunnel_dp()
931 if (!tunnel) { in tb_tunnel_dp()
936 if (tb_tunnel_activate(tunnel)) { in tb_tunnel_dp()
941 list_add_tail(&tunnel->list, &tcm->tunnel_list); in tb_tunnel_dp()
946 tb_tunnel_free(tunnel); in tb_tunnel_dp()
961 struct tb_tunnel *tunnel; in tb_dp_resource_unavailable() local
973 tunnel = tb_find_tunnel(tb, TB_TUNNEL_DP, in, out); in tb_dp_resource_unavailable()
974 tb_deactivate_and_free_tunnel(tunnel); in tb_dp_resource_unavailable()
1008 struct tb_tunnel *tunnel, *n; in tb_disconnect_and_release_dp() local
1014 list_for_each_entry_safe_reverse(tunnel, n, &tcm->tunnel_list, list) { in tb_disconnect_and_release_dp()
1015 if (tb_tunnel_is_dp(tunnel)) in tb_disconnect_and_release_dp()
1016 tb_deactivate_and_free_tunnel(tunnel); in tb_disconnect_and_release_dp()
1030 struct tb_tunnel *tunnel; in tb_disconnect_pci() local
1037 tunnel = tb_find_tunnel(tb, TB_TUNNEL_PCI, NULL, up); in tb_disconnect_pci()
1038 if (WARN_ON(!tunnel)) in tb_disconnect_pci()
1041 tb_tunnel_deactivate(tunnel); in tb_disconnect_pci()
1042 list_del(&tunnel->list); in tb_disconnect_pci()
1043 tb_tunnel_free(tunnel); in tb_disconnect_pci()
1052 struct tb_tunnel *tunnel; in tb_tunnel_pci() local
1068 tunnel = tb_tunnel_alloc_pci(tb, up, down); in tb_tunnel_pci()
1069 if (!tunnel) in tb_tunnel_pci()
1072 if (tb_tunnel_activate(tunnel)) { in tb_tunnel_pci()
1075 tb_tunnel_free(tunnel); in tb_tunnel_pci()
1079 list_add_tail(&tunnel->list, &tcm->tunnel_list); in tb_tunnel_pci()
1089 struct tb_tunnel *tunnel; in tb_approve_xdomain_paths() local
1097 tunnel = tb_tunnel_alloc_dma(tb, nhi_port, dst_port, transmit_path, in tb_approve_xdomain_paths()
1099 if (!tunnel) { in tb_approve_xdomain_paths()
1104 if (tb_tunnel_activate(tunnel)) { in tb_approve_xdomain_paths()
1107 tb_tunnel_free(tunnel); in tb_approve_xdomain_paths()
1112 list_add_tail(&tunnel->list, &tcm->tunnel_list); in tb_approve_xdomain_paths()
1123 struct tb_tunnel *tunnel, *n; in __tb_disconnect_xdomain_paths() local
1130 list_for_each_entry_safe(tunnel, n, &tcm->tunnel_list, list) { in __tb_disconnect_xdomain_paths()
1131 if (!tb_tunnel_is_dma(tunnel)) in __tb_disconnect_xdomain_paths()
1133 if (tunnel->src_port != nhi_port || tunnel->dst_port != dst_port) in __tb_disconnect_xdomain_paths()
1136 if (tb_tunnel_match_dma(tunnel, transmit_path, transmit_ring, in __tb_disconnect_xdomain_paths()
1138 tb_deactivate_and_free_tunnel(tunnel); in __tb_disconnect_xdomain_paths()
1296 struct tb_tunnel *tunnel; in tb_stop() local
1301 list_for_each_entry_safe(tunnel, n, &tcm->tunnel_list, list) { in tb_stop()
1307 if (tb_tunnel_is_dma(tunnel)) in tb_stop()
1308 tb_tunnel_deactivate(tunnel); in tb_stop()
1309 tb_tunnel_free(tunnel); in tb_stop()
1431 struct tb_tunnel *tunnel, *n; in tb_resume_noirq() local
1442 list_for_each_entry_safe(tunnel, n, &tcm->tunnel_list, list) in tb_resume_noirq()
1443 tb_tunnel_restart(tunnel); in tb_resume_noirq()
1538 struct tb_tunnel *tunnel, *n; in tb_runtime_resume() local
1544 list_for_each_entry_safe(tunnel, n, &tcm->tunnel_list, list) in tb_runtime_resume()
1545 tb_tunnel_restart(tunnel); in tb_runtime_resume()