public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Bob Pearson <rpearsonhpe@gmail.com>
To: jgg@nvidia.com, zyjzyj2000@gmail.com, linux-rdma@vger.kernel.org,
	jhack@hpe.com
Cc: Bob Pearson <rpearsonhpe@gmail.com>
Subject: [PATCH for-next v3 09/10] RDMA/rxe: Extend do_read() in rxe_comp.c for frags
Date: Thu, 27 Jul 2023 15:01:28 -0500	[thread overview]
Message-ID: <20230727200128.65947-10-rpearsonhpe@gmail.com> (raw)
In-Reply-To: <20230727200128.65947-1-rpearsonhpe@gmail.com>

Extend do_read() in rxe_comp.c to support fragmented skbs.

Rename rxe_do_read(). Adjust caller's API.

Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
---
 drivers/infiniband/sw/rxe/rxe_comp.c | 39 ++++++++++++++++++----------
 1 file changed, 26 insertions(+), 13 deletions(-)

diff --git a/drivers/infiniband/sw/rxe/rxe_comp.c b/drivers/infiniband/sw/rxe/rxe_comp.c
index 670ee08f6f5a..ecaaed15c4eb 100644
--- a/drivers/infiniband/sw/rxe/rxe_comp.c
+++ b/drivers/infiniband/sw/rxe/rxe_comp.c
@@ -360,22 +360,35 @@ static inline enum comp_state check_ack(struct rxe_qp *qp,
 	return COMPST_ERROR;
 }
 
-static inline enum comp_state do_read(struct rxe_qp *qp,
-				      struct rxe_pkt_info *pkt,
-				      struct rxe_send_wqe *wqe)
+/**
+ * rxe_do_read() - Process read reply packet
+ * @qp: The queue pair
+ * @pkt: Packet info
+ * @wqe: The current work request
+ *
+ * Copy payload from incoming read reply packet into current
+ * iova.
+ *
+ * Returns: 0 on success else an error comp_state
+ */
+static inline enum comp_state rxe_do_read(struct rxe_qp *qp,
+					  struct rxe_pkt_info *pkt,
+					  struct rxe_send_wqe *wqe)
 {
 	struct sk_buff *skb = PKT_TO_SKB(pkt);
-	int skb_offset = 0;
-	int ret;
+	u8 *data_addr = payload_addr(pkt);
+	int data_len = payload_size(pkt);
+	enum rxe_mr_copy_op op;
+	int skb_offset;
+	int err;
 
-	ret = rxe_copy_dma_data(skb, qp->pd, IB_ACCESS_LOCAL_WRITE,
-				&wqe->dma, payload_addr(pkt),
-				skb_offset, payload_size(pkt),
-				RXE_COPY_TO_MR);
-	if (ret) {
-		wqe->status = IB_WC_LOC_PROT_ERR;
+	op = skb_is_nonlinear(skb) ? RXE_FRAG_TO_MR : RXE_COPY_TO_MR;
+	skb_offset = rxe_opcode[pkt->opcode].length;
+	err = rxe_copy_dma_data(skb, qp->pd, IB_ACCESS_LOCAL_WRITE,
+				&wqe->dma, data_addr,
+				skb_offset, data_len, op);
+	if (err)
 		return COMPST_ERROR;
-	}
 
 	if (wqe->dma.resid == 0 && (pkt->mask & RXE_END_MASK))
 		return COMPST_COMP_ACK;
@@ -704,7 +717,7 @@ int rxe_completer(struct rxe_qp *qp)
 			break;
 
 		case COMPST_READ:
-			state = do_read(qp, pkt, wqe);
+			state = rxe_do_read(qp, pkt, wqe);
 			break;
 
 		case COMPST_ATOMIC:
-- 
2.39.2


  parent reply	other threads:[~2023-07-27 20:02 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-27 20:01 [PATCH for-next v3 00/10] RDMA/rxe: Implement support for nonlinear packets Bob Pearson
2023-07-27 20:01 ` [PATCH for-next v3 01/10] RDMA/rxe: Add sg fragment ops Bob Pearson
2023-07-28  1:07   ` Zhu Yanjun
2023-07-28  1:49     ` Bob Pearson
2023-07-27 20:01 ` [PATCH for-next v3 02/10] RDMA/rxe: Extend rxe_mr_copy to support skb frags Bob Pearson
2023-07-27 20:01 ` [PATCH for-next v3 03/10] RDMA/rxe: Extend copy_data " Bob Pearson
2023-07-27 20:01 ` [PATCH for-next v3 04/10] RDMA/rxe: Extend rxe_init_packet() to support frags Bob Pearson
2023-07-27 20:01 ` [PATCH for-next v3 05/10] RDMA/rxe: Extend rxe_icrc.c " Bob Pearson
2023-07-28 14:20   ` Zhu Yanjun
2023-07-28 14:49     ` Bob Pearson
2023-07-28 23:39       ` Zhu Yanjun
2023-07-27 20:01 ` [PATCH for-next v3 06/10] RDMA/rxe: Extend rxe_init_req_packet() for frags Bob Pearson
2023-07-27 20:01 ` [PATCH for-next v3 07/10] RDMA/rxe: Extend response packets " Bob Pearson
2023-07-27 20:01 ` [PATCH for-next v3 08/10] RDMA/rxe: Extend send/write_data_in() " Bob Pearson
2023-07-27 20:01 ` Bob Pearson [this message]
2023-07-27 20:01 ` [PATCH for-next v3 10/10] RDMA/rxe: Enable sg code in rxe Bob Pearson
2023-08-15 19:07   ` Jason Gunthorpe
2023-07-28  0:40 ` [PATCH for-next v3 00/10] RDMA/rxe: Implement support for nonlinear packets Zhu Yanjun
2023-07-28  1:54   ` Bob Pearson
2023-08-15 19:08 ` Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230727200128.65947-10-rpearsonhpe@gmail.com \
    --to=rpearsonhpe@gmail.com \
    --cc=jgg@nvidia.com \
    --cc=jhack@hpe.com \
    --cc=linux-rdma@vger.kernel.org \
    --cc=zyjzyj2000@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox