[openib-general] MAD receive work completion

Sean Hefty mshefty at ichips.intel.com
Thu Mar 10 15:37:08 PST 2005


I'm hitting an issue in the CM where I need to access work completion 
information about a received MAD.  The CM takes the received MAD and 
queues it to a CM owned work queue for processing.  It then accesses 
the wc field from ib_mad_recv_wc shown below.

struct ib_mad_recv_wc {
	struct ib_wc		*wc;
	struct ib_mad_recv_buf	recv_buf;
	int			mad_len;
};

The ib_mad_recv_wc and referenced data buffers are owned by the CM 
until it calls ib_free_recv_mad(), however the wc field references an 
item that is declared on the stack.

I see two main solutions.  The CM can allocate its own ib_wc structure 
and copy the contents of the returned work completion.  Or the MAD 
layer can avoid allocating the work completion on the stack.  Thoughts?

- Sean



More information about the general mailing list