@@ -166,9 +166,17 @@ static void iwch_free_context(struct ibv_context *ibctx)
free(context);
}
+static void iwch_uninit_device(struct verbs_device *verbs_device)
+{
+ struct iwch_device *dev = to_iwch_dev(&verbs_device->device);
+
+ free(dev);
+}
+
static struct verbs_device_ops iwch_dev_ops = {
.alloc_context = iwch_alloc_context,
- .free_context = iwch_free_context
+ .free_context = iwch_free_context,
+ .uninit_device = iwch_uninit_device
};
static struct verbs_device *cxgb3_driver_init(const char *uverbs_sys_path,
@@ -220,9 +220,17 @@ static void c4iw_free_context(struct ibv_context *ibctx)
free(context);
}
+static void c4iw_uninit_device(struct verbs_device *verbs_device)
+{
+ struct c4iw_dev *dev = to_c4iw_dev(&verbs_device->device);
+
+ free(dev);
+}
+
static struct verbs_device_ops c4iw_dev_ops = {
.alloc_context = c4iw_alloc_context,
- .free_context = c4iw_free_context
+ .free_context = c4iw_free_context,
+ .uninit_device = c4iw_uninit_device
};
#ifdef STALL_DETECTION
@@ -173,9 +173,17 @@ static void hfi1_free_context(struct ibv_context *ibctx)
free(context);
}
+static void hf11_uninit_device(struct verbs_device *verbs_device)
+{
+ struct hfi1_device *dev = to_idev(&verbs_device->device);
+
+ free(dev);
+}
+
static struct verbs_device_ops hfi1_dev_ops = {
.alloc_context = hfi1_alloc_context,
- .free_context = hfi1_free_context
+ .free_context = hfi1_free_context,
+ .uninit_device = hf11_uninit_device
};
static struct verbs_device *hfi1_driver_init(const char *uverbs_sys_path,
@@ -173,9 +173,17 @@ static void hns_roce_free_context(struct ibv_context *ibctx)
context = NULL;
}
+static void hns_uninit_device(struct verbs_device *verbs_device)
+{
+ struct hns_roce_device *dev = to_hr_dev(&verbs_device->device);
+
+ free(dev);
+}
+
static struct verbs_device_ops hns_roce_dev_ops = {
.alloc_context = hns_roce_alloc_context,
- .free_context = hns_roce_free_context
+ .free_context = hns_roce_free_context,
+ .uninit_device = hns_uninit_device
};
static struct verbs_device *hns_roce_driver_init(const char *uverbs_sys_path,
@@ -208,9 +208,17 @@ static void i40iw_ufree_context(struct ibv_context *ibctx)
free(iwvctx);
}
+static void i40iw_uninit_device(struct verbs_device *verbs_device)
+{
+ struct i40iw_udevice *dev = to_i40iw_udev(&verbs_device->device);
+
+ free(dev);
+}
+
static struct verbs_device_ops i40iw_udev_ops = {
.alloc_context = i40iw_ualloc_context,
- .free_context = i40iw_ufree_context
+ .free_context = i40iw_ufree_context,
+ .uninit_device = i40iw_uninit_device
};
/**
@@ -172,9 +172,17 @@ static void ipath_free_context(struct ibv_context *ibctx)
free(context);
}
+static void ipath_uninit_device(struct verbs_device *verbs_device)
+{
+ struct ipath_device *dev = to_idev(&verbs_device->device);
+
+ free(dev);
+}
+
static struct verbs_device_ops ipath_dev_ops = {
.alloc_context = ipath_alloc_context,
- .free_context = ipath_free_context
+ .free_context = ipath_free_context,
+ .uninit_device = ipath_uninit_device
};
static struct verbs_device *ipath_driver_init(const char *uverbs_sys_path,
@@ -262,9 +262,17 @@ static void mlx4_uninit_context(struct verbs_device *v_device,
to_mdev(&v_device->device)->page_size);
}
+static void mlx4_uninit_device(struct verbs_device *verbs_device)
+{
+ struct mlx4_device *dev = to_mdev(&verbs_device->device);
+
+ free(dev);
+}
+
static struct verbs_device_ops mlx4_dev_ops = {
.init_context = mlx4_init_context,
.uninit_context = mlx4_uninit_context,
+ .uninit_device = mlx4_uninit_device
};
static struct verbs_device *mlx4_driver_init(const char *uverbs_sys_path, int abi_version)
@@ -965,9 +965,17 @@ static void mlx5_cleanup_context(struct verbs_device *device,
close_debug_file(context);
}
+static void mlx5_uninit_device(struct verbs_device *verbs_device)
+{
+ struct mlx5_device *dev = to_mdev(&verbs_device->device);
+
+ free(dev);
+}
+
static struct verbs_device_ops mlx5_dev_ops = {
.init_context = mlx5_init_context,
.uninit_context = mlx5_cleanup_context,
+ .uninit_device = mlx5_uninit_device
};
static struct verbs_device *mlx5_driver_init(const char *uverbs_sys_path,
@@ -209,9 +209,17 @@ static void mthca_free_context(struct ibv_context *ibctx)
free(context);
}
+static void mthca_uninit_device(struct verbs_device *verbs_device)
+{
+ struct mthca_device *dev = to_mdev(&verbs_device->device);
+
+ free(dev);
+}
+
static struct verbs_device_ops mthca_dev_ops = {
.alloc_context = mthca_alloc_context,
- .free_context = mthca_free_context
+ .free_context = mthca_free_context,
+ .uninit_device = mthca_uninit_device
};
static struct verbs_device *mthca_driver_init(const char *uverbs_sys_path,
@@ -184,10 +184,17 @@ static void nes_ufree_context(struct ibv_context *ibctx)
free(nesvctx);
}
+static void nes_uninit_device(struct verbs_device *verbs_device)
+{
+ struct nes_udevice *dev = to_nes_udev(&verbs_device->device);
+
+ free(dev);
+}
static struct verbs_device_ops nes_udev_ops = {
.alloc_context = nes_ualloc_context,
- .free_context = nes_ufree_context
+ .free_context = nes_ufree_context,
+ .uninit_device = nes_uninit_device
};
@@ -103,9 +103,17 @@ static struct ibv_context_ops ocrdma_ctx_ops = {
.detach_mcast = ocrdma_detach_mcast
};
+static void ocrdma_uninit_device(struct verbs_device *verbs_device)
+{
+ struct ocrdma_device *dev = get_ocrdma_dev(&verbs_device->device);
+
+ free(dev);
+}
+
static struct verbs_device_ops ocrdma_dev_ops = {
.alloc_context = ocrdma_alloc_context,
- .free_context = ocrdma_free_context
+ .free_context = ocrdma_free_context,
+ .uninit_device = ocrdma_uninit_device
};
/*
@@ -108,9 +108,17 @@ static struct ibv_context_ops qelr_ctx_ops = {
.async_event = qelr_async_event,
};
+static void qelr_uninit_device(struct verbs_device *verbs_device)
+{
+ struct qelr_device *dev = get_qelr_dev(&verbs_device->device);
+
+ free(dev);
+}
+
static struct verbs_device_ops qelr_dev_ops = {
.alloc_context = qelr_alloc_context,
- .free_context = qelr_free_context
+ .free_context = qelr_free_context,
+ .uninit_device = qelr_uninit_device
};
static void qelr_open_debug_file(struct qelr_devctx *ctx)
@@ -886,9 +886,17 @@ static void rxe_free_context(struct ibv_context *ibctx)
free(context);
}
+static void rxe_uninit_device(struct verbs_device *verbs_device)
+{
+ struct rxe_device *dev = to_rdev(&verbs_device->device);
+
+ free(dev);
+}
+
static struct verbs_device_ops rxe_dev_ops = {
.alloc_context = rxe_alloc_context,
.free_context = rxe_free_context,
+ .uninit_device = rxe_uninit_device
};
static struct verbs_device *rxe_driver_init(const char *uverbs_sys_path,
@@ -162,9 +162,17 @@ static void pvrdma_free_context(struct ibv_context *ibctx)
free(context);
}
+static void pvrdma_uninit_device(struct verbs_device *verbs_device)
+{
+ struct pvrdma_device *dev = to_vdev(&verbs_device->device);
+
+ free(dev);
+}
+
static struct verbs_device_ops pvrdma_dev_ops = {
.alloc_context = pvrdma_alloc_context,
- .free_context = pvrdma_free_context
+ .free_context = pvrdma_free_context,
+ .uninit_device = pvrdma_uninit_device
};
static struct pvrdma_device *pvrdma_driver_init_shared(