[PATCH 7/8] nvme-fabrics: add option to disallow T10-PI offload

Max Gurtovoy mgurtovoy at nvidia.com
Mon Jan 22 06:56:58 PST 2024


From: Israel Rukshin <israelr at nvidia.com>

Today, T10-PI offload is supported only by nvme-rdma, but nothing
prevents other transports reusing the concept, so do not associate
with rdma transport solely. The flag disallows T10-PI offload, so
users can save system resources and allow a more flexible
configuration.

Signed-off-by: Israel Rukshin <israelr at nvidia.com>
Reviewed-by: Max Gurtovoy <mgurtovoy at nvidia.com>
---
 drivers/nvme/host/fabrics.c | 7 +++++++
 drivers/nvme/host/fabrics.h | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index aa88606a44c4..046f5a466576 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -673,6 +673,9 @@ static const match_table_t opt_tokens = {
 #endif
 #ifdef CONFIG_NVME_TCP_TLS
 	{ NVMF_OPT_TLS,			"tls"			},
+#endif
+#ifdef CONFIG_BLK_DEV_INTEGRITY
+	{ NVMF_OPT_DISALLOW_PI,		"disallow_pi"		},
 #endif
 	{ NVMF_OPT_ERR,			NULL			}
 };
@@ -702,6 +705,7 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
 	opts->tls = false;
 	opts->tls_key = NULL;
 	opts->keyring = NULL;
+	opts->disallow_pi = false;
 
 	options = o = kstrdup(buf, GFP_KERNEL);
 	if (!options)
@@ -915,6 +919,9 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
 		case NVMF_OPT_DATA_DIGEST:
 			opts->data_digest = true;
 			break;
+		case NVMF_OPT_DISALLOW_PI:
+			opts->disallow_pi = true;
+			break;
 		case NVMF_OPT_NR_WRITE_QUEUES:
 			if (match_int(args, &token)) {
 				ret = -EINVAL;
diff --git a/drivers/nvme/host/fabrics.h b/drivers/nvme/host/fabrics.h
index fbaee5a7be19..cd0140a2abe7 100644
--- a/drivers/nvme/host/fabrics.h
+++ b/drivers/nvme/host/fabrics.h
@@ -73,6 +73,7 @@ enum {
 	NVMF_OPT_TLS		= 1 << 25,
 	NVMF_OPT_KEYRING	= 1 << 26,
 	NVMF_OPT_TLS_KEY	= 1 << 27,
+	NVMF_OPT_DISALLOW_PI	= 1 << 28,
 };
 
 /**
@@ -115,6 +116,7 @@ enum {
  * @nr_poll_queues: number of queues for polling I/O
  * @tos: type of service
  * @fast_io_fail_tmo: Fast I/O fail timeout in seconds
+ * @disallow_pi: Disallow metadata (T10-PI) offload support
  */
 struct nvmf_ctrl_options {
 	unsigned		mask;
@@ -140,6 +142,7 @@ struct nvmf_ctrl_options {
 	bool			disable_sqflow;
 	bool			hdr_digest;
 	bool			data_digest;
+	bool			disallow_pi;
 	unsigned int		nr_write_queues;
 	unsigned int		nr_poll_queues;
 	int			tos;
-- 
2.18.1




More information about the Linux-nvme mailing list