[PATCH for v4.9 LTS 78/87] iw_cxgb4: do not send RX_DATA_ACK CPLs after close/abort

From: Levin, Alexander (Sasha Levin)
Date: Fri Jul 14 2017 - 21:32:58 EST

From: Steve Wise <swise@xxxxxxxxxxxxxxxxxxxxx>

[ Upstream commit 3bcf96e0183f5c863657cb6ae9adad307a0f6071 ]

Function rx_data(), which handles ingress CPL_RX_DATA messages, was
always sending an RX_DATA_ACK with the goal of updating the credits.
However, if the RDMA connection is moved out of FPDU mode abruptly,
then it is possible for iw_cxgb4 to process queued RX_DATA CPLs after HW
has aborted the connection. These CPLs should not trigger RX_DATA_ACKS.
If they do, HW can see a READ after DELETE of the DB_LE hash entry for
the tid and post a LE_DB HashTblMemCrcError.

Signed-off-by: Steve Wise <swise@xxxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Doug Ledford <dledford@xxxxxxxxxx>
Signed-off-by: Sasha Levin <alexander.levin@xxxxxxxxxxx>
drivers/infiniband/hw/cxgb4/cm.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index f1510cc76d2d..9398143d7c5e 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -1804,20 +1804,21 @@ static int rx_data(struct c4iw_dev *dev, struct sk_buff *skb)
skb_trim(skb, dlen);

- /* update RX credits */
- update_rx_credits(ep, dlen);
switch (ep->com.state) {
+ update_rx_credits(ep, dlen);
ep->rcv_seq += dlen;
disconnect = process_mpa_reply(ep, skb);
+ update_rx_credits(ep, dlen);
ep->rcv_seq += dlen;
disconnect = process_mpa_request(ep, skb);
case FPDU_MODE: {
struct c4iw_qp_attributes attrs;
+ update_rx_credits(ep, dlen);
if (status)
pr_err("%s Unexpected streaming data." \