Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2759991rdb; Mon, 4 Dec 2023 06:56:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IFFm8X9e/JvWoV8KrokyaDQCWQo4Iz0RLlJAFDEAMM/NeayKVwkfG6tz0djQC3OylRBOd0q X-Received: by 2002:a17:902:e887:b0:1d0:8be8:bb6a with SMTP id w7-20020a170902e88700b001d08be8bb6amr3029693plg.67.1701701812019; Mon, 04 Dec 2023 06:56:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701701812; cv=none; d=google.com; s=arc-20160816; b=p26BaFT/bN/bejDnNidIfHPqqg5Dofe6lHaKvYQ3+RjLh5oLSmb1WSr/EbQaJqyqwL EKW6k3tNS9DEULMCPOHRC1c4aGNi4QlBVpPQ6gif28Oj/lUwCbYVTfkbH5TKeyz2A1yQ tqlGt7NcaoVxazLklP05uEj6eMu8oLSPUo12POTy9yMfHIW7nFtcP8S9YiUk0zMAzKtW S9H/e+lCnlKECUYR+kLtO4BY/5ju/9GszyyN0/MpG1YANGQB+uT1KuqwudTtQhGpxZ82 xk7rfPvCPuRxJB6q4r8dl++yB1rJ0ZwiuD1E0E8OCrC2Bjm1VpXvO8ZU1YNCuVdmgVcV DTJw== 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=Md4MiRSG8RHKRowyEEizu81R3YNK3hbF1ba0rAKrtlI=; fh=WfGVbliYpqgzl5GprTVUBQR8rnRPHqjfX8LKlqDYYGk=; b=zPEOTVbC7zQ5j9uAGEk0i8gP+JiOQaWEifRE7RpvJ/74f7PL+T59v7T0N54QmrhdSp H4nD3S15LQ1NFELB99kQSYURC8mmv58WR8Dgfw25Er6+TJFRqoSVRuMXiAgUYhW5VV8y NvEjSjXi/ZW5TW+WJg4I5cFTivTyEVgMHEP0X4GKN59gUZkcsWhzMCL74jQK8qRFY+Xi jnRDjWxPpw/NxI9QOzrrCdOcPOc5t0g0gfmUc2F+InnHWcxjZClnn0w3Zn59eGUvvwGk Ao91ux51hCo65f0NRZ6Au/ctkG2wt1DsGA2uTtguk/2F0o+JpQa2hjGSQcf3NFOALpAM hf0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pZIhmkhE; spf=pass (google.com: domain of linux-nfs+bounces-279-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-279-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id j6-20020a170903024600b001cfa70fd337si7893761plh.301.2023.12.04.06.56.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 06:56:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-279-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=pZIhmkhE; spf=pass (google.com: domain of linux-nfs+bounces-279-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-279-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id C7FDAB20985 for ; Mon, 4 Dec 2023 14:56:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B4CD128E07; Mon, 4 Dec 2023 14:56:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="pZIhmkhE" 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 9636528DB6; Mon, 4 Dec 2023 14:56:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C71AC433C8; Mon, 4 Dec 2023 14:56:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701701805; bh=OgxhiV6P9E3V+VCH1ztRduwpyc8kJqsYco7mhx4iJU8=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=pZIhmkhEX6jOupnBCzDEPl9PNfGN7lhdOws5v8J0k3RvlMLW+pBqPtVphkRxX88aq Q//yp60RJO4MGu5SHUmfOa+5qQcfelpg1xqsSuHNVKm0szKO7NqqI0wEyjJHV0mNKS VsozFKiDEXXxBAGOy5WkBmM0cRtrIntC/yAN6mu3262OxFwaluqK/avuSFcnW7DIL6 f8X3QwFE1FlibCmwcPOzWms/sPeVwuM0sFr4BowxF24PCU+H3GEEgBqNVrElRNxWht pw/9oQ3av42ILxisb8NbyauMybA8fKQw2HYS2AEmYCUkoR4pQxlKeJ7Geia+WRU+ZU cCdnHNw/fPW+w== Subject: [PATCH v1 04/21] svcrdma: Explicitly pass the transport into Read chunk I/O paths From: Chuck Lever To: linux-nfs@vger.kernel.org, linux-rdma@vger.kernel.org Cc: tom@talpey.com Date: Mon, 04 Dec 2023 09:56:44 -0500 Message-ID: <170170180418.54779.17658853478664431036.stgit@bazille.1015granger.net> In-Reply-To: <170170144201.54779.9877683240030806819.stgit@bazille.1015granger.net> References: <170170144201.54779.9877683240030806819.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 Enable the eventual removal of the svc_rdma_chunk_ctxt::cc_rdma field. Signed-off-by: Chuck Lever --- net/sunrpc/xprtrdma/svc_rdma_rw.c | 58 +++++++++++++++++++++++-------------- 1 file changed, 36 insertions(+), 22 deletions(-) diff --git a/net/sunrpc/xprtrdma/svc_rdma_rw.c b/net/sunrpc/xprtrdma/svc_rdma_rw.c index ef2579141c33..cda57a5f8ba0 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_rw.c +++ b/net/sunrpc/xprtrdma/svc_rdma_rw.c @@ -712,6 +712,7 @@ int svc_rdma_send_reply_chunk(struct svcxprt_rdma *rdma, /** * svc_rdma_build_read_segment - Build RDMA Read WQEs to pull one RDMA segment + * @rdma: controlling transport * @info: context for ongoing I/O * @segment: co-ordinates of remote memory to be read * @@ -721,7 +722,8 @@ int svc_rdma_send_reply_chunk(struct svcxprt_rdma *rdma, * %-ENOMEM: allocating a local resources failed * %-EIO: a DMA mapping error occurred */ -static int svc_rdma_build_read_segment(struct svc_rdma_read_info *info, +static int svc_rdma_build_read_segment(struct svcxprt_rdma *rdma, + struct svc_rdma_read_info *info, const struct svc_rdma_segment *segment) { struct svc_rdma_recv_ctxt *head = info->ri_readctxt; @@ -734,7 +736,7 @@ static int svc_rdma_build_read_segment(struct svc_rdma_read_info *info, len = segment->rs_length; sge_no = PAGE_ALIGN(info->ri_pageoff + len) >> PAGE_SHIFT; - ctxt = svc_rdma_get_rw_ctxt(cc->cc_rdma, sge_no); + ctxt = svc_rdma_get_rw_ctxt(rdma, sge_no); if (!ctxt) return -ENOMEM; ctxt->rw_nents = sge_no; @@ -764,7 +766,7 @@ static int svc_rdma_build_read_segment(struct svc_rdma_read_info *info, goto out_overrun; } - ret = svc_rdma_rw_ctx_init(cc->cc_rdma, ctxt, segment->rs_offset, + ret = svc_rdma_rw_ctx_init(rdma, ctxt, segment->rs_offset, segment->rs_handle, DMA_FROM_DEVICE); if (ret < 0) return -EIO; @@ -781,6 +783,7 @@ static int svc_rdma_build_read_segment(struct svc_rdma_read_info *info, /** * svc_rdma_build_read_chunk - Build RDMA Read WQEs to pull one RDMA chunk + * @rdma: controlling transport * @info: context for ongoing I/O * @chunk: Read chunk to pull * @@ -790,7 +793,8 @@ static int svc_rdma_build_read_segment(struct svc_rdma_read_info *info, * %-ENOMEM: allocating a local resources failed * %-EIO: a DMA mapping error occurred */ -static int svc_rdma_build_read_chunk(struct svc_rdma_read_info *info, +static int svc_rdma_build_read_chunk(struct svcxprt_rdma *rdma, + struct svc_rdma_read_info *info, const struct svc_rdma_chunk *chunk) { const struct svc_rdma_segment *segment; @@ -798,7 +802,7 @@ static int svc_rdma_build_read_chunk(struct svc_rdma_read_info *info, ret = -EINVAL; pcl_for_each_segment(segment, chunk) { - ret = svc_rdma_build_read_segment(info, segment); + ret = svc_rdma_build_read_segment(rdma, info, segment); if (ret < 0) break; info->ri_totalbytes += segment->rs_length; @@ -858,6 +862,7 @@ static int svc_rdma_copy_inline_range(struct svc_rdma_read_info *info, /** * svc_rdma_read_multiple_chunks - Construct RDMA Reads to pull data item Read chunks + * @rdma: controlling transport * @info: context for RDMA Reads * * The chunk data lands in rqstp->rq_arg as a series of contiguous pages, @@ -870,7 +875,8 @@ static int svc_rdma_copy_inline_range(struct svc_rdma_read_info *info, * %-ENOTCONN: posting failed (connection is lost), * %-EIO: rdma_rw initialization failed (DMA mapping, etc). */ -static noinline int svc_rdma_read_multiple_chunks(struct svc_rdma_read_info *info) +static noinline int svc_rdma_read_multiple_chunks(struct svcxprt_rdma *rdma, + struct svc_rdma_read_info *info) { struct svc_rdma_recv_ctxt *head = info->ri_readctxt; const struct svc_rdma_pcl *pcl = &head->rc_read_pcl; @@ -887,7 +893,7 @@ static noinline int svc_rdma_read_multiple_chunks(struct svc_rdma_read_info *inf return ret; pcl_for_each_chunk(chunk, pcl) { - ret = svc_rdma_build_read_chunk(info, chunk); + ret = svc_rdma_build_read_chunk(rdma, info, chunk); if (ret < 0) return ret; @@ -920,6 +926,7 @@ static noinline int svc_rdma_read_multiple_chunks(struct svc_rdma_read_info *inf /** * svc_rdma_read_data_item - Construct RDMA Reads to pull data item Read chunks + * @rdma: controlling transport * @info: context for RDMA Reads * * The chunk data lands in the page list of rqstp->rq_arg.pages. @@ -935,7 +942,8 @@ static noinline int svc_rdma_read_multiple_chunks(struct svc_rdma_read_info *inf * %-ENOTCONN: posting failed (connection is lost), * %-EIO: rdma_rw initialization failed (DMA mapping, etc). */ -static int svc_rdma_read_data_item(struct svc_rdma_read_info *info) +static int svc_rdma_read_data_item(struct svcxprt_rdma *rdma, + struct svc_rdma_read_info *info) { struct svc_rdma_recv_ctxt *head = info->ri_readctxt; struct xdr_buf *buf = &info->ri_rqst->rq_arg; @@ -944,7 +952,7 @@ static int svc_rdma_read_data_item(struct svc_rdma_read_info *info) int ret; chunk = pcl_first_chunk(&head->rc_read_pcl); - ret = svc_rdma_build_read_chunk(info, chunk); + ret = svc_rdma_build_read_chunk(rdma, info, chunk); if (ret < 0) goto out; @@ -978,6 +986,7 @@ static int svc_rdma_read_data_item(struct svc_rdma_read_info *info) /** * svc_rdma_read_chunk_range - Build RDMA Read WQEs for portion of a chunk + * @rdma: controlling transport * @info: context for RDMA Reads * @chunk: parsed Call chunk to pull * @offset: offset of region to pull @@ -990,7 +999,8 @@ static int svc_rdma_read_data_item(struct svc_rdma_read_info *info) * %-ENOTCONN: posting failed (connection is lost), * %-EIO: rdma_rw initialization failed (DMA mapping, etc). */ -static int svc_rdma_read_chunk_range(struct svc_rdma_read_info *info, +static int svc_rdma_read_chunk_range(struct svcxprt_rdma *rdma, + struct svc_rdma_read_info *info, const struct svc_rdma_chunk *chunk, unsigned int offset, unsigned int length) { @@ -1010,7 +1020,7 @@ static int svc_rdma_read_chunk_range(struct svc_rdma_read_info *info, dummy.rs_length = min_t(u32, length, segment->rs_length) - offset; dummy.rs_offset = segment->rs_offset + offset; - ret = svc_rdma_build_read_segment(info, &dummy); + ret = svc_rdma_build_read_segment(rdma, info, &dummy); if (ret < 0) break; @@ -1023,6 +1033,7 @@ static int svc_rdma_read_chunk_range(struct svc_rdma_read_info *info, /** * svc_rdma_read_call_chunk - Build RDMA Read WQEs to pull a Long Message + * @rdma: controlling transport * @info: context for RDMA Reads * * Return values: @@ -1032,7 +1043,8 @@ static int svc_rdma_read_chunk_range(struct svc_rdma_read_info *info, * %-ENOTCONN: posting failed (connection is lost), * %-EIO: rdma_rw initialization failed (DMA mapping, etc). */ -static int svc_rdma_read_call_chunk(struct svc_rdma_read_info *info) +static int svc_rdma_read_call_chunk(struct svcxprt_rdma *rdma, + struct svc_rdma_read_info *info) { struct svc_rdma_recv_ctxt *head = info->ri_readctxt; const struct svc_rdma_chunk *call_chunk = @@ -1043,17 +1055,17 @@ static int svc_rdma_read_call_chunk(struct svc_rdma_read_info *info) int ret; if (pcl_is_empty(pcl)) - return svc_rdma_build_read_chunk(info, call_chunk); + return svc_rdma_build_read_chunk(rdma, info, call_chunk); start = 0; chunk = pcl_first_chunk(pcl); length = chunk->ch_position; - ret = svc_rdma_read_chunk_range(info, call_chunk, start, length); + ret = svc_rdma_read_chunk_range(rdma, info, call_chunk, start, length); if (ret < 0) return ret; pcl_for_each_chunk(chunk, pcl) { - ret = svc_rdma_build_read_chunk(info, chunk); + ret = svc_rdma_build_read_chunk(rdma, info, chunk); if (ret < 0) return ret; @@ -1063,7 +1075,7 @@ static int svc_rdma_read_call_chunk(struct svc_rdma_read_info *info) start += length; length = next->ch_position - info->ri_totalbytes; - ret = svc_rdma_read_chunk_range(info, call_chunk, + ret = svc_rdma_read_chunk_range(rdma, info, call_chunk, start, length); if (ret < 0) return ret; @@ -1071,11 +1083,12 @@ static int svc_rdma_read_call_chunk(struct svc_rdma_read_info *info) start += length; length = call_chunk->ch_length - start; - return svc_rdma_read_chunk_range(info, call_chunk, start, length); + return svc_rdma_read_chunk_range(rdma, info, call_chunk, start, length); } /** * svc_rdma_read_special - Build RDMA Read WQEs to pull a Long Message + * @rdma: controlling transport * @info: context for RDMA Reads * * The start of the data lands in the first page just after the @@ -1092,12 +1105,13 @@ static int svc_rdma_read_call_chunk(struct svc_rdma_read_info *info) * %-ENOTCONN: posting failed (connection is lost), * %-EIO: rdma_rw initialization failed (DMA mapping, etc). */ -static noinline int svc_rdma_read_special(struct svc_rdma_read_info *info) +static noinline int svc_rdma_read_special(struct svcxprt_rdma *rdma, + struct svc_rdma_read_info *info) { struct xdr_buf *buf = &info->ri_rqst->rq_arg; int ret; - ret = svc_rdma_read_call_chunk(info); + ret = svc_rdma_read_call_chunk(rdma, info); if (ret < 0) goto out; @@ -1156,11 +1170,11 @@ int svc_rdma_process_read_list(struct svcxprt_rdma *rdma, if (pcl_is_empty(&head->rc_call_pcl)) { if (head->rc_read_pcl.cl_count == 1) - ret = svc_rdma_read_data_item(info); + ret = svc_rdma_read_data_item(rdma, info); else - ret = svc_rdma_read_multiple_chunks(info); + ret = svc_rdma_read_multiple_chunks(rdma, info); } else - ret = svc_rdma_read_special(info); + ret = svc_rdma_read_special(rdma, info); if (ret < 0) goto out_err;