All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH rdma-core 0/4] Cleanup ibv_register_driver
@ 2017-02-28 21:31 Jason Gunthorpe
       [not found] ` <1488317497-538-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Jason Gunthorpe @ 2017-02-28 21:31 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA

Now that the provider API is private there is no reason to have two different
ways to register a driver. Consolidate everything into verbs_register_driver.

This approach is simplified by not also forcing a change to the new context
allocation protocol, which is a bit more complex.

The changes to providers are very simple and mechanical. A future series could
eliminate the old context allocation protocol.

https://github.com/linux-rdma/rdma-core/pull/87

Jason Gunthorpe (4):
  ibverbs: Make struct verbs_device and related private
  providers: Make every provider allocate a verbs_device
  providers: Move all verbs_device ops into struct verbs_device_ops
  verbs: Remove ibv_register_driver

 libibverbs/compat-1_0.c            |  4 ++--
 libibverbs/device.c                | 12 ++++++------
 libibverbs/driver.h                | 36 +++++++++++++++++++++++++++++++----
 libibverbs/init.c                  | 39 +++++++++-----------------------------
 libibverbs/verbs.h                 | 27 +++++---------------------
 providers/cxgb3/iwch.c             | 12 ++++++------
 providers/cxgb3/iwch.h             |  2 +-
 providers/cxgb4/dev.c              | 10 +++++-----
 providers/cxgb4/libcxgb4.h         |  2 +-
 providers/hfi1verbs/hfiverbs.c     | 12 ++++++------
 providers/hfi1verbs/hfiverbs.h     |  2 +-
 providers/hns/hns_roce_u.c         | 12 ++++++------
 providers/hns/hns_roce_u.h         |  2 +-
 providers/i40iw/i40iw_umain.c      | 11 ++++++-----
 providers/i40iw/i40iw_umain.h      |  5 +----
 providers/ipathverbs/ipathverbs.c  | 12 ++++++------
 providers/ipathverbs/ipathverbs.h  |  2 +-
 providers/mlx4/mlx4.c              |  9 ++++++---
 providers/mlx5/mlx5.c              |  9 +++++++--
 providers/mthca/mthca.c            | 10 +++++-----
 providers/mthca/mthca.h            |  2 +-
 providers/nes/nes_umain.c          | 11 ++++++-----
 providers/nes/nes_umain.h          |  5 +----
 providers/ocrdma/ocrdma_main.c     | 14 +++++++-------
 providers/ocrdma/ocrdma_main.h     |  4 +---
 providers/qedr/qelr.h              |  2 +-
 providers/qedr/qelr_main.c         | 14 ++++++--------
 providers/qedr/qelr_main.h         |  2 --
 providers/rxe/rxe.c                | 12 ++++++------
 providers/rxe/rxe.h                |  2 +-
 providers/vmw_pvrdma/pvrdma.h      |  2 +-
 providers/vmw_pvrdma/pvrdma_main.c | 12 ++++++------
 32 files changed, 150 insertions(+), 162 deletions(-)

-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH rdma-core 1/4] ibverbs: Make struct verbs_device and related private
       [not found] ` <1488317497-538-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
@ 2017-02-28 21:31   ` Jason Gunthorpe
  2017-02-28 21:31   ` [PATCH rdma-core 2/4] providers: Make every provider allocate a verbs_device Jason Gunthorpe
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Jason Gunthorpe @ 2017-02-28 21:31 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA

Nothing can be using this publicly, no sense in publishing it.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 libibverbs/driver.h | 19 +++++++++++++++++++
 libibverbs/verbs.h  | 18 ------------------
 2 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/libibverbs/driver.h b/libibverbs/driver.h
index 5d29b14036635b..96f4903d19670a 100644
--- a/libibverbs/driver.h
+++ b/libibverbs/driver.h
@@ -96,6 +96,25 @@ struct verbs_qp {
 	uint32_t		comp_mask;
 	struct verbs_xrcd       *xrcd;
 };
+
+/* Must change the PRIVATE IBVERBS_PRIVATE_ symbol if this is changed */
+struct verbs_device {
+	struct ibv_device device; /* Must be first */
+	size_t	sz;
+	size_t	size_of_context;
+	int	(*init_context)(struct verbs_device *device,
+				struct ibv_context *ctx, int cmd_fd);
+	void	(*uninit_context)(struct verbs_device *device,
+				struct ibv_context *ctx);
+};
+
+static inline struct verbs_device *verbs_get_device(
+					const struct ibv_device *dev)
+{
+	return (dev->ops.alloc_context) ?
+		NULL : container_of(dev, struct verbs_device, device);
+}
+
 typedef struct ibv_device *(*ibv_driver_init_func)(const char *uverbs_sys_path,
 						   int abi_version);
 typedef struct verbs_device *(*verbs_driver_init_func)(const char *uverbs_sys_path,
diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
index 7b8377bbd7bf62..a6c541b8020685 100644
--- a/libibverbs/verbs.h
+++ b/libibverbs/verbs.h
@@ -1328,17 +1328,6 @@ struct ibv_device {
 	char			ibdev_path[IBV_SYSFS_PATH_MAX];
 };
 
-struct verbs_device {
-	struct ibv_device device; /* Must be first */
-	size_t	sz;
-	size_t	size_of_context;
-	int	(*init_context)(struct verbs_device *device,
-				struct ibv_context *ctx, int cmd_fd);
-	void	(*uninit_context)(struct verbs_device *device,
-				struct ibv_context *ctx);
-	/* future fields added here */
-};
-
 struct ibv_context_ops {
 	int			(*query_device)(struct ibv_context *context,
 					      struct ibv_device_attr *device_attr);
@@ -1515,13 +1504,6 @@ static inline struct verbs_context *verbs_get_ctx(struct ibv_context *ctx)
 	if (vctx && (vctx->sz >= sizeof(*vctx) - offsetof(struct verbs_context, op))) \
 		vctx->op = ptr; })
 
-static inline struct verbs_device *verbs_get_device(
-					const struct ibv_device *dev)
-{
-	return (dev->ops.alloc_context) ?
-		NULL : container_of(dev, struct verbs_device, device);
-}
-
 /**
  * ibv_get_device_list - Get list of IB devices currently available
  * @num_devices: optional.  if non-NULL, set to the number of devices
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH rdma-core 2/4] providers: Make every provider allocate a verbs_device
       [not found] ` <1488317497-538-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  2017-02-28 21:31   ` [PATCH rdma-core 1/4] ibverbs: Make struct verbs_device and related private Jason Gunthorpe
@ 2017-02-28 21:31   ` Jason Gunthorpe
       [not found]     ` <1488317497-538-3-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  2017-02-28 21:31   ` [PATCH rdma-core 3/4] providers: Move all verbs_device ops into struct verbs_device_ops Jason Gunthorpe
  2017-02-28 21:31   ` [PATCH rdma-core 4/4] verbs: Remove ibv_register_driver Jason Gunthorpe
  3 siblings, 1 reply; 6+ messages in thread
From: Jason Gunthorpe @ 2017-02-28 21:31 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA

Switch struct ibv_device to verbs_device in the provider specific device
structure and use calloc to allocate it so the unset bytes are zero.

This lets us change the return type of ibv_driver_init_func to
struct verbs_device without changing the control flow at all.

Also make a few _init functions static for consistency/simplicity.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 libibverbs/driver.h                |  4 ++--
 libibverbs/init.c                  |  5 +++--
 providers/cxgb3/iwch.c             |  8 ++++----
 providers/cxgb3/iwch.h             |  2 +-
 providers/cxgb4/dev.c              |  6 +++---
 providers/cxgb4/libcxgb4.h         |  2 +-
 providers/hfi1verbs/hfiverbs.c     |  8 ++++----
 providers/hfi1verbs/hfiverbs.h     |  2 +-
 providers/hns/hns_roce_u.c         |  8 ++++----
 providers/hns/hns_roce_u.h         |  2 +-
 providers/i40iw/i40iw_umain.c      |  7 ++++---
 providers/i40iw/i40iw_umain.h      |  5 +----
 providers/ipathverbs/ipathverbs.c  |  8 ++++----
 providers/ipathverbs/ipathverbs.h  |  2 +-
 providers/mthca/mthca.c            |  6 +++---
 providers/mthca/mthca.h            |  2 +-
 providers/nes/nes_umain.c          |  7 ++++---
 providers/nes/nes_umain.h          |  5 +----
 providers/ocrdma/ocrdma_main.c     | 10 +++++-----
 providers/ocrdma/ocrdma_main.h     |  4 +---
 providers/qedr/qelr.h              |  2 +-
 providers/qedr/qelr_main.c         | 10 ++++------
 providers/qedr/qelr_main.h         |  2 --
 providers/rxe/rxe.c                |  8 ++++----
 providers/rxe/rxe.h                |  2 +-
 providers/vmw_pvrdma/pvrdma.h      |  2 +-
 providers/vmw_pvrdma/pvrdma_main.c |  8 ++++----
 27 files changed, 64 insertions(+), 73 deletions(-)

diff --git a/libibverbs/driver.h b/libibverbs/driver.h
index 96f4903d19670a..9e7f02ca30190c 100644
--- a/libibverbs/driver.h
+++ b/libibverbs/driver.h
@@ -115,8 +115,8 @@ static inline struct verbs_device *verbs_get_device(
 		NULL : container_of(dev, struct verbs_device, device);
 }
 
-typedef struct ibv_device *(*ibv_driver_init_func)(const char *uverbs_sys_path,
-						   int abi_version);
+typedef struct verbs_device *(*ibv_driver_init_func)(const char *uverbs_sys_path,
+						     int abi_version);
 typedef struct verbs_device *(*verbs_driver_init_func)(const char *uverbs_sys_path,
 						       int abi_version);
 
diff --git a/libibverbs/init.c b/libibverbs/init.c
index 6eb6a2082bae3c..11c2a587abf745 100644
--- a/libibverbs/init.c
+++ b/libibverbs/init.c
@@ -384,9 +384,10 @@ static struct ibv_device *try_driver(struct ibv_driver *driver,
 	char value[16];
 
 	if (driver->init_func) {
-		dev = driver->init_func(sysfs_dev->sysfs_path, sysfs_dev->abi_ver);
-		if (!dev)
+		vdev = driver->init_func(sysfs_dev->sysfs_path, sysfs_dev->abi_ver);
+		if (!vdev)
 			return NULL;
+		dev = &vdev->device;
 	} else {
 		vdev = driver->verbs_init_func(sysfs_dev->sysfs_path, sysfs_dev->abi_ver);
 		if (!vdev)
diff --git a/providers/cxgb3/iwch.c b/providers/cxgb3/iwch.c
index a03bced9eeaf61..6e60949f39dcc1 100644
--- a/providers/cxgb3/iwch.c
+++ b/providers/cxgb3/iwch.c
@@ -171,8 +171,8 @@ static struct ibv_device_ops iwch_dev_ops = {
 	.free_context = iwch_free_context
 };
 
-static struct ibv_device *cxgb3_driver_init(const char *uverbs_sys_path,
-					    int abi_version)
+static struct verbs_device *cxgb3_driver_init(const char *uverbs_sys_path,
+					      int abi_version)
 {
 	char devstr[IBV_SYSFS_PATH_MAX], ibdev[16], value[32], *cp;
 	struct iwch_device *dev;
@@ -245,13 +245,13 @@ found:
 	PDBG("%s found vendor %d device %d type %d\n", 
 	     __FUNCTION__, vendor, device, hca_table[i].type);
 
-	dev = malloc(sizeof *dev);
+	dev = calloc(1, sizeof(*dev));
 	if (!dev) {
 		return NULL;
 	}
 
 	pthread_spin_init(&dev->lock, PTHREAD_PROCESS_PRIVATE);
-	dev->ibv_dev.ops = iwch_dev_ops;
+	dev->ibv_dev.device.ops = iwch_dev_ops;
 	dev->hca_type = hca_table[i].type;
 	dev->abi_version = abi_version;
 
diff --git a/providers/cxgb3/iwch.h b/providers/cxgb3/iwch.h
index 9ea58b73036f43..ba6e610cbca7ac 100644
--- a/providers/cxgb3/iwch.h
+++ b/providers/cxgb3/iwch.h
@@ -51,7 +51,7 @@ struct iwch_mr;
 #define ABI_VERS 1
 
 struct iwch_device {
-	struct ibv_device ibv_dev;
+	struct verbs_device ibv_dev;
 	enum iwch_hca_type hca_type;
 	struct iwch_mr **mmid2ptr;
 	struct iwch_qp **qpid2ptr;
diff --git a/providers/cxgb4/dev.c b/providers/cxgb4/dev.c
index b0233de0dd40c4..ec7fa53de50a89 100644
--- a/providers/cxgb4/dev.c
+++ b/providers/cxgb4/dev.c
@@ -397,8 +397,8 @@ void dump_state(void)
  */
 int c4iw_abi_version = 1;
 
-static struct ibv_device *cxgb4_driver_init(const char *uverbs_sys_path,
-					    int abi_version)
+static struct verbs_device *cxgb4_driver_init(const char *uverbs_sys_path,
+					      int abi_version)
 {
 	char devstr[IBV_SYSFS_PATH_MAX], ibdev[16], value[32], *cp;
 	struct c4iw_dev *dev;
@@ -470,7 +470,7 @@ found:
 	}
 
 	pthread_spin_init(&dev->lock, PTHREAD_PROCESS_PRIVATE);
-	dev->ibv_dev.ops = c4iw_dev_ops;
+	dev->ibv_dev.device.ops = c4iw_dev_ops;
 	dev->chip_version = CHELSIO_CHIP_VERSION(hca_table[i].device >> 8);
 	dev->abi_version = abi_version;
 	list_node_init(&dev->list);
diff --git a/providers/cxgb4/libcxgb4.h b/providers/cxgb4/libcxgb4.h
index b64b33564c76e5..e7d13c5ec58f94 100644
--- a/providers/cxgb4/libcxgb4.h
+++ b/providers/cxgb4/libcxgb4.h
@@ -51,7 +51,7 @@ extern unsigned long c4iw_page_mask;
 struct c4iw_mr;
 
 struct c4iw_dev {
-	struct ibv_device ibv_dev;
+	struct verbs_device ibv_dev;
 	unsigned chip_version;
 	int max_mr;
 	struct c4iw_mr **mmid2ptr;
diff --git a/providers/hfi1verbs/hfiverbs.c b/providers/hfi1verbs/hfiverbs.c
index 760534797b5724..e8e777e833d0a3 100644
--- a/providers/hfi1verbs/hfiverbs.c
+++ b/providers/hfi1verbs/hfiverbs.c
@@ -178,8 +178,8 @@ static struct ibv_device_ops hfi1_dev_ops = {
 	.free_context	= hfi1_free_context
 };
 
-static struct ibv_device *hfi1_driver_init(const char *uverbs_sys_path,
-					    int abi_version)
+static struct verbs_device *hfi1_driver_init(const char *uverbs_sys_path,
+					     int abi_version)
 {
 	char			value[8];
 	struct hfi1_device    *dev;
@@ -204,14 +204,14 @@ static struct ibv_device *hfi1_driver_init(const char *uverbs_sys_path,
 	return NULL;
 
 found:
-	dev = malloc(sizeof *dev);
+	dev = calloc(1, sizeof(*dev));
 	if (!dev) {
 		fprintf(stderr, PFX "Fatal: couldn't allocate device for %s\n",
 			uverbs_sys_path);
 		return NULL;
 	}
 
-	dev->ibv_dev.ops = hfi1_dev_ops;
+	dev->ibv_dev.device.ops = hfi1_dev_ops;
 	dev->abi_version = abi_version;
 
 	return &dev->ibv_dev;
diff --git a/providers/hfi1verbs/hfiverbs.h b/providers/hfi1verbs/hfiverbs.h
index 194db8350dac6f..456d36872df8a8 100644
--- a/providers/hfi1verbs/hfiverbs.h
+++ b/providers/hfi1verbs/hfiverbs.h
@@ -69,7 +69,7 @@
 #define PFX		"hfi1: "
 
 struct hfi1_device {
-	struct ibv_device	ibv_dev;
+	struct verbs_device	ibv_dev;
 	int			abi_version;
 };
 
diff --git a/providers/hns/hns_roce_u.c b/providers/hns/hns_roce_u.c
index 281f9f408a161d..fe13e3b940e76f 100644
--- a/providers/hns/hns_roce_u.c
+++ b/providers/hns/hns_roce_u.c
@@ -178,8 +178,8 @@ static struct ibv_device_ops hns_roce_dev_ops = {
 	.free_context	= hns_roce_free_context
 };
 
-static struct ibv_device *hns_roce_driver_init(const char *uverbs_sys_path,
-					       int abi_version)
+static struct verbs_device *hns_roce_driver_init(const char *uverbs_sys_path,
+						 int abi_version)
 {
 	struct hns_roce_device  *dev;
 	char			 value[128];
@@ -208,14 +208,14 @@ static struct ibv_device *hns_roce_driver_init(const char *uverbs_sys_path,
 	return NULL;
 
 found:
-	dev = malloc(sizeof(struct hns_roce_device));
+	dev = calloc(1, sizeof(*dev));
 	if (!dev) {
 		fprintf(stderr, PFX "Fatal: couldn't allocate device for %s\n",
 			uverbs_sys_path);
 		return NULL;
 	}
 
-	dev->ibv_dev.ops = hns_roce_dev_ops;
+	dev->ibv_dev.device.ops = hns_roce_dev_ops;
 	dev->u_hw = (struct hns_roce_u_hw *)u_hw;
 	dev->hw_version = hw_version;
 	dev->page_size   = sysconf(_SC_PAGESIZE);
diff --git a/providers/hns/hns_roce_u.h b/providers/hns/hns_roce_u.h
index cb2f26060711dd..dc8956af4f8fae 100644
--- a/providers/hns/hns_roce_u.h
+++ b/providers/hns/hns_roce_u.h
@@ -80,7 +80,7 @@ enum {
 };
 
 struct hns_roce_device {
-	struct ibv_device		ibv_dev;
+	struct verbs_device		ibv_dev;
 	int				page_size;
 	struct hns_roce_u_hw		*u_hw;
 	int				hw_version;
diff --git a/providers/i40iw/i40iw_umain.c b/providers/i40iw/i40iw_umain.c
index a1e98aca11f125..69493b56dbbdb1 100644
--- a/providers/i40iw/i40iw_umain.c
+++ b/providers/i40iw/i40iw_umain.c
@@ -218,7 +218,8 @@ static struct ibv_device_ops i40iw_udev_ops = {
  * @uverbs_sys_path: sys path
  * @abi_version: not used
  */
-struct ibv_device *i40iw_driver_init(const char *uverbs_sys_path, int abi_version)
+static struct verbs_device *i40iw_driver_init(const char *uverbs_sys_path,
+					      int abi_version)
 {
 	char value[16];
 	struct i40iw_udevice *dev;
@@ -241,13 +242,13 @@ struct ibv_device *i40iw_driver_init(const char *uverbs_sys_path, int abi_versio
 
 	return NULL;
 found:
-	dev = malloc(sizeof(*dev));
+	dev = calloc(1, sizeof(*dev));
 	if (!dev) {
 		fprintf(stderr, PFX "%s: failed to allocate memory for device object\n", __func__);
 		return NULL;
 	}
 
-	dev->ibv_dev.ops = i40iw_udev_ops;
+	dev->ibv_dev.device.ops = i40iw_udev_ops;
 	dev->hca_type = hca_table[i].type;
 	dev->page_size = I40IW_HW_PAGE_SIZE;
 	return &dev->ibv_dev;
diff --git a/providers/i40iw/i40iw_umain.h b/providers/i40iw/i40iw_umain.h
index 1f86c8f90b10d9..d70ed657ebc0df 100644
--- a/providers/i40iw/i40iw_umain.h
+++ b/providers/i40iw/i40iw_umain.h
@@ -69,7 +69,7 @@ enum i40iw_uhca_type {
 };
 
 struct i40iw_udevice {
-	struct ibv_device ibv_dev;
+	struct verbs_device ibv_dev;
 	enum i40iw_uhca_type hca_type;
 	int page_size;
 };
@@ -156,9 +156,6 @@ static inline struct i40iw_uqp *to_i40iw_uqp(struct ibv_qp *ibqp)
 	return to_i40iw_uxxx(qp, qp);
 }
 
-/* i40iw_umain.c */
-struct ibv_device *i40iw_driver_init(const char *, int);
-
 /* i40iw_uverbs.c */
 int i40iw_uquery_device(struct ibv_context *, struct ibv_device_attr *);
 int i40iw_uquery_port(struct ibv_context *, uint8_t, struct ibv_port_attr *);
diff --git a/providers/ipathverbs/ipathverbs.c b/providers/ipathverbs/ipathverbs.c
index e953864e79f37e..c45675735c10b9 100644
--- a/providers/ipathverbs/ipathverbs.c
+++ b/providers/ipathverbs/ipathverbs.c
@@ -177,8 +177,8 @@ static struct ibv_device_ops ipath_dev_ops = {
 	.free_context	= ipath_free_context
 };
 
-static struct ibv_device *ipath_driver_init(const char *uverbs_sys_path,
-					    int abi_version)
+static struct verbs_device *ipath_driver_init(const char *uverbs_sys_path,
+					      int abi_version)
 {
 	char			value[8];
 	struct ipath_device    *dev;
@@ -203,14 +203,14 @@ static struct ibv_device *ipath_driver_init(const char *uverbs_sys_path,
 	return NULL;
 
 found:
-	dev = malloc(sizeof *dev);
+	dev = calloc(1, sizeof(*dev));
 	if (!dev) {
 		fprintf(stderr, PFX "Fatal: couldn't allocate device for %s\n",
 			uverbs_sys_path);
 		return NULL;
 	}
 
-	dev->ibv_dev.ops = ipath_dev_ops;
+	dev->ibv_dev.device.ops = ipath_dev_ops;
 	dev->abi_version = abi_version;
 
 	return &dev->ibv_dev;
diff --git a/providers/ipathverbs/ipathverbs.h b/providers/ipathverbs/ipathverbs.h
index b036c69a4158b3..13acec2466f607 100644
--- a/providers/ipathverbs/ipathverbs.h
+++ b/providers/ipathverbs/ipathverbs.h
@@ -49,7 +49,7 @@
 #define PFX		"ipath: "
 
 struct ipath_device {
-	struct ibv_device	ibv_dev;
+	struct verbs_device	ibv_dev;
 	int			abi_version;
 };
 
diff --git a/providers/mthca/mthca.c b/providers/mthca/mthca.c
index 4103a3a8ca629d..9dbd6610f1e61f 100644
--- a/providers/mthca/mthca.c
+++ b/providers/mthca/mthca.c
@@ -214,7 +214,7 @@ static struct ibv_device_ops mthca_dev_ops = {
 	.free_context  = mthca_free_context
 };
 
-static struct ibv_device *mthca_driver_init(const char *uverbs_sys_path,
+static struct verbs_device *mthca_driver_init(const char *uverbs_sys_path,
 					    int abi_version)
 {
 	char			value[8];
@@ -246,14 +246,14 @@ found:
 		return NULL;
 	}
 
-	dev = malloc(sizeof *dev);
+	dev = calloc(1, sizeof(*dev));
 	if (!dev) {
 		fprintf(stderr, PFX "Fatal: couldn't allocate device for %s\n",
 			uverbs_sys_path);
 		return NULL;
 	}
 
-	dev->ibv_dev.ops = mthca_dev_ops;
+	dev->ibv_dev.device.ops = mthca_dev_ops;
 	dev->hca_type    = hca_table[i].type;
 	dev->page_size   = sysconf(_SC_PAGESIZE);
 
diff --git a/providers/mthca/mthca.h b/providers/mthca/mthca.h
index 61ee92807fcb86..d456e6a50c889f 100644
--- a/providers/mthca/mthca.h
+++ b/providers/mthca/mthca.h
@@ -89,7 +89,7 @@ enum {
 struct mthca_ah_page;
 
 struct mthca_device {
-	struct ibv_device   ibv_dev;
+	struct verbs_device ibv_dev;
 	enum mthca_hca_type hca_type;
 	int                 page_size;
 };
diff --git a/providers/nes/nes_umain.c b/providers/nes/nes_umain.c
index 4b19dd7829cbe6..b166c0916e4ce9 100644
--- a/providers/nes/nes_umain.c
+++ b/providers/nes/nes_umain.c
@@ -194,7 +194,8 @@ static struct ibv_device_ops nes_udev_ops = {
 /**
  * nes_driver_init
  */
-struct ibv_device *nes_driver_init(const char *uverbs_sys_path, int abi_version)
+static struct verbs_device *nes_driver_init(const char *uverbs_sys_path,
+					    int abi_version)
 {
 	char value[16];
 	struct nes_udevice *dev;
@@ -229,13 +230,13 @@ found:
 			sscanf(value, "%u", &nes_debug_level);
 	}
 
-	dev = malloc(sizeof *dev);
+	dev = calloc(1, sizeof(*dev));
 	if (!dev) {
 		nes_debug(NES_DBG_INIT, "Fatal: couldn't allocate device for libnes\n");
 		return NULL;
 	}
 
-	dev->ibv_dev.ops = nes_udev_ops;
+	dev->ibv_dev.device.ops = nes_udev_ops;
 	dev->hca_type = hca_table[i].type;
 	dev->page_size = sysconf(_SC_PAGESIZE);
 
diff --git a/providers/nes/nes_umain.h b/providers/nes/nes_umain.h
index 6a4366802db209..5676c377357d12 100644
--- a/providers/nes/nes_umain.h
+++ b/providers/nes/nes_umain.h
@@ -248,7 +248,7 @@ struct nes_user_doorbell {
 };
 
 struct nes_udevice {
-	struct ibv_device ibv_dev;
+	struct verbs_device ibv_dev;
 	enum nes_uhca_type hca_type;
 	int page_size;
 };
@@ -351,9 +351,6 @@ static inline struct nes_uqp *to_nes_uqp(struct ibv_qp *ibqp)
 }
 
 
-/* nes_umain.c */
-struct ibv_device *nes_driver_init(const char *, int);
-
 /* nes_uverbs.c */
 int nes_uquery_device(struct ibv_context *, struct ibv_device_attr *);
 int nes_uquery_port(struct ibv_context *, uint8_t, struct ibv_port_attr *);
diff --git a/providers/ocrdma/ocrdma_main.c b/providers/ocrdma/ocrdma_main.c
index dfd3172841255b..8dad5ffe17694d 100644
--- a/providers/ocrdma/ocrdma_main.c
+++ b/providers/ocrdma/ocrdma_main.c
@@ -172,8 +172,8 @@ static void ocrdma_free_context(struct ibv_context *ibctx)
 /**
  * ocrdma_driver_init
  */
-struct ibv_device *ocrdma_driver_init(const char *uverbs_sys_path,
-				      int abi_version)
+static struct verbs_device *ocrdma_driver_init(const char *uverbs_sys_path,
+					       int abi_version)
 {
 
 	char value[16];
@@ -207,20 +207,20 @@ found:
 		return NULL;
 	}
 
-	dev = malloc(sizeof *dev);
+	dev = calloc(1, sizeof(*dev));
 	if (!dev) {
 		ocrdma_err("%s() Fatal: fail allocate device for libocrdma\n",
 			   __func__);
 		return NULL;
 	}
-	bzero(dev, sizeof *dev);
+
 	dev->qp_tbl = malloc(OCRDMA_MAX_QP * sizeof(struct ocrdma_qp *));
 	if (!dev->qp_tbl)
 		goto qp_err;
 	bzero(dev->qp_tbl, OCRDMA_MAX_QP * sizeof(struct ocrdma_qp *));
 	pthread_mutex_init(&dev->dev_lock, NULL);
 	pthread_spin_init(&dev->flush_q_lock, PTHREAD_PROCESS_PRIVATE);
-	dev->ibv_dev.ops = ocrdma_dev_ops;
+	dev->ibv_dev.device.ops = ocrdma_dev_ops;
 	list_node_init(&dev->entry);
 	pthread_mutex_lock(&ocrdma_dev_list_lock);
 	list_add_tail(&ocrdma_dev_list, &dev->entry);
diff --git a/providers/ocrdma/ocrdma_main.h b/providers/ocrdma/ocrdma_main.h
index 6c74545d08df2d..b2b27abdcabfd1 100644
--- a/providers/ocrdma/ocrdma_main.h
+++ b/providers/ocrdma/ocrdma_main.h
@@ -54,7 +54,7 @@
 struct ocrdma_qp;
 
 struct ocrdma_device {
-	struct ibv_device ibv_dev;
+	struct verbs_device ibv_dev;
 	struct ocrdma_qp **qp_tbl;
 	pthread_mutex_t dev_lock;
 	pthread_spinlock_t flush_q_lock;
@@ -266,8 +266,6 @@ static inline struct ocrdma_ah *get_ocrdma_ah(struct ibv_ah *ibah)
 	return get_ocrdma_xxx(ah, ah);
 }
 
-struct ibv_device *ocrdma_driver_init(const char *, int);
-
 void ocrdma_init_ahid_tbl(struct ocrdma_devctx *ctx);
 int ocrdma_query_device(struct ibv_context *, struct ibv_device_attr *);
 int ocrdma_query_port(struct ibv_context *, uint8_t, struct ibv_port_attr *);
diff --git a/providers/qedr/qelr.h b/providers/qedr/qelr.h
index e887d9f8e4713a..426bba6ec019e7 100644
--- a/providers/qedr/qelr.h
+++ b/providers/qedr/qelr.h
@@ -112,7 +112,7 @@ struct qelr_buf {
 };
 
 struct qelr_device {
-	struct ibv_device ibv_dev;
+	struct verbs_device ibv_dev;
 };
 
 struct qelr_devctx {
diff --git a/providers/qedr/qelr_main.c b/providers/qedr/qelr_main.c
index 0378d2c37944db..ef192c533de350 100644
--- a/providers/qedr/qelr_main.c
+++ b/providers/qedr/qelr_main.c
@@ -231,8 +231,8 @@ static void qelr_free_context(struct ibv_context *ibctx)
 	free(ctx);
 }
 
-struct ibv_device *qelr_driver_init(const char *uverbs_sys_path,
-				    int abi_version)
+static struct verbs_device *qelr_driver_init(const char *uverbs_sys_path,
+					     int abi_version)
 {
 	char value[16];
 	struct qelr_device *dev;
@@ -265,16 +265,14 @@ found:
 		return NULL;
 	}
 
-	dev = malloc(sizeof(*dev));
+	dev = calloc(1, sizeof(*dev));
 	if (!dev) {
 		qelr_err("%s() Fatal: fail allocate device for libqedr\n",
 			 __func__);
 		return NULL;
 	}
 
-	bzero(dev, sizeof(*dev));
-
-	dev->ibv_dev.ops = qelr_dev_ops;
+	dev->ibv_dev.device.ops = qelr_dev_ops;
 
 	return &dev->ibv_dev;
 }
diff --git a/providers/qedr/qelr_main.h b/providers/qedr/qelr_main.h
index 88d52b7aed2b66..f0b16d9804363e 100644
--- a/providers/qedr/qelr_main.h
+++ b/providers/qedr/qelr_main.h
@@ -40,8 +40,6 @@
 #include <infiniband/driver.h>
 #include <util/udma_barrier.h>
 
-struct ibv_device *qelr_driver_init(const char *, int);
-
 int qelr_query_device(struct ibv_context *, struct ibv_device_attr *);
 int qelr_query_port(struct ibv_context *, uint8_t, struct ibv_port_attr *);
 
diff --git a/providers/rxe/rxe.c b/providers/rxe/rxe.c
index 7fcd754b8058c1..fba3bc719cd45a 100644
--- a/providers/rxe/rxe.c
+++ b/providers/rxe/rxe.c
@@ -891,8 +891,8 @@ static struct ibv_device_ops rxe_dev_ops = {
 	.free_context = rxe_free_context,
 };
 
-static struct ibv_device *rxe_driver_init(const char *uverbs_sys_path,
-					  int abi_version)
+static struct verbs_device *rxe_driver_init(const char *uverbs_sys_path,
+					    int abi_version)
 {
 	struct rxe_device *dev;
 	char value[16];
@@ -905,7 +905,7 @@ static struct ibv_device *rxe_driver_init(const char *uverbs_sys_path,
 	if (strncmp(value, "rxe", 3))
 		return NULL;
 
-	dev = malloc(sizeof *dev);
+	dev = calloc(1, sizeof(*dev));
 	if (!dev) {
 		fprintf(stderr,
 			"rxe: Fatal: couldn't allocate device for %s\n",
@@ -913,7 +913,7 @@ static struct ibv_device *rxe_driver_init(const char *uverbs_sys_path,
 		return NULL;
 	}
 
-	dev->ibv_dev.ops = rxe_dev_ops;
+	dev->ibv_dev.device.ops = rxe_dev_ops;
 	dev->abi_version = abi_version;
 
 	return &dev->ibv_dev;
diff --git a/providers/rxe/rxe.h b/providers/rxe/rxe.h
index 0a67a810d7ceed..fbf18b26f3e19a 100644
--- a/providers/rxe/rxe.h
+++ b/providers/rxe/rxe.h
@@ -43,7 +43,7 @@ enum rdma_network_type {
 };
 
 struct rxe_device {
-	struct ibv_device	ibv_dev;
+	struct verbs_device	ibv_dev;
 	int	abi_version;
 };
 
diff --git a/providers/vmw_pvrdma/pvrdma.h b/providers/vmw_pvrdma/pvrdma.h
index 29c99912d1d304..a5a34e845ad66b 100644
--- a/providers/vmw_pvrdma/pvrdma.h
+++ b/providers/vmw_pvrdma/pvrdma.h
@@ -110,7 +110,7 @@ enum {
 };
 
 struct pvrdma_device {
-	struct ibv_device		ibv_dev;
+	struct verbs_device		ibv_dev;
 	int				page_size;
 	int				abi_version;
 };
diff --git a/providers/vmw_pvrdma/pvrdma_main.c b/providers/vmw_pvrdma/pvrdma_main.c
index 7190efaf086af5..a518cacba79da3 100644
--- a/providers/vmw_pvrdma/pvrdma_main.c
+++ b/providers/vmw_pvrdma/pvrdma_main.c
@@ -198,7 +198,7 @@ static struct pvrdma_device *pvrdma_driver_init_shared(
 		return NULL;
 	}
 
-	dev = malloc(sizeof(*dev));
+	dev = calloc(1, sizeof(*dev));
 	if (!dev) {
 		fprintf(stderr, PFX "couldn't allocate device for %s\n",
 			uverbs_sys_path);
@@ -207,13 +207,13 @@ static struct pvrdma_device *pvrdma_driver_init_shared(
 
 	dev->abi_version = abi_version;
 	dev->page_size   = sysconf(_SC_PAGESIZE);
-	dev->ibv_dev.ops = pvrdma_dev_ops;
+	dev->ibv_dev.device.ops = pvrdma_dev_ops;
 
 	return dev;
 }
 
-static struct ibv_device *pvrdma_driver_init(const char *uverbs_sys_path,
-					     int abi_version)
+static struct verbs_device *pvrdma_driver_init(const char *uverbs_sys_path,
+					       int abi_version)
 {
 	struct pvrdma_device *dev = pvrdma_driver_init_shared(uverbs_sys_path,
 							      abi_version);
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH rdma-core 3/4] providers: Move all verbs_device ops into struct verbs_device_ops
       [not found] ` <1488317497-538-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
  2017-02-28 21:31   ` [PATCH rdma-core 1/4] ibverbs: Make struct verbs_device and related private Jason Gunthorpe
  2017-02-28 21:31   ` [PATCH rdma-core 2/4] providers: Make every provider allocate a verbs_device Jason Gunthorpe
@ 2017-02-28 21:31   ` Jason Gunthorpe
  2017-02-28 21:31   ` [PATCH rdma-core 4/4] verbs: Remove ibv_register_driver Jason Gunthorpe
  3 siblings, 0 replies; 6+ messages in thread
From: Jason Gunthorpe @ 2017-02-28 21:31 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA

This makes the ibv_device->ops stuff unused, so delete those
public names to prevent anyone from using it.

Drivers that use ibv_register_driver just get some simple renames,
drivers that used verbs_register_driver get their ops structure back,
using the new context API pointers.

This makes further extension of the drivers ops really easy and
clear. We can use this simple approach now that the provider
API is private.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 libibverbs/compat-1_0.c            |  2 +-
 libibverbs/device.c                | 12 ++++++------
 libibverbs/driver.h                | 28 ++++++++++++++++++++--------
 libibverbs/init.c                  |  5 +++--
 libibverbs/verbs.h                 |  9 +++++----
 providers/cxgb3/iwch.c             |  4 ++--
 providers/cxgb4/dev.c              |  4 ++--
 providers/hfi1verbs/hfiverbs.c     |  4 ++--
 providers/hns/hns_roce_u.c         |  4 ++--
 providers/i40iw/i40iw_umain.c      |  4 ++--
 providers/ipathverbs/ipathverbs.c  |  4 ++--
 providers/mlx4/mlx4.c              |  9 ++++++---
 providers/mlx5/mlx5.c              |  9 +++++++--
 providers/mthca/mthca.c            |  4 ++--
 providers/nes/nes_umain.c          |  4 ++--
 providers/ocrdma/ocrdma_main.c     |  4 ++--
 providers/qedr/qelr_main.c         |  4 ++--
 providers/rxe/rxe.c                |  4 ++--
 providers/vmw_pvrdma/pvrdma_main.c |  4 ++--
 19 files changed, 72 insertions(+), 50 deletions(-)

diff --git a/libibverbs/compat-1_0.c b/libibverbs/compat-1_0.c
index d9bac536c85ebd..4978b8e9aa45f3 100644
--- a/libibverbs/compat-1_0.c
+++ b/libibverbs/compat-1_0.c
@@ -161,7 +161,7 @@ struct ibv_device_1_0 {
 	void		       *obsolete_sysfs_dev;
 	void		       *obsolete_sysfs_ibdev;
 	struct ibv_device      *real_device; /* was obsolete driver member */
-	struct ibv_device_ops	ops;
+	struct _ibv_device_ops	_ops;
 };
 
 struct ibv_context_ops_1_0 {
diff --git a/libibverbs/device.c b/libibverbs/device.c
index c7f39d57681170..e930a6c94a1e7a 100644
--- a/libibverbs/device.c
+++ b/libibverbs/device.c
@@ -173,8 +173,8 @@ struct ibv_context *__ibv_open_device(struct ibv_device *device)
 	if (cmd_fd < 0)
 		return NULL;
 
-	if (!verbs_device) {
-		context = device->ops.alloc_context(device, cmd_fd);
+	if (!verbs_device->ops->init_context) {
+		context = verbs_device->ops->alloc_context(device, cmd_fd);
 		if (!context)
 			goto err;
 	} else {
@@ -200,7 +200,7 @@ struct ibv_context *__ibv_open_device(struct ibv_device *device)
 		context_ex->sz = sizeof(*context_ex);
 
 		context = &context_ex->context;
-		ret = verbs_device->init_context(verbs_device, context, cmd_fd);
+		ret = verbs_device->ops->init_context(verbs_device, context, cmd_fd);
 		if (ret)
 			goto verbs_err;
 		/*
@@ -245,15 +245,15 @@ int __ibv_close_device(struct ibv_context *context)
 	int cmd_fd   = context->cmd_fd;
 	int cq_fd    = -1;
 	struct verbs_context *context_ex;
+	struct verbs_device *verbs_device = verbs_get_device(context->device);
 
 	context_ex = verbs_get_ctx(context);
 	if (context_ex) {
-		struct verbs_device *verbs_device = verbs_get_device(context->device);
-		verbs_device->uninit_context(verbs_device, context);
+		verbs_device->ops->uninit_context(verbs_device, context);
 		free(context_ex->priv);
 		free(context_ex);
 	} else {
-		context->device->ops.free_context(context);
+		verbs_device->ops->free_context(context);
 	}
 
 	close(async_fd);
diff --git a/libibverbs/driver.h b/libibverbs/driver.h
index 9e7f02ca30190c..34820af16e7fe1 100644
--- a/libibverbs/driver.h
+++ b/libibverbs/driver.h
@@ -53,6 +53,8 @@
  */
 #define IBV_DEVICE_LIBRARY_EXTENSION rdmav2
 
+struct verbs_device;
+
 enum verbs_xrcd_mask {
 	VERBS_XRCD_HANDLE	= 1 << 0,
 	VERBS_XRCD_RESERVED	= 1 << 1
@@ -98,21 +100,31 @@ struct verbs_qp {
 };
 
 /* Must change the PRIVATE IBVERBS_PRIVATE_ symbol if this is changed */
+struct verbs_device_ops {
+	/* Old interface, do not use in new code. */
+	struct ibv_context *(*alloc_context)(struct ibv_device *device,
+					     int cmd_fd);
+	void (*free_context)(struct ibv_context *context);
+
+	/* New interface */
+	int (*init_context)(struct verbs_device *device,
+			    struct ibv_context *ctx, int cmd_fd);
+	void (*uninit_context)(struct verbs_device *device,
+			       struct ibv_context *ctx);
+};
+
+/* Must change the PRIVATE IBVERBS_PRIVATE_ symbol if this is changed */
 struct verbs_device {
 	struct ibv_device device; /* Must be first */
+	const struct verbs_device_ops *ops;
 	size_t	sz;
 	size_t	size_of_context;
-	int	(*init_context)(struct verbs_device *device,
-				struct ibv_context *ctx, int cmd_fd);
-	void	(*uninit_context)(struct verbs_device *device,
-				struct ibv_context *ctx);
 };
 
-static inline struct verbs_device *verbs_get_device(
-					const struct ibv_device *dev)
+static inline struct verbs_device *
+verbs_get_device(const struct ibv_device *dev)
 {
-	return (dev->ops.alloc_context) ?
-		NULL : container_of(dev, struct verbs_device, device);
+	return container_of(dev, struct verbs_device, device);
 }
 
 typedef struct verbs_device *(*ibv_driver_init_func)(const char *uverbs_sys_path,
diff --git a/libibverbs/init.c b/libibverbs/init.c
index 11c2a587abf745..8e059546cdb5af 100644
--- a/libibverbs/init.c
+++ b/libibverbs/init.c
@@ -45,6 +45,7 @@
 #include <sys/resource.h>
 #include <dirent.h>
 #include <errno.h>
+#include <assert.h>
 
 #include <util/util.h>
 #include "ibverbs.h"
@@ -394,8 +395,8 @@ static struct ibv_device *try_driver(struct ibv_driver *driver,
 			return NULL;
 
 		dev = &vdev->device;
-		dev->ops.alloc_context = NULL;
-		dev->ops.free_context = NULL;
+		assert(dev->_ops._dummy1 == NULL);
+		assert(dev->_ops._dummy2 == NULL);
 	}
 
 	if (ibv_read_sysfs_file(sysfs_dev->ibdev_path, "node_type", value, sizeof value) < 0) {
diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
index a6c541b8020685..25f4ededdb6d63 100644
--- a/libibverbs/verbs.h
+++ b/libibverbs/verbs.h
@@ -1304,9 +1304,10 @@ struct ibv_flow {
 struct ibv_device;
 struct ibv_context;
 
-struct ibv_device_ops {
-	struct ibv_context *	(*alloc_context)(struct ibv_device *device, int cmd_fd);
-	void			(*free_context)(struct ibv_context *context);
+/* Obsolete, never used, do not touch */
+struct _ibv_device_ops {
+	struct ibv_context *	(*_dummy1)(struct ibv_device *device, int cmd_fd);
+	void			(*_dummy2)(struct ibv_context *context);
 };
 
 enum {
@@ -1315,7 +1316,7 @@ enum {
 };
 
 struct ibv_device {
-	struct ibv_device_ops	ops;
+	struct _ibv_device_ops	_ops;
 	enum ibv_node_type	node_type;
 	enum ibv_transport_type	transport_type;
 	/* Name of underlying kernel IB device, eg "mthca0" */
diff --git a/providers/cxgb3/iwch.c b/providers/cxgb3/iwch.c
index 6e60949f39dcc1..776c42c444ea36 100644
--- a/providers/cxgb3/iwch.c
+++ b/providers/cxgb3/iwch.c
@@ -166,7 +166,7 @@ static void iwch_free_context(struct ibv_context *ibctx)
 	free(context);
 }
 
-static struct ibv_device_ops iwch_dev_ops = {
+static struct verbs_device_ops iwch_dev_ops = {
 	.alloc_context = iwch_alloc_context,
 	.free_context = iwch_free_context
 };
@@ -251,7 +251,7 @@ found:
 	}
 
 	pthread_spin_init(&dev->lock, PTHREAD_PROCESS_PRIVATE);
-	dev->ibv_dev.device.ops = iwch_dev_ops;
+	dev->ibv_dev.ops = &iwch_dev_ops;
 	dev->hca_type = hca_table[i].type;
 	dev->abi_version = abi_version;
 
diff --git a/providers/cxgb4/dev.c b/providers/cxgb4/dev.c
index ec7fa53de50a89..8488c02830d56f 100644
--- a/providers/cxgb4/dev.c
+++ b/providers/cxgb4/dev.c
@@ -220,7 +220,7 @@ static void c4iw_free_context(struct ibv_context *ibctx)
 	free(context);
 }
 
-static struct ibv_device_ops c4iw_dev_ops = {
+static struct verbs_device_ops c4iw_dev_ops = {
 	.alloc_context = c4iw_alloc_context,
 	.free_context = c4iw_free_context
 };
@@ -470,7 +470,7 @@ found:
 	}
 
 	pthread_spin_init(&dev->lock, PTHREAD_PROCESS_PRIVATE);
-	dev->ibv_dev.device.ops = c4iw_dev_ops;
+	dev->ibv_dev.ops = &c4iw_dev_ops;
 	dev->chip_version = CHELSIO_CHIP_VERSION(hca_table[i].device >> 8);
 	dev->abi_version = abi_version;
 	list_node_init(&dev->list);
diff --git a/providers/hfi1verbs/hfiverbs.c b/providers/hfi1verbs/hfiverbs.c
index e8e777e833d0a3..82c2bd15d995eb 100644
--- a/providers/hfi1verbs/hfiverbs.c
+++ b/providers/hfi1verbs/hfiverbs.c
@@ -173,7 +173,7 @@ static void hfi1_free_context(struct ibv_context *ibctx)
 	free(context);
 }
 
-static struct ibv_device_ops hfi1_dev_ops = {
+static struct verbs_device_ops hfi1_dev_ops = {
 	.alloc_context	= hfi1_alloc_context,
 	.free_context	= hfi1_free_context
 };
@@ -211,7 +211,7 @@ found:
 		return NULL;
 	}
 
-	dev->ibv_dev.device.ops = hfi1_dev_ops;
+	dev->ibv_dev.ops = &hfi1_dev_ops;
 	dev->abi_version = abi_version;
 
 	return &dev->ibv_dev;
diff --git a/providers/hns/hns_roce_u.c b/providers/hns/hns_roce_u.c
index fe13e3b940e76f..2b2fd19a41a4fe 100644
--- a/providers/hns/hns_roce_u.c
+++ b/providers/hns/hns_roce_u.c
@@ -173,7 +173,7 @@ static void hns_roce_free_context(struct ibv_context *ibctx)
 	context = NULL;
 }
 
-static struct ibv_device_ops hns_roce_dev_ops = {
+static struct verbs_device_ops hns_roce_dev_ops = {
 	.alloc_context = hns_roce_alloc_context,
 	.free_context	= hns_roce_free_context
 };
@@ -215,7 +215,7 @@ found:
 		return NULL;
 	}
 
-	dev->ibv_dev.device.ops = hns_roce_dev_ops;
+	dev->ibv_dev.ops = &hns_roce_dev_ops;
 	dev->u_hw = (struct hns_roce_u_hw *)u_hw;
 	dev->hw_version = hw_version;
 	dev->page_size   = sysconf(_SC_PAGESIZE);
diff --git a/providers/i40iw/i40iw_umain.c b/providers/i40iw/i40iw_umain.c
index 69493b56dbbdb1..3d3015b7acdf3a 100644
--- a/providers/i40iw/i40iw_umain.c
+++ b/providers/i40iw/i40iw_umain.c
@@ -208,7 +208,7 @@ static void i40iw_ufree_context(struct ibv_context *ibctx)
 	free(iwvctx);
 }
 
-static struct ibv_device_ops i40iw_udev_ops = {
+static struct verbs_device_ops i40iw_udev_ops = {
 	.alloc_context	= i40iw_ualloc_context,
 	.free_context	= i40iw_ufree_context
 };
@@ -248,7 +248,7 @@ found:
 		return NULL;
 	}
 
-	dev->ibv_dev.device.ops = i40iw_udev_ops;
+	dev->ibv_dev.ops = &i40iw_udev_ops;
 	dev->hca_type = hca_table[i].type;
 	dev->page_size = I40IW_HW_PAGE_SIZE;
 	return &dev->ibv_dev;
diff --git a/providers/ipathverbs/ipathverbs.c b/providers/ipathverbs/ipathverbs.c
index c45675735c10b9..7eef9dfccbcb23 100644
--- a/providers/ipathverbs/ipathverbs.c
+++ b/providers/ipathverbs/ipathverbs.c
@@ -172,7 +172,7 @@ static void ipath_free_context(struct ibv_context *ibctx)
 	free(context);
 }
 
-static struct ibv_device_ops ipath_dev_ops = {
+static struct verbs_device_ops ipath_dev_ops = {
 	.alloc_context	= ipath_alloc_context,
 	.free_context	= ipath_free_context
 };
@@ -210,7 +210,7 @@ found:
 		return NULL;
 	}
 
-	dev->ibv_dev.device.ops = ipath_dev_ops;
+	dev->ibv_dev.ops = &ipath_dev_ops;
 	dev->abi_version = abi_version;
 
 	return &dev->ibv_dev;
diff --git a/providers/mlx4/mlx4.c b/providers/mlx4/mlx4.c
index 8e1a0dd88b46be..229c2670b5ed85 100644
--- a/providers/mlx4/mlx4.c
+++ b/providers/mlx4/mlx4.c
@@ -263,6 +263,11 @@ static void mlx4_uninit_context(struct verbs_device *v_device,
 		       to_mdev(&v_device->device)->page_size);
 }
 
+static struct verbs_device_ops mlx4_dev_ops = {
+	.init_context = mlx4_init_context,
+	.uninit_context = mlx4_uninit_context,
+};
+
 static struct verbs_device *mlx4_driver_init(const char *uverbs_sys_path, int abi_version)
 {
 	char			value[8];
@@ -308,12 +313,10 @@ found:
 	dev->page_size   = sysconf(_SC_PAGESIZE);
 	dev->abi_version = abi_version;
 
+	dev->verbs_dev.ops = &mlx4_dev_ops;
 	dev->verbs_dev.sz = sizeof(*dev);
 	dev->verbs_dev.size_of_context =
 		sizeof(struct mlx4_context) - sizeof(struct ibv_context);
-	/* mlx4_init_context will initialize provider calls */
-	dev->verbs_dev.init_context = mlx4_init_context;
-	dev->verbs_dev.uninit_context = mlx4_uninit_context;
 
 	return &dev->verbs_dev;
 }
diff --git a/providers/mlx5/mlx5.c b/providers/mlx5/mlx5.c
index 980e4dfb7a369f..bd87b4486987e8 100644
--- a/providers/mlx5/mlx5.c
+++ b/providers/mlx5/mlx5.c
@@ -900,6 +900,11 @@ static void mlx5_cleanup_context(struct verbs_device *device,
 	close_debug_file(context);
 }
 
+static struct verbs_device_ops mlx5_dev_ops = {
+	.init_context = mlx5_init_context,
+	.uninit_context = mlx5_cleanup_context,
+};
+
 static struct verbs_device *mlx5_driver_init(const char *uverbs_sys_path,
 					     int abi_version)
 {
@@ -945,11 +950,11 @@ found:
 
 	dev->page_size   = sysconf(_SC_PAGESIZE);
 	dev->driver_abi_ver = abi_version;
+
+	dev->verbs_dev.ops = &mlx5_dev_ops;
 	dev->verbs_dev.sz = sizeof(*dev);
 	dev->verbs_dev.size_of_context = sizeof(struct mlx5_context) -
 		sizeof(struct ibv_context);
-	dev->verbs_dev.init_context = mlx5_init_context;
-	dev->verbs_dev.uninit_context = mlx5_cleanup_context;
 
 	return &dev->verbs_dev;
 }
diff --git a/providers/mthca/mthca.c b/providers/mthca/mthca.c
index 9dbd6610f1e61f..abff1eb707a315 100644
--- a/providers/mthca/mthca.c
+++ b/providers/mthca/mthca.c
@@ -209,7 +209,7 @@ static void mthca_free_context(struct ibv_context *ibctx)
 	free(context);
 }
 
-static struct ibv_device_ops mthca_dev_ops = {
+static struct verbs_device_ops mthca_dev_ops = {
 	.alloc_context = mthca_alloc_context,
 	.free_context  = mthca_free_context
 };
@@ -253,7 +253,7 @@ found:
 		return NULL;
 	}
 
-	dev->ibv_dev.device.ops = mthca_dev_ops;
+	dev->ibv_dev.ops = &mthca_dev_ops;
 	dev->hca_type    = hca_table[i].type;
 	dev->page_size   = sysconf(_SC_PAGESIZE);
 
diff --git a/providers/nes/nes_umain.c b/providers/nes/nes_umain.c
index b166c0916e4ce9..b9ec9c41a9d5d1 100644
--- a/providers/nes/nes_umain.c
+++ b/providers/nes/nes_umain.c
@@ -185,7 +185,7 @@ static void nes_ufree_context(struct ibv_context *ibctx)
 }
 
 
-static struct ibv_device_ops nes_udev_ops = {
+static struct verbs_device_ops nes_udev_ops = {
 	.alloc_context = nes_ualloc_context,
 	.free_context = nes_ufree_context
 };
@@ -236,7 +236,7 @@ found:
 		return NULL;
 	}
 
-	dev->ibv_dev.device.ops = nes_udev_ops;
+	dev->ibv_dev.ops = &nes_udev_ops;
 	dev->hca_type = hca_table[i].type;
 	dev->page_size = sysconf(_SC_PAGESIZE);
 
diff --git a/providers/ocrdma/ocrdma_main.c b/providers/ocrdma/ocrdma_main.c
index 8dad5ffe17694d..9e2862843fed68 100644
--- a/providers/ocrdma/ocrdma_main.c
+++ b/providers/ocrdma/ocrdma_main.c
@@ -103,7 +103,7 @@ static struct ibv_context_ops ocrdma_ctx_ops = {
 	.detach_mcast = ocrdma_detach_mcast
 };
 
-static struct ibv_device_ops ocrdma_dev_ops = {
+static struct verbs_device_ops ocrdma_dev_ops = {
 	.alloc_context = ocrdma_alloc_context,
 	.free_context = ocrdma_free_context
 };
@@ -220,7 +220,7 @@ found:
 	bzero(dev->qp_tbl, OCRDMA_MAX_QP * sizeof(struct ocrdma_qp *));
 	pthread_mutex_init(&dev->dev_lock, NULL);
 	pthread_spin_init(&dev->flush_q_lock, PTHREAD_PROCESS_PRIVATE);
-	dev->ibv_dev.device.ops = ocrdma_dev_ops;
+	dev->ibv_dev.ops = &ocrdma_dev_ops;
 	list_node_init(&dev->entry);
 	pthread_mutex_lock(&ocrdma_dev_list_lock);
 	list_add_tail(&ocrdma_dev_list, &dev->entry);
diff --git a/providers/qedr/qelr_main.c b/providers/qedr/qelr_main.c
index ef192c533de350..5d14f733eea727 100644
--- a/providers/qedr/qelr_main.c
+++ b/providers/qedr/qelr_main.c
@@ -114,7 +114,7 @@ static struct ibv_context_ops qelr_ctx_ops = {
 	.async_event = qelr_async_event,
 };
 
-static struct ibv_device_ops qelr_dev_ops = {
+static struct verbs_device_ops qelr_dev_ops = {
 	.alloc_context = qelr_alloc_context,
 	.free_context = qelr_free_context
 };
@@ -272,7 +272,7 @@ found:
 		return NULL;
 	}
 
-	dev->ibv_dev.device.ops = qelr_dev_ops;
+	dev->ibv_dev.ops = &qelr_dev_ops;
 
 	return &dev->ibv_dev;
 }
diff --git a/providers/rxe/rxe.c b/providers/rxe/rxe.c
index fba3bc719cd45a..133a1b6ba908e8 100644
--- a/providers/rxe/rxe.c
+++ b/providers/rxe/rxe.c
@@ -886,7 +886,7 @@ static void rxe_free_context(struct ibv_context *ibctx)
 	free(context);
 }
 
-static struct ibv_device_ops rxe_dev_ops = {
+static struct verbs_device_ops rxe_dev_ops = {
 	.alloc_context = rxe_alloc_context,
 	.free_context = rxe_free_context,
 };
@@ -913,7 +913,7 @@ static struct verbs_device *rxe_driver_init(const char *uverbs_sys_path,
 		return NULL;
 	}
 
-	dev->ibv_dev.device.ops = rxe_dev_ops;
+	dev->ibv_dev.ops = &rxe_dev_ops;
 	dev->abi_version = abi_version;
 
 	return &dev->ibv_dev;
diff --git a/providers/vmw_pvrdma/pvrdma_main.c b/providers/vmw_pvrdma/pvrdma_main.c
index a518cacba79da3..7630134eda8e6e 100644
--- a/providers/vmw_pvrdma/pvrdma_main.c
+++ b/providers/vmw_pvrdma/pvrdma_main.c
@@ -162,7 +162,7 @@ static void pvrdma_free_context(struct ibv_context *ibctx)
 	free(context);
 }
 
-static struct ibv_device_ops pvrdma_dev_ops = {
+static struct verbs_device_ops pvrdma_dev_ops = {
 	.alloc_context = pvrdma_alloc_context,
 	.free_context  = pvrdma_free_context
 };
@@ -207,7 +207,7 @@ static struct pvrdma_device *pvrdma_driver_init_shared(
 
 	dev->abi_version = abi_version;
 	dev->page_size   = sysconf(_SC_PAGESIZE);
-	dev->ibv_dev.device.ops = pvrdma_dev_ops;
+	dev->ibv_dev.ops = &pvrdma_dev_ops;
 
 	return dev;
 }
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH rdma-core 4/4] verbs: Remove ibv_register_driver
       [not found] ` <1488317497-538-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
                     ` (2 preceding siblings ...)
  2017-02-28 21:31   ` [PATCH rdma-core 3/4] providers: Move all verbs_device ops into struct verbs_device_ops Jason Gunthorpe
@ 2017-02-28 21:31   ` Jason Gunthorpe
  3 siblings, 0 replies; 6+ messages in thread
From: Jason Gunthorpe @ 2017-02-28 21:31 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA

This is now identical to verbs_register driver, so use the new name.
We prefer verbs_register_driver as a name because of the symver compat
hack for ibv_register_driver.

Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
---
 libibverbs/compat-1_0.c            |  2 +-
 libibverbs/driver.h                |  5 +----
 libibverbs/init.c                  | 39 ++++++++------------------------------
 providers/cxgb3/iwch.c             |  2 +-
 providers/cxgb4/dev.c              |  2 +-
 providers/hfi1verbs/hfiverbs.c     |  2 +-
 providers/hns/hns_roce_u.c         |  2 +-
 providers/i40iw/i40iw_umain.c      |  2 +-
 providers/ipathverbs/ipathverbs.c  |  2 +-
 providers/mthca/mthca.c            |  2 +-
 providers/nes/nes_umain.c          |  2 +-
 providers/ocrdma/ocrdma_main.c     |  2 +-
 providers/qedr/qelr_main.c         |  2 +-
 providers/rxe/rxe.c                |  2 +-
 providers/vmw_pvrdma/pvrdma_main.c |  2 +-
 15 files changed, 22 insertions(+), 48 deletions(-)

diff --git a/libibverbs/compat-1_0.c b/libibverbs/compat-1_0.c
index 4978b8e9aa45f3..4155a92060e4bf 100644
--- a/libibverbs/compat-1_0.c
+++ b/libibverbs/compat-1_0.c
@@ -940,7 +940,7 @@ symver(__ibv_detach_mcast_1_0, ibv_detach_mcast, IBVERBS_1.0);
 
 typedef struct ibv_device *(*ibv_driver_init_func_1_1)(const char *uverbs_sys_path,
 						       int abi_version);
-void __ibv_register_driver_1_1(const char *name, ibv_driver_init_func init_func_1_1)
+void __ibv_register_driver_1_1(const char *name, ibv_driver_init_func_1_1 init_func)
 {
 	/* The driver interface is private as of rdma-core 13. This stub is
 	 * left to preserve dynamic-link compatability with old libfabrics
diff --git a/libibverbs/driver.h b/libibverbs/driver.h
index 34820af16e7fe1..e3ac3f7c92b03c 100644
--- a/libibverbs/driver.h
+++ b/libibverbs/driver.h
@@ -127,13 +127,10 @@ verbs_get_device(const struct ibv_device *dev)
 	return container_of(dev, struct verbs_device, device);
 }
 
-typedef struct verbs_device *(*ibv_driver_init_func)(const char *uverbs_sys_path,
-						     int abi_version);
 typedef struct verbs_device *(*verbs_driver_init_func)(const char *uverbs_sys_path,
 						       int abi_version);
-
-void ibv_register_driver(const char *name, ibv_driver_init_func init_func);
 void verbs_register_driver(const char *name, verbs_driver_init_func init_func);
+
 int ibv_cmd_get_context(struct ibv_context *context, struct ibv_get_context *cmd,
 			size_t cmd_size, struct ibv_get_context_resp *resp,
 			size_t resp_size);
diff --git a/libibverbs/init.c b/libibverbs/init.c
index 8e059546cdb5af..fdabe821ee8c80 100644
--- a/libibverbs/init.c
+++ b/libibverbs/init.c
@@ -71,7 +71,6 @@ struct ibv_driver_name {
 
 struct ibv_driver {
 	const char	       *name;
-	ibv_driver_init_func	init_func;
 	verbs_driver_init_func	verbs_init_func;
 	struct ibv_driver      *next;
 };
@@ -161,8 +160,8 @@ static int find_sysfs_devs(void)
 	return ret;
 }
 
-static void register_driver(const char *name, ibv_driver_init_func init_func,
-			    verbs_driver_init_func verbs_init_func)
+void verbs_register_driver(const char *name,
+			   verbs_driver_init_func verbs_init_func)
 {
 	struct ibv_driver *driver;
 
@@ -173,7 +172,6 @@ static void register_driver(const char *name, ibv_driver_init_func init_func,
 	}
 
 	driver->name            = name;
-	driver->init_func	= init_func;
 	driver->verbs_init_func = verbs_init_func;
 	driver->next            = NULL;
 
@@ -184,20 +182,6 @@ static void register_driver(const char *name, ibv_driver_init_func init_func,
 	tail_driver = driver;
 }
 
-void __ibv_register_driver(const char *name, ibv_driver_init_func init_func)
-{
-	register_driver(name, init_func, NULL);
-}
-private_symver(__ibv_register_driver, ibv_register_driver);
-
-/* New registration symbol with same functionality - used by providers to
-  * validate that library supports verbs extension.
-  */
-void verbs_register_driver(const char *name, verbs_driver_init_func init_func)
-{
-	register_driver(name, NULL, init_func);
-}
-
 #define __IBV_QUOTE(x)	#x
 #define IBV_QUOTE(x)	__IBV_QUOTE(x)
 #define DLOPEN_TRAILER "-" IBV_QUOTE(IBV_DEVICE_LIBRARY_EXTENSION) ".so"
@@ -384,20 +368,13 @@ static struct ibv_device *try_driver(struct ibv_driver *driver,
 	struct ibv_device *dev;
 	char value[16];
 
-	if (driver->init_func) {
-		vdev = driver->init_func(sysfs_dev->sysfs_path, sysfs_dev->abi_ver);
-		if (!vdev)
-			return NULL;
-		dev = &vdev->device;
-	} else {
-		vdev = driver->verbs_init_func(sysfs_dev->sysfs_path, sysfs_dev->abi_ver);
-		if (!vdev)
-			return NULL;
+	vdev = driver->verbs_init_func(sysfs_dev->sysfs_path, sysfs_dev->abi_ver);
+	if (!vdev)
+		return NULL;
 
-		dev = &vdev->device;
-		assert(dev->_ops._dummy1 == NULL);
-		assert(dev->_ops._dummy2 == NULL);
-	}
+	dev = &vdev->device;
+	assert(dev->_ops._dummy1 == NULL);
+	assert(dev->_ops._dummy2 == NULL);
 
 	if (ibv_read_sysfs_file(sysfs_dev->ibdev_path, "node_type", value, sizeof value) < 0) {
 		fprintf(stderr, PFX "Warning: no node_type attr under %s.\n",
diff --git a/providers/cxgb3/iwch.c b/providers/cxgb3/iwch.c
index 776c42c444ea36..be3905c4ab6850 100644
--- a/providers/cxgb3/iwch.c
+++ b/providers/cxgb3/iwch.c
@@ -284,5 +284,5 @@ err1:
 
 static __attribute__((constructor)) void cxgb3_register_driver(void)
 {
-	ibv_register_driver("cxgb3", cxgb3_driver_init);
+	verbs_register_driver("cxgb3", cxgb3_driver_init);
 }
diff --git a/providers/cxgb4/dev.c b/providers/cxgb4/dev.c
index 8488c02830d56f..183f141ac1a9f5 100644
--- a/providers/cxgb4/dev.c
+++ b/providers/cxgb4/dev.c
@@ -512,7 +512,7 @@ static __attribute__((constructor)) void cxgb4_register_driver(void)
 	c4iw_page_size = sysconf(_SC_PAGESIZE);
 	c4iw_page_shift = long_log2(c4iw_page_size);
 	c4iw_page_mask = ~(c4iw_page_size - 1);
-	ibv_register_driver("cxgb4", cxgb4_driver_init);
+	verbs_register_driver("cxgb4", cxgb4_driver_init);
 }
 
 #ifdef STATS
diff --git a/providers/hfi1verbs/hfiverbs.c b/providers/hfi1verbs/hfiverbs.c
index 82c2bd15d995eb..b27df3d843c4ad 100644
--- a/providers/hfi1verbs/hfiverbs.c
+++ b/providers/hfi1verbs/hfiverbs.c
@@ -219,5 +219,5 @@ found:
 
 static __attribute__((constructor)) void hfi1_register_driver(void)
 {
-	ibv_register_driver("hfi1verbs", hfi1_driver_init);
+	verbs_register_driver("hfi1verbs", hfi1_driver_init);
 }
diff --git a/providers/hns/hns_roce_u.c b/providers/hns/hns_roce_u.c
index 2b2fd19a41a4fe..a080ca609c8337 100644
--- a/providers/hns/hns_roce_u.c
+++ b/providers/hns/hns_roce_u.c
@@ -224,5 +224,5 @@ found:
 
 static __attribute__((constructor)) void hns_roce_register_driver(void)
 {
-	ibv_register_driver("hns", hns_roce_driver_init);
+	verbs_register_driver("hns", hns_roce_driver_init);
 }
diff --git a/providers/i40iw/i40iw_umain.c b/providers/i40iw/i40iw_umain.c
index 3d3015b7acdf3a..5946b7c8e63d04 100644
--- a/providers/i40iw/i40iw_umain.c
+++ b/providers/i40iw/i40iw_umain.c
@@ -256,5 +256,5 @@ found:
 
 static __attribute__ ((constructor)) void i40iw_register_driver(void)
 {
-	ibv_register_driver("i40iw", i40iw_driver_init);
+	verbs_register_driver("i40iw", i40iw_driver_init);
 }
diff --git a/providers/ipathverbs/ipathverbs.c b/providers/ipathverbs/ipathverbs.c
index 7eef9dfccbcb23..0cb6abf2d96563 100644
--- a/providers/ipathverbs/ipathverbs.c
+++ b/providers/ipathverbs/ipathverbs.c
@@ -218,5 +218,5 @@ found:
 
 static __attribute__((constructor)) void ipath_register_driver(void)
 {
-	ibv_register_driver("ipathverbs", ipath_driver_init);
+	verbs_register_driver("ipathverbs", ipath_driver_init);
 }
diff --git a/providers/mthca/mthca.c b/providers/mthca/mthca.c
index abff1eb707a315..96e7944ef72285 100644
--- a/providers/mthca/mthca.c
+++ b/providers/mthca/mthca.c
@@ -262,5 +262,5 @@ found:
 
 static __attribute__((constructor)) void mthca_register_driver(void)
 {
-	ibv_register_driver("mthca", mthca_driver_init);
+	verbs_register_driver("mthca", mthca_driver_init);
 }
diff --git a/providers/nes/nes_umain.c b/providers/nes/nes_umain.c
index b9ec9c41a9d5d1..20ddc8d01acdce 100644
--- a/providers/nes/nes_umain.c
+++ b/providers/nes/nes_umain.c
@@ -253,5 +253,5 @@ static __attribute__((constructor)) void nes_register_driver(void)
 {
 	/* fprintf(stderr, PFX "nes_register_driver: call ibv_register_driver()\n"); */
 
-	ibv_register_driver("nes", nes_driver_init);
+	verbs_register_driver("nes", nes_driver_init);
 }
diff --git a/providers/ocrdma/ocrdma_main.c b/providers/ocrdma/ocrdma_main.c
index 9e2862843fed68..2f22e8fd02c03a 100644
--- a/providers/ocrdma/ocrdma_main.c
+++ b/providers/ocrdma/ocrdma_main.c
@@ -237,5 +237,5 @@ qp_err:
 static __attribute__ ((constructor))
 void ocrdma_register_driver(void)
 {
-	ibv_register_driver("ocrdma", ocrdma_driver_init);
+	verbs_register_driver("ocrdma", ocrdma_driver_init);
 }
diff --git a/providers/qedr/qelr_main.c b/providers/qedr/qelr_main.c
index 5d14f733eea727..ba70db9d496755 100644
--- a/providers/qedr/qelr_main.c
+++ b/providers/qedr/qelr_main.c
@@ -280,5 +280,5 @@ found:
 static __attribute__ ((constructor))
 void qelr_register_driver(void)
 {
-	ibv_register_driver("qelr", qelr_driver_init);
+	verbs_register_driver("qelr", qelr_driver_init);
 }
diff --git a/providers/rxe/rxe.c b/providers/rxe/rxe.c
index 133a1b6ba908e8..a81d022c36a749 100644
--- a/providers/rxe/rxe.c
+++ b/providers/rxe/rxe.c
@@ -922,5 +922,5 @@ static struct verbs_device *rxe_driver_init(const char *uverbs_sys_path,
 static __attribute__ ((constructor))
 void rxe_register_driver(void)
 {
-	ibv_register_driver("rxe", rxe_driver_init);
+	verbs_register_driver("rxe", rxe_driver_init);
 }
diff --git a/providers/vmw_pvrdma/pvrdma_main.c b/providers/vmw_pvrdma/pvrdma_main.c
index 7630134eda8e6e..047f492699b136 100644
--- a/providers/vmw_pvrdma/pvrdma_main.c
+++ b/providers/vmw_pvrdma/pvrdma_main.c
@@ -225,5 +225,5 @@ static struct verbs_device *pvrdma_driver_init(const char *uverbs_sys_path,
 
 static __attribute__((constructor)) void pvrdma_register_driver(void)
 {
-	ibv_register_driver("pvrdma", pvrdma_driver_init);
+	verbs_register_driver("pvrdma", pvrdma_driver_init);
 }
-- 
2.7.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* RE: [PATCH rdma-core 2/4] providers: Make every provider allocate a verbs_device
       [not found]     ` <1488317497-538-3-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
@ 2017-03-01 20:01       ` Steve Wise
  0 siblings, 0 replies; 6+ messages in thread
From: Steve Wise @ 2017-03-01 20:01 UTC (permalink / raw)
  To: 'Jason Gunthorpe', linux-rdma-u79uwXL29TY76Z2rM5mHXA

> Switch struct ibv_device to verbs_device in the provider specific device
> structure and use calloc to allocate it so the unset bytes are zero.
> 
> This lets us change the return type of ibv_driver_init_func to
> struct verbs_device without changing the control flow at all.
> 
> Also make a few _init functions static for consistency/simplicity.
> 
> Signed-off-by: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>

cxgb* changes look fine.

Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-03-01 20:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-28 21:31 [PATCH rdma-core 0/4] Cleanup ibv_register_driver Jason Gunthorpe
     [not found] ` <1488317497-538-1-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-02-28 21:31   ` [PATCH rdma-core 1/4] ibverbs: Make struct verbs_device and related private Jason Gunthorpe
2017-02-28 21:31   ` [PATCH rdma-core 2/4] providers: Make every provider allocate a verbs_device Jason Gunthorpe
     [not found]     ` <1488317497-538-3-git-send-email-jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-03-01 20:01       ` Steve Wise
2017-02-28 21:31   ` [PATCH rdma-core 3/4] providers: Move all verbs_device ops into struct verbs_device_ops Jason Gunthorpe
2017-02-28 21:31   ` [PATCH rdma-core 4/4] verbs: Remove ibv_register_driver Jason Gunthorpe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.