[ofa-general] Re: [PATCH] IB/umad: fix GRH handling

Hal Rosenstock halr at voltaire.com
Wed Mar 21 16:22:00 PDT 2007


On Wed, 2007-03-21 at 01:52, Sean Hefty wrote:
> >> Unfortunately, at least opensm cannot respond to SA queries issued from a
> >> remote subnet.  I'm not sure how much work this would take to fix, or if
> >> other SAs have this issue.  Hal briefly looked at the problems,
> >
> >FWIW, I'll be looking some more at these again.
> 
> I think the following patch corrects the GRH handling issues in ib_umad.
> (Tested loading of ib_umad module only, and not against openSM.)

It can't be tested against OpenSM right now.

> If this looks right,

It looks right to me. I'll need some time to take it out for a test
driver as some other issues need some work to exercise this.

-- Hal

>  I'll add it to my rdma-dev.git ib_router branch
> 
> Signed-off-by: Sean Hefty <sean.hefty at intel.com>
> ---
> diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c
> index c069ebe..7774cf5 100644
> --- a/drivers/infiniband/core/user_mad.c
> +++ b/drivers/infiniband/core/user_mad.c
> @@ -231,12 +231,17 @@ static void recv_handler(struct ib_mad_agent *agent,
>  	packet->mad.hdr.path_bits = mad_recv_wc->wc->dlid_path_bits;
>  	packet->mad.hdr.grh_present = !!(mad_recv_wc->wc->wc_flags & IB_WC_GRH);
>  	if (packet->mad.hdr.grh_present) {
> -		/* XXX parse GRH */
> -		packet->mad.hdr.gid_index 	= 0;
> -		packet->mad.hdr.hop_limit 	= 0;
> -		packet->mad.hdr.traffic_class	= 0;
> -		memset(packet->mad.hdr.gid, 0, 16);
> -		packet->mad.hdr.flow_label	= 0;
> +		struct ib_ah_attr ah_attr;
> +
> +		ib_init_ah_from_wc(agent->device, agent->port_num,
> +				   mad_recv_wc->wc, mad_recv_wc->recv_buf.grh,
> +				   &ah_attr);
> +
> +		packet->mad.hdr.gid_index = ah_attr.grh.sgid_index;
> +		packet->mad.hdr.hop_limit = ah_attr.grh.hop_limit;
> +		packet->mad.hdr.traffic_class = ah_attr.grh.traffic_class;
> +		memcpy(packet->mad.hdr.gid, &ah_attr.grh.dgid, 16);
> +		packet->mad.hdr.flow_label = cpu_to_be32(ah_attr.grh.flow_label);
>  	}
>  
>  	if (queue_packet(file, agent, packet))
> @@ -473,6 +478,7 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf,
>  	if (packet->mad.hdr.grh_present) {
>  		ah_attr.ah_flags = IB_AH_GRH;
>  		memcpy(ah_attr.grh.dgid.raw, packet->mad.hdr.gid, 16);
> +		ah_attr.grh.sgid_index	   = packet->mad.hdr.gid_index;
>  		ah_attr.grh.flow_label 	   = be32_to_cpu(packet->mad.hdr.flow_label);
>  		ah_attr.grh.hop_limit  	   = packet->mad.hdr.hop_limit;
>  		ah_attr.grh.traffic_class  = packet->mad.hdr.traffic_class;
> 




More information about the general mailing list