Commit ea4baf7f authored by Parav Pandit's avatar Parav Pandit Committed by Jason Gunthorpe
Browse files

RDMA: Rename port_callback to init_port



Most provider routines are callback routines which ib core invokes.
_callback suffix doesn't convey information about when such callback is
invoked. Therefore, rename port_callback to init_port.

Additionally, store the init_port function pointer in ib_device_ops, so
that it can be accessed in subsequent patches when binding rdma device to
net namespace.

Signed-off-by: default avatarParav Pandit <parav@mellanox.com>
Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 081de949
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -54,9 +54,7 @@ struct pkey_index_qp_list {
	struct list_head    qp_list;
};

int  ib_device_register_sysfs(struct ib_device *device,
			      int (*port_callback)(struct ib_device *,
						   u8, struct kobject *));
int ib_device_register_sysfs(struct ib_device *device);
void ib_device_unregister_sysfs(struct ib_device *device);
int ib_device_rename(struct ib_device *ibdev, const char *name);

+3 −4
Original line number Diff line number Diff line
@@ -574,9 +574,7 @@ port_cleanup:
 * callback for each device that is added. @device must be allocated
 * with ib_alloc_device().
 */
int ib_register_device(struct ib_device *device, const char *name,
		       int (*port_callback)(struct ib_device *, u8,
					    struct kobject *))
int ib_register_device(struct ib_device *device, const char *name)
{
	int ret;
	struct ib_client *client;
@@ -613,7 +611,7 @@ int ib_register_device(struct ib_device *device, const char *name,
		goto dev_cleanup;
	}

	ret = ib_device_register_sysfs(device, port_callback);
	ret = ib_device_register_sysfs(device);
	if (ret) {
		dev_warn(&device->dev,
			 "Couldn't register device with driver model\n");
@@ -1283,6 +1281,7 @@ void ib_set_device_ops(struct ib_device *dev, const struct ib_device_ops *ops)
	SET_DEVICE_OP(dev_ops, get_vector_affinity);
	SET_DEVICE_OP(dev_ops, get_vf_config);
	SET_DEVICE_OP(dev_ops, get_vf_stats);
	SET_DEVICE_OP(dev_ops, init_port);
	SET_DEVICE_OP(dev_ops, map_mr_sg);
	SET_DEVICE_OP(dev_ops, map_phys_fmr);
	SET_DEVICE_OP(dev_ops, mmap);
+6 −10
Original line number Diff line number Diff line
@@ -1015,9 +1015,7 @@ err_free_stats:
	return;
}

static int add_port(struct ib_device *device, int port_num,
		    int (*port_callback)(struct ib_device *,
					 u8, struct kobject *))
static int add_port(struct ib_device *device, int port_num)
{
	struct ib_port *p;
	struct ib_port_attr attr;
@@ -1113,8 +1111,8 @@ static int add_port(struct ib_device *device, int port_num,
	if (ret)
		goto err_free_pkey;

	if (port_callback) {
		ret = port_callback(device, port_num, &p->kobj);
	if (device->ops.init_port) {
		ret = device->ops.init_port(device, port_num, &p->kobj);
		if (ret)
			goto err_remove_pkey;
	}
@@ -1308,9 +1306,7 @@ static void free_port_list_attributes(struct ib_device *device)
	kobject_put(device->ports_kobj);
}

int ib_device_register_sysfs(struct ib_device *device,
			     int (*port_callback)(struct ib_device *,
						  u8, struct kobject *))
int ib_device_register_sysfs(struct ib_device *device)
{
	struct device *class_dev = &device->dev;
	int ret;
@@ -1330,12 +1326,12 @@ int ib_device_register_sysfs(struct ib_device *device,
	}

	if (rdma_cap_ib_switch(device)) {
		ret = add_port(device, 0, port_callback);
		ret = add_port(device, 0);
		if (ret)
			goto err_put;
	} else {
		for (i = 1; i <= device->phys_port_cnt; ++i) {
			ret = add_port(device, i, port_callback);
			ret = add_port(device, i);
			if (ret)
				goto err_put;
		}
+1 −1
Original line number Diff line number Diff line
@@ -662,7 +662,7 @@ static int bnxt_re_register_ib(struct bnxt_re_dev *rdev)
	rdma_set_device_sysfs_group(ibdev, &bnxt_re_dev_attr_group);
	ibdev->driver_id = RDMA_DRIVER_BNXT_RE;
	ib_set_device_ops(ibdev, &bnxt_re_dev_ops);
	return ib_register_device(ibdev, "bnxt_re%d", NULL);
	return ib_register_device(ibdev, "bnxt_re%d");
}

static void bnxt_re_dev_remove(struct bnxt_re_dev *rdev)
+1 −1
Original line number Diff line number Diff line
@@ -1409,7 +1409,7 @@ int iwch_register_device(struct iwch_dev *dev)
	dev->ibdev.driver_id = RDMA_DRIVER_CXGB3;
	rdma_set_device_sysfs_group(&dev->ibdev, &iwch_attr_group);
	ib_set_device_ops(&dev->ibdev, &iwch_dev_ops);
	ret = ib_register_device(&dev->ibdev, "cxgb3_%d", NULL);
	ret = ib_register_device(&dev->ibdev, "cxgb3_%d");
	if (ret)
		kfree(dev->ibdev.iwcm);
	return ret;
Loading