Skip to content

Commit

Permalink
ntb_perf: Allow limiting the size of the memory windows
Browse files Browse the repository at this point in the history
On my system, dma_alloc_coherent won't produce memory anywhere
near the size of the BAR. So I needed a way to limit this.

It's pretty much copied straight from ntb_transport.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Acked-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>
  • Loading branch information
Logan Gunthorpe authored and Jon Mason committed Aug 5, 2016
1 parent a754a8f commit 4aae977
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/ntb/test/ntb_perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ MODULE_DESCRIPTION(DRIVER_DESCRIPTION);

static struct dentry *perf_debugfs_dir;

static unsigned long max_mw_size;
module_param(max_mw_size, ulong, 0644);
MODULE_PARM_DESC(max_mw_size, "Limit size of large memory windows");

static unsigned int seg_order = 19; /* 512K */
module_param(seg_order, uint, 0644);
MODULE_PARM_DESC(seg_order, "size order [n^2] of buffer segment for testing");
Expand Down Expand Up @@ -472,6 +476,10 @@ static void perf_link_work(struct work_struct *work)
dev_dbg(&perf->ntb->pdev->dev, "%s called\n", __func__);

size = perf->mw.phys_size;

if (max_mw_size && size > max_mw_size)
size = max_mw_size;

ntb_peer_spad_write(ndev, MW_SZ_HIGH, upper_32_bits(size));
ntb_peer_spad_write(ndev, MW_SZ_LOW, lower_32_bits(size));
ntb_peer_spad_write(ndev, VERSION, PERF_VERSION);
Expand Down

0 comments on commit 4aae977

Please sign in to comment.