Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp2017511lqa; Tue, 30 Apr 2024 06:20:33 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWSETeDbtefV0fYLu1NoCsY3brRLp0xoffa548qpR3ZqWKNk4agwfUQeHe5OtR9S6ALUhwXep9Y64C1/dc/rOkh2iKL8xl6XIoM1mlTpg== X-Google-Smtp-Source: AGHT+IEIMlfiKnBIuCVmBeILE9xJsb9uLsgYho89qXmtxwodTIzylDygZyX++8T8/Fgd1In3puk4 X-Received: by 2002:ac8:7c4d:0:b0:43a:b9e1:3891 with SMTP id o13-20020ac87c4d000000b0043ab9e13891mr8357422qtv.51.1714483233242; Tue, 30 Apr 2024 06:20:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714483233; cv=pass; d=google.com; s=arc-20160816; b=EjDynqtlssnYyWX1Zi4a1bRwx9zwrksVc9MHrMPHJ+97ylUfAUALYy3WrFGHIDis8X v0yNTFV8+2uqv7zdhoECdjfRZG9G7w8hIp6e6BxySkF9Ana5DNBmXljHfwvb03LYwdnB JzOrnS/qf1PFbcHFefv4Ab6rMtgA4T+qrzwJsnJbJHpbvPXURcQ6JCA64ucjizdLUff1 uoQw8MMy6HV9DaBB/PK/SBvTJ+QNtdExDwOrMzzZfEMIIdpj7qv5eCKqeHRsaZ5pbQRR lUigKQgkFTC+lTdTdvmtWwYWft7E1Lu44JhHKAPbm8Dg6R3w+hvbiqQ5MEWItA4XPatF cUnQ== ARC-Message-Signature: i=2; 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:dkim-signature:dkim-signature :dkim-signature:dkim-signature; bh=IqmLcu21VKVleGdDKkyS5kWnZkHjeaB7QlqTWzxzX+Q=; fh=DJuiNgwyR0bD8rPMSu/msvIvJ9b4/StdsZoGeLLj0J4=; b=qHbeudX6aO//hwm09hFFMPe03OVGB4hdyDpfoaJhRhtF4Hmh0nJJ3xkF5LQY7KHh3P rj5aoxfXSvrU4213axSM2PV/Lgp3go5MyWtF19lXYfAkb9YcSbOcaoe1nXbFWwpX31LW mUqata7+SGEYl6dqyE9vh0N+bnQb3gi/QyBr0L0+Up6Jl3jWTQdPclYTVDI2qf3iYWmM lNITM/ECuykc2Q3R+Ebm/1qGvpcPmFe3Z77NJQOL4dAofw8Qp6sRuLJShcW+RnkXkSeU gkmejftlYLY5wri5uB6z8/18Sg6auZmkzhonIvBN0GhX+/eOewRaL4Q1PHA4Oh9CHH7s B+rQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=ri79Gfyt; dkim=neutral (no key) header.i=@suse.de header.b="Yp/18S0B"; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=ri79Gfyt; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-163984-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163984-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id dj12-20020a05622a4e8c00b00432b6a45c72si26727267qtb.582.2024.04.30.06.20.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Apr 2024 06:20:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163984-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=ri79Gfyt; dkim=neutral (no key) header.i=@suse.de header.b="Yp/18S0B"; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=ri79Gfyt; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-163984-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163984-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (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 ny.mirrors.kernel.org (Postfix) with ESMTPS id E33391C2254B for ; Tue, 30 Apr 2024 13:20:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 08E39172BD0; Tue, 30 Apr 2024 13:19:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="ri79Gfyt"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="Yp/18S0B"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="ri79Gfyt"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="Yp/18S0B" 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 5CACC171E67 for ; Tue, 30 Apr 2024 13:19:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714483180; cv=none; b=Yh3ySKEXRKeuewivtZkiXpKvfNgLpdTQYxNfXGqaDq6OXYjXWHUKCJ9xZk7IvRiw/9RlHlr+rTtM+W0O4mLuQ0eNBVQcTWAptEer0raaO0nj7M9m2GKVHSKvxdeY2eq+EwiWi3VNBSE4hfim1uyTPyS6fsSV5uT7i3fBIsBQaQY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714483180; c=relaxed/simple; bh=BK3COps9RWbDbzAXm6b9is1mXXB7VVBI1k12WaLmR9I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ky+o7YZmu5bZz5mjai9xeWpTv3tT87WWvyVq34MKwPfsEFQ65TNdm9i9D3F1SZjE/o78XuIubTY9WikQrNciZUZW87b6XMZekyElhO063csNSS4Wt76Z4TBjpwtpI1o0YNKyqmUFkm3/nDnFvIoyVKizzFXyvWg7hu4MGlwD+pE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=ri79Gfyt; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=Yp/18S0B; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=ri79Gfyt; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=Yp/18S0B; arc=none smtp.client-ip=195.135.223.131 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 imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (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 8259E1F7E5; Tue, 30 Apr 2024 13:19:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1714483177; 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=IqmLcu21VKVleGdDKkyS5kWnZkHjeaB7QlqTWzxzX+Q=; b=ri79Gfyt2hjCszVM2HXT7m6dJtRVBDt7pz+7Xz3DIr3rvgd6RFzaYp5snlcAeSOus6a4SP +asZDdC+KPTH9jAEfxJG5WkuQ/UcnkPZTyaHivCw8+lxR5ZTDSlWJfa4HfnBB2grD6jLxR fWMsci6J+HPxjoJ2/poLD9EaI3ItfZ8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1714483177; 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=IqmLcu21VKVleGdDKkyS5kWnZkHjeaB7QlqTWzxzX+Q=; b=Yp/18S0BUq6vlyHbUavon5SWh59FIXkm6fJ2fa7uSuc3dHni+GVvbLgBmWWQZ4Dtq5frh/ FTYKNhgvLOTcprBg== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1714483177; 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=IqmLcu21VKVleGdDKkyS5kWnZkHjeaB7QlqTWzxzX+Q=; b=ri79Gfyt2hjCszVM2HXT7m6dJtRVBDt7pz+7Xz3DIr3rvgd6RFzaYp5snlcAeSOus6a4SP +asZDdC+KPTH9jAEfxJG5WkuQ/UcnkPZTyaHivCw8+lxR5ZTDSlWJfa4HfnBB2grD6jLxR fWMsci6J+HPxjoJ2/poLD9EaI3ItfZ8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1714483177; 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=IqmLcu21VKVleGdDKkyS5kWnZkHjeaB7QlqTWzxzX+Q=; b=Yp/18S0BUq6vlyHbUavon5SWh59FIXkm6fJ2fa7uSuc3dHni+GVvbLgBmWWQZ4Dtq5frh/ FTYKNhgvLOTcprBg== Received: from imap1.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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 70A95133A7; Tue, 30 Apr 2024 13:19:37 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id z1EMGunvMGZ1MAAAD6G6ig (envelope-from ); Tue, 30 Apr 2024 13:19:37 +0000 From: Daniel Wagner To: Christoph Hellwig Cc: Keith Busch , Sagi Grimberg , James Smart , Hannes Reinecke , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Daniel Wagner Subject: [PATCH v7 3/5] nvme: return kernel error codes for admin queue connect Date: Tue, 30 Apr 2024 15:19:26 +0200 Message-ID: <20240430131928.29766-4-dwagner@suse.de> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240430131928.29766-1-dwagner@suse.de> References: <20240430131928.29766-1-dwagner@suse.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Level: X-Spamd-Result: default: False [-2.80 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; ARC_NA(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_TRACE(0.00)[0:+]; FUZZY_BLOCKED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCVD_TLS_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCPT_COUNT_SEVEN(0.00)[8]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:email] X-Spam-Score: -2.80 X-Spam-Flag: NO From: Hannes Reinecke nvmf_connect_admin_queue returns NVMe error status codes and kernel error codes. This mixes the different domains which makes maintainability difficult. Reviewed-by: Christoph Hellwig Reviewed-by: Sagi Grimberg Signed-off-by: Hannes Reinecke Signed-off-by: Daniel Wagner --- drivers/nvme/host/core.c | 6 +++--- drivers/nvme/host/fabrics.c | 31 +++++++++++++------------------ drivers/nvme/host/nvme.h | 2 +- 3 files changed, 17 insertions(+), 22 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 504dc352c458..66387bcca8ae 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -383,14 +383,14 @@ static inline enum nvme_disposition nvme_decide_disposition(struct request *req) if (likely(nvme_req(req)->status == 0)) return COMPLETE; - if ((nvme_req(req)->status & 0x7ff) == NVME_SC_AUTH_REQUIRED) - return AUTHENTICATE; - if (blk_noretry_request(req) || (nvme_req(req)->status & NVME_SC_DNR) || nvme_req(req)->retries >= nvme_max_retries) return COMPLETE; + if ((nvme_req(req)->status & 0x7ff) == NVME_SC_AUTH_REQUIRED) + return AUTHENTICATE; + if (req->cmd_flags & REQ_NVME_MPATH) { if (nvme_is_path_error(nvme_req(req)->status) || blk_queue_dying(req->q)) diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c index 1f0ea1f32d22..f7eaf9580b4f 100644 --- a/drivers/nvme/host/fabrics.c +++ b/drivers/nvme/host/fabrics.c @@ -428,12 +428,6 @@ static void nvmf_connect_cmd_prep(struct nvme_ctrl *ctrl, u16 qid, * fabrics-protocol connection of the NVMe Admin queue between the * host system device and the allocated NVMe controller on the * target system via a NVMe Fabrics "Connect" command. - * - * Return: - * 0: success - * > 0: NVMe error status code - * < 0: Linux errno error code - * */ int nvmf_connect_admin_queue(struct nvme_ctrl *ctrl) { @@ -467,7 +461,7 @@ int nvmf_connect_admin_queue(struct nvme_ctrl *ctrl) if (result & NVME_CONNECT_AUTHREQ_ASCR) { dev_warn(ctrl->device, "qid 0: secure concatenation is not supported\n"); - ret = NVME_SC_AUTH_REQUIRED; + ret = -EOPNOTSUPP; goto out_free_data; } /* Authentication required */ @@ -475,14 +469,14 @@ int nvmf_connect_admin_queue(struct nvme_ctrl *ctrl) if (ret) { dev_warn(ctrl->device, "qid 0: authentication setup failed\n"); - ret = NVME_SC_AUTH_REQUIRED; goto out_free_data; } ret = nvme_auth_wait(ctrl, 0); - if (ret) + if (ret) { dev_warn(ctrl->device, - "qid 0: authentication failed\n"); - else + "qid 0: authentication failed, error %d\n", + ret); + } else dev_info(ctrl->device, "qid 0: authenticated\n"); } @@ -542,7 +536,7 @@ int nvmf_connect_io_queue(struct nvme_ctrl *ctrl, u16 qid) if (result & NVME_CONNECT_AUTHREQ_ASCR) { dev_warn(ctrl->device, "qid 0: secure concatenation is not supported\n"); - ret = NVME_SC_AUTH_REQUIRED; + ret = -EOPNOTSUPP; goto out_free_data; } /* Authentication required */ @@ -550,12 +544,13 @@ int nvmf_connect_io_queue(struct nvme_ctrl *ctrl, u16 qid) if (ret) { dev_warn(ctrl->device, "qid %d: authentication setup failed\n", qid); - ret = NVME_SC_AUTH_REQUIRED; - } else { - ret = nvme_auth_wait(ctrl, qid); - if (ret) - dev_warn(ctrl->device, - "qid %u: authentication failed\n", qid); + goto out_free_data; + } + ret = nvme_auth_wait(ctrl, qid); + if (ret) { + dev_warn(ctrl->device, + "qid %u: authentication failed, error %d\n", + qid, ret); } } out_free_data: diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h index d0ed64dc7380..9b8904a476b8 100644 --- a/drivers/nvme/host/nvme.h +++ b/drivers/nvme/host/nvme.h @@ -1122,7 +1122,7 @@ static inline int nvme_auth_negotiate(struct nvme_ctrl *ctrl, int qid) } static inline int nvme_auth_wait(struct nvme_ctrl *ctrl, int qid) { - return NVME_SC_AUTH_REQUIRED; + return -EPROTONOSUPPORT; } static inline void nvme_auth_free(struct nvme_ctrl *ctrl) {}; #endif -- 2.44.0