[ewg] Re: [ofa-general] OFED 1.3 Beta release is available

Jack Morgenstein jackm at dev.mellanox.co.il
Wed Dec 5 10:33:48 PST 2007


On Wednesday 05 December 2007 07:24, Roland Dreier wrote:
> 
> I think the only alternative we have to preserve backwards
> compatibility is to leave struct ibv_context_ops alone and change the
> structure to:
> 
> struct ibv_context {
>         struct ibv_device      *device;
>         struct ibv_context_ops  ops;
>         int                     cmd_fd;
>         int                     async_fd;
>         int                     num_comp_vectors;
>         pthread_mutex_t         mutex;
>         void                   *abi_compat;
>         struct ibv_xrc_op      *xrc_ops;
> };
> 
> with xrc_ops added at the end.  It's my fault for not making the ops
> member a pointer I guess.
> 

We don't need to have this as a pointer, really (I'd like to save the
extra malloc and associated bookkeeping). If we have the ibv_xrc_op struct
at the end of ibv_context, this is sufficient for backwards binary
compatibility(libmlx4 itself allocates the ibv_context structure for
libibverbs.  If the actual structure is a bit bigger, who cares --
we just need to preserve the current offsets of the structure
fields for binary compatibility).

If you want to be a bit more generic, we could do this as an "extra_ops"
structure and add new ops as needed.
(If future changes are messier than just adding a new op, we can then
increment the API version):

struct ibv_context_extra_ops {
	struct ibv_srq *	(*create_xrc_srq)(struct ibv_pd *pd,
						  struct ibv_xrc_domain *xrc_domain,
						  struct ibv_cq *xrc_cq,
						  struct ibv_srq_init_attr *srq_init_attr);
	struct ibv_xrc_domain *	(*open_xrc_domain)(struct ibv_context *context,
						   int fd, int oflag);
	int			(*close_xrc_domain)(struct ibv_xrc_domain *d);
};

 struct ibv_context {
         struct ibv_device      *device;
         struct ibv_context_ops  ops;
         int                     cmd_fd;
         int                     async_fd;
         int                     num_comp_vectors;
         pthread_mutex_t         mutex;
         void                   *abi_compat;
         struct ibv_context_extra_ops  extra_ops;
 };
 



More information about the general mailing list