public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH libnvme v4 0/2] Do not pass disable_sqflow if not supported
@ 2023-08-08 13:30 Daniel Wagner
  2023-08-08 13:30 ` [PATCH libnvme v4 1/2] fabrics: Read the supported options lazy Daniel Wagner
  2023-08-08 13:30 ` [PATCH libnvme v4 2/2] fabrics: Do not pass disable_sqflow if not supported Daniel Wagner
  0 siblings, 2 replies; 6+ messages in thread
From: Daniel Wagner @ 2023-08-08 13:30 UTC (permalink / raw)
  To: Sagi Grimberg; +Cc: Caleb Sander, Keith Busch, linux-nvme, Daniel Wagner

Follow up on the discussion in [1]

[1] https://lore.kernel.org/linux-nvme/676b7c2b-7bcf-6138-0229-389ed9efaa92@grimberg.me/

changes:
v4:
 - updated commit message
 - updated author
v3:
  - do not even try to use disable_sqflow if when it not supported
v2:
  - use cached options table
v1
  - initial verison


Daniel Wagner (2):
  fabrics: Read the supported options lazy
  fabrics: Do not pass disable_sqflow if not supported

 src/nvme/fabrics.c | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

-- 
2.41.0



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH libnvme v4 1/2] fabrics: Read the supported options lazy
  2023-08-08 13:30 [PATCH libnvme v4 0/2] Do not pass disable_sqflow if not supported Daniel Wagner
@ 2023-08-08 13:30 ` Daniel Wagner
  2023-08-08 19:50   ` Chaitanya Kulkarni
  2023-08-09 10:03   ` Daniel Wagner
  2023-08-08 13:30 ` [PATCH libnvme v4 2/2] fabrics: Do not pass disable_sqflow if not supported Daniel Wagner
  1 sibling, 2 replies; 6+ messages in thread
From: Daniel Wagner @ 2023-08-08 13:30 UTC (permalink / raw)
  To: Sagi Grimberg; +Cc: Caleb Sander, Keith Busch, linux-nvme, Daniel Wagner

Read the options in when we need the for the first time.

Reported-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/nvme/fabrics.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/nvme/fabrics.c b/src/nvme/fabrics.c
index 800293e2a8e7..9725eeb3cda8 100644
--- a/src/nvme/fabrics.c
+++ b/src/nvme/fabrics.c
@@ -357,10 +357,18 @@ static int __add_argument(char **argstr, const char *tok, const char *arg)
 	return 0;
 }
 
+static int __nvmf_supported_options(nvme_root_t r);
+#define nvmf_check_option(r, tok)					\
+({									\
+	if (!(r)->options)						\
+		__nvmf_supported_options(r);				\
+	(r)->options->tok;						\
+})
+
 #define add_bool_argument(o, argstr, tok, arg)				\
 ({									\
 	int ret;							\
-	if (r->options->tok) {						\
+	if (nvmf_check_option(r, tok)) {				\
 		ret = __add_bool_argument(argstr,			\
 					  stringify(tok),		\
 					  arg);				\
@@ -376,7 +384,7 @@ static int __add_argument(char **argstr, const char *tok, const char *arg)
 #define add_int_argument(o, argstr, tok, arg, allow_zero) \
 ({									\
 	int ret;							\
-	if (r->options->tok) {						\
+	if (nvmf_check_option(r, tok)) {				\
 		ret = __add_int_argument(argstr,			\
 					stringify(tok),			\
 					arg,				\
@@ -393,7 +401,7 @@ static int __add_argument(char **argstr, const char *tok, const char *arg)
 #define add_int_or_minus_one_argument(o, argstr, tok, arg)		\
 ({									\
 	int ret;							\
-	if (r->options->tok) {						\
+	if (nvmf_check_option(r, tok)) {				\
 		ret = __add_int_or_minus_one_argument(argstr,		\
 						     stringify(tok),	\
 						     arg);		\
@@ -409,7 +417,7 @@ static int __add_argument(char **argstr, const char *tok, const char *arg)
 #define add_argument(r, argstr, tok, arg)				\
 ({									\
 	int ret;							\
-	if (r->options->tok) {						\
+	if (nvmf_check_option(r, tok)) {				\
 		ret = __add_argument(argstr,				\
 				     stringify(tok),			\
 				     arg);				\
@@ -913,9 +921,6 @@ int nvmf_add_ctrl(nvme_host_t h, nvme_ctrl_t c,
 		free(traddr);
 	}
 
-	ret = __nvmf_supported_options(h->r);
-	if (ret)
-		return ret;
 	ret = build_options(h, c, &argstr);
 	if (ret)
 		return ret;
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH libnvme v4 2/2] fabrics: Do not pass disable_sqflow if not supported
  2023-08-08 13:30 [PATCH libnvme v4 0/2] Do not pass disable_sqflow if not supported Daniel Wagner
  2023-08-08 13:30 ` [PATCH libnvme v4 1/2] fabrics: Read the supported options lazy Daniel Wagner
@ 2023-08-08 13:30 ` Daniel Wagner
  2023-08-08 19:50   ` Chaitanya Kulkarni
  1 sibling, 1 reply; 6+ messages in thread
From: Daniel Wagner @ 2023-08-08 13:30 UTC (permalink / raw)
  To: Sagi Grimberg; +Cc: Caleb Sander, Keith Busch, linux-nvme, Daniel Wagner

Do not try to use disable_sqflow if the kernel actually supports this
option.

Reported-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
 src/nvme/fabrics.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/nvme/fabrics.c b/src/nvme/fabrics.c
index 9725eeb3cda8..11d99580072a 100644
--- a/src/nvme/fabrics.c
+++ b/src/nvme/fabrics.c
@@ -1031,8 +1031,11 @@ nvme_ctrl_t nvmf_connect_disc_entry(nvme_host_t h,
 		return NULL;
 	}
 
-	if (e->treq & NVMF_TREQ_DISABLE_SQFLOW)
+	if (e->treq & NVMF_TREQ_DISABLE_SQFLOW &&
+	    nvmf_check_option(h->r, disable_sqflow))
 		c->cfg.disable_sqflow = true;
+	else
+		c->cfg.disable_sqflow = false;
 
 	if (e->trtype == NVMF_TRTYPE_TCP &&
 	    (e->treq & NVMF_TREQ_REQUIRED ||
-- 
2.41.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH libnvme v4 1/2] fabrics: Read the supported options lazy
  2023-08-08 13:30 ` [PATCH libnvme v4 1/2] fabrics: Read the supported options lazy Daniel Wagner
@ 2023-08-08 19:50   ` Chaitanya Kulkarni
  2023-08-09 10:03   ` Daniel Wagner
  1 sibling, 0 replies; 6+ messages in thread
From: Chaitanya Kulkarni @ 2023-08-08 19:50 UTC (permalink / raw)
  To: Daniel Wagner, Sagi Grimberg
  Cc: Caleb Sander, Keith Busch, linux-nvme@lists.infradead.org

On 8/8/2023 6:30 AM, Daniel Wagner wrote:
> Read the options in when we need the for the first time.
> 
> Reported-by: Sagi Grimberg <sagi@grimberg.me>
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---


I believe blktests is passing with this, with that.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH libnvme v4 2/2] fabrics: Do not pass disable_sqflow if not supported
  2023-08-08 13:30 ` [PATCH libnvme v4 2/2] fabrics: Do not pass disable_sqflow if not supported Daniel Wagner
@ 2023-08-08 19:50   ` Chaitanya Kulkarni
  0 siblings, 0 replies; 6+ messages in thread
From: Chaitanya Kulkarni @ 2023-08-08 19:50 UTC (permalink / raw)
  To: Daniel Wagner, Sagi Grimberg
  Cc: Caleb Sander, Keith Busch, linux-nvme@lists.infradead.org

On 8/8/2023 6:30 AM, Daniel Wagner wrote:
> Do not try to use disable_sqflow if the kernel actually supports this
> option.
> 
> Reported-by: Sagi Grimberg <sagi@grimberg.me>
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---

I believe blktests is passing with this, with that.

Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>

-ck


||

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH libnvme v4 1/2] fabrics: Read the supported options lazy
  2023-08-08 13:30 ` [PATCH libnvme v4 1/2] fabrics: Read the supported options lazy Daniel Wagner
  2023-08-08 19:50   ` Chaitanya Kulkarni
@ 2023-08-09 10:03   ` Daniel Wagner
  1 sibling, 0 replies; 6+ messages in thread
From: Daniel Wagner @ 2023-08-09 10:03 UTC (permalink / raw)
  To: Sagi Grimberg; +Cc: Caleb Sander, Keith Busch, linux-nvme

On Tue, Aug 08, 2023 at 03:30:27PM +0200, Daniel Wagner wrote:
> Read the options in when we need the for the first time.
> 
> Reported-by: Sagi Grimberg <sagi@grimberg.me>
> Signed-off-by: Daniel Wagner <dwagner@suse.de>
> ---
>  src/nvme/fabrics.c | 19 ++++++++++++-------
>  1 file changed, 12 insertions(+), 7 deletions(-)
> 
> diff --git a/src/nvme/fabrics.c b/src/nvme/fabrics.c
> index 800293e2a8e7..9725eeb3cda8 100644
> --- a/src/nvme/fabrics.c
> +++ b/src/nvme/fabrics.c
> @@ -357,10 +357,18 @@ static int __add_argument(char **argstr, const char *tok, const char *arg)
>  	return 0;
>  }
>  
> +static int __nvmf_supported_options(nvme_root_t r);
> +#define nvmf_check_option(r, tok)					\
> +({									\
> +	if (!(r)->options)						\
> +		__nvmf_supported_options(r);				\

I'm adding a check if __nvmf_support_options() returns an error.
Feedback from Caleb.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-08-09 10:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-08 13:30 [PATCH libnvme v4 0/2] Do not pass disable_sqflow if not supported Daniel Wagner
2023-08-08 13:30 ` [PATCH libnvme v4 1/2] fabrics: Read the supported options lazy Daniel Wagner
2023-08-08 19:50   ` Chaitanya Kulkarni
2023-08-09 10:03   ` Daniel Wagner
2023-08-08 13:30 ` [PATCH libnvme v4 2/2] fabrics: Do not pass disable_sqflow if not supported Daniel Wagner
2023-08-08 19:50   ` Chaitanya Kulkarni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox