Skip to contentSkip to conversation

thunderbolt: Introducing Thunderbolt(TM) networking

PATCH Superseded Amir Levy 2 participants 12 messages Jun 29, 2016 – Jul 13, 2016

Subsystems (5)

v2 of 9 Superseded Latest is v9 →

lore
Share & tools
lore

Amir Levy

author
#0 lore raw

v2 cover thunderbolt: Introducing Thunderbolt(TM) networking

This is version 2 of Thunderbolt(TM) driver for non-Apple hardware.

Changes since v1:
- Separation to 2 modules.
- Moved ICM specific registers definition to ICM header file.
- Added new Thunderbolt device IDs.
- Renamed the Thunderbolt networking documentation.
- General cleanups

These patches were pushed to GitHub where they can be reviewed more comfortably with green/red highlighting:
https://github.com/01org/thunderbolt-software-kernel-tree

Daemon code:
https://github.com/01org/thunderbolt-software-daemon

For reference, here's a link to version 1:
[v1]: http://www.spinics.net/lists/linux-pci/msg51287.html

Amir Levy (8):
thunderbolt: Macro rename
thunderbolt: Updating device IDs
thunderbolt: Updating the register definitions
thunderbolt: Kconfig for Thunderbolt(TM) networking
thunderbolt: Communication with the ICM (firmware)
thunderbolt: Networking state machine
thunderbolt: Networking transmit and receive
thunderbolt: Networking doc

 Documentation/00-INDEX                   |    2 +
 Documentation/thunderbolt-networking.txt |  135 ++
 drivers/thunderbolt/Kconfig              |   25 +-
 drivers/thunderbolt/Makefile             |    4 +-
 drivers/thunderbolt/icm_nhi.c            | 1631 +++++++++++++++++++++
 drivers/thunderbolt/icm_nhi.h            |   84 ++
 drivers/thunderbolt/net.c                | 2277 ++++++++++++++++++++++++++++++
 drivers/thunderbolt/net.h                |  274 ++++
 drivers/thunderbolt/nhi_regs.h           |  115 +-
 include/linux/pci_ids.h                  |   44 +-
 10 files changed, 4565 insertions(+), 26 deletions(-)
 create mode 100644 Documentation/thunderbolt-networking.txt
 create mode 100644 drivers/thunderbolt/icm_nhi.c
 create mode 100644 drivers/thunderbolt/icm_nhi.h
 create mode 100644 drivers/thunderbolt/net.c
 create mode 100644 drivers/thunderbolt/net.h
Signature · 1 line
2.7.4
author
#1 lore raw

PATCH v2 1/8 thunderbolt: Macro rename

This first patch updates the registers file to
reflect that it isn't only for Cactus Ridge.
No functional change intended.

---
 drivers/thunderbolt/nhi_regs.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/thunderbolt/nhi_regs.h +3 -3
index 86b996c..75cf069 100644
@@ -1,11 +1,11 @@
 /*
- * Thunderbolt Cactus Ridge driver - NHI registers
+ * Thunderbolt driver - NHI registers
  *
  * Copyright (c) 2014 Andreas Noever <[email protected]>
  */
 
-#ifndef DSL3510_REGS_H_
-#define DSL3510_REGS_H_
+#ifndef NHI_REGS_H_
+#define NHI_REGS_H_
 
 #include <linux/types.h>
 
Signature · 1 line
2.7.4
author
#2 lore raw

PATCH v2 2/8 thunderbolt: Updating device IDs

In reply to Amir Levy

Adding the new Thunderbolt(TM) device IDs to the list.

---
 include/linux/pci_ids.h | 44 ++++++++++++++++++++++++++------------------
 1 file changed, 26 insertions(+), 18 deletions(-)
include/linux/pci_ids.h +26 -18
index c58752f..2d4cc50 100644
@@ -2604,24 +2604,32 @@
 #define PCI_DEVICE_ID_INTEL_82441	0x1237
 #define PCI_DEVICE_ID_INTEL_82380FB	0x124b
 #define PCI_DEVICE_ID_INTEL_82439	0x1250
-#define PCI_DEVICE_ID_INTEL_LIGHT_RIDGE             0x1513 /* Tbt 1 Gen 1 */
-#define PCI_DEVICE_ID_INTEL_EAGLE_RIDGE             0x151a
-#define PCI_DEVICE_ID_INTEL_LIGHT_PEAK              0x151b
-#define PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_4C         0x1547 /* Tbt 1 Gen 2 */
-#define PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_2C         0x1548
-#define PCI_DEVICE_ID_INTEL_PORT_RIDGE              0x1549
-#define PCI_DEVICE_ID_INTEL_REDWOOD_RIDGE_2C_NHI    0x1566 /* Tbt 1 Gen 3 */
-#define PCI_DEVICE_ID_INTEL_REDWOOD_RIDGE_2C_BRIDGE 0x1567
-#define PCI_DEVICE_ID_INTEL_REDWOOD_RIDGE_4C_NHI    0x1568
-#define PCI_DEVICE_ID_INTEL_REDWOOD_RIDGE_4C_BRIDGE 0x1569
-#define PCI_DEVICE_ID_INTEL_FALCON_RIDGE_2C_NHI     0x156a /* Thunderbolt 2 */
-#define PCI_DEVICE_ID_INTEL_FALCON_RIDGE_2C_BRIDGE  0x156b
-#define PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_NHI     0x156c
-#define PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_BRIDGE  0x156d
-#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_2C_NHI     0x1575 /* Thunderbolt 3 */
-#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_2C_BRIDGE  0x1576
-#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_4C_NHI     0x1577
-#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_4C_BRIDGE  0x1578
+#define PCI_DEVICE_ID_INTEL_LIGHT_RIDGE              0x1513 /* Tbt 1 Gen 1 */
+#define PCI_DEVICE_ID_INTEL_EAGLE_RIDGE              0x151a
+#define PCI_DEVICE_ID_INTEL_LIGHT_PEAK               0x151b
+#define PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_4C          0x1547 /* Tbt 1 Gen 2 */
+#define PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_2C          0x1548
+#define PCI_DEVICE_ID_INTEL_PORT_RIDGE               0x1549
+#define PCI_DEVICE_ID_INTEL_REDWOOD_RIDGE_2C_NHI     0x1566 /* Tbt 1 Gen 3 */
+#define PCI_DEVICE_ID_INTEL_REDWOOD_RIDGE_2C_BRIDGE  0x1567
+#define PCI_DEVICE_ID_INTEL_REDWOOD_RIDGE_4C_NHI     0x1568
+#define PCI_DEVICE_ID_INTEL_REDWOOD_RIDGE_4C_BRIDGE  0x1569
+#define PCI_DEVICE_ID_INTEL_FALCON_RIDGE_2C_NHI      0x156a /* Thunderbolt 2 */
+#define PCI_DEVICE_ID_INTEL_FALCON_RIDGE_2C_BRIDGE   0x156b
+#define PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_NHI      0x156c
+#define PCI_DEVICE_ID_INTEL_FALCON_RIDGE_4C_BRIDGE   0x156d
+#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_2C_NHI      0x1575 /* Thunderbolt 3 */
+#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_2C_BRIDGE   0x1576
+#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_4C_NHI      0x1577
+#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_4C_BRIDGE   0x1578
+#define PCI_DEVICE_ID_INTEL_WIN_RIDGE_2C_NHI         0x157d /* Tbt 2 Low Pwr */
+#define PCI_DEVICE_ID_INTEL_WIN_RIDGE_2C_BRIDGE      0x157e
+#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_LP_NHI      0x15bf /* Tbt 3 Low Pwr */
+#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_LP_BRIDGE   0x15c0
+#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_4C_NHI    0x15d2 /* Thunderbolt 3 */
+#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_4C_BRIDGE 0x15d3
+#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_2C_NHI    0x15d9
+#define PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_2C_BRIDGE 0x15da
 #define PCI_DEVICE_ID_INTEL_80960_RP	0x1960
 #define PCI_DEVICE_ID_INTEL_82840_HB	0x1a21
 #define PCI_DEVICE_ID_INTEL_82845_HB	0x1a30
Signature · 1 line
2.7.4
author
#3 lore raw

PATCH v2 3/8 thunderbolt: Updating the register definitions

In reply to Amir Levy

Adding more Thunderbolt(TM) register definitions
and some helper macros.

---
 drivers/thunderbolt/nhi_regs.h | 109 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 109 insertions(+)
drivers/thunderbolt/nhi_regs.h +109 -0
index 75cf069..b8e961f 100644
@@ -9,6 +9,11 @@
 
 #include <linux/types.h>
 
+#define NHI_MMIO_BAR 0
+
+#define TBT_RING_MIN_NUM_BUFFERS	2
+#define TBT_RING_MAX_FRAME_SIZE		(4 * 1024)
+
 enum ring_flags {
 	RING_FLAG_ISOCH_ENABLE = 1 << 27, /* TX only? */
 	RING_FLAG_E2E_FLOW_CONTROL = 1 << 28,
@@ -39,6 +44,33 @@ struct ring_desc {
 	u32 time; /* write zero */
 } __packed;
 
+/**
+ * struct tbt_buf_desc - TX/RX ring buffer descriptor.
+ * This is same as struct ring_desc, but without the use of bitfields and
+ * with explicit endianity.
+ */
+struct tbt_buf_desc {
+	__le64 phys;
+	__le32 attributes;
+	__le32 time;
+};
+
+#define DESC_ATTR_LEN_SHIFT		0
+#define DESC_ATTR_LEN_MASK		GENMASK(11, DESC_ATTR_LEN_SHIFT)
+#define DESC_ATTR_EOF_SHIFT		12
+#define DESC_ATTR_EOF_MASK		GENMASK(15, DESC_ATTR_EOF_SHIFT)
+#define DESC_ATTR_SOF_SHIFT		16
+#define DESC_ATTR_SOF_MASK		GENMASK(19, DESC_ATTR_SOF_SHIFT)
+#define DESC_ATTR_TX_ISOCH_DMA_EN	BIT(20)	/* TX */
+#define DESC_ATTR_RX_CRC_ERR		BIT(20)	/* RX after use */
+#define DESC_ATTR_DESC_DONE		BIT(21)
+#define DESC_ATTR_REQ_STS		BIT(22)	/* TX and RX before use */
+#define DESC_ATTR_RX_BUF_OVRN_ERR	BIT(22)	/* RX after use */
+#define DESC_ATTR_INT_EN		BIT(23)
+#define DESC_ATTR_OFFSET_SHIFT		24
+#define DESC_ATTR_OFFSET_MASK		GENMASK(31, DESC_ATTR_OFFSET_SHIFT)
+
+
 /* NHI registers in bar 0 */
 
 /*
@@ -60,6 +92,30 @@ struct ring_desc {
  */
 #define REG_RX_RING_BASE	0x08000
 
+#define REG_RING_STEP			16
+#define REG_RING_PHYS_LO_OFFSET		0
+#define REG_RING_PHYS_HI_OFFSET		4
+#define REG_RING_CONS_PROD_OFFSET	8	/* cons - RO, prod - RW */
+#define REG_RING_CONS_SHIFT		0
+#define REG_RING_CONS_MASK		GENMASK(15, REG_RING_CONS_SHIFT)
+#define REG_RING_PROD_SHIFT		16
+#define REG_RING_PROD_MASK		GENMASK(31, REG_RING_PROD_SHIFT)
+#define REG_RING_SIZE_OFFSET		12
+#define REG_RING_SIZE_SHIFT		0
+#define REG_RING_SIZE_MASK		GENMASK(15, REG_RING_SIZE_SHIFT)
+#define REG_RING_BUF_SIZE_SHIFT		16
+#define REG_RING_BUF_SIZE_MASK		GENMASK(27, REG_RING_BUF_SIZE_SHIFT)
+
+#define TBT_RING_CONS_PROD_REG(iobase, ringbase, ringnumber) \
+			      ((iobase) + (ringbase) + \
+			      ((ringnumber) * REG_RING_STEP) + \
+			      REG_RING_CONS_PROD_OFFSET)
+
+#define TBT_REG_RING_PROD_EXTRACT(val) (((val) & REG_RING_PROD_MASK) >> \
+				       REG_RING_PROD_SHIFT)
+
+#define TBT_REG_RING_CONS_EXTRACT(val) (((val) & REG_RING_CONS_MASK) >> \
+				       REG_RING_CONS_SHIFT)
 /*
  * 32 bytes per entry, one entry for every hop (REG_HOP_COUNT)
  * 00: enum_ring_flags
@@ -77,6 +133,19 @@ struct ring_desc {
  * ..: unknown
  */
 #define REG_RX_OPTIONS_BASE	0x29800
+#define REG_RX_OPTS_TX_E2E_HOP_ID_SHIFT	12
+#define REG_RX_OPTS_TX_E2E_HOP_ID_MASK	\
+				GENMASK(22, REG_RX_OPTS_TX_E2E_HOP_ID_SHIFT)
+#define REG_RX_OPTS_MASK_OFFSET		4
+#define REG_RX_OPTS_MASK_EOF_SHIFT	0
+#define REG_RX_OPTS_MASK_EOF_MASK	GENMASK(15, REG_RX_OPTS_MASK_EOF_SHIFT)
+#define REG_RX_OPTS_MASK_SOF_SHIFT	16
+#define REG_RX_OPTS_MASK_SOF_MASK	GENMASK(31, REG_RX_OPTS_MASK_SOF_SHIFT)
+
+#define REG_OPTS_STEP			32
+#define REG_OPTS_E2E_EN			BIT(28)
+#define REG_OPTS_RAW			BIT(30)
+#define REG_OPTS_VALID			BIT(31)
 
 /*
  * three bitfields: tx, rx, rx overflow
@@ -86,6 +155,7 @@ struct ring_desc {
  */
 #define REG_RING_NOTIFY_BASE	0x37800
 #define RING_NOTIFY_REG_COUNT(nhi) ((31 + 3 * nhi->hop_count) / 32)
+#define REG_RING_NOTIFY_STEP	4
 
 /*
  * two bitfields: rx, tx
@@ -94,8 +164,47 @@ struct ring_desc {
  */
 #define REG_RING_INTERRUPT_BASE	0x38200
 #define RING_INTERRUPT_REG_COUNT(nhi) ((31 + 2 * nhi->hop_count) / 32)
+#define REG_RING_INT_TX_PROCESSED(ring_num)		BIT(ring_num)
+#define REG_RING_INT_RX_PROCESSED(ring_num, num_paths)	BIT((ring_num) + \
+							    (num_paths))
+#define RING_INT_DISABLE(base, val) iowrite32( \
+			ioread32((base) + REG_RING_INTERRUPT_BASE) & ~(val), \
+			(base) + REG_RING_INTERRUPT_BASE)
+#define RING_INT_ENABLE(base, val) iowrite32( \
+			ioread32((base) + REG_RING_INTERRUPT_BASE) | (val), \
+			(base) + REG_RING_INTERRUPT_BASE)
+#define RING_INT_DISABLE_TX(base, ring_num) \
+	RING_INT_DISABLE(base, REG_RING_INT_TX_PROCESSED(ring_num))
+#define RING_INT_DISABLE_RX(base, ring_num, num_paths) \
+	RING_INT_DISABLE(base, REG_RING_INT_RX_PROCESSED(ring_num, num_paths))
+#define RING_INT_ENABLE_TX(base, ring_num) \
+	RING_INT_ENABLE(base, REG_RING_INT_TX_PROCESSED(ring_num))
+#define RING_INT_ENABLE_RX(base, ring_num, num_paths) \
+	RING_INT_ENABLE(base, REG_RING_INT_RX_PROCESSED(ring_num, num_paths))
+#define RING_INT_DISABLE_TX_RX(base, ring_num, num_paths) \
+	RING_INT_DISABLE(base, REG_RING_INT_TX_PROCESSED(ring_num) | \
+			       REG_RING_INT_RX_PROCESSED(ring_num, num_paths))
+
+#define REG_RING_INTERRUPT_STEP	4
+
+#define REG_INT_THROTTLING_RATE	0x38c00
+#define REG_INT_THROTTLING_RATE_STEP	4
+#define NUM_INT_VECTORS			16
+
+#define REG_INT_VEC_ALLOC_BASE	0x38c40
+#define REG_INT_VEC_ALLOC_STEP		4
+#define REG_INT_VEC_ALLOC_FIELD_BITS	4
+#define REG_INT_VEC_ALLOC_FIELD_MASK	(BIT(REG_INT_VEC_ALLOC_FIELD_BITS) - 1)
+#define REG_INT_VEC_ALLOC_PER_REG	((BITS_PER_BYTE * sizeof(u32)) / \
+					 REG_INT_VEC_ALLOC_FIELD_BITS)
 
 /* The last 11 bits contain the number of hops supported by the NHI port. */
 #define REG_HOP_COUNT		0x39640
+#define REG_HOP_COUNT_TOTAL_PATHS_MASK	GENMASK(10, 0)
+
+#define REG_HOST_INTERFACE_RST	0x39858
+
+#define REG_DMA_MISC		0x39864
+#define REG_DMA_MISC_INT_AUTO_CLEAR	BIT(2)
 
 #endif
Signature · 1 line
2.7.4
author
#4 lore raw

PATCH v2 4/8 thunderbolt: Kconfig for Thunderbolt(TM) networking

In reply to Amir Levy

Updating the Kconfig Thunderbolt(TM) description.

---
 drivers/thunderbolt/Kconfig  | 25 +++++++++++++++++++++----
 drivers/thunderbolt/Makefile |  2 +-
 2 files changed, 22 insertions(+), 5 deletions(-)
drivers/thunderbolt/Kconfig +21 -4
index c121acc..d34b0f5 100644
@@ -1,13 +1,30 @@
-menuconfig THUNDERBOLT
-	tristate "Thunderbolt support for Apple devices"
+config THUNDERBOLT
+	tristate "Thunderbolt(TM) support"
 	depends on PCI
 	select CRC32
 	help
-	  Cactus Ridge Thunderbolt Controller driver
+	  Thunderbolt(TM) Controller driver
+
+if THUNDERBOLT
+
+config THUNDERBOLT_APPLE
+	tristate "Apple hardware support"
+	help
 	  This driver is required if you want to hotplug Thunderbolt devices on
 	  Apple hardware.
 
 	  Device chaining is currently not supported.
 
-	  To compile this driver a module, choose M here. The module will be
+	  To compile this driver as a module, choose M here. The module will be
 	  called thunderbolt.
+
+config THUNDERBOLT_ICM
+	tristate "Thunderbolt(TM) Networking"
+	help
+	  This driver is required if you want Thunderbolt(TM) Networking on
+	  non-Apple hardware.
+
+	  To compile this driver as a module, choose M here. The module will be
+	  called thunderbolt_icm.
+
+endif
drivers/thunderbolt/Makefile +1 -1
index 5d1053c..7a85bd1 100644
@@ -1,3 +1,3 @@
-obj-${CONFIG_THUNDERBOLT} := thunderbolt.o
+obj-${CONFIG_THUNDERBOLT_APPLE} := thunderbolt.o
 thunderbolt-objs := nhi.o ctl.o tb.o switch.o cap.o path.o tunnel_pci.o eeprom.o
 
Signature · 1 line
2.7.4
author
#5 lore raw

PATCH v2 5/8 thunderbolt: Communication with the ICM (firmware)

In reply to Amir Levy

Firmware-based (a.k.a ICM - Intel Connection Manager) controller is used for establishing and maintaining the Thunderbolt Networking connection. We need to be able to communicate with it.

---
 drivers/thunderbolt/Makefile  |    2 +
 drivers/thunderbolt/icm_nhi.c | 1332 +++++++++++++++++++++++++++++++++++++++++
 drivers/thunderbolt/icm_nhi.h |   84 +++
 drivers/thunderbolt/net.h     |  200 +++++++
 4 files changed, 1618 insertions(+)
 create mode 100644 drivers/thunderbolt/icm_nhi.c
 create mode 100644 drivers/thunderbolt/icm_nhi.h
 create mode 100644 drivers/thunderbolt/net.h
drivers/thunderbolt/Makefile +2 -0
index 7a85bd1..cc91d9a 100644
@@ -1,3 +1,5 @@
 obj-${CONFIG_THUNDERBOLT_APPLE} := thunderbolt.o
 thunderbolt-objs := nhi.o ctl.o tb.o switch.o cap.o path.o tunnel_pci.o eeprom.o
 
+obj-${CONFIG_THUNDERBOLT_ICM} += thunderbolt-icm.o
+thunderbolt-icm-objs := icm_nhi.o
drivers/thunderbolt/icm_nhi.c new file +1332 -0

1,332 lines not on this page · raw message

drivers/thunderbolt/icm_nhi.h new file +84 -0

84 lines not on this page · raw message

drivers/thunderbolt/net.h new file +200 -0

200 lines not on this page · raw message

Signature · 1 line
2.7.4
author
#6 lore raw

PATCH v2 6/8 thunderbolt: Networking state machine

In reply to Amir Levy

Negotiation states that a peer goes through in order to establish the communication with the second peer.
This includes communication with upper layer and additional infrastructure support to communicate with the second peer through ICM.

---
 drivers/thunderbolt/Makefile  |   2 +-
 drivers/thunderbolt/icm_nhi.c | 304 +++++++++++++++-
 drivers/thunderbolt/net.c     | 802 ++++++++++++++++++++++++++++++++++++++++++
 drivers/thunderbolt/net.h     |  74 ++++
 4 files changed, 1171 insertions(+), 11 deletions(-)
 create mode 100644 drivers/thunderbolt/net.c
drivers/thunderbolt/Makefile +1 -1
index cc91d9a..50c1c8b 100644
@@ -2,4 +2,4 @@ obj-${CONFIG_THUNDERBOLT_APPLE} := thunderbolt.o
 thunderbolt-objs := nhi.o ctl.o tb.o switch.o cap.o path.o tunnel_pci.o eeprom.o
 
 obj-${CONFIG_THUNDERBOLT_ICM} += thunderbolt-icm.o
-thunderbolt-icm-objs := icm_nhi.o
+thunderbolt-icm-objs := icm_nhi.o net.o
drivers/thunderbolt/icm_nhi.c +294 -10

364 lines not on this page · raw message

drivers/thunderbolt/net.c new file +802 -0

802 lines not on this page · raw message

drivers/thunderbolt/net.h +74 -0

109 lines not on this page · raw message

Signature · 1 line
2.7.4
author
#7 lore raw

PATCH v2 7/8 thunderbolt: Networking transmit and receive

In reply to Amir Levy

Handling the transmission to second peer and receiving from it. This includes communication with upper layer, the network stack and configuration of Thunderbolt(TM) HW.

---
 drivers/thunderbolt/icm_nhi.c |   15 +
 drivers/thunderbolt/net.c     | 1475 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 1490 insertions(+)
drivers/thunderbolt/icm_nhi.c +15 -0
index 060bb38..f8b0527 100644
@@ -1045,6 +1045,7 @@ static irqreturn_t nhi_msi(int __always_unused irq, void *data)
 {
 	struct tbt_nhi_ctxt *nhi_ctxt = data;
 	u32 isr0, isr1, imr0, imr1;
+	int i;
 
 	/* clear on read */
 	isr0 = ioread32(nhi_ctxt->iobase + REG_RING_NOTIFY_BASE);
@@ -1067,6 +1068,20 @@ static irqreturn_t nhi_msi(int __always_unused irq, void *data)
 
 	spin_unlock(&nhi_ctxt->lock);
 
+	for (i = 0; i < nhi_ctxt->num_ports; ++i) {
+		struct net_device *net_dev =
+				nhi_ctxt->net_devices[i].net_dev;
+		if (net_dev) {
+			u8 path = PATH_FROM_PORT(nhi_ctxt->num_paths, i);
+
+			if (isr0 & REG_RING_INT_RX_PROCESSED(
+					path, nhi_ctxt->num_paths))
+				tbt_net_rx_msi(net_dev);
+			if (isr0 & REG_RING_INT_TX_PROCESSED(path))
+				tbt_net_tx_msi(net_dev);
+		}
+	}
+
 	if (isr0 & REG_RING_INT_RX_PROCESSED(TBT_ICM_RING_NUM,
 					     nhi_ctxt->num_paths))
 		schedule_work(&nhi_ctxt->icm_msgs_work);
drivers/thunderbolt/net.c +1475 -0

1,567 lines not on this page · raw message

Signature · 1 line
2.7.4
author
#8 lore raw

PATCH v2 8/8 thunderbolt: Networking doc

In reply to Amir Levy

Adding Thunderbolt(TM) networking documentation.

---
 Documentation/00-INDEX                   |   2 +
 Documentation/thunderbolt-networking.txt | 135 +++++++++++++++++++++++++++++++
 2 files changed, 137 insertions(+)
 create mode 100644 Documentation/thunderbolt-networking.txt
Documentation/00-INDEX +2 -0
index cd077ca..8cf1717 100644
@@ -439,6 +439,8 @@ this_cpu_ops.txt
 	- List rationale behind and the way to use this_cpu operations.
 thermal/
 	- directory with information on managing thermal issues (CPU/temp)
+thunderbolt-networking.txt
+	- Thunderbolt(TM) Networking driver description.
 trace/
 	- directory with info on tracing technologies within linux
 unaligned-memory-access.txt
Documentation/thunderbolt-networking.txt new file +135 -0

135 lines not on this page · raw message

Signature · 1 line
2.7.4
#9 lore raw
In reply to Amir Levy
Quoted 43 lines · Amir (Jer)

This is version 2 of Thunderbolt(TM) driver for non-Apple hardware.

Changes since v1:
- Separation to 2 modules.
- Moved ICM specific registers definition to ICM header file.
- Added new Thunderbolt device IDs.
- Renamed the Thunderbolt networking documentation.
- General cleanups

These patches were pushed to GitHub where they can be reviewed more comfortably with green/red highlighting:
https://github.com/01org/thunderbolt-software-kernel-tree

Daemon code:
https://github.com/01org/thunderbolt-software-daemon

For reference, here's a link to version 1:
[v1]: http://www.spinics.net/lists/linux-pci/msg51287.html

Amir Levy (8):
thunderbolt: Macro rename
thunderbolt: Updating device IDs
thunderbolt: Updating the register definitions
thunderbolt: Kconfig for Thunderbolt(TM) networking
thunderbolt: Communication with the ICM (firmware)
thunderbolt: Networking state machine
thunderbolt: Networking transmit and receive
thunderbolt: Networking doc

 Documentation/00-INDEX                   |    2 +
 Documentation/thunderbolt-networking.txt |  135 ++
 drivers/thunderbolt/Kconfig              |   25 +-
 drivers/thunderbolt/Makefile             |    4 +-
 drivers/thunderbolt/icm_nhi.c            | 1631 +++++++++++++++++++++
 drivers/thunderbolt/icm_nhi.h            |   84 ++
 drivers/thunderbolt/net.c                | 2277
++++++++++++++++++++++++++++++
 drivers/thunderbolt/net.h                |  274 ++++
 drivers/thunderbolt/nhi_regs.h           |  115 +-
 include/linux/pci_ids.h                  |   44 +-
 10 files changed, 4565 insertions(+), 26 deletions(-)  create mode 100644
Documentation/thunderbolt-networking.txt
 create mode 100644 drivers/thunderbolt/icm_nhi.c  create mode 100644
Quoted 5 lines

drivers/thunderbolt/icm_nhi.h create mode 100644 drivers/thunderbolt/net.c create mode 100644 drivers/thunderbolt/net.h

--
2.7.4

Hi All,
Do you have any comments or suggestions for this patch set?

Regards,
Amir

maintainer
#10 lore raw
Quoted 47 lines · Amir (Jer)
Quoted 46 lines · Amir (Jer)

This is version 2 of Thunderbolt(TM) driver for non-Apple hardware.

Changes since v1:
- Separation to 2 modules.
- Moved ICM specific registers definition to ICM header file.
- Added new Thunderbolt device IDs.
- Renamed the Thunderbolt networking documentation.
- General cleanups

These patches were pushed to GitHub where they can be reviewed more comfortably with green/red highlighting:
https://github.com/01org/thunderbolt-software-kernel-tree

Daemon code:
https://github.com/01org/thunderbolt-software-daemon

For reference, here's a link to version 1:
[v1]: http://www.spinics.net/lists/linux-pci/msg51287.html

Amir Levy (8):
thunderbolt: Macro rename
thunderbolt: Updating device IDs
thunderbolt: Updating the register definitions
thunderbolt: Kconfig for Thunderbolt(TM) networking
thunderbolt: Communication with the ICM (firmware)
thunderbolt: Networking state machine
thunderbolt: Networking transmit and receive
thunderbolt: Networking doc

 Documentation/00-INDEX                   |    2 +
 Documentation/thunderbolt-networking.txt |  135 ++
 drivers/thunderbolt/Kconfig              |   25 +-
 drivers/thunderbolt/Makefile             |    4 +-
 drivers/thunderbolt/icm_nhi.c            | 1631 +++++++++++++++++++++
 drivers/thunderbolt/icm_nhi.h            |   84 ++
 drivers/thunderbolt/net.c                | 2277
++++++++++++++++++++++++++++++
 drivers/thunderbolt/net.h                |  274 ++++
 drivers/thunderbolt/nhi_regs.h           |  115 +-
 include/linux/pci_ids.h                  |   44 +-
 10 files changed, 4565 insertions(+), 26 deletions(-)  create mode 100644
Documentation/thunderbolt-networking.txt
 create mode 100644 drivers/thunderbolt/icm_nhi.c  create mode 100644

drivers/thunderbolt/icm_nhi.h create mode 100644 drivers/thunderbolt/net.c create mode 100644 drivers/thunderbolt/net.h

Quoted 5 lines
Quoted 2 lines

--
2.7.4

Hi All,
Do you have any comments or suggestions for this patch set?

Since this is now a separate driver I would prefer if it was in a different (sub)directory (maybe thunderbolt/icm?).

Quoted 2 lines

Regards,
Amir

#11 lore raw
Quoted 3 lines · Andreas Noever

Since this is now a separate driver I would prefer if it was in a different (sub)directory (maybe thunderbolt/icm?).

Thanks Andreas for the comment, will change it in the next patch. Any more comments?