All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Gurtovoy <mgurtovoy@nvidia.com>
To: <linux-nvme@lists.infradead.org>, <hch@lst.de>,
	<kbusch@kernel.org>, <sagi@grimberg.me>
Cc: <chaitanyak@nvidia.com>, <oren@nvidia.com>, <benishay@nvidia.com>,
	<borisp@nvidia.com>, <aviadye@nvidia.com>, <idanb@nvidia.com>,
	<jsmart2021@gmail.com>, Max Gurtovoy <mgurtovoy@nvidia.com>
Subject: [PATCH 1/1 libnvme] fabrics: add support for new cli --skip-cid-gen flag
Date: Mon, 8 Nov 2021 16:46:59 +0200	[thread overview]
Message-ID: <20211108144703.7971-3-mgurtovoy@nvidia.com> (raw)
In-Reply-To: <20211108144703.7971-1-mgurtovoy@nvidia.com>

Setting this flag will enable NVME_QUIRK_SKIP_CID_GEN quirk and will
actually add the ability to ignore the command id generation for
other transport alongside PCI transport that is possible today.

Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
---
 doc/libnvme.rst          |  3 +++
 examples/discover-loop.c |  2 +-
 pynvme/nvme.i            |  2 ++
 src/nvme/fabrics.c       | 10 +++++++---
 src/nvme/fabrics.h       |  4 +++-
 src/nvme/tree.c          |  7 +++++++
 src/nvme/tree.h          |  9 +++++++++
 7 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/doc/libnvme.rst b/doc/libnvme.rst
index d52462f..e2555f9 100644
--- a/doc/libnvme.rst
+++ b/doc/libnvme.rst
@@ -11435,6 +11435,7 @@ errno set otherwise.
     bool disable_sqflow;
     bool hdr_digest;
     bool data_digest;
+    bool skip_cid_gen;
   };
 
 **Members**
@@ -11496,6 +11497,8 @@ errno set otherwise.
 ``data_digest``
   Generate/verify data digest (TCP)
 
+``skip_cid_gen``
+  Skip command id generation control
 
 
 .. c:function:: int nvmf_add_ctrl_opts (struct nvme_fabrics_config * cfg)
diff --git a/examples/discover-loop.c b/examples/discover-loop.c
index c2a2385..66e9d8b 100644
--- a/examples/discover-loop.c
+++ b/examples/discover-loop.c
@@ -70,7 +70,7 @@ int main()
 		fprintf(stderr, "Failed to allocate memory\n");
 		return ENOMEM;
 	}
-	ret = nvmf_add_ctrl(h, c, &cfg, false);
+	ret = nvmf_add_ctrl(h, c, &cfg, false, false);
 	if (ret < 0) {
 		fprintf(stderr, "no controller found\n");
 		return errno;
diff --git a/pynvme/nvme.i b/pynvme/nvme.i
index 4c45a04..cfa0a44 100644
--- a/pynvme/nvme.i
+++ b/pynvme/nvme.i
@@ -145,6 +145,8 @@ static int discover_err = 0;
       temp.hdr_digest = PyObject_IsTrue(value) ? true : false;
     if (!PyUnicode_CompareWithASCIIString(key, "data_digest"))
       temp.data_digest = PyObject_IsTrue(value) ? true : false;
+    if (!PyUnicode_CompareWithASCIIString(key, "skip_cid_gen"))
+      temp.skip_cid_gen = PyObject_IsTrue(value) ? true : false;
   }
   $1 = &temp;
  };
diff --git a/src/nvme/fabrics.c b/src/nvme/fabrics.c
index 94cecd0..2005dc4 100644
--- a/src/nvme/fabrics.c
+++ b/src/nvme/fabrics.c
@@ -162,6 +162,7 @@ static struct nvme_fabrics_config *merge_config(nvme_ctrl_t c,
 	UPDATE_CFG_OPTION(ctrl_cfg, cfg, disable_sqflow, false);
 	UPDATE_CFG_OPTION(ctrl_cfg, cfg, hdr_digest, false);
 	UPDATE_CFG_OPTION(ctrl_cfg, cfg, data_digest, false);
+	UPDATE_CFG_OPTION(ctrl_cfg, cfg, skip_cid_gen, false);
 
 	return ctrl_cfg;
 }
@@ -445,6 +446,8 @@ static int build_options(nvme_host_t h, nvme_ctrl_t c, char **argstr)
 			      cfg->duplicate_connect) ||
 	    add_bool_argument(argstr, "disable_sqflow",
 			      cfg->disable_sqflow) ||
+	    add_bool_argument(argstr, "skip_cid_gen",
+			      cfg->skip_cid_gen) ||
 	    (!strcmp(transport, "tcp") &&
 	     add_bool_argument(argstr, "hdr_digest", cfg->hdr_digest)) ||
 	    (!strcmp(transport, "tcp") &&
@@ -531,13 +534,14 @@ int nvmf_add_ctrl_opts(nvme_ctrl_t c, struct nvme_fabrics_config *cfg)
 
 int nvmf_add_ctrl(nvme_host_t h, nvme_ctrl_t c,
 		  const struct nvme_fabrics_config *cfg,
-		  bool disable_sqflow)
+		  bool disable_sqflow, bool skip_cid_gen)
 {
 	char *argstr;
 	int ret;
 
 	cfg = merge_config(c, cfg);
 	nvme_ctrl_disable_sqflow(c, disable_sqflow);
+	nvme_ctrl_skip_cid_gen(c, skip_cid_gen);
 	nvme_ctrl_set_discovered(c, true);
 	if (traddr_is_hostname(c)) {
 		ret = hostname2traddr(c);
@@ -644,7 +648,7 @@ nvme_ctrl_t nvmf_connect_disc_entry(nvme_host_t h,
 	if (e->treq & NVMF_TREQ_DISABLE_SQFLOW)
 		disable_sqflow = true;
 
-	ret = nvmf_add_ctrl(h, c, cfg, disable_sqflow);
+	ret = nvmf_add_ctrl(h, c, cfg, disable_sqflow, false);
 	if (!ret)
 		return c;
 
@@ -654,7 +658,7 @@ nvme_ctrl_t nvmf_connect_disc_entry(nvme_host_t h,
 		nvme_msg(LOG_INFO, "failed to connect controller, "
 			 "retry with disabling SQ flow control\n");
 		disable_sqflow = false;
-		ret = nvmf_add_ctrl(h, c, cfg, disable_sqflow);
+		ret = nvmf_add_ctrl(h, c, cfg, disable_sqflow, false);
 		if (!ret)
 			return c;
 	}
diff --git a/src/nvme/fabrics.h b/src/nvme/fabrics.h
index 9b796be..e9e4b21 100644
--- a/src/nvme/fabrics.h
+++ b/src/nvme/fabrics.h
@@ -31,6 +31,7 @@
  * @disable_sqflow:	Disable controller sq flow control
  * @hdr_digest:		Generate/verify header digest (TCP)
  * @data_digest:	Generate/verify data digest (TCP)
+ * @skip_cid_gen:	Skip command id generation control
  */
 struct nvme_fabrics_config {
 	int queue_size;
@@ -47,6 +48,7 @@ struct nvme_fabrics_config {
 	bool disable_sqflow;
 	bool hdr_digest;
 	bool data_digest;
+	bool skip_cid_gen;
 };
 
 /**
@@ -133,7 +135,7 @@ int nvmf_add_ctrl_opts(nvme_ctrl_t c, struct nvme_fabrics_config *cfg);
  */
 int nvmf_add_ctrl(nvme_host_t h, nvme_ctrl_t c,
 		  const struct nvme_fabrics_config *cfg,
-		  bool disable_sqflow);
+		  bool disable_sqflow, bool skip_cid_gen);
 
 /**
  * nvmf_get_discovery_log() -
diff --git a/src/nvme/tree.c b/src/nvme/tree.c
index 0f72320..df1ac31 100644
--- a/src/nvme/tree.c
+++ b/src/nvme/tree.c
@@ -700,6 +700,13 @@ void nvme_ctrl_disable_sqflow(nvme_ctrl_t c, bool disable_sqflow)
 		c->s->h->r->modified = true;
 }
 
+void nvme_ctrl_skip_cid_gen(nvme_ctrl_t c, bool skip_cid_gen)
+{
+	c->cfg.skip_cid_gen = skip_cid_gen;
+	if (c->s && c->s->h && c->s->h->r)
+		c->s->h->r->modified = true;
+}
+
 void nvme_ctrl_set_discovered(nvme_ctrl_t c, bool discovered)
 {
 	c->discovered = discovered;
diff --git a/src/nvme/tree.h b/src/nvme/tree.h
index f9e7d37..c819556 100644
--- a/src/nvme/tree.h
+++ b/src/nvme/tree.h
@@ -822,6 +822,15 @@ bool nvme_ctrl_is_persistent(nvme_ctrl_t c);
  */
 void nvme_ctrl_disable_sqflow(nvme_ctrl_t c, bool disable_sqflow);
 
+/**
+ * nvme_ctrl_skip_cid_gen() -
+ * @c:
+ * @skip_cid_gen:
+ *
+ * Return:
+ */
+void nvme_ctrl_skip_cid_gen(nvme_ctrl_t c, bool skip_cid_gen);
+
 /**
  * nvme_ctrl_identify() -
  * @c:
-- 
2.18.1



  parent reply	other threads:[~2021-11-08 14:48 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-08 14:46 [PATCH v1 0/4] Add command id quirk for fabrics Max Gurtovoy
2021-11-08 14:46 ` [PATCH 1/1 nvmecli] fabrics: add new --skip-cid-gen flag to connect cmd Max Gurtovoy
2021-11-08 14:46 ` Max Gurtovoy [this message]
2021-11-08 14:47 ` [PATCH 1/4] nvme-fabrics: add command id quirk for fabrics controllers Max Gurtovoy
2021-11-08 14:47 ` [PATCH 2/4] nvme-rdma: add command id quirk for RDMA controllers Max Gurtovoy
2021-11-08 14:47 ` [PATCH 3/4] nvme-tcp: add command id quirk for TCP controllers Max Gurtovoy
2021-11-08 14:47 ` [PATCH 4/4] nvme-fc: add command id quirk for FC controllers Max Gurtovoy
2021-11-08 16:45 ` [PATCH v1 0/4] Add command id quirk for fabrics Keith Busch
2021-11-09  8:09   ` Christoph Hellwig
2021-11-09 12:08     ` Max Gurtovoy
2021-11-09 13:15       ` Christoph Hellwig
2021-11-09 14:23         ` Max Gurtovoy
2021-11-09 14:31           ` Christoph Hellwig
2021-11-09 16:15             ` Keith Busch
2021-11-09 16:59               ` Max Gurtovoy
2021-11-09 19:04                 ` Keith Busch
2021-11-10 19:45                   ` Sagi Grimberg
2021-11-11  9:29                     ` Max Gurtovoy
2021-11-11 17:36                       ` Keith Busch
2021-11-12 16:07                       ` Sagi Grimberg
2021-11-12 21:37                         ` Keith Busch
2021-11-18 11:19                         ` Max Gurtovoy
2021-11-21 10:05                           ` Sagi Grimberg
2021-11-10 10:32       ` Daniel Wagner
2021-11-10 10:56         ` Max Gurtovoy
2021-11-10 11:18           ` Daniel Wagner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211108144703.7971-3-mgurtovoy@nvidia.com \
    --to=mgurtovoy@nvidia.com \
    --cc=aviadye@nvidia.com \
    --cc=benishay@nvidia.com \
    --cc=borisp@nvidia.com \
    --cc=chaitanyak@nvidia.com \
    --cc=hch@lst.de \
    --cc=idanb@nvidia.com \
    --cc=jsmart2021@gmail.com \
    --cc=kbusch@kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=oren@nvidia.com \
    --cc=sagi@grimberg.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.