@@ -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");
}
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> --- drivers/infiniband/hw/cxgb3/iwch_provider.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)