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 6/8] RDMA/rxe: Put fake udp send code in a subroutine
Date: Thu, 27 Jul 2023 14:28:30 -0500	[thread overview]
Message-ID: <20230727192831.65495-7-rpearsonhpe@gmail.com> (raw)
In-Reply-To: <20230727192831.65495-1-rpearsonhpe@gmail.com>

Isolate the code that handles the case of an overlong to a
subroutine named fake_udp_send().

Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
---
 drivers/infiniband/sw/rxe/rxe_req.c | 37 ++++++++++++++++-------------
 1 file changed, 20 insertions(+), 17 deletions(-)

diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c
index 27be1a946d62..8423d259f26a 100644
--- a/drivers/infiniband/sw/rxe/rxe_req.c
+++ b/drivers/infiniband/sw/rxe/rxe_req.c
@@ -707,6 +707,24 @@ static int rxe_do_local_ops(struct rxe_qp *qp, struct rxe_send_wqe *wqe)
 	return 0;
 }
 
+/* C10-93.1.1: If the total sum of all the buffer lengths specified for a
+ * UD message exceeds the MTU of the port as returned by QueryHCA, the CI
+ * shall not emit any packets for this message. Further, the CI shall not
+ * generate an error due to this condition.
+ */
+static void fake_udp_send(struct rxe_qp *qp, struct rxe_send_wqe *wqe)
+{
+	wqe->first_psn = qp->req.psn;
+	wqe->last_psn = qp->req.psn;
+	qp->req.psn = (qp->req.psn + 1) & BTH_PSN_MASK;
+	qp->req.opcode = IB_OPCODE_UD_SEND_ONLY;
+	qp->req.wqe_index = queue_next_index(qp->sq.queue,
+				       qp->req.wqe_index);
+	wqe->state = wqe_state_done;
+	wqe->status = IB_WC_SUCCESS;
+	rxe_run_task(&qp->comp.task);
+}
+
 int rxe_requester(struct rxe_qp *qp)
 {
 	struct rxe_pkt_info pkt;
@@ -810,23 +828,8 @@ int rxe_requester(struct rxe_qp *qp)
 	payload = (mask & (RXE_WRITE_OR_SEND_MASK | RXE_ATOMIC_WRITE_MASK)) ?
 			wqe->dma.resid : 0;
 	if (payload > mtu) {
-		if (qp_type(qp) == IB_QPT_UD) {
-			/* C10-93.1.1: If the total sum of all the buffer lengths specified for a
-			 * UD message exceeds the MTU of the port as returned by QueryHCA, the CI
-			 * shall not emit any packets for this message. Further, the CI shall not
-			 * generate an error due to this condition.
-			 */
-
-			/* fake a successful UD send */
-			wqe->first_psn = qp->req.psn;
-			wqe->last_psn = qp->req.psn;
-			qp->req.psn = (qp->req.psn + 1) & BTH_PSN_MASK;
-			qp->req.opcode = IB_OPCODE_UD_SEND_ONLY;
-			qp->req.wqe_index = queue_next_index(qp->sq.queue,
-						       qp->req.wqe_index);
-			wqe->state = wqe_state_done;
-			wqe->status = IB_WC_SUCCESS;
-			rxe_sched_task(&qp->comp.task);
+		if (unlikely(qp_type(qp) == IB_QPT_UD)) {
+			fake_udp_send(qp, wqe);
 			goto done;
 		}
 		payload = mtu;
-- 
2.39.2


  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 ` [PATCH for-next v3 3/8] RDMA/rxe: Isolate request payload code in a subroutine Bob Pearson
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 ` Bob Pearson [this message]
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-7-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