--- /dev/null
+Bottom: 748a708247219f3faae97912aea19d2a10559a20
+Top: 0ff022b3d25b623caed4f1ee1ff0065ca0a1fb49
+Author: Sean Hefty <sean.hefty@intel.com>
+Date: 2013-06-27 23:55:42 -0700
+
+Refresh of add-support-for-preloading-ipv
+
+---
+
+diff --git a/Makefile.am b/Makefile.am
+index de035bc..c97326a 100644
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -20,7 +20,7 @@ man_MANS = \
+
+ EXTRA_DIST = src/acm_mad.h src/libacm.h ibacm.init.in \
+ linux/osd.h linux/dlist.h ibacm.spec.in $(man_MANS) ibacm_opts.cfg \
+- ibacm_addr.cfg
++ ibacm_addr.cfg ibacm_hosts.cfg
+
+ install-exec-hook:
+ install -D -m 755 ibacm.init $(DESTDIR)$(sysconfdir)/init.d/ibacm;
+diff --git a/acm_notes.txt b/acm_notes.txt
+index fac0920..373c0f0 100644
+--- a/acm_notes.txt
++++ b/acm_notes.txt
+@@ -135,3 +135,7 @@ be set to opensm_full_v1 for this file format. Default format is
+ none which does not preload these caches. See dump_pr.notes.txt in dump_pr
+ for more information on the opensm_full_v1 file format and how to configure
+ OpenSM to generate this file.
++
++Additional IPv4 and IPv6 caches can be be preloaded by using the
++hosts_file option. The default is "none" which does not preload these
++caches.
+diff --git a/ibacm_hosts.cfg b/ibacm_hosts.cfg
+new file mode 100644
+index 0000000..9011691
+--- /dev/null
++++ b/ibacm_hosts.cfg
+@@ -0,0 +1,12 @@
++# InfiniBand Communication Management Assistant for clusters hosts file
++#
++# Entry format is:
++# address IB GID
++#
++# address - IPv4 or IPv6 formatted address
++#
++# There can be multiple entries for a single IB GID
++#
++# Samples:
++# 192.168.1.3 fe80::8:f104:39a:169
++# fe80::208:f104:39a:169 fe80::8:f104:39a:169
+diff --git a/man/ibacm.1 b/man/ibacm.1
+index ec97b35..2ca7eec 100644
+--- a/man/ibacm.1
++++ b/man/ibacm.1
+@@ -156,5 +156,9 @@ format. Default format is none which does not preload these caches.
+ See dump_pr.notes.txt in dump_pr for more information on the
+ full_opensm_v1 file format and how to configure OpenSM to
+ generate this file.
++.P
++Additional IPv4 and IPv6 caches can be be preloaded by using the
++hosts_file option. The default is "none" which does not preload these
++caches.
+ .SH "SEE ALSO"
+ ibacm(7), ib_acme(1), rdma_cm(7)
+diff --git a/src/acm.c b/src/acm.c
+index a37ebaa..cb5b809 100644
+--- a/src/acm.c
++++ b/src/acm.c
+@@ -218,7 +218,12 @@ static atomic_t counter[ACM_MAX_COUNTER];
+ static char *acme = BINDIR "/ib_acme -A";
+ static char *opts_file = ACM_CONF_DIR "/" ACM_OPTS_FILE;
+ static char *addr_file = ACM_CONF_DIR "/" ACM_ADDR_FILE;
++<<<<<<< current
+ static char route_data_file[128] = ACM_CONF_DIR "/ibacm_route.data";
++=======
++static char path_rec_file[128] = ACM_CONF_DIR "/" ACM_PATH_REC_FILE;
++static char hosts_file[128] = "none";
++>>>>>>> patched
+ static char log_file[128] = "/var/log/ibacm.log";
+ static int log_level = 0;
+ static char lock_file[128] = "/var/run/ibacm.pid";
+@@ -234,6 +239,7 @@ static int resolve_depth = 1;
+ static int sa_depth = 1;
+ static int send_depth = 1;
+ static int recv_depth = 1024;
++static int hosts_opt = 0;
+ static uint8_t min_mtu = IBV_MTU_2048;
+ static uint8_t min_rate = IBV_RATE_10_GBPS;
+ static enum acm_route_preload route_preload;
+@@ -2788,6 +2794,73 @@ err:
+ return ret;
+ }
+
++static void acm_parse_hosts_file(struct acm_ep *ep)
++{
++ FILE *f;
++ char s[120];
++ char addr[INET6_ADDRSTRLEN], gid[INET6_ADDRSTRLEN];
++ uint8_t name[ACM_MAX_ADDRESS];
++ struct in6_addr ip_addr, ib_addr;
++ struct acm_dest *dest, *new_dest;
++ uint8_t addr_type;
++
++ if (!(f = fopen(hosts_file, "r"))) {
++ acm_log(0, "ERROR - couldn't open %s\n", hosts_file);
++ return;
++ }
++
++ while (fgets(s, sizeof s, f)) {
++ if (s[0] == '#')
++ continue;
++
++ if (sscanf(s, "%46s%46s", addr, gid) != 2)
++ continue;
++
++ acm_log(2, "%s", s);
++ if (inet_pton(AF_INET6, gid, &ib_addr) <= 0) {
++ acm_log(0, "ERROR - %s is not IB GID\n", gid);
++ continue;
++ }
++ if (inet_pton(AF_INET, addr, &ip_addr) > 0)
++ addr_type = ACM_ADDRESS_IP;
++ else if (inet_pton(AF_INET6, addr, &ip_addr) > 0)
++ addr_type = ACM_ADDRESS_IP6;
++ else {
++ acm_log(0, "ERROR - %s is not IP address\n", addr);
++ continue;
++ }
++
++ memset(name, 0, ACM_MAX_ADDRESS);
++ memcpy(name, &ib_addr, sizeof(ib_addr));
++ dest = acm_get_dest(ep, ACM_ADDRESS_GID, name);
++ if (!dest) {
++ acm_log(0, "ERROR - IB GID %s not found in cache\n", gid);
++ continue;
++ }
++
++ memset(name, 0, ACM_MAX_ADDRESS);
++ if (addr_type == ACM_ADDRESS_IP)
++ memcpy(name, &ip_addr, 4);
++ else
++ memcpy(name, &ip_addr, sizeof(ip_addr));
++ new_dest = acm_acquire_dest(ep, addr_type, name);
++ if (!new_dest) {
++ acm_log(0, "ERROR - unable to create dest %s\n", addr);
++ continue;
++ }
++ new_dest->path = dest->path;
++ new_dest->remote_qpn = dest->remote_qpn;
++ new_dest->addr_timeout = dest->addr_timeout;
++ new_dest->route_timeout = dest->route_timeout;
++ new_dest->state = dest->state;
++ acm_put_dest(new_dest);
++ acm_log(1, "added host %s address type %d IB GID %s\n",
++ addr, addr_type, gid);
++ }
++
++ fclose(f);
++}
++
+ static int acm_assign_ep_names(struct acm_ep *ep)
+ {
+ FILE *faddr;
+@@ -3049,7 +3122,23 @@ static void acm_ep_up(struct acm_port *port, uint16_t pkey_index)
+ lock_acquire(&port->lock);
+ DListInsertHead(&ep->entry, &port->ep_list);
+ lock_release(&port->lock);
++<<<<<<< current
+ acm_ep_preload(ep);
++=======
++
++ if (path_rec_fmt == ACM_PATH_REV_FMT_OSM_FULL_V1) {
++ ret = acm_parse_path_records(ep);
++ if (ret)
++ acm_log(1, "unable to find ep in path records\n");
++ }
++
++ if (hosts_opt) {
++ if (path_rec_fmt == ACM_PATH_REV_FMT_NONE)
++ acm_log(0, "when using hosts file option should also use path records option\n");
++ acm_parse_hosts_file(ep);
++ }
++
++>>>>>>> patched
+ return;
+
+ err2:
+@@ -3362,10 +3451,24 @@ static void acm_set_options(void)
+ min_mtu = acm_convert_mtu(atoi(value));
+ else if (!stricmp("min_rate", opt))
+ min_rate = acm_convert_rate(atoi(value));
++<<<<<<< current
+ else if (!stricmp("route_preload", opt))
+ route_preload = acm_convert_route_preload(value);
+ else if (!stricmp("route_data_file", opt))
+ strcpy(route_data_file, value);
++=======
++ else if (!stricmp("path_rec_fmt", opt))
++ path_rec_fmt = acm_convert_path_rec_fmt(value);
++ else if (!stricmp("path_rec_file", opt))
++ strcpy(path_rec_file, value);
++ else if (!stricmp("hosts_file", opt)) {
++ strcpy(hosts_file, value);
++ if (!stricmp(hosts_file, "none"))
++ hosts_opt = 0;
++ else
++ hosts_opt = 1;
++ }
++>>>>>>> patched
+ }
+
+ fclose(f);
+@@ -3389,8 +3492,14 @@ static void acm_log_options(void)
+ acm_log(0, "receive depth %d\n", recv_depth);
+ acm_log(0, "minimum mtu %d\n", min_mtu);
+ acm_log(0, "minimum rate %d\n", min_rate);
++<<<<<<< current
+ acm_log(0, "route preload %d\n", route_preload);
+ acm_log(0, "route data file %s\n", route_data_file);
++=======
++ acm_log(0, "path record format %d\n", path_rec_fmt);
++ acm_log(0, "path record file %s\n", path_rec_file);
++ acm_log(0, "hosts file %s\n", hosts_file);
++>>>>>>> patched
+ }
+
+ static FILE *acm_open_log(void)
+diff --git a/src/acme.c b/src/acme.c
+index 2b89a18..46d93c0 100644
+--- a/src/acme.c
++++ b/src/acme.c
+@@ -260,6 +260,12 @@ static void gen_opts_temp(FILE *f)
+ fprintf(f, "# Default is ACM_CONF_DIR/ibacm_route.data\n");
+ fprintf(f, "# /etc/rdma/ibacm_route.data\n");
+ fprintf(f, "\n");
++ fprintf(f, "# hosts_file:\n");
++ fprintf(f, "# none - No hosts file\n");
++ fprintf(f, "# If hosts_file is other than \"none\", full pathname of hosts file\n");
++ fprintf(f, "\n");
++ fprintf(f, "hosts_file none\n");
++ fprintf(f, "\n");
+ }
+
+ static int open_dir(void)