Linux-NVME Archive on lore.kernel.org
 help / color / Atom feed
From: Sagi Grimberg <sagi@grimberg.me>
To: Logan Gunthorpe <logang@deltatee.com>,
	linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org
Cc: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>,
	Stephen Bates <sbates@raithlin.com>, Jens Axboe <axboe@fb.com>,
	Keith Busch <kbusch@kernel.org>, Max Gurtovoy <maxg@mellanox.com>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH v11 7/9] nvmet-passthru: Add passthru code to process commands
Date: Wed, 26 Feb 2020 15:28:09 -0800
Message-ID: <becbf34c-e22e-3c48-41df-f23fee2da658@grimberg.me> (raw)
In-Reply-To: <20200220203652.26734-8-logang@deltatee.com>


> +u16 nvmet_parse_passthru_admin_cmd(struct nvmet_req *req)
> +{
> +	/*
> +	 * Passthru all vendor specific commands
> +	 */
> +	if (req->cmd->common.opcode >= nvme_admin_vendor_start)
> +		return nvmet_setup_passthru_command(req);
> +
> +	switch (req->cmd->common.opcode) {
> +	case nvme_admin_async_event:
> +		req->execute = nvmet_execute_async_event;
> +		return NVME_SC_SUCCESS;
> +	case nvme_admin_keep_alive:
> +		/*
> +		 * Most PCIe ctrls don't support keep alive cmd, we route keep
> +		 * alive to the non-passthru mode. In future please change this
> +		 * code when PCIe ctrls with keep alive support available.
> +		 */
> +		req->execute = nvmet_execute_keep_alive;
> +		return NVME_SC_SUCCESS;
> +	case nvme_admin_set_features:
> +		switch (le32_to_cpu(req->cmd->features.fid)) {
> +		case NVME_FEAT_ASYNC_EVENT:
> +		case NVME_FEAT_KATO:
> +		case NVME_FEAT_NUM_QUEUES:
> +			req->execute = nvmet_execute_set_features;
> +			return NVME_SC_SUCCESS;
> +		default:
> +			return nvmet_setup_passthru_command(req);
> +		}

This looks questionable... There are tons of features that doesn't
make sense here like hmb, temperature stuff, irq stuff, timestamps,
reservations etc... passing-through these will have confusing
semantics.. Maybe white-list what actually makes sense to passthru?

> +		break;
> +	case nvme_admin_get_features:
> +		switch (le32_to_cpu(req->cmd->features.fid)) {
> +		case NVME_FEAT_ASYNC_EVENT:
> +		case NVME_FEAT_KATO:
> +		case NVME_FEAT_NUM_QUEUES:
> +			req->execute = nvmet_execute_get_features;
> +			return NVME_SC_SUCCESS;
> +		default:
> +			return nvmet_setup_passthru_command(req);
> +		}

Same here.

> +		break;
> +	case nvme_admin_identify:
> +		switch (req->cmd->identify.cns) {
> +		case NVME_ID_CNS_CTRL:
> +			req->execute = nvmet_passthru_execute_cmd;
> +			req->p.end_req = nvmet_passthru_override_id_ctrl;
> +			return NVME_SC_SUCCESS;
> +		case NVME_ID_CNS_NS:
> +			req->execute = nvmet_passthru_execute_cmd;
> +			req->p.end_req = nvmet_passthru_override_id_ns;
> +			return NVME_SC_SUCCESS;

Aren't you missing NVME_ID_CNS_NS_DESC_LIST? and
NVME_ID_CNS_NS_ACTIVE_LIST?

> +		default:
> +			return nvmet_setup_passthru_command(req);
> +		}

Also here, all the namespace management stuff has questionable
semantics in my mind...

> +	case nvme_admin_get_log_page:
> +		return nvmet_setup_passthru_command(req);
> +	default:
> +		/* By default, blacklist all admin commands */
> +		return NVME_SC_INVALID_OPCODE | NVME_SC_DNR;
> +	}
> +}
> diff --git a/include/linux/nvme.h b/include/linux/nvme.h
> index 3d5189f46cb1..e29f4b8145fa 100644
> --- a/include/linux/nvme.h
> +++ b/include/linux/nvme.h
> @@ -858,6 +858,7 @@ enum nvme_admin_opcode {
>   	nvme_admin_security_recv	= 0x82,
>   	nvme_admin_sanitize_nvm		= 0x84,
>   	nvme_admin_get_lba_status	= 0x86,
> +	nvme_admin_vendor_start		= 0xC0,
>   };
>   
>   #define nvme_admin_opcode_name(opcode)	{ opcode, #opcode }
> 

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

  reply index

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-20 20:36 [PATCH v11 0/9] nvmet: add target passthru commands support Logan Gunthorpe
2020-02-20 20:36 ` [PATCH v11 1/9] nvme-core: Clear any SGL flags in passthru commands Logan Gunthorpe
2020-02-26 23:08   ` Sagi Grimberg
2020-02-20 20:36 ` [PATCH v11 2/9] nvme: Create helper function to obtain command effects Logan Gunthorpe
2020-02-26 23:09   ` Sagi Grimberg
2020-02-20 20:36 ` [PATCH v11 3/9] nvme: Move nvme_passthru_[start|end]() calls to common helper Logan Gunthorpe
2020-02-26 23:10   ` Sagi Grimberg
2020-02-20 20:36 ` [PATCH v11 4/9] nvmet-passthru: Introduce NVMet passthru Kconfig option Logan Gunthorpe
2020-02-26 23:12   ` Sagi Grimberg
2020-02-20 20:36 ` [PATCH v11 5/9] nvme-core: Introduce nvme_ctrl_get_by_path() Logan Gunthorpe
2020-02-20 20:36 ` [PATCH v11 6/9] nvme: Export existing nvme core functions Logan Gunthorpe
2020-02-26 23:13   ` Sagi Grimberg
2020-02-20 20:36 ` [PATCH v11 7/9] nvmet-passthru: Add passthru code to process commands Logan Gunthorpe
2020-02-26 23:28   ` Sagi Grimberg [this message]
2020-02-27 17:33     ` Logan Gunthorpe
2020-02-20 20:36 ` [PATCH v11 8/9] nvmet-passthru: Add enable/disable helpers Logan Gunthorpe
2020-02-26 23:33   ` Sagi Grimberg
2020-02-27 17:37     ` Logan Gunthorpe
2020-02-27 23:13       ` Sagi Grimberg
2020-02-20 20:36 ` [PATCH v11 9/9] nvmet-configfs: Introduce passthru configfs interface Logan Gunthorpe
2020-02-26 23:35   ` Sagi Grimberg

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=becbf34c-e22e-3c48-41df-f23fee2da658@grimberg.me \
    --to=sagi@grimberg.me \
    --cc=Chaitanya.Kulkarni@wdc.com \
    --cc=axboe@fb.com \
    --cc=hch@lst.de \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=logang@deltatee.com \
    --cc=maxg@mellanox.com \
    --cc=sbates@raithlin.com \
    /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

Linux-NVME Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-nvme/0 linux-nvme/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-nvme linux-nvme/ https://lore.kernel.org/linux-nvme \
		linux-nvme@lists.infradead.org
	public-inbox-index linux-nvme

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-nvme


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git