Re: [PATCH v3 for-next 05/13] IB/cm: Reference count ib_cm_ids

Haggai Eran
2015-05-17T06:27:35Z

On 15/05/2015 22:11, Hefty, Sean wrote:
>> The lifetime if each cm_id is clearly defined:
>>
>> cm_create_cm_id()
>> cm_ref_id() / cm_deref_id()
>> cm_destroy_id()
>>
>> The fact the CM might share a listen (and only a listen) ID behind the
>> scenes is not the caller's problem. That is an implementation choice,
>> each caller stands alone and uses the API properly, assuming it is the
>> only user of the returned cm_id.
>
> Actually, I seriously question why the ib_cm should be modified at all for any of this.

At first I thought of doing all the changes in the rdma_cm module. After
a little thought though, I saw that this would require having a data
structure in rdma_cm that could tell which ib_cm_id to use when
listening on a new rdma_cm_id. That data structure would be indexed by a
service ID. This is exactly what the listen_service_table rb_tree in
ib_cm does, so instead of duplicating the rb_tree's data in another
module, I prefer to make a small change to ib_cm and let it continue
manage that tree.

Haggai