[openib-general] [PATCH v2] mad: use GID/LID on requester side when matching responses to requests

Hal Rosenstock halr at voltaire.com
Wed Apr 12 10:45:51 PDT 2006


On Mon, 2006-04-10 at 11:04, Jack Morgenstein wrote:

A couple of commentary comments below...

-- Hal

> Index: src/drivers/infiniband/core/mad.c
> ===================================================================
> --- src/drivers/infiniband/core/mad.c	(revision 6066)
> +++ src/drivers/infiniband/core/mad.c	(working copy)

>  struct ib_mad_send_wr_private*
>  ib_find_send_mad(struct ib_mad_agent_private *mad_agent_priv,
> -		 struct ib_mad_recv_wc *mad_recv_wc)
> +		 struct ib_mad_recv_wc *wc)
>  {
> -	struct ib_mad_send_wr_private *mad_send_wr;
> +	struct ib_mad_send_wr_private *wr;
>  	struct ib_mad *mad;
>  
> -	mad = (struct ib_mad *)mad_recv_wc->recv_buf.mad;
> +	mad = (struct ib_mad *)wc->recv_buf.mad;
>  
> -	list_for_each_entry(mad_send_wr, &mad_agent_priv->wait_list,
> -			    agent_list) {
> -		if ((mad_send_wr->tid == mad->mad_hdr.tid) &&
> -		    rcv_has_same_class(mad_send_wr, mad_recv_wc) &&
> -		    rcv_has_same_gid(mad_send_wr, mad_recv_wc))
> -			return mad_send_wr;
> +	list_for_each_entry(wr, &mad_agent_priv->wait_list, agent_list) {
> +		if ((wr->tid == mad->mad_hdr.tid) &&
> +		    rcv_has_same_class(wr, wc) &&
> +		    /*
> +		     * Don't check GID for direct routed MADs.
> +		     * These might have permissive LIDs.

What's the relevance of the latter comment ? VL15 packets never have
GRHs so there are no GIDs so I think the first comment is sufficient.

> +		     */
> +		    (is_direct(wc->recv_buf.mad->mad_hdr.mgmt_class) ||
> +		     rcv_has_same_gid(mad_agent_priv, wr, wc)))
> +			return wr;
>  	}
>  
>  	/*
>  	 * It's possible to receive the response before we've
>  	 * been notified that the send has completed
>  	 */
> -	list_for_each_entry(mad_send_wr, &mad_agent_priv->send_list,
> -			    agent_list) {
> -		if (is_data_mad(mad_agent_priv, mad_send_wr->send_buf.mad) &&
> -		    mad_send_wr->tid == mad->mad_hdr.tid &&
> -		    mad_send_wr->timeout &&
> -		    rcv_has_same_class(mad_send_wr, mad_recv_wc) &&
> -		    rcv_has_same_gid(mad_send_wr, mad_recv_wc)) {
> +	list_for_each_entry(wr, &mad_agent_priv->send_list, agent_list) {
> +		if (is_data_mad(mad_agent_priv, wr->send_buf.mad) &&
> +		    wr->tid == mad->mad_hdr.tid &&
> +		    wr->timeout &&
> +		    rcv_has_same_class(wr, wc) &&
> +		    /*
> +		     * Don't check GID for direct routed MADs.
> +		     * These might have permissive LIDs.
> +		     */

Same comment as above.

> +		    (is_direct(wc->recv_buf.mad->mad_hdr.mgmt_class) ||
> +		     rcv_has_same_gid(mad_agent_priv, wr, wc)))
>  			/* Verify request has not been canceled */
> -			return (mad_send_wr->status == IB_WC_SUCCESS) ?
> -				mad_send_wr : NULL;
> -		}
> +			return (wr->status == IB_WC_SUCCESS) ? wr : NULL;
>  	}
>  	return NULL;
>  }




More information about the general mailing list