Whamcloud - gitweb
- another merge of b_devel into b_ad
authorbraam <braam>
Wed, 9 Jul 2003 18:39:54 +0000 (18:39 +0000)
committerbraam <braam>
Wed, 9 Jul 2003 18:39:54 +0000 (18:39 +0000)
12 files changed:
lnet/archdep.m4
lnet/include/linux/kp30.h
lnet/include/lnet/types.h
lnet/libcfs/debug.c
lnet/lnet/lib-move.c
lnet/utils/portals.c
lustre/portals/archdep.m4
lustre/portals/include/linux/kp30.h
lustre/portals/include/portals/types.h
lustre/portals/libcfs/debug.c
lustre/portals/portals/lib-move.c
lustre/portals/utils/portals.c

index 16455a5..c107a74 100644 (file)
@@ -116,6 +116,13 @@ case ${host_cpu} in
         MOD_LINK=elf64_ia64
 ;;
 
+       x86_64 )
+       AC_MSG_RESULT($host_cpu)
+        KCFLAGS='-g -O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fomit-frame-pointer -mno-red-zone -mcmodel=kernel -pipe -fno-reorder-blocks -finline-limit=2000 -fno-strength-reduce -fno-asynchronous-unwind-tables'
+       KCPPFLAGS='-D__KERNEL__ -DMODULE'
+        MOD_LINK=elf_x86_64
+;;
+
        sparc64 )
        AC_MSG_RESULT($host_cpu)
         KCFLAGS='-O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fomit-frame-pointer -fno-strict-aliasing -fno-common -Wno-unused -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow -ffixed-g4 -fcall-used-g5 -fcall-used-g7 -Wno-sign-compare -Wa,--undeclared-regs'
index 9f30cce..8f3a1ab 100644 (file)
@@ -48,6 +48,7 @@ extern unsigned int portal_printk;
 #define S_COBD        (21 << 24)
 #define S_PTLBD       (22 << 24)
 #define S_LOG         (23 << 24)
+#define S_MGMT        (24 << 24)
 
 /* If you change these values, please keep portals/linux/utils/debug.c
  * up to date! */
index d4038b6..0269290 100644 (file)
@@ -2,14 +2,19 @@
 #define _P30_TYPES_H_
 
 #ifdef __linux__
-#include <asm/types.h>
-#include <asm/timex.h>
+# include <asm/types.h>
+# include <asm/timex.h>
 #else
-#include <sys/types.h>
+# include <sys/types.h>
 typedef u_int32_t __u32;
 typedef u_int64_t __u64;
-typedef unsigned long long cycles_t;
-static inline cycles_t get_cycles(void) { return 0; }
+#endif
+
+#ifdef __KERNEL__
+# include <linux/time.h>
+#else
+# include <sys/time.h>
+# define do_gettimeofday(tv) gettimeofday(tv, NULL)
 #endif
 
 typedef __u64 ptl_nid_t;
@@ -31,7 +36,7 @@ typedef ptl_handle_any_t ptl_handle_md_t;
 typedef ptl_handle_any_t ptl_handle_me_t;
 
 #define PTL_HANDLE_NONE \
-((const ptl_handle_any_t){.nal_idx = -1, .cookie = -1})
+    ((const ptl_handle_any_t){.nal_idx = -1, .cookie = -1})
 #define PTL_EQ_NONE PTL_HANDLE_NONE
 
 static inline int PtlHandleEqual (ptl_handle_any_t h1, ptl_handle_any_t h2)
@@ -108,17 +113,15 @@ typedef struct {
         ptl_handle_me_t unlinked_me;
         ptl_md_t mem_desc;
         ptl_hdr_data_t hdr_data;
-        cycles_t  arrival_time;
+        struct timeval arrival_time;
         volatile ptl_seq_t sequence;
 } ptl_event_t;
 
-
 typedef enum {
         PTL_ACK_REQ,
         PTL_NOACK_REQ
 } ptl_ack_req_t;
 
-
 typedef struct {
         volatile ptl_seq_t sequence;
         ptl_size_t size;
@@ -130,7 +133,6 @@ typedef struct {
         ptl_eq_t *eq;
 } ptl_ni_t;
 
-
 typedef struct {
         int max_match_entries;    /* max number of match entries */
         int max_mem_descriptors;  /* max number of memory descriptors */
index 6cdf101..2c6ba6c 100644 (file)
@@ -572,8 +572,8 @@ int portals_debug_init(unsigned long bufsize)
         memset(debug_buf, 0, debug_size);
         debug_wrapped = 0;
 
-        printk(KERN_INFO "Portals: allocated %lu byte debug buffer at %p.\n",
-               bufsize, debug_buf);
+        //printk(KERN_INFO "Portals: allocated %lu byte debug buffer at %p.\n",
+               //bufsize, debug_buf);
         atomic_set(&debug_off_a, debug_off);
         notifier_chain_register(&panic_notifier_list, &lustre_panic_notifier);
         debug_size = bufsize;
index fde4f16..02f8b60 100644 (file)
@@ -544,7 +544,7 @@ get_new_msg (nal_cb_t *nal, lib_md_t *md)
         msg->send_ack = 0;
 
         msg->md = md;
-        msg->ev.arrival_time = get_cycles();
+        do_gettimeofday(&msg->ev.arrival_time);
         md->pending++;
         if (md->threshold != PTL_MD_THRESH_INF) {
                 LASSERT (md->threshold > 0);
index 90d66f5..a89f4f7 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <stdio.h>
 #include <sys/types.h>
+#include <netdb.h>
 #include <sys/socket.h>
 #include <netinet/tcp.h>
 #include <netdb.h>
@@ -106,6 +107,27 @@ nal2name (int nal)
         return ((e == NULL) ? "???" : e->name);
 }
 
+static struct hostent *
+ptl_gethostbyname(char * hname) {
+        struct hostent *he;
+        he = gethostbyname(hname);
+        if (!he) {
+                switch(h_errno) {
+                case HOST_NOT_FOUND:
+                case NO_ADDRESS:
+                        fprintf(stderr, "Unable to resolve hostname: %s\n",
+                                hname);
+                        break;
+                default:
+                        fprintf(stderr, "gethostbyname error: %s\n",
+                                strerror(errno));
+                        break;
+                }
+                return NULL;
+        }
+        return he;
+}
+
 int
 ptl_parse_nid (ptl_nid_t *nidp, char *str)
 {
@@ -127,7 +149,7 @@ ptl_parse_nid (ptl_nid_t *nidp, char *str)
         
         if ((('a' <= str[0] && str[0] <= 'z') ||
              ('A' <= str[0] && str[0] <= 'Z')) &&
-             (he = gethostbyname (str)) != NULL)
+             (he = ptl_gethostbyname (str)) != NULL)
         {
                 __u32 addr = *(__u32 *)he->h_addr;
 
@@ -351,12 +373,9 @@ int jt_ptl_connect(int argc, char **argv)
                         goto usage;
                 }
 
-                he = gethostbyname(argv[1]);
-                if (!he) {
-                        fprintf(stderr, "gethostbyname error: %s\n",
-                                strerror(errno));
+                he = ptl_gethostbyname(argv[1]);
+                if (!he)
                         return -1;
-                }
 
                 g_port = atol(argv[2]);
 
@@ -525,12 +544,9 @@ int jt_ptl_disconnect(int argc, char **argv)
 
                 PORTAL_IOC_INIT(data);
                 if (argc == 2) {
-                        he = gethostbyname(argv[1]);
-                        if (!he) {
-                                fprintf(stderr, "gethostbyname error: %s\n",
-                                        strerror(errno));
+                        he = ptl_gethostbyname(argv[1]);
+                        if (!he) 
                                 return -1;
-                        }
                         
                         data.ioc_nid = ntohl (*(__u32 *)he->h_addr); /* HOST byte order */
 
@@ -582,12 +598,9 @@ int jt_ptl_push_connection (int argc, char **argv)
 
                 PORTAL_IOC_INIT(data);
                 if (argc == 2) {
-                        he = gethostbyname(argv[1]);
-                        if (!he) {
-                                fprintf(stderr, "gethostbyname error: %s\n",
-                                        strerror(errno));
+                        he = ptl_gethostbyname(argv[1]);
+                        if (!he)
                                 return -1;
-                        }
                         
                         data.ioc_nid = ntohl (*(__u32 *)he->h_addr); /* HOST byte order */
 
index 16455a5..c107a74 100644 (file)
@@ -116,6 +116,13 @@ case ${host_cpu} in
         MOD_LINK=elf64_ia64
 ;;
 
+       x86_64 )
+       AC_MSG_RESULT($host_cpu)
+        KCFLAGS='-g -O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fomit-frame-pointer -mno-red-zone -mcmodel=kernel -pipe -fno-reorder-blocks -finline-limit=2000 -fno-strength-reduce -fno-asynchronous-unwind-tables'
+       KCPPFLAGS='-D__KERNEL__ -DMODULE'
+        MOD_LINK=elf_x86_64
+;;
+
        sparc64 )
        AC_MSG_RESULT($host_cpu)
         KCFLAGS='-O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fomit-frame-pointer -fno-strict-aliasing -fno-common -Wno-unused -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow -ffixed-g4 -fcall-used-g5 -fcall-used-g7 -Wno-sign-compare -Wa,--undeclared-regs'
index 9f30cce..8f3a1ab 100644 (file)
@@ -48,6 +48,7 @@ extern unsigned int portal_printk;
 #define S_COBD        (21 << 24)
 #define S_PTLBD       (22 << 24)
 #define S_LOG         (23 << 24)
+#define S_MGMT        (24 << 24)
 
 /* If you change these values, please keep portals/linux/utils/debug.c
  * up to date! */
index d4038b6..0269290 100644 (file)
@@ -2,14 +2,19 @@
 #define _P30_TYPES_H_
 
 #ifdef __linux__
-#include <asm/types.h>
-#include <asm/timex.h>
+# include <asm/types.h>
+# include <asm/timex.h>
 #else
-#include <sys/types.h>
+# include <sys/types.h>
 typedef u_int32_t __u32;
 typedef u_int64_t __u64;
-typedef unsigned long long cycles_t;
-static inline cycles_t get_cycles(void) { return 0; }
+#endif
+
+#ifdef __KERNEL__
+# include <linux/time.h>
+#else
+# include <sys/time.h>
+# define do_gettimeofday(tv) gettimeofday(tv, NULL)
 #endif
 
 typedef __u64 ptl_nid_t;
@@ -31,7 +36,7 @@ typedef ptl_handle_any_t ptl_handle_md_t;
 typedef ptl_handle_any_t ptl_handle_me_t;
 
 #define PTL_HANDLE_NONE \
-((const ptl_handle_any_t){.nal_idx = -1, .cookie = -1})
+    ((const ptl_handle_any_t){.nal_idx = -1, .cookie = -1})
 #define PTL_EQ_NONE PTL_HANDLE_NONE
 
 static inline int PtlHandleEqual (ptl_handle_any_t h1, ptl_handle_any_t h2)
@@ -108,17 +113,15 @@ typedef struct {
         ptl_handle_me_t unlinked_me;
         ptl_md_t mem_desc;
         ptl_hdr_data_t hdr_data;
-        cycles_t  arrival_time;
+        struct timeval arrival_time;
         volatile ptl_seq_t sequence;
 } ptl_event_t;
 
-
 typedef enum {
         PTL_ACK_REQ,
         PTL_NOACK_REQ
 } ptl_ack_req_t;
 
-
 typedef struct {
         volatile ptl_seq_t sequence;
         ptl_size_t size;
@@ -130,7 +133,6 @@ typedef struct {
         ptl_eq_t *eq;
 } ptl_ni_t;
 
-
 typedef struct {
         int max_match_entries;    /* max number of match entries */
         int max_mem_descriptors;  /* max number of memory descriptors */
index 6cdf101..2c6ba6c 100644 (file)
@@ -572,8 +572,8 @@ int portals_debug_init(unsigned long bufsize)
         memset(debug_buf, 0, debug_size);
         debug_wrapped = 0;
 
-        printk(KERN_INFO "Portals: allocated %lu byte debug buffer at %p.\n",
-               bufsize, debug_buf);
+        //printk(KERN_INFO "Portals: allocated %lu byte debug buffer at %p.\n",
+               //bufsize, debug_buf);
         atomic_set(&debug_off_a, debug_off);
         notifier_chain_register(&panic_notifier_list, &lustre_panic_notifier);
         debug_size = bufsize;
index fde4f16..02f8b60 100644 (file)
@@ -544,7 +544,7 @@ get_new_msg (nal_cb_t *nal, lib_md_t *md)
         msg->send_ack = 0;
 
         msg->md = md;
-        msg->ev.arrival_time = get_cycles();
+        do_gettimeofday(&msg->ev.arrival_time);
         md->pending++;
         if (md->threshold != PTL_MD_THRESH_INF) {
                 LASSERT (md->threshold > 0);
index 90d66f5..a89f4f7 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <stdio.h>
 #include <sys/types.h>
+#include <netdb.h>
 #include <sys/socket.h>
 #include <netinet/tcp.h>
 #include <netdb.h>
@@ -106,6 +107,27 @@ nal2name (int nal)
         return ((e == NULL) ? "???" : e->name);
 }
 
+static struct hostent *
+ptl_gethostbyname(char * hname) {
+        struct hostent *he;
+        he = gethostbyname(hname);
+        if (!he) {
+                switch(h_errno) {
+                case HOST_NOT_FOUND:
+                case NO_ADDRESS:
+                        fprintf(stderr, "Unable to resolve hostname: %s\n",
+                                hname);
+                        break;
+                default:
+                        fprintf(stderr, "gethostbyname error: %s\n",
+                                strerror(errno));
+                        break;
+                }
+                return NULL;
+        }
+        return he;
+}
+
 int
 ptl_parse_nid (ptl_nid_t *nidp, char *str)
 {
@@ -127,7 +149,7 @@ ptl_parse_nid (ptl_nid_t *nidp, char *str)
         
         if ((('a' <= str[0] && str[0] <= 'z') ||
              ('A' <= str[0] && str[0] <= 'Z')) &&
-             (he = gethostbyname (str)) != NULL)
+             (he = ptl_gethostbyname (str)) != NULL)
         {
                 __u32 addr = *(__u32 *)he->h_addr;
 
@@ -351,12 +373,9 @@ int jt_ptl_connect(int argc, char **argv)
                         goto usage;
                 }
 
-                he = gethostbyname(argv[1]);
-                if (!he) {
-                        fprintf(stderr, "gethostbyname error: %s\n",
-                                strerror(errno));
+                he = ptl_gethostbyname(argv[1]);
+                if (!he)
                         return -1;
-                }
 
                 g_port = atol(argv[2]);
 
@@ -525,12 +544,9 @@ int jt_ptl_disconnect(int argc, char **argv)
 
                 PORTAL_IOC_INIT(data);
                 if (argc == 2) {
-                        he = gethostbyname(argv[1]);
-                        if (!he) {
-                                fprintf(stderr, "gethostbyname error: %s\n",
-                                        strerror(errno));
+                        he = ptl_gethostbyname(argv[1]);
+                        if (!he) 
                                 return -1;
-                        }
                         
                         data.ioc_nid = ntohl (*(__u32 *)he->h_addr); /* HOST byte order */
 
@@ -582,12 +598,9 @@ int jt_ptl_push_connection (int argc, char **argv)
 
                 PORTAL_IOC_INIT(data);
                 if (argc == 2) {
-                        he = gethostbyname(argv[1]);
-                        if (!he) {
-                                fprintf(stderr, "gethostbyname error: %s\n",
-                                        strerror(errno));
+                        he = ptl_gethostbyname(argv[1]);
+                        if (!he)
                                 return -1;
-                        }
                         
                         data.ioc_nid = ntohl (*(__u32 *)he->h_addr); /* HOST byte order */