From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f100.google.com (mail-wm1-f100.google.com [209.85.128.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 F297218FDDE for ; Sat, 27 Jun 2026 04:16:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.100 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782533814; cv=none; b=kuhxsVZ56smpeHfrVnTnPAGNipkHXnXTbn10RHstjjf2Uo0HTQzECnd6xFF6CdMUtWdkzMbO9YTFYbTgXiY5TLv6e6wCdmrSRaTs6oyH3mogrVLwO+L90oCLKtcCZOK/3n0mejZUECQ7Uh8ec77g6MH/fHEV+I/mrph7fkCFMiY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782533814; c=relaxed/simple; bh=UrBZPDZt/sR7Io7FYOyRVzAKrrDvj5Gz3ZQEahB08e0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lB4FgCsLnVoOAsNAE04RTcRHvhgIt66AInVHoh1e6ZCtJnrhTKYFq8OvAy2vA5/bSakaNB61bzGMFfTk8x9bG6aNKo+RDErm4I2muWUnDZSJtN0eXbi/MwPvW+Y28FJr7ZrnIZTD0vInON1FcCgEZwzoNGHnsbCg730RsGHqqLc= 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=M4ZRymEz; arc=none smtp.client-ip=209.85.128.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="M4ZRymEz" Received: by mail-wm1-f100.google.com with SMTP id 5b1f17b1804b1-4926046fbc5so18020925e9.0 for ; Fri, 26 Jun 2026 21:16:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=purestorage.com; s=google2022; t=1782533811; x=1783138611; 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=UqQrXbvNNtV5YXjfD1Jedf36ralgeIbi+2SpSm+BWs4=; b=M4ZRymEz5WBwzLhNmBSOlv9a44BsQlfh8umTk9CiDKfmKy3QoqjrfgpctLImwLEPvZ bASYBBqWyEpsaNx9VMamAaiZLYUkrl1c9Z6wsIGCeNHyLrENc21mNoef4Z/T+og8d47o aG/ktJYwlnw321+x7pEXTAsf47LA+AZlscvrLgi1oMS4T1RQo1lWgPhnjPWAIklSDaQQ /VPL9TGlYAGso+ob/SRuV4wEmbA0JvaFd0IsL7oSLbNB1baOE9yEqXcfAFs1Nw3dMW8l 3qM418JZST1rFQyEMHIkdsYXi2+06coslxj6KrZdfcMgnmY36IJUY0xy1B2Sv2CHZRSL kE1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782533811; x=1783138611; 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=UqQrXbvNNtV5YXjfD1Jedf36ralgeIbi+2SpSm+BWs4=; b=JZFk1j7uAKvvd4pcVYm15HBe71gFA7Xefuyar7NAslgoRhfTfD2GBu4NkeTzKdeU6K QT4sk+Mtc9IBvXODX+tDDc7nI4BYjfjVCgTowzacYkTFDJiMueD6yjdY0LlNgwTV6lGo L1EwUkWUYOnwkuHKEtqcQGELsRDAtuqITcoy8hJAq5AUOQQaHKa4oJnhZyQE/6vVvyEa K1QRBQmcCjPU4gQc/JtpkFFkEzxgxZOgAHULmz/aEDhZq9hinC2HiKvFoOvDWqhGvPWu Dbnc5MBQ7YkiaGWl4/FXNUh0iz4J/eIinWLm7JrOdVZoGz4ic6jCfMZUVgJyAC1vu2X8 AegA== X-Forwarded-Encrypted: i=1; AFNElJ9NyiPuDjru/vFqefiytqCxvNcY0zmG20DHddnbczF9suMGuvQgpxCpZd9MejnfFsFRx/RJYug5mYdnD5M=@vger.kernel.org X-Gm-Message-State: AOJu0YwyYFxnp7XIH7uII9TNjVQgLMJPcIMB27qJ/bXTK6W2BLxp7Syy Asx7Oxy/i3oJXC+H6aMgGCtN5BOiJ3AtzASxfwjbSOA5lDuF2XvGQfoAYwN0HuBrSvdhHlvwLnc trtH0pZ6cdg6Rzy6Pk482zr+89tanDVvxNYN3p413HWwbSuFz4gxq X-Gm-Gg: AfdE7ckqrl/stdv1gSQaHwbJkkL6aTGbfNmaWKi6k1FAAb4LZgWcswfkFHoGu4LZRRZ 0meCkaJy3BuXozGmxK1hxfgIs46o2O0Z30uL7dyYU+df3Mu1vOJY6swD6tZJ98Az8xm656m/N8F z+lh/KXkVhELFhAs/c7dXY4vEsZMQUDxysThQ+SO3z3hC+ZcmfRPHZPwpI2iqScxY+JJJI+rg4O 9mleSPrfH6QMbsETFQFs1NZDXdUFfWTr58ugtAXmXdki6a/eXszQwj8XMg+DgdLwwyDiry27BSM 9FyiLpY5NuUMmVhDyCoEbjSDHgO9/yZcnzmVYNwhlIzPjLXpTetydpcCJa0eMuOgsjSMvPeap9/ YRLwb/L2J2ImefhywlvL0FdUuMJ0= X-Received: by 2002:a05:600d:8497:20b0:490:af63:2cb1 with SMTP id 5b1f17b1804b1-492663e5d71mr94058485e9.7.1782533811424; Fri, 26 Jun 2026 21:16:51 -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 5b1f17b1804b1-49268ff963dsm1889285e9.8.2026.06.26.21.16.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jun 2026 21:16:51 -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 65FF340146; Fri, 26 Jun 2026 22:16:49 -0600 (MDT) Received: by dev-sgogte.dev.purestorage.com (Postfix, from userid 1557734945) id 6368551219; Fri, 26 Jun 2026 22:16:49 -0600 (MDT) From: Surabhi Gogte To: Christoph Hellwig , Keith Busch , Jens Axboe , 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 v4 1/2] nvme-rdma: refactor nvme_rdma_alloc_queue() to take a queue pointer Date: Fri, 26 Jun 2026 22:15:50 -0600 Message-ID: <20260627041551.1981256-2-sgogte@purestorage.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260627041551.1981256-1-sgogte@purestorage.com> References: <20260627041551.1981256-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 Reviewed-by: Christoph Hellwig --- 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