Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp383548iob; Wed, 18 May 2022 04:26:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw5bGkpRtcfosNgwYliFtaWvfSV3kMroaxU+EU0JznhOsTDBMyC27kZih4dJPRKMVNZnfkr X-Received: by 2002:a65:6051:0:b0:39d:1b00:e473 with SMTP id a17-20020a656051000000b0039d1b00e473mr23137123pgp.578.1652873200670; Wed, 18 May 2022 04:26:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652873200; cv=none; d=google.com; s=arc-20160816; b=Co6fhQDtCdGlvwRmv8XvowC9xIHJIG1hT0P9lcvBVYNLivUnmm5kg492KSyvRJ6vfD pdy0Vd0slMm65xTS6gpmPKMLUUuk1VvgpABUi7UmKXdtpO9pQ7d9bSp5YbSVo1GhtlsN Jy+S1RCxJV8xCNkmNMF+IXRiKCB27W6y2NUbAEu2aYG53giSfcRo0b0mHRl9FWiARTfp 7Tkxrcoi49HnZIpMj6hW3JjjLMYVaYiqwQWLfiU+B1IYNo91JrWJ3X4GFUS17ookdpAY VvaLOFsUytAka1rkIlCGtJ932aN0qdZXNCdHxp09djS3iQGV9t8ieduJY02+6H1DBOPY VUDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=5SosWoAHWyB6TbnbAfulqwAIBVU1Qhynj9mAe9um6CU=; b=KaPpVYVYznywrjMNV4wUylNcBgb8Izwm0VQptGveTsE/7TgxwfbmSJb5rpkSXSpNhv TLwkJqKGIFXr1cQC2d1qpBuW9h3+GNfk1SQmT0vb90Eg5ocoru1aJA9kZbU4+FHTHAuW bUvW62gILWqH84RBxCmVNidmcyirNlqjy+tXRlnT8DLN66gOyOILDF7934YBfZ8oHduE eobUuIlfZUmmqbn5i/2uXD3oYOCfiqB4S10O3IZVj7kfIG3neU7RqRfl3vVScQTwpeH2 6AjCXS9VhJ+ifezdAgk0al/d/dSh7htr3wR+uOlBwwDFiY41vk4v7THLI+JpGzdLpHVu caHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=peyGL9UI; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id m1-20020a170902f64100b00158618de96fsi2457144plg.115.2022.05.18.04.26.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 May 2022 04:26:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=peyGL9UI; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E133417064D; Wed, 18 May 2022 04:23:27 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235397AbiERLXR (ORCPT + 99 others); Wed, 18 May 2022 07:23:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235408AbiERLXD (ORCPT ); Wed, 18 May 2022 07:23:03 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DEC715D338 for ; Wed, 18 May 2022 04:23:00 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 6D0361F9AC; Wed, 18 May 2022 11:22:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1652872973; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5SosWoAHWyB6TbnbAfulqwAIBVU1Qhynj9mAe9um6CU=; b=peyGL9UIT1bmuuoAEkmeKd0Yv+G1DS1J55ijO+UxO8PqG8S33+NSS2aF4c+ZoxO4WQ3Gv/ 1b8FdStevcv1KWXilZuayJEXUfLGKRDxdMeZ9aRXCPp+v1PITzE/7IHxHjMTt3y3vlOEah BL+pFjOhGDkHLFM0steevjL9FWb6A5M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1652872973; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=5SosWoAHWyB6TbnbAfulqwAIBVU1Qhynj9mAe9um6CU=; b=DqO5JV57DOyAHaPUOAw1jWBDe0f1R0pIhpdgdeNiFcl+b3DZteMSGb3YQXazZotDW8jult WPMNxRs7os5BoEBg== Received: from adalid.arch.suse.de (adalid.arch.suse.de [10.161.8.13]) by relay2.suse.de (Postfix) with ESMTP id 5BE392C14B; Wed, 18 May 2022 11:22:53 +0000 (UTC) Received: by adalid.arch.suse.de (Postfix, from userid 16045) id 9FA3D5194515; Wed, 18 May 2022 13:22:52 +0200 (CEST) From: Hannes Reinecke To: Christoph Hellwig Cc: Sagi Grimberg , Keith Busch , linux-nvme@lists.infradead.org, linux-crypto@vger.kernel.org, Hannes Reinecke Subject: [PATCH 08/11] nvmet: parse fabrics commands on io queues Date: Wed, 18 May 2022 13:22:31 +0200 Message-Id: <20220518112234.24264-9-hare@suse.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20220518112234.24264-1-hare@suse.de> References: <20220518112234.24264-1-hare@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Some fabrics commands can be sent via io queues, so add a new function nvmet_parse_fabrics_io_cmd() and rename the existing nvmet_parse_fabrics_cmd() to nvmet_parse_fabrics_admin_cmd(). Signed-off-by: Hannes Reinecke --- drivers/nvme/target/admin-cmd.c | 2 +- drivers/nvme/target/core.c | 4 ++++ drivers/nvme/target/fabrics-cmd.c | 17 ++++++++++++++++- drivers/nvme/target/nvmet.h | 3 ++- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c index 397daaf51f1b..31df40ac828f 100644 --- a/drivers/nvme/target/admin-cmd.c +++ b/drivers/nvme/target/admin-cmd.c @@ -1017,7 +1017,7 @@ u16 nvmet_parse_admin_cmd(struct nvmet_req *req) u16 ret; if (nvme_is_fabrics(cmd)) - return nvmet_parse_fabrics_cmd(req); + return nvmet_parse_fabrics_admin_cmd(req); if (nvmet_is_disc_subsys(nvmet_req_subsys(req))) return nvmet_parse_discovery_cmd(req); diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c index 90e75324dae0..792f15621173 100644 --- a/drivers/nvme/target/core.c +++ b/drivers/nvme/target/core.c @@ -865,8 +865,12 @@ static inline u16 nvmet_io_cmd_check_access(struct nvmet_req *req) static u16 nvmet_parse_io_cmd(struct nvmet_req *req) { + struct nvme_command *cmd = req->cmd; u16 ret; + if (nvme_is_fabrics(cmd)) + return nvmet_parse_fabrics_io_cmd(req); + ret = nvmet_check_ctrl_status(req); if (unlikely(ret)) return ret; diff --git a/drivers/nvme/target/fabrics-cmd.c b/drivers/nvme/target/fabrics-cmd.c index 70fb587e9413..f23c28729908 100644 --- a/drivers/nvme/target/fabrics-cmd.c +++ b/drivers/nvme/target/fabrics-cmd.c @@ -82,7 +82,7 @@ static void nvmet_execute_prop_get(struct nvmet_req *req) nvmet_req_complete(req, status); } -u16 nvmet_parse_fabrics_cmd(struct nvmet_req *req) +u16 nvmet_parse_fabrics_admin_cmd(struct nvmet_req *req) { struct nvme_command *cmd = req->cmd; @@ -103,6 +103,21 @@ u16 nvmet_parse_fabrics_cmd(struct nvmet_req *req) return 0; } +u16 nvmet_parse_fabrics_io_cmd(struct nvmet_req *req) +{ + struct nvme_command *cmd = req->cmd; + + switch (cmd->fabrics.fctype) { + default: + pr_debug("received unknown capsule type 0x%x\n", + cmd->fabrics.fctype); + req->error_loc = offsetof(struct nvmf_common_command, fctype); + return NVME_SC_INVALID_OPCODE | NVME_SC_DNR; + } + + return 0; +} + static u16 nvmet_install_queue(struct nvmet_ctrl *ctrl, struct nvmet_req *req) { struct nvmf_connect_command *c = &req->cmd->connect; diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h index 69818752a33a..c37f41eafc2f 100644 --- a/drivers/nvme/target/nvmet.h +++ b/drivers/nvme/target/nvmet.h @@ -419,7 +419,8 @@ u16 nvmet_file_parse_io_cmd(struct nvmet_req *req); u16 nvmet_bdev_zns_parse_io_cmd(struct nvmet_req *req); u16 nvmet_parse_admin_cmd(struct nvmet_req *req); u16 nvmet_parse_discovery_cmd(struct nvmet_req *req); -u16 nvmet_parse_fabrics_cmd(struct nvmet_req *req); +u16 nvmet_parse_fabrics_admin_cmd(struct nvmet_req *req); +u16 nvmet_parse_fabrics_io_cmd(struct nvmet_req *req); bool nvmet_req_init(struct nvmet_req *req, struct nvmet_cq *cq, struct nvmet_sq *sq, const struct nvmet_fabrics_ops *ops); -- 2.29.2