Merge tag 'gcc-plugins-v5.2-rc1' of ssh://gitolite.kernel.org/pub/scm/linux/kernel...
[sfrench/cifs-2.6.git] / drivers / thunderbolt / tunnel.h
index 07bf587bed80a699dd57b495d24712fc11657544..c68bbcd3a62c4f1b0ba68b8223420fcd5e5e4b09 100644 (file)
 
 #include "tb.h"
 
+enum tb_tunnel_type {
+       TB_TUNNEL_PCI,
+       TB_TUNNEL_DP,
+       TB_TUNNEL_DMA,
+};
+
 /**
  * struct tb_tunnel - Tunnel between two ports
  * @tb: Pointer to the domain
  *           tunnels may be %NULL or null adapter port instead.
  * @paths: All paths required by the tunnel
  * @npaths: Number of paths in @paths
+ * @init: Optional tunnel specific initialization
  * @activate: Optional tunnel specific activation/deactivation
  * @list: Tunnels are linked using this field
+ * @type: Type of the tunnel
  */
 struct tb_tunnel {
        struct tb *tb;
@@ -28,18 +36,43 @@ struct tb_tunnel {
        struct tb_port *dst_port;
        struct tb_path **paths;
        size_t npaths;
+       int (*init)(struct tb_tunnel *tunnel);
        int (*activate)(struct tb_tunnel *tunnel, bool activate);
        struct list_head list;
+       enum tb_tunnel_type type;
 };
 
 struct tb_tunnel *tb_tunnel_discover_pci(struct tb *tb, struct tb_port *down);
 struct tb_tunnel *tb_tunnel_alloc_pci(struct tb *tb, struct tb_port *up,
                                      struct tb_port *down);
+struct tb_tunnel *tb_tunnel_discover_dp(struct tb *tb, struct tb_port *in);
+struct tb_tunnel *tb_tunnel_alloc_dp(struct tb *tb, struct tb_port *in,
+                                    struct tb_port *out);
+struct tb_tunnel *tb_tunnel_alloc_dma(struct tb *tb, struct tb_port *nhi,
+                                     struct tb_port *dst, int transmit_ring,
+                                     int transmit_path, int receive_ring,
+                                     int receive_path);
+
 void tb_tunnel_free(struct tb_tunnel *tunnel);
 int tb_tunnel_activate(struct tb_tunnel *tunnel);
 int tb_tunnel_restart(struct tb_tunnel *tunnel);
 void tb_tunnel_deactivate(struct tb_tunnel *tunnel);
 bool tb_tunnel_is_invalid(struct tb_tunnel *tunnel);
 
+static inline bool tb_tunnel_is_pci(const struct tb_tunnel *tunnel)
+{
+       return tunnel->type == TB_TUNNEL_PCI;
+}
+
+static inline bool tb_tunnel_is_dp(const struct tb_tunnel *tunnel)
+{
+       return tunnel->type == TB_TUNNEL_DP;
+}
+
+static inline bool tb_tunnel_is_dma(const struct tb_tunnel *tunnel)
+{
+       return tunnel->type == TB_TUNNEL_DMA;
+}
+
 #endif