]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
IB/core: Save the device attributes on the device structure
authorIra Weiny <ira.weiny@intel.com>
Fri, 18 Dec 2015 08:59:44 +0000 (10:59 +0200)
committerJack Vogel <jack.vogel@oracle.com>
Thu, 15 Mar 2018 20:10:53 +0000 (13:10 -0700)
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 <ira.weiny@intel.com>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Orabug: 27687711
Signed-off-by: Gerd Rausch <gerd.rausch@oracle.com>
(cherry-picked from upstream 3e153a93a1c12e3354dd38cca414fb51a15136a2)
Reviewed-by: HÃ¥kon Bugge <haakon.bugge@oracle.com>
drivers/infiniband/core/device.c
include/rdma/ib_verbs.h

index 7b60cc0b0e1924996ab6717deab945919c1f99a3..8f72ff1744ac08117b78c7c3be816fe3531304eb 100644 (file)
@@ -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",
index d5e998e10f9dfd90b23f886e4522418103da2855..c206030d776d8ad88e007859d92bb1a4fadc449a 100644 (file)
@@ -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;
 };