On Tue, Dec 18, 2018 at 02:28:30PM +0200, Leon Romanovsky wrote: > From: Parav Pandit <parav@xxxxxxxxxxxx> > > 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 port_init. > > Additionally, store the port_init function pointer to ib_device, so that > it can be checked in subsequent patch when binding rdma device to net > namespace. Currently devices which exposes their own port specific > files cannot be bind to net namespace. Once infrastructure is built to > init and uninit the ports, this limitation will be removed. > > Signed-off-by: Parav Pandit <parav@xxxxxxxxxxxx> > Signed-off-by: Leon Romanovsky <leonro@xxxxxxxxxxxx> > --- > drivers/infiniband/core/core_priv.h | 4 +--- > drivers/infiniband/core/device.c | 6 ++---- > drivers/infiniband/core/sysfs.c | 6 ++---- > drivers/infiniband/hw/bnxt_re/main.c | 2 +- > drivers/infiniband/hw/cxgb3/iwch_provider.c | 2 +- > drivers/infiniband/hw/cxgb4/provider.c | 2 +- > drivers/infiniband/hw/hfi1/verbs.c | 2 +- > drivers/infiniband/hw/hns/hns_roce_main.c | 2 +- > drivers/infiniband/hw/i40iw/i40iw_verbs.c | 2 +- > drivers/infiniband/hw/mlx4/main.c | 2 +- > drivers/infiniband/hw/mlx5/main.c | 2 +- > drivers/infiniband/hw/mthca/mthca_provider.c | 2 +- > drivers/infiniband/hw/nes/nes_verbs.c | 2 +- > drivers/infiniband/hw/ocrdma/ocrdma_main.c | 2 +- > drivers/infiniband/hw/qedr/main.c | 2 +- > drivers/infiniband/hw/qib/qib_verbs.c | 2 +- > drivers/infiniband/hw/usnic/usnic_ib_main.c | 2 +- > drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c | 2 +- > drivers/infiniband/sw/rdmavt/vt.c | 5 ++--- > drivers/infiniband/sw/rxe/rxe_verbs.c | 2 +- > include/rdma/ib_verbs.h | 9 ++++++--- > include/rdma/rdma_vt.h | 3 --- > 22 files changed, 29 insertions(+), 36 deletions(-) > > diff --git a/drivers/infiniband/core/core_priv.h b/drivers/infiniband/core/core_priv.h > index ef2cea6de0b6..f2da31de62c9 100644 > --- a/drivers/infiniband/core/core_priv.h > +++ b/drivers/infiniband/core/core_priv.h > @@ -61,9 +61,7 @@ extern struct rw_semaphore ib_lists_rwsem; > > extern ushort ib_devices_shared_netns; > > -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); > > diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c > index 68934bf14f76..6d8f3d87633c 100644 > --- a/drivers/infiniband/core/device.c > +++ b/drivers/infiniband/core/device.c > @@ -630,9 +630,7 @@ static int setup_device(struct ib_device *device) > * 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; > @@ -669,7 +667,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"); > diff --git a/drivers/infiniband/core/sysfs.c b/drivers/infiniband/core/sysfs.c > index 68f50a82b317..9fc21cc526a3 100644 > --- a/drivers/infiniband/core/sysfs.c > +++ b/drivers/infiniband/core/sysfs.c > @@ -1344,9 +1344,7 @@ int ib_setup_port_attrs(struct ib_core_device *coredev, > return ret; > } > > -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) > { > int ret; > > @@ -1354,7 +1352,7 @@ int ib_device_register_sysfs(struct ib_device *device, > if (ret) > return ret; > > - ret = ib_setup_port_attrs(&device->coredev, port_callback, true); > + ret = ib_setup_port_attrs(&device->coredev, device->ops.port_init, true); > if (ret) { > device_del(&device->dev); > return ret; > diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c > index 56ad4882f381..2d96477c8e36 100644 > --- a/drivers/infiniband/hw/bnxt_re/main.c > +++ b/drivers/infiniband/hw/bnxt_re/main.c > @@ -664,7 +664,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) > diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c > index a44d431a158a..6d2ccd256eee 100644 > --- a/drivers/infiniband/hw/cxgb3/iwch_provider.c > +++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c > @@ -1411,7 +1411,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; > diff --git a/drivers/infiniband/hw/cxgb4/provider.c b/drivers/infiniband/hw/cxgb4/provider.c > index fd547e9cf21b..f977f8e7e162 100644 > --- a/drivers/infiniband/hw/cxgb4/provider.c > +++ b/drivers/infiniband/hw/cxgb4/provider.c > @@ -636,7 +636,7 @@ void c4iw_register_device(struct work_struct *work) > rdma_set_device_sysfs_group(&dev->ibdev, &c4iw_attr_group); > dev->ibdev.driver_id = RDMA_DRIVER_CXGB4; > ib_set_device_ops(&dev->ibdev, &c4iw_dev_ops); > - ret = ib_register_device(&dev->ibdev, "cxgb4_%d", NULL); > + ret = ib_register_device(&dev->ibdev, "cxgb4_%d"); > if (ret) > goto err_kfree_iwcm; > return; > diff --git a/drivers/infiniband/hw/hfi1/verbs.c b/drivers/infiniband/hw/hfi1/verbs.c > index e42162ea59f6..50af1913cc19 100644 > --- a/drivers/infiniband/hw/hfi1/verbs.c > +++ b/drivers/infiniband/hw/hfi1/verbs.c > @@ -1625,6 +1625,7 @@ static const struct ib_device_ops hfi1_dev_ops = { > .modify_device = modify_device, > /* keep process mad in the driver */ > .process_mad = hfi1_process_mad, > + .port_init = hfi1_create_port_files, > }; > > /** > @@ -1679,7 +1680,6 @@ int hfi1_register_ib_device(struct hfi1_devdata *dd) > /* > * Fill in rvt info object. > */ > - dd->verbs_dev.rdi.driver_f.port_callback = hfi1_create_port_files; > dd->verbs_dev.rdi.driver_f.get_pci_dev = get_pci_dev; > dd->verbs_dev.rdi.driver_f.check_ah = hfi1_check_ah; > dd->verbs_dev.rdi.driver_f.notify_new_ah = hfi1_notify_new_ah; > diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c > index c79054ba9495..e0c542324ad0 100644 > --- a/drivers/infiniband/hw/hns/hns_roce_main.c > +++ b/drivers/infiniband/hw/hns/hns_roce_main.c > @@ -564,7 +564,7 @@ static int hns_roce_register_device(struct hns_roce_dev *hr_dev) > ib_dev->driver_id = RDMA_DRIVER_HNS; > ib_set_device_ops(ib_dev, hr_dev->hw->hns_roce_dev_ops); > ib_set_device_ops(ib_dev, &hns_roce_dev_ops); > - ret = ib_register_device(ib_dev, "hns_%d", NULL); > + ret = ib_register_device(ib_dev, "hns_%d"); > if (ret) { > dev_err(dev, "ib_register_device failed!\n"); > return ret; > diff --git a/drivers/infiniband/hw/i40iw/i40iw_verbs.c b/drivers/infiniband/hw/i40iw/i40iw_verbs.c > index 54ade0cfce50..e7d9a3284f5b 100644 > --- a/drivers/infiniband/hw/i40iw/i40iw_verbs.c > +++ b/drivers/infiniband/hw/i40iw/i40iw_verbs.c > @@ -2867,7 +2867,7 @@ int i40iw_register_rdma_device(struct i40iw_device *iwdev) > iwibdev = iwdev->iwibdev; > rdma_set_device_sysfs_group(&iwibdev->ibdev, &i40iw_attr_group); > iwibdev->ibdev.driver_id = RDMA_DRIVER_I40IW; > - ret = ib_register_device(&iwibdev->ibdev, "i40iw%d", NULL); > + ret = ib_register_device(&iwibdev->ibdev, "i40iw%d"); > if (ret) > goto error; > > diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c > index 5dbf1030098b..dc2ffd293a11 100644 > --- a/drivers/infiniband/hw/mlx4/main.c > +++ b/drivers/infiniband/hw/mlx4/main.c > @@ -2857,7 +2857,7 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) > > rdma_set_device_sysfs_group(&ibdev->ib_dev, &mlx4_attr_group); > ibdev->ib_dev.driver_id = RDMA_DRIVER_MLX4; > - if (ib_register_device(&ibdev->ib_dev, "mlx4_%d", NULL)) > + if (ib_register_device(&ibdev->ib_dev, "mlx4_%d")) > goto err_diag_counters; > > if (mlx4_ib_mad_init(ibdev)) > diff --git a/drivers/infiniband/hw/mlx5/main.c b/drivers/infiniband/hw/mlx5/main.c > index 4430f8ad9e67..d2e9ade81df6 100644 > --- a/drivers/infiniband/hw/mlx5/main.c > +++ b/drivers/infiniband/hw/mlx5/main.c > @@ -6233,7 +6233,7 @@ int mlx5_ib_stage_ib_reg_init(struct mlx5_ib_dev *dev) > name = "mlx5_%d"; > else > name = "mlx5_bond_%d"; > - return ib_register_device(&dev->ib_dev, name, NULL); > + return ib_register_device(&dev->ib_dev, name); > } > > void mlx5_ib_stage_pre_ib_reg_umr_cleanup(struct mlx5_ib_dev *dev) > diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c > index 2153ec032749..e548fa8168f1 100644 > --- a/drivers/infiniband/hw/mthca/mthca_provider.c > +++ b/drivers/infiniband/hw/mthca/mthca_provider.c > @@ -1340,7 +1340,7 @@ int mthca_register_device(struct mthca_dev *dev) > > rdma_set_device_sysfs_group(&dev->ib_dev, &mthca_attr_group); > dev->ib_dev.driver_id = RDMA_DRIVER_MTHCA; > - ret = ib_register_device(&dev->ib_dev, "mthca%d", NULL); > + ret = ib_register_device(&dev->ib_dev, "mthca%d"); > if (ret) > return ret; > > diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c > index 599e30a4c678..988084527937 100644 > --- a/drivers/infiniband/hw/nes/nes_verbs.c > +++ b/drivers/infiniband/hw/nes/nes_verbs.c > @@ -3801,7 +3801,7 @@ int nes_register_ofa_device(struct nes_ib_device *nesibdev) > > rdma_set_device_sysfs_group(&nesvnic->nesibdev->ibdev, &nes_attr_group); > nesvnic->nesibdev->ibdev.driver_id = RDMA_DRIVER_NES; > - ret = ib_register_device(&nesvnic->nesibdev->ibdev, "nes%d", NULL); > + ret = ib_register_device(&nesvnic->nesibdev->ibdev, "nes%d"); > if (ret) { > return ret; > } > diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_main.c b/drivers/infiniband/hw/ocrdma/ocrdma_main.c > index 0e8380ef3511..b0491b9ecfe4 100644 > --- a/drivers/infiniband/hw/ocrdma/ocrdma_main.c > +++ b/drivers/infiniband/hw/ocrdma/ocrdma_main.c > @@ -245,7 +245,7 @@ static int ocrdma_register_device(struct ocrdma_dev *dev) > } > rdma_set_device_sysfs_group(&dev->ibdev, &ocrdma_attr_group); > dev->ibdev.driver_id = RDMA_DRIVER_OCRDMA; > - return ib_register_device(&dev->ibdev, "ocrdma%d", NULL); > + return ib_register_device(&dev->ibdev, "ocrdma%d"); > } > > static int ocrdma_alloc_resources(struct ocrdma_dev *dev) > diff --git a/drivers/infiniband/hw/qedr/main.c b/drivers/infiniband/hw/qedr/main.c > index 88be4144ccc7..f85e72b65a10 100644 > --- a/drivers/infiniband/hw/qedr/main.c > +++ b/drivers/infiniband/hw/qedr/main.c > @@ -291,7 +291,7 @@ static int qedr_register_device(struct qedr_dev *dev) > ib_set_device_ops(&dev->ibdev, &qedr_dev_ops); > > dev->ibdev.driver_id = RDMA_DRIVER_QEDR; > - return ib_register_device(&dev->ibdev, "qedr%d", NULL); > + return ib_register_device(&dev->ibdev, "qedr%d"); > } > > /* This function allocates fast-path status block memory */ > diff --git a/drivers/infiniband/hw/qib/qib_verbs.c b/drivers/infiniband/hw/qib/qib_verbs.c > index 611a6b5ef83f..669b25496a9f 100644 > --- a/drivers/infiniband/hw/qib/qib_verbs.c > +++ b/drivers/infiniband/hw/qib/qib_verbs.c > @@ -1496,6 +1496,7 @@ static void qib_fill_device_attr(struct qib_devdata *dd) > static const struct ib_device_ops qib_dev_ops = { > .modify_device = qib_modify_device, > .process_mad = qib_process_mad, > + .port_init = qib_create_port_files, > }; > > /** > @@ -1567,7 +1568,6 @@ int qib_register_ib_device(struct qib_devdata *dd) > /* > * Fill in rvt info object. > */ > - dd->verbs_dev.rdi.driver_f.port_callback = qib_create_port_files; > dd->verbs_dev.rdi.driver_f.get_pci_dev = qib_get_pci_dev; > dd->verbs_dev.rdi.driver_f.check_ah = qib_check_ah; > dd->verbs_dev.rdi.driver_f.setup_wqe = qib_check_send_wqe; > diff --git a/drivers/infiniband/hw/usnic/usnic_ib_main.c b/drivers/infiniband/hw/usnic/usnic_ib_main.c > index b2323a52a0dd..3201dd1899c7 100644 > --- a/drivers/infiniband/hw/usnic/usnic_ib_main.c > +++ b/drivers/infiniband/hw/usnic/usnic_ib_main.c > @@ -422,7 +422,7 @@ static void *usnic_ib_device_add(struct pci_dev *dev) > us_ibdev->ib_dev.driver_id = RDMA_DRIVER_USNIC; > rdma_set_device_sysfs_group(&us_ibdev->ib_dev, &usnic_attr_group); > > - if (ib_register_device(&us_ibdev->ib_dev, "usnic_%d", NULL)) > + if (ib_register_device(&us_ibdev->ib_dev, "usnic_%d")) > goto err_fwd_dealloc; > > usnic_fwd_set_mtu(us_ibdev->ufdev, us_ibdev->netdev->mtu); > diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c > index eaa109dbc96a..1bc415483d9b 100644 > --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c > +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_main.c > @@ -278,7 +278,7 @@ static int pvrdma_register_device(struct pvrdma_dev *dev) > spin_lock_init(&dev->srq_tbl_lock); > rdma_set_device_sysfs_group(&dev->ib_dev, &pvrdma_attr_group); > > - ret = ib_register_device(&dev->ib_dev, "vmw_pvrdma%d", NULL); > + ret = ib_register_device(&dev->ib_dev, "vmw_pvrdma%d"); > if (ret) > goto err_srq_free; > > diff --git a/drivers/infiniband/sw/rdmavt/vt.c b/drivers/infiniband/sw/rdmavt/vt.c > index aef3aa3fe667..c93bea876efc 100644 > --- a/drivers/infiniband/sw/rdmavt/vt.c > +++ b/drivers/infiniband/sw/rdmavt/vt.c > @@ -446,7 +446,7 @@ static noinline int check_support(struct rvt_dev_info *rdi, int verb) > * These functions are not part of verbs specifically but are > * required for rdmavt to function. > */ > - if ((!rdi->driver_f.port_callback) || > + if ((!rdi->ibdev.port_init) || I failed to rebase properly, !rdi->ibdev.port_init should be !rdi->ibdev.ops.port_init Thanks
Attachment:
signature.asc
Description: PGP signature