All of lore.kernel.org
 help / color / mirror / Atom feed
From: israelr@mellanox.com (Israel Rukshin)
Subject: [PATCH 5/5] nvmet-tcp: Add TOS for tcp transport
Date: Sun, 18 Aug 2019 12:08:55 +0300	[thread overview]
Message-ID: <1566119335-15058-7-git-send-email-israelr@mellanox.com> (raw)
In-Reply-To: <1566119335-15058-1-git-send-email-israelr@mellanox.com>

Set the outgoing packets type of service (TOS) according to the
receiving TOS.

Signed-off-by: Israel Rukshin <israelr at mellanox.com>
Suggested-by: Sagi Grimberg <sagi at grimberg.me>
Reviewed-by: Max Gurtovoy <maxg at mellanox.com>
Reviewed-by: Sagi Grimberg <sagi at grimberg.me>
---
 drivers/nvme/target/tcp.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
index 76e4375..bf4f034 100644
--- a/drivers/nvme/target/tcp.c
+++ b/drivers/nvme/target/tcp.c
@@ -1415,6 +1415,7 @@ static void nvmet_tcp_state_change(struct sock *sk)
 static int nvmet_tcp_set_queue_sock(struct nvmet_tcp_queue *queue)
 {
 	struct socket *sock = queue->sock;
+	struct inet_sock *inet = inet_sk(sock->sk);
 	struct linger sol = { .l_onoff = 1, .l_linger = 0 };
 	int ret;
 
@@ -1438,6 +1439,16 @@ static int nvmet_tcp_set_queue_sock(struct nvmet_tcp_queue *queue)
 	if (ret)
 		return ret;
 
+	/* Set socket type of service */
+	if (inet->rcv_tos > 0) {
+		int tos = inet->rcv_tos;
+
+		ret = kernel_setsockopt(sock, SOL_IP, IP_TOS,
+				(char *)&tos, sizeof(tos));
+		if (ret)
+			return ret;
+	}
+
 	write_lock_bh(&sock->sk->sk_callback_lock);
 	sock->sk->sk_user_data = queue;
 	queue->data_ready = sock->sk->sk_data_ready;
-- 
1.8.3.1

  parent reply	other threads:[~2019-08-18  9:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-18  9:08 [PATCH 0/5 V5] nvme: Add type of service (TOS) configuration Israel Rukshin
2019-08-18  9:08 ` [PATCH] nvme-cli/fabrics: Add tos param to connect cmd Israel Rukshin
2019-08-18  9:08 ` [PATCH 1/5] nvme-fabrics: Add type of service (TOS) configuration Israel Rukshin
2019-08-18  9:08 ` [PATCH 2/5] nvme-rdma: Add TOS for rdma transport Israel Rukshin
2019-08-18  9:08 ` [PATCH 3/5] nvme-tcp: Use struct nvme_ctrl directly Israel Rukshin
2019-08-18  9:08 ` [PATCH 4/5] nvme-tcp: Add TOS for tcp transport Israel Rukshin
2019-08-18  9:08 ` Israel Rukshin [this message]
     [not found] ` <054fa45e-a2ee-d291-4c71-75f7a1872f9a@grimberg.me>
2019-09-01 11:18   ` [PATCH 0/5 V5] nvme: Add type of service (TOS) configuration Max Gurtovoy
2019-09-01 15:11     ` Keith Busch
  -- strict thread matches above, loose matches on Subject: below --
2019-08-15 13:33 [PATCH 0/5 V4] " Israel Rukshin
2019-08-15 13:33 ` [PATCH 5/5] nvmet-tcp: Add TOS for tcp transport Israel Rukshin
2019-08-14 10:19 [PATCH 0/5 V3] nvme: Add type of service (TOS) configuration Israel Rukshin
2019-08-14 10:19 ` [PATCH 5/5] nvmet-tcp: Add TOS for tcp transport Israel Rukshin
2019-08-13 13:17 [PATCH 0/5 V2] nvme: Add type of service (TOS) configuration Israel Rukshin
2019-08-13 13:17 ` [PATCH 5/5] nvmet-tcp: Add TOS for tcp transport Israel Rukshin
2019-08-13 16:41   ` Sagi Grimberg

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=1566119335-15058-7-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.