Commit 52fb2b50 authored by Vu Pham's avatar Vu Pham Committed by Roland Dreier

IB/srp: Allow cmd_per_lun to be set per target port

Allow userspace to throttle traffic on a given connection to a target
port by adding "max_cmd_per_lun=xyz" to lower the cmd_per_lun value
set for that scsi_host.
Signed-off-by: default avatarVu Pham <vu@mellanox.com>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 0c5b3952
...@@ -1491,6 +1491,7 @@ enum { ...@@ -1491,6 +1491,7 @@ enum {
SRP_OPT_PKEY = 1 << 3, SRP_OPT_PKEY = 1 << 3,
SRP_OPT_SERVICE_ID = 1 << 4, SRP_OPT_SERVICE_ID = 1 << 4,
SRP_OPT_MAX_SECT = 1 << 5, SRP_OPT_MAX_SECT = 1 << 5,
SRP_OPT_MAX_CMD_PER_LUN = 1 << 6,
SRP_OPT_ALL = (SRP_OPT_ID_EXT | SRP_OPT_ALL = (SRP_OPT_ID_EXT |
SRP_OPT_IOC_GUID | SRP_OPT_IOC_GUID |
SRP_OPT_DGID | SRP_OPT_DGID |
...@@ -1505,6 +1506,7 @@ static match_table_t srp_opt_tokens = { ...@@ -1505,6 +1506,7 @@ static match_table_t srp_opt_tokens = {
{ SRP_OPT_PKEY, "pkey=%x" }, { SRP_OPT_PKEY, "pkey=%x" },
{ SRP_OPT_SERVICE_ID, "service_id=%s" }, { SRP_OPT_SERVICE_ID, "service_id=%s" },
{ SRP_OPT_MAX_SECT, "max_sect=%d" }, { SRP_OPT_MAX_SECT, "max_sect=%d" },
{ SRP_OPT_MAX_CMD_PER_LUN, "max_cmd_per_lun=%d" },
{ SRP_OPT_ERR, NULL } { SRP_OPT_ERR, NULL }
}; };
...@@ -1581,6 +1583,14 @@ static int srp_parse_options(const char *buf, struct srp_target_port *target) ...@@ -1581,6 +1583,14 @@ static int srp_parse_options(const char *buf, struct srp_target_port *target)
target->scsi_host->max_sectors = token; target->scsi_host->max_sectors = token;
break; break;
case SRP_OPT_MAX_CMD_PER_LUN:
if (match_int(args, &token)) {
printk(KERN_WARNING PFX "bad max cmd_per_lun parameter '%s'\n", p);
goto out;
}
target->scsi_host->cmd_per_lun = min(token, SRP_SQ_SIZE);
break;
default: default:
printk(KERN_WARNING PFX "unknown parameter or missing value " printk(KERN_WARNING PFX "unknown parameter or missing value "
"'%s' in target creation request\n", p); "'%s' in target creation request\n", p);
......
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