Use verbs_is_destroy_err() upon ioctl destroy commands to consider the EIO use case. Signed-off-by: Yishai Hadas <yishaih@xxxxxxxxxxxx> --- libibverbs/cmd_counters.c | 8 +++++++- libibverbs/cmd_dm.c | 7 ++++++- libibverbs/cmd_flow_action.c | 8 +++++++- libibverbs/libibverbs.map.in | 1 + providers/mlx5/verbs.c | 2 ++ 5 files changed, 23 insertions(+), 3 deletions(-) diff --git a/libibverbs/cmd_counters.c b/libibverbs/cmd_counters.c index 13e66d5..ed57f25 100644 --- a/libibverbs/cmd_counters.c +++ b/libibverbs/cmd_counters.c @@ -33,6 +33,7 @@ #include <infiniband/cmd_ioctl.h> #include <rdma/ib_user_ioctl_cmds.h> #include <infiniband/driver.h> +#include <infiniband/cmd_write.h> int ibv_cmd_create_counters(struct ibv_context *context, struct ibv_counters_init_attr *init_attr, @@ -65,9 +66,14 @@ int ibv_cmd_destroy_counters(struct verbs_counters *vcounters) DECLARE_COMMAND_BUFFER(cmd, UVERBS_OBJECT_COUNTERS, UVERBS_METHOD_COUNTERS_DESTROY, 1); + int ret; fill_attr_in_obj(cmd, UVERBS_ATTR_DESTROY_COUNTERS_HANDLE, vcounters->handle); - return execute_ioctl(vcounters->counters.context, cmd); + ret = execute_ioctl(vcounters->counters.context, cmd); + if (verbs_is_destroy_err(&ret)) + return ret; + + return 0; } int ibv_cmd_read_counters(struct verbs_counters *vcounters, diff --git a/libibverbs/cmd_dm.c b/libibverbs/cmd_dm.c index e2018c3..86b1331 100644 --- a/libibverbs/cmd_dm.c +++ b/libibverbs/cmd_dm.c @@ -62,10 +62,15 @@ int ibv_cmd_free_dm(struct verbs_dm *dm) { DECLARE_COMMAND_BUFFER(cmdb, UVERBS_OBJECT_DM, UVERBS_METHOD_DM_FREE, 1); + int ret; fill_attr_in_obj(cmdb, UVERBS_ATTR_FREE_DM_HANDLE, dm->handle); - return execute_ioctl(dm->dm.context, cmdb); + ret = execute_ioctl(dm->dm.context, cmdb); + if (verbs_is_destroy_err(&ret)) + return ret; + + return 0; } int ibv_cmd_reg_dm_mr(struct ibv_pd *pd, struct verbs_dm *dm, diff --git a/libibverbs/cmd_flow_action.c b/libibverbs/cmd_flow_action.c index 1782fb7..0bb8149 100644 --- a/libibverbs/cmd_flow_action.c +++ b/libibverbs/cmd_flow_action.c @@ -33,6 +33,7 @@ #include <infiniband/cmd_ioctl.h> #include <rdma/ib_user_ioctl_cmds.h> #include <infiniband/driver.h> +#include <infiniband/cmd_write.h> static void scrub_esp_encap(struct ibv_flow_action_esp_encap *esp_encap) { @@ -120,9 +121,14 @@ int ibv_cmd_destroy_flow_action(struct verbs_flow_action *action) { DECLARE_COMMAND_BUFFER(cmd, UVERBS_OBJECT_FLOW_ACTION, UVERBS_METHOD_FLOW_ACTION_DESTROY, 1); + int ret; fill_attr_in_obj(cmd, UVERBS_ATTR_DESTROY_FLOW_ACTION_HANDLE, action->handle); - return execute_ioctl(action->action.context, cmd); + ret = execute_ioctl(action->action.context, cmd); + if (verbs_is_destroy_err(&ret)) + return ret; + + return 0; } diff --git a/libibverbs/libibverbs.map.in b/libibverbs/libibverbs.map.in index c6a65ad..80ef2a1 100644 --- a/libibverbs/libibverbs.map.in +++ b/libibverbs/libibverbs.map.in @@ -177,6 +177,7 @@ IBVERBS_PRIVATE_@IBVERBS_PABI_VERSION@ { ibv_cmd_resize_cq; ibv_query_gid_type; ibv_register_driver; + verbs_allow_disassociate_destroy; verbs_register_driver_@IBVERBS_PABI_VERSION@; verbs_set_ops; verbs_uninit_context; diff --git a/providers/mlx5/verbs.c b/providers/mlx5/verbs.c index 25f0d5f..82efc4d 100644 --- a/providers/mlx5/verbs.c +++ b/providers/mlx5/verbs.c @@ -50,6 +50,7 @@ #include <util/mmio.h> #include <rdma/ib_user_ioctl_cmds.h> #include <rdma/mlx5_user_ioctl_cmds.h> +#include <infiniband/cmd_write.h> #include "mlx5.h" #include "mlx5-abi.h" @@ -3606,6 +3607,7 @@ int mlx5dv_destroy_flow_matcher(struct mlx5dv_flow_matcher *flow_matcher) fill_attr_in_obj(cmd, MLX5_IB_ATTR_FLOW_MATCHER_DESTROY_HANDLE, flow_matcher->handle); ret = execute_ioctl(flow_matcher->context, cmd); + verbs_is_destroy_err(&ret); if (ret) return ret; -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html