Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp403986ybf; Wed, 26 Feb 2020 15:28:46 -0800 (PST) X-Google-Smtp-Source: APXvYqyeazk8slTcnu6Q7RkbHU9F1xsvqv2KiIHQXU344m3cumDKtlpT6M8n6Oq3pcI//cnnYWYf X-Received: by 2002:aca:c78e:: with SMTP id x136mr281014oif.116.1582759726639; Wed, 26 Feb 2020 15:28:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582759726; cv=none; d=google.com; s=arc-20160816; b=b8NUeh3gJsbxExecNf/5MSBlHQMR0RprSSvho3cZNBT4S4fWvYRl36p9DtYQm5mYEj ztmA90BBF8lEAiqpxghW850UFW3UAAKvpwvA6kymfqVODVryCXfbiO9SV6xM7D2aQDeE X6ttSAWMxBGEcOYOldOjQb3x0sCnoRZOnUgZhS6wO/yHrGhcU2i+b1BP3Hi2ibmthZMI O6C5ujFoY4s4PodpEyGThUnU0Z/zy1h6Ln4Mlo+BBVeFj5O9yg1DKhz24b9HuM93nKt1 aNVf+ZEly+DvIhU2Yy38NQW0+6KBavgPqvi4N44CUVmJPTJjereQdrIYjKF5YWXvCO4Q /JGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=RyN8wdyx5UTXqhX47LF5ataeVQFJ6brgByOTBGpOppg=; b=CDoDHliNVHjG7WME4hTuTtyWPlKmemLJUK9f2oc5lUUPi2MC9aVcbOAGeT8FAX1BRt x8I7/Hg2fpeansOrv/z6kSarcte8o8Ev6TF0fo8AbsS9jFqC4hw/bmRsV2MZAN4l5UFh 14elCqp7kfYEFbHSugMq4BDVthUNdEB6KGzofShdHQFYjATUabNecTtMUrk5Loy7ZuaN buAfEXgWlioAtvdpfMq/AshQ4Lg2bkUzcdDEqE73u/w0gxrfQxrDwKFA7/KRyConpS3m DVvtNyV749x2YUgRAD+agPHltpKKH081tUVxs/Lhz27Lil6LzzxaLVlUTphPyoNaxIqk tlDA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g17si488257otk.252.2020.02.26.15.28.34; Wed, 26 Feb 2020 15:28:46 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727941AbgBZX2N (ORCPT + 99 others); Wed, 26 Feb 2020 18:28:13 -0500 Received: from mail-oi1-f195.google.com ([209.85.167.195]:34508 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726413AbgBZX2N (ORCPT ); Wed, 26 Feb 2020 18:28:13 -0500 Received: by mail-oi1-f195.google.com with SMTP id l136so1417399oig.1 for ; Wed, 26 Feb 2020 15:28:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=RyN8wdyx5UTXqhX47LF5ataeVQFJ6brgByOTBGpOppg=; b=qB1WLiJH8TfQ6K5vlsQ4FLxDhXfaz3aPlMwWOcdR1MEBtvEn7Blm7IOADUvxlBugYx 98bkcb8ClA2haDf+Dy9ql0psTCI4WiEWFr6SZCaVaYkV9lDtvArWRM3ZJ2zQKgZbH9rf JrbUR2tnci1ZpNPVvCGP/zEnO9OOWAiYtSgIfYGqtbV2zrsJtXtNO7Kf0tCjDofMkXtk AaJqDf09I/utuiEyGcbfJADmozqI88nY6AnZZzB1BtsZEf/HjxeiqhNWi/Hjum2uGBrk Zdmg57gZEOFDSOZdobmkmhUsojgj1GXPOWSDXo+Ihcq9rUwWQL0oUHaTr3+3xaI37kWJ Et3w== X-Gm-Message-State: APjAAAV2raVuEuLEPcZnKxfzjQzC+ioKQ3A0C2y6U6U7tfMiRwDM39GR ElAWkw11uQVEnaAg2TvcsnE= X-Received: by 2002:a54:468a:: with SMTP id k10mr1239874oic.3.1582759692462; Wed, 26 Feb 2020 15:28:12 -0800 (PST) Received: from ?IPv6:2600:1700:65a0:78e0:514:7862:1503:8e4d? ([2600:1700:65a0:78e0:514:7862:1503:8e4d]) by smtp.gmail.com with ESMTPSA id n22sm1325231otj.36.2020.02.26.15.28.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Feb 2020 15:28:11 -0800 (PST) Subject: Re: [PATCH v11 7/9] nvmet-passthru: Add passthru code to process commands To: Logan Gunthorpe , linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org Cc: Christoph Hellwig , Keith Busch , Jens Axboe , Chaitanya Kulkarni , Max Gurtovoy , Stephen Bates References: <20200220203652.26734-1-logang@deltatee.com> <20200220203652.26734-8-logang@deltatee.com> From: Sagi Grimberg Message-ID: Date: Wed, 26 Feb 2020 15:28:09 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <20200220203652.26734-8-logang@deltatee.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > +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 } >