Re: [RFC PATCH 20/22] thunderbolt: Add support for USB tunnels
From: Mika Westerberg
Date: Thu Oct 03 2019 - 04:52:29 EST
On Thu, Oct 03, 2019 at 10:42:56AM +0200, Oliver Neukum wrote:
> Am Dienstag, den 01.10.2019, 14:38 +0300 schrieb Mika Westerberg:
> > From: Rajmohan Mani <rajmohan.mani@xxxxxxxxx>
> >
> > USB4 added a capability to tunnel USB 3.x protocol over the USB4
> > fabric. USB4 device routers may include integrated SuperSpeed HUB or a
> > function or both. USB tunneling follows PCIe so that the tunnel is
> > created between the parent and the child router from USB downstream
> > adapter port to USB upstream adapter port over a single USB4 link.
> >
> > This adds support for USB tunneling and also capability to discover
> > existing USB tunnels (for example created by connection manager in boot
> > firmware).
> >
> > Signed-off-by: Rajmohan Mani <rajmohan.mani@xxxxxxxxx>
> > Co-developed-by: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>
> > Signed-off-by: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>
> > ---
> > drivers/thunderbolt/switch.c | 35 ++++++++
> > drivers/thunderbolt/tb.c | 153 ++++++++++++++++++++++++++------
> > drivers/thunderbolt/tb.h | 15 ++++
> > drivers/thunderbolt/tb_regs.h | 9 +-
> > drivers/thunderbolt/tunnel.c | 158 +++++++++++++++++++++++++++++++++-
> > drivers/thunderbolt/tunnel.h | 9 ++
> > drivers/thunderbolt/usb4.c | 41 ++++++++-
> > 7 files changed, 393 insertions(+), 27 deletions(-)
> >
> > diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
> > index 58e3f54ddbb9..5a3236fefb76 100644
> > --- a/drivers/thunderbolt/switch.c
> > +++ b/drivers/thunderbolt/switch.c
> > @@ -1025,11 +1025,46 @@ bool tb_port_is_enabled(struct tb_port *port)
> > case TB_TYPE_DP_HDMI_OUT:
> > return tb_dp_port_is_enabled(port);
> >
> > + case TB_TYPE_USB_UP:
> > + case TB_TYPE_USB_DOWN:
> > + return tb_usb_port_is_enabled(port);
> > +
> > default:
> > return false;
> > }
> > }
> >
> > +/**
> > + * tb_usb_port_is_enabled() - Is the USB adapter port enabled
> > + * @port: USB port to check
> > + */
> > +bool tb_usb_port_is_enabled(struct tb_port *port)
>
> Should these functions be called tb_usb3_port... ?
> This looks like all USB would need this.
Yes, I agree it follows the spec better that way.
> > -static const char * const tb_tunnel_names[] = { "PCI", "DP", "DMA" };
> > +static const char * const tb_tunnel_names[] = { "PCI", "DP", "DMA", "USB"};
>
> USB3 ?
Sure.