Whamcloud - gitweb
git://git.whamcloud.com
/
fs
/
lustre-release.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
* 5602 fix improves checks that NID is set correctly and causes incorrect
[fs/lustre-release.git]
/
lnet
/
utils
/
portals.c
diff --git
a/lnet/utils/portals.c
b/lnet/utils/portals.c
index
9c1537b
..
4efca98
100644
(file)
--- a/
lnet/utils/portals.c
+++ b/
lnet/utils/portals.c
@@
-78,6
+78,7
@@
static name2num_t nalnames[] = {
{"gm", GMNAL},
{"openib", OPENIBNAL},
{"iib", IIBNAL},
+ {"vib", VIBNAL},
{"lo", LONAL},
{"ra", RANAL},
#else
@@
-237,8
+238,8
@@
ptl_gethostbyname(char * hname) {
hname);
break;
default:
- fprintf(stderr, "gethostbyname error: %s\n",
-
strerror(
errno));
+ fprintf(stderr, "gethostbyname error
for %s
: %s\n",
+
hname, strerror(h_
errno));
break;
}
return NULL;
@@
-316,8
+317,7
@@
ptl_parse_ipaddr (__u32 *ipaddrp, char *str)
struct hostent *he;
#endif
- if (!strcmp (str, "_all_"))
- {
+ if (!strcmp (str, "_all_")) {
*ipaddrp = 0;
return (0);
}
@@
-325,11
+325,10
@@
ptl_parse_ipaddr (__u32 *ipaddrp, char *str)
if (ptl_parse_ipquad(ipaddrp, str) == 0)
return (0);
-#if
HAVE_GETHOSTBYNAME
+#if
def HAVE_GETHOSTBYNAME
if ((('a' <= str[0] && str[0] <= 'z') ||
('A' <= str[0] && str[0] <= 'Z')) &&
- (he = ptl_gethostbyname (str)) != NULL)
- {
+ (he = ptl_gethostbyname (str)) != NULL) {
__u32 addr = *(__u32 *)he->h_addr;
*ipaddrp = ntohl(addr); /* HOST byte order */
@@
-370,11
+369,6
@@
ptl_parse_nid (ptl_nid_t *nidp, char *str)
char *end;
unsigned long long ullval;
- if (!strcmp (str, "_all_")) {
- *nidp = PTL_NID_ANY;
- return (0);
- }
-
if (ptl_parse_ipaddr (&ipaddr, str) == 0) {
#if !CRAY_PORTALS
*nidp = (ptl_nid_t)ipaddr;
@@
-385,8
+379,8
@@
ptl_parse_nid (ptl_nid_t *nidp, char *str)
}
ullval = strtoull(str, &end, 0);
- if (*end == 0) {
- /* parsed whole string */
+ if (
end != str &&
*end == 0) {
+ /* parsed whole
non-empty
string */
*nidp = (ptl_nid_t)ullval;
return (0);
}
@@
-394,6
+388,17
@@
ptl_parse_nid (ptl_nid_t *nidp, char *str)
return (-1);
}
+int
+ptl_parse_anynid (ptl_nid_t *nidp, char *str)
+{
+ if (!strcmp (str, "_all_")) {
+ *nidp = PTL_NID_ANY;
+ return 0;
+ }
+
+ return ptl_parse_nid(nidp, str);
+}
+
__u64 ptl_nid2u64(ptl_nid_t nid)
{
switch (sizeof (nid)) {
@@
-422,7
+427,7
@@
ptl_nid2str (char *buffer, ptl_nid_t nid)
if (nid & 0xff000000) {
__u32 addr = htonl((__u32)nid); /* back to NETWORK byte order */
- he = gethostbyaddr
((const char *)&addr, sizeof
(addr), AF_INET);
+ he = gethostbyaddr
((const char *)&addr, sizeof
(addr), AF_INET);
}
if (he != NULL)
@@
-676,7
+681,8
@@
jt_ptl_print_peers (int argc, char **argv)
int index;
int rc;
- if (!g_nal_is_compatible (argv[0], SOCKNAL, OPENIBNAL, IIBNAL, RANAL, 0))
+ if (!g_nal_is_compatible (argv[0], SOCKNAL, RANAL,
+ OPENIBNAL, IIBNAL, VIBNAL, 0))
return -1;
for (index = 0;;index++) {
@@
-693,6
+699,11
@@
jt_ptl_print_peers (int argc, char **argv)
ptl_ipaddr_2_str (pcfg.pcfg_size, buffer[0], 1),
ptl_ipaddr_2_str (pcfg.pcfg_id, buffer[1], 1),
pcfg.pcfg_misc, pcfg.pcfg_count);
+ else if (g_nal_is_compatible(NULL, RANAL, OPENIBNAL, 0))
+ printf (LPX64"[%d]@%s:%d\n",
+ pcfg.pcfg_nid, pcfg.pcfg_wait,
+ ptl_ipaddr_2_str (pcfg.pcfg_id, buffer[1], 1),
+ pcfg.pcfg_misc);
else
printf (LPX64"[%d]\n",
pcfg.pcfg_nid, pcfg.pcfg_wait);
@@
-712,17
+723,18
@@
jt_ptl_add_peer (int argc, char **argv)
int port = 0;
int rc;
- if (!g_nal_is_compatible (argv[0], SOCKNAL, OPENIBNAL, IIBNAL, RANAL, 0))
+ if (!g_nal_is_compatible (argv[0], SOCKNAL, RANAL,
+ OPENIBNAL, IIBNAL, VIBNAL, 0))
return -1;
- if (g_nal_is_compatible(NULL, SOCKNAL, RANAL, 0)) {
+ if (g_nal_is_compatible(NULL, SOCKNAL,
OPENIBNAL,
RANAL, 0)) {
if (argc != 4) {
- fprintf (stderr, "usage(tcp): %s nid ipaddr port\n",
+ fprintf (stderr, "usage(tcp
,openib,ra
): %s nid ipaddr port\n",
argv[0]);
return 0;
}
} else if (argc != 2) {
- fprintf (stderr, "usage(
openib,i
ib): %s nid\n", argv[0]);
+ fprintf (stderr, "usage(
iib,v
ib): %s nid\n", argv[0]);
return 0;
}
@@
-732,7
+744,7
@@
jt_ptl_add_peer (int argc, char **argv)
return -1;
}
- if (g_nal_is_compatible (NULL, SOCKNAL, RANAL, 0)) {
+ if (g_nal_is_compatible (NULL, SOCKNAL,
OPENIBNAL,
RANAL, 0)) {
if (ptl_parse_ipaddr (&ip, argv[2]) != 0) {
fprintf (stderr, "Can't parse ip addr: %s\n", argv[2]);
return -1;
@@
-769,7
+781,8
@@
jt_ptl_del_peer (int argc, char **argv)
int argidx;
int rc;
- if (!g_nal_is_compatible (argv[0], SOCKNAL, OPENIBNAL, IIBNAL, RANAL, 0))
+ if (!g_nal_is_compatible (argv[0], SOCKNAL, RANAL,
+ OPENIBNAL, IIBNAL, VIBNAL, 0))
return -1;
if (g_nal_is_compatible(NULL, SOCKNAL, 0)) {
@@
-784,7
+797,7
@@
jt_ptl_del_peer (int argc, char **argv)
}
if (argc > 1 &&
- ptl_parse_nid (&nid, argv[1]) != 0) {
+ ptl_parse_
any
nid (&nid, argv[1]) != 0) {
fprintf (stderr, "Can't parse nid: %s\n", argv[1]);
return -1;
}
@@
-832,7
+845,8
@@
jt_ptl_print_connections (int argc, char **argv)
int index;
int rc;
- if (!g_nal_is_compatible (argv[0], SOCKNAL, OPENIBNAL, IIBNAL, RANAL, 0))
+ if (!g_nal_is_compatible (argv[0], SOCKNAL, RANAL,
+ OPENIBNAL, IIBNAL, VIBNAL, 0))
return -1;
for (index = 0;;index++) {
@@
-857,6
+871,10
@@
jt_ptl_print_connections (int argc, char **argv)
pcfg.pcfg_count, /* tx buffer size */
pcfg.pcfg_size, /* rx buffer size */
pcfg.pcfg_wait ? "nagle" : "nonagle");
+ else if (g_nal_is_compatible (NULL, RANAL, 0))
+ printf ("[%d]"LPX64"\n",
+ pcfg.pcfg_id, /* device id */
+ pcfg.pcfg_nid);
else
printf (LPX64"\n",
pcfg.pcfg_nid);
@@
-1023,11
+1041,12
@@
int jt_ptl_disconnect(int argc, char **argv)
return 0;
}
- if (!g_nal_is_compatible (NULL, SOCKNAL, OPENIBNAL, IIBNAL, RANAL, 0))
+ if (!g_nal_is_compatible (NULL, SOCKNAL, RANAL,
+ OPENIBNAL, IIBNAL, VIBNAL, 0))
return 0;
if (argc >= 2 &&
- ptl_parse_nid (&nid, argv[1]) != 0) {
+ ptl_parse_
any
nid (&nid, argv[1]) != 0) {
fprintf (stderr, "Can't parse nid %s\n", argv[1]);
return -1;
}
@@
-1069,7
+1088,7
@@
int jt_ptl_push_connection (int argc, char **argv)
return -1;
if (argc > 1 &&
- ptl_parse_nid (&nid, argv[1]) != 0) {
+ ptl_parse_
any
nid (&nid, argv[1]) != 0) {
fprintf(stderr, "Can't parse nid: %s\n", argv[1]);
return -1;
}
@@
-1276,7
+1295,7
@@
jt_ptl_fail_nid (int argc, char **argv)
if (!strcmp (argv[1], "_all_"))
nid = PTL_NID_ANY;
- else if (ptl_parse_nid (&nid, argv[1]) != 0)
+ else if (ptl_parse_
any
nid (&nid, argv[1]) != 0)
{
fprintf (stderr, "Can't parse nid \"%s\"\n", argv[1]);
return (-1);