@@ -379,10 +379,9 @@ LATEST_SYMVER_FUNC(ibv_close_device, 1_1, "IBVERBS_1.1",
int,
struct ibv_context *context)
{
- struct verbs_device *verbs_device = verbs_get_device(context->device);
-
- verbs_device->ops->free_context(context);
+ const struct verbs_context_ops *ops = get_ops(context);
+ ops->free_context(context);
return 0;
}
@@ -218,7 +218,6 @@ struct verbs_device_ops {
struct verbs_context *(*alloc_context)(struct ibv_device *device,
int cmd_fd,
void *private_data);
- void (*free_context)(struct ibv_context *context);
struct verbs_device *(*alloc_device)(struct verbs_sysfs_dev *sysfs_dev);
void (*uninit_device)(struct verbs_device *device);
@@ -315,6 +314,7 @@ struct verbs_context_ops {
int (*destroy_wq)(struct ibv_wq *wq);
int (*detach_mcast)(struct ibv_qp *qp, const union ibv_gid *gid,
uint16_t lid);
+ void (*free_context)(struct ibv_context *context);
int (*free_dm)(struct ibv_dm *dm);
int (*get_srq_num)(struct ibv_srq *srq, uint32_t *srq_num);
int (*modify_cq)(struct ibv_cq *cq, struct ibv_modify_cq_attr *attr);
@@ -272,6 +272,11 @@ static int detach_mcast(struct ibv_qp *qp, const union ibv_gid *gid,
return ENOSYS;
}
+static void free_context(struct ibv_context *ctx)
+{
+ return;
+}
+
static int free_dm(struct ibv_dm *dm)
{
return ENOSYS;
@@ -485,6 +490,7 @@ const struct verbs_context_ops verbs_dummy_ops = {
destroy_srq,
destroy_wq,
detach_mcast,
+ free_context,
free_dm,
get_srq_num,
modify_cq,
@@ -600,6 +606,7 @@ void verbs_set_ops(struct verbs_context *vctx,
SET_PRIV_OP(ctx, destroy_srq);
SET_OP(vctx, destroy_wq);
SET_PRIV_OP(ctx, detach_mcast);
+ SET_PRIV_OP_IC(ctx, free_context);
SET_OP(vctx, free_dm);
SET_OP(vctx, get_srq_num);
SET_OP(vctx, modify_cq);
@@ -50,6 +50,8 @@
#include "main.h"
#include "verbs.h"
+static void bnxt_re_free_context(struct ibv_context *ibvctx);
+
#define PCI_VENDOR_ID_BROADCOM 0x14E4
#define CNA(v, d) VERBS_PCI_MATCH(PCI_VENDOR_ID_##v, d, NULL)
@@ -113,7 +115,8 @@ static const struct verbs_context_ops bnxt_re_cntx_ops = {
.post_send = bnxt_re_post_send,
.post_recv = bnxt_re_post_recv,
.create_ah = bnxt_re_create_ah,
- .destroy_ah = bnxt_re_destroy_ah
+ .destroy_ah = bnxt_re_destroy_ah,
+ .free_context = bnxt_re_free_context,
};
bool bnxt_re_is_chip_gen_p5(struct bnxt_re_chip_ctx *cctx)
@@ -218,6 +221,5 @@ static const struct verbs_device_ops bnxt_re_dev_ops = {
.match_table = cna_table,
.alloc_device = bnxt_re_device_alloc,
.alloc_context = bnxt_re_alloc_context,
- .free_context = bnxt_re_free_context,
};
PROVIDER_DRIVER(bnxt_re, bnxt_re_dev_ops);
@@ -43,6 +43,8 @@
#include "libcxgb4.h"
#include "cxgb4-abi.h"
+static void c4iw_free_context(struct ibv_context *ibctx);
+
#define PCI_VENDOR_ID_CHELSIO 0x1425
/*
@@ -96,6 +98,7 @@ static const struct verbs_context_ops c4iw_ctx_common_ops = {
.detach_mcast = c4iw_detach_mcast,
.post_srq_recv = c4iw_post_srq_recv,
.req_notify_cq = c4iw_arm_cq,
+ .free_context = c4iw_free_context,
};
static const struct verbs_context_ops c4iw_ctx_t4_ops = {
@@ -456,7 +459,6 @@ static const struct verbs_device_ops c4iw_dev_ops = {
.alloc_device = c4iw_device_alloc,
.uninit_device = c4iw_uninit_device,
.alloc_context = c4iw_alloc_context,
- .free_context = c4iw_free_context,
};
PROVIDER_DRIVER(cxgb4, c4iw_dev_ops);
@@ -12,6 +12,8 @@
#include "efa.h"
#include "verbs.h"
+static void efa_free_context(struct ibv_context *ibvctx);
+
#define PCI_VENDOR_ID_AMAZON 0x1d0f
static const struct verbs_match_ent efa_table[] = {
@@ -40,6 +42,7 @@ static const struct verbs_context_ops efa_ctx_ops = {
.query_port = efa_query_port,
.query_qp = efa_query_qp,
.reg_mr = efa_reg_mr,
+ .free_context = efa_free_context,
};
static struct verbs_context *efa_alloc_context(struct ibv_device *vdev,
@@ -127,7 +130,6 @@ static const struct verbs_device_ops efa_dev_ops = {
.alloc_device = efa_device_alloc,
.uninit_device = efa_uninit_device,
.alloc_context = efa_alloc_context,
- .free_context = efa_free_context,
};
bool is_efa_dev(struct ibv_device *device)
@@ -65,6 +65,8 @@
#include "hfiverbs.h"
#include "hfi-abi.h"
+static void hfi1_free_context(struct ibv_context *ibctx);
+
#ifndef PCI_VENDOR_ID_INTEL
#define PCI_VENDOR_ID_INTEL 0x8086
#endif
@@ -87,6 +89,7 @@ static const struct verbs_match_ent hca_table[] = {
};
static const struct verbs_context_ops hfi1_ctx_common_ops = {
+ .free_context = hfi1_free_context,
.query_device = hfi1_query_device,
.query_port = hfi1_query_port,
@@ -205,6 +208,5 @@ static const struct verbs_device_ops hfi1_dev_ops = {
.alloc_device = hfi1_device_alloc,
.uninit_device = hf11_uninit_device,
.alloc_context = hfi1_alloc_context,
- .free_context = hfi1_free_context,
};
PROVIDER_DRIVER(hfi1verbs, hfi1_dev_ops);
@@ -40,6 +40,8 @@
#include "hns_roce_u.h"
#include "hns_roce_u_abi.h"
+static void hns_roce_free_context(struct ibv_context *ibctx);
+
#define HID_LEN 15
#define DEV_MATCH_LEN 128
@@ -81,6 +83,7 @@ static const struct verbs_context_ops hns_common_ops = {
.modify_srq = hns_roce_u_modify_srq,
.query_srq = hns_roce_u_query_srq,
.destroy_srq = hns_roce_u_destroy_srq,
+ .free_context = hns_roce_free_context,
};
static struct verbs_context *hns_roce_alloc_context(struct ibv_device *ibdev,
@@ -206,6 +209,5 @@ static const struct verbs_device_ops hns_roce_dev_ops = {
.alloc_device = hns_device_alloc,
.uninit_device = hns_uninit_device,
.alloc_context = hns_roce_alloc_context,
- .free_context = hns_roce_free_context,
};
PROVIDER_DRIVER(hns, hns_roce_dev_ops);
@@ -50,6 +50,8 @@
#include <sys/stat.h>
#include <fcntl.h>
+static void i40iw_ufree_context(struct ibv_context *ibctx);
+
#define INTEL_HCA(v, d) VERBS_PCI_MATCH(v, d, NULL)
static const struct verbs_match_ent hca_table[] = {
VERBS_DRIVER_ID(RDMA_DRIVER_I40IW),
@@ -115,7 +117,8 @@ static const struct verbs_context_ops i40iw_uctx_ops = {
.destroy_ah = i40iw_udestroy_ah,
.attach_mcast = i40iw_uattach_mcast,
.detach_mcast = i40iw_udetach_mcast,
- .async_event = i40iw_async_event
+ .async_event = i40iw_async_event,
+ .free_context = i40iw_ufree_context,
};
/**
@@ -224,6 +227,5 @@ static const struct verbs_device_ops i40iw_udev_ops = {
.alloc_device = i40iw_device_alloc,
.uninit_device = i40iw_uninit_device,
.alloc_context = i40iw_ualloc_context,
- .free_context = i40iw_ufree_context,
};
PROVIDER_DRIVER(i40iw, i40iw_udev_ops);
@@ -45,6 +45,8 @@
#include "ipathverbs.h"
#include "ipath-abi.h"
+static void ipath_free_context(struct ibv_context *ibctx);
+
#ifndef PCI_VENDOR_ID_PATHSCALE
#define PCI_VENDOR_ID_PATHSCALE 0x1fc1
#endif
@@ -86,6 +88,7 @@ static const struct verbs_match_ent hca_table[] = {
};
static const struct verbs_context_ops ipath_ctx_common_ops = {
+ .free_context = ipath_free_context,
.query_device = ipath_query_device,
.query_port = ipath_query_port,
@@ -203,6 +206,5 @@ static const struct verbs_device_ops ipath_dev_ops = {
.alloc_device = ipath_device_alloc,
.uninit_device = ipath_uninit_device,
.alloc_context = ipath_alloc_context,
- .free_context = ipath_free_context,
};
PROVIDER_DRIVER(ipathverbs, ipath_dev_ops);
@@ -43,6 +43,8 @@
#include "mlx4.h"
#include "mlx4-abi.h"
+static void mlx4_free_context(struct ibv_context *ibv_ctx);
+
#ifndef PCI_VENDOR_ID_MELLANOX
#define PCI_VENDOR_ID_MELLANOX 0x15b3
#endif
@@ -131,6 +133,7 @@ static const struct verbs_context_ops mlx4_ctx_ops = {
.open_xrcd = mlx4_open_xrcd,
.query_device_ex = mlx4_query_device_ex,
.query_rt_values = mlx4_query_rt_values,
+ .free_context = mlx4_free_context,
};
static int mlx4_map_internal_clock(struct mlx4_device *mdev,
@@ -302,7 +305,6 @@ static const struct verbs_device_ops mlx4_dev_ops = {
.alloc_device = mlx4_device_alloc,
.uninit_device = mlx4_uninit_device,
.alloc_context = mlx4_alloc_context,
- .free_context = mlx4_free_context,
};
PROVIDER_DRIVER(mlx4, mlx4_dev_ops);
@@ -49,6 +49,8 @@
#include "wqe.h"
#include "mlx5_ifc.h"
+static void mlx5_free_context(struct ibv_context *ibctx);
+
#ifndef PCI_VENDOR_ID_MELLANOX
#define PCI_VENDOR_ID_MELLANOX 0x15b3
#endif
@@ -156,6 +158,7 @@ static const struct verbs_context_ops mlx5_ctx_common_ops = {
.read_counters = mlx5_read_counters,
.reg_dm_mr = mlx5_reg_dm_mr,
.alloc_null_mr = mlx5_alloc_null_mr,
+ .free_context = mlx5_free_context,
};
static const struct verbs_context_ops mlx5_ctx_cqev1_ops = {
@@ -1451,7 +1454,6 @@ static const struct verbs_device_ops mlx5_dev_ops = {
.alloc_device = mlx5_device_alloc,
.uninit_device = mlx5_uninit_device,
.alloc_context = mlx5_alloc_context,
- .free_context = mlx5_free_context,
};
bool is_mlx5_dev(struct ibv_device *device)
@@ -44,6 +44,8 @@
#include "mthca.h"
#include "mthca-abi.h"
+static void mthca_free_context(struct ibv_context *ibctx);
+
#ifndef PCI_VENDOR_ID_MELLANOX
#define PCI_VENDOR_ID_MELLANOX 0x15b3
#endif
@@ -111,7 +113,8 @@ static const struct verbs_context_ops mthca_ctx_common_ops = {
.create_ah = mthca_create_ah,
.destroy_ah = mthca_destroy_ah,
.attach_mcast = ibv_cmd_attach_mcast,
- .detach_mcast = ibv_cmd_detach_mcast
+ .detach_mcast = ibv_cmd_detach_mcast,
+ .free_context = mthca_free_context,
};
static const struct verbs_context_ops mthca_ctx_arbel_ops = {
@@ -237,6 +240,5 @@ static const struct verbs_device_ops mthca_dev_ops = {
.alloc_device = mthca_device_alloc,
.uninit_device = mthca_uninit_device,
.alloc_context = mthca_alloc_context,
- .free_context = mthca_free_context,
};
PROVIDER_DRIVER(mthca, mthca_dev_ops);
@@ -50,6 +50,8 @@
#include <sys/stat.h>
#include <fcntl.h>
+static void ocrdma_free_context(struct ibv_context *ibctx);
+
#define PCI_VENDOR_ID_EMULEX 0x10DF
#define PCI_DEVICE_ID_EMULEX_GEN1 0xe220
#define PCI_DEVICE_ID_EMULEX_GEN2 0x720
@@ -93,7 +95,8 @@ static const struct verbs_context_ops ocrdma_ctx_ops = {
.destroy_srq = ocrdma_destroy_srq,
.post_srq_recv = ocrdma_post_srq_recv,
.attach_mcast = ocrdma_attach_mcast,
- .detach_mcast = ocrdma_detach_mcast
+ .detach_mcast = ocrdma_detach_mcast,
+ .free_context = ocrdma_free_context,
};
static void ocrdma_uninit_device(struct verbs_device *verbs_device)
@@ -194,6 +197,5 @@ static const struct verbs_device_ops ocrdma_dev_ops = {
.alloc_device = ocrdma_device_alloc,
.uninit_device = ocrdma_uninit_device,
.alloc_context = ocrdma_alloc_context,
- .free_context = ocrdma_free_context,
};
PROVIDER_DRIVER(ocrdma, ocrdma_dev_ops);
@@ -48,6 +48,8 @@
#include <sys/stat.h>
#include <fcntl.h>
+static void qelr_free_context(struct ibv_context *ibctx);
+
#define PCI_VENDOR_ID_QLOGIC (0x1077)
#define PCI_DEVICE_ID_QLOGIC_57980S (0x1629)
#define PCI_DEVICE_ID_QLOGIC_57980S_40 (0x1634)
@@ -104,6 +106,7 @@ static const struct verbs_context_ops qelr_ctx_ops = {
.post_send = qelr_post_send,
.post_recv = qelr_post_recv,
.async_event = qelr_async_event,
+ .free_context = qelr_free_context,
};
static void qelr_uninit_device(struct verbs_device *verbs_device)
@@ -249,6 +252,5 @@ static const struct verbs_device_ops qelr_dev_ops = {
.alloc_device = qelr_device_alloc,
.uninit_device = qelr_uninit_device,
.alloc_context = qelr_alloc_context,
- .free_context = qelr_free_context,
};
PROVIDER_DRIVER(qedr, qelr_dev_ops);
@@ -56,6 +56,8 @@
#include "rxe-abi.h"
#include "rxe.h"
+static void rxe_free_context(struct ibv_context *ibctx);
+
static const struct verbs_match_ent hca_table[] = {
VERBS_DRIVER_ID(RDMA_DRIVER_RXE),
VERBS_NAME_MATCH("rxe", NULL),
@@ -856,7 +858,8 @@ static const struct verbs_context_ops rxe_ctx_ops = {
.create_ah = rxe_create_ah,
.destroy_ah = rxe_destroy_ah,
.attach_mcast = ibv_cmd_attach_mcast,
- .detach_mcast = ibv_cmd_detach_mcast
+ .detach_mcast = ibv_cmd_detach_mcast,
+ .free_context = rxe_free_context,
};
static struct verbs_context *rxe_alloc_context(struct ibv_device *ibdev,
@@ -926,6 +929,5 @@ static const struct verbs_device_ops rxe_dev_ops = {
.alloc_device = rxe_device_alloc,
.uninit_device = rxe_uninit_device,
.alloc_context = rxe_alloc_context,
- .free_context = rxe_free_context,
};
PROVIDER_DRIVER(rxe, rxe_dev_ops);
@@ -18,6 +18,7 @@
#include "siw.h"
static const int siw_debug;
+static void siw_free_context(struct ibv_context *ibv_ctx);
static int siw_query_device(struct ibv_context *ctx,
struct ibv_device_attr *attr)
@@ -841,6 +842,7 @@ static const struct verbs_context_ops siw_context_ops = {
.destroy_cq = siw_destroy_cq,
.destroy_qp = siw_destroy_qp,
.destroy_srq = siw_destroy_srq,
+ .free_context = siw_free_context,
.modify_qp = siw_modify_qp,
.modify_srq = siw_modify_srq,
.poll_cq = siw_poll_cq,
@@ -919,7 +921,6 @@ static const struct verbs_device_ops siw_dev_ops = {
.alloc_device = siw_device_alloc,
.uninit_device = siw_device_free,
.alloc_context = siw_alloc_context,
- .free_context = siw_free_context
};
PROVIDER_DRIVER(siw, siw_dev_ops);
@@ -45,6 +45,8 @@
#include "pvrdma.h"
+static void pvrdma_free_context(struct ibv_context *ibctx);
+
/*
* VMware PVRDMA vendor id and PCI device id.
*/
@@ -52,6 +54,7 @@
#define PCI_DEVICE_ID_VMWARE_PVRDMA 0x0820
static const struct verbs_context_ops pvrdma_ctx_ops = {
+ .free_context = pvrdma_free_context,
.query_device = pvrdma_query_device,
.query_port = pvrdma_query_port,
.alloc_pd = pvrdma_alloc_pd,
@@ -208,6 +211,5 @@ static const struct verbs_device_ops pvrdma_dev_ops = {
.alloc_device = pvrdma_device_alloc,
.uninit_device = pvrdma_uninit_device,
.alloc_context = pvrdma_alloc_context,
- .free_context = pvrdma_free_context,
};
PROVIDER_DRIVER(vmw_pvrdma, pvrdma_dev_ops);