[openib-general] Re: [PATCH] kDAPL: remove typedef DAT_CONTEX T

Itamar Rabenstein itamar at mellanox.co.il
Tue May 31 09:16:40 PDT 2005


hi all,
I have tried to use DAT_UPCALL_NULL and I got compile error
and I don't think that it is good to try to make comparator ( = ) between
structs
if we want to check for DAT_UPCALL_NULL we need to check that the CB
function pointer is NULL.
I mean that if you want to use DAT_UPCALL_NULL you need to have 
real dat_upcall struct and to set the CB function to NULL.
instead of casting NULL to be a struct.

Currently dat_evd_modify_upcall() is not implemented according the spec.

 Itamar  

> -----Original Message-----
> From: James Lentini [mailto:jlentini at netapp.com]
> Sent: Tuesday, May 31, 2005 6:39 PM
> To: Tom Duffy
> Cc: openib-general at openib.org
> Subject: [openib-general] Re: [PATCH] kDAPL: remove typedef 
> DAT_CONTEXT
> 
> 
> 
> Mostly committed in revision 2515. 
> 
> I didn't remove DAT_UPCALL_NULL and DAT_UPCALL_SAME. DAT_UPCALL_NULL 
> is provided as a convenience to the consumer. I think it is 
> useful, but 
> I'm willing to hear other opinions. The provider's implementation of 
> dat_evd_modify_upcall() should check for the DAT_UPCALL_SAME value. 
> The fact that it doesn't is a bug.
> 
> james
> 
> On Fri, 27 May 2005, Tom Duffy wrote:
> 
> tduffy> Get rid of the typedef DAT_CONTEXT.
> tduffy> 
> tduffy> Signed-off-by: Tom Duffy <tduffy at sun.com>
> tduffy> 
> tduffy> Index: linux-kernel/test/dapltest/include/dapl_common.h
> tduffy> 
> ===================================================================
> tduffy> --- linux-kernel/test/dapltest/include/dapl_common.h	
> (revision 2506)
> tduffy> +++ linux-kernel/test/dapltest/include/dapl_common.h	
> (working copy)
> tduffy> @@ -42,7 +42,7 @@ typedef enum
> tduffy>  typedef struct
> tduffy>  {
> tduffy>      DAT_RMR_CONTEXT         rmr_context;
> tduffy> -    DAT_CONTEXT             mem_address;
> tduffy> +    union dat_context             mem_address;
> tduffy>  } RemoteMemoryInfo;
> tduffy>  #pragma pack()
> tduffy>  
> tduffy> Index: linux-kernel/dat-provider/dapl_get_consumer_context.c
> tduffy> 
> ===================================================================
> tduffy> --- 
> linux-kernel/dat-provider/dapl_get_consumer_context.c	(revision 2506)
> tduffy> +++ 
> linux-kernel/dat-provider/dapl_get_consumer_context.c	(working copy)
> tduffy> @@ -48,7 +48,7 @@
> tduffy>   * 	DAT_SUCCESS
> tduffy>   * 	DAT_INVALID_PARAMETER
> tduffy>   */
> tduffy> -u32 dapl_get_consumer_context(DAT_HANDLE dat_handle, 
> DAT_CONTEXT *context)
> tduffy> +u32 dapl_get_consumer_context(DAT_HANDLE dat_handle, 
> union dat_context *context)
> tduffy>  {
> tduffy>  	u32 dat_status = DAT_SUCCESS;
> tduffy>  	struct dapl_header *header;
> tduffy> Index: linux-kernel/dat-provider/dapl_set_consumer_context.c
> tduffy> 
> ===================================================================
> tduffy> --- 
> linux-kernel/dat-provider/dapl_set_consumer_context.c	(revision 2506)
> tduffy> +++ 
> linux-kernel/dat-provider/dapl_set_consumer_context.c	(working copy)
> tduffy> @@ -47,7 +47,7 @@
> tduffy>   * 	DAT_SUCCESS
> tduffy>   * 	DAT_INVALID_HANDLE
> tduffy>   */
> tduffy> -u32 dapl_set_consumer_context(DAT_HANDLE dat_handle, 
> DAT_CONTEXT context)
> tduffy> +u32 dapl_set_consumer_context(DAT_HANDLE dat_handle, 
> union dat_context context)
> tduffy>  {
> tduffy>  	u32 dat_status = DAT_SUCCESS;
> tduffy>  	struct dapl_header *header;
> tduffy> Index: linux-kernel/dat-provider/dapl.h
> tduffy> 
> ===================================================================
> tduffy> --- linux-kernel/dat-provider/dapl.h	(revision 2506)
> tduffy> +++ linux-kernel/dat-provider/dapl.h	(working copy)
> tduffy> @@ -177,7 +177,7 @@ struct dapl_header {
> tduffy>  	enum dat_handle_type handle_type; 
> tduffy>  	struct dapl_ia *owner_ia;
> tduffy>  	struct dapl_llist_entry ia_list_entry;	
> tduffy> -	DAT_CONTEXT user_context;	  /* user 
> context - opaque to DAPL */
> tduffy> +	union dat_context user_context;	  /* user 
> context - opaque to DAPL */
> tduffy>  	spinlock_t lock;
> tduffy>  	unsigned long flags;		  /* saved lock 
> flag values */
> tduffy>  };
> tduffy> @@ -423,9 +423,11 @@ extern u32 dapl_ia_query(DAT_IA_HANDLE, 
> tduffy>  
> tduffy>  /* helper functions */
> tduffy>  
> tduffy> -extern u32 dapl_set_consumer_context(DAT_HANDLE 
> handle, DAT_CONTEXT context);
> tduffy> +extern u32 dapl_set_consumer_context(DAT_HANDLE handle,
> tduffy> +				     union dat_context context);
> tduffy>  
> tduffy> -extern u32 dapl_get_consumer_context(DAT_HANDLE 
> handle, DAT_CONTEXT *context);
> tduffy> +extern u32 dapl_get_consumer_context(DAT_HANDLE handle,
> tduffy> +				     union dat_context 
> *context);
> tduffy>  
> tduffy>  extern u32 dapl_get_handle_type(DAT_HANDLE handle,
> tduffy>  				enum dat_handle_type *type);
> tduffy> Index: linux-kernel/dat/dat.h
> tduffy> 
> ===================================================================
> tduffy> --- linux-kernel/dat/dat.h	(revision 2506)
> tduffy> +++ linux-kernel/dat/dat.h	(working copy)
> tduffy> @@ -361,14 +361,14 @@ typedef enum {
> tduffy>  	TRUE = 1
> tduffy>  } boolean_t;
> tduffy>  
> tduffy> -typedef union dat_context {
> tduffy> +union dat_context {
> tduffy>  	void *as_ptr;
> tduffy>  	u64 as_64;
> tduffy>  	unsigned long long as_index;
> tduffy> -} DAT_CONTEXT;
> tduffy> +};
> tduffy>  
> tduffy> -typedef DAT_CONTEXT DAT_DTO_COOKIE;
> tduffy> -typedef DAT_CONTEXT DAT_RMR_COOKIE;
> tduffy> +typedef union dat_context DAT_DTO_COOKIE;
> tduffy> +typedef union dat_context DAT_RMR_COOKIE;
> tduffy>  
> tduffy>  enum dat_completion_flags {
> tduffy>  	/* Completes with notification                  
>                    */
> tduffy> @@ -920,13 +920,6 @@ struct dat_upcall_object {
> tduffy>  	DAT_UPCALL_FUNC upcall_func;
> tduffy>  };
> tduffy>  
> tduffy> -/* Define NULL upcall */
> tduffy> -
> tduffy> -#define DAT_UPCALL_NULL \
> tduffy> -	((struct dat_upcall_object) { (void *) NULL, 
> (DAT_UPCALL_FUNC) NULL })
> tduffy> -
> tduffy> -#define DAT_UPCALL_SAME	((struct 
> dat_upcall_object *) NULL)
> tduffy> -
> tduffy>  /* Provider/registration info */
> tduffy>  
> tduffy>  struct dat_provider_info {
> tduffy> @@ -1098,9 +1091,9 @@ typedef u32 (*DAT_IA_QUERY_FUNC)(DAT_IA_
> tduffy>  				 struct dat_ia_attr *,
> tduffy>  				 struct dat_provider_attr *);
> tduffy>  
> tduffy> -typedef u32 
> (*DAT_SET_CONSUMER_CONTEXT_FUNC)(DAT_HANDLE, DAT_CONTEXT);
> tduffy> +typedef u32 
> (*DAT_SET_CONSUMER_CONTEXT_FUNC)(DAT_HANDLE, union dat_context);
> tduffy>  
> tduffy> -typedef u32 
> (*DAT_GET_CONSUMER_CONTEXT_FUNC)(DAT_HANDLE, DAT_CONTEXT *);
> tduffy> +typedef u32 
> (*DAT_GET_CONSUMER_CONTEXT_FUNC)(DAT_HANDLE, union dat_context *);
> tduffy>  
> tduffy>  typedef u32 (*DAT_GET_HANDLE_TYPE_FUNC)(DAT_HANDLE, 
> enum dat_handle_type *);
> tduffy>  
> tduffy> @@ -1387,14 +1380,14 @@ extern u32 
> dat_registry_list_providers(i
> tduffy>          DAT_HANDLE_TO_PROVIDER(handle)->func(handle, 
> ##__VA_ARGS__)
> tduffy>  
> tduffy>  static inline u32 dat_set_consumer_context(DAT_HANDLE handle,
> tduffy> -					   DAT_CONTEXT context) 
> tduffy> +					   union 
> dat_context context) 
> tduffy>  {
> tduffy>          return 
> DAT_CALL_PROVIDER_FUNC(set_consumer_context_func, handle,
> tduffy>  				      context);
> tduffy>  }
> tduffy>  
> tduffy>  static inline u32 dat_get_consumer_context(DAT_HANDLE handle,
> tduffy> -					   DAT_CONTEXT *context)
> tduffy> +					   union 
> dat_context *context)
> tduffy>  {
> tduffy>          return 
> DAT_CALL_PROVIDER_FUNC(get_consumer_context_func, handle,
> tduffy>  				      context);
> tduffy> 
> _______________________________________________
> openib-general mailing list
> openib-general at openib.org
> http://openib.org/mailman/listinfo/openib-general
> 
> To unsubscribe, please visit 
> http://openib.org/mailman/listinfo/openib-general
> 



More information about the general mailing list