[openib-general] cm-id->context should be NULL forIB_CM_REQ_RECEIVED ?

Jeff Carr jcarr at linuxmachines.com
Mon Jun 13 15:20:51 PDT 2005


On 06/13/05 14:56, Fab Tillier wrote:
>>From: Jeff Carr [mailto:jcarr at linuxmachines.com]
>>Sent: Monday, June 13, 2005 2:52 PM
>>
>>On 06/13/05 14:12, Roland Dreier wrote:
>>
>>>    Jeff> On the recieving end of a request, when the handler gets
>>>    Jeff> called and the cm-id gets passed to your handler (aka when
>>>    Jeff> the handler gets IB_CM_REQ_RECEIVED) it seems cm-id->context
>>>    Jeff> isn't null. Is there some useful data in there? If not, I
>>>    Jeff> think it makes more sense (and makes code easier to write to
>>>    Jeff> use the cm handler) if the context is set to NULL.
>>>
>>>I think the context gets populated from the context of the
>>>corresponding cm_id that was passed to ib_cm_listen().
>>
>>OK, thanks. I checked and it does look like that is what is happening.
>>I'll set the context for the cm_id I pass into ib_cm_listen to null.
>>Assuming of course, that the cm_id context for that one doesn't matter.
> 
> 
> The CM doesn't interpret the user's context ever.  It is just there for the
> benefit of the user.  If your app doesn't need the context in the REQ callback,
> then you can set it to NULL.
> 
> Out of curiosity, if you don't set the listen's context, how do you figure out
> which listen received the callback?  Does DAPL not care?

I only call ib_cm_listen once:

ib_cm_listen(listen_id, LISTEN_NUM, 0);

Is it necessary to call listen for each connection I wish to recieve? It 
seems like the cm handler function I register when I create the cm_id 
continues to handle req events until it is destroyed so I'm assuming 
this is all I need.

In the case where I only have one number I'm listening on, then it 
doesn't matter to me what the context is; NULL makes the code simple.

Jeff



More information about the general mailing list