All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Smart <jsmart2021@gmail.com>
To: Hannes Reinecke <hare@suse.de>, Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>,
	Keith Busch <keith.busch@wdc.com>,
	Chaitanya Kulkarni <chaitanyak@nvidia.com>,
	linux-nvme@lists.infradead.org,
	Chaitanya Kulkarni <kch@nvidia.com>
Subject: Re: [PATCH 6/7] nvme: Add connect option 'discovery'
Date: Wed, 22 Sep 2021 09:59:29 -0700	[thread overview]
Message-ID: <f38f89f9-90c7-40ca-3d62-1491cb36be19@gmail.com> (raw)
In-Reply-To: <20210922063525.143045-7-hare@suse.de>

On 9/21/2021 11:35 PM, Hannes Reinecke wrote:
> Add a connect option 'discovery' to specify that the connection
> should be made to a discovery controller, not a normal I/O controller.
> With discovery controllers supporting unique subsystem NQNs we
> cannot easily distinguish by the subsystem NQN if this should be
> a discovery connection, but we need this information to blank out
> options not supported by discovery controllers.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
> ---
>   drivers/nvme/host/core.c    | 7 +++++++
>   drivers/nvme/host/fabrics.c | 6 +++++-
>   drivers/nvme/host/fabrics.h | 1 +
>   3 files changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 1ed1b7be2812..ad01e2778cb6 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -2715,6 +2715,13 @@ static int nvme_init_subsystem(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
>   	else
>   		subsys->subtype = NVME_NQN_NVME;
>   
> +	if (nvme_discovery_ctrl(ctrl) && subsys->subtype != NVME_NQN_DISC) {
> +		dev_err(ctrl->device,
> +			"Subsystem %s is not a discovery controller",
> +			subsys->subnqn);
> +		kfree(subsys);
> +		return -EINVAL;
> +	}
>   	subsys->awupf = le16_to_cpu(id->awupf);
>   #ifdef CONFIG_NVME_MULTIPATH
>   	subsys->iopolicy = NVME_IOPOLICY_NUMA;
> diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
> index 668c6bb7a567..c5a2b71c5268 100644
> --- a/drivers/nvme/host/fabrics.c
> +++ b/drivers/nvme/host/fabrics.c
> @@ -548,6 +548,7 @@ static const match_table_t opt_tokens = {
>   	{ NVMF_OPT_NR_POLL_QUEUES,	"nr_poll_queues=%d"	},
>   	{ NVMF_OPT_TOS,			"tos=%d"		},
>   	{ NVMF_OPT_FAIL_FAST_TMO,	"fast_io_fail_tmo=%d"	},
> +	{ NVMF_OPT_DISCOVERY,		"discovery"		},
>   	{ NVMF_OPT_ERR,			NULL			}
>   };
>   
> @@ -823,6 +824,9 @@ static int nvmf_parse_options(struct nvmf_ctrl_options *opts,
>   			}
>   			opts->tos = token;
>   			break;
> +		case NVMF_OPT_DISCOVERY:
> +			opts->discovery_nqn = true;
> +			break;
>   		default:
>   			pr_warn("unknown parameter or missing value '%s' in ctrl creation request\n",
>   				p);
> @@ -949,7 +953,7 @@ EXPORT_SYMBOL_GPL(nvmf_free_options);
>   #define NVMF_ALLOWED_OPTS	(NVMF_OPT_QUEUE_SIZE | NVMF_OPT_NR_IO_QUEUES | \
>   				 NVMF_OPT_KATO | NVMF_OPT_HOSTNQN | \
>   				 NVMF_OPT_HOST_ID | NVMF_OPT_DUP_CONNECT |\
> -				 NVMF_OPT_DISABLE_SQFLOW |\
> +				 NVMF_OPT_DISABLE_SQFLOW | NVMF_OPT_DISCOVERY |\
>   				 NVMF_OPT_FAIL_FAST_TMO)
>   
>   static struct nvme_ctrl *
> diff --git a/drivers/nvme/host/fabrics.h b/drivers/nvme/host/fabrics.h
> index a146cb903869..b61b666e10ec 100644
> --- a/drivers/nvme/host/fabrics.h
> +++ b/drivers/nvme/host/fabrics.h
> @@ -67,6 +67,7 @@ enum {
>   	NVMF_OPT_TOS		= 1 << 19,
>   	NVMF_OPT_FAIL_FAST_TMO	= 1 << 20,
>   	NVMF_OPT_HOST_IFACE	= 1 << 21,
> +	NVMF_OPT_DISCOVERY	= 1 << 22,
>   };
>   
>   /**
> 


I think you need to be patching __nvme_find_get_subsystem(), which looks 
for subsystem name and opts out (allowing multiple connects to discovery 
subsystems) if discovery controller nqn.

e.g. the loop matching subsys name (assuming discovery ctlr now has a 
unique name) continues if subsys->subtype is NVME_NQN_DISC

-- james


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

  reply	other threads:[~2021-09-22 17:00 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-22  6:35 [PATCHv3 0/7] nvme: support unique discovery controller NQN Hannes Reinecke
2021-09-22  6:35 ` [PATCH 1/7] nvmet: make discovery NQN configurable Hannes Reinecke
2021-09-22  7:07   ` Chaitanya Kulkarni
2021-09-22 13:36   ` Himanshu Madhani
2021-09-22  6:35 ` [PATCH 2/7] nvme: add CNTRLTYPE definitions for 'identify controller' Hannes Reinecke
2021-09-22 13:37   ` Himanshu Madhani
2021-09-22  6:35 ` [PATCH 3/7] nvmet: add nvmet_is_disc_subsys() helper Hannes Reinecke
2021-09-22  7:06   ` Chaitanya Kulkarni
2021-09-22 13:36   ` Himanshu Madhani
2021-09-22  6:35 ` [PATCH 4/7] nvmet: set 'CNTRLTYPE' in the identify controller data Hannes Reinecke
2021-09-22  7:08   ` Chaitanya Kulkarni
2021-09-22  6:35 ` [PATCH 5/7] nvme: expose subsystem type in sysfs attribute 'subtype' Hannes Reinecke
2021-09-22  8:02   ` Daniel Wagner
2021-10-12 13:10     ` Christoph Hellwig
2021-10-12 13:43       ` Hannes Reinecke
2021-10-12 13:44         ` Christoph Hellwig
2021-09-22  6:35 ` [PATCH 6/7] nvme: Add connect option 'discovery' Hannes Reinecke
2021-09-22 16:59   ` James Smart [this message]
2021-09-23  6:11     ` Hannes Reinecke
2021-09-22  6:35 ` [PATCH 7/7] nvme: display correct subsystem NQN Hannes Reinecke
2021-10-12 13:10 ` [PATCHv3 0/7] nvme: support unique discovery controller NQN Christoph Hellwig

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=f38f89f9-90c7-40ca-3d62-1491cb36be19@gmail.com \
    --to=jsmart2021@gmail.com \
    --cc=chaitanyak@nvidia.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=kch@nvidia.com \
    --cc=keith.busch@wdc.com \
    --cc=linux-nvme@lists.infradead.org \
    --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.