Lines Matching refs:tunnel

112 		struct tb_tunnel *tunnel = NULL;  in tb_discover_tunnels()  local
116 tunnel = tb_tunnel_discover_dp(tb, port); in tb_discover_tunnels()
120 tunnel = tb_tunnel_discover_pci(tb, port); in tb_discover_tunnels()
124 tunnel = tb_tunnel_discover_usb3(tb, port); in tb_discover_tunnels()
131 if (!tunnel) in tb_discover_tunnels()
134 if (tb_tunnel_is_pci(tunnel)) { in tb_discover_tunnels()
135 struct tb_switch *parent = tunnel->dst_port->sw; in tb_discover_tunnels()
137 while (parent != tunnel->src_port->sw) { in tb_discover_tunnels()
143 list_add_tail(&tunnel->list, &tcm->tunnel_list); in tb_discover_tunnels()
257 struct tb_tunnel *tunnel; in tb_find_tunnel() local
259 list_for_each_entry(tunnel, &tcm->tunnel_list, list) { in tb_find_tunnel()
260 if (tunnel->type == type && in tb_find_tunnel()
261 ((src_port && src_port == tunnel->src_port) || in tb_find_tunnel()
262 (dst_port && dst_port == tunnel->dst_port))) { in tb_find_tunnel()
263 return tunnel; in tb_find_tunnel()
302 struct tb_tunnel *tunnel; in tb_available_bandwidth() local
307 tunnel = tb_find_first_usb3_tunnel(tb, src_port, dst_port); in tb_available_bandwidth()
308 if (tunnel) { in tb_available_bandwidth()
309 ret = tb_tunnel_consumed_bandwidth(tunnel, &usb3_consumed_up, in tb_available_bandwidth()
348 list_for_each_entry(tunnel, &tcm->tunnel_list, list) { in tb_available_bandwidth()
351 if (!tb_tunnel_is_dp(tunnel)) in tb_available_bandwidth()
354 if (!tb_tunnel_port_on_path(tunnel, port)) in tb_available_bandwidth()
357 ret = tb_tunnel_consumed_bandwidth(tunnel, in tb_available_bandwidth()
394 struct tb_tunnel *tunnel; in tb_release_unused_usb3_bandwidth() local
396 tunnel = tb_find_first_usb3_tunnel(tb, src_port, dst_port); in tb_release_unused_usb3_bandwidth()
397 return tunnel ? tb_tunnel_release_unused_bandwidth(tunnel) : 0; in tb_release_unused_usb3_bandwidth()
404 struct tb_tunnel *tunnel; in tb_reclaim_usb3_bandwidth() local
406 tunnel = tb_find_first_usb3_tunnel(tb, src_port, dst_port); in tb_reclaim_usb3_bandwidth()
407 if (!tunnel) in tb_reclaim_usb3_bandwidth()
416 ret = tb_available_bandwidth(tb, tunnel->src_port, tunnel->dst_port, in tb_reclaim_usb3_bandwidth()
426 tb_tunnel_reclaim_available_bandwidth(tunnel, &available_up, &available_down); in tb_reclaim_usb3_bandwidth()
435 struct tb_tunnel *tunnel; in tb_tunnel_usb3() local
478 tunnel = tb_tunnel_alloc_usb3(tb, up, down, available_up, in tb_tunnel_usb3()
480 if (!tunnel) { in tb_tunnel_usb3()
485 if (tb_tunnel_activate(tunnel)) { in tb_tunnel_usb3()
492 list_add_tail(&tunnel->list, &tcm->tunnel_list); in tb_tunnel_usb3()
499 tb_tunnel_free(tunnel); in tb_tunnel_usb3()
663 static void tb_deactivate_and_free_tunnel(struct tb_tunnel *tunnel) in tb_deactivate_and_free_tunnel() argument
668 if (!tunnel) in tb_deactivate_and_free_tunnel()
671 tb_tunnel_deactivate(tunnel); in tb_deactivate_and_free_tunnel()
672 list_del(&tunnel->list); in tb_deactivate_and_free_tunnel()
674 tb = tunnel->tb; in tb_deactivate_and_free_tunnel()
675 src_port = tunnel->src_port; in tb_deactivate_and_free_tunnel()
676 dst_port = tunnel->dst_port; in tb_deactivate_and_free_tunnel()
678 switch (tunnel->type) { in tb_deactivate_and_free_tunnel()
704 tb_tunnel_free(tunnel); in tb_deactivate_and_free_tunnel()
713 struct tb_tunnel *tunnel; in tb_free_invalid_tunnels() local
716 list_for_each_entry_safe(tunnel, n, &tcm->tunnel_list, list) { in tb_free_invalid_tunnels()
717 if (tb_tunnel_is_invalid(tunnel)) in tb_free_invalid_tunnels()
718 tb_deactivate_and_free_tunnel(tunnel); in tb_free_invalid_tunnels()
839 struct tb_tunnel *tunnel; in tb_tunnel_dp() local
907 tunnel = tb_tunnel_alloc_dp(tb, in, out, available_up, available_down); in tb_tunnel_dp()
908 if (!tunnel) { in tb_tunnel_dp()
913 if (tb_tunnel_activate(tunnel)) { in tb_tunnel_dp()
918 list_add_tail(&tunnel->list, &tcm->tunnel_list); in tb_tunnel_dp()
923 tb_tunnel_free(tunnel); in tb_tunnel_dp()
938 struct tb_tunnel *tunnel; in tb_dp_resource_unavailable() local
950 tunnel = tb_find_tunnel(tb, TB_TUNNEL_DP, in, out); in tb_dp_resource_unavailable()
951 tb_deactivate_and_free_tunnel(tunnel); in tb_dp_resource_unavailable()
985 struct tb_tunnel *tunnel, *n; in tb_disconnect_and_release_dp() local
991 list_for_each_entry_safe_reverse(tunnel, n, &tcm->tunnel_list, list) { in tb_disconnect_and_release_dp()
992 if (tb_tunnel_is_dp(tunnel)) in tb_disconnect_and_release_dp()
993 tb_deactivate_and_free_tunnel(tunnel); in tb_disconnect_and_release_dp()
1010 struct tb_tunnel *tunnel; in tb_tunnel_pci() local
1026 tunnel = tb_tunnel_alloc_pci(tb, up, down); in tb_tunnel_pci()
1027 if (!tunnel) in tb_tunnel_pci()
1030 if (tb_tunnel_activate(tunnel)) { in tb_tunnel_pci()
1033 tb_tunnel_free(tunnel); in tb_tunnel_pci()
1037 list_add_tail(&tunnel->list, &tcm->tunnel_list); in tb_tunnel_pci()
1045 struct tb_tunnel *tunnel; in tb_approve_xdomain_paths() local
1053 tunnel = tb_tunnel_alloc_dma(tb, nhi_port, dst_port, xd->transmit_ring, in tb_approve_xdomain_paths()
1056 if (!tunnel) { in tb_approve_xdomain_paths()
1061 if (tb_tunnel_activate(tunnel)) { in tb_approve_xdomain_paths()
1064 tb_tunnel_free(tunnel); in tb_approve_xdomain_paths()
1069 list_add_tail(&tunnel->list, &tcm->tunnel_list); in tb_approve_xdomain_paths()
1077 struct tb_tunnel *tunnel; in __tb_disconnect_xdomain_paths() local
1088 tunnel = tb_find_tunnel(tb, TB_TUNNEL_DMA, NULL, dst_port); in __tb_disconnect_xdomain_paths()
1089 tb_deactivate_and_free_tunnel(tunnel); in __tb_disconnect_xdomain_paths()
1242 struct tb_tunnel *tunnel; in tb_stop() local
1247 list_for_each_entry_safe(tunnel, n, &tcm->tunnel_list, list) { in tb_stop()
1253 if (tb_tunnel_is_dma(tunnel)) in tb_stop()
1254 tb_tunnel_deactivate(tunnel); in tb_stop()
1255 tb_tunnel_free(tunnel); in tb_stop()
1377 struct tb_tunnel *tunnel, *n; in tb_resume_noirq() local
1388 list_for_each_entry_safe(tunnel, n, &tcm->tunnel_list, list) in tb_resume_noirq()
1389 tb_tunnel_restart(tunnel); in tb_resume_noirq()
1484 struct tb_tunnel *tunnel, *n; in tb_runtime_resume() local
1490 list_for_each_entry_safe(tunnel, n, &tcm->tunnel_list, list) in tb_runtime_resume()
1491 tb_tunnel_restart(tunnel); in tb_runtime_resume()