From patchwork Thu Nov 15 17:16:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sagi Grimberg X-Patchwork-Id: 10684751 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0B344109C for ; Thu, 15 Nov 2018 17:17:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E97262CC75 for ; Thu, 15 Nov 2018 17:17:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DDEC12CC82; Thu, 15 Nov 2018 17:17:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E7D12CC75 for ; Thu, 15 Nov 2018 17:17:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388321AbeKPDZo (ORCPT ); Thu, 15 Nov 2018 22:25:44 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:45000 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388683AbeKPDZO (ORCPT ); Thu, 15 Nov 2018 22:25:14 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=References:In-Reply-To:Message-Id: Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=zeE9qNUvxwXROYdSpTrdQdie5JY3zQ1AuyiC6Pi1Or0=; b=tSUhOjJtxW3jA6YutbhGI+Lnt yXnUdZMb4QQ4fphmHcsBtC5fCXjOux9cV5qCpHdvoj0ysoljgMJPkZU5lwb/Y5nSW6MqnjsDfpj6U ZTiuTyhojc0bGQ0PSUSErVNsqKUkaWcd5PTFKm+JdYR2WHHdRmrV7lSMec/q9oQe1Dgg0Z28cs+cz JEIiaAi8VT/p2td5fioy+qAORpUL7PLhJjlMwyR5pmq1Qby4hTa7Ar4VhXl/0VqhGXTj2no+6CRk5 Y5zDmozaK3eXuXMAPJ22umqUz12HMo6c8LYZ0htMVrUWjzb7ZVq02hDT6wzlkVGNNSvDJnvwuGj7y bRlPmjgzA==; Received: from [52.119.64.114] (helo=bombadil.infradead.org) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1gNLFn-0002LK-KD; Thu, 15 Nov 2018 17:16:31 +0000 From: Sagi Grimberg To: linux-nvme@lists.infradead.org Cc: linux-block@vger.kernel.org, netdev@vger.kernel.org, Christoph Hellwig , Keith Busch Subject: [PATCH 05/11] nvmet: Add install_queue callout Date: Thu, 15 Nov 2018 09:16:17 -0800 Message-Id: <20181115171626.9306-6-sagi@lightbitslabs.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181115171626.9306-1-sagi@lightbitslabs.com> References: <20181115171626.9306-1-sagi@lightbitslabs.com> Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP nvmet-tcp will implement it to allocate queue commands which are only known at nvmf connect time (sq size). Signed-off-by: Sagi Grimberg Reviewed-by: Max Gurtovoy --- drivers/nvme/target/fabrics-cmd.c | 9 +++++++++ drivers/nvme/target/nvmet.h | 1 + 2 files changed, 10 insertions(+) diff --git a/drivers/nvme/target/fabrics-cmd.c b/drivers/nvme/target/fabrics-cmd.c index 1f05d8507e35..a84668e8939c 100644 --- a/drivers/nvme/target/fabrics-cmd.c +++ b/drivers/nvme/target/fabrics-cmd.c @@ -117,6 +117,15 @@ static u16 nvmet_install_queue(struct nvmet_ctrl *ctrl, struct nvmet_req *req) nvmet_sq_setup(ctrl, req->sq, qid, sqsize + 1, !!(c->cattr & NVME_CONNECT_DISABLE_SQFLOW)); + if (ctrl->ops->install_queue) { + int ret = ctrl->ops->install_queue(req->sq); + if (ret) { + pr_err("failed to install queue %d cntlid %d ret %d\n", + qid, ret, ctrl->cntlid); + return NVME_SC_CONNECT_INVALID_PARAM | NVME_SC_DNR; + } + } + return 0; } diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h index abc603fa725d..1362afe6e0b3 100644 --- a/drivers/nvme/target/nvmet.h +++ b/drivers/nvme/target/nvmet.h @@ -281,6 +281,7 @@ struct nvmet_fabrics_ops { void (*delete_ctrl)(struct nvmet_ctrl *ctrl); void (*disc_traddr)(struct nvmet_req *req, struct nvmet_port *port, char *traddr); + int (*install_queue)(struct nvmet_sq *nvme_sq); }; #define NVMET_MAX_INLINE_BIOVEC 8