Whamcloud - gitweb
* landing portals b1_4_sfw on HEAD
[fs/lustre-release.git] / lnet / utils / portals.c
index 07fada2..dbe264b 100644 (file)
 #include <time.h>
 #include <stdarg.h>
 #include <endian.h>
+#if CRAY_PORTALS
+#ifdef REDSTORM
+#define __QK__
+#endif
+#include <portals/ipmap.h>
+#endif
 
 #ifdef __CYGWIN__
 
@@ -66,12 +72,20 @@ typedef struct
 
 static name2num_t nalnames[] = {
         {"any",         0},
+#if !CRAY_PORTALS
         {"tcp",                SOCKNAL},
         {"elan",       QSWNAL},
         {"gm",         GMNAL},
         {"openib",      OPENIBNAL},
         {"iib",         IIBNAL},
+        {"vib",         VIBNAL},
         {"lo",          LONAL},
+        {"ra",          RANAL},
+#else
+        {"cray_kern_nal", CRAY_KERN_NAL},
+        {"cray_user_nal", CRAY_USER_NAL},
+        {"cray_qk_nal",   CRAY_QK_NAL},
+#endif
         {NULL,         -1}
 };
 
@@ -363,7 +377,11 @@ ptl_parse_nid (ptl_nid_t *nidp, char *str)
         }
 
         if (ptl_parse_ipaddr (&ipaddr, str) == 0) {
+#if !CRAY_PORTALS
                 *nidp = (ptl_nid_t)ipaddr;
+#else
+                *nidp = (((ptl_nid_t)ipaddr & PNAL_HOSTID_MASK) << PNAL_VNODE_SHIFT);
+#endif
                 return (0);
         }
 
@@ -659,7 +677,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++) {
@@ -676,6 +695,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, 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);
@@ -695,17 +719,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, RANAL, 0)) {
                 if (argc != 4) {
-                        fprintf (stderr, "usage(tcp): %s nid ipaddr port\n", 
+                        fprintf (stderr, "usage(tcp,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(openib,iib,vib): %s nid\n", argv[0]);
                 return 0;
         }
 
@@ -715,7 +740,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, RANAL, 0)) {
                 if (ptl_parse_ipaddr (&ip, argv[2]) != 0) {
                         fprintf (stderr, "Can't parse ip addr: %s\n", argv[2]);
                         return -1;
@@ -752,7 +777,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)) {
@@ -815,7 +841,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++) {
@@ -840,6 +867,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);
@@ -1006,7 +1037,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 &&