RDMA/cxgb3: Use ib_device_set_netdev()

This change is required to associate the cxgb3 ib_dev with the
underlying net_device, so in the upcoming patch we can call
ib_device_get_netdev().

Signed-off-by: Kamal Heib <kamalheib1@gmail.com>
Link: https://lore.kernel.org/r/20190807103138.17219-3-kamalheib1@gmail.com
Signed-off-by: Doug Ledford <dledford@redhat.com>
This commit is contained in:
Kamal Heib 2019-08-07 13:31:36 +03:00 committed by Doug Ledford
parent 72a7720fca
commit 691f380df2
1 changed files with 20 additions and 0 deletions

View File

@ -1273,8 +1273,24 @@ static const struct ib_device_ops iwch_dev_ops = {
INIT_RDMA_OBJ_SIZE(ib_ucontext, iwch_ucontext, ibucontext),
};
static int set_netdevs(struct ib_device *ib_dev, struct cxio_rdev *rdev)
{
int ret;
int i;
for (i = 0; i < rdev->port_info.nports; i++) {
ret = ib_device_set_netdev(ib_dev, rdev->port_info.lldevs[i],
i + 1);
if (ret)
return ret;
}
return 0;
}
int iwch_register_device(struct iwch_dev *dev)
{
int err;
pr_debug("%s iwch_dev %p\n", __func__, dev);
memset(&dev->ibdev.node_guid, 0, sizeof(dev->ibdev.node_guid));
memcpy(&dev->ibdev.node_guid, dev->rdev.t3cdev_p->lldev->dev_addr, 6);
@ -1315,6 +1331,10 @@ int iwch_register_device(struct iwch_dev *dev)
rdma_set_device_sysfs_group(&dev->ibdev, &iwch_attr_group);
ib_set_device_ops(&dev->ibdev, &iwch_dev_ops);
err = set_netdevs(&dev->ibdev, &dev->rdev);
if (err)
return err;
return ib_register_device(&dev->ibdev, "cxgb3_%d");
}