aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSean Hefty <sean.hefty@intel.com>2007-05-21 20:38:02 -0400
committerRoland Dreier <rolandd@cisco.com>2007-05-29 19:07:09 -0400
commitd998ccce020e2cfcf11c6b57503532930ede2894 (patch)
treeee9756ab7c9bf087dc47ecd43c1e3a4c439a26c5 /drivers
parentec56dc0b7f6c3fec20bbc2e98ff1a06edf2fc9b9 (diff)
IB/cm: Fix stale connection detection
The ib_cm can incorrectly detect a stale connection (a new connection request for a QPN that is already connected) as a duplicate connection request. Separate the handling of potential duplicate REQs from stale connections. Signed-off-by: Sean Hefty <sean.hefty@intel.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/infiniband/core/cm.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index e840434a96d8..40c004a2697e 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -1297,26 +1297,29 @@ static struct cm_id_private * cm_match_req(struct cm_work *work,
1297 1297
1298 req_msg = (struct cm_req_msg *)work->mad_recv_wc->recv_buf.mad; 1298 req_msg = (struct cm_req_msg *)work->mad_recv_wc->recv_buf.mad;
1299 1299
1300 /* Check for duplicate REQ and stale connections. */ 1300 /* Check for possible duplicate REQ. */
1301 spin_lock_irqsave(&cm.lock, flags); 1301 spin_lock_irqsave(&cm.lock, flags);
1302 timewait_info = cm_insert_remote_id(cm_id_priv->timewait_info); 1302 timewait_info = cm_insert_remote_id(cm_id_priv->timewait_info);
1303 if (!timewait_info)
1304 timewait_info = cm_insert_remote_qpn(cm_id_priv->timewait_info);
1305
1306 if (timewait_info) { 1303 if (timewait_info) {
1307 cur_cm_id_priv = cm_get_id(timewait_info->work.local_id, 1304 cur_cm_id_priv = cm_get_id(timewait_info->work.local_id,
1308 timewait_info->work.remote_id); 1305 timewait_info->work.remote_id);
1309 cm_cleanup_timewait(cm_id_priv->timewait_info);
1310 spin_unlock_irqrestore(&cm.lock, flags); 1306 spin_unlock_irqrestore(&cm.lock, flags);
1311 if (cur_cm_id_priv) { 1307 if (cur_cm_id_priv) {
1312 cm_dup_req_handler(work, cur_cm_id_priv); 1308 cm_dup_req_handler(work, cur_cm_id_priv);
1313 cm_deref_id(cur_cm_id_priv); 1309 cm_deref_id(cur_cm_id_priv);
1314 } else 1310 }
1315 cm_issue_rej(work->port, work->mad_recv_wc, 1311 return NULL;
1316 IB_CM_REJ_STALE_CONN, CM_MSG_RESPONSE_REQ, 1312 }
1317 NULL, 0); 1313
1318 listen_cm_id_priv = NULL; 1314 /* Check for stale connections. */
1319 goto out; 1315 timewait_info = cm_insert_remote_qpn(cm_id_priv->timewait_info);
1316 if (timewait_info) {
1317 cm_cleanup_timewait(cm_id_priv->timewait_info);
1318 spin_unlock_irqrestore(&cm.lock, flags);
1319 cm_issue_rej(work->port, work->mad_recv_wc,
1320 IB_CM_REJ_STALE_CONN, CM_MSG_RESPONSE_REQ,
1321 NULL, 0);
1322 return NULL;
1320 } 1323 }
1321 1324
1322 /* Find matching listen request. */ 1325 /* Find matching listen request. */