Commit 691f380d authored by Kamal Heib's avatar Kamal Heib Committed by Doug Ledford

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: default avatarKamal Heib <kamalheib1@gmail.com>
Link: https://lore.kernel.org/r/20190807103138.17219-3-kamalheib1@gmail.comSigned-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 72a7720f
......@@ -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");
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment