diff mbox

[RFC] Set HopLimit based on off subnet Re: SRP issues with OpenSM 3.3.3

Message ID 20091215185511.3ae458cc.weiny2@llnl.gov (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Ira Weiny Dec. 16, 2009, 2:55 a.m. UTC
None
diff mbox

Patch

diff --git a/opensm/opensm/osm_sa_path_record.c b/opensm/opensm/osm_sa_path_record.c
index be0cd71..1fa83a1 100644
--- a/opensm/opensm/osm_sa_path_record.c
+++ b/opensm/opensm/osm_sa_path_record.c
@@ -757,6 +757,14 @@  Exit:
        return (status);
 }
 
+static int gid_is_off_subnet(IN osm_sa_t * sa, IN const ib_gid_t * p_dgid)
+{
+       return (!ib_gid_is_link_local(p_dgid) &&
+               !ib_gid_is_multicast(p_dgid) &&
+               ib_gid_get_subnet_prefix(p_dgid) !=
+               sa->p_subn->opt.subnet_prefix);
+}
+
 /**********************************************************************
  **********************************************************************/
 static void pr_rcv_build_pr(IN osm_sa_t * sa, IN const osm_port_t * p_src_port,
@@ -770,16 +778,12 @@  static void pr_rcv_build_pr(IN osm_sa_t * sa, IN const osm_port_t * p_src_port,
 {
        const osm_physp_t *p_src_physp;
        const osm_physp_t *p_dest_physp;
-       boolean_t is_nonzero_gid = 0;
 
        OSM_LOG_ENTER(sa->p_log);
 
        p_src_physp = p_src_port->p_physp;
 
        if (p_dgid)
-               is_nonzero_gid = ib_gid_is_notzero(p_dgid);
-
-       if (is_nonzero_gid)
                p_pr->dgid = *p_dgid;
        else {
                p_dest_physp = p_dest_port->p_physp;
@@ -799,7 +803,7 @@  static void pr_rcv_build_pr(IN osm_sa_t * sa, IN const osm_port_t * p_src_port,
        p_pr->hop_flow_raw &= cl_hton32(1 << 31);
 
        /* Only set HopLimit if going through a router */
-       if (is_nonzero_gid)
+       if (gid_is_off_subnet(sa, &p_pr->dgid))
                p_pr->hop_flow_raw |= cl_hton32(IB_HOPLIMIT_MAX);
 
        p_pr->pkey = p_parms->pkey;
@@ -1248,10 +1252,7 @@  static ib_net16_t pr_rcv_get_end_points(IN osm_sa_t * sa,
                memset(p_dgid, 0, sizeof(*p_dgid));
 
        if (comp_mask & IB_PR_COMPMASK_DGID) {
-               if (!ib_gid_is_link_local(&p_pr->dgid) &&
-                   !ib_gid_is_multicast(&p_pr->dgid) &&
-                   ib_gid_get_subnet_prefix(&p_pr->dgid) !=
-                   sa->p_subn->opt.subnet_prefix) {
+               if (gid_is_off_subnet(sa, &p_pr->dgid)) {
                        dest_guid = find_router(sa, p_pr->dgid.unicast.prefix);
                        if (!dest_guid) {
                                char gid_str[INET6_ADDRSTRLEN];