[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221020101838.2712846-10-aaptel@nvidia.com>
Date: Thu, 20 Oct 2022 13:18:24 +0300
From: Aurelien Aptel <aaptel@...dia.com>
To: netdev@...r.kernel.org, davem@...emloft.net, kuba@...nel.org,
edumazet@...gle.com, pabeni@...hat.com, saeedm@...dia.com,
tariqt@...dia.com, linux-nvme@...ts.infradead.org,
sagi@...mberg.me, hch@....de, kbusch@...nel.org, axboe@...com,
chaitanyak@...dia.com
Cc: smalin@...dia.com, aaptel@...dia.com, ogerlitz@...dia.com,
yorayz@...dia.com, borisp@...dia.com, aurelien.aptel@...il.com,
malin1024@...il.com
Subject: [PATCH v6 09/23] nvme-tcp: Add ulp_offload modparam to control enablement of ULP offload
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.
In summary, to enable ULP offload:
- nvme-tcp modparam must be set to 1
- the NIC driver must set
- NETIF_F_HW_ULP_DDP flag in netdev->features
- ULP_DDP_C_NVME_TCP and/or ULP_DDP_C_NVME_TCP_DDGST_RX
flags in ulp_limits->offload_capabilities
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 | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index 11d9197f59ab..7ee14b8a392e 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -34,6 +34,17 @@ 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
@@ -298,6 +309,9 @@ static bool nvme_tcp_ddp_query_limits(struct net_device *netdev,
{
int ret;
+ if (!ulp_offload)
+ return false;
+
if (!netdev || !(netdev->features & NETIF_F_HW_ULP_DDP) ||
!netdev->ulp_ddp_ops || !netdev->ulp_ddp_ops->ulp_ddp_limits)
return false;
@@ -497,6 +511,9 @@ static int nvme_tcp_offload_limits(struct nvme_tcp_queue *queue, struct net_devi
{
struct nvme_tcp_ddp_limits limits = {{ULP_DDP_NVME}};
+ if (!ulp_offload)
+ return 0;
+
if (!nvme_tcp_ddp_query_limits(netdev, &limits)) {
queue->ctrl->offloading_netdev = NULL;
return -EOPNOTSUPP;
--
2.31.1
Powered by blists - more mailing lists