From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f100.google.com (mail-pj1-f100.google.com [209.85.216.100]) (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 59201395ACF for ; Mon, 24 Aug 2026 22:57:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.100 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787612225; cv=none; b=rNhgKk88l4vjNnFaGS7+CboTQR3XXlNgW5aXUqUu6QJVTv7Tu4kc+QpWKleGXNSCL9hR2uNNENlADYj5G1eixR0pjr8bDq89ClQfAn61Q7/rKauB6uzd0QbyL5mDjnobj6USZlyzFhDgPtAGzbWxNS4jOdgbRpAuWhvUPGkM3Xg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787612225; c=relaxed/simple; bh=QrI9buz0sw8DI6OG7s7nPX5TCgVkOM2CJln0YlezXko=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UWsXtFcOQ+teEVkIm+7rzaUUz5AvjPxVH1rBzSqBWwbYWwst/H+bcY2emlGoE9zaitdl8QetfUtINOrzBSmut4e8mgf3AzcrHAvi8Zuf1sbME2EVv+RjBwY1mRJFPW9LwrAEKpNHCL4zQVAzjAIgzURHc37zxHg90nD7iJ22Vck= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=purestorage.com; spf=pass smtp.mailfrom=purestorage.com; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b=Ljz3x2MB; arc=none smtp.client-ip=209.85.216.100 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=purestorage.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=purestorage.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=purestorage.com header.i=@purestorage.com header.b="Ljz3x2MB" Received: by mail-pj1-f100.google.com with SMTP id 98e67ed59e1d1-38e08baf860so4596555a91.2 for ; Mon, 24 Aug 2026 15:57:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1787612223; x=1788217023; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=fFUnUD2PSYg4bX4Q3b9OOzDwXzWSfr57LRsGrlQRamE=; b=Ljz3x2MB4I0e6GsFLVszz7+UDm+oZrj4dJGCQnIVhQZMeKClsZUTEsudEN2MQlTR// sA8EKkSUtyvPMwpB8WKxTc5u14LmEVV1dFtfekFCXB8PsrrHvsgKtPPwS2IKnaUyRY5/ 6LmnV/rOOzlFNF3DXWMSlTANpR59vMvrjdBVh8vrh89iBHWXIfJ/HTTvKAKq/YgCGSSa pJAPp1ARhXVJQL0EjqTWvS1yoeizJfLTsLJpmVLQDS9XKtJYpFDnoWbNAftD8te4QUFo uucxHS5sRjerEzjLT7CeDlopORIJBQmyEXlk9SZQpn3gVUDrSruqDpjmJRFZ8G7n919b Da5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787612223; x=1788217023; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=fFUnUD2PSYg4bX4Q3b9OOzDwXzWSfr57LRsGrlQRamE=; b=ABOKNqui/VrV1OE0LtMW+WrJqFjDxeNyDLM+GRxHkGhjkll3p3B++GocBuKyTeFOo1 Gx0IejQtTRltwEa3wagVovEQYH26kwTIJtk5ksGKl66ZNJqt/99m6aSvSauYiFlpCaJs fIdYPxQUJ+q/6lLgbGQubWYdCVvw5ulxp22Z9SZrQI9oyEjSKsYimTcx2cIA/FsIxUgo NlsASi/LGUl46LBzEJR49OlpiRIpNevVQ3CI1PnOhm0jk8MkHrsWuyqBJwMgOc4fO8Qz kTpwW/e/K/8TYx0siSitIG+OWQWvdrlPhXWS2q0o/+tKtAid0OmVX/v5bz0bWT4IHvHT KL2g== X-Forwarded-Encrypted: i=1; AHgh+RpCic6p25lnPNTRB5/6xYRvKDsNIr9ZuFDcP3NBLMc2cIYQ5Qi/ulyqUDlWDwCxPftEkq7gRudhl6LeELw=@vger.kernel.org X-Gm-Message-State: AFuF++leLPbxLznzLHC4cGDNOTORIPQedEb7QdM/QHe7VY1nPPBJpRfZ RNDI7qQoqbt4W0w8+ig5DoDasdfQU794uRE5pTJYvFk4Dh/ZjAsKldWU3E0pbrd/jTtbstevUR/ wgTTnEdpaq8tP45NKz45yRoyR8Cl7e700v/I6zmXnc8cAsynIGKnI X-Gm-Gg: AR+sD13QQ9P1o4uhSDSh5FMVt01hNfrdLLjuVBCfZSj4GpTf3N+XyNtkNsJ3Am/q+89 PXFQqo4jph9/rsx45tb/zJMkDsFVxebWcUXdDqwdPwyUdNvBjQt07opvftIBbniIIGMe1GlgNCi A3Mp4TtwlIY+p8CKCNOQXvUIUFkh5619KXro6ClLRnlvmgqLwkhFWj5LrbQRhF8wqitS9ARW47U +6NYr5xoAKHWtDHnGbpFl3zl6r0H4Hll53exS2ZisHJX0e2dLO8BSpCMuRGopABO635vlQuLUeC J43eZncAZ8v0Vx/y8YP9dcST3WFujyvjVg/M4o5ZiBNi4hNm+0QnKvXjUPsEN/1JYjLPyLXpnTl VRUEhO34TjQptlVg= X-Received: by 2002:a17:90b:4ed0:b0:381:1c96:829b with SMTP id 98e67ed59e1d1-395dee539f3mr43171924a91.3.1787612223567; Mon, 24 Aug 2026 15:57:03 -0700 (PDT) Received: from c7-smtp-2026.dev.purestorage.com ([2620:125:9017:12:36:3:6:0]) by smtp-relay.gmail.com with ESMTPS id 98e67ed59e1d1-39645b43d8asm400989a91.13.2026.08.24.15.57.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 15:57:03 -0700 (PDT) X-Relaying-Domain: purestorage.com Received: from dev-sgogte.dev.purestorage.com (bond0.slc5-n22m24-k8s.dev.purestorage.com [IPv6:2620:125:9025:20::a31:429]) by c7-smtp-2026.dev.purestorage.com (Postfix) with ESMTP id E386F43660; Mon, 24 Aug 2026 16:57:02 -0600 (MDT) Received: by dev-sgogte.dev.purestorage.com (Postfix, from userid 1557734945) id E0E0551D05; Mon, 24 Aug 2026 16:57:02 -0600 (MDT) From: Surabhi Gogte To: Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg Cc: linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, mkhalfella@purestorage.com, randyj@purestorage.com, adailey@purestorage.com, Surabhi Gogte Subject: [PATCH v2 1/2] nvme-tcp: refactor I/O queue setup path Date: Mon, 24 Aug 2026 16:56:47 -0600 Message-ID: <20260824225648.316962-2-sgogte@purestorage.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260824225648.316962-1-sgogte@purestorage.com> References: <20260824225648.316962-1-sgogte@purestorage.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Split the I/O queue setup helpers apart so that the individual steps can be called directly from nvme_tcp_configure_io_queues(): - Queue count negotiation moves out of nvme_tcp_alloc_io_queues() into a new nvme_tcp_io_queue_count(), leaving the allocator with just the per-queue allocation loop. - TLS PSK validation moves out of __nvme_tcp_alloc_io_queues() into a new nvme_tcp_tls_check_psk(). - nvme_tcp_configure_io_queues() now calls the three steps directly in the same order as before. Signed-off-by: Surabhi Gogte --- drivers/nvme/host/tcp.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c index 5fda9661bdb7..354668ad29ac 100644 --- a/drivers/nvme/host/tcp.c +++ b/drivers/nvme/host/tcp.c @@ -2171,10 +2171,8 @@ static int nvme_tcp_alloc_admin_queue(struct nvme_ctrl *ctrl) return ret; } -static int __nvme_tcp_alloc_io_queues(struct nvme_ctrl *ctrl) +static int nvme_tcp_tls_check_psk(struct nvme_ctrl *ctrl) { - int i, ret; - if (nvme_tcp_tls_configured(ctrl)) { if (ctrl->opts->concat) { /* @@ -2196,6 +2194,13 @@ static int __nvme_tcp_alloc_io_queues(struct nvme_ctrl *ctrl) } } + return 0; +} + +static int __nvme_tcp_alloc_io_queues(struct nvme_ctrl *ctrl) +{ + int i, ret; + for (i = 1; i < ctrl->queue_count; i++) { ret = nvme_tcp_alloc_queue(ctrl, i, ctrl->tls_pskid); @@ -2212,7 +2217,7 @@ static int __nvme_tcp_alloc_io_queues(struct nvme_ctrl *ctrl) return ret; } -static int nvme_tcp_alloc_io_queues(struct nvme_ctrl *ctrl) +static int nvme_tcp_io_queue_count(struct nvme_ctrl *ctrl) { unsigned int nr_io_queues; int ret; @@ -2234,14 +2239,22 @@ static int nvme_tcp_alloc_io_queues(struct nvme_ctrl *ctrl) nvmf_set_io_queues(ctrl->opts, nr_io_queues, to_tcp_ctrl(ctrl)->io_queues); - return __nvme_tcp_alloc_io_queues(ctrl); + return 0; } static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new) { int ret, nr_queues; - ret = nvme_tcp_alloc_io_queues(ctrl); + ret = nvme_tcp_io_queue_count(ctrl); + if (ret) + return ret; + + ret = nvme_tcp_tls_check_psk(ctrl); + if (ret) + return ret; + + ret = __nvme_tcp_alloc_io_queues(ctrl); if (ret) return ret; -- 2.55.0