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 3/8] RDMA/rxe: Isolate request payload code in a subroutine
Date: Thu, 27 Jul 2023 14:28:27 -0500 [thread overview]
Message-ID: <20230727192831.65495-4-rpearsonhpe@gmail.com> (raw)
In-Reply-To: <20230727192831.65495-1-rpearsonhpe@gmail.com>
Isolate the code that fills the payload of a request packet into
a subroutine named rxe_init_payload().
Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
---
drivers/infiniband/sw/rxe/rxe_req.c | 34 +++++++++++++++++------------
1 file changed, 20 insertions(+), 14 deletions(-)
diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c
index 6e9c8da001a4..c92e561b8a0b 100644
--- a/drivers/infiniband/sw/rxe/rxe_req.c
+++ b/drivers/infiniband/sw/rxe/rxe_req.c
@@ -477,6 +477,25 @@ static void rxe_init_roce_hdrs(struct rxe_qp *qp, struct rxe_send_wqe *wqe,
}
}
+static int rxe_init_payload(struct rxe_qp *qp, struct rxe_send_wqe *wqe,
+ struct rxe_pkt_info *pkt, u32 payload)
+{
+ void *data;
+ int err = 0;
+
+ if (wqe->wr.send_flags & IB_SEND_INLINE) {
+ data = &wqe->dma.inline_data[wqe->dma.sge_offset];
+ memcpy(payload_addr(pkt), data, payload);
+ wqe->dma.resid -= payload;
+ wqe->dma.sge_offset += payload;
+ } else {
+ err = copy_data(qp->pd, 0, &wqe->dma, payload_addr(pkt),
+ payload, RXE_FROM_MR_OBJ);
+ }
+
+ return err;
+}
+
static struct sk_buff *init_req_packet(struct rxe_qp *qp,
struct rxe_av *av,
struct rxe_send_wqe *wqe,
@@ -513,20 +532,7 @@ static int finish_packet(struct rxe_qp *qp, struct rxe_av *av,
return err;
if (pkt->mask & RXE_WRITE_OR_SEND_MASK) {
- if (wqe->wr.send_flags & IB_SEND_INLINE) {
- u8 *tmp = &wqe->dma.inline_data[wqe->dma.sge_offset];
-
- memcpy(payload_addr(pkt), tmp, payload);
-
- wqe->dma.resid -= payload;
- wqe->dma.sge_offset += payload;
- } else {
- err = copy_data(qp->pd, 0, &wqe->dma,
- payload_addr(pkt), payload,
- RXE_FROM_MR_OBJ);
- if (err)
- return err;
- }
+ err = rxe_init_payload(qp, wqe, pkt, payload);
if (pkt->pad) {
pad_addr = payload_addr(pkt) + payload;
memset(pad_addr, 0, pkt->pad);
--
2.39.2
next prev parent reply other threads:[~2023-07-27 19:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-27 19:28 [PATCH for-next v3 0/7] RDMA/rxe: Misc cleanups Bob Pearson
2023-07-27 19:28 ` [PATCH for-next v3 1/8] RDMA/rxe: Add pad size to struct rxe_pkt_info Bob Pearson
2023-07-27 19:28 ` [PATCH for-next v3 2/8] RDMA/rxe: Isolate code to fill request roce headers Bob Pearson
2023-07-27 19:28 ` Bob Pearson [this message]
2023-07-27 19:28 ` [PATCH for-next v3 4/8] RDMA/rxe: Remove paylen parameter from rxe_init_packet Bob Pearson
2023-07-27 19:28 ` [PATCH for-next v3 5/8] RDMA/rxe: Isolate code to build request packet Bob Pearson
2023-07-27 19:28 ` [PATCH for-next v3 6/8] RDMA/rxe: Put fake udp send code in a subroutine Bob Pearson
2023-07-27 19:28 ` [PATCH for-next v3 7/8] RDMA/rxe: Combine setting pkt info Bob Pearson
2023-07-27 19:28 ` [PATCH for-next v3 8/8] RDMA/rxe: Move next_opcode to rxe_opcode.c Bob Pearson
2023-08-09 19:20 ` [PATCH for-next v3 0/7] RDMA/rxe: Misc cleanups 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=20230727192831.65495-4-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