Commit graph

4 commits

Author SHA1 Message Date
Mika Westerberg
180b068942 thunderbolt: Allow multiple DMA tunnels over a single XDomain connection
Currently we have had an artificial limitation of a single DMA tunnel
per XDomain connection. However, hardware wise there is no such limit
and software based connection manager can take advantage of all the DMA
rings available on the host to establish tunnels.

For this reason make the tb_xdomain_[enable|disable]_paths() to take the
DMA ring and HopID as parameter instead of storing them in the struct
tb_xdomain. We also add API functions to allocate input and output
HopIDs of the XDomain connection that the service drivers can use
instead of hard-coding.

Also convert the two existing service drivers over to this API.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2021-03-18 18:25:31 +03:00
Mika Westerberg
8b0ab503c0 thunderbolt: dma_test: Drop unnecessary include
It seems <linux/acpi.h> is not actually needed in this driver so we can
drop it.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2021-02-04 10:39:13 +03:00
Tian Tao
82096ecf58 thunderbolt: Use kmemdup instead of kzalloc and memcpy
Fixes coccicheck warning:
drivers/thunderbolt/dma_test.c:302:13-20: WARNING opportunity for kmemdup.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2020-12-28 12:41:53 +03:00
Isaac Hazan
edc0f494ed thunderbolt: Add DMA traffic test driver
This driver allows sending DMA traffic over XDomain connection.
Specifically over a loopback connection using either a Thunderbolt/USB4
cable that is connected back to the host router port, or a special
loopback dongle that has RX and TX lines crossed. This can be useful at
manufacturing floor to check whether Thunderbolt/USB4 ports are
functional.

The driver exposes debugfs directory under the XDomain service that can
be used to configure the driver, start the test and check the results.

If a loopback dongle is used the steps to send and receive 1000 packets
can be done like:

  # modprobe thunderbolt_dma_test
  # echo 1000 > /sys/kernel/debug/thunderbolt/<service_id>/dma_test/packets_to_receive
  # echo 1000 > /sys/kernel/debug/thunderbolt/<service_id>/dma_test/packets_to_send
  # echo 1 > /sys/kernel/debug/thunderbolt/<service_id>/dma_test/test
  # cat /sys/kernel/debug/thunderbolt/<service_id>/dma_test/status

When a cable is connected back to host then there are two Thunderbolt
services, one is configured for receiving (does not matter which one):

  # modprobe thunderbolt_dma_test
  # echo 1000 > /sys/kernel/debug/thunderbolt/<service_a>/dma_test/packets_to_receive
  # echo 1 > /sys/kernel/debug/thunderbolt/<service_a>/dma_test/test

The other one for sending:

  # echo 1000 > /sys/kernel/debug/thunderbolt/<service_b>/dma_test/packets_to_send
  # echo 1 > /sys/kernel/debug/thunderbolt/<service_b>/dma_test/test

Results can be read from both services status attributes.

Signed-off-by: Isaac Hazan <isaac.hazan@intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Yehezkel Bernat <YehezkelShB@gmail.com>
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-11-11 10:20:16 +03:00