@@ -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
@@ -315,6 +325,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->ulp_ddp_limits)
return false;
@@ -453,6 +466,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 = queue->hdr_digest ? NVME_TCP_HDR_DIGEST_ENABLE : 0;
@@ -504,6 +520,9 @@ static void nvme_tcp_offload_limits(struct nvme_tcp_queue *queue, struct net_dev
{
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;