Re: [PATCH rdma-core] verbs: Provide native ioctl implementations for trivial destroy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Dec 09, 2018 at 08:39:39PM +0000, Jason Gunthorpe wrote:
> In the kernel these all go through the common destroy flow and take no
> code. Call out to ioctl directly for these destroys instead of using
> write.
>
> Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxxxx>
> ---
>  libibverbs/CMakeLists.txt |   7 +++
>  libibverbs/cmd.c          | 117 --------------------------------------
>  libibverbs/cmd_ah.c       |  63 ++++++++++++++++++++
>  libibverbs/cmd_flow.c     |  65 +++++++++++++++++++++
>  libibverbs/cmd_mr.c       |  65 +++++++++++++++++++++
>  libibverbs/cmd_mw.c       |  64 +++++++++++++++++++++
>  libibverbs/cmd_pd.c       |  64 +++++++++++++++++++++
>  libibverbs/cmd_rwq_ind.c  |  66 +++++++++++++++++++++
>  libibverbs/cmd_xrcd.c     |  64 +++++++++++++++++++++
>  9 files changed, 458 insertions(+), 117 deletions(-)
>  create mode 100644 libibverbs/cmd_ah.c
>  create mode 100644 libibverbs/cmd_flow.c
>  create mode 100644 libibverbs/cmd_mr.c
>  create mode 100644 libibverbs/cmd_mw.c
>  create mode 100644 libibverbs/cmd_pd.c
>  create mode 100644 libibverbs/cmd_rwq_ind.c
>  create mode 100644 libibverbs/cmd_xrcd.c
>
> This is the matching userspace patch for
>
> https://patchwork.kernel.org/patch/10706139/
>
> It is still being testing so for review only.

FYI, it is not part of our regression testing.

>
> Jason
>
> diff --git a/libibverbs/CMakeLists.txt b/libibverbs/CMakeLists.txt
> index ddf5995e7fae31..edbcfdf71daa59 100644
> --- a/libibverbs/CMakeLists.txt
> +++ b/libibverbs/CMakeLists.txt
> @@ -30,12 +30,19 @@ rdma_library(ibverbs "${CMAKE_CURRENT_BINARY_DIR}/libibverbs.map"
>    1 1.5.${PACKAGE_VERSION}
>    all_providers.c
>    cmd.c
> +  cmd_ah.c
>    cmd_counters.c
>    cmd_cq.c
>    cmd_dm.c
>    cmd_fallback.c
> +  cmd_flow.c
>    cmd_flow_action.c
>    cmd_ioctl.c
> +  cmd_mr.c
> +  cmd_mw.c
> +  cmd_pd.c
> +  cmd_rwq_ind.c
> +  cmd_xrcd.c
>    compat-1_0.c
>    device.c
>    dummy_ops.c
> diff --git a/libibverbs/cmd.c b/libibverbs/cmd.c
> index a824202e7dbd5f..2e5e63d51775df 100644
> --- a/libibverbs/cmd.c
> +++ b/libibverbs/cmd.c
> @@ -326,22 +326,6 @@ int ibv_cmd_alloc_pd(struct ibv_context *context, struct ibv_pd *pd,
>  	return 0;
>  }
>
> -int ibv_cmd_dealloc_pd(struct ibv_pd *pd)
> -{
> -	struct ibv_dealloc_pd req;
> -	int ret;
> -
> -	req.core_payload = (struct ib_uverbs_dealloc_pd){
> -		.pd_handle = pd->handle,
> -	};
> -	ret = execute_cmd_write_req(pd->context, IB_USER_VERBS_CMD_DEALLOC_PD,
> -				    &req, sizeof(req));
> -	if (verbs_is_destroy_err(&ret))
> -		return ret;
> -
> -	return 0;
> -}
> -
>  int ibv_cmd_open_xrcd(struct ibv_context *context, struct verbs_xrcd *xrcd,
>  		      int vxrcd_size,
>  		      struct ibv_xrcd_init_attr *attr,
> @@ -374,23 +358,6 @@ int ibv_cmd_open_xrcd(struct ibv_context *context, struct verbs_xrcd *xrcd,
>  	return 0;
>  }
>
> -int ibv_cmd_close_xrcd(struct verbs_xrcd *xrcd)
> -{
> -	struct ibv_close_xrcd req;
> -	int ret;
> -
> -	req.core_payload = (struct ib_uverbs_close_xrcd){
> -		.xrcd_handle = xrcd->handle,
> -	};
> -	ret = execute_cmd_write_req(xrcd->xrcd.context,
> -				    IB_USER_VERBS_CMD_CLOSE_XRCD, &req,
> -				    sizeof(req));
> -	if (verbs_is_destroy_err(&ret))
> -		return ret;
> -
> -	return 0;
> -}
> -
>  int ibv_cmd_reg_mr(struct ibv_pd *pd, void *addr, size_t length,
>  		   uint64_t hca_va, int access,
>  		   struct verbs_mr *vmr, struct ibv_reg_mr *cmd,
> @@ -448,23 +415,6 @@ int ibv_cmd_rereg_mr(struct verbs_mr *vmr, uint32_t flags, void *addr,
>  	return 0;
>  }
>
> -int ibv_cmd_dereg_mr(struct verbs_mr *vmr)
> -{
> -	struct ibv_dereg_mr req;
> -	int ret;
> -
> -	req.core_payload = (struct ib_uverbs_dereg_mr){
> -		.mr_handle = vmr->ibv_mr.handle,
> -	};
> -	ret = execute_cmd_write_req(vmr->ibv_mr.context,
> -				    IB_USER_VERBS_CMD_DEREG_MR, &req,
> -				    sizeof(req));
> -	if (verbs_is_destroy_err(&ret))
> -		return ret;
> -
> -	return 0;
> -}
> -
>  int ibv_cmd_alloc_mw(struct ibv_pd *pd, enum ibv_mw_type type,
>  		     struct ibv_mw *mw, struct ibv_alloc_mw *cmd,
>  		     size_t cmd_size,
> @@ -490,22 +440,6 @@ int ibv_cmd_alloc_mw(struct ibv_pd *pd, enum ibv_mw_type type,
>  	return 0;
>  }
>
> -int ibv_cmd_dealloc_mw(struct ibv_mw *mw)
> -{
> -	struct ibv_dealloc_mw req;
> -	int ret;
> -
> -	req.core_payload = (struct ib_uverbs_dealloc_mw) {
> -		.mw_handle = mw->handle,
> -	};
> -	ret = execute_cmd_write_req(mw->context, IB_USER_VERBS_CMD_DEALLOC_MW,
> -				    &req, sizeof(req));
> -	if (verbs_is_destroy_err(&ret))
> -		return ret;
> -
> -	return 0;
> -}
> -
>  int ibv_cmd_poll_cq(struct ibv_cq *ibcq, int ne, struct ibv_wc *wc)
>  {
>  	struct ibv_poll_cq       cmd;
> @@ -1529,22 +1463,6 @@ int ibv_cmd_create_ah(struct ibv_pd *pd, struct ibv_ah *ah,
>  	return 0;
>  }
>
> -int ibv_cmd_destroy_ah(struct ibv_ah *ah)
> -{
> -	struct ibv_destroy_ah req;
> -	int ret;
> -
> -	req.core_payload = (struct ib_uverbs_destroy_ah){
> -		.ah_handle = ah->handle,
> -	};
> -	ret = execute_cmd_write_req(ah->context, IB_USER_VERBS_CMD_DESTROY_AH,
> -				    &req, sizeof(req));
> -	if (verbs_is_destroy_err(&ret))
> -		return ret;
> -
> -	return 0;
> -}
> -
>  int ibv_cmd_destroy_qp(struct ibv_qp *qp)
>  {
>  	struct ibv_destroy_qp req;
> @@ -1851,23 +1769,6 @@ int ibv_cmd_create_flow(struct ibv_qp *qp,
>  	return 0;
>  }
>
> -int ibv_cmd_destroy_flow(struct ibv_flow *flow_id)
> -{
> -	struct ibv_destroy_flow req;
> -	int ret;
> -
> -	req.core_payload = (struct ib_uverbs_destroy_flow){
> -		.flow_handle = flow_id->handle,
> -	};
> -	ret = execute_cmd_write_ex_req(flow_id->context,
> -				       IB_USER_VERBS_EX_CMD_DESTROY_FLOW, &req,
> -				       sizeof(req));
> -	if (verbs_is_destroy_err(&ret))
> -		return ret;
> -
> -	return 0;
> -}
> -
>  int ibv_cmd_create_wq(struct ibv_context *context,
>  		      struct ibv_wq_init_attr *wq_init_attr,
>  		      struct ibv_wq *wq,
> @@ -2017,24 +1918,6 @@ int ibv_cmd_create_rwq_ind_table(struct ibv_context *context,
>  	return 0;
>  }
>
> -int ibv_cmd_destroy_rwq_ind_table(struct ibv_rwq_ind_table *rwq_ind_table)
> -{
> -	struct ibv_destroy_rwq_ind_table req;
> -	int ret;
> -
> -	req.core_payload = (struct ib_uverbs_ex_destroy_rwq_ind_table){
> -		.ind_tbl_handle = rwq_ind_table->ind_tbl_handle,
> -	};
> -	ret = execute_cmd_write_ex_req(rwq_ind_table->context,
> -				       IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL,
> -				       &req, sizeof(req));
> -	if (verbs_is_destroy_err(&ret))
> -		return ret;
> -
> -	return 0;
> -}
> -
> -
>  int ibv_cmd_modify_cq(struct ibv_cq *cq,
>  		      struct ibv_modify_cq_attr *attr,
>  		      struct ibv_modify_cq *cmd,
> diff --git a/libibverbs/cmd_ah.c b/libibverbs/cmd_ah.c
> new file mode 100644
> index 00000000000000..76d4ba145b59d6
> --- /dev/null
> +++ b/libibverbs/cmd_ah.c
> @@ -0,0 +1,63 @@
> +/*
> + * Copyright (c) 2018 Mellanox Technologies, Ltd.  All rights reserved.
> + *
> + * This software is available to you under a choice of one of two
> + * licenses.  You may choose to be licensed under the terms of the GNU
> + * General Public License (GPL) Version 2, available from the file
> + * COPYING in the main directory of this source tree, or the
> + * OpenIB.org BSD license below:
> + *
> + *     Redistribution and use in source and binary forms, with or
> + *     without modification, are permitted provided that the following
> + *     conditions are met:
> + *
> + *      - Redistributions of source code must retain the above
> + *        copyright notice, this list of conditions and the following
> + *        disclaimer.
> + *
> + *      - Redistributions in binary form must reproduce the above
> + *        copyright notice, this list of conditions and the following
> + *        disclaimer in the documentation and/or other materials
> + *        provided with the distribution.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
> + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
> + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
> + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> + * SOFTWARE.

SPDX please, in all places.

> + */
> +
> +#include <infiniband/cmd_write.h>
> +
> +int ibv_cmd_destroy_ah(struct ibv_ah *ah)
> +{
> +	DECLARE_FBCMD_BUFFER(cmdb, UVERBS_OBJECT_AH,
> +			     UVERBS_METHOD_AH_DESTROY, 1, NULL);
> +	int ret;
> +
> +	fill_attr_in_obj(cmdb, UVERBS_ATTR_DESTROY_AH_HANDLE, ah->handle);
> +
> +	switch (execute_ioctl_fallback(ah->context, destroy_ah, cmdb, &ret)) {
> +	case TRY_WRITE: {
> +		struct ibv_destroy_ah req;
> +
> +		req.core_payload = (struct ib_uverbs_destroy_ah){
> +			.ah_handle = ah->handle,
> +		};
> +		ret = execute_cmd_write_req(ah->context,
> +					    IB_USER_VERBS_CMD_DESTROY_AH, &req,
> +					    sizeof(req));
> +		break;
> +	}
> +
> +	default:
> +		break;
> +	}
> +
> +	if (verbs_is_destroy_err(&ret))

Maybe you are passing uninitialized ret, if for any reason
execute_ioctl_fallback will return before execute_ioctl().

Anyway, it is fragile.

> +		return ret;
> +	return 0;
> +}
> diff --git a/libibverbs/cmd_flow.c b/libibverbs/cmd_flow.c
> new file mode 100644
> index 00000000000000..2cb09b91fa413e
> --- /dev/null
> +++ b/libibverbs/cmd_flow.c
> @@ -0,0 +1,65 @@
> +/*
> + * Copyright (c) 2018 Mellanox Technologies, Ltd.  All rights reserved.
> + *
> + * This software is available to you under a choice of one of two
> + * licenses.  You may choose to be licensed under the terms of the GNU
> + * General Public License (GPL) Version 2, available from the file
> + * COPYING in the main directory of this source tree, or the
> + * OpenIB.org BSD license below:
> + *
> + *     Redistribution and use in source and binary forms, with or
> + *     without modification, are permitted provided that the following
> + *     conditions are met:
> + *
> + *      - Redistributions of source code must retain the above
> + *        copyright notice, this list of conditions and the following
> + *        disclaimer.
> + *
> + *      - Redistributions in binary form must reproduce the above
> + *        copyright notice, this list of conditions and the following
> + *        disclaimer in the documentation and/or other materials
> + *        provided with the distribution.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
> + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
> + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
> + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> + * SOFTWARE.
> + */
> +
> +#include <infiniband/cmd_write.h>
> +
> +int ibv_cmd_destroy_flow(struct ibv_flow *flow_id)
> +{
> +	DECLARE_FBCMD_BUFFER(cmdb, UVERBS_OBJECT_FLOW,
> +			     UVERBS_METHOD_FLOW_DESTROY, 1, NULL);
> +	int ret;
> +
> +	fill_attr_in_obj(cmdb, UVERBS_ATTR_DESTROY_FLOW_HANDLE,
> +			 flow_id->handle);
> +
> +	switch (execute_ioctl_fallback(flow_id->context, destroy_ah, cmdb,
> +				       &ret)) {
> +	case TRY_WRITE: {
> +		struct ibv_destroy_flow req;
> +
> +		req.core_payload = (struct ib_uverbs_destroy_flow){
> +			.flow_handle = flow_id->handle,
> +		};
> +		ret = execute_cmd_write_ex_req(
> +			flow_id->context, IB_USER_VERBS_EX_CMD_DESTROY_FLOW,
> +			&req, sizeof(req));
> +		break;
> +	}
> +
> +	default:
> +		break;
> +	}
> +
> +	if (verbs_is_destroy_err(&ret))
> +		return ret;
> +	return 0;
> +}
> diff --git a/libibverbs/cmd_mr.c b/libibverbs/cmd_mr.c
> new file mode 100644
> index 00000000000000..e008025a8c8542
> --- /dev/null
> +++ b/libibverbs/cmd_mr.c
> @@ -0,0 +1,65 @@
> +/*
> + * Copyright (c) 2018 Mellanox Technologies, Ltd.  All rights reserved.
> + *
> + * This software is available to you under a choice of one of two
> + * licenses.  You may choose to be licensed under the terms of the GNU
> + * General Public License (GPL) Version 2, available from the file
> + * COPYING in the main directory of this source tree, or the
> + * OpenIB.org BSD license below:
> + *
> + *     Redistribution and use in source and binary forms, with or
> + *     without modification, are permitted provided that the following
> + *     conditions are met:
> + *
> + *      - Redistributions of source code must retain the above
> + *        copyright notice, this list of conditions and the following
> + *        disclaimer.
> + *
> + *      - Redistributions in binary form must reproduce the above
> + *        copyright notice, this list of conditions and the following
> + *        disclaimer in the documentation and/or other materials
> + *        provided with the distribution.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
> + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
> + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
> + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> + * SOFTWARE.
> + */
> +
> +#include <infiniband/cmd_write.h>
> +
> +int ibv_cmd_dereg_mr(struct verbs_mr *vmr)
> +{
> +	DECLARE_FBCMD_BUFFER(cmdb, UVERBS_OBJECT_MR, UVERBS_METHOD_MR_DESTROY,
> +			     1, NULL);
> +	int ret;
> +
> +	fill_attr_in_obj(cmdb, UVERBS_ATTR_DESTROY_MR_HANDLE,
> +			 vmr->ibv_mr.handle);
> +
> +	switch (execute_ioctl_fallback(vmr->ibv_mr.context, dereg_mr, cmdb,
> +				       &ret)) {
> +	case TRY_WRITE: {
> +		struct ibv_dereg_mr req;
> +
> +		req.core_payload = (struct ib_uverbs_dereg_mr){
> +			.mr_handle = vmr->ibv_mr.handle,
> +		};
> +		ret = execute_cmd_write_req(vmr->ibv_mr.context,
> +					    IB_USER_VERBS_CMD_DEREG_MR, &req,
> +					    sizeof(req));
> +		break;
> +	}
> +
> +	default:
> +		break;
> +	}
> +
> +	if (verbs_is_destroy_err(&ret))
> +		return ret;
> +	return 0;
> +}
> diff --git a/libibverbs/cmd_mw.c b/libibverbs/cmd_mw.c
> new file mode 100644
> index 00000000000000..387d4db68461b8
> --- /dev/null
> +++ b/libibverbs/cmd_mw.c
> @@ -0,0 +1,64 @@
> +/*
> + * Copyright (c) 2018 Mellanox Technologies, Ltd.  All rights reserved.
> + *
> + * This software is available to you under a choice of one of two
> + * licenses.  You may choose to be licensed under the terms of the GNU
> + * General Public License (GPL) Version 2, available from the file
> + * COPYING in the main directory of this source tree, or the
> + * OpenIB.org BSD license below:
> + *
> + *     Redistribution and use in source and binary forms, with or
> + *     without modification, are permitted provided that the following
> + *     conditions are met:
> + *
> + *      - Redistributions of source code must retain the above
> + *        copyright notice, this list of conditions and the following
> + *        disclaimer.
> + *
> + *      - Redistributions in binary form must reproduce the above
> + *        copyright notice, this list of conditions and the following
> + *        disclaimer in the documentation and/or other materials
> + *        provided with the distribution.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
> + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
> + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
> + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> + * SOFTWARE.
> + */
> +
> +#include <infiniband/cmd_write.h>
> +
> +int ibv_cmd_dealloc_mw(struct ibv_mw *mw)
> +{
> +	DECLARE_FBCMD_BUFFER(cmdb, UVERBS_OBJECT_MW, UVERBS_METHOD_MW_DESTROY,
> +			     1, NULL);
> +	int ret;
> +
> +	fill_attr_in_obj(cmdb, UVERBS_ATTR_DESTROY_MW_HANDLE,
> +			 mw->handle);
> +
> +	switch (execute_ioctl_fallback(mw->context, dealloc_mw, cmdb, &ret)) {
> +	case TRY_WRITE: {
> +		struct ibv_dealloc_mw req;
> +
> +		req.core_payload = (struct ib_uverbs_dealloc_mw){
> +			.mw_handle = mw->handle,
> +		};
> +		ret = execute_cmd_write_req(mw->context,
> +					    IB_USER_VERBS_CMD_DEALLOC_MW, &req,
> +					    sizeof(req));
> +		break;
> +	}
> +
> +	default:
> +		break;
> +	}
> +
> +	if (verbs_is_destroy_err(&ret))
> +		return ret;
> +	return 0;
> +}
> diff --git a/libibverbs/cmd_pd.c b/libibverbs/cmd_pd.c
> new file mode 100644
> index 00000000000000..d1e237be92ce8e
> --- /dev/null
> +++ b/libibverbs/cmd_pd.c
> @@ -0,0 +1,64 @@
> +/*
> + * Copyright (c) 2018 Mellanox Technologies, Ltd.  All rights reserved.
> + *
> + * This software is available to you under a choice of one of two
> + * licenses.  You may choose to be licensed under the terms of the GNU
> + * General Public License (GPL) Version 2, available from the file
> + * COPYING in the main directory of this source tree, or the
> + * OpenIB.org BSD license below:
> + *
> + *     Redistribution and use in source and binary forms, with or
> + *     without modification, are permitted provided that the following
> + *     conditions are met:
> + *
> + *      - Redistributions of source code must retain the above
> + *        copyright notice, this list of conditions and the following
> + *        disclaimer.
> + *
> + *      - Redistributions in binary form must reproduce the above
> + *        copyright notice, this list of conditions and the following
> + *        disclaimer in the documentation and/or other materials
> + *        provided with the distribution.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
> + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
> + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
> + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> + * SOFTWARE.
> + */
> +
> +#include <infiniband/cmd_write.h>
> +
> +int ibv_cmd_dealloc_pd(struct ibv_pd *pd)
> +{
> +	DECLARE_FBCMD_BUFFER(cmdb, UVERBS_OBJECT_PD, UVERBS_METHOD_PD_DESTROY,
> +			     1, NULL);
> +	int ret;
> +
> +	fill_attr_in_obj(cmdb, UVERBS_ATTR_DESTROY_PD_HANDLE,
> +			 pd->handle);
> +
> +	switch (execute_ioctl_fallback(pd->context, dealloc_pd, cmdb, &ret)) {
> +	case TRY_WRITE: {
> +		struct ibv_dealloc_pd req;
> +
> +		req.core_payload = (struct ib_uverbs_dealloc_pd){
> +			.pd_handle = pd->handle,
> +		};
> +		ret = execute_cmd_write_req(pd->context,
> +					    IB_USER_VERBS_CMD_DEALLOC_PD, &req,
> +					    sizeof(req));
> +		break;
> +	}
> +
> +	default:
> +		break;
> +	}
> +
> +	if (verbs_is_destroy_err(&ret))
> +		return ret;
> +	return 0;
> +}
> diff --git a/libibverbs/cmd_rwq_ind.c b/libibverbs/cmd_rwq_ind.c
> new file mode 100644
> index 00000000000000..78163b8a3b1493
> --- /dev/null
> +++ b/libibverbs/cmd_rwq_ind.c
> @@ -0,0 +1,66 @@
> +/*
> + * Copyright (c) 2018 Mellanox Technologies, Ltd.  All rights reserved.
> + *
> + * This software is available to you under a choice of one of two
> + * licenses.  You may choose to be licensed under the terms of the GNU
> + * General Public License (GPL) Version 2, available from the file
> + * COPYING in the main directory of this source tree, or the
> + * OpenIB.org BSD license below:
> + *
> + *     Redistribution and use in source and binary forms, with or
> + *     without modification, are permitted provided that the following
> + *     conditions are met:
> + *
> + *      - Redistributions of source code must retain the above
> + *        copyright notice, this list of conditions and the following
> + *        disclaimer.
> + *
> + *      - Redistributions in binary form must reproduce the above
> + *        copyright notice, this list of conditions and the following
> + *        disclaimer in the documentation and/or other materials
> + *        provided with the distribution.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
> + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
> + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
> + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> + * SOFTWARE.
> + */
> +
> +#include <infiniband/cmd_write.h>
> +
> +int ibv_cmd_destroy_rwq_ind_table(struct ibv_rwq_ind_table *rwq_ind_table)
> +{
> +	DECLARE_FBCMD_BUFFER(cmdb, UVERBS_OBJECT_RWQ_IND_TBL,
> +			     UVERBS_METHOD_RWQ_IND_TBL_DESTROY, 1, NULL);
> +	int ret;
> +
> +	fill_attr_in_obj(cmdb, UVERBS_ATTR_DESTROY_RWQ_IND_TBL_HANDLE,
> +			 rwq_ind_table->ind_tbl_handle);
> +
> +	switch (execute_ioctl_fallback(rwq_ind_table->context, destroy_ah, cmdb,
> +				       &ret)) {
> +	case TRY_WRITE: {
> +		struct ibv_destroy_rwq_ind_table req;
> +
> +		req.core_payload = (struct ib_uverbs_ex_destroy_rwq_ind_table){
> +			.ind_tbl_handle = rwq_ind_table->ind_tbl_handle,
> +		};
> +		ret = execute_cmd_write_ex_req(
> +			rwq_ind_table->context,
> +			IB_USER_VERBS_EX_CMD_DESTROY_RWQ_IND_TBL, &req,
> +			sizeof(req));
> +		break;
> +	}
> +
> +	default:
> +		break;
> +	}
> +
> +	if (verbs_is_destroy_err(&ret))
> +		return ret;
> +	return 0;
> +}
> diff --git a/libibverbs/cmd_xrcd.c b/libibverbs/cmd_xrcd.c
> new file mode 100644
> index 00000000000000..52d2952e398171
> --- /dev/null
> +++ b/libibverbs/cmd_xrcd.c
> @@ -0,0 +1,64 @@
> +/*
> + * Copyright (c) 2018 Mellanox Technologies, Ltd.  All rights reserved.
> + *
> + * This software is available to you under a choice of one of two
> + * licenses.  You may choose to be licensed under the terms of the GNU
> + * General Public License (GPL) Version 2, available from the file
> + * COPYING in the main directory of this source tree, or the
> + * OpenIB.org BSD license below:
> + *
> + *     Redistribution and use in source and binary forms, with or
> + *     without modification, are permitted provided that the following
> + *     conditions are met:
> + *
> + *      - Redistributions of source code must retain the above
> + *        copyright notice, this list of conditions and the following
> + *        disclaimer.
> + *
> + *      - Redistributions in binary form must reproduce the above
> + *        copyright notice, this list of conditions and the following
> + *        disclaimer in the documentation and/or other materials
> + *        provided with the distribution.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
> + * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
> + * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
> + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
> + * SOFTWARE.
> + */
> +
> +#include <infiniband/cmd_write.h>
> +
> +int ibv_cmd_close_xrcd(struct verbs_xrcd *xrcd)
> +{
> +	DECLARE_FBCMD_BUFFER(cmdb, UVERBS_OBJECT_XRCD,
> +			     UVERBS_METHOD_XRCD_DESTROY, 1, NULL);
> +	int ret;
> +
> +	fill_attr_in_obj(cmdb, UVERBS_ATTR_DESTROY_XRCD_HANDLE, xrcd->handle);
> +
> +	switch (execute_ioctl_fallback(xrcd->xrcd.context, close_xrcd, cmdb,
> +				       &ret)) {
> +	case TRY_WRITE: {
> +		struct ibv_close_xrcd req;
> +
> +		req.core_payload = (struct ib_uverbs_close_xrcd){
> +			.xrcd_handle = xrcd->handle,
> +		};
> +		ret = execute_cmd_write_req(xrcd->xrcd.context,
> +					    IB_USER_VERBS_CMD_CLOSE_XRCD, &req,
> +					    sizeof(req));
> +		break;
> +	}
> +
> +	default:
> +		break;
> +	}
> +
> +	if (verbs_is_destroy_err(&ret))
> +		return ret;
> +	return 0;
> +}
> --
> 2.19.2
>

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux