diff options
author | Bart Van Assche <bvanassche@acm.org> | 2014-05-20 09:06:41 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2014-05-20 12:20:52 -0400 |
commit | b1b8854d1622b99b64cd98ed307ffd168c6d3ebd (patch) | |
tree | c001c3ef7ba5d870b49c214552b38da549111d61 | |
parent | 539dde6fc5c30cfa76439de03ed3ba444d2579b3 (diff) |
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: Bart Van Assche <bvanassche@acm.org>
Reviewed-by: Sagi Grimberg <sagig@mellanox.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
-rw-r--r-- | drivers/infiniband/ulp/srp/ib_srp.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index c2e0ad399213..77ba96553b27 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c | |||
@@ -66,6 +66,7 @@ static unsigned int srp_sg_tablesize; | |||
66 | static unsigned int cmd_sg_entries; | 66 | static unsigned int cmd_sg_entries; |
67 | static unsigned int indirect_sg_entries; | 67 | static unsigned int indirect_sg_entries; |
68 | static bool allow_ext_sg; | 68 | static bool allow_ext_sg; |
69 | static bool register_always; | ||
69 | static int topspin_workarounds = 1; | 70 | static int topspin_workarounds = 1; |
70 | 71 | ||
71 | module_param(srp_sg_tablesize, uint, 0444); | 72 | module_param(srp_sg_tablesize, uint, 0444); |
@@ -87,6 +88,10 @@ module_param(topspin_workarounds, int, 0444); | |||
87 | MODULE_PARM_DESC(topspin_workarounds, | 88 | MODULE_PARM_DESC(topspin_workarounds, |
88 | "Enable workarounds for Topspin/Cisco SRP target bugs if != 0"); | 89 | "Enable workarounds for Topspin/Cisco SRP target bugs if != 0"); |
89 | 90 | ||
91 | module_param(register_always, bool, 0444); | ||
92 | MODULE_PARM_DESC(register_always, | ||
93 | "Use memory registration even for contiguous memory regions"); | ||
94 | |||
90 | static struct kernel_param_ops srp_tmo_ops; | 95 | static struct kernel_param_ops srp_tmo_ops; |
91 | 96 | ||
92 | static int srp_reconnect_delay = 10; | 97 | static int srp_reconnect_delay = 10; |
@@ -956,7 +961,7 @@ static int srp_finish_mapping(struct srp_map_state *state, | |||
956 | if (state->npages == 0) | 961 | if (state->npages == 0) |
957 | return 0; | 962 | return 0; |
958 | 963 | ||
959 | if (state->npages == 1) | 964 | if (state->npages == 1 && !register_always) |
960 | srp_map_desc(state, state->base_dma_addr, state->fmr_len, | 965 | srp_map_desc(state, state->base_dma_addr, state->fmr_len, |
961 | target->rkey); | 966 | target->rkey); |
962 | else | 967 | else |
@@ -1138,7 +1143,7 @@ static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_target_port *target, | |||
1138 | fmt = SRP_DATA_DESC_DIRECT; | 1143 | fmt = SRP_DATA_DESC_DIRECT; |
1139 | len = sizeof (struct srp_cmd) + sizeof (struct srp_direct_buf); | 1144 | len = sizeof (struct srp_cmd) + sizeof (struct srp_direct_buf); |
1140 | 1145 | ||
1141 | if (count == 1) { | 1146 | if (count == 1 && !register_always) { |
1142 | /* | 1147 | /* |
1143 | * The midlayer only generated a single gather/scatter | 1148 | * The midlayer only generated a single gather/scatter |
1144 | * entry, or DMA mapping coalesced everything to a | 1149 | * entry, or DMA mapping coalesced everything to a |