[openib-general] Re: [PATCH] mad: add GID/class checking for matching received to sent MADs

Sean Hefty mshefty at ichips.intel.com
Tue Feb 28 12:48:56 PST 2006


Jack Morgenstein wrote:
> +static inline int rcv_has_same_gid(struct ib_mad_send_wr_private *wr,
> +				   struct ib_mad_recv_wc *rwc )
> +{
> +	struct ib_ah_attr attr;
> +	u8 send_resp, rcv_resp;
> +
> +	send_resp = ((struct ib_mad *)(wr->send_buf.mad))->
> +		     mad_hdr.method & IB_MGMT_METHOD_RESP;
> +	rcv_resp = rwc->recv_buf.mad->mad_hdr.method & IB_MGMT_METHOD_RESP;
> +
> +	if (!send_resp && rcv_resp)
> +		/* is request/response. GID/LIDs are both local (same). */
> +		return 1;
> +
> +	if (send_resp == rcv_resp)
> +		/* both requests, or both responses. GIDs different */
> +		return 0;

The two checks above are only checking response bits of a sent and received MAD. 
  How do these relate to checking the GIDs?

> +	if (ib_query_ah(wr->send_buf.ah, &attr))
> +		/* Assume not equal, to avoid false positives. */
> +		return 0;

Querying for the address handle every time seems expensive.  Can't we save the 
necessary information inside the ah?  Failing that, we should move the query 
when sending a MAD, so it can be done once.

- Sean



More information about the general mailing list