lkml.org 
[lkml]   [2020]   [Feb]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v11 7/9] nvmet-passthru: Add passthru code to process commands
From
Date

> +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 }
>

\
 
 \ /
  Last update: 2020-02-27 00:28    [W:0.091 / U:7.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site