Skip to content

Commit bb13985

Browse files
Israel Rukshinsagigrimberg
authored andcommitted
nvme-tcp: Add TOS for tcp transport
TOS provide clients the ability to segregate traffic flows for different type of data. One of the TOS usage is bandwidth management which allows setting bandwidth limits for QoS classes, e.g. 80% bandwidth to controllers at QoS class A and 20% to controllers at QoS class B. usage examples: nvme connect --tos=0 --transport=tcp --traddr=10.0.1.1 --nqn=test-nvme Signed-off-by: Israel Rukshin <israelr@mellanox.com> Reviewed-by: Max Gurtovoy <maxg@mellanox.com> Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
1 parent 9924b03 commit bb13985

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

‎drivers/nvme/host/tcp.c‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1304,6 +1304,18 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl,
13041304
goto err_sock;
13051305
}
13061306

1307+
/* Set socket type of service */
1308+
if (nctrl->opts->tos >= 0) {
1309+
opt = nctrl->opts->tos;
1310+
ret = kernel_setsockopt(queue->sock, SOL_IP, IP_TOS,
1311+
(char *)&opt, sizeof(opt));
1312+
if (ret) {
1313+
dev_err(nctrl->device,
1314+
"failed to set IP_TOS sock opt %d\n", ret);
1315+
goto err_sock;
1316+
}
1317+
}
1318+
13071319
queue->sock->sk->sk_allocation = GFP_ATOMIC;
13081320
if (!qid)
13091321
n = 0;
@@ -2344,7 +2356,8 @@ static struct nvmf_transport_ops nvme_tcp_transport = {
23442356
.allowed_opts = NVMF_OPT_TRSVCID | NVMF_OPT_RECONNECT_DELAY |
23452357
NVMF_OPT_HOST_TRADDR | NVMF_OPT_CTRL_LOSS_TMO |
23462358
NVMF_OPT_HDR_DIGEST | NVMF_OPT_DATA_DIGEST |
2347-
NVMF_OPT_NR_WRITE_QUEUES | NVMF_OPT_NR_POLL_QUEUES,
2359+
NVMF_OPT_NR_WRITE_QUEUES | NVMF_OPT_NR_POLL_QUEUES |
2360+
NVMF_OPT_TOS,
23482361
.create_ctrl = nvme_tcp_create_ctrl,
23492362
};
23502363

0 commit comments

Comments
 (0)