All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Marciniszyn <mike.marciniszyn@intel.com>
To: jgg@ziepe.ca, dledford@redhat.com
Cc: linux-rdma@vger.kernel.org
Subject: [PATCH 4/6] IB/hfi1: Drop all TID RDMA READ RESP packets after r_next_psn
Date: Mon, 15 Jul 2019 12:45:40 -0400	[thread overview]
Message-ID: <20190715164540.74174.54702.stgit@awfm-01.aw.intel.com> (raw)
In-Reply-To: <20190715164423.74174.4994.stgit@awfm-01.aw.intel.com>

From: Kaike Wan <kaike.wan@intel.com>

When a TID sequence error occurs while receiving TID RDMA READ RESP
packets, all packets after flow->flow_state.r_next_psn should be
dropped, including those response packets for subsequent segments.

The current implementation will drop the subsequent response packets
for the segment to complete next, but may accept packets for subsequent
segments and therefore mistakenly advance the r_next_psn fields
for the corresponding software flows. This may result in failures
to complete subsequent segments after the current segment is completed.

The fix is to only use the flow pointed by req->clear_tail for checking
KDETH PSN instead of finding a flow from the request's flow array.

Fixes: b885d5be9ca1 ("IB/hfi1: Unify the software PSN check for TID RDMA READ/WRITE")
Cc: <stable@vger.kernel.org>
Reviewed-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Kaike Wan <kaike.wan@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
---
 drivers/infiniband/hw/hfi1/tid_rdma.c |   42 +--------------------------------
 1 file changed, 1 insertion(+), 41 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/tid_rdma.c b/drivers/infiniband/hw/hfi1/tid_rdma.c
index 7fcbeee..996fc2982 100644
--- a/drivers/infiniband/hw/hfi1/tid_rdma.c
+++ b/drivers/infiniband/hw/hfi1/tid_rdma.c
@@ -1674,34 +1674,6 @@ static struct tid_rdma_flow *find_flow_ib(struct tid_rdma_request *req,
 	return NULL;
 }
 
-static struct tid_rdma_flow *
-__find_flow_ranged(struct tid_rdma_request *req, u16 head, u16 tail,
-		   u32 psn, u16 *fidx)
-{
-	for ( ; CIRC_CNT(head, tail, MAX_FLOWS);
-	      tail = CIRC_NEXT(tail, MAX_FLOWS)) {
-		struct tid_rdma_flow *flow = &req->flows[tail];
-		u32 spsn, lpsn;
-
-		spsn = full_flow_psn(flow, flow->flow_state.spsn);
-		lpsn = full_flow_psn(flow, flow->flow_state.lpsn);
-
-		if (cmp_psn(psn, spsn) >= 0 && cmp_psn(psn, lpsn) <= 0) {
-			if (fidx)
-				*fidx = tail;
-			return flow;
-		}
-	}
-	return NULL;
-}
-
-static struct tid_rdma_flow *find_flow(struct tid_rdma_request *req,
-				       u32 psn, u16 *fidx)
-{
-	return __find_flow_ranged(req, req->setup_head, req->clear_tail, psn,
-				  fidx);
-}
-
 /* TID RDMA READ functions */
 u32 hfi1_build_tid_rdma_read_packet(struct rvt_swqe *wqe,
 				    struct ib_other_headers *ohdr, u32 *bth1,
@@ -2789,19 +2761,7 @@ static bool handle_read_kdeth_eflags(struct hfi1_ctxtdata *rcd,
 			 * to prevent continuous Flow Sequence errors for any
 			 * packets that could be still in the fabric.
 			 */
-			flow = find_flow(req, psn, NULL);
-			if (!flow) {
-				/*
-				 * We can't find the IB PSN matching the
-				 * received KDETH PSN. The only thing we can
-				 * do at this point is report the error to
-				 * the QP.
-				 */
-				hfi1_kern_read_tid_flow_free(qp);
-				spin_unlock(&qp->s_lock);
-				rvt_rc_error(qp, IB_WC_LOC_QP_OP_ERR);
-				return ret;
-			}
+			flow = &req->flows[req->clear_tail];
 			if (priv->s_flags & HFI1_R_TID_SW_PSN) {
 				diff = cmp_psn(psn,
 					       flow->flow_state.r_next_psn);


  parent reply	other threads:[~2019-07-15 16:45 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-15 16:45 [PATCH 0/6] More 5.3 patches Mike Marciniszyn
2019-07-15 16:45 ` [PATCH 1/6] IB/hfi1: Check for error on call to alloc_rsm_map_table Mike Marciniszyn
2019-07-15 16:45 ` [PATCH 2/6] IB/hfi1: Unreserve a flushed OPFN request Mike Marciniszyn
2019-07-15 16:45 ` [PATCH 3/6] IB/hfi1: Field not zero-ed when allocating TID flow memory Mike Marciniszyn
2019-07-15 16:45 ` Mike Marciniszyn [this message]
2019-07-15 16:45 ` [PATCH 5/6] IB/hfi1: Do not update hcrc for a KDETH packet during fault injection Mike Marciniszyn
2019-07-15 16:45 ` [PATCH 6/6] IB/hfi1: Remove unused define Mike Marciniszyn
2019-07-15 17:54 ` [PATCH 0/6] More 5.3 patches Jason Gunthorpe
2019-07-15 17:55   ` Marciniszyn, Mike
2019-07-15 18:04     ` Jason Gunthorpe
2019-07-15 18:05       ` Marciniszyn, Mike
2019-07-22 18:03 ` 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=20190715164540.74174.54702.stgit@awfm-01.aw.intel.com \
    --to=mike.marciniszyn@intel.com \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-rdma@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.