Commit b1b8854d authored by Bart Van Assche's avatar Bart Van Assche Committed by Roland Dreier

IB/srp: Introduce the 'register_always' kernel module parameter

Add a kernel module parameter that enables memory registration also for SG-lists
that can be processed without memory registration. This makes it easier for kernel
developers to test the memory registration code.
Signed-off-by: default avatarBart Van Assche <bvanassche@acm.org>
Reviewed-by: default avatarSagi Grimberg <sagig@mellanox.com>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent 539dde6f
...@@ -66,6 +66,7 @@ static unsigned int srp_sg_tablesize; ...@@ -66,6 +66,7 @@ static unsigned int srp_sg_tablesize;
static unsigned int cmd_sg_entries; static unsigned int cmd_sg_entries;
static unsigned int indirect_sg_entries; static unsigned int indirect_sg_entries;
static bool allow_ext_sg; static bool allow_ext_sg;
static bool register_always;
static int topspin_workarounds = 1; static int topspin_workarounds = 1;
module_param(srp_sg_tablesize, uint, 0444); module_param(srp_sg_tablesize, uint, 0444);
...@@ -87,6 +88,10 @@ module_param(topspin_workarounds, int, 0444); ...@@ -87,6 +88,10 @@ module_param(topspin_workarounds, int, 0444);
MODULE_PARM_DESC(topspin_workarounds, MODULE_PARM_DESC(topspin_workarounds,
"Enable workarounds for Topspin/Cisco SRP target bugs if != 0"); "Enable workarounds for Topspin/Cisco SRP target bugs if != 0");
module_param(register_always, bool, 0444);
MODULE_PARM_DESC(register_always,
"Use memory registration even for contiguous memory regions");
static struct kernel_param_ops srp_tmo_ops; static struct kernel_param_ops srp_tmo_ops;
static int srp_reconnect_delay = 10; static int srp_reconnect_delay = 10;
...@@ -956,7 +961,7 @@ static int srp_finish_mapping(struct srp_map_state *state, ...@@ -956,7 +961,7 @@ static int srp_finish_mapping(struct srp_map_state *state,
if (state->npages == 0) if (state->npages == 0)
return 0; return 0;
if (state->npages == 1) if (state->npages == 1 && !register_always)
srp_map_desc(state, state->base_dma_addr, state->fmr_len, srp_map_desc(state, state->base_dma_addr, state->fmr_len,
target->rkey); target->rkey);
else else
...@@ -1138,7 +1143,7 @@ static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_target_port *target, ...@@ -1138,7 +1143,7 @@ static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_target_port *target,
fmt = SRP_DATA_DESC_DIRECT; fmt = SRP_DATA_DESC_DIRECT;
len = sizeof (struct srp_cmd) + sizeof (struct srp_direct_buf); len = sizeof (struct srp_cmd) + sizeof (struct srp_direct_buf);
if (count == 1) { if (count == 1 && !register_always) {
/* /*
* The midlayer only generated a single gather/scatter * The midlayer only generated a single gather/scatter
* entry, or DMA mapping coalesced everything to a * entry, or DMA mapping coalesced everything to a
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment