From 72d994d0f481e5cacea1b69c8170691b343f261d Mon Sep 17 00:00:00 2001 From: eeb Date: Mon, 26 Sep 2005 08:01:22 +0000 Subject: [PATCH] * Added vibnal arp patch from 8206 --- lustre/utils/Makefile.am | 3 +- lustre/utils/lconf | 4 ++- lustre/utils/llmount.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 95 insertions(+), 2 deletions(-) diff --git a/lustre/utils/Makefile.am b/lustre/utils/Makefile.am index daf9480..3e8498f 100644 --- a/lustre/utils/Makefile.am +++ b/lustre/utils/Makefile.am @@ -43,7 +43,8 @@ obdio_SOURCES = obdio.c obdiolib.c obdiolib.h obdbarrier_SOURCES = obdbarrier.c obdiolib.c obdiolib.h lfs_SOURCES = lfs.c parser.c obd.c llmount_SOURCES = llmount.c -llmount_LDADD = $(LIBREADLINE) $(LIBPTLCTL) +llmount_CFLAGS = $(LLMOUNT_GM_CFLAGS) +llmount_LDADD = $(LIBREADLINE) $(LIBPTLCTL) $(LLMOUNT_GM_LDADD) llmount_DEPENDENCIES := $(LIBPTLCTL) EXTRA_DIST = $(bin_scripts) $(sbin_scripts) diff --git a/lustre/utils/lconf b/lustre/utils/lconf index da888a8..0a7f3c5 100755 --- a/lustre/utils/lconf +++ b/lustre/utils/lconf @@ -1110,7 +1110,9 @@ def sys_get_local_nid(net_type, wildcard, cluster_id): fixme("automatic local address for loopback") elif net_type == 'gm': found=0 - paths = ['/usr/sbin', config.portals + "/utils"] + paths = ['/usr/sbin'] + if config.portals: + paths = paths + [config.portals + "/utils"] for path in paths: gmnalnid = path + '/gmnalnid' if (os.path.exists(gmnalnid) and os.access(gmnalnid, os.X_OK)): diff --git a/lustre/utils/llmount.c b/lustre/utils/llmount.c index 73a36aa..84d5e68 100644 --- a/lustre/utils/llmount.c +++ b/lustre/utils/llmount.c @@ -383,6 +383,80 @@ get_local_elan_id(char *fname, char *buf) return (rc == 1) ? 0 : -1; } +#if !CRAY_PORTALS +#if WITH_GM +#include +#define GM_UNIT 0 + +int getgmnid(char *name, ptl_nid_t *nid) +{ + struct gm_port *gm_port; + int gm_port_id = 2; + gm_status_t gm_status = GM_SUCCESS; + unsigned global_nid = 0, local_nid = 0; /* gm ids never 0 */ + + gm_status = gm_init(); + if (gm_status != GM_SUCCESS) { + fprintf(stderr, "gm_init: %s\n", gm_strerror(gm_status)); + return(0); + } + + gm_status = gm_open(&gm_port, GM_UNIT, gm_port_id, "gmnalnid", + GM_API_VERSION); + if (gm_status != GM_SUCCESS) { + int num_ports = gm_num_ports(gm_port); + + /* Couldn't open port 2, try 4 ... num_ports */ + for (gm_port_id = 4; gm_port_id < num_ports; gm_port_id++) { + gm_status = gm_open(&gm_port, GM_UNIT, gm_port_id, + "gmnalnid", GM_API_VERSION); + if (gm_status == GM_SUCCESS) + break; + } + + if (gm_status != GM_SUCCESS) { + fprintf(stderr, "gm_open: %s\n",gm_strerror(gm_status)); + gm_finalize(); + return(0); + } + } + + if (name == NULL) { + local_nid = 1; + } else { + gm_status = gm_host_name_to_node_id_ex(gm_port, 1000000, name, + &local_nid); + if (gm_status != GM_SUCCESS) { + fprintf(stderr, "gm_host_name_to_node_id_ex: %s\n", + gm_strerror(gm_status)); + gm_close(gm_port); + gm_finalize(); + return(0); + } + } + + gm_status = gm_node_id_to_global_id(gm_port, local_nid, &global_nid) ; + if (gm_status != GM_SUCCESS) { + fprintf(stderr, "gm_node_id_to_global_id: %s\n", + gm_strerror(gm_status)); + gm_close(gm_port); + gm_finalize(); + return(0); + } + gm_close(gm_port); + gm_finalize(); + + *nid = (__u64)global_nid; + return 1; +} +#else +int getgmnid(char *name, ptl_nid_t *nid) +{ + return 0; +} +#endif +#endif + int set_local(struct lustre_mount_data *lmd) { @@ -459,6 +533,13 @@ set_local(struct lustre_mount_data *lmd) break; } #if !CRAY_PORTALS + case GMNAL: + if (!getgmnid(NULL, &lmd->lmd_local_nid)) { + fprintf(stderr, "Can't get local GM NID\n"); + return 1; + } + return 0; + case QSWNAL: { char *pfiles[] = {"/proc/qsnet/elan3/device0/position", @@ -554,6 +635,15 @@ set_peer(char *hostname, struct lustre_mount_data *lmd) } break; #if !CRAY_PORTALS + case GMNAL: + if (lmd->lmd_server_nid != PTL_NID_ANY) + break; + if (!getgmnid(hostname, &lmd->lmd_server_nid)) { + fprintf(stderr, "Can't get GM NID for %s\n", hostname); + return 1; + } + break; + case QSWNAL: { char buf[64]; -- 1.8.3.1