All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] thunderbolt: Add DP out resource when DP tunnel is discovered.
@ 2022-07-06  5:39 Sanjay R Mehta
  2022-07-06  6:25 ` Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: Sanjay R Mehta @ 2022-07-06  5:39 UTC (permalink / raw)
  To: mika.westerberg, andreas.noever, michael.jamet, YehezkelShB
  Cc: Basavaraj.Natikar, mario.limonciello, linux-usb, Sanjay R Mehta

From: Sanjay R Mehta <sanju.mehta@amd.com>

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.

Signed-off-by: Sanjay R Mehta <sanju.mehta@amd.com>
Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
---
 drivers/thunderbolt/tb.c     | 15 +++++++++++++++
 drivers/thunderbolt/tb.h     |  1 +
 drivers/thunderbolt/tunnel.c |  2 ++
 3 files changed, 18 insertions(+)

diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
index 9a3214f..dcd0c3e 100644
--- a/drivers/thunderbolt/tb.c
+++ b/drivers/thunderbolt/tb.c
@@ -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);
diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h
index 4602c69..cef2fe3 100644
--- a/drivers/thunderbolt/tb.h
+++ b/drivers/thunderbolt/tb.h
@@ -1222,6 +1222,7 @@ struct usb4_port *usb4_port_device_add(struct tb_port *port);
 void usb4_port_device_remove(struct usb4_port *usb4);
 int usb4_port_device_resume(struct usb4_port *usb4);
 
+void tb_dp_resource_available_discovered(struct tb *tb, struct tb_port *port);
 /* Keep link controller awake during update */
 #define QUIRK_FORCE_POWER_LINK_CONTROLLER		BIT(0)
 
diff --git a/drivers/thunderbolt/tunnel.c b/drivers/thunderbolt/tunnel.c
index 2c3cf7f..1394ae9 100644
--- a/drivers/thunderbolt/tunnel.c
+++ b/drivers/thunderbolt/tunnel.c
@@ -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;
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] thunderbolt: Add DP out resource when DP tunnel is discovered.
  2022-07-06  5:39 [PATCH] thunderbolt: Add DP out resource when DP tunnel is discovered Sanjay R Mehta
@ 2022-07-06  6:25 ` Greg KH
  2022-07-06 12:00   ` Sanjay R Mehta
  0 siblings, 1 reply; 7+ messages in thread
From: Greg KH @ 2022-07-06  6:25 UTC (permalink / raw)
  To: Sanjay R Mehta
  Cc: mika.westerberg, andreas.noever, michael.jamet, YehezkelShB,
	Basavaraj.Natikar, mario.limonciello, linux-usb

On Wed, Jul 06, 2022 at 12:39:38AM -0500, Sanjay R Mehta wrote:
> From: Sanjay R Mehta <sanju.mehta@amd.com>
> 
> 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.
> 
> Signed-off-by: Sanjay R Mehta <sanju.mehta@amd.com>
> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
> ---
>  drivers/thunderbolt/tb.c     | 15 +++++++++++++++
>  drivers/thunderbolt/tb.h     |  1 +
>  drivers/thunderbolt/tunnel.c |  2 ++
>  3 files changed, 18 insertions(+)
> 
> diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
> index 9a3214f..dcd0c3e 100644
> --- a/drivers/thunderbolt/tb.c
> +++ b/drivers/thunderbolt/tb.c
> @@ -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);
> diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h
> index 4602c69..cef2fe3 100644
> --- a/drivers/thunderbolt/tb.h
> +++ b/drivers/thunderbolt/tb.h
> @@ -1222,6 +1222,7 @@ struct usb4_port *usb4_port_device_add(struct tb_port *port);
>  void usb4_port_device_remove(struct usb4_port *usb4);
>  int usb4_port_device_resume(struct usb4_port *usb4);
>  
> +void tb_dp_resource_available_discovered(struct tb *tb, struct tb_port *port);

Why not put this in the .h file next to the other tb_* calls?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] thunderbolt: Add DP out resource when DP tunnel is discovered.
  2022-07-06  6:25 ` Greg KH
@ 2022-07-06 12:00   ` Sanjay R Mehta
  2022-07-07 10:31     ` Sanjay R Mehta
  0 siblings, 1 reply; 7+ messages in thread
From: Sanjay R Mehta @ 2022-07-06 12:00 UTC (permalink / raw)
  To: Greg KH, Sanjay R Mehta
  Cc: mika.westerberg, andreas.noever, michael.jamet, YehezkelShB,
	Basavaraj.Natikar, mario.limonciello, linux-usb



On 7/6/2022 11:55 AM, Greg KH wrote:
> On Wed, Jul 06, 2022 at 12:39:38AM -0500, Sanjay R Mehta wrote:
>> From: Sanjay R Mehta <sanju.mehta@amd.com>
>>
>> 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.
>>
>> Signed-off-by: Sanjay R Mehta <sanju.mehta@amd.com>
>> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
>> ---
>>  drivers/thunderbolt/tb.c     | 15 +++++++++++++++
>>  drivers/thunderbolt/tb.h     |  1 +
>>  drivers/thunderbolt/tunnel.c |  2 ++
>>  3 files changed, 18 insertions(+)
>>
>> diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
>> index 9a3214f..dcd0c3e 100644
>> --- a/drivers/thunderbolt/tb.c
>> +++ b/drivers/thunderbolt/tb.c
>> @@ -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);
>> diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h
>> index 4602c69..cef2fe3 100644
>> --- a/drivers/thunderbolt/tb.h
>> +++ b/drivers/thunderbolt/tb.h
>> @@ -1222,6 +1222,7 @@ struct usb4_port *usb4_port_device_add(struct tb_port *port);
>>  void usb4_port_device_remove(struct usb4_port *usb4);
>>  int usb4_port_device_resume(struct usb4_port *usb4);
>>  
>> +void tb_dp_resource_available_discovered(struct tb *tb, struct tb_port *port);
> 
> Why not put this in the .h file next to the other tb_* calls?
> 

Sure Greg. Will make this change.

- Sanjay

> thanks,
> 
> greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] thunderbolt: Add DP out resource when DP tunnel is discovered.
  2022-07-06 12:00   ` Sanjay R Mehta
@ 2022-07-07 10:31     ` Sanjay R Mehta
  2022-07-07 11:12       ` Greg KH
  2022-07-07 11:14       ` Greg KH
  0 siblings, 2 replies; 7+ messages in thread
From: Sanjay R Mehta @ 2022-07-07 10:31 UTC (permalink / raw)
  To: Greg KH, Sanjay R Mehta
  Cc: mika.westerberg, andreas.noever, michael.jamet, YehezkelShB,
	Basavaraj.Natikar, mario.limonciello, linux-usb



On 7/6/2022 5:30 PM, Sanjay R Mehta wrote:
> 
> 
> On 7/6/2022 11:55 AM, Greg KH wrote:
>> On Wed, Jul 06, 2022 at 12:39:38AM -0500, Sanjay R Mehta wrote:
>>> From: Sanjay R Mehta <sanju.mehta@amd.com>
>>>
>>> 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.
>>>
>>> Signed-off-by: Sanjay R Mehta <sanju.mehta@amd.com>
>>> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
>>> ---
>>>  drivers/thunderbolt/tb.c     | 15 +++++++++++++++
>>>  drivers/thunderbolt/tb.h     |  1 +
>>>  drivers/thunderbolt/tunnel.c |  2 ++
>>>  3 files changed, 18 insertions(+)
>>>
>>> diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
>>> index 9a3214f..dcd0c3e 100644
>>> --- a/drivers/thunderbolt/tb.c
>>> +++ b/drivers/thunderbolt/tb.c
>>> @@ -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);
>>> diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h
>>> index 4602c69..cef2fe3 100644
>>> --- a/drivers/thunderbolt/tb.h
>>> +++ b/drivers/thunderbolt/tb.h
>>> @@ -1222,6 +1222,7 @@ struct usb4_port *usb4_port_device_add(struct tb_port *port);
>>>  void usb4_port_device_remove(struct usb4_port *usb4);
>>>  int usb4_port_device_resume(struct usb4_port *usb4);
>>>  
>>> +void tb_dp_resource_available_discovered(struct tb *tb, struct tb_port *port);
>>
>> Why not put this in the .h file next to the other tb_* calls?
>>
> 
Hi Greg,

I forgot to explain that in this function, I have used a structure
"struct tb_cm" which is defined and used only in tb.c file. Hence have
to keep this function in tb.c file.

- Sanjay

> Sure Greg. Will make this change.
> 
> - Sanjay
> 
>> thanks,
>>
>> greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] thunderbolt: Add DP out resource when DP tunnel is discovered.
  2022-07-07 10:31     ` Sanjay R Mehta
@ 2022-07-07 11:12       ` Greg KH
  2022-07-07 11:14       ` Greg KH
  1 sibling, 0 replies; 7+ messages in thread
From: Greg KH @ 2022-07-07 11:12 UTC (permalink / raw)
  To: Sanjay R Mehta
  Cc: Sanjay R Mehta, mika.westerberg, andreas.noever, michael.jamet,
	YehezkelShB, Basavaraj.Natikar, mario.limonciello, linux-usb

On Thu, Jul 07, 2022 at 04:01:12PM +0530, Sanjay R Mehta wrote:
> 
> 
> On 7/6/2022 5:30 PM, Sanjay R Mehta wrote:
> > 
> > 
> > On 7/6/2022 11:55 AM, Greg KH wrote:
> >> On Wed, Jul 06, 2022 at 12:39:38AM -0500, Sanjay R Mehta wrote:
> >>> From: Sanjay R Mehta <sanju.mehta@amd.com>
> >>>
> >>> 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.
> >>>
> >>> Signed-off-by: Sanjay R Mehta <sanju.mehta@amd.com>
> >>> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
> >>> ---
> >>>  drivers/thunderbolt/tb.c     | 15 +++++++++++++++
> >>>  drivers/thunderbolt/tb.h     |  1 +
> >>>  drivers/thunderbolt/tunnel.c |  2 ++
> >>>  3 files changed, 18 insertions(+)
> >>>
> >>> diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
> >>> index 9a3214f..dcd0c3e 100644
> >>> --- a/drivers/thunderbolt/tb.c
> >>> +++ b/drivers/thunderbolt/tb.c
> >>> @@ -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);
> >>> diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h
> >>> index 4602c69..cef2fe3 100644
> >>> --- a/drivers/thunderbolt/tb.h
> >>> +++ b/drivers/thunderbolt/tb.h
> >>> @@ -1222,6 +1222,7 @@ struct usb4_port *usb4_port_device_add(struct tb_port *port);
> >>>  void usb4_port_device_remove(struct usb4_port *usb4);
> >>>  int usb4_port_device_resume(struct usb4_port *usb4);
> >>>  
> >>> +void tb_dp_resource_available_discovered(struct tb *tb, struct tb_port *port);
> >>
> >> Why not put this in the .h file next to the other tb_* calls?
> >>
> > 
> Hi Greg,
> 
> I forgot to explain that in this function, I have used a structure
> "struct tb_cm" which is defined and used only in tb.c file. Hence have
> to keep this function in tb.c file.

I was not referring to the .c file here.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] thunderbolt: Add DP out resource when DP tunnel is discovered.
  2022-07-07 10:31     ` Sanjay R Mehta
  2022-07-07 11:12       ` Greg KH
@ 2022-07-07 11:14       ` Greg KH
  2022-07-07 11:18         ` Sanjay R Mehta
  1 sibling, 1 reply; 7+ messages in thread
From: Greg KH @ 2022-07-07 11:14 UTC (permalink / raw)
  To: Sanjay R Mehta
  Cc: Sanjay R Mehta, mika.westerberg, andreas.noever, michael.jamet,
	YehezkelShB, Basavaraj.Natikar, mario.limonciello, linux-usb

On Thu, Jul 07, 2022 at 04:01:12PM +0530, Sanjay R Mehta wrote:
> 
> 
> On 7/6/2022 5:30 PM, Sanjay R Mehta wrote:
> > 
> > 
> > On 7/6/2022 11:55 AM, Greg KH wrote:
> >> On Wed, Jul 06, 2022 at 12:39:38AM -0500, Sanjay R Mehta wrote:
> >>> From: Sanjay R Mehta <sanju.mehta@amd.com>
> >>>
> >>> 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.
> >>>
> >>> Signed-off-by: Sanjay R Mehta <sanju.mehta@amd.com>
> >>> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
> >>> ---
> >>>  drivers/thunderbolt/tb.c     | 15 +++++++++++++++
> >>>  drivers/thunderbolt/tb.h     |  1 +
> >>>  drivers/thunderbolt/tunnel.c |  2 ++
> >>>  3 files changed, 18 insertions(+)
> >>>
> >>> diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
> >>> index 9a3214f..dcd0c3e 100644
> >>> --- a/drivers/thunderbolt/tb.c
> >>> +++ b/drivers/thunderbolt/tb.c
> >>> @@ -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);
> >>> diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h
> >>> index 4602c69..cef2fe3 100644
> >>> --- a/drivers/thunderbolt/tb.h
> >>> +++ b/drivers/thunderbolt/tb.h
> >>> @@ -1222,6 +1222,7 @@ struct usb4_port *usb4_port_device_add(struct tb_port *port);
> >>>  void usb4_port_device_remove(struct usb4_port *usb4);
> >>>  int usb4_port_device_resume(struct usb4_port *usb4);
> >>>  
> >>> +void tb_dp_resource_available_discovered(struct tb *tb, struct tb_port *port);
> >>
> >> Why not put this in the .h file next to the other tb_* calls?
> >>
> > 
> Hi Greg,
> 
> I forgot to explain that in this function, I have used a structure
> "struct tb_cm" which is defined and used only in tb.c file. Hence have
> to keep this function in tb.c file.

To be more specific, I mean why not put it below the line:
	int tb_dp_port_enable(struct tb_port *port, bool enable);
in this .h file in an attempt to keep things orderly.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] thunderbolt: Add DP out resource when DP tunnel is discovered.
  2022-07-07 11:14       ` Greg KH
@ 2022-07-07 11:18         ` Sanjay R Mehta
  0 siblings, 0 replies; 7+ messages in thread
From: Sanjay R Mehta @ 2022-07-07 11:18 UTC (permalink / raw)
  To: Greg KH
  Cc: Sanjay R Mehta, mika.westerberg, andreas.noever, michael.jamet,
	YehezkelShB, Basavaraj.Natikar, mario.limonciello, linux-usb



On 7/7/2022 4:44 PM, Greg KH wrote:
> On Thu, Jul 07, 2022 at 04:01:12PM +0530, Sanjay R Mehta wrote:
>>
>>
>> On 7/6/2022 5:30 PM, Sanjay R Mehta wrote:
>>>
>>>
>>> On 7/6/2022 11:55 AM, Greg KH wrote:
>>>> On Wed, Jul 06, 2022 at 12:39:38AM -0500, Sanjay R Mehta wrote:
>>>>> From: Sanjay R Mehta <sanju.mehta@amd.com>
>>>>>
>>>>> 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.
>>>>>
>>>>> Signed-off-by: Sanjay R Mehta <sanju.mehta@amd.com>
>>>>> Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
>>>>> ---
>>>>>  drivers/thunderbolt/tb.c     | 15 +++++++++++++++
>>>>>  drivers/thunderbolt/tb.h     |  1 +
>>>>>  drivers/thunderbolt/tunnel.c |  2 ++
>>>>>  3 files changed, 18 insertions(+)
>>>>>
>>>>> diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
>>>>> index 9a3214f..dcd0c3e 100644
>>>>> --- a/drivers/thunderbolt/tb.c
>>>>> +++ b/drivers/thunderbolt/tb.c
>>>>> @@ -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);
>>>>> diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h
>>>>> index 4602c69..cef2fe3 100644
>>>>> --- a/drivers/thunderbolt/tb.h
>>>>> +++ b/drivers/thunderbolt/tb.h
>>>>> @@ -1222,6 +1222,7 @@ struct usb4_port *usb4_port_device_add(struct tb_port *port);
>>>>>  void usb4_port_device_remove(struct usb4_port *usb4);
>>>>>  int usb4_port_device_resume(struct usb4_port *usb4);
>>>>>  
>>>>> +void tb_dp_resource_available_discovered(struct tb *tb, struct tb_port *port);
>>>>
>>>> Why not put this in the .h file next to the other tb_* calls?
>>>>
>>>
>> Hi Greg,
>>
>> I forgot to explain that in this function, I have used a structure
>> "struct tb_cm" which is defined and used only in tb.c file. Hence have
>> to keep this function in tb.c file.
> 
> To be more specific, I mean why not put it below the line:
> 	int tb_dp_port_enable(struct tb_port *port, bool enable);
> in this .h file in an attempt to keep things orderly.
> 

I get it now. My bad :).

Will send the change.

> thanks,
> 
> greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-07-07 11:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-06  5:39 [PATCH] thunderbolt: Add DP out resource when DP tunnel is discovered Sanjay R Mehta
2022-07-06  6:25 ` Greg KH
2022-07-06 12:00   ` Sanjay R Mehta
2022-07-07 10:31     ` Sanjay R Mehta
2022-07-07 11:12       ` Greg KH
2022-07-07 11:14       ` Greg KH
2022-07-07 11:18         ` Sanjay R Mehta

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.