[openib-general] [PATCH 2/9] kDAPL: convert the lmr list to linux native

Tom Duffy Tom.Duffy at Sun.COM
Mon Jun 13 17:18:07 PDT 2005


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

diff -Nurp -X /home/tduffy/dontdiff linux-kernel-ll2/dat-provider/dapl.h linux-kernel-ll3/dat-provider/dapl.h
--- linux-kernel-ll2/dat-provider/dapl.h	2005-06-13 14:34:58.534000000 -0700
+++ linux-kernel-ll3/dat-provider/dapl.h	2005-06-13 15:27:19.134000000 -0700
@@ -155,7 +155,7 @@ struct dapl_ia {
 
 	struct dapl_llist_entry hca_ia_list_entry;	/* HCAs list of IAs */
 	struct list_head ep_list;	/* EP queue */
-	struct dapl_llist_entry *lmr_list_head;	/* LMR queue */
+	struct list_head lmr_list;	/* LMR queue */
 	struct dapl_llist_entry *rmr_list_head;	/* RMR queue */
 	struct dapl_llist_entry *pz_list_head;	/* PZ queue */
 	struct dapl_llist_entry *evd_list_head;	/* EVD queue */
@@ -251,6 +251,7 @@ struct dapl_pz {
 struct dapl_lmr {
 	struct dat_lmr lmr;
 	struct dapl_common common;
+	struct list_head list;
 	struct dat_lmr_param param;
 	struct ib_mr *mr;
 	atomic_t lmr_ref_count;
diff -Nurp -X /home/tduffy/dontdiff linux-kernel-ll2/dat-provider/dapl_ia.c linux-kernel-ll3/dat-provider/dapl_ia.c
--- linux-kernel-ll2/dat-provider/dapl_ia.c	2005-06-13 14:40:19.903015000 -0700
+++ linux-kernel-ll3/dat-provider/dapl_ia.c	2005-06-13 15:30:24.780010000 -0700
@@ -64,7 +64,7 @@ struct dapl_ia *dapl_ia_alloc(struct dat
 	ia->cleanup_async_error_evd = FALSE;
 	dapl_llist_init_entry(&ia->hca_ia_list_entry);
 	INIT_LIST_HEAD(&ia->ep_list);
-	dapl_llist_init_head(&ia->lmr_list_head);
+	INIT_LIST_HEAD(&ia->lmr_list);
 	dapl_llist_init_head(&ia->rmr_list_head);
 	dapl_llist_init_head(&ia->pz_list_head);
 	dapl_llist_init_head(&ia->evd_list_head);
@@ -105,7 +105,7 @@ u32 dapl_ia_abrupt_close(struct dapl_ia 
 {
 	u32 dat_status = DAT_SUCCESS;
 	struct dapl_ep *ep;
-	struct dapl_lmr *lmr, *next_lmr;
+	struct dapl_lmr *lmr;
 	struct dapl_rmr *rmr, *next_rmr;
 	struct dapl_pz *pz, *next_pz;
 	struct dapl_evd *evd, *next_evd;
@@ -178,18 +178,12 @@ u32 dapl_ia_abrupt_close(struct dapl_ia 
 				     ep, dat_status);
 	}
 
-	lmr = (dapl_llist_is_empty(&ia->lmr_list_head)
-		   ? NULL : dapl_llist_peek_head(&ia->lmr_list_head));
-	while (lmr != NULL) {
-		next_lmr = dapl_llist_next_entry(&ia->lmr_list_head,
-						     &lmr->common.
-						     ia_list_entry);
+	list_for_each_entry(lmr, &ia->lmr_list, list) {
 		dat_status = dapl_lmr_free((struct dat_lmr *)lmr);
 		if (dat_status != DAT_SUCCESS)
 			dapl_dbg_log(DAPL_DBG_TYPE_WARN,
 				     "ia_close(ABRUPT): lmr_free(%p) returns %x\n",
 				     lmr, dat_status);
-		lmr = next_lmr;
 	}
 
 	sp = (dapl_llist_is_empty(&ia->psp_list_head)
@@ -321,7 +315,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) ||
 	    !list_empty(&ia->ep_list) ||
-	    !dapl_llist_is_empty(&ia->lmr_list_head) ||
+	    !list_empty(&ia->lmr_list) ||
 	    !dapl_llist_is_empty(&ia->psp_list_head) ||
 	    !dapl_llist_is_empty(&ia->pz_list_head)) {
 		dat_status =
@@ -413,7 +407,7 @@ bail:
 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(list_empty(&ia->lmr_list));
 	dapl_os_assert(dapl_llist_is_empty(&ia->rmr_list_head));
 	dapl_os_assert(list_empty(&ia->ep_list));
 	dapl_os_assert(dapl_llist_is_empty(&ia->evd_list_head));
@@ -474,8 +468,7 @@ void dapl_ia_unlink_srq(struct dapl_ia *
 void dapl_ia_link_lmr(struct dapl_ia *ia, struct dapl_lmr *lmr)
 {
 	spin_lock_irqsave(&ia->common.lock, ia->common.flags);
-	dapl_llist_add_head(&ia->lmr_list_head,
-			    &lmr->common.ia_list_entry, lmr);
+	list_add(&lmr->list, &ia->lmr_list);
 	spin_unlock_irqrestore(&ia->common.lock, ia->common.flags);
 }
 
@@ -485,8 +478,7 @@ void dapl_ia_link_lmr(struct dapl_ia *ia
 void dapl_ia_unlink_lmr(struct dapl_ia *ia, struct dapl_lmr *lmr)
 {
 	spin_lock_irqsave(&ia->common.lock, ia->common.flags);
-	dapl_llist_remove_entry(&ia->lmr_list_head,
-				&lmr->common.ia_list_entry);
+	list_del(&lmr->list);
 	spin_unlock_irqrestore(&ia->common.lock, ia->common.flags);
 }
 




More information about the general mailing list