Message ID | 20231218153105.12717-2-dwagner@suse.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-3942-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp1327394dyi; Mon, 18 Dec 2023 07:38:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IEZnXs+p6TYqJGuOjZJVKlWLIylNqKE+pfJ6/tN1SDZqMThO/lMNtsLLBivJWq+J5+dPadS X-Received: by 2002:a17:903:25c3:b0:1d3:b860:5a99 with SMTP id jc3-20020a17090325c300b001d3b8605a99mr881514plb.71.1702913885681; Mon, 18 Dec 2023 07:38:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702913885; cv=none; d=google.com; s=arc-20160816; b=NMAUth0V0Qz2rfkTOTTXjyTmYpTzFdn/kjfEhyx9vli0x7HECPBeNKcxGWPwSjenkj Gyvh9iKDhR+wq0L0wt2WGKV03V0NGRU+uv22kM5MdoMSiRCq+f09VSx2YwCJ9rB1nruL tlICUJGbbiy7dA3JzF56Bq0GOgizGqgYXpF/laTnmB6LDlUnrK5iLmSpck6ziW15t2ON qfWuLax/XbCQ0JZRyTllm5JDrLfS5BimFWIy/YrKLdzCzyjz6s/mgRsPARTq9Mg1e9pk HNE2xmWWwm4e5jv4upHY/XD9IRb9zlA04OnbcDC6MvTod160m+tYy+jubIunkvjKNunj YxiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=r99rVTmaXp3PLbfDNxganSpUb1DQiRb6MbvQzK+q+Ro=; fh=3QIVKsEmsld8rvcEkMSr/XDw53o2lrGJeYcvS7FhzFk=; b=p7dAIULHrV1y0RQUbOLj7bXVJEiaDA6aIfuowTLP/1GXdrMXf0T80IE5oc2rw+KOCX MHohBsJp8xRaO7CeEop0gbO/izVW6FxYk40FzJamA28LStR/AJgFDApdLBWjeP1V9kME wJJV8WrSb9oovDOcrbDntN+css7bMu1gtjWKAA8CeqOZ0t7ncUNcEugJPybXQ4iUad+J nOnylnxO67HlDoafCyIwp1ytWf0KESJjqW5p3b6QsA4vBtISQ7vlU/rwbKIi78eBkNPz f8nmUaOV/dkpkZH67e0impvyjnE8KshhNODbsFOn7nSWqFih4+t3Tuh96y9t6a0LYqjt 5k9w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-3942-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3942-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id ju9-20020a170903428900b001d0a0ee28e0si427231plb.288.2023.12.18.07.38.05 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 07:38:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-3942-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-3942-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-3942-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 740A9B2269D for <ouuuleilei@gmail.com>; Mon, 18 Dec 2023 15:36:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CD22F3D57D; Mon, 18 Dec 2023 15:35:53 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D20A13D563 for <linux-kernel@vger.kernel.org>; Mon, 18 Dec 2023 15:35:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Received: from imap2.dmz-prg2.suse.org (imap2.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:98]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 35F5E1F37E; Mon, 18 Dec 2023 15:35:49 +0000 (UTC) Received: from imap2.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap2.dmz-prg2.suse.org (Postfix) with ESMTPS id 2455E13BC8; Mon, 18 Dec 2023 15:35:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap2.dmz-prg2.suse.org with ESMTPSA id unYoCNVmgGUTfQAAn2gu4w (envelope-from <dwagner@suse.de>); Mon, 18 Dec 2023 15:35:49 +0000 From: Daniel Wagner <dwagner@suse.de> To: linux-nvme@lists.infradead.org Cc: linux-kernel@vger.kernel.org, Christoph Hellwig <hch@lst.de>, Sagi Grimberg <sagi@grimberg.me>, Keith Busch <kbusch@kernel.org>, James Smart <james.smart@broadcom.com>, Hannes Reinecke <hare@suse.de>, Daniel Wagner <dwagner@suse.de> Subject: [PATCH v3 01/16] nvmet: report ioccsz and iorcsz for disc ctrl Date: Mon, 18 Dec 2023 16:30:49 +0100 Message-ID: <20231218153105.12717-2-dwagner@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231218153105.12717-1-dwagner@suse.de> References: <20231218153105.12717-1-dwagner@suse.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Level: X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Level: X-Spam-Flag: NO X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] Authentication-Results: smtp-out2.suse.de; none X-Spam-Score: -4.00 X-Rspamd-Queue-Id: 35F5E1F37E X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785634630511444942 X-GMAIL-MSGID: 1785634630511444942 |
Series |
enable nvmet-fc for blktests
|
|
Commit Message
Daniel Wagner
Dec. 18, 2023, 3:30 p.m. UTC
The host started to verify the ioccsz and iorcsz values. I/O controllers
return valid values but not the discovery controllers. Use the same
values as for I/O controllers.
Fixes: 2fcd3ab39826 ("nvme-fabrics: check ioccsz and iorcsz")
Signed-off-by: Daniel Wagner <dwagner@suse.de>
---
drivers/nvme/target/discovery.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
Comments
On Mon, Dec 18, 2023 at 04:30:49PM +0100, Daniel Wagner wrote: > + /* > + * Max command capsule size is sqe + in-capsule data size. > + * Disable in-capsule data for Metadata capable controllers. A why on the disable would be useful here - the fact that it is disabled is pretty obvious from the code.
On 12/18/23 16:30, Daniel Wagner wrote: > The host started to verify the ioccsz and iorcsz values. I/O controllers > return valid values but not the discovery controllers. Use the same > values as for I/O controllers. > > Fixes: 2fcd3ab39826 ("nvme-fabrics: check ioccsz and iorcsz") > Signed-off-by: Daniel Wagner <dwagner@suse.de> > --- > drivers/nvme/target/discovery.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) > > diff --git a/drivers/nvme/target/discovery.c b/drivers/nvme/target/discovery.c > index 668d257fa986..e3c4d247dd23 100644 > --- a/drivers/nvme/target/discovery.c > +++ b/drivers/nvme/target/discovery.c > @@ -249,6 +249,7 @@ static void nvmet_execute_disc_identify(struct nvmet_req *req) > { > struct nvmet_ctrl *ctrl = req->sq->ctrl; > struct nvme_id_ctrl *id; > + u32 cmd_capsule_size; > u16 status = 0; > > if (!nvmet_check_transfer_len(req, NVME_IDENTIFY_DATA_SIZE)) > @@ -294,6 +295,18 @@ static void nvmet_execute_disc_identify(struct nvmet_req *req) > > strscpy(id->subnqn, ctrl->subsys->subsysnqn, sizeof(id->subnqn)); > > + /* > + * Max command capsule size is sqe + in-capsule data size. 'is sqe size + in-capsule data size' > + * Disable in-capsule data for Metadata capable controllers. > + */ > + cmd_capsule_size = sizeof(struct nvme_command); > + if (!ctrl->pi_support) > + cmd_capsule_size += req->port->inline_data_size; > + id->ioccsz = cpu_to_le32(cmd_capsule_size / 16); Why the division by 16? > + > + /* Max response capsule size is cqe */ 'is cqe size' > + id->iorcsz = cpu_to_le32(sizeof(struct nvme_completion) / 16); > + > status = nvmet_copy_to_sgl(req, 0, id, sizeof(*id)); > > kfree(id); Otherwise looks good. Cheers, Hannes
On Tue, Dec 19, 2023 at 08:24:58AM +0100, Hannes Reinecke wrote: > > + * Disable in-capsule data for Metadata capable controllers. > > + */ > > + cmd_capsule_size = sizeof(struct nvme_command); > > + if (!ctrl->pi_support) > > + cmd_capsule_size += req->port->inline_data_size; > > + id->ioccsz = cpu_to_le32(cmd_capsule_size / 16); > > Why the division by 16? The unit size is 16 bytes: I/O Queue Command Capsule Supported Size (IOCCSZ): This field defines the maximum I/O command capsule size in 16 byte units.
On 19/12/2023 6:27, Christoph Hellwig wrote: > On Mon, Dec 18, 2023 at 04:30:49PM +0100, Daniel Wagner wrote: >> + /* >> + * Max command capsule size is sqe + in-capsule data size. >> + * Disable in-capsule data for Metadata capable controllers. > > A why on the disable would be useful here - the fact that it is disabled > is pretty obvious from the code. > We have another thread on this patch that I think is wrong since the discovery controller shouldn't set these values according to the spec. It is explicitly say that ioccsz and iorcsz are reserved for discovery controllers. I've sent a proposal to fix the initiator/host code.
diff --git a/drivers/nvme/target/discovery.c b/drivers/nvme/target/discovery.c index 668d257fa986..e3c4d247dd23 100644 --- a/drivers/nvme/target/discovery.c +++ b/drivers/nvme/target/discovery.c @@ -249,6 +249,7 @@ static void nvmet_execute_disc_identify(struct nvmet_req *req) { struct nvmet_ctrl *ctrl = req->sq->ctrl; struct nvme_id_ctrl *id; + u32 cmd_capsule_size; u16 status = 0; if (!nvmet_check_transfer_len(req, NVME_IDENTIFY_DATA_SIZE)) @@ -294,6 +295,18 @@ static void nvmet_execute_disc_identify(struct nvmet_req *req) strscpy(id->subnqn, ctrl->subsys->subsysnqn, sizeof(id->subnqn)); + /* + * Max command capsule size is sqe + in-capsule data size. + * Disable in-capsule data for Metadata capable controllers. + */ + cmd_capsule_size = sizeof(struct nvme_command); + if (!ctrl->pi_support) + cmd_capsule_size += req->port->inline_data_size; + id->ioccsz = cpu_to_le32(cmd_capsule_size / 16); + + /* Max response capsule size is cqe */ + id->iorcsz = cpu_to_le32(sizeof(struct nvme_completion) / 16); + status = nvmet_copy_to_sgl(req, 0, id, sizeof(*id)); kfree(id);