diff options
author | Christoph Hellwig | 2020-05-28 07:12:26 +0200 |
---|---|---|
committer | David S. Miller | 2020-05-28 11:11:45 -0700 |
commit | 6ebf71bab9fb476fc8132be4c12b88201278f0ca (patch) | |
tree | 46494a55e668794da37d9f3bda2185a3aedb6930 /drivers/nvme/target | |
parent | 480aeb9639d6a077c611b303a22f9b1e5937d081 (diff) |
ipv4: add ip_sock_set_tos
Add a helper to directly set the IP_TOS sockopt from kernel space without
going through a fake uaccess.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/nvme/target')
-rw-r--r-- | drivers/nvme/target/tcp.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c index 55bc4c3c0a74..4546049a96b3 100644 --- a/drivers/nvme/target/tcp.c +++ b/drivers/nvme/target/tcp.c @@ -1452,14 +1452,8 @@ static int nvmet_tcp_set_queue_sock(struct nvmet_tcp_queue *queue) sock_set_priority(sock->sk, so_priority); /* 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; - } + if (inet->rcv_tos > 0) + ip_sock_set_tos(sock->sk, inet->rcv_tos); write_lock_bh(&sock->sk->sk_callback_lock); sock->sk->sk_user_data = queue; |