public inbox for linux-nvme@lists.infradead.org
 help / color / mirror / Atom feed
From: Chaitanya Kulkarni <chaitanyak@nvidia.com>
To: Hannes Reinecke <hare@suse.de>
Cc: Sagi Grimberg <sagi@grimberg.me>,
	Keith Busch <keith.busch@wdc.com>,
	"linux-nvme@lists.infradead.org" <linux-nvme@lists.infradead.org>,
	Martin Belanger <martin.belanger@dell.com>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCHv2] nvme: print out valid arguments when reading from /dev/nvme-fabrics
Date: Mon, 13 Dec 2021 08:06:27 +0000	[thread overview]
Message-ID: <6ba69fc7-d2cf-664d-5289-89ff932b1539@nvidia.com> (raw)
In-Reply-To: <20211207135549.100950-1-hare@suse.de>

On 12/7/21 5:55 AM, Hannes Reinecke wrote:
> Currently applications have a hard time figuring out which
> nvme-over-fabrics arguments are supported for any given kernel;
> the ioctl will return an error code on failure, and the application
> has to guess whether this was due to an invalid argument or due
> to a connection or controller error.
> With this patch applications can read a list of supported
> arguments by simply reading from /dev/nvme-fabrics, allowing
> them to validate the connection string.
> 
> Signed-off-by: Hannes Reinecke <hare@suse.de>
> ---
>   drivers/nvme/host/fabrics.c | 22 +++++++++++++++++++++-
>   1 file changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
> index 282d54117e0a..7ae041e2b3fb 100644
> --- a/drivers/nvme/host/fabrics.c
> +++ b/drivers/nvme/host/fabrics.c
> @@ -1069,6 +1069,26 @@ static ssize_t nvmf_dev_write(struct file *file, const char __user *ubuf,
>   	return ret ? ret : count;
>   }
>   
> +static void __nvmf_concat_opt_tokens(struct seq_file *seq_file)
> +{
> +	const struct match_token *tok;
> +	int idx;
> +
> +	/*
> +	 * Add dummy entries for instance and cntlid to
> +	 * signal an invalid/non-existing controller
> +	 */
> +	seq_puts(seq_file, "instance=-1,cntlid=-1");
> +	for (idx = 0; idx < ARRAY_SIZE(opt_tokens); idx++) {
> +		tok = &opt_tokens[idx];
> +		if (tok->token == NVMF_OPT_ERR)
> +			continue;
> +		seq_puts(seq_file, ",");

Can we use "\n" instead of "," ?
with that change it looks :-

instance=-1,cntlid=-1
transport=%s
traddr=%s
trsvcid=%s
nqn=%s
queue_size=%d
nr_io_queues=%d
reconnect_delay=%d
ctrl_loss_tmo=%d
keep_alive_tmo=%d
hostnqn=%s
host_traddr=%s
host_iface=%s
hostid=%s
duplicate_connect
disable_sqflow
hdr_digest
data_digest
nr_write_queues=%d
nr_poll_queues=%d
tos=%d
fast_io_fail_tmo=%d
discovery


  reply	other threads:[~2021-12-13  8:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-07 13:55 [PATCHv2] nvme: print out valid arguments when reading from /dev/nvme-fabrics Hannes Reinecke
2021-12-13  8:06 ` Chaitanya Kulkarni [this message]
2021-12-13  8:39   ` Hannes Reinecke
2021-12-13 21:47     ` Chaitanya Kulkarni
2021-12-16  8:37 ` 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=6ba69fc7-d2cf-664d-5289-89ff932b1539@nvidia.com \
    --to=chaitanyak@nvidia.com \
    --cc=hare@suse.de \
    --cc=hch@lst.de \
    --cc=keith.busch@wdc.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=martin.belanger@dell.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox