Skip to contentSkip to conversation

RDMA/rxe: Use correct ATOMIC Acknowledge opcode in BTH

PATCH In review Xiao Yang 2 participants 3 messages Jul 5, 2022 – Jul 14, 2022

Subsystems (2)
lore
Share & tools
lore

Xiao Yang

author
#0 lore raw

PATCH 1/1 RDMA/rxe: Use correct ATOMIC Acknowledge opcode in BTH

When responder processed an Atomic requeset and got a NAK, the opcode field in BTH should be ATOMIC Acknowledge instead of Acknowledge.

---
 drivers/infiniband/sw/rxe/rxe_resp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/infiniband/sw/rxe/rxe_resp.c +3 -3
index 265e46fe050f..592d73c37d48 100644
@@ -1080,10 +1080,10 @@ static enum resp_states acknowledge(struct rxe_qp *qp,
 	if (qp_type(qp) != IB_QPT_RC)
 		return RESPST_CLEANUP;
 
-	if (qp->resp.aeth_syndrome != AETH_ACK_UNLIMITED)
+	if (pkt->mask & RXE_ATOMIC_MASK)
+		send_atomic_ack(qp, qp->resp.aeth_syndrome, pkt->psn);
+	else if (qp->resp.aeth_syndrome != AETH_ACK_UNLIMITED)
 		send_ack(qp, qp->resp.aeth_syndrome, pkt->psn);
-	else if (pkt->mask & RXE_ATOMIC_MASK)
-		send_atomic_ack(qp, AETH_ACK_UNLIMITED, pkt->psn);
 	else if (bth_ack(pkt))
 		send_ack(qp, AETH_ACK_UNLIMITED, pkt->psn);
 
Signature · 1 line
2.34.1
#1 lore raw
Quoted 3 lines · Xiao Yang

When responder processed an Atomic requeset and got a NAK, the opcode field in BTH should be ATOMIC Acknowledge instead of Acknowledge.

Hi,

Sorry, please ignore the wrong patch because it will lead to a kernel panic.

Best Regards,
Xiao Yang

Quoted 24 lines
---
  drivers/infiniband/sw/rxe/rxe_resp.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/infiniband/sw/rxe/rxe_resp.c +3 -3
index 265e46fe050f..592d73c37d48 100644
@@ -1080,10 +1080,10 @@ static enum resp_states acknowledge(struct rxe_qp *qp,
  	if (qp_type(qp) != IB_QPT_RC)
  		return RESPST_CLEANUP;
 
-	if (qp->resp.aeth_syndrome != AETH_ACK_UNLIMITED)
+	if (pkt->mask & RXE_ATOMIC_MASK)
+		send_atomic_ack(qp, qp->resp.aeth_syndrome, pkt->psn);
+	else if (qp->resp.aeth_syndrome != AETH_ACK_UNLIMITED)
  		send_ack(qp, qp->resp.aeth_syndrome, pkt->psn);
-	else if (pkt->mask & RXE_ATOMIC_MASK)
-		send_atomic_ack(qp, AETH_ACK_UNLIMITED, pkt->psn);
  	else if (bth_ack(pkt))
  		send_ack(qp, AETH_ACK_UNLIMITED, pkt->psn);
 
#2 lore raw
In reply to Xiao Yang
Quoted 17 lines · Xiao Yang

When responder processed an Atomic requeset and got a NAK, the opcode field in BTH should be ATOMIC Acknowledge instead of Acknowledge.

---
 drivers/infiniband/sw/rxe/rxe_resp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/infiniband/sw/rxe/rxe_resp.c +0 -0
index 265e46fe050f..592d73c37d48 100644
@@ -1080,10 +1080,10 @@ static enum resp_states acknowledge(struct rxe_qp *qp,
 	if (qp_type(qp) != IB_QPT_RC)
 		return RESPST_CLEANUP;
 

drivers/infiniband/sw/rxe/rxe_resp.c static enum resp_states acknowledge(struct rxe_qp *qp, · line 1089

Quoted 10 lines
drivers/infiniband/sw/rxe/rxe_resp.c +3 -3
-	if (qp->resp.aeth_syndrome != AETH_ACK_UNLIMITED)
+	if (pkt->mask & RXE_ATOMIC_MASK)
+		send_atomic_ack(qp, qp->resp.aeth_syndrome, pkt->psn);
+	else if (qp->resp.aeth_syndrome != AETH_ACK_UNLIMITED)
 		send_ack(qp, qp->resp.aeth_syndrome, pkt->psn);
-	else if (pkt->mask & RXE_ATOMIC_MASK)
-		send_atomic_ack(qp, AETH_ACK_UNLIMITED, pkt->psn);
 	else if (bth_ack(pkt))
 		send_ack(qp, AETH_ACK_UNLIMITED, pkt->psn);
 

Xaio,

Just saw this. The difference between the two opcodes tells if there is an AtomicAckETH present. If the operation fails there is no data to send back so there is only an AETH in the reply packet and Acknowledge is the correct opcode. When the packet is parsed if you use AtomicAcknowledge for a failed atomic operation you will get the wrong offsets when you lookup the header offsets in rxe_opcode[] which not surprisingly leads to problems.

Bob