From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f227.google.com (mail-pl1-f227.google.com [209.85.214.227]) (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 A8E923939B0 for ; Mon, 24 Aug 2026 22:29:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.227 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787610601; cv=none; b=pzEcLkCoSdGwg1RaArPORxoXpmky8jOzfmJx+O/X7T94yObIQV8t/CRWnvOCdI+f+gk548i/YDfvC+C+pwpE0QY6EA8PrxV2csx63a4PMyEmW7IIu15izWis+csTD5GISFn0FDBb9tdvUO1dKxVTrV5n5dIBmPDwCrlp+EEspis= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787610601; c=relaxed/simple; bh=QrI9buz0sw8DI6OG7s7nPX5TCgVkOM2CJln0YlezXko=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PwTY6AqUsOfCUssvyLb/4rSQGef3oc2ZPCbrGINfC1PzfrFsVypPCOJxcOx2I6qGhw8UQCZSz+TvCFKqeUw91sFVKq5RDKeAUZRyY7ZSOO8yV3WRxfgs/rjRO2y94EMUhaCwIt23VAMxwOmSkd9BejO3Bqg5BK6b5T9hs775SdU= 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=M1Wn8zDr; arc=none smtp.client-ip=209.85.214.227 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="M1Wn8zDr" Received: by mail-pl1-f227.google.com with SMTP id d9443c01a7336-2cedda2ce6fso24552645ad.1 for ; Mon, 24 Aug 2026 15:29:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1787610599; x=1788215399; 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=M1Wn8zDrzlDyIRmmL3zmNZs3wDfWndgrGK5XEH+AGV6AaUFgKNvXlkmPF0yjS9NTzQ eDCLG4ZLRO+wqWtE/Mqa3txJofyl0DsUgeapf/cIfsJ9MM1Fx5OsGNNrwkmRPMkt8XS3 dv2MZr7FRPQoRUlyiZJZSZpfZPbCGMUFnwUXd/UhNFOURlTI20O/jFSWboPe+7Kmu02Q Wbv3FUreLt9atqLH+TOrT7ygoQrrp2mjkPTUhrgAGd8vg7/nQURi40bdSiPIl8cNO1Fg BN5KoQdU0Bj4GwQFtF01X08jjXn+C3W/SsLnYZ1QXJNGdZAhGVIAuuk4hibrkjdKQOHK pf1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787610599; x=1788215399; 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=R84uQ8DY18EqUgvOb8oiKUZ2UKriFi9uYMJVNtSyVwdpXVEORv3zsa0KdepeZLQrAn BP33NJe7jsggSmP8Gmxp3eBPGN/IBQVTQAv5bNSYOjMOHckh5yUzzpcdRjiBgzoy//Hs cqUvZBs3fUpC0GDrZPHkMWedjtC5wHG5vXOanbn7+Pcmxo9BbifCcOrVvHFTipRfH5Zs lyVc1hOB4MAaNY0d6H4bdGrk++ROKV5V7Xzi2jETi0yiaE3QG2hqshMizIKjZkLOpSX9 XqjZEuhesWKhTw6f6v92HwVJUSEmwbpQADDuDRBUAIbd4QU1QlGbjp8rNitZJE9K6fcD fIzw== X-Forwarded-Encrypted: i=1; AHgh+RpmjBArnPgTm/zwk917sK7MSqEsfhOa082Wy77AF1Fd8adUDZhYKpX/a9FLp6/vy8DV/jF70IaHBRqOIjI=@vger.kernel.org X-Gm-Message-State: AFuF++mktQVEN2FO70p5mugabiae8AstnpIpMI+0oRls6bt63f+gFDqM F/tb1cZ8nWMm0mCok2/UEgPSqqUkhV/5KIbDi3mOBDAZ89+78bEl7A35R6cPSKbL/OyaVLT8BHi QC/3uMvYw6Vq4kz3VPCkgTtZNaRila5xHGI1y X-Gm-Gg: AR+sD11TCs/CTB/hHZPTY+dDC4wq/hrVzJyBg4ff84e7JR4ulhkmmDH82GkOV3I/ThU IDgJdWAyIXHAwVFjgV1dN0wTUT7Q36S6JXkzO7qk8w72a/TG2TuhKHb900vu3zv9ZOtaScB7y9v 0hEn/cmi4IEjoUTH8x9nCEeGYU+bHe+zJs2eiGYk4BcwB3pG/IOhanm9zbV9fJ+KWI9N9nrxz9k Hv3mrkuCC2CAx+3yD3WuVd0Dvu/+x8tv8YvkBIGf+g6LsGqFAAMXXFsrSdhLgo1Cr6s6uIY7eoj 1ZcNLyHFN9kB2BICoTGz38Bai1YC9daj+Gqty80FrDZxsAOZCyPHY+vxocuQUr1NWIoZut7adGG lEEfTLxXVkppWKlbP5hiBqf/kU924Gmg= X-Received: by 2002:a17:90b:3bc6:b0:393:194d:5366 with SMTP id 98e67ed59e1d1-395c354da4fmr55156438a91.10.1787610598726; Mon, 24 Aug 2026 15:29:58 -0700 (PDT) Received: from c7-smtp-2026.dev.purestorage.com ([208.88.159.129]) by smtp-relay.gmail.com with ESMTPS id 98e67ed59e1d1-39645b346ecsm385635a91.12.2026.08.24.15.29.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 15:29:58 -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 1B996402B2; Mon, 24 Aug 2026 16:29:58 -0600 (MDT) Received: by dev-sgogte.dev.purestorage.com (Postfix, from userid 1557734945) id 181B951D15; Mon, 24 Aug 2026 16:29:58 -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 1/2] nvme-tcp: refactor I/O queue setup path Date: Mon, 24 Aug 2026 16:29:38 -0600 Message-ID: <20260824222939.301887-2-sgogte@purestorage.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260824222939.301887-1-sgogte@purestorage.com> References: <20260824222939.301887-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