[stgt] [PATCH] dynamically link libibverbs and librdma

Pete Wyckoff pw at padd.com
Mon Sep 22 23:07:16 CEST 2008


dorons at Voltaire.COM wrote on Sun, 21 Sep 2008 08:34 +0300:
> dynamically link libibverbs and librdma for using
> stgt without having userspace IB (e.g tcp mode).

I like the idea, but the implementation is quite ugly.  Is there any
better way to do it?  What other projects do dynamic linking to IB
like this?

> +typedef void (*ibv_ack_cq_events_t)(struct ibv_cq *cq, unsigned int nevents);
> +typedef struct ibv_pd *(*ibv_alloc_pd_t)(struct ibv_context *context);
> +typedef struct ibv_comp_channel *(*ibv_create_comp_channel_t)(struct ibv_context *context);
> +typedef struct ibv_cq *(*ibv_create_cq_t)(struct ibv_context *context, int cqe,
> +                              void *cq_context,
> +                              struct ibv_comp_channel *channel,
> +                              int comp_vector);
[..]

This particularly feels wrong.  We have to duplicate the function
declarations from verbs.h inside tgt?

> -	conn->srmr = ibv_reg_mr(conn->dev->pd, conn->srbuf, size,
> +	conn->srmr = tgt_fptr.ibv_reg_mr(conn->dev->pd, conn->srbuf, size,
>  				IBV_ACCESS_LOCAL_WRITE);

Is this really the only way?  All calls have to go through this big
table of function pointers?

What about compiling libtgt-rdma.so using existing verbs, then
figure out if you can dlopen() that successfully.  Maybe if you say
RTLD_NOW and libverbs.so is not present, the dlopen will fail and
you can fall back to non-IB mode.

		-- Pete
--
To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html



More information about the stgt mailing list