From: Shiraz Saleem <shiraz.saleem@intel.com>
Date: Tue, 3 Oct 2017 11:11:48 -0500
Subject: i40iw: Do not allow posting WR after QP is flushed
Patch-mainline: v4.15-rc1
Git-commit: 40837273d084ad1584dbaea5e8fbefe0a64f2a6b
References: bsc#1058659 FATE#322535
A Work Request (WR) posted after QP is flushed will not
get a flush completion.
Correct this problem by not allowing posting of WRs
after a QP is flushed.
Fixes: d37498417947 ("i40iw: add files for iwarp interface")
Signed-off-by: Shiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
drivers/infiniband/hw/i40iw/i40iw_verbs.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
--- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c
+++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c
@@ -2204,6 +2204,12 @@ static int i40iw_post_send(struct ib_qp
ukqp = &iwqp->sc_qp.qp_uk;
spin_lock_irqsave(&iwqp->lock, flags);
+
+ if (iwqp->flush_issued) {
+ err = -EINVAL;
+ goto out;
+ }
+
while (ib_wr) {
inv_stag = false;
memset(&info, 0, sizeof(info));
@@ -2346,6 +2352,7 @@ static int i40iw_post_send(struct ib_qp
ib_wr = ib_wr->next;
}
+out:
if (err)
*bad_wr = ib_wr;
else
@@ -2378,6 +2385,12 @@ static int i40iw_post_recv(struct ib_qp
memset(&post_recv, 0, sizeof(post_recv));
spin_lock_irqsave(&iwqp->lock, flags);
+
+ if (iwqp->flush_issued) {
+ err = -EINVAL;
+ goto out;
+ }
+
while (ib_wr) {
post_recv.num_sges = ib_wr->num_sge;
post_recv.wr_id = ib_wr->wr_id;