--- /dev/null
+Bottom: 1fcbb0d2b361b8a2ed7ce1d4252ecc8c4be8ae71
+Top: ddad54aad21e16422c9bd58df41234de480031db
+Author: Sean Hefty <sean.hefty@intel.com>
+Date: 2010-12-15 17:22:11 -0800
+
+Refresh of xref-lid
+
+---
+
+diff --git a/src/acm.c b/src/acm.c
+index 4ec01e8..b6dc799 100644
+--- a/src/acm.c
++++ b/src/acm.c
+@@ -280,6 +280,11 @@ acm_format_name(int level, char *name, size_t name_size,
+ }
+ }
+
++static int ib_gid_any(union ibv_gid *gid)
++{
++ return ((gid->subnet_prefix | gid->interface_id) == 0);
++}
++
+ static int acm_compare_dest(const void *dest1, const void *dest2)
+ {
+ return memcmp(dest1, dest2, ACM_MAX_ADDRESS);
+@@ -1708,6 +1713,16 @@ static uint8_t acm_svr_query_sa(struct acm_ep *ep, struct acm_request *req)
+ return ACM_STATUS_SUCCESS;
+ }
+
++static int
++acm_is_port_addr(struct acm_port *port, struct ibv_path_record *path)
++{
++ if (path->slid) {
++ return (port->lid == ntohs(path.slid) & port->lmc);
++ new_ah->src_path_mask = (1 << port_attr.lmc) - 1
++ }
++
++}
++
+ static struct acm_ep *
+ acm_get_ep(struct acm_ep_addr_data *data)
+ {
+@@ -1768,12 +1783,6 @@ acm_svr_query(struct acm_client *client, struct acm_resolve_msg *msg)
+ goto resp;
+ }
+
+- if (msg->data[0].type != ACM_EP_INFO_PATH) {
+- acm_log(0, "ERROR - unsupported type: 0x%x\n", msg->data[0].type);
+- status = ACM_STATUS_EINVAL;
+- goto resp;
+- }
+-
+ ep = acm_get_ep(&msg->data[0]);
+ if (!ep) {
+ acm_log(1, "notice - could not find local end point\n");
+@@ -2060,6 +2069,99 @@ put:
+ return ret;
+ }
+
++static int
++acm_svr_resolve_path(struct acm_client *client, struct acm_resolve_msg *msg)
++{
++ struct acm_ep *ep;
++ struct acm_dest *dest;
++ struct ibv_path_record *path;
++ uint8_t addr[ACM_MAX_ADDRESS];
++ uint8_t status;
++ int ret;
++
++ acm_log(2, "client %d\n", client->index);
++ if (msg->hdr.length < (ACM_MSG_HDR_LENGTH + ACM_MSG_EP_LENGTH)) {
++ acm_log(0, "notice - invalid msg hdr length %d\n", msg->hdr.length);
++ return acm_client_resolve_resp(client, msg, NULL, ACM_STATUS_EINVAL);
++ }
++
++ path = &msg->data[0].info.path;
++ if (!path->dlid && ib_any_gid(&path->dgid)) {
++ acm_log(0, "notice - no destination specified\n");
++ return acm_client_resolve_resp(client, msg, NULL, ACM_STATUS_EDESTADDR);
++ }
++
++ ep = acm_get_ep(&msg->data[0]);
++ if (!ep) {
++ acm_log(0, "notice - unknown local end point\n");
++ return acm_client_resolve_resp(client, msg, NULL, ACM_STATUS_ESRCADDR);
++ }
++/*
++ acm_format_name(2, log_data, sizeof log_data,
++ saddr->type, saddr->info.addr, sizeof saddr->info.addr);
++ acm_log(2, "src %s\n", log_data);
++ ep = acm_get_ep(saddr);
++ if (!ep) {
++ acm_log(0, "notice - unknown local end point\n");
++ return acm_client_resolve_resp(client, msg, NULL, ACM_STATUS_ESRCADDR);
++ }
++
++ acm_format_name(2, log_data, sizeof log_data,
++ daddr->type, daddr->info.addr, sizeof daddr->info.addr);
++ acm_log(2, "dest %s\n", log_data);
++
++ dest = acm_acquire_dest(ep, daddr->type, daddr->info.addr);
++ if (!dest) {
++ acm_log(0, "ERROR - unable to allocate destination in client request\n");
++ return acm_client_resolve_resp(client, msg, NULL, ACM_STATUS_ENOMEM);
++ }
++
++ lock_acquire(&dest->lock);
++ switch (dest->state) {
++ case ACM_READY:
++ acm_log(2, "request satisfied from local cache\n");
++ status = ACM_STATUS_SUCCESS;
++ break;
++ case ACM_ADDR_RESOLVED:
++ acm_log(2, "have address, resolving route\n");
++ status = acm_resolve_path(ep, dest, acm_dest_sa_resp);
++ if (status) {
++ break;
++ }
++ goto queue;
++ case ACM_INIT:
++ acm_log(2, "sending resolve msg to dest\n");
++ status = acm_send_resolve(ep, dest, saddr);
++ if (status) {
++ break;
++ }
++ dest->state = ACM_QUERY_ADDR;
++*/
++ /* fall through */
++/*
++ default:
++queue:
++ if (daddr->flags & ACM_FLAGS_NODELAY) {
++ acm_log(2, "lookup initiated, but client wants no delay\n");
++ status = ACM_STATUS_ENODATA;
++ break;
++ }
++ status = acm_svr_queue_req(dest, client, msg);
++ if (status) {
++ break;
++ }
++ ret = 0;
++ lock_release(&dest->lock);
++ goto put;
++ }
++ lock_release(&dest->lock);
++ ret = acm_client_resolve_resp(client, msg, dest, status);
++*/
++put:
++ acm_put_dest(dest);
++ return ret;
++}
++
+ static void acm_svr_receive(struct acm_client *client)
+ {
+ struct acm_msg msg;
+@@ -2085,7 +2187,11 @@ static void acm_svr_receive(struct acm_client *client)
+ }
+
+ if (resolve_msg->data[0].type == ACM_EP_INFO_PATH) {
+- ret = acm_svr_query(client, resolve_msg);
++ if (resolve_msg->data[0].flags & ACM_FLAGS_QUERY_SA) {
++ ret = acm_svr_query(client, resolve_msg);
++ } else {
++ ret = acm_svr_resolve_path(client, resolve_msg);
++ }
+ } else {
+ ret = acm_svr_resolve(client, resolve_msg);
+ }