* [PATCH rfc 2/2] nvmet-tcp: set SO_PRIORITY for network sockets
@ 2019-09-24 16:06 Wunderlich, Mark
2019-09-26 20:03 ` Sagi Grimberg
0 siblings, 1 reply; 3+ messages in thread
From: Wunderlich, Mark @ 2019-09-24 16:06 UTC (permalink / raw)
To: linux-nvme; +Cc: Sagi Grimberg
Enable ability to associate all sockets related to NVMf TCP
traffic to a priority group that will perform optimized
network processing for this traffic class. Maintain initial
default behavior of using priority of zero.
Signed-off-by: Kiran Patil <kiran.patil@intel.com>
Signed-off-by: Mark Wunderlich <mark.wunderlich@intel.com>
---
drivers/nvme/target/tcp.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
index a232ef5..10c8722 100644
--- a/drivers/nvme/target/tcp.c
+++ b/drivers/nvme/target/tcp.c
@@ -19,6 +19,16 @@
#define NVMET_TCP_DEF_INLINE_DATA_SIZE (4 * PAGE_SIZE)
+/* Define the socket priority to use for connections were it is desirable
+ * that the NIC consider performing optimized packet processing or filtering.
+ * A non-zero value being sufficient to indicate general consideration of any
+ * possible optimization. Making it a module param allows for alternative
+ * values that may be unique for some NIC implementations.
+ */
+static int nvmet_tcp_so_priority;
+module_param(nvmet_tcp_so_priority, int, 0644);
+MODULE_PARM_DESC(nvmet_tcp_so_priority, "nvmet tcp socket optimize priority");
+
#define NVMET_TCP_RECV_BUDGET 8
#define NVMET_TCP_SEND_BUDGET 8
#define NVMET_TCP_IO_WORK_BUDGET 64
@@ -1461,6 +1471,12 @@ static int nvmet_tcp_set_queue_sock(struct nvmet_tcp_queue *queue)
if (ret)
return ret;
+ ret = kernel_setsockopt(sock, SOL_SOCKET, SO_PRIORITY,
+ (char *)&nvmet_tcp_so_priority,
+ sizeof(nvmet_tcp_so_priority));
+ if (ret)
+ return ret;
+
/* Set socket type of service */
if (inet->rcv_tos > 0) {
int tos = inet->rcv_tos;
@@ -1650,6 +1666,15 @@ static int nvmet_tcp_add_port(struct nvmet_port *nport)
goto err_sock;
}
+ ret = kernel_setsockopt(port->sock, SOL_SOCKET, SO_PRIORITY,
+ (char *)&nvmet_tcp_so_priority,
+ sizeof(nvmet_tcp_so_priority));
+ if (ret) {
+ pr_err("failed to set listen socket SO_PRIORITY, ret %d\n",
+ ret);
+ goto err_sock;
+ }
+
ret = kernel_bind(port->sock, (struct sockaddr *)&port->addr,
sizeof(port->addr));
if (ret) {
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH rfc 2/2] nvmet-tcp: set SO_PRIORITY for network sockets
2019-09-24 16:06 [PATCH rfc 2/2] nvmet-tcp: set SO_PRIORITY for network sockets Wunderlich, Mark
@ 2019-09-26 20:03 ` Sagi Grimberg
2019-09-26 21:41 ` Wunderlich, Mark
0 siblings, 1 reply; 3+ messages in thread
From: Sagi Grimberg @ 2019-09-26 20:03 UTC (permalink / raw)
To: Wunderlich, Mark, linux-nvme
> +/* Define the socket priority to use for connections were it is desirable
> + * that the NIC consider performing optimized packet processing or filtering.
> + * A non-zero value being sufficient to indicate general consideration of any
> + * possible optimization. Making it a module param allows for alternative
> + * values that may be unique for some NIC implementations.
> + */
> +static int nvmet_tcp_so_priority;
> +module_param(nvmet_tcp_so_priority, int, 0644);
> +MODULE_PARM_DESC(nvmet_tcp_so_priority, "nvmet tcp socket optimize priority");
> +
No need for nvmet_tcp prefix I assume.
Should it be a bool if a non-zero value is sufficient?
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH rfc 2/2] nvmet-tcp: set SO_PRIORITY for network sockets
2019-09-26 20:03 ` Sagi Grimberg
@ 2019-09-26 21:41 ` Wunderlich, Mark
0 siblings, 0 replies; 3+ messages in thread
From: Wunderlich, Mark @ 2019-09-26 21:41 UTC (permalink / raw)
To: Sagi Grimberg, linux-nvme
>> +/* Define the socket priority to use for connections were it is
>> +desirable
>> + * that the NIC consider performing optimized packet processing or filtering.
>> + * A non-zero value being sufficient to indicate general
>> +consideration of any
>> + * possible optimization. Making it a module param allows for
>> +alternative
>> + * values that may be unique for some NIC implementations.
>> + */
>> +static int nvmet_tcp_so_priority;
>> +module_param(nvmet_tcp_so_priority, int, 0644);
>> +MODULE_PARM_DESC(nvmet_tcp_so_priority, "nvmet tcp socket optimize
>> +priority");
>> +
>No need for nvmet_tcp prefix I assume.
Sure. Was not sure if standard practice is to name such params specific to module. So 'so_priority', or just 'priority' would be OK?
>Should it be a bool if a non-zero value is sufficient?
Since various NIC vendors may use different actual so_priority values to trigger specific behavior thought is best to leave it adjustable. True, in our case a Boolean could be made to work for now. But future proofing may be a good thing. If we leave as is, maybe would make sense to not allow a value that would exceed the possible range to be used/set.
_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-09-26 21:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-24 16:06 [PATCH rfc 2/2] nvmet-tcp: set SO_PRIORITY for network sockets Wunderlich, Mark
2019-09-26 20:03 ` Sagi Grimberg
2019-09-26 21:41 ` Wunderlich, Mark
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.