From: Ira Weiny Date: Fri, 18 Dec 2015 08:59:44 +0000 (+0200) Subject: IB/core: Save the device attributes on the device structure X-Git-Tag: v4.1.12-124.31.3~911 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=bcec646a7d44772cb21fa0f78d953af04c12adcf;p=users%2Fjedix%2Flinux-maple.git IB/core: Save the device attributes on the device structure This way both the IB core and upper level drivers can access these cached device attributes rather than querying or caching them on their own. Signed-off-by: Ira Weiny Signed-off-by: Or Gerlitz Signed-off-by: Doug Ledford Orabug: 27687711 Signed-off-by: Gerd Rausch (cherry-picked from upstream 3e153a93a1c12e3354dd38cca414fb51a15136a2) Reviewed-by: HÃ¥kon Bugge --- diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index 7b60cc0b0e19..8f72ff1744ac 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -308,6 +308,13 @@ int ib_register_device(struct ib_device *device, goto out; } + memset(&device->attrs, 0, sizeof(device->attrs)); + ret = device->query_device(device, &device->attrs); + if (ret) { + printk(KERN_WARNING "Couldn't query the device attributes\n"); + goto out; + } + ret = ib_device_register_sysfs(device, port_callback); if (ret) { printk(KERN_WARNING "Couldn't register device %s with driver model\n", diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index d5e998e10f9d..c206030d776d 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -1732,6 +1732,8 @@ struct ib_device { u32 local_dma_lkey; u8 node_type; u8 phys_port_cnt; + struct ib_device_attr attrs; + struct ib_pd *relaxed_pd; struct list_head relaxed_pool_list; };