Skip to contentSkip to conversation

thunderbolt: Add DP out resource when DP tunnel is discovered.

PATCH RESEND Superseded Sanjay R Mehta 3 participants 3 messages Jul 7, 2022 – Aug 1, 2022

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH RESEND v2 1/1 thunderbolt: Add DP out resource when DP tunnel is discovered.

From: Sanjay R Mehta <[email protected]>

If the boot firmware implements a connection manager of its own it may create a DP tunnel and will be handed off to Linux CM, but the DP out resource is not saved in the dp_resource list.

This patch adds tunnelled DP out port to the dp_resource list once the DP tunnel is discovered.

---
v2: Re-ordering the function declaration as per Greg's comment.

---
 drivers/thunderbolt/tb.c     | 15 +++++++++++++++
 drivers/thunderbolt/tb.h     |  1 +
 drivers/thunderbolt/tunnel.c |  2 ++
 3 files changed, 18 insertions(+)
drivers/thunderbolt/tb.c +15 -0
index 9a3214f..dcd0c3e 100644
@@ -1006,6 +1006,21 @@ static void tb_dp_resource_unavailable(struct tb *tb, struct tb_port *port)
 	tb_tunnel_dp(tb);
 }
 
+void tb_dp_resource_available_discovered(struct tb *tb, struct tb_port *port)
+{
+	struct tb_cm *tcm = tb_priv(tb);
+	struct tb_port *p;
+
+	list_for_each_entry(p, &tcm->dp_resources, list) {
+		if (p == port)
+			return;
+	}
+
+	tb_port_dbg(port, "DP %s resource available discovered\n",
+		    tb_port_is_dpin(port) ? "IN" : "OUT");
+	list_add_tail(&port->list, &tcm->dp_resources);
+}
+
 static void tb_dp_resource_available(struct tb *tb, struct tb_port *port)
 {
 	struct tb_cm *tcm = tb_priv(tb);
drivers/thunderbolt/tb.h +1 -0
index 4602c69..a841844 100644
@@ -1051,6 +1051,7 @@ int tb_dp_port_set_hops(struct tb_port *port, unsigned int video,
 			unsigned int aux_tx, unsigned int aux_rx);
 bool tb_dp_port_is_enabled(struct tb_port *port);
 int tb_dp_port_enable(struct tb_port *port, bool enable);
+void tb_dp_resource_available_discovered(struct tb *tb, struct tb_port *port);
 
 struct tb_path *tb_path_discover(struct tb_port *src, int src_hopid,
 				 struct tb_port *dst, int dst_hopid,
drivers/thunderbolt/tunnel.c +2 -0
index 2c3cf7f..1394ae9 100644
@@ -845,6 +845,8 @@ struct tb_tunnel *tb_tunnel_discover_dp(struct tb *tb, struct tb_port *in,
 		goto err_deactivate;
 	}
 
+	tb_dp_resource_available_discovered(tb, tunnel->dst_port);
+
 	tb_tunnel_dbg(tunnel, "discovered\n");
 	return tunnel;
 
Signature · 1 line
2.7.4
#1 lore raw

Hi,

Quoted 27 lines · Sanjay R Mehta

From: Sanjay R Mehta <[email protected]>

If the boot firmware implements a connection manager of its own it may create a DP tunnel and will be handed off to Linux CM, but the DP out resource is not saved in the dp_resource list.

This patch adds tunnelled DP out port to the dp_resource list once the DP tunnel is discovered.

---
v2: Re-ordering the function declaration as per Greg's comment.

---
 drivers/thunderbolt/tb.c     | 15 +++++++++++++++
 drivers/thunderbolt/tb.h     |  1 +
 drivers/thunderbolt/tunnel.c |  2 ++
 3 files changed, 18 insertions(+)
drivers/thunderbolt/tb.c +0 -0
index 9a3214f..dcd0c3e 100644

drivers/thunderbolt/tb.c static void tb_dp_resource_unavailable(struct tb *tb, struct tb_port *port) · line 1009

Quoted 4 lines
drivers/thunderbolt/tb.c +1 -0
@@ -1006,6 +1006,21 @@ static void tb_dp_resource_unavailable(struct tb *tb, struct tb_port *port)
 	tb_tunnel_dp(tb);
 }
 
+void tb_dp_resource_available_discovered(struct tb *tb, struct tb_port *port)

Please call this tb_discover_dp_resources() make it static and call it right after tb_discover_tunnels() in tb_start() or in tb_discover_tunnels().

Thanks!

#2 lore raw
Quoted 33 lines · Mika Westerberg

Hi,

Quoted 30 lines · Sanjay R Mehta

From: Sanjay R Mehta <[email protected]>

If the boot firmware implements a connection manager of its own it may create a DP tunnel and will be handed off to Linux CM, but the DP out resource is not saved in the dp_resource list.

This patch adds tunnelled DP out port to the dp_resource list once the DP tunnel is discovered.

---
v2: Re-ordering the function declaration as per Greg's comment.

---
 drivers/thunderbolt/tb.c     | 15 +++++++++++++++
 drivers/thunderbolt/tb.h     |  1 +
 drivers/thunderbolt/tunnel.c |  2 ++
 3 files changed, 18 insertions(+)
drivers/thunderbolt/tb.c +0 -0
index 9a3214f..dcd0c3e 100644
@@ -1006,6 +1006,21 @@ static void tb_dp_resource_unavailable(struct tb *tb, struct tb_port *port)
 	tb_tunnel_dp(tb);
 }
 
Quoted 6 lines

drivers/thunderbolt/tb.c static void tb_dp_resource_unavailable(struct tb *tb, struct tb_port *port) · line 1009

Quoted 1 line
drivers/thunderbolt/tb.c +1 -0
+void tb_dp_resource_available_discovered(struct tb *tb, struct tb_port *port)

Please call this tb_discover_dp_resources() make it static and call it right after tb_discover_tunnels() in tb_start() or in tb_discover_tunnels().

Thanks Mika. Sure, I'll address this & will send you the v3.

Quoted 1 line

Thanks!