[openib-general] [PATCH] kDAPL: convert the ep list to linux native

Tom Duffy tduffy at sun.com
Fri Jun 10 13:57:14 PDT 2005


This patch converts the ep list to the linux native linked list
structure.  Let me know what you think.

Signed-off-by: Tom Duffy <tduffy at sun.com>

Index: linux-kernel-ll2/dat-provider/dapl_ia.c
===================================================================
--- linux-kernel-ll2/dat-provider/dapl_ia.c	(revision 2585)
+++ linux-kernel-ll2/dat-provider/dapl_ia.c	(working copy)
@@ -63,7 +63,7 @@ struct dapl_ia *dapl_ia_alloc(struct dat
 	ia->async_error_evd = NULL;
 	ia->cleanup_async_error_evd = FALSE;
 	dapl_llist_init_entry(&ia->hca_ia_list_entry);
-	dapl_llist_init_head(&ia->ep_list_head);
+	INIT_LIST_HEAD(&ia->ep_list);
 	dapl_llist_init_head(&ia->lmr_list_head);
 	dapl_llist_init_head(&ia->rmr_list_head);
 	dapl_llist_init_head(&ia->pz_list_head);
@@ -104,7 +104,7 @@ bail:
 u32 dapl_ia_abrupt_close(struct dapl_ia *ia)
 {
 	u32 dat_status = DAT_SUCCESS;
-	struct dapl_ep *ep, *next_ep;
+	struct dapl_ep *ep;
 	struct dapl_lmr *lmr, *next_lmr;
 	struct dapl_rmr *rmr, *next_rmr;
 	struct dapl_pz *pz, *next_pz;
@@ -151,12 +151,7 @@ u32 dapl_ia_abrupt_close(struct dapl_ia 
 		sp = next_sp;
 	}
 
-	ep = (dapl_llist_is_empty(&ia->ep_list_head)
-		  ? NULL : dapl_llist_peek_head(&ia->ep_list_head));
-	while (ep != NULL) {
-		next_ep = dapl_llist_next_entry(&ia->ep_list_head,
-						    &ep->common.
-						    ia_list_entry);
+	list_for_each_entry(ep, &ia->ep_list, list) {
 		/*
 		 * Issue a disconnect if the EP needs it
 		 */
@@ -181,7 +176,6 @@ u32 dapl_ia_abrupt_close(struct dapl_ia 
 			dapl_dbg_log(DAPL_DBG_TYPE_WARN,
 				     "ia_close(ABRUPT): ep_free(%p) returns %x\n",
 				     ep, dat_status);
-		ep = next_ep;
 	}
 
 	lmr = (dapl_llist_is_empty(&ia->lmr_list_head)
@@ -332,7 +326,7 @@ u32 dapl_ia_graceful_close(struct dapl_i
 
 	if (!dapl_llist_is_empty(&ia->rmr_list_head) ||
 	    !dapl_llist_is_empty(&ia->rsp_list_head) ||
-	    !dapl_llist_is_empty(&ia->ep_list_head) ||
+	    !list_empty(&ia->ep_list) ||
 	    !dapl_llist_is_empty(&ia->lmr_list_head) ||
 	    !dapl_llist_is_empty(&ia->psp_list_head) ||
 	    !dapl_llist_is_empty(&ia->pz_list_head)) {
@@ -427,7 +421,7 @@ void dapl_ia_free(struct dapl_ia *ia)
 	dapl_os_assert(ia->async_error_evd == NULL);
 	dapl_os_assert(dapl_llist_is_empty(&ia->lmr_list_head));
 	dapl_os_assert(dapl_llist_is_empty(&ia->rmr_list_head));
-	dapl_os_assert(dapl_llist_is_empty(&ia->ep_list_head));
+	dapl_os_assert(list_empty(&ia->ep_list));
 	dapl_os_assert(dapl_llist_is_empty(&ia->evd_list_head));
 	dapl_os_assert(dapl_llist_is_empty(&ia->psp_list_head));
 	dapl_os_assert(dapl_llist_is_empty(&ia->rsp_list_head));
@@ -444,19 +438,17 @@ void dapl_ia_free(struct dapl_ia *ia)
 void dapl_ia_link_ep(struct dapl_ia *ia, struct dapl_ep *ep)
 {
 	spin_lock_irqsave(&ia->common.lock, ia->common.flags);
-	dapl_llist_add_head(&ia->ep_list_head,
-			    &ep->common.ia_list_entry, ep);
+	list_add(&ep->list, &ia->ep_list);
 	spin_unlock_irqrestore(&ia->common.lock, ia->common.flags);
 }
 
 /*
- * Remove an ep from the ia info structure
+ * Remove an ep from the ia structure
  */
 void dapl_ia_unlink_ep(struct dapl_ia *ia, struct dapl_ep *ep)
 {
 	spin_lock_irqsave(&ia->common.lock, ia->common.flags);
-	dapl_llist_remove_entry(&ia->ep_list_head,
-				&ep->common.ia_list_entry);
+	list_del(&ep->list);
 	spin_unlock_irqrestore(&ia->common.lock, ia->common.flags);
 }
 
Index: linux-kernel-ll2/dat-provider/dapl.h
===================================================================
--- linux-kernel-ll2/dat-provider/dapl.h	(revision 2585)
+++ linux-kernel-ll2/dat-provider/dapl.h	(working copy)
@@ -34,6 +34,8 @@
 #ifndef DAPL_H
 #define DAPL_H
 
+#include <linux/list.h>
+
 #include <dat.h>
 
 #include "dapl_util.h"
@@ -152,7 +154,7 @@ struct dapl_ia {
 	boolean_t cleanup_async_error_evd;
 
 	struct dapl_llist_entry hca_ia_list_entry;	/* HCAs list of IAs */
-	struct dapl_llist_entry *ep_list_head;	/* EP queue */
+	struct list_head ep_list;	/* EP queue */
 	struct dapl_llist_entry *lmr_list_head;	/* LMR queue */
 	struct dapl_llist_entry *rmr_list_head;	/* RMR queue */
 	struct dapl_llist_entry *pz_list_head;	/* PZ queue */
@@ -195,6 +197,7 @@ struct dapl_evd {
 struct dapl_ep {
 	struct dat_ep ep;
 	struct dapl_common common;
+	struct list_head list;
 	/* What the DAT Consumer asked for */
 	struct dat_ep_param param;
 




More information about the general mailing list