[openib-general] [PATCH] [CM] have SIDR use its own red-black tree node

Sean Hefty mshefty at ichips.intel.com
Wed Feb 16 15:58:28 PST 2005


This patch defines a new red-black tree node for SIDR to use.  The
separation is done to simplify timewait state handling.

Signed-off-by: Sean Hefty <sean.hefty at intel.com>

Index: infiniband/core/cm.c
===================================================================
--- infiniband/core/cm.c	(revision 1799)
+++ infiniband/core/cm.c	(working copy)
@@ -112,6 +112,7 @@ struct cm_id_private {
 	struct rb_node service_node;
 	struct rb_node remote_qp_node;
 	struct rb_node remote_id_node;
+	struct rb_node sidr_id_node;
 	spinlock_t lock;
 	wait_queue_head_t wait;
 	atomic_t refcount;
@@ -501,7 +502,7 @@ static struct cm_id_private * cm_insert_
 	while (*link) {
 		parent = *link;
 		cur_cm_id_priv = rb_entry(parent, struct cm_id_private,
-					  remote_id_node);
+					  sidr_id_node);
 		if (remote_id < cur_cm_id_priv->id.remote_id)
 			link = &(*link)->rb_left;
 		else if (remote_id > cur_cm_id_priv->id.remote_id)
@@ -518,8 +519,8 @@ static struct cm_id_private * cm_insert_
 				return cur_cm_id_priv;
 		}
 	}
-	rb_link_node(&cm_id_priv->remote_id_node, parent, link);
-	rb_insert_color(&cm_id_priv->remote_id_node, &cm.remote_sidr_table);
+	rb_link_node(&cm_id_priv->sidr_id_node, parent, link);
+	rb_insert_color(&cm_id_priv->sidr_id_node, &cm.remote_sidr_table);
 	return NULL;
 }
 
@@ -2240,7 +2241,7 @@ static int cm_sidr_req_handler(struct cm
 	}
 	cur_cm_id_priv = cm_find_listen(sidr_req_msg->service_id);
 	if (!cur_cm_id_priv) {
-		rb_erase(&cm_id_priv->remote_id_node, &cm.remote_sidr_table);
+		rb_erase(&cm_id_priv->sidr_id_node, &cm.remote_sidr_table);
 		spin_unlock_irqrestore(&cm.lock, flags);
 		/* todo: reject with no match */
 		goto out; /* No match. */
@@ -2325,7 +2326,7 @@ int ib_send_cm_sidr_rep(struct ib_cm_id 
 	spin_unlock_irqrestore(&cm_id_priv->lock, flags);
 
 	spin_lock_irqsave(&cm.lock, flags);
-	rb_erase(&cm_id_priv->remote_id_node, &cm.remote_sidr_table);
+	rb_erase(&cm_id_priv->sidr_id_node, &cm.remote_sidr_table);
 	spin_unlock_irqrestore(&cm.lock, flags);
 out:
 	return ret;



More information about the general mailing list