Skip to contentSkip to conversation

NTB: Use DMA Engine to transmit and receive

RFC Superseded Jon Mason 1 participant 1 message Jul 1, 2013 NTB driver core

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Jon Mason

author
#0 lore raw

RFC 1/1 NTB: Use DMA Engine to transmit and receive

Allocate and use a DMA engine channel to transmit and receive data over NTB. If none is allocated, fall back to using the CPU to transfer data.

---
 drivers/ntb/ntb_hw.c        |   19 ++-
 drivers/ntb/ntb_hw.h        |    1 +
 drivers/ntb/ntb_transport.c |  285 ++++++++++++++++++++++++++++++++++++-------
 3 files changed, 259 insertions(+), 46 deletions(-)
drivers/ntb/ntb_hw.c +18 -1
index 15d7517..d032f6d 100644
@@ -56,7 +56,7 @@
 #include "ntb_regs.h"
 
 #define NTB_NAME	"Intel(R) PCI-E Non-Transparent Bridge Driver"
-#define NTB_VER		"0.25"
+#define NTB_VER		"0.26"
 
 MODULE_DESCRIPTION(NTB_NAME);
 MODULE_VERSION(NTB_VER);
@@ -396,6 +396,23 @@ int ntb_read_remote_spad(struct ntb_device *ndev, unsigned int idx, u32 *val)
 }
 
 /**
+ * ntb_get_mw_base() - get addr for the NTB memory window
+ * @ndev: pointer to ntb_device instance
+ * @mw: memory window number
+ *
+ * This function provides the base address of the memory window specified.
+ *
+ * RETURNS: address, or NULL on error.
+ */
+resource_size_t ntb_get_mw_base(struct ntb_device *ndev, unsigned int mw)
+{
+	if (mw >= NTB_NUM_MW)
+		return 0;
+
+	return pci_resource_start(ndev->pdev, MW_TO_BAR(mw));
+}
+
+/**
  * ntb_get_mw_vbase() - get virtual addr for the NTB memory window
  * @ndev: pointer to ntb_device instance
  * @mw: memory window number
drivers/ntb/ntb_hw.h +1 -0
index f2b11ef..b631070 100644
@@ -206,6 +206,7 @@ int ntb_write_local_spad(struct ntb_device *ndev, unsigned int idx, u32 val);
 int ntb_read_local_spad(struct ntb_device *ndev, unsigned int idx, u32 *val);
 int ntb_write_remote_spad(struct ntb_device *ndev, unsigned int idx, u32 val);
 int ntb_read_remote_spad(struct ntb_device *ndev, unsigned int idx, u32 *val);
+resource_size_t ntb_get_mw_base(struct ntb_device *ndev, unsigned int mw);
 void __iomem *ntb_get_mw_vbase(struct ntb_device *ndev, unsigned int mw);
 u64 ntb_get_mw_size(struct ntb_device *ndev, unsigned int mw);
 void ntb_ring_sdb(struct ntb_device *ndev, unsigned int idx);
drivers/ntb/ntb_transport.c +240 -45

479 lines not on this page · raw message

Signature · 1 line
1.7.9.5