]> git.openfabrics.org - ~shefty/ibacm.git/commitdiff
ibacm: Automatically select local port if not specified by path record
authorSean Hefty <sean.hefty@intel.com>
Mon, 4 Jun 2012 18:38:54 +0000 (11:38 -0700)
committerSean Hefty <sean.hefty@intel.com>
Tue, 5 Jun 2012 16:24:16 +0000 (09:24 -0700)
If the user specifies a DLID or DGID as part of a path record lookup,
automatically select a local port.  This allows a user to query an SA
without needing to specify the local SLID or SGID.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
src/acm.c

index c940df3ab60338b168ca26b44027165ee53c78d9..b6fa32fcfbe878305f31fddb640fbb82e11628bf 100644 (file)
--- a/src/acm.c
+++ b/src/acm.c
@@ -956,7 +956,7 @@ acm_record_path_addr(struct acm_ep *ep, struct acm_dest *dest,
                dest->path.sgid = path->sgid;
                dest->path.slid = path->slid;
        } else {
-               dest->path.slid = ep->port->lid;
+               dest->path.slid = htons(ep->port->lid);
        }
        dest->path.dlid = path->dlid;
        dest->state = ACM_ADDR_RESOLVED;
@@ -1762,6 +1762,10 @@ acm_is_path_from_port(struct acm_port *port, struct ibv_path_record *path)
                return (port->lid == (ntohs(path->slid) & port->lid_mask));
        }
 
+       if (ib_any_gid(&path->dgid)) {
+               return 1;
+       }
+
        if (acm_gid_index(port, &path->dgid) < port->gid_cnt) {
                return 1;
        }