From 0642c091d076e3747e70860930994ca6ec07f6e3 Mon Sep 17 00:00:00 2001 From: braam Date: Wed, 9 Jul 2003 18:39:54 +0000 Subject: [PATCH] - another merge of b_devel into b_ad --- lnet/archdep.m4 | 7 ++++++ lnet/include/linux/kp30.h | 1 + lnet/include/lnet/types.h | 22 +++++++++-------- lnet/libcfs/debug.c | 4 +-- lnet/lnet/lib-move.c | 2 +- lnet/utils/portals.c | 45 ++++++++++++++++++++++------------ lustre/portals/archdep.m4 | 7 ++++++ lustre/portals/include/linux/kp30.h | 1 + lustre/portals/include/portals/types.h | 22 +++++++++-------- lustre/portals/libcfs/debug.c | 4 +-- lustre/portals/portals/lib-move.c | 2 +- lustre/portals/utils/portals.c | 45 ++++++++++++++++++++++------------ 12 files changed, 104 insertions(+), 58 deletions(-) diff --git a/lnet/archdep.m4 b/lnet/archdep.m4 index 16455a5..c107a74 100644 --- a/lnet/archdep.m4 +++ b/lnet/archdep.m4 @@ -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' diff --git a/lnet/include/linux/kp30.h b/lnet/include/linux/kp30.h index 9f30cce..8f3a1ab 100644 --- a/lnet/include/linux/kp30.h +++ b/lnet/include/linux/kp30.h @@ -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! */ diff --git a/lnet/include/lnet/types.h b/lnet/include/lnet/types.h index d4038b6..0269290 100644 --- a/lnet/include/lnet/types.h +++ b/lnet/include/lnet/types.h @@ -2,14 +2,19 @@ #define _P30_TYPES_H_ #ifdef __linux__ -#include -#include +# include +# include #else -#include +# include 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 +#else +# include +# 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 */ diff --git a/lnet/libcfs/debug.c b/lnet/libcfs/debug.c index 6cdf101..2c6ba6c 100644 --- a/lnet/libcfs/debug.c +++ b/lnet/libcfs/debug.c @@ -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; diff --git a/lnet/lnet/lib-move.c b/lnet/lnet/lib-move.c index fde4f16..02f8b60 100644 --- a/lnet/lnet/lib-move.c +++ b/lnet/lnet/lib-move.c @@ -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); diff --git a/lnet/utils/portals.c b/lnet/utils/portals.c index 90d66f5..a89f4f7 100644 --- a/lnet/utils/portals.c +++ b/lnet/utils/portals.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -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 */ diff --git a/lustre/portals/archdep.m4 b/lustre/portals/archdep.m4 index 16455a5..c107a74 100644 --- a/lustre/portals/archdep.m4 +++ b/lustre/portals/archdep.m4 @@ -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' diff --git a/lustre/portals/include/linux/kp30.h b/lustre/portals/include/linux/kp30.h index 9f30cce..8f3a1ab 100644 --- a/lustre/portals/include/linux/kp30.h +++ b/lustre/portals/include/linux/kp30.h @@ -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! */ diff --git a/lustre/portals/include/portals/types.h b/lustre/portals/include/portals/types.h index d4038b6..0269290 100644 --- a/lustre/portals/include/portals/types.h +++ b/lustre/portals/include/portals/types.h @@ -2,14 +2,19 @@ #define _P30_TYPES_H_ #ifdef __linux__ -#include -#include +# include +# include #else -#include +# include 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 +#else +# include +# 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 */ diff --git a/lustre/portals/libcfs/debug.c b/lustre/portals/libcfs/debug.c index 6cdf101..2c6ba6c 100644 --- a/lustre/portals/libcfs/debug.c +++ b/lustre/portals/libcfs/debug.c @@ -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; diff --git a/lustre/portals/portals/lib-move.c b/lustre/portals/portals/lib-move.c index fde4f16..02f8b60 100644 --- a/lustre/portals/portals/lib-move.c +++ b/lustre/portals/portals/lib-move.c @@ -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); diff --git a/lustre/portals/utils/portals.c b/lustre/portals/utils/portals.c index 90d66f5..a89f4f7 100644 --- a/lustre/portals/utils/portals.c +++ b/lustre/portals/utils/portals.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -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 */ -- 1.8.3.1