I digged out following Linux code, which check hop_limit. Might need to get 
Linux guys for comments as well.



int ib_init_ah_from_path(struct ib_device *device, u8 port_num,
                         struct ib_sa_path_rec *rec, struct ib_ah_attr *ah_attr)
{
        int ret;
        u16 gid_index;

        memset(ah_attr, 0, sizeof *ah_attr);
        ah_attr->dlid = be16_to_cpu(rec->dlid);
        ah_attr->sl = rec->sl;
        ah_attr->src_path_bits = be16_to_cpu(rec->slid) &
                                 get_src_path_mask(device, port_num);
        ah_attr->port_num = port_num;
        ah_attr->static_rate = rec->rate;

        if (rec->hop_limit > 1) {
                ah_attr->ah_flags = IB_AH_GRH;
                ah_attr->grh.dgid = rec->dgid;

                ret = ib_find_cached_gid(device, &rec->sgid, &port_num,
                                         &gid_index);
                if (ret)
                        return ret;

                ah_attr->grh.sgid_index    = gid_index;
                ah_attr->grh.flow_label    = be32_to_cpu(rec->flow_label);
                ah_attr->grh.hop_limit     = rec->hop_limit;
                ah_attr->grh.traffic_class = rec->traffic_class;
        }
        return 0;
} 

-----Original Message-----
From: Sean Hefty [mailto:[email protected]] 
Sent: Thursday, December 03, 2009 4:02 PM
To: James Yang; Tzachi Dar; [email protected]
Subject: RE: [ofw] patch 2/2 Add support for RDMAoEth to the low level driver

>It's a field inside cm req path record. This path information is passed 
>over wire during cm hand shaking, and remote will decide to use gid or 
>local lid to communicate.
>
>>> >+ // make this same as Linux code: p_path->hop_flow_raw >= 2
>>> means grh present.
>>> >+ if(cl_hton32(p_path->hop_flow_raw) >= 2)  p_av->attr.grh_valid = 
>>> >+ 1;

A couple of notes.  First, the check here looks wrong.  It should only check 
against the hop count, not the entire 32-bit field, which includes the flow 
label.
 
Second, the hop count has been used to indicate if an IB GRH is required 
because the packet may cross a router.  With RDMAoE, a router is not involved, 
so a hop count of 0 or 1 are still valid.  It's not even clear what an RDMAoE 
path record is, but I can't imagine that the hop count would be defined as 
needing to be >= 2.

- Sean

_______________________________________________
ofw mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/ofw

Reply via email to