-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
* Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
*
* This file is part of Portals, http://www.sf.net/projects/lustre/
}
char *
-ptl_ipaddr_2_str (__u32 ipaddr, char *str, int lookup)
+ptl_ipaddr_2_str(__u32 ipaddr, char *str, size_t strsize, int lookup)
{
#ifdef HAVE_GETHOSTBYNAME
__u32 net_ip;
net_ip = htonl (ipaddr);
he = gethostbyaddr (&net_ip, sizeof (net_ip), AF_INET);
if (he != NULL) {
- strcpy(str, he->h_name);
+ strncpy(str, he->h_name, strsize - 1);
+ str[strsize - 1] = '\0';
return (str);
}
}
jt_ptl_print_interfaces (int argc, char **argv)
{
struct libcfs_ioctl_data data;
- char buffer[3][64];
+ char buffer[3][HOST_NAME_MAX + 1];
int index;
int rc;
break;
printf ("%s: (%s/%s) npeer %d nroute %d\n",
- ptl_ipaddr_2_str(data.ioc_u32[0], buffer[2], 1),
- ptl_ipaddr_2_str(data.ioc_u32[0], buffer[0], 0),
- ptl_ipaddr_2_str(data.ioc_u32[1], buffer[1], 0),
+ ptl_ipaddr_2_str(data.ioc_u32[0], buffer[2],
+ sizeof(buffer[2]), 1),
+ ptl_ipaddr_2_str(data.ioc_u32[0], buffer[0],
+ sizeof(buffer[0]), 0),
+ ptl_ipaddr_2_str(data.ioc_u32[1], buffer[1],
+ sizeof(buffer[1]), 0),
data.ioc_u32[2], data.ioc_u32[3]);
}
{
struct libcfs_ioctl_data data;
lnet_process_id_t id;
- char buffer[2][64];
+ char buffer[2][HOST_NAME_MAX + 1];
int index;
int rc;
if (!g_net_is_compatible (argv[0], SOCKLND, RALND, PTLLND, MXLND,
- O2IBLND, 0))
+ O2IBLND, GNILND, 0))
return -1;
for (index = 0;;index++) {
printf ("%-20s [%d]%s->%s:%d #%d\n",
libcfs_id2str(id),
data.ioc_count, /* persistence */
- ptl_ipaddr_2_str (data.ioc_u32[2], buffer[0], 1), /* my ip */
- ptl_ipaddr_2_str (data.ioc_u32[0], buffer[1], 1), /* peer ip */
+ /* my ip */
+ ptl_ipaddr_2_str(data.ioc_u32[2], buffer[0],
+ sizeof(buffer[0]), 1),
+ /* peer ip */
+ ptl_ipaddr_2_str(data.ioc_u32[0], buffer[1],
+ sizeof(buffer[1]), 1),
data.ioc_u32[1], /* peer port */
data.ioc_u32[3]); /* conn_count */
} else if (g_net_is_compatible(NULL, PTLLND, 0)) {
printf ("%-20s [%d]@%s:%d\n",
libcfs_nid2str(data.ioc_nid), /* peer nid */
data.ioc_count, /* peer persistence */
- ptl_ipaddr_2_str (data.ioc_u32[0], buffer[1], 1), /* peer ip */
+ /* peer ip */
+ ptl_ipaddr_2_str(data.ioc_u32[0], buffer[1],
+ sizeof(buffer[1]), 1),
data.ioc_u32[1]); /* peer port */
+ } else if (g_net_is_compatible(NULL, GNILND, 0)) {
+ int disconn = data.ioc_flags >> 16;
+ char *state;
+
+ if (disconn)
+ state = "D";
+ else
+ state = data.ioc_flags & 0xffff ? "C" : "U";
+
+ printf ("%-20s (%d) %s [%d] "LPU64" "
+ "sq %d/%d tx %d/%d/%d\n",
+ libcfs_nid2str(data.ioc_nid), /* peer nid */
+ data.ioc_net, /* gemini device id */
+ state, /* peer is Connecting, Up, or Down */
+ data.ioc_count, /* peer refcount */
+ data.ioc_u64[0], /* peerstamp */
+ data.ioc_u32[2], data.ioc_u32[3], /* tx and rx seq */
+ /* fmaq, nfma, nrdma */
+ data.ioc_u32[0], data.ioc_u32[1], data.ioc_u32[4]
+ );
} else {
printf ("%-20s [%d]\n",
libcfs_nid2str(data.ioc_nid), data.ioc_count);
int port = 0;
int rc;
- if (!g_net_is_compatible (argv[0], SOCKLND, RALND, 0))
+ if (!g_net_is_compatible (argv[0], SOCKLND, RALND,
+ GNILND, 0))
return -1;
if (argc != 4) {
- fprintf (stderr, "usage(tcp,ra): %s nid ipaddr port\n",
+ fprintf (stderr, "usage(tcp,ra,gni): %s nid ipaddr port\n",
argv[0]);
return 0;
}
int rc;
if (!g_net_is_compatible (argv[0], SOCKLND, RALND, MXLND, PTLLND,
- O2IBLND, 0))
+ O2IBLND, GNILND, 0))
return -1;
if (g_net_is_compatible(NULL, SOCKLND, 0)) {
{
struct libcfs_ioctl_data data;
lnet_process_id_t id;
- char buffer[2][64];
+ char buffer[2][HOST_NAME_MAX + 1];
int index;
int rc;
- if (!g_net_is_compatible (argv[0], SOCKLND, RALND, MXLND, O2IBLND, 0))
+ if (!g_net_is_compatible (argv[0], SOCKLND, RALND, MXLND, O2IBLND,
+ GNILND, 0))
return -1;
for (index = 0; ; index++) {
(data.ioc_u32[3] == SOCKLND_CONN_BULK_IN) ? "I" :
(data.ioc_u32[3] == SOCKLND_CONN_BULK_OUT) ? "O" : "?",
data.ioc_u32[4], /* scheduler */
- ptl_ipaddr_2_str (data.ioc_u32[2], buffer[0], 1), /* local IP addr */
- ptl_ipaddr_2_str (data.ioc_u32[0], buffer[1], 1), /* remote IP addr */
+ /* local IP addr */
+ ptl_ipaddr_2_str(data.ioc_u32[2], buffer[0],
+ sizeof(buffer[0]), 1),
+ /* remote IP addr */
+ ptl_ipaddr_2_str(data.ioc_u32[0], buffer[1],
+ sizeof(buffer[1]), 1),
data.ioc_u32[1], /* remote port */
data.ioc_count, /* tx buffer size */
data.ioc_u32[5], /* rx buffer size */
printf ("%s mtu %d\n",
libcfs_nid2str(data.ioc_nid),
data.ioc_u32[0]); /* path MTU */
+ } else if (g_net_is_compatible (NULL, GNILND, 0)) {
+ printf ("%-20s [%d]\n",
+ libcfs_nid2str(data.ioc_nid),
+ data.ioc_u32[0] /* device id */);
} else {
printf ("%s\n", libcfs_nid2str(data.ioc_nid));
}
return 0;
}
- if (!g_net_is_compatible (NULL, SOCKLND, RALND, MXLND, O2IBLND, 0))
+ if (!g_net_is_compatible (NULL, SOCKLND, RALND, MXLND, O2IBLND,
+ GNILND, 0))
return 0;
if (argc >= 2 &&
return 0;
}
- if (!g_net_is_compatible (argv[0], SOCKLND, 0))
+ if (!g_net_is_compatible (argv[0], SOCKLND, GNILND, 0))
return -1;
if (argc > 1 &&