From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f226.google.com (mail-qt1-f226.google.com [209.85.160.226]) (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 9481A2FDC20 for ; Thu, 25 Jun 2026 21:27:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.226 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782422862; cv=none; b=l+m+3lEO64+m2e9XWyeWS23q0vt2wDZYolaNbLoxExOMEZxzeCfiycB8fepRYpTVApf4gaqAtIJlYg4jtixlslH4Pcq40/xxzLV5CpLJOIzMU7D1Gy52fQTyB3lXM3T744bFeC1jd58zVg86Erc4T2Qud09pGNKPME8e3oJSNj4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782422862; c=relaxed/simple; bh=ttNmRXPpL5f0dMmYarOYkfJkWUWJH812ymhb1o7OXI8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KgETo/g4oUoNjSKNjMcjXOqUrS7HUefnfW7JbaN04sOXttdDVgOcWN6J/2Txz78rcLidhNlIXEZKloZ0FsEEOXS51eCvWk89F1t1UE8Q9VIfrn2sAQ+/4aMfiPOdtqCsprLKiT1yjhwwMNM6NZuq2fw0Sn/Z+7q8g6sQqKt+UBM= 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=WofWCk50; arc=none smtp.client-ip=209.85.160.226 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="WofWCk50" Received: by mail-qt1-f226.google.com with SMTP id d75a77b69052e-519f758bca6so2362011cf.0 for ; Thu, 25 Jun 2026 14:27:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1782422860; x=1783027660; 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; bh=t4BwWVBvnlyUMkUU6VF2UEwXIcp46kv2CLab4+aVLSg=; b=WofWCk50/KIrCSEEc2tHgkghkZ7IK2GM4Rhsp9Lmie4FIlSsgy8Hbu1LAtYwg7RDyV /kUTPTDuljMbYKb2dmqeHEC5Zl2wAZO6KVKAJWmgDEzX/YjkPE4oPVYrp74zo5DWmOVs EUBh+S5TrzVYsHXw0CCkRl1zlgbyTuc2pVoiB3YrHfbjHrDAf7ZOKz9hlHUodE+aIbMJ NEmkO2j2S5ElnFYoQOydZ3VZe8u4x8/lztd3vQTrIAkUtzSdn/rjgvoCFM51SKMiLHTu yaqgtCOekn1FhSH4aIG523h/4e3anhax14MdZM29fn/rTrfWQeVDuHYrJGzAFiT+dpgg VjhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782422860; x=1783027660; 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; bh=t4BwWVBvnlyUMkUU6VF2UEwXIcp46kv2CLab4+aVLSg=; b=pRNC5I/WCO0rArH3/sfO7Cv/rp0GI0LJOIC1Vr1QXZI3PMSoX3vpyrlqLf4RKPHNR7 h+tIgX3O6KoCtIUIu7yCQPO+4aAfNDbQHH3pKYZNN1X3iH/vv/qwuiL1LrNyYrzKv01q JHTFwd0qzwqTzdQMnUWwLwtg6yV/to/fyZHhiXVTefstbiz6L+0pH3Rlyz1gJze+eUsz ZGoRrv4J4exs4fO7WiwIlZ6YNCOUH1nq4WX1oY4wJK8h5AgvJweHFfYbkWr6tuODvFC4 KpdHy7OAjiBxzXBfHoSUHesGjP0/ZDEznS2pxH8+W3EUYO98T3SupF4QdvTlW3iNss9x xILw== X-Forwarded-Encrypted: i=1; AFNElJ9Cg1IxNCoaIKVT1IB+2ZTaUZDy8dUCxj8AfoPLv/3kjpasmEiouXNF/ps1l10pAOwRK8qJL8Baz77hMZM=@vger.kernel.org X-Gm-Message-State: AOJu0YwyLbwXcB64Ux7E+KAP1RtdSFlEEGelYuY/1A5yNifHK1T8gvQ6 gOlXFmNqBr/ptV2BU27YhAxh5iQ6nM2VbwTY41HZ75NkvmBYb+2qMskBKQezKEOeypPR1Xb9BYX g3782ll7plLahObrIxkjKRFZ16X7yV9jeC3tw5jc/KfUH5oFNcNpp X-Gm-Gg: AfdE7cnrM4EiIyg37VkIfh24CNTOVi0rgCYUaIbREFw+SaQ8uvu191F7yQBGwEyLWSZ cq3lEc3HDmNVkLBIch0BFRHqjXsABZdzjaosBlP0A3s5XIv71F2p/TDZCh1q0Xj9YdXw3MFNoXL y9LOxj3dubw5YcAWcgkDiWsL88y5NGtJfW4s1K1ZIfC//ghdLWuW0+xOepFFC43fIfmc1Mat6Gu t6ovqVkOPLomj0YaiV3qIdl+RNOOql1hcdEseTG0148eNI1Nhrb7hEL4alio/Grejh2M9MjQLyc m4oltXqxqs28TuZZnmL8guJwDrx6ZAWkAwWjE4AHiTKKam/C6/o9VFiBdmN4CUiioBxx7+IHnOU c5QkYmELVDmX+F+7zb83Tpn4+m8o= X-Received: by 2002:a05:622a:4291:b0:517:6435:c4ce with SMTP id d75a77b69052e-51a72822e58mr60054881cf.49.1782422860006; Thu, 25 Jun 2026 14:27:40 -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 6a1803df08f44-8df82b6856dsm13100326d6.20.2026.06.25.14.27.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jun 2026 14:27:39 -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 686F3401FD; Thu, 25 Jun 2026 15:27:39 -0600 (MDT) Received: by dev-sgogte.dev.purestorage.com (Postfix, from userid 1557734945) id 65FAB51222; Thu, 25 Jun 2026 15:27:39 -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 v3 1/2] nvme-rdma: refactor nvme_rdma_alloc_queue() to take a queue pointer Date: Thu, 25 Jun 2026 15:27:21 -0600 Message-ID: <20260625212722.1302344-2-sgogte@purestorage.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260625212722.1302344-1-sgogte@purestorage.com> References: <20260625212722.1302344-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 Callers are responsible for initializing queue->ctrl and queue->queue_size before calling nvme_rdma_alloc_queue(), which now derives ctrl and idx from the queue pointer directly. This removes redundant assignments inside the function and simplifies the interface. Signed-off-by: Surabhi Gogte --- drivers/nvme/host/rdma.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index 6909e3542794..6b0b0a3dea62 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c @@ -566,16 +566,14 @@ static int nvme_rdma_create_queue_ib(struct nvme_rdma_queue *queue) return ret; } -static int nvme_rdma_alloc_queue(struct nvme_rdma_ctrl *ctrl, - int idx, size_t queue_size) +static int nvme_rdma_alloc_queue(struct nvme_rdma_queue *queue) { - struct nvme_rdma_queue *queue; + struct nvme_rdma_ctrl *ctrl = queue->ctrl; + int idx = nvme_rdma_queue_idx(queue); struct sockaddr *src_addr = NULL; int ret; - queue = &ctrl->queues[idx]; mutex_init(&queue->queue_lock); - queue->ctrl = ctrl; if (idx && ctrl->ctrl.max_integrity_segments) queue->pi_support = true; else @@ -587,8 +585,6 @@ static int nvme_rdma_alloc_queue(struct nvme_rdma_ctrl *ctrl, else queue->cmnd_capsule_len = sizeof(struct nvme_command); - queue->queue_size = queue_size; - queue->cm_id = rdma_create_id(&init_net, nvme_rdma_cm_handler, queue, RDMA_PS_TCP, IB_QPT_RC); if (IS_ERR(queue->cm_id)) { @@ -736,8 +732,9 @@ static int nvme_rdma_alloc_io_queues(struct nvme_rdma_ctrl *ctrl) nvmf_set_io_queues(opts, nr_io_queues, ctrl->io_queues); for (i = 1; i < ctrl->ctrl.queue_count; i++) { - ret = nvme_rdma_alloc_queue(ctrl, i, - ctrl->ctrl.sqsize + 1); + ctrl->queues[i].ctrl = ctrl; + ctrl->queues[i].queue_size = ctrl->ctrl.sqsize + 1; + ret = nvme_rdma_alloc_queue(&ctrl->queues[i]); if (ret) goto out_free_queues; } @@ -783,7 +780,9 @@ static int nvme_rdma_configure_admin_queue(struct nvme_rdma_ctrl *ctrl, bool pi_capable = false; int error; - error = nvme_rdma_alloc_queue(ctrl, 0, NVME_AQ_DEPTH); + ctrl->queues[0].ctrl = ctrl; + ctrl->queues[0].queue_size = NVME_AQ_DEPTH; + error = nvme_rdma_alloc_queue(&ctrl->queues[0]); if (error) return error; -- 2.54.0