Whamcloud - gitweb
b_2036
authoryoufeng <youfeng>
Wed, 29 Oct 2003 03:47:13 +0000 (03:47 +0000)
committeryoufeng <youfeng>
Wed, 29 Oct 2003 03:47:13 +0000 (03:47 +0000)
formats nids for readability, from "nid" to "nid (format)"
nid    : using LPX64 everywhere
format : "%u:%d.%d.%d.%d" for IP NIDS (leading part iscluster ID)
         "%u:%u" for non-IP NIDs (leading part is cluster ID)

16 files changed:
lnet/include/linux/kp30.h
lnet/klnds/scimaclnd/scimacnal.c
lnet/klnds/scimaclnd/scimacnal_cb.c
lnet/libcfs/debug.c
lnet/libcfs/module.c
lnet/router/router.c
lnet/tests/ping_cli.c
lnet/tests/sping_cli.c
lustre/portals/include/linux/kp30.h
lustre/portals/knals/scimacnal/scimacnal.c
lustre/portals/knals/scimacnal/scimacnal_cb.c
lustre/portals/libcfs/debug.c
lustre/portals/libcfs/module.c
lustre/portals/router/router.c
lustre/portals/tests/ping_cli.c
lustre/portals/tests/sping_cli.c

index aef9522..9656c83 100644 (file)
@@ -595,6 +595,7 @@ extern struct prof_ent prof_ents[MAX_PROFS];
 #endif /* PORTALS_PROFILING */
 
 /* debug.c */
+char *portals_nid2str(int nal, ptl_nid_t nid, char *str);
 void portals_run_upcall(char **argv);
 void portals_run_lbug_upcall(char * file, const char *fn, const int line);
 void portals_debug_dumplog(void);
@@ -1043,6 +1044,8 @@ extern ptl_handle_ni_t  kgmnal_ni;
 extern ptl_handle_ni_t  kscimacnal_ni;
 #endif
 
+#define PTL_NALFMT_SIZE         16
+
 #define NAL_MAX_NR (NAL_ENUM_END_MARKER - 1)
 
 #define NAL_CMD_REGISTER_PEER_FD     100
index f3fe617..5ffba31 100644 (file)
@@ -123,7 +123,7 @@ static nal_t *kscimacnal_init(int interface, ptl_pt_index_t  ptl_size,
 {
         int     nnids = 512; /* FIXME: Need ScaMac funktion to get #nodes */
 
-        CDEBUG(D_NET, "calling lib_init with nid 0x%Lx nnids %d\n", kscimacnal_data.ksci_nid, nnids);
+        CDEBUG(D_NET, "calling lib_init with nid "LPX64" nnids %d\n", kscimacnal_data.ksci_nid, nnids);
         lib_init(&kscimacnal_lib, kscimacnal_data.ksci_nid, 0, nnids,ptl_size, ac_size); 
         return &kscimacnal_api;
 }
index 7d5796e..b31c2ea 100644 (file)
@@ -208,7 +208,7 @@ kscimacnal_sendmsg(nal_cb_t        *nal,
         unsigned long   physaddr;
         
 
-        CDEBUG(D_NET, "sending %d bytes from %p/%p to nid 0x%Lx niov: %d\n",
+        CDEBUG(D_NET, "sending %d bytes from %p/%p to nid "LPX64" niov: %d\n",
                payload_len, payload_iov, payload_kiov, nid, payload_niov);
 
         /* Basic sanity checks */
index a42d422..aca06a6 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/kmod.h>
 #include <linux/notifier.h>
 #include <linux/kernel.h>
-#include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/string.h>
 #include <linux/stat.h>
@@ -920,8 +919,30 @@ void portals_run_lbug_upcall(char *file, const char *fn, const int line)
         portals_run_upcall (argv);
 }
 
+char *portals_nid2str(int nal, ptl_nid_t nid, char *str)
+{
+        switch(nal){
+        case TCPNAL:
+                /* userspace NAL */
+        case SOCKNAL:
+                sprintf(str, "%u:%d.%d.%d.%d", (__u32)(nid >> 32),
+                        HIPQUAD(nid));
+                break;
+        case QSWNAL:
+        case GMNAL:
+        case TOENAL:
+        case SCIMACNAL:
+                sprintf(str, "%u:%u", (__u32)(nid >> 32), (__u32)nid);
+                break;
+        default:
+                return NULL;
+        }
+        return str;
+}
+
 EXPORT_SYMBOL(portals_debug_dumplog);
 EXPORT_SYMBOL(portals_debug_msg);
 EXPORT_SYMBOL(portals_debug_set_level);
 EXPORT_SYMBOL(portals_run_upcall);
 EXPORT_SYMBOL(portals_run_lbug_upcall);
+EXPORT_SYMBOL(portals_nid2str);
index c51a506..bfa959d 100644 (file)
@@ -326,6 +326,7 @@ static int kportal_ioctl(struct inode *inode, struct file *file,
         int err = 0;
         char buf[1024];
         struct portal_ioctl_data *data;
+        char str[PTL_NALFMT_SIZE];
 
         ENTRY;
 
@@ -379,8 +380,9 @@ static int kportal_ioctl(struct inode *inode, struct file *file,
         case IOC_PORTAL_PING: {
                 void (*ping)(struct portal_ioctl_data *);
 
-                CDEBUG(D_IOCTL, "doing %d pings to nid "LPU64"\n",
-                       data->ioc_count, data->ioc_nid);
+                CDEBUG(D_IOCTL, "doing %d pings to nid "LPX64" (%s)\n",
+                       data->ioc_count, data->ioc_nid,
+                       portals_nid2str(data->ioc_nal, data->ioc_nid, str));
                 ping = PORTAL_SYMBOL_GET(kping_client);
                 if (!ping)
                         CERROR("PORTAL_SYMBOL_GET failed\n");
@@ -434,7 +436,7 @@ static int kportal_ioctl(struct inode *inode, struct file *file,
                 const ptl_handle_ni_t *nip;
                 ptl_process_id_t       pid;
 
-                CDEBUG (D_IOCTL, "Getting nid [%d]\n", data->ioc_nal);
+                CDEBUG (D_IOCTL, "Getting nid for nal [%d]\n", data->ioc_nal);
 
                 nip = kportal_get_ni (data->ioc_nal);
                 if (nip == NULL)
index b5bab2c..e29f628 100644 (file)
@@ -126,12 +126,16 @@ kpr_do_upcall (void *arg)
 void
 kpr_upcall (int gw_nalid, ptl_nid_t gw_nid, int alive, time_t when)
 {
+        char str[PTL_NALFMT_SIZE];
+        
         /* May be in arbitrary context */
         kpr_upcall_t  *u = kmalloc (sizeof (kpr_upcall_t), GFP_ATOMIC);
 
         if (u == NULL) {
-                CERROR ("Upcall out of memory: nal %d nid "LPX64" %s\n",
-                        gw_nalid, gw_nid, alive ? "up" : "down");
+                CERROR ("Upcall out of memory: nal %d nid "LPX64" (%s) %s\n",
+                        gw_nalid, gw_nid,
+                        portals_nid2str(gw_nalid, gw_nid, str),
+                        alive ? "up" : "down");
                 return;
         }
 
@@ -155,6 +159,7 @@ kpr_do_notify (int byNal, int gateway_nalid, ptl_nid_t gateway_nid,
         struct timeval       now;
        struct list_head    *e;
        struct list_head    *n;
+        char                 str[PTL_NALFMT_SIZE];
 
         CDEBUG (D_NET, "%s notifying [%d] "LPX64": %s\n", 
                 byNal ? "NAL" : "userspace", 
@@ -253,8 +258,9 @@ kpr_do_notify (int byNal, int gateway_nalid, ptl_nid_t gateway_nid,
         
         if (byNal) {
                 /* It wasn't userland that notified me... */
-                CWARN ("Upcall: NAL %d NID "LPX64" is %s\n",
+                CWARN ("Upcall: NAL %d NID "LPX64" (%s) is %s\n",
                        gateway_nalid, gateway_nid,
+                       portals_nid2str(gateway_nalid, gateway_nid, str),
                        alive ? "alive" : "dead");
                 kpr_upcall (gateway_nalid, gateway_nid, alive, when);
         } else {
index 22bdb45..85c0d71 100644 (file)
@@ -111,11 +111,15 @@ pingcli_start(struct portal_ioctl_data *args)
         unsigned ping_bulk_magic = PING_BULK_MAGIC;
         int rc;
         struct timeval tv1, tv2;
+        char str[PTL_NALFMT_SIZE];
+        
         client->tsk = current;
         client->args = args;
-        CDEBUG (D_OTHER, "pingcli_setup args: nid "LPX64",  \
+        CDEBUG (D_OTHER, "pingcli_setup args: nid "LPX64" (%s),  \
                         nal %d, size %u, count: %u, timeout: %u\n",
-                        args->ioc_nid, args->ioc_nal, args->ioc_size,
+                        args->ioc_nid,
+                        portals_nid2str(args->ioc_nal, args->ioc_nid, str),
+                        args->ioc_nal, args->ioc_size,
                         args->ioc_count, args->ioc_timeout);
 
 
index c37db4c..64a1dd2 100644 (file)
@@ -104,14 +104,17 @@ pingcli_start(struct portal_ioctl_data *args)
 {
         const ptl_handle_ni_t *nip;
         unsigned ping_head_magic = PING_HEADER_MAGIC;
+        char str[PTL_NALFMT_SIZE];
         int rc;
 
         client->tsk = current;
         client->args = args;
 
-        CDEBUG (D_OTHER, "pingcli_setup args: nid "LPX64",  \
+        CDEBUG (D_OTHER, "pingcli_setup args: nid "LPX64" (%s),  \
                         nal %d, size %u, count: %u, timeout: %u\n",
-                        args->ioc_nid, args->ioc_nal, args->ioc_size,
+                        args->ioc_nid,
+                        portals_nid2str(args->ioc_nid, args->ioc_nal, str),
+                        args->ioc_nal, args->ioc_size,
                         args->ioc_count, args->ioc_timeout);
 
 
index aef9522..9656c83 100644 (file)
@@ -595,6 +595,7 @@ extern struct prof_ent prof_ents[MAX_PROFS];
 #endif /* PORTALS_PROFILING */
 
 /* debug.c */
+char *portals_nid2str(int nal, ptl_nid_t nid, char *str);
 void portals_run_upcall(char **argv);
 void portals_run_lbug_upcall(char * file, const char *fn, const int line);
 void portals_debug_dumplog(void);
@@ -1043,6 +1044,8 @@ extern ptl_handle_ni_t  kgmnal_ni;
 extern ptl_handle_ni_t  kscimacnal_ni;
 #endif
 
+#define PTL_NALFMT_SIZE         16
+
 #define NAL_MAX_NR (NAL_ENUM_END_MARKER - 1)
 
 #define NAL_CMD_REGISTER_PEER_FD     100
index f3fe617..5ffba31 100644 (file)
@@ -123,7 +123,7 @@ static nal_t *kscimacnal_init(int interface, ptl_pt_index_t  ptl_size,
 {
         int     nnids = 512; /* FIXME: Need ScaMac funktion to get #nodes */
 
-        CDEBUG(D_NET, "calling lib_init with nid 0x%Lx nnids %d\n", kscimacnal_data.ksci_nid, nnids);
+        CDEBUG(D_NET, "calling lib_init with nid "LPX64" nnids %d\n", kscimacnal_data.ksci_nid, nnids);
         lib_init(&kscimacnal_lib, kscimacnal_data.ksci_nid, 0, nnids,ptl_size, ac_size); 
         return &kscimacnal_api;
 }
index 7d5796e..b31c2ea 100644 (file)
@@ -208,7 +208,7 @@ kscimacnal_sendmsg(nal_cb_t        *nal,
         unsigned long   physaddr;
         
 
-        CDEBUG(D_NET, "sending %d bytes from %p/%p to nid 0x%Lx niov: %d\n",
+        CDEBUG(D_NET, "sending %d bytes from %p/%p to nid "LPX64" niov: %d\n",
                payload_len, payload_iov, payload_kiov, nid, payload_niov);
 
         /* Basic sanity checks */
index a42d422..aca06a6 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/kmod.h>
 #include <linux/notifier.h>
 #include <linux/kernel.h>
-#include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/string.h>
 #include <linux/stat.h>
@@ -920,8 +919,30 @@ void portals_run_lbug_upcall(char *file, const char *fn, const int line)
         portals_run_upcall (argv);
 }
 
+char *portals_nid2str(int nal, ptl_nid_t nid, char *str)
+{
+        switch(nal){
+        case TCPNAL:
+                /* userspace NAL */
+        case SOCKNAL:
+                sprintf(str, "%u:%d.%d.%d.%d", (__u32)(nid >> 32),
+                        HIPQUAD(nid));
+                break;
+        case QSWNAL:
+        case GMNAL:
+        case TOENAL:
+        case SCIMACNAL:
+                sprintf(str, "%u:%u", (__u32)(nid >> 32), (__u32)nid);
+                break;
+        default:
+                return NULL;
+        }
+        return str;
+}
+
 EXPORT_SYMBOL(portals_debug_dumplog);
 EXPORT_SYMBOL(portals_debug_msg);
 EXPORT_SYMBOL(portals_debug_set_level);
 EXPORT_SYMBOL(portals_run_upcall);
 EXPORT_SYMBOL(portals_run_lbug_upcall);
+EXPORT_SYMBOL(portals_nid2str);
index c51a506..bfa959d 100644 (file)
@@ -326,6 +326,7 @@ static int kportal_ioctl(struct inode *inode, struct file *file,
         int err = 0;
         char buf[1024];
         struct portal_ioctl_data *data;
+        char str[PTL_NALFMT_SIZE];
 
         ENTRY;
 
@@ -379,8 +380,9 @@ static int kportal_ioctl(struct inode *inode, struct file *file,
         case IOC_PORTAL_PING: {
                 void (*ping)(struct portal_ioctl_data *);
 
-                CDEBUG(D_IOCTL, "doing %d pings to nid "LPU64"\n",
-                       data->ioc_count, data->ioc_nid);
+                CDEBUG(D_IOCTL, "doing %d pings to nid "LPX64" (%s)\n",
+                       data->ioc_count, data->ioc_nid,
+                       portals_nid2str(data->ioc_nal, data->ioc_nid, str));
                 ping = PORTAL_SYMBOL_GET(kping_client);
                 if (!ping)
                         CERROR("PORTAL_SYMBOL_GET failed\n");
@@ -434,7 +436,7 @@ static int kportal_ioctl(struct inode *inode, struct file *file,
                 const ptl_handle_ni_t *nip;
                 ptl_process_id_t       pid;
 
-                CDEBUG (D_IOCTL, "Getting nid [%d]\n", data->ioc_nal);
+                CDEBUG (D_IOCTL, "Getting nid for nal [%d]\n", data->ioc_nal);
 
                 nip = kportal_get_ni (data->ioc_nal);
                 if (nip == NULL)
index b5bab2c..e29f628 100644 (file)
@@ -126,12 +126,16 @@ kpr_do_upcall (void *arg)
 void
 kpr_upcall (int gw_nalid, ptl_nid_t gw_nid, int alive, time_t when)
 {
+        char str[PTL_NALFMT_SIZE];
+        
         /* May be in arbitrary context */
         kpr_upcall_t  *u = kmalloc (sizeof (kpr_upcall_t), GFP_ATOMIC);
 
         if (u == NULL) {
-                CERROR ("Upcall out of memory: nal %d nid "LPX64" %s\n",
-                        gw_nalid, gw_nid, alive ? "up" : "down");
+                CERROR ("Upcall out of memory: nal %d nid "LPX64" (%s) %s\n",
+                        gw_nalid, gw_nid,
+                        portals_nid2str(gw_nalid, gw_nid, str),
+                        alive ? "up" : "down");
                 return;
         }
 
@@ -155,6 +159,7 @@ kpr_do_notify (int byNal, int gateway_nalid, ptl_nid_t gateway_nid,
         struct timeval       now;
        struct list_head    *e;
        struct list_head    *n;
+        char                 str[PTL_NALFMT_SIZE];
 
         CDEBUG (D_NET, "%s notifying [%d] "LPX64": %s\n", 
                 byNal ? "NAL" : "userspace", 
@@ -253,8 +258,9 @@ kpr_do_notify (int byNal, int gateway_nalid, ptl_nid_t gateway_nid,
         
         if (byNal) {
                 /* It wasn't userland that notified me... */
-                CWARN ("Upcall: NAL %d NID "LPX64" is %s\n",
+                CWARN ("Upcall: NAL %d NID "LPX64" (%s) is %s\n",
                        gateway_nalid, gateway_nid,
+                       portals_nid2str(gateway_nalid, gateway_nid, str),
                        alive ? "alive" : "dead");
                 kpr_upcall (gateway_nalid, gateway_nid, alive, when);
         } else {
index 22bdb45..85c0d71 100644 (file)
@@ -111,11 +111,15 @@ pingcli_start(struct portal_ioctl_data *args)
         unsigned ping_bulk_magic = PING_BULK_MAGIC;
         int rc;
         struct timeval tv1, tv2;
+        char str[PTL_NALFMT_SIZE];
+        
         client->tsk = current;
         client->args = args;
-        CDEBUG (D_OTHER, "pingcli_setup args: nid "LPX64",  \
+        CDEBUG (D_OTHER, "pingcli_setup args: nid "LPX64" (%s),  \
                         nal %d, size %u, count: %u, timeout: %u\n",
-                        args->ioc_nid, args->ioc_nal, args->ioc_size,
+                        args->ioc_nid,
+                        portals_nid2str(args->ioc_nal, args->ioc_nid, str),
+                        args->ioc_nal, args->ioc_size,
                         args->ioc_count, args->ioc_timeout);
 
 
index c37db4c..64a1dd2 100644 (file)
@@ -104,14 +104,17 @@ pingcli_start(struct portal_ioctl_data *args)
 {
         const ptl_handle_ni_t *nip;
         unsigned ping_head_magic = PING_HEADER_MAGIC;
+        char str[PTL_NALFMT_SIZE];
         int rc;
 
         client->tsk = current;
         client->args = args;
 
-        CDEBUG (D_OTHER, "pingcli_setup args: nid "LPX64",  \
+        CDEBUG (D_OTHER, "pingcli_setup args: nid "LPX64" (%s),  \
                         nal %d, size %u, count: %u, timeout: %u\n",
-                        args->ioc_nid, args->ioc_nal, args->ioc_size,
+                        args->ioc_nid,
+                        portals_nid2str(args->ioc_nid, args->ioc_nal, str),
+                        args->ioc_nal, args->ioc_size,
                         args->ioc_count, args->ioc_timeout);