[openib-general] Re: mad.c memory leak

Sean Hefty mshefty at ichips.intel.com
Wed Mar 15 10:33:07 PST 2006


Michael S. Tsirkin wrote:
>>There's also something I don't understand: ib_mad_recv_done_handler seems
>>to *always* pass response to ib_mad_post_receive_mads, even if
>>driver's process_mad returned IB_MAD_RESULT_CONSUMED: we simply
>>do "goto out" and that has
>>
>>       if (response) {
>>                ib_mad_post_receive_mads(qp_info, response);
>>
>>Could you explain please?
> 
> 
> I guess the naming is what confuses me: if this is a response, apparently
> returned by driver, why are we passing it to ib_mad_post_receive_mads?

The response MAD contains the data to send in reply to a received MAD.  If 
process_mad() returns CONSUMED, then the received MAD has been consumed and no 
response was generated.  If process_mad() returns REPLY, then the reply data is 
in response->mad.mad.  The data is copied to an ib_mad_send_buf in 
agent_send_response().

Following what I believe is the common processing flow:

1. We receive a MAD.
2. We allocate a buffer to store a response from the device.
3. We call process_mad() to let the device examine the MAD.
4. The device will typically not process the MAD.
5. We hand the received MAD to a MAD agent.
6. We post a new receive on the special QP.

The code has been optimized to use the buffer allocated in step 2 as the receive 
buffer in step 6.

- Sean



More information about the general mailing list