[openib-general] Re: [PATCH] kDAPL: convert the ep list to linux native
James Lentini
jlentini at netapp.com
Mon Jun 13 14:10:31 PDT 2005
Tom.
This looks good. I've checked it in as revision 2595.
Eventually, we could move the list up into the dapl_common structure.
The one oddity is that all the objects are put on the IA list except
CRs which are placed on an SP. I think it would be worth reflecting
this in the list's member name. Instead of calling it a ia_list_entry
as it is now, a name like parent_list or owner_list would be more
appropriate.
james
On Fri, 10 Jun 2005, Tom Duffy wrote:
tduffy> This patch converts the ep list to the linux native linked list
tduffy> structure. Let me know what you think.
tduffy>
tduffy> Signed-off-by: Tom Duffy <tduffy at sun.com>
tduffy>
tduffy> Index: linux-kernel-ll2/dat-provider/dapl_ia.c
tduffy> ===================================================================
tduffy> --- linux-kernel-ll2/dat-provider/dapl_ia.c (revision 2585)
tduffy> +++ linux-kernel-ll2/dat-provider/dapl_ia.c (working copy)
tduffy> @@ -63,7 +63,7 @@ struct dapl_ia *dapl_ia_alloc(struct dat
tduffy> ia->async_error_evd = NULL;
tduffy> ia->cleanup_async_error_evd = FALSE;
tduffy> dapl_llist_init_entry(&ia->hca_ia_list_entry);
tduffy> - dapl_llist_init_head(&ia->ep_list_head);
tduffy> + INIT_LIST_HEAD(&ia->ep_list);
tduffy> dapl_llist_init_head(&ia->lmr_list_head);
tduffy> dapl_llist_init_head(&ia->rmr_list_head);
tduffy> dapl_llist_init_head(&ia->pz_list_head);
tduffy> @@ -104,7 +104,7 @@ bail:
tduffy> u32 dapl_ia_abrupt_close(struct dapl_ia *ia)
tduffy> {
tduffy> u32 dat_status = DAT_SUCCESS;
tduffy> - struct dapl_ep *ep, *next_ep;
tduffy> + struct dapl_ep *ep;
tduffy> struct dapl_lmr *lmr, *next_lmr;
tduffy> struct dapl_rmr *rmr, *next_rmr;
tduffy> struct dapl_pz *pz, *next_pz;
tduffy> @@ -151,12 +151,7 @@ u32 dapl_ia_abrupt_close(struct dapl_ia
tduffy> sp = next_sp;
tduffy> }
tduffy>
tduffy> - ep = (dapl_llist_is_empty(&ia->ep_list_head)
tduffy> - ? NULL : dapl_llist_peek_head(&ia->ep_list_head));
tduffy> - while (ep != NULL) {
tduffy> - next_ep = dapl_llist_next_entry(&ia->ep_list_head,
tduffy> - &ep->common.
tduffy> - ia_list_entry);
tduffy> + list_for_each_entry(ep, &ia->ep_list, list) {
tduffy> /*
tduffy> * Issue a disconnect if the EP needs it
tduffy> */
tduffy> @@ -181,7 +176,6 @@ u32 dapl_ia_abrupt_close(struct dapl_ia
tduffy> dapl_dbg_log(DAPL_DBG_TYPE_WARN,
tduffy> "ia_close(ABRUPT): ep_free(%p) returns %x\n",
tduffy> ep, dat_status);
tduffy> - ep = next_ep;
tduffy> }
tduffy>
tduffy> lmr = (dapl_llist_is_empty(&ia->lmr_list_head)
tduffy> @@ -332,7 +326,7 @@ u32 dapl_ia_graceful_close(struct dapl_i
tduffy>
tduffy> if (!dapl_llist_is_empty(&ia->rmr_list_head) ||
tduffy> !dapl_llist_is_empty(&ia->rsp_list_head) ||
tduffy> - !dapl_llist_is_empty(&ia->ep_list_head) ||
tduffy> + !list_empty(&ia->ep_list) ||
tduffy> !dapl_llist_is_empty(&ia->lmr_list_head) ||
tduffy> !dapl_llist_is_empty(&ia->psp_list_head) ||
tduffy> !dapl_llist_is_empty(&ia->pz_list_head)) {
tduffy> @@ -427,7 +421,7 @@ void dapl_ia_free(struct dapl_ia *ia)
tduffy> dapl_os_assert(ia->async_error_evd == NULL);
tduffy> dapl_os_assert(dapl_llist_is_empty(&ia->lmr_list_head));
tduffy> dapl_os_assert(dapl_llist_is_empty(&ia->rmr_list_head));
tduffy> - dapl_os_assert(dapl_llist_is_empty(&ia->ep_list_head));
tduffy> + dapl_os_assert(list_empty(&ia->ep_list));
tduffy> dapl_os_assert(dapl_llist_is_empty(&ia->evd_list_head));
tduffy> dapl_os_assert(dapl_llist_is_empty(&ia->psp_list_head));
tduffy> dapl_os_assert(dapl_llist_is_empty(&ia->rsp_list_head));
tduffy> @@ -444,19 +438,17 @@ void dapl_ia_free(struct dapl_ia *ia)
tduffy> void dapl_ia_link_ep(struct dapl_ia *ia, struct dapl_ep *ep)
tduffy> {
tduffy> spin_lock_irqsave(&ia->common.lock, ia->common.flags);
tduffy> - dapl_llist_add_head(&ia->ep_list_head,
tduffy> - &ep->common.ia_list_entry, ep);
tduffy> + list_add(&ep->list, &ia->ep_list);
tduffy> spin_unlock_irqrestore(&ia->common.lock, ia->common.flags);
tduffy> }
tduffy>
tduffy> /*
tduffy> - * Remove an ep from the ia info structure
tduffy> + * Remove an ep from the ia structure
tduffy> */
tduffy> void dapl_ia_unlink_ep(struct dapl_ia *ia, struct dapl_ep *ep)
tduffy> {
tduffy> spin_lock_irqsave(&ia->common.lock, ia->common.flags);
tduffy> - dapl_llist_remove_entry(&ia->ep_list_head,
tduffy> - &ep->common.ia_list_entry);
tduffy> + list_del(&ep->list);
tduffy> spin_unlock_irqrestore(&ia->common.lock, ia->common.flags);
tduffy> }
tduffy>
tduffy> Index: linux-kernel-ll2/dat-provider/dapl.h
tduffy> ===================================================================
tduffy> --- linux-kernel-ll2/dat-provider/dapl.h (revision 2585)
tduffy> +++ linux-kernel-ll2/dat-provider/dapl.h (working copy)
tduffy> @@ -34,6 +34,8 @@
tduffy> #ifndef DAPL_H
tduffy> #define DAPL_H
tduffy>
tduffy> +#include <linux/list.h>
tduffy> +
tduffy> #include <dat.h>
tduffy>
tduffy> #include "dapl_util.h"
tduffy> @@ -152,7 +154,7 @@ struct dapl_ia {
tduffy> boolean_t cleanup_async_error_evd;
tduffy>
tduffy> struct dapl_llist_entry hca_ia_list_entry; /* HCAs list of IAs */
tduffy> - struct dapl_llist_entry *ep_list_head; /* EP queue */
tduffy> + struct list_head ep_list; /* EP queue */
tduffy> struct dapl_llist_entry *lmr_list_head; /* LMR queue */
tduffy> struct dapl_llist_entry *rmr_list_head; /* RMR queue */
tduffy> struct dapl_llist_entry *pz_list_head; /* PZ queue */
tduffy> @@ -195,6 +197,7 @@ struct dapl_evd {
tduffy> struct dapl_ep {
tduffy> struct dat_ep ep;
tduffy> struct dapl_common common;
tduffy> + struct list_head list;
tduffy> /* What the DAT Consumer asked for */
tduffy> struct dat_ep_param param;
tduffy>
tduffy>
More information about the general
mailing list