Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4043582rdb; Mon, 11 Dec 2023 07:24:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IHdgomjclWwqp8a2S17Zx9GwKfgZ2XahypQlK/9XqYgIV6eqfbG5eQGP+DOiLe/93o0C5iS X-Received: by 2002:a6b:7205:0:b0:7b7:2a73:4988 with SMTP id n5-20020a6b7205000000b007b72a734988mr4606605ioc.35.1702308257601; Mon, 11 Dec 2023 07:24:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702308257; cv=none; d=google.com; s=arc-20160816; b=N5PuqS36dIUtXLGYwpmhOSsvnoRNUzD6UHfHWfpBxoBukSLTm9PStoEPnDFsNmT7TR uwStOdzraogIhEO72EUK62Srzc+rrcpupxvyw4RqnQnN9MFn3Wsl3hwUrdhnU8HvmNEZ JMuLUKRubPIot0mdlVIc1+Ntb7Fb2PlyCDx8N6PmpamBCerBZxYeeIkS95XfDJFWCJ+b MuWUJOKmWX4fltyi2LV9qO2KwyWOh6zE2Lca0MNZHmkFMpNzymWtiq0Gs+EZIuP83vim 8rIIGY0WlMcAJoiyfRcIN5hbpRnWokhLARxqGjNpQNkeVsWRlIHazOkMQ4PentW9G/VC chvw== ARC-Message-Signature: i=1; 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:user-agent:references:in-reply-to :message-id:date:cc:to:from:subject:dkim-signature; bh=NGbZbTrhthSAVUz/Vzb0wytkIkhcWs2h0OuQxJ3K8tg=; fh=WfGVbliYpqgzl5GprTVUBQR8rnRPHqjfX8LKlqDYYGk=; b=YULqGWCX7nzKmCwZ/z47z9nMhCWiG1DkDFiKaTMj7ZY6iRtKBIiu61oboeeProkOO6 GQRYr5WRt82FA/RCc8hXA5snrqVzHglyaOC/O9ucTWsunw0EIjlr497tIG/cFQavydL2 WO5iQhScj1bWYu5d8dWteGM0Byf/Y9yVpdX+MVeuKM33tmQwhZ3TjHwhjrHPYDT4iFxm 3uuuk7/AR1sBIxPqw86bT6Vqp1PvnEh5p3NbfqwQLkTqNBL391R3os9U8XflgN7jCmIq 7t4ile/Oz3jcb2RLaW9hSj48zDxbkHMLdIcqpuBMn5hKYbafFEZy+Gli/RzaXRFTE7vs WFKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cEJQ9dTf; spf=pass (google.com: domain of linux-nfs+bounces-483-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-483-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id n10-20020a634d4a000000b005c1b313a127si6031591pgl.660.2023.12.11.07.24.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Dec 2023 07:24:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-483-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=cEJQ9dTf; spf=pass (google.com: domain of linux-nfs+bounces-483-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-483-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 26236281DE7 for ; Mon, 11 Dec 2023 15:24:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 487F34B5A6; Mon, 11 Dec 2023 15:24:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="cEJQ9dTf" X-Original-To: linux-nfs@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 234EE4AF81; Mon, 11 Dec 2023 15:24:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AC311C433B9; Mon, 11 Dec 2023 15:24:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702308250; bh=Cn2aLrgLn9F4WwngZDunocI5s85Y6YoRuq/jxaaPDr4=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=cEJQ9dTfj1hiXCcLW1NkRUFavOioJ3tD9NITXYTr03W9MnD3MDHByAGCJT+W1ZMZq mFANGT1OyshB8b7QU2PIEr2NE1ewhmb+VDEL5xkvSfCx8EGPRTKfACyhbWpgEMWtnY x72GaqAXd06CMatfYfBpA1xyepzFBP+gcdyAaYEday8Ce2Zo2Ci5zAba4qM5riPftL 6rYydb9oAb98qqx6eANB+oLPm51zW7wKE4P3xSIencVMd5VUMSMjT8RDSxujMqD4Nh 5cgUTzPWzaoGEvVMCA6CLQ8ooluO6Mg/PIU0yodPeSe/PPhBQOsT3iQduV4WzSCvHg w0KTWL8FpuypQ== Subject: [PATCH v1 1/8] svcrdma: De-duplicate completion ID initialization helpers From: Chuck Lever To: linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org Cc: tom@talpey.com Date: Mon, 11 Dec 2023 10:24:08 -0500 Message-ID: <170230824865.90242.7760213084666437745.stgit@bazille.1015granger.net> In-Reply-To: <170230788373.90242.9421368360904462120.stgit@bazille.1015granger.net> References: <170230788373.90242.9421368360904462120.stgit@bazille.1015granger.net> User-Agent: StGit/1.5 Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit From: Chuck Lever Signed-off-by: Chuck Lever --- include/linux/sunrpc/svc_rdma.h | 24 ++++++++++++++++++++++++ net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 7 ------- net/sunrpc/xprtrdma/svc_rdma_rw.c | 9 +-------- net/sunrpc/xprtrdma/svc_rdma_sendto.c | 7 ------- 4 files changed, 25 insertions(+), 22 deletions(-) diff --git a/include/linux/sunrpc/svc_rdma.h b/include/linux/sunrpc/svc_rdma.h index 051fefde8d51..46f2ce9f810b 100644 --- a/include/linux/sunrpc/svc_rdma.h +++ b/include/linux/sunrpc/svc_rdma.h @@ -134,6 +134,30 @@ enum { #define RPCSVC_MAXPAYLOAD_RDMA RPCSVC_MAXPAYLOAD +/** + * svc_rdma_send_cid_init - Initialize a Receive Queue completion ID + * @rdma: controlling transport + * @cid: completion ID to initialize + */ +static inline void svc_rdma_recv_cid_init(struct svcxprt_rdma *rdma, + struct rpc_rdma_cid *cid) +{ + cid->ci_queue_id = rdma->sc_rq_cq->res.id; + cid->ci_completion_id = atomic_inc_return(&rdma->sc_completion_ids); +} + +/** + * svc_rdma_send_cid_init - Initialize a Send Queue completion ID + * @rdma: controlling transport + * @cid: completion ID to initialize + */ +static inline void svc_rdma_send_cid_init(struct svcxprt_rdma *rdma, + struct rpc_rdma_cid *cid) +{ + cid->ci_queue_id = rdma->sc_sq_cq->res.id; + cid->ci_completion_id = atomic_inc_return(&rdma->sc_completion_ids); +} + /* * A chunk context tracks all I/O for moving one Read or Write * chunk. This is a set of rdma_rw's that handle data movement diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c index 392a91dc8a99..ac6351e292c5 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c @@ -115,13 +115,6 @@ svc_rdma_next_recv_ctxt(struct list_head *list) rc_list); } -static void svc_rdma_recv_cid_init(struct svcxprt_rdma *rdma, - struct rpc_rdma_cid *cid) -{ - cid->ci_queue_id = rdma->sc_rq_cq->res.id; - cid->ci_completion_id = atomic_inc_return(&rdma->sc_completion_ids); -} - static struct svc_rdma_recv_ctxt * svc_rdma_recv_ctxt_alloc(struct svcxprt_rdma *rdma) { diff --git a/net/sunrpc/xprtrdma/svc_rdma_rw.c b/net/sunrpc/xprtrdma/svc_rdma_rw.c index 4d2db06ccfd2..eab71f3867fa 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_rw.c +++ b/net/sunrpc/xprtrdma/svc_rdma_rw.c @@ -146,13 +146,6 @@ static int svc_rdma_rw_ctx_init(struct svcxprt_rdma *rdma, return ret; } -static void svc_rdma_cc_cid_init(struct svcxprt_rdma *rdma, - struct rpc_rdma_cid *cid) -{ - cid->ci_queue_id = rdma->sc_sq_cq->res.id; - cid->ci_completion_id = atomic_inc_return(&rdma->sc_completion_ids); -} - /** * svc_rdma_cc_init - Initialize an svc_rdma_chunk_ctxt * @rdma: controlling transport instance @@ -161,7 +154,7 @@ static void svc_rdma_cc_cid_init(struct svcxprt_rdma *rdma, void svc_rdma_cc_init(struct svcxprt_rdma *rdma, struct svc_rdma_chunk_ctxt *cc) { - svc_rdma_cc_cid_init(rdma, &cc->cc_cid); + svc_rdma_send_cid_init(rdma, &cc->cc_cid); INIT_LIST_HEAD(&cc->cc_rwctxts); cc->cc_sqecount = 0; diff --git a/net/sunrpc/xprtrdma/svc_rdma_sendto.c b/net/sunrpc/xprtrdma/svc_rdma_sendto.c index 9571ed4a74d4..c9585e469ca8 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_sendto.c +++ b/net/sunrpc/xprtrdma/svc_rdma_sendto.c @@ -113,13 +113,6 @@ static void svc_rdma_wc_send(struct ib_cq *cq, struct ib_wc *wc); -static void svc_rdma_send_cid_init(struct svcxprt_rdma *rdma, - struct rpc_rdma_cid *cid) -{ - cid->ci_queue_id = rdma->sc_sq_cq->res.id; - cid->ci_completion_id = atomic_inc_return(&rdma->sc_completion_ids); -} - static struct svc_rdma_send_ctxt * svc_rdma_send_ctxt_alloc(struct svcxprt_rdma *rdma) {