[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230117153535.1945554-12-aaptel@nvidia.com>
Date: Tue, 17 Jan 2023 17:35:21 +0200
From: Aurelien Aptel <aaptel@...dia.com>
To: linux-nvme@...ts.infradead.org, netdev@...r.kernel.org,
sagi@...mberg.me, hch@....de, kbusch@...nel.org, axboe@...com,
chaitanyak@...dia.com, davem@...emloft.net, kuba@...nel.org
Cc: Aurelien Aptel <aaptel@...dia.com>, aurelien.aptel@...il.com,
smalin@...dia.com, malin1024@...il.com, ogerlitz@...dia.com,
yorayz@...dia.com, borisp@...dia.com
Subject: [PATCH v9 11/25] nvme-tcp: Add modparam to control the ULP offload enablement
Add ulp_offload module parameter to the nvme-tcp module to control
ULP offload at the NVMe-TCP layer.
Turn ULP offload off be default, regardless of the NIC driver support.
Overall, in order to enable ULP offload:
- nvme-tcp ulp_offload modparam must be set to 1
- netdev->ulp_ddp_caps.active must have ULP_DDP_C_NVME_TCP and/or
ULP_DDP_C_NVME_TCP_DDGST_RX capabilities flag set.
Signed-off-by: Yoray Zack <yorayz@...dia.com>
Signed-off-by: Shai Malin <smalin@...dia.com>
Signed-off-by: Aurelien Aptel <aaptel@...dia.com>
---
drivers/nvme/host/tcp.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index 8b1ebbdcda8e..3d7bf5136b5a 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -34,6 +34,16 @@ static int so_priority;
module_param(so_priority, int, 0644);
MODULE_PARM_DESC(so_priority, "nvme tcp socket optimize priority");
+#ifdef CONFIG_ULP_DDP
+/* NVMeTCP direct data placement and data digest offload will not
+ * happen if this parameter false (default), regardless of what the
+ * underlying netdev capabilities are.
+ */
+static bool ulp_offload;
+module_param(ulp_offload, bool, 0644);
+MODULE_PARM_DESC(ulp_offload, "Enable or disable NVMeTCP ULP support");
+#endif
+
#ifdef CONFIG_DEBUG_LOCK_ALLOC
/* lockdep can detect a circular dependency of the form
* sk_lock -> mmap_lock (page fault) -> fs locks -> sk_lock
@@ -316,6 +326,9 @@ static bool nvme_tcp_ddp_query_limits(struct net_device *netdev,
{
int ret;
+ if (!ulp_offload)
+ return false;
+
if (!netdev || !is_netdev_ulp_offload_active(netdev, NULL) ||
!netdev->netdev_ops->ulp_ddp_ops->limits)
return false;
@@ -455,6 +468,9 @@ static int nvme_tcp_offload_socket(struct nvme_tcp_queue *queue)
netdev->ulp_ddp_caps.active);
int ret;
+ if (!ulp_offload)
+ return 0;
+
config.nvmeotcp.pfv = NVME_TCP_PFV_1_0;
config.nvmeotcp.cpda = 0;
config.nvmeotcp.dgst =
@@ -509,6 +525,9 @@ static void nvme_tcp_offload_limits(struct nvme_tcp_queue *queue,
{
struct ulp_ddp_limits limits = {.type = ULP_DDP_NVME };
+ if (!ulp_offload)
+ return;
+
if (!nvme_tcp_ddp_query_limits(netdev, &limits)) {
queue->ctrl->offloading_netdev = NULL;
return;
--
2.31.1
Powered by blists - more mailing lists