diff mbox series

[for-rc,v2,2/4] RDMA/rxe: Add a pkt->mask bit for ack_req

Message ID 20220514030435.91155-3-rpearsonhpe@gmail.com (mailing list archive)
State Changes Requested
Headers show
Series RDMA/rxe: Cleanup retransmit and rnr retry | expand

Commit Message

Bob Pearson May 14, 2022, 3:04 a.m. UTC
Add a bit to pkt->mask indicating that the ackreq bit has been
set in the current packet. Use this bit to condition setting
the retransmit timer since a packet without the ackreq bit set
will not generate a response.

Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
---
 drivers/infiniband/sw/rxe/rxe_opcode.h |  1 +
 drivers/infiniband/sw/rxe/rxe_req.c    | 11 +++++++----
 2 files changed, 8 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/infiniband/sw/rxe/rxe_opcode.h b/drivers/infiniband/sw/rxe/rxe_opcode.h
index 8f9aaaf260f2..629504245e98 100644
--- a/drivers/infiniband/sw/rxe/rxe_opcode.h
+++ b/drivers/infiniband/sw/rxe/rxe_opcode.h
@@ -80,6 +80,7 @@  enum rxe_hdr_mask {
 	RXE_END_MASK		= BIT(NUM_HDR_TYPES + 10),
 
 	RXE_LOOPBACK_MASK	= BIT(NUM_HDR_TYPES + 12),
+	RXE_ACK_REQ_MASK	= BIT(NUM_HDR_TYPES + 13),
 
 	RXE_READ_OR_ATOMIC_MASK	= (RXE_READ_MASK | RXE_ATOMIC_MASK),
 	RXE_WRITE_OR_SEND_MASK	= (RXE_WRITE_MASK | RXE_SEND_MASK),
diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c
index 1884e3a64310..d15165e9319c 100644
--- a/drivers/infiniband/sw/rxe/rxe_req.c
+++ b/drivers/infiniband/sw/rxe/rxe_req.c
@@ -394,11 +394,13 @@  static struct sk_buff *init_req_packet(struct rxe_qp *qp,
 
 	ack_req = ((pkt->mask & RXE_END_MASK) ||
 		(qp->req.noack_pkts++ > RXE_MAX_PKT_PER_ACK));
-	if (ack_req)
+	if (ack_req) {
 		qp->req.noack_pkts = 0;
+		pkt->mask |= RXE_ACK_REQ_MASK;
+	}
 
-	bth_init(pkt, pkt->opcode, solicited, 0, pad, IB_DEFAULT_PKEY_FULL, qp_num,
-		 ack_req, pkt->psn);
+	bth_init(pkt, pkt->opcode, solicited, 0, pad, IB_DEFAULT_PKEY_FULL,
+		 qp_num, ack_req, pkt->psn);
 
 	/* init optional headers */
 	if (pkt->mask & RXE_RETH_MASK) {
@@ -539,7 +541,8 @@  static void update_state(struct rxe_qp *qp, struct rxe_send_wqe *wqe,
 
 	qp->need_req_skb = 0;
 
-	if (qp->timeout_jiffies && !timer_pending(&qp->retrans_timer))
+	if ((pkt->mask & RXE_ACK_REQ_MASK) && qp->timeout_jiffies &&
+	    !timer_pending(&qp->retrans_timer))
 		mod_timer(&qp->retrans_timer,
 			  jiffies + qp->timeout_jiffies);
 }