Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Andreas Noever | 3364f0c | 2014-06-03 22:04:08 +0200 | [diff] [blame] | 2 | /* |
Mika Westerberg | 93f36ad | 2017-02-19 13:48:29 +0200 | [diff] [blame] | 3 | * Thunderbolt driver - Tunneling support |
Andreas Noever | 3364f0c | 2014-06-03 22:04:08 +0200 | [diff] [blame] | 4 | * |
| 5 | * Copyright (c) 2014 Andreas Noever <andreas.noever@gmail.com> |
Mika Westerberg | 93f36ad | 2017-02-19 13:48:29 +0200 | [diff] [blame] | 6 | * Copyright (C) 2019, Intel Corporation |
Andreas Noever | 3364f0c | 2014-06-03 22:04:08 +0200 | [diff] [blame] | 7 | */ |
| 8 | |
Mika Westerberg | 1752b9f | 2017-02-19 10:58:35 +0200 | [diff] [blame] | 9 | #ifndef TB_TUNNEL_H_ |
| 10 | #define TB_TUNNEL_H_ |
Andreas Noever | 3364f0c | 2014-06-03 22:04:08 +0200 | [diff] [blame] | 11 | |
| 12 | #include "tb.h" |
| 13 | |
Mika Westerberg | 93f36ad | 2017-02-19 13:48:29 +0200 | [diff] [blame] | 14 | /** |
| 15 | * struct tb_tunnel - Tunnel between two ports |
| 16 | * @tb: Pointer to the domain |
| 17 | * @src_port: Source port of the tunnel |
Mika Westerberg | 0414bec | 2017-02-19 23:43:26 +0200 | [diff] [blame^] | 18 | * @dst_port: Destination port of the tunnel. For discovered incomplete |
| 19 | * tunnels may be %NULL or null adapter port instead. |
Mika Westerberg | 93f36ad | 2017-02-19 13:48:29 +0200 | [diff] [blame] | 20 | * @paths: All paths required by the tunnel |
| 21 | * @npaths: Number of paths in @paths |
| 22 | * @activate: Optional tunnel specific activation/deactivation |
| 23 | * @list: Tunnels are linked using this field |
| 24 | */ |
| 25 | struct tb_tunnel { |
Andreas Noever | 3364f0c | 2014-06-03 22:04:08 +0200 | [diff] [blame] | 26 | struct tb *tb; |
Mika Westerberg | 93f36ad | 2017-02-19 13:48:29 +0200 | [diff] [blame] | 27 | struct tb_port *src_port; |
| 28 | struct tb_port *dst_port; |
| 29 | struct tb_path **paths; |
| 30 | size_t npaths; |
| 31 | int (*activate)(struct tb_tunnel *tunnel, bool activate); |
Andreas Noever | 3364f0c | 2014-06-03 22:04:08 +0200 | [diff] [blame] | 32 | struct list_head list; |
| 33 | }; |
| 34 | |
Mika Westerberg | 0414bec | 2017-02-19 23:43:26 +0200 | [diff] [blame^] | 35 | struct tb_tunnel *tb_tunnel_discover_pci(struct tb *tb, struct tb_port *down); |
Mika Westerberg | 93f36ad | 2017-02-19 13:48:29 +0200 | [diff] [blame] | 36 | struct tb_tunnel *tb_tunnel_alloc_pci(struct tb *tb, struct tb_port *up, |
| 37 | struct tb_port *down); |
| 38 | void tb_tunnel_free(struct tb_tunnel *tunnel); |
| 39 | int tb_tunnel_activate(struct tb_tunnel *tunnel); |
| 40 | int tb_tunnel_restart(struct tb_tunnel *tunnel); |
| 41 | void tb_tunnel_deactivate(struct tb_tunnel *tunnel); |
| 42 | bool tb_tunnel_is_invalid(struct tb_tunnel *tunnel); |
Andreas Noever | 3364f0c | 2014-06-03 22:04:08 +0200 | [diff] [blame] | 43 | |
| 44 | #endif |
| 45 | |