[ofa-general] [PATCH] infiniband/core: Enable loopback of DR SMP responses from userspace

Sean Hefty mshefty at ichips.intel.com
Tue Sep 4 17:54:53 PDT 2007


> @@ -754,6 +755,7 @@ static int handle_outgoing_dr_smp(struct ib_mad_agent_private *mad_agent_priv,
>  		if (port_priv) {
>  			mad_priv->mad.mad.mad_hdr.tid =
>  				((struct ib_mad *)smp)->mad_hdr.tid;
> +			memcpy(&mad_priv->mad.mad, smp, sizeof(struct ib_mad));

I'm having a hard time understanding the impact of this change.  If I'm 
reading the code correctly, mad_priv->mad should contain the response 
from the device process_mad() routine.  This changes that response.  Can 
you provide more details describing the effect this change has on the 
existing behavior?

Also, I think we can eliminate setting the tid, since the memcpy will 
set that as well.

>  			recv_mad_agent = find_mad_agent(port_priv,
>  						        &mad_priv->mad.mad);
>  		}
> diff --git a/drivers/infiniband/core/smi.h b/drivers/infiniband/core/smi.h
> index 1cfc298..d96fc8e 100644
> --- a/drivers/infiniband/core/smi.h
> +++ b/drivers/infiniband/core/smi.h
> @@ -71,4 +71,18 @@ static inline enum smi_action smi_check_local_smp(struct ib_smp *smp,
>  		(smp->hop_ptr == smp->hop_cnt + 1)) ?
>  		IB_SMI_HANDLE : IB_SMI_DISCARD);
>  }
> +
> +/*
> + * Return 1 if the SMP response should be handled by the local management stack
> + */

The comment is off here - return IB_SMI_HANDLE.  (It's off for 
smi_check_local_smp() as well.)

> +static inline enum smi_action smi_check_local_resp_smp(struct ib_smp *smp,
> +						       struct ib_device *device)
> +{
> +	/* C14-13:3 -- We're at the end of the DR segment of path */
> +	/* C14-13:4 -- Hop Pointer == 0 -> give to SM */
> +	return ((device->process_mad &&
> +		ib_get_smp_direction(smp) &&
> +		!smp->hop_ptr) ? IB_SMI_HANDLE : IB_SMI_DISCARD);
> +}

- Sean



More information about the general mailing list