Commit 52b4451a authored by Israel Rukshin's avatar Israel Rukshin Committed by Sagi Grimberg

nvme-fabrics: Add type of service (TOS) configuration

TOS is user-defined and needs to be configured via nvme-cli.
It must be set before initiating any traffic and once set the TOS
cannot be changed.
Signed-off-by: default avatarIsrael Rukshin <israelr@mellanox.com>
Reviewed-by: default avatarMax Gurtovoy <maxg@mellanox.com>
Signed-off-by: default avatarSagi Grimberg <sagi@grimberg.me>
parent 35d1a938
...@@ -611,6 +611,7 @@ static const match_table_t opt_tokens = { ...@@ -611,6 +611,7 @@ static const match_table_t opt_tokens = {
{ NVMF_OPT_DATA_DIGEST, "data_digest" }, { NVMF_OPT_DATA_DIGEST, "data_digest" },
{ NVMF_OPT_NR_WRITE_QUEUES, "nr_write_queues=%d" }, { NVMF_OPT_NR_WRITE_QUEUES, "nr_write_queues=%d" },
{ NVMF_OPT_NR_POLL_QUEUES, "nr_poll_queues=%d" }, { NVMF_OPT_NR_POLL_QUEUES, "nr_poll_queues=%d" },
{ NVMF_OPT_TOS, "tos=%d" },
{ NVMF_OPT_ERR, NULL } { NVMF_OPT_ERR, NULL }
}; };
...@@ -632,6 +633,7 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts, ...@@ -632,6 +633,7 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
opts->duplicate_connect = false; opts->duplicate_connect = false;
opts->hdr_digest = false; opts->hdr_digest = false;
opts->data_digest = false; opts->data_digest = false;
opts->tos = -1; /* < 0 == use transport default */
options = o = kstrdup(buf, GFP_KERNEL); options = o = kstrdup(buf, GFP_KERNEL);
if (!options) if (!options)
...@@ -856,6 +858,22 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts, ...@@ -856,6 +858,22 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
} }
opts->nr_poll_queues = token; opts->nr_poll_queues = token;
break; break;
case NVMF_OPT_TOS:
if (match_int(args, &token)) {
ret = -EINVAL;
goto out;
}
if (token < 0) {
pr_err("Invalid type of service %d\n", token);
ret = -EINVAL;
goto out;
}
if (token > 255) {
pr_warn("Clamping type of service to 255\n");
token = 255;
}
opts->tos = token;
break;
default: default:
pr_warn("unknown parameter or missing value '%s' in ctrl creation request\n", pr_warn("unknown parameter or missing value '%s' in ctrl creation request\n",
p); p);
......
...@@ -55,6 +55,7 @@ enum { ...@@ -55,6 +55,7 @@ enum {
NVMF_OPT_DATA_DIGEST = 1 << 16, NVMF_OPT_DATA_DIGEST = 1 << 16,
NVMF_OPT_NR_WRITE_QUEUES = 1 << 17, NVMF_OPT_NR_WRITE_QUEUES = 1 << 17,
NVMF_OPT_NR_POLL_QUEUES = 1 << 18, NVMF_OPT_NR_POLL_QUEUES = 1 << 18,
NVMF_OPT_TOS = 1 << 19,
}; };
/** /**
...@@ -87,6 +88,7 @@ enum { ...@@ -87,6 +88,7 @@ enum {
* @data_digest: generate/verify data digest (TCP) * @data_digest: generate/verify data digest (TCP)
* @nr_write_queues: number of queues for write I/O * @nr_write_queues: number of queues for write I/O
* @nr_poll_queues: number of queues for polling I/O * @nr_poll_queues: number of queues for polling I/O
* @tos: type of service
*/ */
struct nvmf_ctrl_options { struct nvmf_ctrl_options {
unsigned mask; unsigned mask;
...@@ -108,6 +110,7 @@ struct nvmf_ctrl_options { ...@@ -108,6 +110,7 @@ struct nvmf_ctrl_options {
bool data_digest; bool data_digest;
unsigned int nr_write_queues; unsigned int nr_write_queues;
unsigned int nr_poll_queues; unsigned int nr_poll_queues;
int tos;
}; };
/* /*
......
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