[ewg] Re: [PATCH 1/1]librdmacm: add rdma_create_qp_expanded

Ron Livne ronli at voltaire.com
Tue Aug 12 14:34:20 PDT 2008


Jack,
This patch is based on librdmacm from
git://git.openfabrics.org/~shefty/librdmacm.git

If you want me to get rid of the expanded parameter in
rdma_create_qp_common as Sean wanted, tell me and I'll send you an updated
patch.

Ron

On Tue, 12 Aug 2008, Ron Livne wrote:

> Adds a new function: int rdma_create_qp_expanded
> which uses the ibv_create_qp_expanded function in libibverbs and uses
> it similarly to ibv_create_qp, with the difference of creation flags.
>
> Signed-off-by: Ron Livne <ronli at voltaire.com>
>
> diff --git a/include/rdma/rdma_cma.h b/include/rdma/rdma_cma.h
> index 534489d..f06c04e 100644
> --- a/include/rdma/rdma_cma.h
> +++ b/include/rdma/rdma_cma.h
> @@ -297,6 +297,10 @@ int rdma_resolve_route(struct rdma_cm_id *id, int timeout_ms);
>  int rdma_create_qp(struct rdma_cm_id *id, struct ibv_pd *pd,
>  		   struct ibv_qp_init_attr *qp_init_attr);
>
> +int rdma_create_qp_expanded(struct rdma_cm_id *id, struct ibv_pd *pd,
> +				struct ibv_qp_init_attr *qp_init_attr,
> +				uint32_t create_flags);
> +
>  /**
>   * rdma_destroy_qp - Deallocate a QP.
>   * @id: RDMA identifier.
> diff --git a/src/cma.c b/src/cma.c
> index 70dbe1c..93d99c2 100644
> --- a/src/cma.c
> +++ b/src/cma.c
> @@ -781,8 +781,9 @@ static int ucma_init_ud_qp(struct cma_id_private *id_priv, struct ibv_qp *qp)
>  	return ibv_modify_qp(qp, &qp_attr, IBV_QP_STATE | IBV_QP_SQ_PSN);
>  }
>
> -int rdma_create_qp(struct rdma_cm_id *id, struct ibv_pd *pd,
> -		   struct ibv_qp_init_attr *qp_init_attr)
> +static int rdma_create_qp_common(struct rdma_cm_id *id, struct ibv_pd *pd,
> +				struct ibv_qp_init_attr *qp_init_attr,
> +				uint32_t create_flags, int expanded)
>  {
>  	struct cma_id_private *id_priv;
>  	struct ibv_qp *qp;
> @@ -792,7 +793,9 @@ int rdma_create_qp(struct rdma_cm_id *id, struct ibv_pd *pd,
>  	if (id->verbs != pd->context)
>  		return -EINVAL;
>
> -	qp = ibv_create_qp(pd, qp_init_attr);
> +	qp = expanded ?
> +		ibv_create_qp_expanded(pd, qp_init_attr, create_flags) :
> +		ibv_create_qp(pd, qp_init_attr);
>  	if (!qp)
>  		return -ENOMEM;
>
> @@ -810,6 +813,19 @@ err:
>  	return ret;
>  }
>
> +int rdma_create_qp_expanded(struct rdma_cm_id *id, struct ibv_pd *pd,
> +				struct ibv_qp_init_attr *qp_init_attr,
> +				uint32_t create_flags)
> +{
> +	return rdma_create_qp_common(id, pd, qp_init_attr, create_flags, 1);
> +}
> +
> +int rdma_create_qp(struct rdma_cm_id *id, struct ibv_pd *pd,
> +				struct ibv_qp_init_attr *qp_init_attr)
> +{
> +	return rdma_create_qp_common(id, pd, qp_init_attr, 0, 0);
> +}
> +
>  void rdma_destroy_qp(struct rdma_cm_id *id)
>  {
>  	ibv_destroy_qp(id->qp);
> diff --git a/src/librdmacm.map b/src/librdmacm.map
> index cb94efe..b237eda 100644
> --- a/src/librdmacm.map
> +++ b/src/librdmacm.map
> @@ -28,5 +28,6 @@ RDMACM_1.0 {
>  		rdma_get_local_addr;
>  		rdma_get_peer_addr;
>  		rdma_migrate_id;
> +		rdma_create_qp_expanded;
>  	local: *;
>  };
>



More information about the ewg mailing list