[openib-general] [PATCH 5/9] kDAPL: convert the evd list to linux native
Tom Duffy
Tom.Duffy at Sun.COM
Mon Jun 13 17:18:08 PDT 2005
Please pay particular attention to the part where the asynchronous event is
kept around. I think I got it right, but would like to make sure another
pair of eyeballs looked it over.
Signed-off-by: Tom Duffy <tduffy at sun.com>
diff -Nurp -X /home/tduffy/dontdiff linux-kernel-ll5/dat-provider/dapl.h linux-kernel-ll6/dat-provider/dapl.h
--- linux-kernel-ll5/dat-provider/dapl.h 2005-06-13 15:46:07.858004000 -0700
+++ linux-kernel-ll6/dat-provider/dapl.h 2005-06-13 16:11:11.259003000 -0700
@@ -158,7 +158,7 @@ struct dapl_ia {
struct list_head lmr_list; /* LMR queue */
struct list_head rmr_list; /* RMR queue */
struct list_head pz_list; /* PZ queue */
- struct dapl_llist_entry *evd_list_head; /* EVD 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 dapl_llist_entry *srq_list_head; /* SRQ queue */
@@ -167,6 +167,7 @@ struct dapl_ia {
struct dapl_evd {
struct dat_evd evd;
struct dapl_common common;
+ struct list_head list;
DAPL_EVD_STATE evd_state;
enum dat_evd_flags evd_flags;
diff -Nurp -X /home/tduffy/dontdiff linux-kernel-ll5/dat-provider/dapl_ia.c linux-kernel-ll6/dat-provider/dapl_ia.c
--- linux-kernel-ll5/dat-provider/dapl_ia.c 2005-06-13 15:48:31.170005000 -0700
+++ linux-kernel-ll6/dat-provider/dapl_ia.c 2005-06-13 16:30:09.267002000 -0700
@@ -67,7 +67,7 @@ struct dapl_ia *dapl_ia_alloc(struct dat
INIT_LIST_HEAD(&ia->lmr_list);
INIT_LIST_HEAD(&ia->rmr_list);
INIT_LIST_HEAD(&ia->pz_list);
- dapl_llist_init_head(&ia->evd_list_head);
+ INIT_LIST_HEAD(&ia->evd_list);
dapl_llist_init_head(&ia->rsp_list_head);
dapl_llist_init_head(&ia->psp_list_head);
@@ -108,7 +108,7 @@ u32 dapl_ia_abrupt_close(struct dapl_ia
struct dapl_lmr *lmr;
struct dapl_rmr *rmr;
struct dapl_pz *pz;
- struct dapl_evd *evd, *next_evd;
+ struct dapl_evd *evd;
struct dapl_sp *sp, *next_sp; /* for PSP and RSP queues */
struct dapl_cr *cr;
struct dapl_hca *hca;
@@ -232,12 +232,7 @@ u32 dapl_ia_abrupt_close(struct dapl_ia
* HCA, to accept any async events that occur. So we cycle through
* the list with dapl_llist_next_entry instead of dapl_llist_is_empty.
*/
- evd = (dapl_llist_is_empty(&ia->evd_list_head)
- ? NULL : dapl_llist_peek_head(&ia->evd_list_head));
- while (evd != NULL) {
- next_evd = dapl_llist_next_entry(&ia->evd_list_head,
- &evd->common.
- ia_list_entry);
+ list_for_each_entry(evd, &ia->evd_list, list) {
if (evd != ia->async_error_evd) {
/* it isn't the async EVD; delete it. */
dat_status = dapl_evd_free((struct dat_evd *)evd);
@@ -246,7 +241,6 @@ u32 dapl_ia_abrupt_close(struct dapl_ia
"ia_close(ABRUPT): evd_free(%p) returns %x\n",
evd, dat_status);
}
- evd = next_evd;
}
hca = ia->hca;
@@ -297,7 +291,6 @@ u32 dapl_ia_graceful_close(struct dapl_i
u32 dat_status = DAT_SUCCESS;
u32 cur_dat_status;
struct dapl_evd *evd;
- struct dapl_llist_entry *entry;
struct dapl_hca *hca;
if (!list_empty(&ia->rmr_list) ||
@@ -315,7 +308,7 @@ u32 dapl_ia_graceful_close(struct dapl_i
/* (ie. it was not created by dapl_ia_open) */
/* then the evd list should be empty */
if (FALSE == ia->cleanup_async_error_evd) {
- if (!dapl_llist_is_empty(&ia->evd_list_head)) {
+ if (!list_empty(&ia->evd_list)) {
dat_status =
DAT_ERROR(DAT_INVALID_STATE,
DAT_INVALID_STATE_IA_IN_USE);
@@ -325,9 +318,9 @@ u32 dapl_ia_graceful_close(struct dapl_i
/* else the async evd should be the only evd in */
/* the list. */
else {
- evd = (dapl_llist_is_empty(&ia->evd_list_head)
- ? NULL : dapl_llist_peek_head(&ia->
- evd_list_head));
+ evd = (list_empty(&ia->evd_list)
+ ? NULL : list_entry(ia->evd_list.next,
+ struct dapl_evd, list));
if (evd != NULL &&
!(evd->evd_flags & DAT_EVD_ASYNC_FLAG)) {
@@ -337,10 +330,8 @@ u32 dapl_ia_graceful_close(struct dapl_i
goto bail;
}
- entry = ia->evd_list_head;
-
/* if the async evd is not the only element in the list */
- if (entry->blink != entry->flink) {
+ if (evd->list.next != &ia->evd_list) {
dat_status =
DAT_ERROR(DAT_INVALID_STATE,
DAT_INVALID_STATE_IA_IN_USE);
@@ -398,7 +389,7 @@ void dapl_ia_free(struct dapl_ia *ia)
dapl_os_assert(list_empty(&ia->lmr_list));
dapl_os_assert(list_empty(&ia->rmr_list));
dapl_os_assert(list_empty(&ia->ep_list));
- dapl_os_assert(dapl_llist_is_empty(&ia->evd_list_head));
+ 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));
@@ -516,8 +507,7 @@ void dapl_ia_unlink_pz(struct dapl_ia *i
void dapl_ia_link_evd(struct dapl_ia *ia, struct dapl_evd *evd)
{
spin_lock_irqsave(&ia->common.lock, ia->common.flags);
- dapl_llist_add_head(&ia->evd_list_head,
- &evd->common.ia_list_entry, evd);
+ list_add(&evd->list, &ia->evd_list);
spin_unlock_irqrestore(&ia->common.lock, ia->common.flags);
}
@@ -527,8 +517,7 @@ void dapl_ia_link_evd(struct dapl_ia *ia
void dapl_ia_unlink_evd(struct dapl_ia *ia, struct dapl_evd *evd)
{
spin_lock_irqsave(&ia->common.lock, ia->common.flags);
- dapl_llist_remove_entry(&ia->evd_list_head,
- &evd->common.ia_list_entry);
+ list_del(&evd->list);
spin_unlock_irqrestore(&ia->common.lock, ia->common.flags);
}
More information about the general
mailing list