blob: 07bf587bed80a699dd57b495d24712fc11657544 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Andreas Noever3364f0c2014-06-03 22:04:08 +02002/*
Mika Westerberg93f36ad2017-02-19 13:48:29 +02003 * Thunderbolt driver - Tunneling support
Andreas Noever3364f0c2014-06-03 22:04:08 +02004 *
5 * Copyright (c) 2014 Andreas Noever <andreas.noever@gmail.com>
Mika Westerberg93f36ad2017-02-19 13:48:29 +02006 * Copyright (C) 2019, Intel Corporation
Andreas Noever3364f0c2014-06-03 22:04:08 +02007 */
8
Mika Westerberg1752b9f2017-02-19 10:58:35 +02009#ifndef TB_TUNNEL_H_
10#define TB_TUNNEL_H_
Andreas Noever3364f0c2014-06-03 22:04:08 +020011
12#include "tb.h"
13
Mika Westerberg93f36ad2017-02-19 13:48:29 +020014/**
15 * struct tb_tunnel - Tunnel between two ports
16 * @tb: Pointer to the domain
17 * @src_port: Source port of the tunnel
Mika Westerberg0414bec2017-02-19 23:43:26 +020018 * @dst_port: Destination port of the tunnel. For discovered incomplete
19 * tunnels may be %NULL or null adapter port instead.
Mika Westerberg93f36ad2017-02-19 13:48:29 +020020 * @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 */
25struct tb_tunnel {
Andreas Noever3364f0c2014-06-03 22:04:08 +020026 struct tb *tb;
Mika Westerberg93f36ad2017-02-19 13:48:29 +020027 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 Noever3364f0c2014-06-03 22:04:08 +020032 struct list_head list;
33};
34
Mika Westerberg0414bec2017-02-19 23:43:26 +020035struct tb_tunnel *tb_tunnel_discover_pci(struct tb *tb, struct tb_port *down);
Mika Westerberg93f36ad2017-02-19 13:48:29 +020036struct tb_tunnel *tb_tunnel_alloc_pci(struct tb *tb, struct tb_port *up,
37 struct tb_port *down);
38void tb_tunnel_free(struct tb_tunnel *tunnel);
39int tb_tunnel_activate(struct tb_tunnel *tunnel);
40int tb_tunnel_restart(struct tb_tunnel *tunnel);
41void tb_tunnel_deactivate(struct tb_tunnel *tunnel);
42bool tb_tunnel_is_invalid(struct tb_tunnel *tunnel);
Andreas Noever3364f0c2014-06-03 22:04:08 +020043
44#endif
45