mbox series

[v3,0/3] thunderbolt: Expose details about tunneling

Message ID 20210329074150.62622-1-mika.westerberg@linux.intel.com
Headers show
Series thunderbolt: Expose details about tunneling | expand

Message

Mika Westerberg March 29, 2021, 7:41 a.m. UTC
Hello there,

There has been ask if we can expose more details about the connected
devices and the tunneling to userspace, so it can then provide more
detailed information to the user.

First we add uevent details for each device (USB4 router) that adds
USB4_TYPE=host|device|hub and USB4_VERSION=1.0 (if the device actually is
USB4). The host|device|hub definitions follow the USB4 spec.

Then for each device router we expose two new attributes: "usb3" and "dp"
that if present mean that the device has corresponding adapter (USB 3.x
upstream adapter and DP OUT adapter). The contents of the attributes then
hold number of tunnels ending to this router. So if USB 3.x is tunneled
"usb3" reads 1. Since there can be multiple DP OUT adaptes the "dp"
attribute holds number of DP tunnels ending to this router. For PCIe
tunneling the "authorized" attribute works the same way.

Previous versions can be found:

  v2: https://lore.kernel.org/linux-usb/20210323145701.86161-1-mika.westerberg@linux.intel.com/
  v1: https://lore.kernel.org/linux-usb/20210309134818.63118-1-mika.westerberg@linux.intel.com/

Changes from v2:

  * Added missing sysfs_emit()

Changes from v1:

  * Added Greg's Reviewed-by tags for patch 1 and 2
  * Use sysfs_emit()
  * Drop the locking in the new attributes
  * Drop the kobject_uevent()

Mika Westerberg (3):
  thunderbolt: Add details to router uevent
  thunderbolt: Hide authorized attribute if router does not support PCIe tunnels
  thunderbolt: Expose more details about USB 3.x and DisplayPort tunnels

 .../ABI/testing/sysfs-bus-thunderbolt         | 26 +++++++
 drivers/thunderbolt/domain.c                  | 10 +++
 drivers/thunderbolt/switch.c                  | 78 ++++++++++++++++++-
 drivers/thunderbolt/tb.c                      | 44 ++++++++---
 drivers/thunderbolt/tb.h                      |  4 +
 include/linux/thunderbolt.h                   |  6 ++
 6 files changed, 156 insertions(+), 12 deletions(-)

Comments

Mika Westerberg April 9, 2021, 9:33 a.m. UTC | #1
On Mon, Mar 29, 2021 at 10:41:47AM +0300, Mika Westerberg wrote:
> Hello there,

> 

> There has been ask if we can expose more details about the connected

> devices and the tunneling to userspace, so it can then provide more

> detailed information to the user.

> 

> First we add uevent details for each device (USB4 router) that adds

> USB4_TYPE=host|device|hub and USB4_VERSION=1.0 (if the device actually is

> USB4). The host|device|hub definitions follow the USB4 spec.

> 

> Then for each device router we expose two new attributes: "usb3" and "dp"

> that if present mean that the device has corresponding adapter (USB 3.x

> upstream adapter and DP OUT adapter). The contents of the attributes then

> hold number of tunnels ending to this router. So if USB 3.x is tunneled

> "usb3" reads 1. Since there can be multiple DP OUT adaptes the "dp"

> attribute holds number of DP tunnels ending to this router. For PCIe

> tunneling the "authorized" attribute works the same way.

> 

> Previous versions can be found:

> 

>   v2: https://lore.kernel.org/linux-usb/20210323145701.86161-1-mika.westerberg@linux.intel.com/

>   v1: https://lore.kernel.org/linux-usb/20210309134818.63118-1-mika.westerberg@linux.intel.com/

> 

> Changes from v2:

> 

>   * Added missing sysfs_emit()

> 

> Changes from v1:

> 

>   * Added Greg's Reviewed-by tags for patch 1 and 2

>   * Use sysfs_emit()

>   * Drop the locking in the new attributes

>   * Drop the kobject_uevent()

> 

> Mika Westerberg (3):

>   thunderbolt: Add details to router uevent

>   thunderbolt: Hide authorized attribute if router does not support PCIe tunnels

>   thunderbolt: Expose more details about USB 3.x and DisplayPort tunnels


Applied the first two patches to thunderbolt.git/next. I'm dropping the
last one for now. We can revisit it later if really needed.