[openib-general] Re: [PATCH][kdapl] Integrate dapl_hca_link_ia/dapl_hca_unlink_ia into dapl_ia.c

James Lentini jlentini at netapp.com
Thu Jun 23 13:23:14 PDT 2005


Do we even need to link each IA onto an HCA? I don't see where in the 
code we use an HCA's ia_list. Is this just dead code?

On Mon, 20 Jun 2005, Itamar Rabenstein wrote:

itamar> Integrate dapl_hca_link_ia/dapl_hca_unlink_ia into dapl_ia.c
itamar> (no need for functions that just call LIST_ADD and LIST_DEL)
itamar> 
itamar> Signed-off-by: Itamar Rabenstein <itamar at mellanox.co.il>
itamar> 
itamar> diff -Nurp -X dontdiff dat-provider_simp/dapl_hca_util.c dat-provider/dapl_hca_util.c
itamar> --- dat-provider_simp/dapl_hca_util.c	Sun Jun 19 18:36:31 2005
itamar> +++ dat-provider/dapl_hca_util.c	Sun Jun 19 18:38:33 2005
itamar> @@ -88,49 +88,3 @@ void dapl_hca_free(struct dapl_hca *hca)
itamar>  {
itamar>  	kfree(hca);
itamar>  }
itamar> -
itamar> -/*
itamar> - * dapl_hca_link_ia
itamar> - *
itamar> - * Add an ia to the HCA structure
itamar> - *
itamar> - * Input:
itamar> - *	hca
itamar> - *	ia_ptr
itamar> - *
itamar> - * Output:
itamar> - * 	none
itamar> - *
itamar> - * Returns:
itamar> - * 	none
itamar> - *
itamar> - */
itamar> -void dapl_hca_link_ia(struct dapl_hca *hca, struct dapl_ia *ia_ptr)
itamar> -{
itamar> -	spin_lock_irqsave(&hca->lock, hca->flags);
itamar> -	list_add(&ia_ptr->list, &hca->ia_list);
itamar> -	spin_unlock_irqrestore(&hca->lock, hca->flags);
itamar> -}
itamar> -
itamar> -/*
itamar> - * dapl_hca_unlink_ia
itamar> - *
itamar> - * Remove an ia from the hca info structure
itamar> - *
itamar> - * Input:
itamar> - *	hca
itamar> - *	ia_ptr
itamar> - *
itamar> - * Output:
itamar> - * 	none
itamar> - *
itamar> - * Returns:
itamar> - * 	none
itamar> - *
itamar> - */
itamar> -void dapl_hca_unlink_ia(struct dapl_hca *hca, struct dapl_ia *ia)
itamar> -{
itamar> -	spin_lock_irqsave(&hca->lock, hca->flags);
itamar> -	list_del(&ia->list);
itamar> -	spin_unlock_irqrestore(&hca->lock, hca->flags);
itamar> -}
itamar> diff -Nurp -X dontdiff dat-provider_simp/dapl_hca_util.h dat-provider/dapl_hca_util.h
itamar> --- dat-provider_simp/dapl_hca_util.h	Sun Jun 19 18:36:31 2005
itamar> +++ dat-provider/dapl_hca_util.h	Sun Jun 19 18:36:45 2005
itamar> @@ -39,8 +39,4 @@ struct dapl_hca *dapl_hca_alloc(char *na
itamar>  
itamar>  void dapl_hca_free(struct dapl_hca *hca);
itamar>  
itamar> -void dapl_hca_link_ia(struct dapl_hca *hca, struct dapl_ia *ia);
itamar> -
itamar> -void dapl_hca_unlink_ia(struct dapl_hca *hca, struct dapl_ia *ia);
itamar> -
itamar>  #endif
itamar> diff -Nurp -X dontdiff dat-provider_simp/dapl_ia.c dat-provider/dapl_ia.c
itamar> --- dat-provider_simp/dapl_ia.c	Sun Jun 19 18:36:31 2005
itamar> +++ dat-provider/dapl_ia.c	Sun Jun 19 18:39:03 2005
itamar> @@ -34,7 +34,6 @@
itamar>  #include "dapl_ia.h"
itamar>  #include "dapl_provider.h"
itamar>  #include "dapl_evd.h"
itamar> -#include "dapl_hca_util.h"
itamar>  #include "dapl_openib_util.h"
itamar>  #include "dapl_sp.h"
itamar>  #include "dapl_cr.h"
itamar> @@ -71,7 +70,9 @@ static struct dapl_ia *dapl_ia_alloc(str
itamar>  	INIT_LIST_HEAD(&ia->psp_list);
itamar>  	INIT_LIST_HEAD(&ia->srq_list);
itamar>  
itamar> -	dapl_hca_link_ia(hca, ia);
itamar> +	spin_lock_irqsave(&hca->lock, hca->flags);
itamar> +	list_add(&ia->list, &hca->ia_list);
itamar> +	spin_unlock_irqrestore(&hca->lock, hca->flags);
itamar>  
itamar>  	return ia;
itamar>  }
itamar> @@ -379,7 +380,9 @@ void dapl_ia_free(struct dapl_ia *ia)
itamar>  	dapl_os_assert(list_empty(&ia->psp_list));
itamar>  	dapl_os_assert(list_empty(&ia->rsp_list));
itamar>  
itamar> -	dapl_hca_unlink_ia(ia->hca, ia);
itamar> +	spin_lock_irqsave(&ia->hca->lock, ia->hca->flags);
itamar> +	list_del(&ia->list);
itamar> +	spin_unlock_irqrestore(&ia->hca->lock, ia->hca->flags);
itamar>  	/* no need to destroy ia->common.lock */
itamar>  
itamar>  	kfree(ia);
itamar> -- 
itamar> Itamar
itamar> 



More information about the general mailing list