Skip to content

Commit b0780ee

Browse files
KAGA-KOKOdledford
authored andcommitted
IB/srp: Add target_can_queue login parameter
Although I'm not sure this parameter is useful for regular SRP users, setting this parameter to 1 has shown to be invaluable for testing the block layer core, SCSI core and device mapper queue running mechanisms. Signed-off-by: Bart Van Assche <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent 19f3134 commit b0780ee

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

drivers/infiniband/ulp/srp/ib_srp.c

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3018,6 +3018,16 @@ static int srp_reset_host(struct scsi_cmnd *scmnd)
30183018
return srp_reconnect_rport(target->rport) == 0 ? SUCCESS : FAILED;
30193019
}
30203020

3021+
static int srp_target_alloc(struct scsi_target *starget)
3022+
{
3023+
struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
3024+
struct srp_target_port *target = host_to_target(shost);
3025+
3026+
if (target->target_can_queue)
3027+
starget->can_queue = target->target_can_queue;
3028+
return 0;
3029+
}
3030+
30213031
static int srp_slave_alloc(struct scsi_device *sdev)
30223032
{
30233033
struct Scsi_Host *shost = sdev->host;
@@ -3231,6 +3241,7 @@ static struct scsi_host_template srp_template = {
32313241
.module = THIS_MODULE,
32323242
.name = "InfiniBand SRP initiator",
32333243
.proc_name = DRV_NAME,
3244+
.target_alloc = srp_target_alloc,
32343245
.slave_alloc = srp_slave_alloc,
32353246
.slave_configure = srp_slave_configure,
32363247
.info = srp_target_info,
@@ -3398,6 +3409,7 @@ enum {
33983409
SRP_OPT_QUEUE_SIZE = 1 << 14,
33993410
SRP_OPT_IP_SRC = 1 << 15,
34003411
SRP_OPT_IP_DEST = 1 << 16,
3412+
SRP_OPT_TARGET_CAN_QUEUE= 1 << 17,
34013413
};
34023414

34033415
static unsigned int srp_opt_mandatory[] = {
@@ -3419,6 +3431,7 @@ static const match_table_t srp_opt_tokens = {
34193431
{ SRP_OPT_SERVICE_ID, "service_id=%s" },
34203432
{ SRP_OPT_MAX_SECT, "max_sect=%d" },
34213433
{ SRP_OPT_MAX_CMD_PER_LUN, "max_cmd_per_lun=%d" },
3434+
{ SRP_OPT_TARGET_CAN_QUEUE, "target_can_queue=%d" },
34223435
{ SRP_OPT_IO_CLASS, "io_class=%x" },
34233436
{ SRP_OPT_INITIATOR_EXT, "initiator_ext=%s" },
34243437
{ SRP_OPT_CMD_SG_ENTRIES, "cmd_sg_entries=%u" },
@@ -3607,6 +3620,15 @@ static int srp_parse_options(struct net *net, const char *buf,
36073620
target->scsi_host->cmd_per_lun = token;
36083621
break;
36093622

3623+
case SRP_OPT_TARGET_CAN_QUEUE:
3624+
if (match_int(args, &token) || token < 1) {
3625+
pr_warn("bad max target_can_queue parameter '%s'\n",
3626+
p);
3627+
goto out;
3628+
}
3629+
target->target_can_queue = token;
3630+
break;
3631+
36103632
case SRP_OPT_IO_CLASS:
36113633
if (match_hex(args, &token)) {
36123634
pr_warn("bad IO class parameter '%s'\n", p);

drivers/infiniband/ulp/srp/ib_srp.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ struct srp_target_port {
211211
char target_name[32];
212212
unsigned int scsi_id;
213213
unsigned int sg_tablesize;
214+
unsigned int target_can_queue;
214215
int mr_pool_size;
215216
int mr_per_cmd;
216217
int queue_size;

0 commit comments

Comments
 (0)