linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: israelr@mellanox.com (Israel Rukshin)
Subject: [PATCH 4/5] nvme-tcp: Add TOS for tcp transport
Date: Tue, 13 Aug 2019 16:17:30 +0300	[thread overview]
Message-ID: <1565702251-17198-6-git-send-email-israelr@mellanox.com> (raw)
In-Reply-To: <1565702251-17198-1-git-send-email-israelr@mellanox.com>

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 at mellanox.com>
Reviewed-by: Max Gurtovoy <maxg at mellanox.com>
---
 drivers/nvme/host/tcp.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index feed0dc..229017f 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -1301,6 +1301,18 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl,
 		goto err_sock;
 	}
 
+	/* Set socket type of service */
+	if (nctrl->opts->tos >= 0) {
+		opt = nctrl->opts->tos;
+		ret = kernel_setsockopt(queue->sock, SOL_IP, IP_TOS,
+				(char *)&opt, sizeof(opt));
+		if (ret) {
+			dev_err(nctrl->device,
+				"failed to set IP_TOS sock opt %d\n", ret);
+			goto err_sock;
+		}
+	}
+
 	queue->sock->sk->sk_allocation = GFP_ATOMIC;
 	if (!qid)
 		n = 0;
-- 
1.8.3.1

  parent reply	other threads:[~2019-08-13 13:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-13 13:17 [PATCH 0/5 V2] nvme: Add type of service (TOS) configuration Israel Rukshin
2019-08-13 13:17 ` [PATCH] nvme-cli/fabrics: Add tos param to connect cmd Israel Rukshin
2019-08-13 16:43   ` Sagi Grimberg
2019-08-14  7:42     ` Israel Rukshin
2019-08-13 13:17 ` [PATCH 1/5] nvme-fabrics: Add type of service (TOS) configuration Israel Rukshin
2019-08-13 16:40   ` Sagi Grimberg
2019-08-13 17:55     ` James Smart
2019-08-13 13:17 ` [PATCH 2/5] nvme-rdma: Add TOS for rdma transport Israel Rukshin
2019-08-13 16:40   ` Sagi Grimberg
2019-08-13 13:17 ` [PATCH 3/5] nvme-tcp: Use struct nvme_ctrl directly Israel Rukshin
2019-08-13 16:41   ` Sagi Grimberg
2019-08-13 13:17 ` Israel Rukshin [this message]
2019-08-13 16:41   ` [PATCH 4/5] nvme-tcp: Add TOS for tcp transport Sagi Grimberg
2019-08-13 13:17 ` [PATCH 5/5] nvmet-tcp: " Israel Rukshin
2019-08-13 16:41   ` Sagi Grimberg
2019-08-14 10:19 [PATCH 0/5 V3] nvme: Add type of service (TOS) configuration Israel Rukshin
2019-08-14 10:19 ` [PATCH 4/5] nvme-tcp: Add TOS for tcp transport Israel Rukshin
2019-08-15 13:33 [PATCH 0/5 V4] nvme: Add type of service (TOS) configuration Israel Rukshin
2019-08-15 13:33 ` [PATCH 4/5] nvme-tcp: Add TOS for tcp transport Israel Rukshin
2019-08-15 17:15   ` Sagi Grimberg
2019-08-18  9:08 [PATCH 0/5 V5] nvme: Add type of service (TOS) configuration Israel Rukshin
2019-08-18  9:08 ` [PATCH 4/5] nvme-tcp: Add TOS for tcp transport Israel Rukshin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1565702251-17198-6-git-send-email-israelr@mellanox.com \
    --to=israelr@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).