Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c4b3630a authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'Thunderbolt-networking'

Mika Westerberg says:

====================
Thunderbolt networking

In addition of tunneling PCIe, Display Port and USB traffic, Thunderbolt
allows connecting two hosts (domains) over a Thunderbolt cable. It is
possible to tunnel arbitrary data packets over such connection using
high-speed DMA rings available in the Thunderbolt host controller.

In order to discover Thunderbolt services the other host supports, there is
a software protocol running on top of the automatically configured control
channel (ring 0). This protocol is called XDomain discovery protocol and it
uses XDomain properties to describe the host (domain) and the services it
supports.

Once both sides have agreed what services are supported they can enable
high-speed DMA rings to transfer data over the cable.

This series adds support for the XDomain protocol so that we expose each
remote connection as Thunderbolt XDomain device and each service as
Thunderbolt service device. On top of that we create an API that allows
writing drivers for these services and finally we provide an example
Thunderbolt service driver that creates virtual ethernet inferface that
allows tunneling networking packets over Thunderbolt cable. The API could
be used for creating other future Thunderbolt services, such as tunneling
SCSI over Thunderbolt, for example.

The XDomain protocol and networking support is also available in macOS and
Windows so this makes it possible to connect Linux to macOS and Windows as
well.

The patches are based on previous Thunderbolt networking patch series by
Amir Levy and Michael Jamet, that can be found here:

  https://lwn.net/Articles/705998/

The main difference to that patch series is that we have the XDomain
protocol running in the kernel now so there is no need for a separate
userspace daemon.

Note this does not affect the existing functionality, so security levels
and NVM firmware upgrade continue to work as before (with the small
exception that now sysfs also shows the XDomain connections and services in
addition to normal Thunderbolt devices). It is also possible to connect up
to 5 Thunderbolt devices and then another host, and the network driver
works exactly the same.

This is third version of the patch series. The previous versions can be
be found here:

  v2: https://lkml.org/lkml/2017/9/25/225
  v1: https://lwn.net/Articles/734019/



Changes from the v2:

  * Add comment regarding calculation of interrupt throttling value
  * Add UUIDs as strings in comments on top of each declaration
  * Add a patch removing __packed from existing ICM messages. They are all
    32-bit aligned and should pack fine without the __packed.
  * Move adding MAINTAINERS entries to a separate patches
  * Added Michael and Yehezkel to be maintainers of the network driver
  * Remove __packed from the new ICM messages. They should pack fine as
    well without it.
  * Call register_netdev() after all other initialization is done in the
    network driver.
  * Use build_skb() instead of copying. We allocate order 1 page here to
    leave room for SKB shared info required by build_skb(). However, we do
    not leave room for full NET_SKB_PAD because the NHI hardware does not
    cope well if a frame crosses 4kB boundary. According comments in
    __build_skb() that should still be fine.
  * Added Reviewed-by tag from Andy.

Changes from the v1:

  * Add include/linux/thunderbolt.h to MAINTAINERS
  * Correct Linux version and date of new sysfs entries in
    Documentation/ABI/testing/sysfs-bus-thunderbolt
  * Move network driver from drivers/thunderbolt/net.c to
    drivers/net/thunderbolt.c and update it to follow coding style in
    drivers/net/*.
  * Add MAINTAINERS entry for the network driver
  * Minor cleanups

In case someone wants to try this out, the last patch adds documentation
how the networking driver can be used. In short, if you connect Linux to a
macOS or Windows, everything is done automatically (as those systems have
the networking service enabled by default). For Linux to Linux connection
one host needs to load the networking driver first (so that the other side
can locate the networking service and load the corresponding driver).
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 1dd236fd c024297e
Loading
Loading
Loading
Loading
+48 −0
Original line number Diff line number Diff line
@@ -110,3 +110,51 @@ Description: When new NVM image is written to the non-active NVM
		is directly the status value from the DMA configuration
		based mailbox before the device is power cycled. Writing
		0 here clears the status.

What:		/sys/bus/thunderbolt/devices/<xdomain>.<service>/key
Date:		Jan 2018
KernelVersion:	4.15
Contact:	thunderbolt-software@lists.01.org
Description:	This contains name of the property directory the XDomain
		service exposes. This entry describes the protocol in
		question. Following directories are already reserved by
		the Apple XDomain specification:

		network:  IP/ethernet over Thunderbolt
		targetdm: Target disk mode protocol over Thunderbolt
		extdisp:  External display mode protocol over Thunderbolt

What:		/sys/bus/thunderbolt/devices/<xdomain>.<service>/modalias
Date:		Jan 2018
KernelVersion:	4.15
Contact:	thunderbolt-software@lists.01.org
Description:	Stores the same MODALIAS value emitted by uevent for
		the XDomain service. Format: tbtsvc:kSpNvNrN

What:		/sys/bus/thunderbolt/devices/<xdomain>.<service>/prtcid
Date:		Jan 2018
KernelVersion:	4.15
Contact:	thunderbolt-software@lists.01.org
Description:	This contains XDomain protocol identifier the XDomain
		service supports.

What:		/sys/bus/thunderbolt/devices/<xdomain>.<service>/prtcvers
Date:		Jan 2018
KernelVersion:	4.15
Contact:	thunderbolt-software@lists.01.org
Description:	This contains XDomain protocol version the XDomain
		service supports.

What:		/sys/bus/thunderbolt/devices/<xdomain>.<service>/prtcrevs
Date:		Jan 2018
KernelVersion:	4.15
Contact:	thunderbolt-software@lists.01.org
Description:	This contains XDomain software version the XDomain
		service supports.

What:		/sys/bus/thunderbolt/devices/<xdomain>.<service>/prtcstns
Date:		Jan 2018
KernelVersion:	4.15
Contact:	thunderbolt-software@lists.01.org
Description:	This contains XDomain service specific settings as
		bitmask. Format: %x
+24 −0
Original line number Diff line number Diff line
@@ -197,3 +197,27 @@ information is missing.

To recover from this mode, one needs to flash a valid NVM image to the
host host controller in the same way it is done in the previous chapter.

Networking over Thunderbolt cable
---------------------------------
Thunderbolt technology allows software communication across two hosts
connected by a Thunderbolt cable.

It is possible to tunnel any kind of traffic over Thunderbolt link but
currently we only support Apple ThunderboltIP protocol.

If the other host is running Windows or macOS only thing you need to
do is to connect Thunderbolt cable between the two hosts, the
``thunderbolt-net`` is loaded automatically. If the other host is also
Linux you should load ``thunderbolt-net`` manually on one host (it does
not matter which one)::

  # modprobe thunderbolt-net

This triggers module load on the other host automatically. If the driver
is built-in to the kernel image, there is no need to do anything.

The driver will create one virtual ethernet interface per Thunderbolt
port which are named like ``thunderbolt0`` and so on. From this point
you can either use standard userspace tools like ``ifconfig`` to
configure the interface or let your GUI to handle it automatically.
+9 −0
Original line number Diff line number Diff line
@@ -13278,6 +13278,15 @@ M: Mika Westerberg <mika.westerberg@linux.intel.com>
M:	Yehezkel Bernat <yehezkel.bernat@intel.com>
S:	Maintained
F:	drivers/thunderbolt/
F:	include/linux/thunderbolt.h

THUNDERBOLT NETWORK DRIVER
M:	Michael Jamet <michael.jamet@intel.com>
M:	Mika Westerberg <mika.westerberg@linux.intel.com>
M:	Yehezkel Bernat <yehezkel.bernat@intel.com>
L:	netdev@vger.kernel.org
S:	Maintained
F:	drivers/net/thunderbolt.c

THUNDERX GPIO DRIVER
M:	David Daney <david.daney@cavium.com>
+12 −0
Original line number Diff line number Diff line
@@ -483,6 +483,18 @@ config FUJITSU_ES
	  This driver provides support for Extended Socket network device
          on Extended Partitioning of FUJITSU PRIMEQUEST 2000 E2 series.

config THUNDERBOLT_NET
	tristate "Networking over Thunderbolt cable"
	depends on THUNDERBOLT && INET
	help
	  Select this if you want to create network between two
	  computers over a Thunderbolt cable. The driver supports Apple
	  ThunderboltIP protocol and allows communication with any host
	  supporting the same protocol including Windows and macOS.

	  To compile this driver a module, choose M here. The module will be
	  called thunderbolt-net.

source "drivers/net/hyperv/Kconfig"

endif # NETDEVICES
+3 −0
Original line number Diff line number Diff line
@@ -74,3 +74,6 @@ obj-$(CONFIG_HYPERV_NET) += hyperv/
obj-$(CONFIG_NTB_NETDEV) += ntb_netdev.o

obj-$(CONFIG_FUJITSU_ES) += fjes/

thunderbolt-net-y += thunderbolt.o
obj-$(CONFIG_THUNDERBOLT_NET) += thunderbolt-net.o
Loading