Whamcloud - gitweb
* Made openib not use the subnet manager to discover connection parameters
[fs/lustre-release.git] / lnet / utils / portals.c
index 29717fa..9dc47da 100644 (file)
@@ -78,6 +78,7 @@ static name2num_t nalnames[] = {
         {"gm",         GMNAL},
         {"openib",      OPENIBNAL},
         {"iib",         IIBNAL},
+        {"vib",         VIBNAL},
         {"lo",          LONAL},
         {"ra",          RANAL},
 #else
@@ -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        
+#ifdef 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 */
@@ -422,7 +421,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 +675,8 @@ jt_ptl_print_peers (int argc, char **argv)
         int                      index;
         int                      rc;
 
-        if (!g_nal_is_compatible (argv[0], SOCKNAL, OPENIBNAL, IIBNAL, 0))
+        if (!g_nal_is_compatible (argv[0], SOCKNAL, RANAL, 
+                                  OPENIBNAL, IIBNAL, VIBNAL, 0))
                 return -1;
 
         for (index = 0;;index++) {
@@ -693,6 +693,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 +717,18 @@ jt_ptl_add_peer (int argc, char **argv)
         int                      port = 0;
         int                      rc;
 
-        if (!g_nal_is_compatible (argv[0], SOCKNAL, OPENIBNAL, IIBNAL, 0))
+        if (!g_nal_is_compatible (argv[0], SOCKNAL, RANAL, 
+                                  OPENIBNAL, IIBNAL, VIBNAL, 0))
                 return -1;
 
-        if (g_nal_is_compatible(NULL, SOCKNAL, 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,iib): %s nid\n", argv[0]);
+                fprintf (stderr, "usage(iib,vib): %s nid\n", argv[0]);
                 return 0;
         }
 
@@ -732,7 +738,7 @@ jt_ptl_add_peer (int argc, char **argv)
                 return -1;
         }
 
-        if (g_nal_is_compatible (NULL, SOCKNAL, 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 +775,8 @@ jt_ptl_del_peer (int argc, char **argv)
         int                      argidx;
         int                      rc;
 
-        if (!g_nal_is_compatible (argv[0], SOCKNAL, OPENIBNAL, IIBNAL, 0))
+        if (!g_nal_is_compatible (argv[0], SOCKNAL, RANAL, 
+                                  OPENIBNAL, IIBNAL, VIBNAL, 0))
                 return -1;
 
         if (g_nal_is_compatible(NULL, SOCKNAL, 0)) {
@@ -832,7 +839,8 @@ jt_ptl_print_connections (int argc, char **argv)
         int                      index;
         int                      rc;
 
-        if (!g_nal_is_compatible (argv[0], SOCKNAL, OPENIBNAL, IIBNAL, 0))
+        if (!g_nal_is_compatible (argv[0], SOCKNAL, RANAL, 
+                                  OPENIBNAL, IIBNAL, VIBNAL, 0))
                 return -1;
 
         for (index = 0;;index++) {
@@ -857,6 +865,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,7 +1035,8 @@ int jt_ptl_disconnect(int argc, char **argv)
                 return 0;
         }
 
-        if (!g_nal_is_compatible (NULL, SOCKNAL, OPENIBNAL, IIBNAL, 0))
+        if (!g_nal_is_compatible (NULL, SOCKNAL, RANAL, 
+                                  OPENIBNAL, IIBNAL, VIBNAL, 0))
                 return 0;
 
         if (argc >= 2 &&