[openib-general] mthca calls ib_register_mad_agent() and implements ib_device.process_mad()?

Hal Rosenstock halr at voltaire.com
Mon Dec 19 17:40:31 PST 2005


On Mon, 2005-12-19 at 19:38, Ralph Campbell wrote:
> Can someone explain why the mthca driver calls
> ib_register_mad_agent() and implements ib_device.process_mad()?

This is because the mthca has the agents in firmware and the driver
wants to see each MAD and give the firmware the right of first refusal
on each received MAD. There was a long thread on this in the early days
of OpenIB.

> It looks like the later does the actual processing of MAD packets
> for the SMA and PMA

and any other agents that might be implemented in firmware. Right now it
is just SMA and PMA.

> whereas the former doesn't seem to do anything
> except cause the ib_mad module to be modprobe'd.

It also registers a send completion handler for MADs sent. Yes, it would
also have the effect of pulling in ib_mad.

> I understand the need to have ib_mad loaded before ib_mthca
> since the call to ib_register_device() will cause ib_mad
> to create QP 0 & 1.
> 
> Normally, it looks like ib_register_mad_agent() is used to
> tell the ib_mad module to send MADs to agents like the
> SM, CM, etc.

If what you mean is demultiplex receive MADs, and also entities such as
SM, SMA, PMA, CM, etc., then yes (as well as handle the completions from
sending MADs which have some resouces to clean up).

>From ib_mad.h:
/**
 * ib_register_mad_agent - Register to send/receive MADs.
 * @device: The device to register with.
 * @port_num: The port on the specified device to use.
 * @qp_type: Specifies which QP to access.  Must be either
 *   IB_QPT_SMI or IB_QPT_GSI.
 * @mad_reg_req: Specifies which unsolicited MADs should be received
 *   by the caller.  This parameter may be NULL if the caller only
 *   wishes to receive solicited responses.
 * @rmpp_version: If set, indicates that the client will send
 *   and receive MADs that contain the RMPP header for the given version.
 *   If set to 0, indicates that RMPP is not used by this client.
 * @send_handler: The completion callback routine invoked after a send
 *   request has completed.
 * @recv_handler: The completion callback routine invoked for a received
 *   MAD.
 * @context: User specified context associated with the registration.
 */

-- Hal




More information about the general mailing list