Signed-off-by: Tom Duffy <[EMAIL PROTECTED]>

diff -Nurp -X /home/tduffy/dontdiff linux-kernel-ll6/dat-provider/dapl.h 
linux-kernel-ll7/dat-provider/dapl.h
--- linux-kernel-ll6/dat-provider/dapl.h        2005-06-13 16:11:11.259003000 
-0700
+++ linux-kernel-ll7/dat-provider/dapl.h        2005-06-13 16:36:22.902013000 
-0700
@@ -159,8 +159,8 @@ struct dapl_ia {
        struct list_head rmr_list;      /* RMR queue */
        struct list_head pz_list;       /* PZ queue */
        struct list_head evd_list;      /* EVD queue */
-       struct dapl_llist_entry *psp_list_head; /* PSP queue */
-       struct dapl_llist_entry *rsp_list_head; /* RSP queue */
+       struct list_head psp_list;      /* PSP queue */
+       struct list_head rsp_list;      /* RSP queue */
        struct dapl_llist_entry *srq_list_head; /* SRQ queue */
 };
 
@@ -282,6 +282,7 @@ typedef enum dapl_sp_state {
 struct dapl_sp {
        struct dat_sp sp;
        struct dapl_common common;
+       struct list_head list;
        DAPL_SP_STATE state;    /* type and queue of the SP */
 
        /* PSP/RSP PARAM fields */
diff -Nurp -X /home/tduffy/dontdiff linux-kernel-ll6/dat-provider/dapl_ia.c 
linux-kernel-ll7/dat-provider/dapl_ia.c
--- linux-kernel-ll6/dat-provider/dapl_ia.c     2005-06-13 16:30:09.267002000 
-0700
+++ linux-kernel-ll7/dat-provider/dapl_ia.c     2005-06-13 16:46:18.755001000 
-0700
@@ -68,8 +68,8 @@ struct dapl_ia *dapl_ia_alloc(struct dat
        INIT_LIST_HEAD(&ia->rmr_list);
        INIT_LIST_HEAD(&ia->pz_list);
        INIT_LIST_HEAD(&ia->evd_list);
-       dapl_llist_init_head(&ia->rsp_list_head);
-       dapl_llist_init_head(&ia->psp_list_head);
+       INIT_LIST_HEAD(&ia->rsp_list);
+       INIT_LIST_HEAD(&ia->psp_list);
 
        dapl_hca_link_ia(hca, ia);
 
@@ -109,7 +109,7 @@ u32 dapl_ia_abrupt_close(struct dapl_ia 
        struct dapl_rmr *rmr;
        struct dapl_pz *pz;
        struct dapl_evd *evd;
-       struct dapl_sp *sp, *next_sp;   /* for PSP and RSP queues */
+       struct dapl_sp *sp;     /* for PSP and RSP queues */
        struct dapl_cr *cr;
        struct dapl_hca *hca;
 
@@ -131,18 +131,12 @@ u32 dapl_ia_abrupt_close(struct dapl_ia 
                                     rmr, dat_status);
        }
 
-       sp = (dapl_llist_is_empty(&ia->rsp_list_head)
-                 ? NULL : dapl_llist_peek_head(&ia->rsp_list_head));
-       while (sp != NULL) {
-               next_sp = dapl_llist_next_entry(&ia->rsp_list_head,
-                                                   &sp->common.
-                                                   ia_list_entry);
+       list_for_each_entry(sp, &ia->rsp_list, list) {
                dat_status = dapl_rsp_free((struct dat_sp *)sp);
                if (dat_status != DAT_SUCCESS)
                        dapl_dbg_log(DAPL_DBG_TYPE_WARN,
                                     "ia_close(ABRUPT): rsp_free(%p) returns 
%x\n",
                                     sp, dat_status);
-               sp = next_sp;
        }
 
        list_for_each_entry(ep, &ia->ep_list, list) {
@@ -180,9 +174,7 @@ u32 dapl_ia_abrupt_close(struct dapl_ia 
                                     lmr, dat_status);
        }
 
-       sp = (dapl_llist_is_empty(&ia->psp_list_head)
-                 ? NULL : dapl_llist_peek_head(&ia->psp_list_head));
-       while (sp != NULL) {
+       list_for_each_entry(sp, &ia->psp_list, list) {
                /*
                 * Shut down the PSP so we get no further callbacks. There
                 * should be no competing threads after this.
@@ -193,10 +185,6 @@ u32 dapl_ia_abrupt_close(struct dapl_ia 
                                     "ia_close(ABRUPT): psp cannot remove 
listener, returns %x\n",
                                     dat_status);
 
-               next_sp = dapl_llist_next_entry(&ia->psp_list_head,
-                                                   &sp->common.
-                                                   ia_list_entry);
-
                /* Remove CR's from this PSP and clean them up */
                list_for_each_entry(cr, &sp->cr_list, list) {
                        /* Remove the CR from the queue & cleanup */
@@ -214,8 +202,6 @@ u32 dapl_ia_abrupt_close(struct dapl_ia 
                        dapl_dbg_log(DAPL_DBG_TYPE_WARN,
                                     "ia_close(ABRUPT): psp_free(%p) returns 
%x\n",
                                     sp, dat_status);
-
-               sp = next_sp;
        }
 
        list_for_each_entry(pz, &ia->pz_list, list) {
@@ -294,10 +280,10 @@ u32 dapl_ia_graceful_close(struct dapl_i
        struct dapl_hca *hca;
 
        if (!list_empty(&ia->rmr_list) ||
-           !dapl_llist_is_empty(&ia->rsp_list_head) ||
+           !list_empty(&ia->rsp_list) ||
            !list_empty(&ia->ep_list) ||
            !list_empty(&ia->lmr_list) ||
-           !dapl_llist_is_empty(&ia->psp_list_head) ||
+           !list_empty(&ia->psp_list) ||
            !list_empty(&ia->pz_list)) {
                dat_status =
                    DAT_ERROR(DAT_INVALID_STATE, DAT_INVALID_STATE_IA_IN_USE);
@@ -390,8 +376,8 @@ void dapl_ia_free(struct dapl_ia *ia)
        dapl_os_assert(list_empty(&ia->rmr_list));
        dapl_os_assert(list_empty(&ia->ep_list));
        dapl_os_assert(list_empty(&ia->evd_list));
-       dapl_os_assert(dapl_llist_is_empty(&ia->psp_list_head));
-       dapl_os_assert(dapl_llist_is_empty(&ia->rsp_list_head));
+       dapl_os_assert(list_empty(&ia->psp_list));
+       dapl_os_assert(list_empty(&ia->rsp_list));
 
        dapl_hca_unlink_ia(ia->hca, ia);
        /* no need to destroy ia->common.lock */
@@ -527,8 +513,7 @@ void dapl_ia_unlink_evd(struct dapl_ia *
 void dapl_ia_link_psp(struct dapl_ia *ia, struct dapl_sp *sp)
 {
        spin_lock_irqsave(&ia->common.lock, ia->common.flags);
-       dapl_llist_add_head(&ia->psp_list_head,
-                           &sp->common.ia_list_entry, sp);
+       list_add(&sp->list, &ia->psp_list);
        spin_unlock_irqrestore(&ia->common.lock, ia->common.flags);
 }
 
@@ -537,18 +522,8 @@ void dapl_ia_link_psp(struct dapl_ia *ia
  */
 void dapl_ia_unlink_sp(struct dapl_ia *ia, struct dapl_sp *sp)
 {
-       struct dapl_llist_entry **list_head;
-
-       if (sp->sp.type == DAT_SP_TYPE_PSP) {
-               list_head = &ia->psp_list_head;
-       } else {
-               dapl_os_assert(sp->sp.type ==
-                              DAT_SP_TYPE_RSP);
-               list_head = &ia->rsp_list_head;
-       }
-
        spin_lock_irqsave(&ia->common.lock, ia->common.flags);
-       dapl_llist_remove_entry(list_head, &sp->common.ia_list_entry);
+       list_del(&sp->list);
        spin_unlock_irqrestore(&ia->common.lock, ia->common.flags);
 }
 
@@ -556,36 +531,30 @@ struct dapl_sp *dapl_ia_sp_search(struct
                                  boolean_t is_psp)
 {
        struct dapl_sp *sp;
-       struct dapl_llist_entry **list_head;
+       struct list_head *list_head;
 
        if (is_psp)
-               list_head = &ia->psp_list_head;
+               list_head = &ia->psp_list;
        else
-               list_head = &ia->rsp_list_head;
+               list_head = &ia->rsp_list;
 
        spin_lock_irqsave(&ia->common.lock, ia->common.flags);
 
-       sp = (dapl_llist_is_empty(list_head) ? NULL :
-                 dapl_llist_peek_head(list_head));
-
-       while (sp != NULL) {
-               if (sp->conn_qual == conn_qual) 
-                       break;
-               
-               sp = dapl_llist_next_entry(list_head,
-                                              &sp->common.ia_list_entry);
-       }
+       list_for_each_entry(sp, list_head, list)
+               if (sp->conn_qual == conn_qual) {
+                       spin_unlock_irqrestore(&ia->common.lock,
+                                              ia->common.flags);
+                       return sp;
+               }
 
        spin_unlock_irqrestore(&ia->common.lock, ia->common.flags);
-
-       return sp;
+       return NULL;
 }
 
 void dapl_ia_link_rsp(struct dapl_ia *ia, struct dapl_sp *sp)
 {
        spin_lock_irqsave(&ia->common.lock, ia->common.flags);
-       dapl_llist_add_head(&ia->rsp_list_head,
-                           &sp->common.ia_list_entry, sp);
+       list_add(&sp->list, &ia->rsp_list);
        spin_unlock_irqrestore(&ia->common.lock, ia->common.flags);
 }
 

_______________________________________________
openib-general mailing list
[email protected]
http://openib.org/mailman/listinfo/openib-general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to