summaryrefslogtreecommitdiff
path: root/drivers/ntb/ntb_transport.c
diff options
context:
space:
mode:
authorDave Jiang <dave.jiang@intel.com>2015-05-19 23:52:04 +0300
committerJon Mason <jdmason@kudzu.us>2015-07-04 21:09:24 +0300
commita41ef053f700618f5f55a1dd658908a71163400b (patch)
tree6dbde672b790ffab2d8a784ed7cbab349afc1307 /drivers/ntb/ntb_transport.c
parent06917f753547e6bba8a5d17f79971d1c071a70dd (diff)
downloadlinux-a41ef053f700618f5f55a1dd658908a71163400b.tar.xz
NTB: Default to CPU memcpy for performance
Disable DMA usage by default, since the CPU provides much better performance with write combining. Provide a module parameter to enable DMA usage when offloading the memcpy is preferred. Signed-off-by: Dave Jiang <dave.jiang@intel.com> Signed-off-by: Allen Hubbe <Allen.Hubbe@emc.com> Signed-off-by: Jon Mason <jdmason@kudzu.us>
Diffstat (limited to 'drivers/ntb/ntb_transport.c')
-rw-r--r--drivers/ntb/ntb_transport.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c
index 7a765d3230d8..e07b056af3be 100644
--- a/drivers/ntb/ntb_transport.c
+++ b/drivers/ntb/ntb_transport.c
@@ -88,6 +88,10 @@ static unsigned int copy_bytes = 1024;
module_param(copy_bytes, uint, 0644);
MODULE_PARM_DESC(copy_bytes, "Threshold under which NTB will use the CPU to copy instead of DMA");
+static bool use_dma;
+module_param(use_dma, bool, 0644);
+MODULE_PARM_DESC(use_dma, "Use DMA engine to perform large data copy");
+
static struct dentry *nt_debugfs_dir;
struct ntb_queue_entry {
@@ -1589,10 +1593,15 @@ ntb_transport_create_queue(void *data, struct device *client_dev,
dma_cap_zero(dma_mask);
dma_cap_set(DMA_MEMCPY, dma_mask);
- qp->dma_chan = dma_request_channel(dma_mask, ntb_dma_filter_fn,
- (void *)(unsigned long)node);
- if (!qp->dma_chan)
- dev_info(&pdev->dev, "Unable to allocate DMA channel, using CPU instead\n");
+ if (use_dma) {
+ qp->dma_chan = dma_request_channel(dma_mask, ntb_dma_filter_fn,
+ (void *)(unsigned long)node);
+ if (!qp->dma_chan)
+ dev_info(&pdev->dev, "Unable to allocate DMA channel\n");
+ } else {
+ qp->dma_chan = NULL;
+ }
+ dev_dbg(&pdev->dev, "Using %s memcpy\n", qp->dma_chan ? "DMA" : "CPU");
for (i = 0; i < NTB_QP_DEF_NUM_ENTRIES; i++) {
entry = kzalloc_node(sizeof(*entry), GFP_ATOMIC, node);