Skip to contentSkip to conversation

iw_cxgb4 fixes for 4.8

PATCH In review Steve Wise 2 participants 4 messages Jul 29, 2016 – Aug 2, 2016 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Steve Wise

author
#0 lore raw

cover iw_cxgb4 fixes for 4.8

Hey Doug, here are few iw_cxgb4 fixes that I would like to hit 4.8.

Thanks,

Steve.
---

Steve Wise (2):
iw_cxgb4: stop MPA_REPLY timer when disconnecting
iw_cxgb4: explicitly move the qp to ERROR state during flush

 drivers/infiniband/hw/cxgb4/cm.c | 12 +++++++++++-
 drivers/infiniband/hw/cxgb4/qp.c |  9 +++++++++
 2 files changed, 20 insertions(+), 1 deletion(-)
Signature · 6 lines
2.7.0

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): cover.1469824142.git.swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org

author
#2 lore raw

PATCH 1/2 iw_cxgb4: stop MPA_REPLY timer when disconnecting

There exists a race where the application can setup a connection and then disconnect it before iw_cxgb4 processes the fw4_ack message. For passive side connections, the fw4_ack message is used to know when to stop the ep timer for MPA_REPLY messages.

If the application disconnects before the fw4_ack is handled then c4iw_ep_disconnect() needs to clean up the timer state and stop the timer before restarting it for the disconnect timer. Failure to do this results in a "timer already started" message and a premature stopping of the disconnect timer.

Fixes e4b76a2 ("RDMA/iw_cxgb4: stop_ep_timer() after MPA negotiation")
---
 drivers/infiniband/hw/cxgb4/cm.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/infiniband/hw/cxgb4/cm.c +11 -1
index a3a6721..be00c4b 100644
@@ -3011,9 +3011,9 @@ static int fw4_ack(struct c4iw_dev *dev, struct sk_buff *skb)
 		PDBG("%s last streaming msg ack ep %p tid %u state %u "
 		     "initiator %u freeing skb\n", __func__, ep, ep->hwtid,
 		     state_read(&ep->com), ep->mpa_attr.initiator ? 1 : 0);
+		mutex_lock(&ep->com.mutex);
 		kfree_skb(ep->mpa_skb);
 		ep->mpa_skb = NULL;
-		mutex_lock(&ep->com.mutex);
 		if (test_bit(STOP_MPA_TIMER, &ep->com.flags))
 			stop_ep_timer(ep);
 		mutex_unlock(&ep->com.mutex);
@@ -3582,6 +3582,16 @@ int c4iw_ep_disconnect(struct c4iw_ep *ep, int abrupt, gfp_t gfp)
 			ep->com.state = ABORTING;
 		else {
 			ep->com.state = CLOSING;
+
+			/*
+			 * if we close before we see the fw4_ack() then we fix
+			 * up the timer state since we're reusing it.
+			 */
+			if (ep->mpa_skb &&
+			    test_bit(STOP_MPA_TIMER, &ep->com.flags)) {
+				clear_bit(STOP_MPA_TIMER, &ep->com.flags);
+				stop_ep_timer(ep);
+			}
 			start_ep_timer(ep);
 		}
 		set_bit(CLOSE_SENT, &ep->com.flags);
Signature · 6 lines
2.7.0

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author
#3 lore raw

PATCH 2/2 iw_cxgb4: explicitly move the qp to ERROR state during flush

In reply to a message not in the archive

This forces the connection to abort if the application failed to disconnect before flushing. This is aligned with how the common flush services work.

---
 drivers/infiniband/hw/cxgb4/qp.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/infiniband/hw/cxgb4/qp.c +9 -0
index e8993e4..0d461f3 100644
@@ -1896,12 +1896,20 @@ int c4iw_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
 	return 0;
 }
 
+static void move_qp_to_err(struct c4iw_qp *qp)
+{
+	struct c4iw_qp_attributes attrs = { .next_state = C4IW_QP_STATE_ERROR };
+
+	(void)c4iw_modify_qp(qp->rhp, qp, C4IW_QP_ATTR_NEXT_STATE, &attrs, 1);
+}
+
 void c4iw_drain_sq(struct ib_qp *ibqp)
 {
 	struct c4iw_qp *qp = to_c4iw_qp(ibqp);
 	unsigned long flag;
 	bool need_to_wait;
 
+	move_qp_to_err(qp);
 	spin_lock_irqsave(&qp->lock, flag);
 	need_to_wait = !t4_sq_empty(&qp->wq);
 	spin_unlock_irqrestore(&qp->lock, flag);
@@ -1916,6 +1924,7 @@ void c4iw_drain_rq(struct ib_qp *ibqp)
 	unsigned long flag;
 	bool need_to_wait;
 
+	move_qp_to_err(qp);
 	spin_lock_irqsave(&qp->lock, flag);
 	need_to_wait = !t4_rq_empty(&qp->wq);
 	spin_unlock_irqrestore(&qp->lock, flag);
Signature · 6 lines
2.7.0

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw
In reply to a message not in the archive
Quoted 8 lines · Steve Wise

Hey Doug, here are few iw_cxgb4 fixes that I would like to hit 4.8.

Thanks,

Steve.
---

Quoted 8 lines

Steve Wise (2):
  iw_cxgb4: stop MPA_REPLY timer when disconnecting
  iw_cxgb4: explicitly move the qp to ERROR state during flush

 drivers/infiniband/hw/cxgb4/cm.c | 12 +++++++++++- drivers/infiniband/hw/cxgb4/qp.c |  9 +++++++++

 2 files changed, 20 insertions(+), 1 deletion(-)

Series applied, thanks.

Signature · 2 lines
Doug Ledford <[email protected]>
              GPG KeyID: 0E572FDD