Skip to contentSkip to conversation

NTB: Use DMA Engine to Transmit and Receive

PATCH New Jon Mason 1 participant 1 message Aug 20, 2013 NTB driver core

lore
Share & tools
lore

Jon Mason

author
#0 lore raw

PATCH v2 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.

Cc Dan Williams <[email protected]>
Cc Vinod Koul <[email protected]>
Cc Dave Jiang <[email protected]>
---
 drivers/ntb/ntb_hw.c        |   17 +++
 drivers/ntb/ntb_hw.h        |    1 +
 drivers/ntb/ntb_transport.c |  324 ++++++++++++++++++++++++++++++++++++-------
 3 files changed, 295 insertions(+), 47 deletions(-)
drivers/ntb/ntb_hw.c +17 -0
index 060fdf0..524c159 100644
@@ -350,6 +350,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_max_mw(ndev))
+		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 b03de80..ab5f768 100644
@@ -240,6 +240,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 +277 -47

543 lines not on this page · raw message

Signature · 1 line
1.7.9.5