Skip to content

Commit e4b76a2

Browse files
Hariprasad Sdledford
authored andcommitted
RDMA/iw_cxgb4: stop_ep_timer() after MPA negotiation
->Stop the ep timer after MPA negotiation so that the arp failures during send_mpa_reply/reject will be handled by process_timeout() after the ep timer expires. ->Added case MPA_REP_SENT in process_timeout(). ->For MPA reject, c4iw_ep_disconnect tries to start an already started timer, which leads to warning message "timer already started". -> In case of mpa reject stop the timer and call send_mpa_reject(). -> Added new ep flag STOP_MPA_TIMER to tell fw4_ack() to stop the timer only for send_mpa_reply(), which is set in c4iw_accept_cr(). Signed-off-by: Steve Wise <swise@opengridcomputing.com> Signed-off-by: Hariprasad Shenai <hariprasad@chelsio.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
1 parent da1cecd commit e4b76a2

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

drivers/infiniband/hw/cxgb4/cm.c

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,7 +1047,6 @@ static int send_mpa_reject(struct c4iw_ep *ep, const void *pdata, u8 plen)
10471047
*/
10481048
skb_get(skb);
10491049
set_wr_txq(skb, CPL_PRIORITY_DATA, ep->txq_idx);
1050-
t4_set_arp_err_handler(skb, NULL, arp_failure_discard);
10511050
BUG_ON(ep->mpa_skb);
10521051
ep->mpa_skb = skb;
10531052
ep->snd_seq += mpalen;
@@ -1132,7 +1131,6 @@ static int send_mpa_reply(struct c4iw_ep *ep, const void *pdata, u8 plen)
11321131
* Function fw4_ack() will deref it.
11331132
*/
11341133
skb_get(skb);
1135-
t4_set_arp_err_handler(skb, NULL, arp_failure_discard);
11361134
ep->mpa_skb = skb;
11371135
__state_set(&ep->com, MPA_REP_SENT);
11381136
ep->snd_seq += mpalen;
@@ -1744,25 +1742,17 @@ static int process_mpa_request(struct c4iw_ep *ep, struct sk_buff *skb)
17441742
ep->mpa_attr.xmit_marker_enabled, ep->mpa_attr.version,
17451743
ep->mpa_attr.p2p_type);
17461744

1747-
/*
1748-
* If the endpoint timer already expired, then we ignore
1749-
* the start request. process_timeout() will abort
1750-
* the connection.
1751-
*/
1752-
if (!stop_ep_timer(ep)) {
1753-
__state_set(&ep->com, MPA_REQ_RCVD);
1754-
1755-
/* drive upcall */
1756-
mutex_lock_nested(&ep->parent_ep->com.mutex,
1757-
SINGLE_DEPTH_NESTING);
1758-
if (ep->parent_ep->com.state != DEAD) {
1759-
if (connect_request_upcall(ep))
1760-
goto err_unlock_parent;
1761-
} else {
1745+
__state_set(&ep->com, MPA_REQ_RCVD);
1746+
1747+
/* drive upcall */
1748+
mutex_lock_nested(&ep->parent_ep->com.mutex, SINGLE_DEPTH_NESTING);
1749+
if (ep->parent_ep->com.state != DEAD) {
1750+
if (connect_request_upcall(ep))
17621751
goto err_unlock_parent;
1763-
}
1764-
mutex_unlock(&ep->parent_ep->com.mutex);
1752+
} else {
1753+
goto err_unlock_parent;
17651754
}
1755+
mutex_unlock(&ep->parent_ep->com.mutex);
17661756
return 0;
17671757

17681758
err_unlock_parent:
@@ -2926,6 +2916,10 @@ static int fw4_ack(struct c4iw_dev *dev, struct sk_buff *skb)
29262916
state_read(&ep->com), ep->mpa_attr.initiator ? 1 : 0);
29272917
kfree_skb(ep->mpa_skb);
29282918
ep->mpa_skb = NULL;
2919+
mutex_lock(&ep->com.mutex);
2920+
if (test_bit(STOP_MPA_TIMER, &ep->com.flags))
2921+
stop_ep_timer(ep);
2922+
mutex_unlock(&ep->com.mutex);
29292923
}
29302924
return 0;
29312925
}
@@ -2952,8 +2946,10 @@ int c4iw_reject_cr(struct iw_cm_id *cm_id, const void *pdata, u8 pdata_len)
29522946
disconnect = 1;
29532947
}
29542948
mutex_unlock(&ep->com.mutex);
2955-
if (disconnect)
2949+
if (disconnect) {
2950+
stop_ep_timer(ep);
29562951
err = c4iw_ep_disconnect(ep, disconnect == 2, GFP_KERNEL);
2952+
}
29572953
c4iw_put_ep(&ep->com);
29582954
return 0;
29592955
}
@@ -3047,6 +3043,8 @@ int c4iw_accept_cr(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
30473043
ep->com.qp, mask, &attrs, 1);
30483044
if (err)
30493045
goto err_deref_cm_id;
3046+
3047+
set_bit(STOP_MPA_TIMER, &ep->com.flags);
30503048
err = send_mpa_reply(ep, conn_param->private_data,
30513049
conn_param->private_data_len);
30523050
if (err)
@@ -3968,6 +3966,7 @@ static void process_timeout(struct c4iw_ep *ep)
39683966
connect_reply_upcall(ep, -ETIMEDOUT);
39693967
break;
39703968
case MPA_REQ_WAIT:
3969+
case MPA_REP_SENT:
39713970
__state_set(&ep->com, ABORTING);
39723971
break;
39733972
case CLOSING:

drivers/infiniband/hw/cxgb4/iw_cxgb4.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,6 +755,7 @@ enum c4iw_ep_flags {
755755
CLOSE_SENT = 3,
756756
TIMEOUT = 4,
757757
QP_REFERENCED = 5,
758+
STOP_MPA_TIMER = 7,
758759
};
759760

760761
enum c4iw_ep_history {

0 commit comments

Comments
 (0)