> > On Mon, Dec 8, 2014 at 2:23 AM, Weiny, Ira <ira.weiny@xxxxxxxxx> wrote: > > >> I find it very annoying that upper level drivers replicate in > >> different ways elements from the IB device attributes returned by > >> ib_query_device. I met that in multiple drivers and upcoming designs > >> for which I do code review. Are you up to come up with a patch that > >> caches the device attributes on the device structure? > > > I don't follow what you are asking for. Could you give more details? > > 1. add a struct ib_device_attr field to struct ib_device > > 2. when the device registers itself with the IB core, go and run the > query_device verb with the param being pointer to that field I see where you are going. Then the MAD stack does not have to cache a "max_mad_size" value but rather looks in the ib_device structure "on the fly"... So, something like the diff below? What are the chances we end up with attributes which are not constant? If Roland would like to go this way I can rework my series based on the attributes being cached. -- Ira 17:15:59 > git di diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c index 18c1ece..db18795 100644 --- a/drivers/infiniband/core/device.c +++ b/drivers/infiniband/core/device.c @@ -322,6 +322,8 @@ int ib_register_device(struct ib_device *device, client->add(device); } + device->query_device(device, &device->attributes); + out: mutex_unlock(&device_mutex); return ret; diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h index 470a011..241a882 100644 --- a/include/rdma/ib_verbs.h +++ b/include/rdma/ib_verbs.h @@ -1630,6 +1630,7 @@ struct ib_device { u32 local_dma_lkey; u8 node_type; u8 phys_port_cnt; + struct ib_device_attr attributes; }; struct ib_client { ��.n��������+%������w��{.n�����{���fk��ܨ}���Ơz�j:+v�����w����ޙ��&�)ߡ�a����z�ޗ���ݢj��w�f