Return-Path: Received: from omzsmtpe03.verizonbusiness.com ([199.249.25.208]:32844 "EHLO omzsmtpe03.verizonbusiness.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753197AbdLMB63 (ORCPT ); Tue, 12 Dec 2017 20:58:29 -0500 From: alexander.levin@verizon.com Cc: David Marchand , Doug Ledford , alexander.levin@verizon.com To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: [PATCH AUTOSEL for 4.9 049/100] IB/rxe: increment msn only when completing a request Date: Wed, 13 Dec 2017 01:57:34 +0000 Message-ID: <20171213015722.6722-24-alexander.levin@verizon.com> References: <20171213015722.6722-1-alexander.levin@verizon.com> In-Reply-To: <20171213015722.6722-1-alexander.levin@verizon.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: David Marchand [ Upstream commit 9fcd67d1772c43d2f23e8fca56acc7219e991676 ] According to C9-147, MSN should only be incremented when the last packet of a multi packet request has been received. "Logically, the requester associates a sequential Send Sequence Number (SSN) with each WQE posted to the send queue. The SSN bears a one- to-one relationship to the MSN returned by the responder in each re- sponse packet. Therefore, when the requester receives a response, it in- terprets the MSN as representing the SSN of the most recent request completed by the responder to determine which send WQE(s) can be completed." Fixes: 8700e3e7c485 ("Soft RoCE driver") Signed-off-by: David Marchand Signed-off-by: Doug Ledford Signed-off-by: Sasha Levin --- drivers/infiniband/sw/rxe/rxe_resp.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/r= xe/rxe_resp.c index 7705820cdac6..8c0ddd7165ae 100644 --- a/drivers/infiniband/sw/rxe/rxe_resp.c +++ b/drivers/infiniband/sw/rxe/rxe_resp.c @@ -799,18 +799,17 @@ static enum resp_states execute(struct rxe_qp *qp, st= ruct rxe_pkt_info *pkt) /* Unreachable */ WARN_ON(1); =20 - /* We successfully processed this new request. */ - qp->resp.msn++; - /* next expected psn, read handles this separately */ qp->resp.psn =3D (pkt->psn + 1) & BTH_PSN_MASK; =20 qp->resp.opcode =3D pkt->opcode; qp->resp.status =3D IB_WC_SUCCESS; =20 - if (pkt->mask & RXE_COMP_MASK) + if (pkt->mask & RXE_COMP_MASK) { + /* We successfully processed this new request. */ + qp->resp.msn++; return RESPST_COMPLETE; - else if (qp_type(qp) =3D=3D IB_QPT_RC) + } else if (qp_type(qp) =3D=3D IB_QPT_RC) return RESPST_ACKNOWLEDGE; else return RESPST_CLEANUP; --=20 2.11.0