Lines Matching refs:tunnel

99 	struct tb_tunnel *tunnel;  in tb_attach_bandwidth_group()  local
107 list_for_each_entry(tunnel, &tcm->tunnel_list, list) { in tb_attach_bandwidth_group()
108 if (!tb_tunnel_is_dp(tunnel)) in tb_attach_bandwidth_group()
111 if (tunnel->src_port->sw == in->sw && in tb_attach_bandwidth_group()
112 tunnel->dst_port->sw == out->sw) { in tb_attach_bandwidth_group()
113 group = tunnel->src_port->group; in tb_attach_bandwidth_group()
235 struct tb_tunnel *tunnel; in tb_discover_dp_resources() local
237 list_for_each_entry(tunnel, &tcm->tunnel_list, list) { in tb_discover_dp_resources()
238 if (tb_tunnel_is_dp(tunnel)) in tb_discover_dp_resources()
239 tb_discover_dp_resource(tb, tunnel->dst_port); in tb_discover_dp_resources()
248 const struct tb_tunnel *tunnel; in tb_enable_clx() local
271 list_for_each_entry(tunnel, &tcm->tunnel_list, list) { in tb_enable_clx()
272 if (tb_tunnel_is_dma(tunnel)) { in tb_enable_clx()
273 if (tb_tunnel_port_on_path(tunnel, tb_upstream_port(sw))) in tb_enable_clx()
325 static void tb_increase_tmu_accuracy(struct tb_tunnel *tunnel) in tb_increase_tmu_accuracy() argument
329 if (!tunnel) in tb_increase_tmu_accuracy()
341 sw = tunnel->tb->root_switch; in tb_increase_tmu_accuracy()
392 struct tb_tunnel *tunnel = NULL; in tb_switch_discover_tunnels() local
396 tunnel = tb_tunnel_discover_dp(tb, port, alloc_hopids); in tb_switch_discover_tunnels()
397 tb_increase_tmu_accuracy(tunnel); in tb_switch_discover_tunnels()
401 tunnel = tb_tunnel_discover_pci(tb, port, alloc_hopids); in tb_switch_discover_tunnels()
405 tunnel = tb_tunnel_discover_usb3(tb, port, alloc_hopids); in tb_switch_discover_tunnels()
412 if (tunnel) in tb_switch_discover_tunnels()
413 list_add_tail(&tunnel->list, list); in tb_switch_discover_tunnels()
427 struct tb_tunnel *tunnel; in tb_discover_tunnels() local
431 list_for_each_entry(tunnel, &tcm->tunnel_list, list) { in tb_discover_tunnels()
432 if (tb_tunnel_is_pci(tunnel)) { in tb_discover_tunnels()
433 struct tb_switch *parent = tunnel->dst_port->sw; in tb_discover_tunnels()
435 while (parent != tunnel->src_port->sw) { in tb_discover_tunnels()
439 } else if (tb_tunnel_is_dp(tunnel)) { in tb_discover_tunnels()
440 struct tb_port *in = tunnel->src_port; in tb_discover_tunnels()
441 struct tb_port *out = tunnel->dst_port; in tb_discover_tunnels()
535 struct tb_tunnel *tunnel; in tb_find_tunnel() local
537 list_for_each_entry(tunnel, &tcm->tunnel_list, list) { in tb_find_tunnel()
538 if (tunnel->type == type && in tb_find_tunnel()
539 ((src_port && src_port == tunnel->src_port) || in tb_find_tunnel()
540 (dst_port && dst_port == tunnel->dst_port))) { in tb_find_tunnel()
541 return tunnel; in tb_find_tunnel()
580 struct tb_tunnel *tunnel; in tb_available_bandwidth() local
587 tunnel = tb_find_first_usb3_tunnel(tb, src_port, dst_port); in tb_available_bandwidth()
588 if (tunnel && tunnel->src_port != src_port && in tb_available_bandwidth()
589 tunnel->dst_port != dst_port) { in tb_available_bandwidth()
590 ret = tb_tunnel_consumed_bandwidth(tunnel, &usb3_consumed_up, in tb_available_bandwidth()
658 list_for_each_entry(tunnel, &tcm->tunnel_list, list) { in tb_available_bandwidth()
661 if (tb_tunnel_is_invalid(tunnel)) in tb_available_bandwidth()
664 if (!tb_tunnel_is_dp(tunnel)) in tb_available_bandwidth()
667 if (!tb_tunnel_port_on_path(tunnel, port)) in tb_available_bandwidth()
675 if (tunnel->src_port == src_port && in tb_available_bandwidth()
676 tunnel->dst_port == dst_port) in tb_available_bandwidth()
679 ret = tb_tunnel_consumed_bandwidth(tunnel, in tb_available_bandwidth()
716 struct tb_tunnel *tunnel; in tb_release_unused_usb3_bandwidth() local
718 tunnel = tb_find_first_usb3_tunnel(tb, src_port, dst_port); in tb_release_unused_usb3_bandwidth()
719 return tunnel ? tb_tunnel_release_unused_bandwidth(tunnel) : 0; in tb_release_unused_usb3_bandwidth()
726 struct tb_tunnel *tunnel; in tb_reclaim_usb3_bandwidth() local
728 tunnel = tb_find_first_usb3_tunnel(tb, src_port, dst_port); in tb_reclaim_usb3_bandwidth()
729 if (!tunnel) in tb_reclaim_usb3_bandwidth()
738 ret = tb_available_bandwidth(tb, tunnel->src_port, tunnel->dst_port, in tb_reclaim_usb3_bandwidth()
748 tb_tunnel_reclaim_available_bandwidth(tunnel, &available_up, &available_down); in tb_reclaim_usb3_bandwidth()
757 struct tb_tunnel *tunnel; in tb_tunnel_usb3() local
805 tunnel = tb_tunnel_alloc_usb3(tb, up, down, available_up, in tb_tunnel_usb3()
807 if (!tunnel) { in tb_tunnel_usb3()
812 if (tb_tunnel_activate(tunnel)) { in tb_tunnel_usb3()
819 list_add_tail(&tunnel->list, &tcm->tunnel_list); in tb_tunnel_usb3()
826 tb_tunnel_free(tunnel); in tb_tunnel_usb3()
1020 static void tb_deactivate_and_free_tunnel(struct tb_tunnel *tunnel) in tb_deactivate_and_free_tunnel() argument
1025 if (!tunnel) in tb_deactivate_and_free_tunnel()
1028 tb_tunnel_deactivate(tunnel); in tb_deactivate_and_free_tunnel()
1029 list_del(&tunnel->list); in tb_deactivate_and_free_tunnel()
1031 tb = tunnel->tb; in tb_deactivate_and_free_tunnel()
1032 src_port = tunnel->src_port; in tb_deactivate_and_free_tunnel()
1033 dst_port = tunnel->dst_port; in tb_deactivate_and_free_tunnel()
1035 switch (tunnel->type) { in tb_deactivate_and_free_tunnel()
1062 tb_tunnel_free(tunnel); in tb_deactivate_and_free_tunnel()
1071 struct tb_tunnel *tunnel; in tb_free_invalid_tunnels() local
1074 list_for_each_entry_safe(tunnel, n, &tcm->tunnel_list, list) { in tb_free_invalid_tunnels()
1075 if (tb_tunnel_is_invalid(tunnel)) in tb_free_invalid_tunnels()
1076 tb_deactivate_and_free_tunnel(tunnel); in tb_free_invalid_tunnels()
1169 struct tb_tunnel *tunnel; in tb_recalc_estimated_bandwidth_for_group() local
1175 tunnel = tb_find_tunnel(tb, TB_TUNNEL_DP, in, NULL); in tb_recalc_estimated_bandwidth_for_group()
1176 if (WARN_ON(!tunnel)) in tb_recalc_estimated_bandwidth_for_group()
1187 first_tunnel = tunnel; in tb_recalc_estimated_bandwidth_for_group()
1197 out = tunnel->dst_port; in tb_recalc_estimated_bandwidth_for_group()
1290 struct tb_tunnel *tunnel; in tb_tunnel_dp() local
1339 list_for_each_entry(tunnel, &tcm->tunnel_list, list) { in tb_tunnel_dp()
1340 if (tb_tunnel_is_dp(tunnel)) { in tb_tunnel_dp()
1379 tunnel = tb_tunnel_alloc_dp(tb, in, out, link_nr, available_up, in tb_tunnel_dp()
1381 if (!tunnel) { in tb_tunnel_dp()
1386 if (tb_tunnel_activate(tunnel)) { in tb_tunnel_dp()
1391 list_add_tail(&tunnel->list, &tcm->tunnel_list); in tb_tunnel_dp()
1401 tb_increase_tmu_accuracy(tunnel); in tb_tunnel_dp()
1405 tb_tunnel_free(tunnel); in tb_tunnel_dp()
1465 struct tb_tunnel *tunnel; in tb_dp_resource_unavailable() local
1477 tunnel = tb_find_tunnel(tb, TB_TUNNEL_DP, in, out); in tb_dp_resource_unavailable()
1478 if (tunnel) in tb_dp_resource_unavailable()
1479 tb_deactivate_and_free_tunnel(tunnel); in tb_dp_resource_unavailable()
1517 struct tb_tunnel *tunnel, *n; in tb_disconnect_and_release_dp() local
1523 list_for_each_entry_safe_reverse(tunnel, n, &tcm->tunnel_list, list) { in tb_disconnect_and_release_dp()
1524 if (tb_tunnel_is_dp(tunnel)) in tb_disconnect_and_release_dp()
1525 tb_deactivate_and_free_tunnel(tunnel); in tb_disconnect_and_release_dp()
1539 struct tb_tunnel *tunnel; in tb_disconnect_pci() local
1546 tunnel = tb_find_tunnel(tb, TB_TUNNEL_PCI, NULL, up); in tb_disconnect_pci()
1547 if (WARN_ON(!tunnel)) in tb_disconnect_pci()
1552 tb_tunnel_deactivate(tunnel); in tb_disconnect_pci()
1553 list_del(&tunnel->list); in tb_disconnect_pci()
1554 tb_tunnel_free(tunnel); in tb_disconnect_pci()
1562 struct tb_tunnel *tunnel; in tb_tunnel_pci() local
1577 tunnel = tb_tunnel_alloc_pci(tb, up, down); in tb_tunnel_pci()
1578 if (!tunnel) in tb_tunnel_pci()
1581 if (tb_tunnel_activate(tunnel)) { in tb_tunnel_pci()
1584 tb_tunnel_free(tunnel); in tb_tunnel_pci()
1598 list_add_tail(&tunnel->list, &tcm->tunnel_list); in tb_tunnel_pci()
1608 struct tb_tunnel *tunnel; in tb_approve_xdomain_paths() local
1624 tunnel = tb_tunnel_alloc_dma(tb, nhi_port, dst_port, transmit_path, in tb_approve_xdomain_paths()
1626 if (!tunnel) { in tb_approve_xdomain_paths()
1631 if (tb_tunnel_activate(tunnel)) { in tb_approve_xdomain_paths()
1638 list_add_tail(&tunnel->list, &tcm->tunnel_list); in tb_approve_xdomain_paths()
1643 tb_tunnel_free(tunnel); in tb_approve_xdomain_paths()
1657 struct tb_tunnel *tunnel, *n; in __tb_disconnect_xdomain_paths() local
1664 list_for_each_entry_safe(tunnel, n, &tcm->tunnel_list, list) { in __tb_disconnect_xdomain_paths()
1665 if (!tb_tunnel_is_dma(tunnel)) in __tb_disconnect_xdomain_paths()
1667 if (tunnel->src_port != nhi_port || tunnel->dst_port != dst_port) in __tb_disconnect_xdomain_paths()
1670 if (tb_tunnel_match_dma(tunnel, transmit_path, transmit_ring, in __tb_disconnect_xdomain_paths()
1672 tb_deactivate_and_free_tunnel(tunnel); in __tb_disconnect_xdomain_paths()
1815 static int tb_alloc_dp_bandwidth(struct tb_tunnel *tunnel, int *requested_up, in tb_alloc_dp_bandwidth() argument
1821 struct tb *tb = tunnel->tb; in tb_alloc_dp_bandwidth()
1824 ret = tb_tunnel_allocated_bandwidth(tunnel, &allocated_up, &allocated_down); in tb_alloc_dp_bandwidth()
1828 in = tunnel->src_port; in tb_alloc_dp_bandwidth()
1829 out = tunnel->dst_port; in tb_alloc_dp_bandwidth()
1846 ret = tb_tunnel_maximum_bandwidth(tunnel, &max_up, &max_down); in tb_alloc_dp_bandwidth()
1894 return tb_tunnel_alloc_bandwidth(tunnel, requested_up, in tb_alloc_dp_bandwidth()
1920 ret = tb_tunnel_alloc_bandwidth(tunnel, requested_up, in tb_alloc_dp_bandwidth()
1936 struct tb_tunnel *tunnel; in tb_handle_dp_bandwidth_request() local
1979 tunnel = tb_find_tunnel(tb, TB_TUNNEL_DP, in, NULL); in tb_handle_dp_bandwidth_request()
1980 if (!tunnel) { in tb_handle_dp_bandwidth_request()
1985 out = tunnel->dst_port; in tb_handle_dp_bandwidth_request()
1995 ret = tb_alloc_dp_bandwidth(tunnel, &requested_up, &requested_down); in tb_handle_dp_bandwidth_request()
2094 struct tb_tunnel *tunnel; in tb_stop() local
2099 list_for_each_entry_safe(tunnel, n, &tcm->tunnel_list, list) { in tb_stop()
2105 if (tb_tunnel_is_dma(tunnel)) in tb_stop()
2106 tb_tunnel_deactivate(tunnel); in tb_stop()
2107 tb_tunnel_free(tunnel); in tb_stop()
2256 struct tb_tunnel *tunnel, *n; in tb_resume_noirq() local
2281 list_for_each_entry_safe_reverse(tunnel, n, &tunnels, list) { in tb_resume_noirq()
2282 if (tb_tunnel_is_usb3(tunnel)) in tb_resume_noirq()
2284 tb_tunnel_deactivate(tunnel); in tb_resume_noirq()
2285 tb_tunnel_free(tunnel); in tb_resume_noirq()
2289 list_for_each_entry_safe(tunnel, n, &tcm->tunnel_list, list) { in tb_resume_noirq()
2291 if (tb_tunnel_is_usb3(tunnel)) { in tb_resume_noirq()
2296 tb_tunnel_restart(tunnel); in tb_resume_noirq()
2392 struct tb_tunnel *tunnel, *n; in tb_runtime_resume() local
2398 list_for_each_entry_safe(tunnel, n, &tcm->tunnel_list, list) in tb_runtime_resume()
2399 tb_tunnel_restart(tunnel); in tb_runtime_resume()