Whamcloud - gitweb
* Merged b_devel updates
authoreeb <eeb>
Sun, 27 Jul 2003 02:39:59 +0000 (02:39 +0000)
committereeb <eeb>
Sun, 27 Jul 2003 02:39:59 +0000 (02:39 +0000)
89 files changed:
lnet/.cvsignore
lnet/Kernelenv.in
lnet/Kernelenv.mk
lnet/Makefile.mk
lnet/archdep.m4
lnet/include/config.h.in
lnet/include/linux/kp30.h
lnet/include/lnet/internal.h
lnet/include/lnet/list.h
lnet/include/lnet/lltrace.h
lnet/include/lnet/myrnal.h
lnet/include/lnet/nal.h
lnet/include/lnet/ppid.h
lnet/include/lnet/stringtab.h
lnet/include/lnet/types.h
lnet/klnds/.cvsignore
lnet/klnds/Makefile.mk
lnet/klnds/gmlnd/gmnal.c
lnet/klnds/qswlnd/qswlnd.h
lnet/klnds/qswlnd/qswlnd_cb.c
lnet/klnds/scimaclnd/scimacnal.c
lnet/klnds/socklnd/socklnd_cb.c
lnet/klnds/toelnd/toenal.c
lnet/klnds/toelnd/toenal_cb.c
lnet/libcfs/.cvsignore
lnet/libcfs/Makefile.mk
lnet/libcfs/debug.c
lnet/libcfs/module.c
lnet/lnet/.cvsignore
lnet/lnet/Makefile.mk
lnet/lnet/lib-move.c
lnet/router/.cvsignore
lnet/router/Makefile.mk
lnet/router/router.c
lnet/tests/.cvsignore
lnet/tests/ping_cli.c
lnet/tests/ping_srv.c
lnet/tests/sping_cli.c
lnet/tests/sping_srv.c
lnet/ulnds/debug.c
lnet/ulnds/socklnd/debug.c
lnet/utils/debug.c
lnet/utils/portals.c
lnet/utils/routerstat.c
lustre/Makefile.mk
lustre/mds/Makefile.mk
lustre/portals/.cvsignore
lustre/portals/Kernelenv.in
lustre/portals/Kernelenv.mk
lustre/portals/Makefile.mk
lustre/portals/archdep.m4
lustre/portals/include/config.h.in
lustre/portals/include/linux/kp30.h
lustre/portals/include/portals/list.h
lustre/portals/include/portals/lltrace.h
lustre/portals/include/portals/myrnal.h
lustre/portals/include/portals/nal.h
lustre/portals/include/portals/ppid.h
lustre/portals/include/portals/stringtab.h
lustre/portals/include/portals/types.h
lustre/portals/knals/.cvsignore
lustre/portals/knals/Makefile.mk
lustre/portals/knals/gmnal/gmnal.c
lustre/portals/knals/qswnal/qswnal.h
lustre/portals/knals/qswnal/qswnal_cb.c
lustre/portals/knals/scimacnal/scimacnal.c
lustre/portals/knals/socknal/socknal_cb.c
lustre/portals/knals/toenal/toenal.c
lustre/portals/knals/toenal/toenal_cb.c
lustre/portals/libcfs/.cvsignore
lustre/portals/libcfs/Makefile.mk
lustre/portals/libcfs/debug.c
lustre/portals/libcfs/module.c
lustre/portals/portals/.cvsignore
lustre/portals/portals/Makefile.mk
lustre/portals/portals/lib-move.c
lustre/portals/router/.cvsignore
lustre/portals/router/Makefile.mk
lustre/portals/router/router.c
lustre/portals/tests/.cvsignore
lustre/portals/tests/ping_cli.c
lustre/portals/tests/ping_srv.c
lustre/portals/tests/sping_cli.c
lustre/portals/tests/sping_srv.c
lustre/portals/unals/debug.c
lustre/portals/utils/debug.c
lustre/portals/utils/portals.c
lustre/portals/utils/routerstat.c
lustre/utils/llobdstat.pl

index 99ac885..c1a9bdf 100644 (file)
@@ -6,3 +6,4 @@ autom4te.cache
 config.log
 config.status
 configure
+.*.o.cmd
index 29a713f..7a48c58 100644 (file)
@@ -1 +1,6 @@
-EXTRA_CFLAGS= -Ifs/lustre/include -Ifs/lustre/portals/include
+EXTRA_CFLAGS := -Ifs/lustre/include -Ifs/lustre/portals/include
+# portals/utils/debug.c wants <linux/version.h> from userspace.  sigh.
+HOSTCFLAGS := -I@LINUX@/include $(EXTRA_CFLAGS)
+LIBREADLINE := @LIBREADLINE@
+# 2.5's makefiles aren't nice to cross dir libraries in host programs
+PTLCTLOBJS := debug.o l_ioctl.o parser.o portals.o
index 29a713f..7c66dfa 100644 (file)
@@ -1 +1,4 @@
-EXTRA_CFLAGS= -Ifs/lustre/include -Ifs/lustre/portals/include
+EXTRA_CFLAGS := -Ifs/lustre/include -Ifs/lustre/portals/include
+HOSTCFLAGS := $(EXTRA_CFLAGS)
+# the kernel doesn't want us to build archives for host binaries :/
+PTLCTLOBJS := debug.o l_ioctl.o parser.o portals.o
index be0e51a..73a19df 100644 (file)
@@ -1,6 +1,12 @@
-include fs/lustre/portals/Kernelenv
+include $(src)/Kernelenv
 
-obj-y += portals/
+# The ordering of these determines the order that each subsystem's 
+# module_init() functions are called in.  if these are changed make sure
+# they reflect the dependencies between each subsystem's _init functions.
 obj-y += libcfs/
-obj-y += knals/
+obj-y += portals/
 obj-y += router/
+obj-y += knals/
+obj-y += tests/
+
+obj-m += utils/
index ba7c699..c1455c3 100644 (file)
@@ -11,8 +11,13 @@ AC_ARG_WITH(lib, [  --with-lib compile lustre library], host_cpu="lib")
 
 AC_ARG_WITH(linux, [  --with-linux=[path] set path to Linux source (default=/usr/src/linux)],LINUX=$with_linux,LINUX=/usr/src/linux)
 AC_SUBST(LINUX)
+if test x$enable_inkernel = xyes ; then
+        echo ln -s `pwd` $LINUX/fs/lustre
+        rm $LINUX/fs/lustre
+        ln -s `pwd` $LINUX/fs/lustre
+fi
 
-# --------- UML?  --------------------
+#  --------------------
 AC_MSG_CHECKING(if you are running user mode linux for $host_cpu ...)
 if test $host_cpu = "lib" ; then 
         host_cpu="lib"
@@ -111,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'
@@ -160,21 +172,33 @@ if test $host_cpu != "lib" ; then
       AC_MSG_ERROR(** cannot find $LINUX/include/linux/autoconf.h. Run make config in $LINUX.)
   fi
 
-# ------------ RELEASE and moduledir ------------------
+# ------------ LINUXRELEASE and moduledir ------------------
   AC_MSG_CHECKING(for Linux release)
   
   dnl We need to rid ourselves of the nasty [ ] quotes.
   changequote(, )
   dnl Get release from version.h
-  RELEASE="`sed -ne 's/.*UTS_RELEASE[ \"]*\([0-9.a-zA-Z_-]*\).*/\1/p' $LINUX/include/linux/version.h`"
+  LINUXRELEASE="`sed -ne 's/.*UTS_RELEASE[ \"]*\([0-9.a-zA-Z_-]*\).*/\1/p' $LINUX/include/linux/version.h`"
   changequote([, ])
   
-  moduledir='$(libdir)/modules/'$RELEASE/kernel
+  moduledir='$(libdir)/modules/'$LINUXRELEASE/kernel
   AC_SUBST(moduledir)
   
   modulefsdir='$(moduledir)/fs/$(PACKAGE)'
   AC_SUBST(modulefsdir)
   
+  AC_MSG_RESULT($LINUXRELEASE)
+  AC_SUBST(LINUXRELEASE)
+
+# ------------ RELEASE --------------------------------
+  AC_MSG_CHECKING(lustre release)
+  
+  dnl We need to rid ourselves of the nasty [ ] quotes.
+  changequote(, )
+  dnl Get release from version.h
+  RELEASE="`sed -ne 's/-/_/g' -e 's/.*UTS_RELEASE[ \"]*\([0-9.a-zA-Z_]*\).*/\1/p' $LINUX/include/linux/version.h`_`date +%Y%m%d%H%M`"
+  changequote([, ])
+  
   AC_MSG_RESULT($RELEASE)
   AC_SUBST(RELEASE)
 
@@ -303,7 +327,7 @@ AM_CONDITIONAL(LIBLUSTRE, test x$host_cpu = xlib)
 # This needs to run after we've defined the KCPPFLAGS
 
 AC_MSG_CHECKING(for kernel version)
-AC_TRY_LINK([#define __KERNEL__
+AC_TRY_COMPILE([#define __KERNEL__
              #include <linux/sched.h>],
             [struct task_struct p;
              p.sighand = NULL;],
index b05d0c4..a4b1e1e 100644 (file)
@@ -1,7 +1,7 @@
-/* ../include/config.h.in.  Generated automatically from configure.in by autoheader.  */
+/* portals/include/config.h.in.  Generated automatically from configure.in by autoheader.  */
 
-/* Define if you have the readline library (-lreadline).  */
-#undef HAVE_LIBREADLINE
+/* The number of bytes in a unsigned long long.  */
+#undef SIZEOF_UNSIGNED_LONG_LONG
 
 /* Name of package */
 #undef PACKAGE
@@ -9,3 +9,6 @@
 /* Version number of package */
 #undef VERSION
 
+/* IOCTL Buffer Size */
+#undef OBD_MAX_IOCTL_BUFFER
+
index bd963d7..6088b7f 100644 (file)
 
 #define LOWEST_BIT_SET(x)      ((x) & ~((x) - 1))
 
-#ifndef CONFIG_SMP
-# define smp_processor_id() 0
-#endif
-
 /*
  *  Debugging
  */
@@ -55,6 +51,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! */
@@ -83,20 +80,23 @@ extern unsigned int portal_printk;
 #define D_RPCTRACE  (1 << 20) /* for distributed debugging */
 #define D_VFSTRACE  (1 << 21)
 
-#ifndef __KERNEL__
-#define THREAD_SIZE 8192
+#ifdef __KERNEL__
+# include <linux/sched.h> /* THREAD_SIZE */
+#else
+# define THREAD_SIZE 8192
 #endif
-#ifdef  __ia64__
-#define CDEBUG_STACK() (THREAD_SIZE -                                      \
+
+#ifdef __KERNEL__
+# ifdef  __ia64__
+#  define CDEBUG_STACK (THREAD_SIZE -                                      \
                         ((unsigned long)__builtin_dwarf_cfa() &            \
                          (THREAD_SIZE - 1)))
-#else
-#define CDEBUG_STACK() (THREAD_SIZE -                                      \
+# else
+#  define CDEBUG_STACK (THREAD_SIZE -                                      \
                         ((unsigned long)__builtin_frame_address(0) &       \
                          (THREAD_SIZE - 1)))
-#endif
+# endif
 
-#ifdef __KERNEL__
 #define CHECK_STACK(stack)                                                    \
         do {                                                                  \
                 if ((stack) > 3*THREAD_SIZE/4 && (stack) > portal_stack) {    \
@@ -108,20 +108,21 @@ extern unsigned int portal_printk;
                       /*panic("LBUG");*/                                      \
                 }                                                             \
         } while (0)
-#else
+#else /* __KERNEL __ */
 #define CHECK_STACK(stack) do { } while(0)
-#endif
+#define CDEBUG_STACK (0L)
+#endif /* __KERNEL__ */
 
 #if 1
 #define CDEBUG(mask, format, a...)                                            \
 do {                                                                          \
-        CHECK_STACK(CDEBUG_STACK());                                          \
+        CHECK_STACK(CDEBUG_STACK);                                            \
         if (!(mask) || ((mask) & (D_ERROR | D_EMERG)) ||                      \
             (portal_debug & (mask) &&                                         \
              portal_subsystem_debug & (1 << (DEBUG_SUBSYSTEM >> 24))))        \
                 portals_debug_msg(DEBUG_SUBSYSTEM, mask,                      \
                                   __FILE__, __FUNCTION__, __LINE__,           \
-                                  CDEBUG_STACK(), format , ## a);             \
+                                  CDEBUG_STACK, format, ## a);                \
 } while (0)
 
 #define CWARN(format, a...) CDEBUG(D_WARNING, format, ## a)
@@ -213,7 +214,8 @@ static inline void our_cond_resched(void)
 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) */
 
 #ifdef PORTAL_DEBUG
-extern void kportal_assertion_failed(char *expr,char *file,char *func,int line);
+extern void kportal_assertion_failed(char *expr, char *file, const char *func,
+                                     const int line);
 #define LASSERT(e) ((e) ? 0 : kportal_assertion_failed( #e , __FILE__,  \
                                                         __FUNCTION__, __LINE__))
 #else
@@ -563,7 +565,7 @@ extern struct prof_ent prof_ents[MAX_PROFS];
 #endif /* PORTALS_PROFILING */
 
 /* debug.c */
-void portals_run_lbug_upcall(char * file, char *fn, int line);
+void portals_run_lbug_upcall(char * file, const char *fn, const int line);
 void portals_debug_dumplog(void);
 int portals_debug_init(unsigned long bufsize);
 int portals_debug_cleanup(void);
@@ -581,12 +583,13 @@ __s32 portals_debug_copy_to_user(char *buf, unsigned long len);
 # warning printf has been defined as a macro...
 # undef printf
 #endif
-void portals_debug_msg (int subsys, int mask, char *file, char *fn, int line,
-                        unsigned long stack, const char *format, ...)
+void portals_debug_msg(int subsys, int mask, char *file, const char *fn,
+                       const int line, unsigned long stack,
+                       const char *format, ...)
         __attribute__ ((format (printf, 7, 8)));
 #else
-void portals_debug_msg (int subsys, int mask, char *file, char *fn,
-                        int line, unsigned long stack,
+void portals_debug_msg (int subsys, int mask, char *file, const char *fn,
+                        const int line, unsigned long stack,
                         const char *format, ...);
 #endif /* __GNUC__ */
 void portals_debug_set_level(unsigned int debug_level);
index d78cad4..a70b465 100644 (file)
@@ -1,5 +1,3 @@
-/*
-*/
 #ifndef _P30_INTERNAL_H_
 #define _P30_INTERNAL_H_
 
index 2b63312..78a1e2d 100644 (file)
@@ -1,6 +1,4 @@
 #ifndef _LINUX_LIST_H
-#define _LINUX_LIST_H
-
 
 /*
  * Simple doubly linked list implementation.
@@ -101,7 +99,9 @@ static inline void list_del_init(struct list_head *entry)
        __list_del(entry->prev, entry->next);
        INIT_LIST_HEAD(entry);
 }
+#endif
 
+#ifndef list_for_each_entry
 /**
  * list_move - delete from one list and add as another's head
  * @list: the entry to move
@@ -124,7 +124,10 @@ static inline void list_move_tail(struct list_head *list,
        __list_del(list->prev, list->next);
        list_add_tail(list, head);
 }
+#endif
 
+#ifndef _LINUX_LIST_H
+#define _LINUX_LIST_H
 /**
  * list_empty - tests whether a list is empty
  * @head: the list to test.
index 7d1b304..d389aab 100644 (file)
@@ -2,7 +2,7 @@
  * vim:expandtab:shiftwidth=8:tabstop=8:
  *
  * Compile with:
- * cc -I../../portals/include -o fio fio.c -L../../portals/linux/utils -lptlctl 
+ * cc -I../../portals/include -o fio fio.c -L../../portals/linux/utils -lptlctl
  */
 #ifndef __LTRACE_H_
 #define __LTRACE_H_
@@ -31,20 +31,20 @@ static inline int ltrace_write_file(char* fname)
         argv[0] = "debug_kernel";
         argv[1] = fname;
         argv[2] = "1";
-        
+
         fprintf(stderr, "[ptlctl] %s %s %s\n", argv[0], argv[1], argv[2]);
-        
+
         return jt_dbg_debug_kernel(3, argv);
 }
 
 static inline int ltrace_clear()
 {
         char* argv[1];
-        
+
         argv[0] = "clear";
-        
+
         fprintf(stderr, "[ptlctl] %s\n", argv[0]);
-        
+
         return jt_dbg_clear_debug_buf(1, argv);
 }
 
@@ -52,9 +52,9 @@ static inline int ltrace_mark(int indent_level, char* text)
 {
         char* argv[2];
         char mark_buf[PATH_MAX];
-        
+
         snprintf(mark_buf, PATH_MAX, "====%d=%s", indent_level, text);
-        
+
         argv[0] = "mark";
         argv[1] = mark_buf;
         return jt_dbg_mark_debug_buf(2, argv);
@@ -65,9 +65,9 @@ static inline int ltrace_applymasks()
         char* argv[2];
         argv[0] = "list";
         argv[1] = "applymasks";
-        
+
         fprintf(stderr, "[ptlctl] %s %s\n", argv[0], argv[1]);
-        
+
         return jt_dbg_list(2, argv);
 }
 
@@ -95,19 +95,19 @@ static inline int ltrace_start()
 #ifdef PORTALS_DEV_ID
         rc = register_ioc_dev(PORTALS_DEV_ID, PORTALS_DEV_PATH);
 #endif
-        ltrace_filter("class"); 
+        ltrace_filter("class");
         ltrace_filter("socknal");
-        ltrace_filter("qswnal"); 
-        ltrace_filter("gmnal");  
-        ltrace_filter("portals");  
-        
-        ltrace_show("all_types");  
-        ltrace_filter("trace");  
-        ltrace_filter("malloc"); 
-        ltrace_filter("net"); 
-        ltrace_filter("page"); 
-        ltrace_filter("other"); 
-        ltrace_filter("info"); 
+        ltrace_filter("qswnal");
+        ltrace_filter("gmnal");
+        ltrace_filter("portals");
+
+        ltrace_show("all_types");
+        ltrace_filter("trace");
+        ltrace_filter("malloc");
+        ltrace_filter("net");
+        ltrace_filter("page");
+        ltrace_filter("other");
+        ltrace_filter("info");
         ltrace_applymasks();
 
         return rc;
@@ -146,7 +146,7 @@ static inline void ltrace_add_processnames(char* fname)
         struct timezone tz;
         int nob;
         int underuml = !not_uml();
-        
+
         gettimeofday(&tv, &tz);
 
         nob = snprintf(cmdbuf, LTRACE_MAX_NOB, "ps --no-headers -eo \"");
@@ -167,7 +167,7 @@ static inline void ltrace_add_processnames(char* fname)
                                  "(%s:%d:%s() %d+%lu): ",
                                  "lltrace.h", __LINE__, __FUNCTION__, 0, 0L);
         }
-         
+
         nob += snprintf(cmdbuf+nob, LTRACE_MAX_NOB, " %%p %%c\" >> %s", fname);
         system(cmdbuf);
 }
index 12b1925..13790f7 100644 (file)
@@ -1,6 +1,3 @@
-/*
-*/
-
 #ifndef MYRNAL_H
 #define MYRNAL_H
 
index 88be63c..7cb3ab7 100644 (file)
@@ -1,5 +1,3 @@
-/*
-*/
 #ifndef _NAL_H_
 #define _NAL_H_
 
index 4727599..760f465 100644 (file)
@@ -1,6 +1,3 @@
-/*
- */
-
 #ifndef _INCppidh_
 #define _INCppidh_
 
index c9683f7..33e4375 100644 (file)
@@ -1,5 +1,3 @@
 /*
-*/
-/*
  * stringtab.h
  */
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 282522d..89a4aa6 100644 (file)
@@ -1,2 +1,3 @@
 Makefile
 Makefile.in
+.*.o.cmd
index ce40a60..cd5d9d6 100644 (file)
@@ -1,4 +1,4 @@
-include ../Kernelenv
+include $(obj)/../Kernelenv
 
 obj-y = socknal/
-# more coming...
\ No newline at end of file
+# more coming...
index ceeea2a..0cffc15 100644 (file)
@@ -124,7 +124,7 @@ static nal_t *kgmnal_init(int interface, ptl_pt_index_t ptl_size,
         return &kgmnal_api;
 }
 
-static void __exit
+static void /*__exit*/
 kgmnal_finalize(void)
 {
         struct list_head *tmp;
index ceb7c8c..0eb4959 100644 (file)
@@ -106,7 +106,7 @@ typedef unsigned long kqsw_csum_t;
 #define KQSW_TX_MAXCONTIG              (1<<10) /* largest payload that gets made contiguous on transmit */
 
 #define KQSW_NTXMSGS                   8       /* # normal transmit messages */
-#define KQSW_NNBLK_TXMSGS              128     /* # reserved transmit messages if can't block */
+#define KQSW_NNBLK_TXMSGS              256     /* # reserved transmit messages if can't block */
 
 #define KQSW_NRXMSGS_LARGE             64      /* # large receive buffers */
 #define KQSW_EP_ENVELOPES_LARGE        128     /* # large ep envelopes */
index 3b47a25..c03d592 100644 (file)
@@ -617,6 +617,7 @@ kqswnal_sendmsg (nal_cb_t     *nal,
         if (ktx == NULL) {
                 kqswnal_cerror_hdr (hdr);
                 lib_finalize (&kqswnal_lib, private, cookie);
+                return (-1);
         }
 
         memcpy (ktx->ktx_buffer, hdr, sizeof (*hdr)); /* copy hdr from caller's stack */
index 1066d69..479cc2c 100644 (file)
@@ -112,7 +112,7 @@ static nal_t *kscimacnal_init(int interface, ptl_pt_index_t  ptl_size,
 
 
 /* Called by kernel at module unload time */
-static void __exit 
+static void /*__exit*/ 
 kscimacnal_finalize(void)
 {
         /* FIXME: How should the shutdown procedure really look? */
index 3e7d206..bc770c8 100644 (file)
@@ -1372,21 +1372,17 @@ int ksocknal_scheduler (void *arg)
         int                nloops = 0;
         int                id = sched - ksocknal_data.ksnd_schedulers;
         char               name[16];
-#if (CONFIG_SMP && CPU_AFFINITY)
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-        int                cpu = cpu_logical_map(id % num_online_cpus());
-#else
-#warning "Take care of architecure specific logical APIC map"
-        int cpu = 1;    /* Have to change later. */
-#endif /* LINUX_VERSION_CODE */
-        
-        set_cpus_allowed (current, 1 << cpu);
-        id = cpu;
-#endif /* CONFIG_SMP && CPU_AFFINITY */
 
         snprintf (name, sizeof (name),"ksocknald[%d]", id);
         kportal_daemonize (name);
         kportal_blockallsigs ();
+
+#if (CONFIG_SMP && CPU_AFFINITY)
+        if ((cpu_online_map & (1 << id)) != 0)
+                current->cpus_allowed = (1 << id);
+        else
+                CERROR ("Can't set CPU affinity for %s\n", name);
+#endif /* CONFIG_SMP && CPU_AFFINITY */
         
         spin_lock_irqsave (&sched->kss_lock, flags);
 
index 1f5dc38..77ee473 100644 (file)
@@ -379,7 +379,7 @@ ktoenal_cmd(struct portal_ioctl_data * data, void * private)
 }
 
 
-void __exit
+void /*__exit*/
 ktoenal_module_fini (void)
 {
         CDEBUG(D_MALLOC, "before NAL cleanup: kmem %d\n",
index 5388f4b..2800788 100644 (file)
@@ -893,9 +893,10 @@ ktoenal_process_receive (ksock_conn_t *conn, long *irq_flags)
                                 spin_lock_irqsave (&ktoenal_data.ksnd_sched_lock, *irq_flags);
                                 goto get_fmb;   /* => go get a fwd msg buffer */
                         default:
-                                LBUG ();
+                                break;
                         }
                         /* Not Reached */
+                        LBUG ();
                 }
 
                 PROF_START(lib_parse);
@@ -934,10 +935,11 @@ ktoenal_process_receive (ksock_conn_t *conn, long *irq_flags)
                 goto out;                       /* (later) */
 
         default:
-                LBUG ();
+                break;
         }
 
         /* Not Reached */
+        LBUG ();
 
  out:
         spin_lock_irqsave (&ktoenal_data.ksnd_sched_lock, *irq_flags);
index 67d1a3d..7fa686f 100644 (file)
@@ -2,3 +2,4 @@
 Makefile
 Makefile.in
 link-stamp
+.*.o.cmd
index 3196ea2..9aa838f 100644 (file)
@@ -6,4 +6,4 @@
 include fs/lustre/portals/Kernelenv
 
 obj-y += libcfs.o
-licfs-objs    := module.o proc.o debug.o
\ No newline at end of file
+libcfs-objs    := module.o proc.o debug.o
index 491c954..07c0bed 100644 (file)
@@ -573,8 +573,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;
@@ -634,9 +634,9 @@ int portals_debug_mark_buffer(char *text)
         if (debug_buf == NULL)
                 return -EINVAL;
 
-        CDEBUG(0, "*******************************************************************************\n");
+        CDEBUG(0, "********************************************************\n");
         CDEBUG(0, "DEBUG MARKER: %s\n", text);
-        CDEBUG(0, "*******************************************************************************\n");
+        CDEBUG(0, "********************************************************\n");
 
         return 0;
 }
@@ -674,8 +674,8 @@ __s32 portals_debug_copy_to_user(char *buf, unsigned long len)
 
 /* FIXME: I'm not very smart; someone smarter should make this better. */
 void
-portals_debug_msg (int subsys, int mask, char *file, char *fn, int line,
-                   unsigned long stack, const char *format, ...)
+portals_debug_msg(int subsys, int mask, char *file, const char *fn,
+                  const int line, unsigned long stack, const char *format, ...)
 {
         va_list       ap;
         unsigned long flags;
@@ -792,7 +792,7 @@ void portals_debug_set_level(unsigned int debug_level)
         portal_debug = debug_level;
 }
 
-void portals_run_lbug_upcall(char * file, char *fn, int line)
+void portals_run_lbug_upcall(char *file, const char *fn, const int line)
 {
         char *argv[6];
         char *envp[3];
@@ -805,7 +805,7 @@ void portals_run_lbug_upcall(char * file, char *fn, int line)
         argv[0] = portals_upcall;
         argv[1] = "LBUG";
         argv[2] = file;
-        argv[3] = fn;
+        argv[3] = (char *)fn;
         argv[4] = buf;
         argv[5] = NULL;
 
index 5e3fcb5..e8eb290 100644 (file)
@@ -62,10 +62,10 @@ static struct nal_cmd_handler nal_cmd[NAL_MAX_NR + 1];
 struct semaphore nal_cmd_sem;
 
 #ifdef PORTAL_DEBUG
-void
-kportal_assertion_failed (char *expr, char *file, char *func, int line)
+void kportal_assertion_failed(char *expr, char *file, const char *func,
+                              const int line)
 {
-        portals_debug_msg(0, D_EMERG, file, func, line, CDEBUG_STACK(),
+        portals_debug_msg(0, D_EMERG, file, func, line, CDEBUG_STACK,
                           "ASSERTION(%s) failed\n", expr);
         LBUG_WITH_LOC(file, func, line);
 }
@@ -429,6 +429,7 @@ static int kportal_ioctl(struct inode *inode, struct file *file,
                         return (-EINVAL);
 
                 err = PtlFailNid (*nip, data->ioc_nid, data->ioc_count);
+                kportal_put_ni (data->ioc_nal);
                 break;
         }
 
index e995588..95973d6 100644 (file)
@@ -1,3 +1,4 @@
 .deps
 Makefile
 Makefile.in
+.*.o.cmd
index 5627ef7..7822846 100644 (file)
@@ -3,7 +3,10 @@
 # This code is issued under the GNU General Public License.
 # See the file COPYING in this distribution
 
-include ../Kernelenv
+include $(src)/../Kernelenv
 
 obj-y += portals.o
-portals-objs    := lib-dispatch.o lib-eq.o lib-init.o lib-md.o lib-me.o lib-move.o lib-msg.o lib-ni.o lib-not-impl.o lib-pid.o api-eq.o api-errno.o api-init.o api-md.o api-me.o api-ni.o api-wrap.o
+portals-objs    :=     lib-dispatch.o lib-eq.o lib-init.o lib-md.o lib-me.o \
+                       lib-move.o lib-msg.o lib-ni.o lib-pid.o \
+                       api-eq.o api-errno.o api-init.o api-me.o api-ni.o \
+                       api-wrap.o
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 e995588..95973d6 100644 (file)
@@ -1,3 +1,4 @@
 .deps
 Makefile
 Makefile.in
+.*.o.cmd
index 64bd09b..9b02c03 100644 (file)
@@ -3,7 +3,7 @@
 # This code is issued under the GNU General Public License.
 # See the file COPYING in this distribution
 
-include ../Kernelenv
+include $(src)/../Kernelenv
 
 obj-y += kptlrouter.o
 kptlrouter-objs    := router.o proc.o
index 6074c3c..27a7fba 100644 (file)
@@ -23,8 +23,8 @@
 
 #include "router.h"
 
-struct list_head kpr_routes;
-struct list_head kpr_nals;
+LIST_HEAD(kpr_routes);
+LIST_HEAD(kpr_nals);
 
 unsigned long long kpr_fwd_bytes;
 unsigned long      kpr_fwd_packets;
@@ -35,7 +35,7 @@ atomic_t           kpr_queue_depth;
  *
  * Once in a blue moon we register/deregister NALs and add/remove routing
  * entries (thread context only)... */
-rwlock_t         kpr_rwlock;
+rwlock_t         kpr_rwlock = RW_LOCK_UNLOCKED;
 
 kpr_router_interface_t kpr_router_interface = {
        kprri_register:         kpr_register_nal,
@@ -55,7 +55,7 @@ kpr_control_interface_t kpr_control_interface = {
 int
 kpr_register_nal (kpr_nal_interface_t *nalif, void **argp)
 {
-       long               flags;
+       unsigned long      flags;
        struct list_head  *e;
        kpr_nal_entry_t   *ne;
 
@@ -98,7 +98,7 @@ kpr_register_nal (kpr_nal_interface_t *nalif, void **argp)
 void
 kpr_shutdown_nal (void *arg)
 {
-       long             flags;
+       unsigned long    flags;
        kpr_nal_entry_t *ne = (kpr_nal_entry_t *)arg;
 
         CDEBUG (D_OTHER, "Shutting down NAL %d\n", ne->kpne_interface.kprni_nalid);
@@ -123,7 +123,7 @@ kpr_shutdown_nal (void *arg)
 void
 kpr_deregister_nal (void *arg)
 {
-       long              flags;
+       unsigned long     flags;
        kpr_nal_entry_t  *ne = (kpr_nal_entry_t *)arg;
 
         CDEBUG (D_OTHER, "Deregister NAL %d\n", ne->kpne_interface.kprni_nalid);
@@ -296,7 +296,7 @@ int
 kpr_add_route (int gateway_nalid, ptl_nid_t gateway_nid, ptl_nid_t lo_nid,
                ptl_nid_t hi_nid)
 {
-       long               flags;
+       unsigned long      flags;
        struct list_head  *e;
        kpr_route_entry_t *re;
 
@@ -345,7 +345,7 @@ kpr_add_route (int gateway_nalid, ptl_nid_t gateway_nid, ptl_nid_t lo_nid,
 int
 kpr_del_route (ptl_nid_t nid)
 {
-       long               flags;
+       unsigned long      flags;
        struct list_head  *e;
 
         CDEBUG(D_OTHER, "Del route "LPX64"\n", nid);
@@ -398,7 +398,7 @@ kpr_get_route(int idx, int *gateway_nalid, ptl_nid_t *gateway_nid,
         return (-ENOENT);
 }
 
-static void __exit
+static void /*__exit*/
 kpr_finalise (void)
 {
         LASSERT (list_empty (&kpr_nals));
@@ -427,10 +427,6 @@ kpr_initialise (void)
         CDEBUG(D_MALLOC, "kpr_initialise: kmem %d\n",
                atomic_read(&portal_kmemory));
 
-       rwlock_init(&kpr_rwlock);
-       INIT_LIST_HEAD(&kpr_routes);
-       INIT_LIST_HEAD(&kpr_nals);
-
         kpr_proc_init();
 
         PORTAL_SYMBOL_REGISTER(kpr_router_interface);
index 051d1bd..d0c4c88 100644 (file)
@@ -1,3 +1,4 @@
 Makefile
 Makefile.in
 .deps
+.*.o.cmd
index 389ffbb..4d04ffb 100644 (file)
@@ -260,7 +260,7 @@ pingcli_start(struct portal_ioctl_data *args)
 
 
 /* called by the portals_ioctl for ping requests */
-static int kping_client(struct portal_ioctl_data *args)
+int kping_client(struct portal_ioctl_data *args)
 {
         PORTAL_ALLOC (client, sizeof(struct pingcli_data));
         if (client == NULL)
@@ -282,7 +282,7 @@ static int __init pingcli_init(void)
 } /* pingcli_init() */
 
 
-static void __exit pingcli_cleanup(void)
+static void /*__exit*/ pingcli_cleanup(void)
 {
         PORTAL_SYMBOL_UNREGISTER (kping_client);
 } /* pingcli_cleanup() */
index 1037d09..873e11c 100644 (file)
 #include <asm/semaphore.h>
 
 #define STDSIZE (sizeof(int) + sizeof(int) + sizeof(struct timeval))
-#define MAXSIZE (16*1024*1024)
+#define MAXSIZE (16*1024)
 
 static unsigned ping_head_magic;
 static unsigned ping_bulk_magic;
-static int nal  = 0;                            // Your NAL,
+static int nal  = SOCKNAL;                            // Your NAL,
 static unsigned long packets_valid = 0;         // Valid packets 
 static int running = 1;
 atomic_t pkt;
@@ -282,7 +282,7 @@ static int __init pingsrv_init(void)
 } /* pingsrv_init() */
 
 
-static void __exit pingsrv_cleanup(void)
+static void /*__exit*/ pingsrv_cleanup(void)
 {
         remove_proc_entry ("net/pingsrv", NULL);
         
index 4cef08b..35e114b 100644 (file)
@@ -235,7 +235,7 @@ pingcli_start(struct portal_ioctl_data *args)
 
 
 /* called by the portals_ioctl for ping requests */
-static int kping_client(struct portal_ioctl_data *args)
+int kping_client(struct portal_ioctl_data *args)
 {
 
         PORTAL_ALLOC (client, sizeof(struct pingcli_data));
@@ -258,7 +258,7 @@ static int __init pingcli_init(void)
 } /* pingcli_init() */
 
 
-static void __exit pingcli_cleanup(void)
+static void /*__exit*/ pingcli_cleanup(void)
 {
         PORTAL_SYMBOL_UNREGISTER (kping_client);
 } /* pingcli_cleanup() */
index a18ea35..2b45a46 100644 (file)
@@ -269,7 +269,7 @@ static int __init pingsrv_init(void)
 } /* pingsrv_init() */
 
 
-static void __exit pingsrv_cleanup(void)
+static void /*__exit*/ pingsrv_cleanup(void)
 {
         remove_proc_entry ("net/pingsrv", NULL);
         
index 529bb2d..b73f042 100644 (file)
@@ -84,8 +84,8 @@ int portals_debug_copy_to_user(char *buf, unsigned long len)
 
 /* FIXME: I'm not very smart; someone smarter should make this better. */
 void
-portals_debug_msg (int subsys, int mask, char *file, char *fn, int line,
-                   const char *format, ...)
+portals_debug_msg (int subsys, int mask, char *file, const char *fn, 
+                   const int line, const char *format, ...)
 {
         va_list       ap;
         unsigned long flags;
index 529bb2d..b73f042 100644 (file)
@@ -84,8 +84,8 @@ int portals_debug_copy_to_user(char *buf, unsigned long len)
 
 /* FIXME: I'm not very smart; someone smarter should make this better. */
 void
-portals_debug_msg (int subsys, int mask, char *file, char *fn, int line,
-                   const char *format, ...)
+portals_debug_msg (int subsys, int mask, char *file, const char *fn, 
+                   const int line, const char *format, ...)
 {
         va_list       ap;
         unsigned long flags;
index 9ab1c73..78271d5 100644 (file)
@@ -551,6 +551,8 @@ int jt_dbg_modules(int argc, char **argv)
                 {"mds_ext3", "lustre/mds"},
                 {"mds_extN", "lustre/mds"},
                 {"ptlbd", "lustre/ptlbd"},
+                {"mgmt_svc", "lustre/mgmt"},
+                {"mgmt_cli", "lustre/mgmt"},
                 {NULL, NULL}
         };
         char *path = "..";
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 37da12c..99bc59b 100644 (file)
@@ -21,12 +21,15 @@ do_stat (int fd)
 {
    static char  buffer[1024];
    static double last = 0.0;
+   static unsigned long long old_bytes;
+   static unsigned long      old_packets;
+   static unsigned long      old_errors;
    double now;
    double t;
-   long long bytes;
-   long      packets;
-   long      errors;
-   long      depth;
+   unsigned long long new_bytes, bytes;
+   unsigned long      new_packets, packets;
+   unsigned long      new_errors, errors;
+   unsigned long      depth;
    int    n;
    
    lseek (fd, 0, SEEK_SET);
@@ -39,7 +42,8 @@ do_stat (int fd)
    }    
    buffer[n] = 0;
    
-   n = sscanf (buffer, "%Ld %ld %ld %ld", &bytes, &packets, &errors, &depth);
+   n = sscanf (buffer, "%Lu %lu %lu %lu",
+              &new_bytes, &new_packets, &new_errors, &depth);
    
    if (n < 3)
    {
@@ -48,27 +52,44 @@ do_stat (int fd)
    }
    
    if (last == 0.0)
-      printf ("%Ld bytes, %ld packets (sz %Ld) %ld errors", 
-             bytes, packets, (long long)((packets == 0) ? 0LL : bytes/packets), errors);
+      printf ("%llu bytes, %lu packets (sz %lld), %lu errors", 
+             new_bytes, new_packets,
+             (long long)((new_packets == 0) ? 0LL : new_bytes/new_packets),
+             new_errors);
    else
    {
       t = now - last;
 
-      printf ("%9Ld (%7.2fMb/s), %7ld packets (sz %5Ld, %5ld/s) %ld errors (%ld/s)", 
+      if (new_bytes < old_bytes)
+         bytes = -1ULL - old_bytes + new_bytes + 1;
+      else
+         bytes = new_bytes - old_bytes;
+      if (new_packets < old_packets)
+         packets = -1UL - old_packets + new_packets + 1;
+      else
+         packets = new_packets - old_packets;
+      if (new_errors < old_errors)
+         errors = -1UL - old_errors + new_errors + 1;
+      else
+         errors = new_errors - old_errors;
+      
+      printf ("%9llu bytes (%7.2fMb/s), %7lu packets (sz %5lld, %5ld/s), %lu errors (%ld/s)", 
              bytes, ((double)bytes)/((1<<20) * t),
              packets, (long long)((packets == 0) ? 0LL : bytes/packets), (long)(packets/t),
              errors, (long)(errors/t));
    }
+   old_bytes = new_bytes;
+   old_packets = new_packets;
+   old_errors = new_errors;
 
    if (n == 4)
-      printf (" (%ld)\n", depth);
+      printf (", depth (%ld)\n", depth);
    else
       printf ("\n");
 
    fflush (stdout);
    
    lseek (fd, 0, SEEK_SET);
-   write (fd, "\n", 1);
    last = timenow();
 }
 
@@ -80,7 +101,7 @@ int main (int argc, char **argv)
    if (argc > 1)
       interval = atoi (argv[1]);
 
-   fd = open ("/proc/sys/portals/router", O_RDWR);
+   fd = open ("/proc/sys/portals/router", O_RDONLY);
    if (fd < 0)
    {
       fprintf (stderr, "Can't open stat: %s\n", strerror (errno));
index e540148..59178a4 100644 (file)
@@ -1,4 +1,22 @@
-include fs/lustre/portals/Kernelenv
+include $(src)/portals/Kernelenv
+
+# for scripts/version_tag.pl
+LINUX = @LINUX@
 
 obj-y += portals/
+# obdclass has to come before anything that does class_register..
+obj-y += obdclass/
+obj-y += ptlrpc/
+obj-y += ldlm/
+obj-y += obdfilter/
+obj-y += mdc/
 obj-y += mds/
+obj-y += obdecho/
+obj-y += osc/
+obj-y += ost/
+obj-y += lov/
+obj-y += llite/
+
+# portals needs to be before utils/, which pulls in ptlctl objects
+obj-m += utils/
+obj-m += tests/ 
index 6b712fb..0696bd7 100644 (file)
@@ -3,8 +3,9 @@
 # This code is issued under the GNU General Public License.
 # See the file COPYING in this distribution
 
-include fs/lustre/portals/Kernelenv
+include $(src)/../portals/Kernelenv
 
 obj-y += mds.o
-
-mds-objs    := mds_lov.o handler.o mds_reint.o mds_fs.o lproc_mds.o mds_internal.h mds_updates.o mds_open.o simple.o target.o
+mds-objs := mds_lov.o handler.o mds_reint.o mds_fs.o lproc_mds.o mds_open.o \
+               mds_lib.o
+       
index 99ac885..c1a9bdf 100644 (file)
@@ -6,3 +6,4 @@ autom4te.cache
 config.log
 config.status
 configure
+.*.o.cmd
index 29a713f..7a48c58 100644 (file)
@@ -1 +1,6 @@
-EXTRA_CFLAGS= -Ifs/lustre/include -Ifs/lustre/portals/include
+EXTRA_CFLAGS := -Ifs/lustre/include -Ifs/lustre/portals/include
+# portals/utils/debug.c wants <linux/version.h> from userspace.  sigh.
+HOSTCFLAGS := -I@LINUX@/include $(EXTRA_CFLAGS)
+LIBREADLINE := @LIBREADLINE@
+# 2.5's makefiles aren't nice to cross dir libraries in host programs
+PTLCTLOBJS := debug.o l_ioctl.o parser.o portals.o
index 29a713f..7c66dfa 100644 (file)
@@ -1 +1,4 @@
-EXTRA_CFLAGS= -Ifs/lustre/include -Ifs/lustre/portals/include
+EXTRA_CFLAGS := -Ifs/lustre/include -Ifs/lustre/portals/include
+HOSTCFLAGS := $(EXTRA_CFLAGS)
+# the kernel doesn't want us to build archives for host binaries :/
+PTLCTLOBJS := debug.o l_ioctl.o parser.o portals.o
index be0e51a..73a19df 100644 (file)
@@ -1,6 +1,12 @@
-include fs/lustre/portals/Kernelenv
+include $(src)/Kernelenv
 
-obj-y += portals/
+# The ordering of these determines the order that each subsystem's 
+# module_init() functions are called in.  if these are changed make sure
+# they reflect the dependencies between each subsystem's _init functions.
 obj-y += libcfs/
-obj-y += knals/
+obj-y += portals/
 obj-y += router/
+obj-y += knals/
+obj-y += tests/
+
+obj-m += utils/
index ba7c699..c1455c3 100644 (file)
@@ -11,8 +11,13 @@ AC_ARG_WITH(lib, [  --with-lib compile lustre library], host_cpu="lib")
 
 AC_ARG_WITH(linux, [  --with-linux=[path] set path to Linux source (default=/usr/src/linux)],LINUX=$with_linux,LINUX=/usr/src/linux)
 AC_SUBST(LINUX)
+if test x$enable_inkernel = xyes ; then
+        echo ln -s `pwd` $LINUX/fs/lustre
+        rm $LINUX/fs/lustre
+        ln -s `pwd` $LINUX/fs/lustre
+fi
 
-# --------- UML?  --------------------
+#  --------------------
 AC_MSG_CHECKING(if you are running user mode linux for $host_cpu ...)
 if test $host_cpu = "lib" ; then 
         host_cpu="lib"
@@ -111,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'
@@ -160,21 +172,33 @@ if test $host_cpu != "lib" ; then
       AC_MSG_ERROR(** cannot find $LINUX/include/linux/autoconf.h. Run make config in $LINUX.)
   fi
 
-# ------------ RELEASE and moduledir ------------------
+# ------------ LINUXRELEASE and moduledir ------------------
   AC_MSG_CHECKING(for Linux release)
   
   dnl We need to rid ourselves of the nasty [ ] quotes.
   changequote(, )
   dnl Get release from version.h
-  RELEASE="`sed -ne 's/.*UTS_RELEASE[ \"]*\([0-9.a-zA-Z_-]*\).*/\1/p' $LINUX/include/linux/version.h`"
+  LINUXRELEASE="`sed -ne 's/.*UTS_RELEASE[ \"]*\([0-9.a-zA-Z_-]*\).*/\1/p' $LINUX/include/linux/version.h`"
   changequote([, ])
   
-  moduledir='$(libdir)/modules/'$RELEASE/kernel
+  moduledir='$(libdir)/modules/'$LINUXRELEASE/kernel
   AC_SUBST(moduledir)
   
   modulefsdir='$(moduledir)/fs/$(PACKAGE)'
   AC_SUBST(modulefsdir)
   
+  AC_MSG_RESULT($LINUXRELEASE)
+  AC_SUBST(LINUXRELEASE)
+
+# ------------ RELEASE --------------------------------
+  AC_MSG_CHECKING(lustre release)
+  
+  dnl We need to rid ourselves of the nasty [ ] quotes.
+  changequote(, )
+  dnl Get release from version.h
+  RELEASE="`sed -ne 's/-/_/g' -e 's/.*UTS_RELEASE[ \"]*\([0-9.a-zA-Z_]*\).*/\1/p' $LINUX/include/linux/version.h`_`date +%Y%m%d%H%M`"
+  changequote([, ])
+  
   AC_MSG_RESULT($RELEASE)
   AC_SUBST(RELEASE)
 
@@ -303,7 +327,7 @@ AM_CONDITIONAL(LIBLUSTRE, test x$host_cpu = xlib)
 # This needs to run after we've defined the KCPPFLAGS
 
 AC_MSG_CHECKING(for kernel version)
-AC_TRY_LINK([#define __KERNEL__
+AC_TRY_COMPILE([#define __KERNEL__
              #include <linux/sched.h>],
             [struct task_struct p;
              p.sighand = NULL;],
index b05d0c4..a4b1e1e 100644 (file)
@@ -1,7 +1,7 @@
-/* ../include/config.h.in.  Generated automatically from configure.in by autoheader.  */
+/* portals/include/config.h.in.  Generated automatically from configure.in by autoheader.  */
 
-/* Define if you have the readline library (-lreadline).  */
-#undef HAVE_LIBREADLINE
+/* The number of bytes in a unsigned long long.  */
+#undef SIZEOF_UNSIGNED_LONG_LONG
 
 /* Name of package */
 #undef PACKAGE
@@ -9,3 +9,6 @@
 /* Version number of package */
 #undef VERSION
 
+/* IOCTL Buffer Size */
+#undef OBD_MAX_IOCTL_BUFFER
+
index bd963d7..6088b7f 100644 (file)
 
 #define LOWEST_BIT_SET(x)      ((x) & ~((x) - 1))
 
-#ifndef CONFIG_SMP
-# define smp_processor_id() 0
-#endif
-
 /*
  *  Debugging
  */
@@ -55,6 +51,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! */
@@ -83,20 +80,23 @@ extern unsigned int portal_printk;
 #define D_RPCTRACE  (1 << 20) /* for distributed debugging */
 #define D_VFSTRACE  (1 << 21)
 
-#ifndef __KERNEL__
-#define THREAD_SIZE 8192
+#ifdef __KERNEL__
+# include <linux/sched.h> /* THREAD_SIZE */
+#else
+# define THREAD_SIZE 8192
 #endif
-#ifdef  __ia64__
-#define CDEBUG_STACK() (THREAD_SIZE -                                      \
+
+#ifdef __KERNEL__
+# ifdef  __ia64__
+#  define CDEBUG_STACK (THREAD_SIZE -                                      \
                         ((unsigned long)__builtin_dwarf_cfa() &            \
                          (THREAD_SIZE - 1)))
-#else
-#define CDEBUG_STACK() (THREAD_SIZE -                                      \
+# else
+#  define CDEBUG_STACK (THREAD_SIZE -                                      \
                         ((unsigned long)__builtin_frame_address(0) &       \
                          (THREAD_SIZE - 1)))
-#endif
+# endif
 
-#ifdef __KERNEL__
 #define CHECK_STACK(stack)                                                    \
         do {                                                                  \
                 if ((stack) > 3*THREAD_SIZE/4 && (stack) > portal_stack) {    \
@@ -108,20 +108,21 @@ extern unsigned int portal_printk;
                       /*panic("LBUG");*/                                      \
                 }                                                             \
         } while (0)
-#else
+#else /* __KERNEL __ */
 #define CHECK_STACK(stack) do { } while(0)
-#endif
+#define CDEBUG_STACK (0L)
+#endif /* __KERNEL__ */
 
 #if 1
 #define CDEBUG(mask, format, a...)                                            \
 do {                                                                          \
-        CHECK_STACK(CDEBUG_STACK());                                          \
+        CHECK_STACK(CDEBUG_STACK);                                            \
         if (!(mask) || ((mask) & (D_ERROR | D_EMERG)) ||                      \
             (portal_debug & (mask) &&                                         \
              portal_subsystem_debug & (1 << (DEBUG_SUBSYSTEM >> 24))))        \
                 portals_debug_msg(DEBUG_SUBSYSTEM, mask,                      \
                                   __FILE__, __FUNCTION__, __LINE__,           \
-                                  CDEBUG_STACK(), format , ## a);             \
+                                  CDEBUG_STACK, format, ## a);                \
 } while (0)
 
 #define CWARN(format, a...) CDEBUG(D_WARNING, format, ## a)
@@ -213,7 +214,8 @@ static inline void our_cond_resched(void)
 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) */
 
 #ifdef PORTAL_DEBUG
-extern void kportal_assertion_failed(char *expr,char *file,char *func,int line);
+extern void kportal_assertion_failed(char *expr, char *file, const char *func,
+                                     const int line);
 #define LASSERT(e) ((e) ? 0 : kportal_assertion_failed( #e , __FILE__,  \
                                                         __FUNCTION__, __LINE__))
 #else
@@ -563,7 +565,7 @@ extern struct prof_ent prof_ents[MAX_PROFS];
 #endif /* PORTALS_PROFILING */
 
 /* debug.c */
-void portals_run_lbug_upcall(char * file, char *fn, int line);
+void portals_run_lbug_upcall(char * file, const char *fn, const int line);
 void portals_debug_dumplog(void);
 int portals_debug_init(unsigned long bufsize);
 int portals_debug_cleanup(void);
@@ -581,12 +583,13 @@ __s32 portals_debug_copy_to_user(char *buf, unsigned long len);
 # warning printf has been defined as a macro...
 # undef printf
 #endif
-void portals_debug_msg (int subsys, int mask, char *file, char *fn, int line,
-                        unsigned long stack, const char *format, ...)
+void portals_debug_msg(int subsys, int mask, char *file, const char *fn,
+                       const int line, unsigned long stack,
+                       const char *format, ...)
         __attribute__ ((format (printf, 7, 8)));
 #else
-void portals_debug_msg (int subsys, int mask, char *file, char *fn,
-                        int line, unsigned long stack,
+void portals_debug_msg (int subsys, int mask, char *file, const char *fn,
+                        const int line, unsigned long stack,
                         const char *format, ...);
 #endif /* __GNUC__ */
 void portals_debug_set_level(unsigned int debug_level);
index 2b63312..78a1e2d 100644 (file)
@@ -1,6 +1,4 @@
 #ifndef _LINUX_LIST_H
-#define _LINUX_LIST_H
-
 
 /*
  * Simple doubly linked list implementation.
@@ -101,7 +99,9 @@ static inline void list_del_init(struct list_head *entry)
        __list_del(entry->prev, entry->next);
        INIT_LIST_HEAD(entry);
 }
+#endif
 
+#ifndef list_for_each_entry
 /**
  * list_move - delete from one list and add as another's head
  * @list: the entry to move
@@ -124,7 +124,10 @@ static inline void list_move_tail(struct list_head *list,
        __list_del(list->prev, list->next);
        list_add_tail(list, head);
 }
+#endif
 
+#ifndef _LINUX_LIST_H
+#define _LINUX_LIST_H
 /**
  * list_empty - tests whether a list is empty
  * @head: the list to test.
index 7d1b304..d389aab 100644 (file)
@@ -2,7 +2,7 @@
  * vim:expandtab:shiftwidth=8:tabstop=8:
  *
  * Compile with:
- * cc -I../../portals/include -o fio fio.c -L../../portals/linux/utils -lptlctl 
+ * cc -I../../portals/include -o fio fio.c -L../../portals/linux/utils -lptlctl
  */
 #ifndef __LTRACE_H_
 #define __LTRACE_H_
@@ -31,20 +31,20 @@ static inline int ltrace_write_file(char* fname)
         argv[0] = "debug_kernel";
         argv[1] = fname;
         argv[2] = "1";
-        
+
         fprintf(stderr, "[ptlctl] %s %s %s\n", argv[0], argv[1], argv[2]);
-        
+
         return jt_dbg_debug_kernel(3, argv);
 }
 
 static inline int ltrace_clear()
 {
         char* argv[1];
-        
+
         argv[0] = "clear";
-        
+
         fprintf(stderr, "[ptlctl] %s\n", argv[0]);
-        
+
         return jt_dbg_clear_debug_buf(1, argv);
 }
 
@@ -52,9 +52,9 @@ static inline int ltrace_mark(int indent_level, char* text)
 {
         char* argv[2];
         char mark_buf[PATH_MAX];
-        
+
         snprintf(mark_buf, PATH_MAX, "====%d=%s", indent_level, text);
-        
+
         argv[0] = "mark";
         argv[1] = mark_buf;
         return jt_dbg_mark_debug_buf(2, argv);
@@ -65,9 +65,9 @@ static inline int ltrace_applymasks()
         char* argv[2];
         argv[0] = "list";
         argv[1] = "applymasks";
-        
+
         fprintf(stderr, "[ptlctl] %s %s\n", argv[0], argv[1]);
-        
+
         return jt_dbg_list(2, argv);
 }
 
@@ -95,19 +95,19 @@ static inline int ltrace_start()
 #ifdef PORTALS_DEV_ID
         rc = register_ioc_dev(PORTALS_DEV_ID, PORTALS_DEV_PATH);
 #endif
-        ltrace_filter("class"); 
+        ltrace_filter("class");
         ltrace_filter("socknal");
-        ltrace_filter("qswnal"); 
-        ltrace_filter("gmnal");  
-        ltrace_filter("portals");  
-        
-        ltrace_show("all_types");  
-        ltrace_filter("trace");  
-        ltrace_filter("malloc"); 
-        ltrace_filter("net"); 
-        ltrace_filter("page"); 
-        ltrace_filter("other"); 
-        ltrace_filter("info"); 
+        ltrace_filter("qswnal");
+        ltrace_filter("gmnal");
+        ltrace_filter("portals");
+
+        ltrace_show("all_types");
+        ltrace_filter("trace");
+        ltrace_filter("malloc");
+        ltrace_filter("net");
+        ltrace_filter("page");
+        ltrace_filter("other");
+        ltrace_filter("info");
         ltrace_applymasks();
 
         return rc;
@@ -146,7 +146,7 @@ static inline void ltrace_add_processnames(char* fname)
         struct timezone tz;
         int nob;
         int underuml = !not_uml();
-        
+
         gettimeofday(&tv, &tz);
 
         nob = snprintf(cmdbuf, LTRACE_MAX_NOB, "ps --no-headers -eo \"");
@@ -167,7 +167,7 @@ static inline void ltrace_add_processnames(char* fname)
                                  "(%s:%d:%s() %d+%lu): ",
                                  "lltrace.h", __LINE__, __FUNCTION__, 0, 0L);
         }
-         
+
         nob += snprintf(cmdbuf+nob, LTRACE_MAX_NOB, " %%p %%c\" >> %s", fname);
         system(cmdbuf);
 }
index 4727599..760f465 100644 (file)
@@ -1,6 +1,3 @@
-/*
- */
-
 #ifndef _INCppidh_
 #define _INCppidh_
 
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 ce40a60..cd5d9d6 100644 (file)
@@ -1,4 +1,4 @@
-include ../Kernelenv
+include $(obj)/../Kernelenv
 
 obj-y = socknal/
-# more coming...
\ No newline at end of file
+# more coming...
index ceeea2a..0cffc15 100644 (file)
@@ -124,7 +124,7 @@ static nal_t *kgmnal_init(int interface, ptl_pt_index_t ptl_size,
         return &kgmnal_api;
 }
 
-static void __exit
+static void /*__exit*/
 kgmnal_finalize(void)
 {
         struct list_head *tmp;
index ceb7c8c..0eb4959 100644 (file)
@@ -106,7 +106,7 @@ typedef unsigned long kqsw_csum_t;
 #define KQSW_TX_MAXCONTIG              (1<<10) /* largest payload that gets made contiguous on transmit */
 
 #define KQSW_NTXMSGS                   8       /* # normal transmit messages */
-#define KQSW_NNBLK_TXMSGS              128     /* # reserved transmit messages if can't block */
+#define KQSW_NNBLK_TXMSGS              256     /* # reserved transmit messages if can't block */
 
 #define KQSW_NRXMSGS_LARGE             64      /* # large receive buffers */
 #define KQSW_EP_ENVELOPES_LARGE        128     /* # large ep envelopes */
index 3b47a25..c03d592 100644 (file)
@@ -617,6 +617,7 @@ kqswnal_sendmsg (nal_cb_t     *nal,
         if (ktx == NULL) {
                 kqswnal_cerror_hdr (hdr);
                 lib_finalize (&kqswnal_lib, private, cookie);
+                return (-1);
         }
 
         memcpy (ktx->ktx_buffer, hdr, sizeof (*hdr)); /* copy hdr from caller's stack */
index 1066d69..479cc2c 100644 (file)
@@ -112,7 +112,7 @@ static nal_t *kscimacnal_init(int interface, ptl_pt_index_t  ptl_size,
 
 
 /* Called by kernel at module unload time */
-static void __exit 
+static void /*__exit*/ 
 kscimacnal_finalize(void)
 {
         /* FIXME: How should the shutdown procedure really look? */
index 3e7d206..bc770c8 100644 (file)
@@ -1372,21 +1372,17 @@ int ksocknal_scheduler (void *arg)
         int                nloops = 0;
         int                id = sched - ksocknal_data.ksnd_schedulers;
         char               name[16];
-#if (CONFIG_SMP && CPU_AFFINITY)
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
-        int                cpu = cpu_logical_map(id % num_online_cpus());
-#else
-#warning "Take care of architecure specific logical APIC map"
-        int cpu = 1;    /* Have to change later. */
-#endif /* LINUX_VERSION_CODE */
-        
-        set_cpus_allowed (current, 1 << cpu);
-        id = cpu;
-#endif /* CONFIG_SMP && CPU_AFFINITY */
 
         snprintf (name, sizeof (name),"ksocknald[%d]", id);
         kportal_daemonize (name);
         kportal_blockallsigs ();
+
+#if (CONFIG_SMP && CPU_AFFINITY)
+        if ((cpu_online_map & (1 << id)) != 0)
+                current->cpus_allowed = (1 << id);
+        else
+                CERROR ("Can't set CPU affinity for %s\n", name);
+#endif /* CONFIG_SMP && CPU_AFFINITY */
         
         spin_lock_irqsave (&sched->kss_lock, flags);
 
index 1f5dc38..77ee473 100644 (file)
@@ -379,7 +379,7 @@ ktoenal_cmd(struct portal_ioctl_data * data, void * private)
 }
 
 
-void __exit
+void /*__exit*/
 ktoenal_module_fini (void)
 {
         CDEBUG(D_MALLOC, "before NAL cleanup: kmem %d\n",
index 5388f4b..2800788 100644 (file)
@@ -893,9 +893,10 @@ ktoenal_process_receive (ksock_conn_t *conn, long *irq_flags)
                                 spin_lock_irqsave (&ktoenal_data.ksnd_sched_lock, *irq_flags);
                                 goto get_fmb;   /* => go get a fwd msg buffer */
                         default:
-                                LBUG ();
+                                break;
                         }
                         /* Not Reached */
+                        LBUG ();
                 }
 
                 PROF_START(lib_parse);
@@ -934,10 +935,11 @@ ktoenal_process_receive (ksock_conn_t *conn, long *irq_flags)
                 goto out;                       /* (later) */
 
         default:
-                LBUG ();
+                break;
         }
 
         /* Not Reached */
+        LBUG ();
 
  out:
         spin_lock_irqsave (&ktoenal_data.ksnd_sched_lock, *irq_flags);
index 67d1a3d..7fa686f 100644 (file)
@@ -2,3 +2,4 @@
 Makefile
 Makefile.in
 link-stamp
+.*.o.cmd
index 3196ea2..9aa838f 100644 (file)
@@ -6,4 +6,4 @@
 include fs/lustre/portals/Kernelenv
 
 obj-y += libcfs.o
-licfs-objs    := module.o proc.o debug.o
\ No newline at end of file
+libcfs-objs    := module.o proc.o debug.o
index 491c954..07c0bed 100644 (file)
@@ -573,8 +573,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;
@@ -634,9 +634,9 @@ int portals_debug_mark_buffer(char *text)
         if (debug_buf == NULL)
                 return -EINVAL;
 
-        CDEBUG(0, "*******************************************************************************\n");
+        CDEBUG(0, "********************************************************\n");
         CDEBUG(0, "DEBUG MARKER: %s\n", text);
-        CDEBUG(0, "*******************************************************************************\n");
+        CDEBUG(0, "********************************************************\n");
 
         return 0;
 }
@@ -674,8 +674,8 @@ __s32 portals_debug_copy_to_user(char *buf, unsigned long len)
 
 /* FIXME: I'm not very smart; someone smarter should make this better. */
 void
-portals_debug_msg (int subsys, int mask, char *file, char *fn, int line,
-                   unsigned long stack, const char *format, ...)
+portals_debug_msg(int subsys, int mask, char *file, const char *fn,
+                  const int line, unsigned long stack, const char *format, ...)
 {
         va_list       ap;
         unsigned long flags;
@@ -792,7 +792,7 @@ void portals_debug_set_level(unsigned int debug_level)
         portal_debug = debug_level;
 }
 
-void portals_run_lbug_upcall(char * file, char *fn, int line)
+void portals_run_lbug_upcall(char *file, const char *fn, const int line)
 {
         char *argv[6];
         char *envp[3];
@@ -805,7 +805,7 @@ void portals_run_lbug_upcall(char * file, char *fn, int line)
         argv[0] = portals_upcall;
         argv[1] = "LBUG";
         argv[2] = file;
-        argv[3] = fn;
+        argv[3] = (char *)fn;
         argv[4] = buf;
         argv[5] = NULL;
 
index 5e3fcb5..e8eb290 100644 (file)
@@ -62,10 +62,10 @@ static struct nal_cmd_handler nal_cmd[NAL_MAX_NR + 1];
 struct semaphore nal_cmd_sem;
 
 #ifdef PORTAL_DEBUG
-void
-kportal_assertion_failed (char *expr, char *file, char *func, int line)
+void kportal_assertion_failed(char *expr, char *file, const char *func,
+                              const int line)
 {
-        portals_debug_msg(0, D_EMERG, file, func, line, CDEBUG_STACK(),
+        portals_debug_msg(0, D_EMERG, file, func, line, CDEBUG_STACK,
                           "ASSERTION(%s) failed\n", expr);
         LBUG_WITH_LOC(file, func, line);
 }
@@ -429,6 +429,7 @@ static int kportal_ioctl(struct inode *inode, struct file *file,
                         return (-EINVAL);
 
                 err = PtlFailNid (*nip, data->ioc_nid, data->ioc_count);
+                kportal_put_ni (data->ioc_nal);
                 break;
         }
 
index 5627ef7..7822846 100644 (file)
@@ -3,7 +3,10 @@
 # This code is issued under the GNU General Public License.
 # See the file COPYING in this distribution
 
-include ../Kernelenv
+include $(src)/../Kernelenv
 
 obj-y += portals.o
-portals-objs    := lib-dispatch.o lib-eq.o lib-init.o lib-md.o lib-me.o lib-move.o lib-msg.o lib-ni.o lib-not-impl.o lib-pid.o api-eq.o api-errno.o api-init.o api-md.o api-me.o api-ni.o api-wrap.o
+portals-objs    :=     lib-dispatch.o lib-eq.o lib-init.o lib-md.o lib-me.o \
+                       lib-move.o lib-msg.o lib-ni.o lib-pid.o \
+                       api-eq.o api-errno.o api-init.o api-me.o api-ni.o \
+                       api-wrap.o
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 64bd09b..9b02c03 100644 (file)
@@ -3,7 +3,7 @@
 # This code is issued under the GNU General Public License.
 # See the file COPYING in this distribution
 
-include ../Kernelenv
+include $(src)/../Kernelenv
 
 obj-y += kptlrouter.o
 kptlrouter-objs    := router.o proc.o
index 6074c3c..27a7fba 100644 (file)
@@ -23,8 +23,8 @@
 
 #include "router.h"
 
-struct list_head kpr_routes;
-struct list_head kpr_nals;
+LIST_HEAD(kpr_routes);
+LIST_HEAD(kpr_nals);
 
 unsigned long long kpr_fwd_bytes;
 unsigned long      kpr_fwd_packets;
@@ -35,7 +35,7 @@ atomic_t           kpr_queue_depth;
  *
  * Once in a blue moon we register/deregister NALs and add/remove routing
  * entries (thread context only)... */
-rwlock_t         kpr_rwlock;
+rwlock_t         kpr_rwlock = RW_LOCK_UNLOCKED;
 
 kpr_router_interface_t kpr_router_interface = {
        kprri_register:         kpr_register_nal,
@@ -55,7 +55,7 @@ kpr_control_interface_t kpr_control_interface = {
 int
 kpr_register_nal (kpr_nal_interface_t *nalif, void **argp)
 {
-       long               flags;
+       unsigned long      flags;
        struct list_head  *e;
        kpr_nal_entry_t   *ne;
 
@@ -98,7 +98,7 @@ kpr_register_nal (kpr_nal_interface_t *nalif, void **argp)
 void
 kpr_shutdown_nal (void *arg)
 {
-       long             flags;
+       unsigned long    flags;
        kpr_nal_entry_t *ne = (kpr_nal_entry_t *)arg;
 
         CDEBUG (D_OTHER, "Shutting down NAL %d\n", ne->kpne_interface.kprni_nalid);
@@ -123,7 +123,7 @@ kpr_shutdown_nal (void *arg)
 void
 kpr_deregister_nal (void *arg)
 {
-       long              flags;
+       unsigned long     flags;
        kpr_nal_entry_t  *ne = (kpr_nal_entry_t *)arg;
 
         CDEBUG (D_OTHER, "Deregister NAL %d\n", ne->kpne_interface.kprni_nalid);
@@ -296,7 +296,7 @@ int
 kpr_add_route (int gateway_nalid, ptl_nid_t gateway_nid, ptl_nid_t lo_nid,
                ptl_nid_t hi_nid)
 {
-       long               flags;
+       unsigned long      flags;
        struct list_head  *e;
        kpr_route_entry_t *re;
 
@@ -345,7 +345,7 @@ kpr_add_route (int gateway_nalid, ptl_nid_t gateway_nid, ptl_nid_t lo_nid,
 int
 kpr_del_route (ptl_nid_t nid)
 {
-       long               flags;
+       unsigned long      flags;
        struct list_head  *e;
 
         CDEBUG(D_OTHER, "Del route "LPX64"\n", nid);
@@ -398,7 +398,7 @@ kpr_get_route(int idx, int *gateway_nalid, ptl_nid_t *gateway_nid,
         return (-ENOENT);
 }
 
-static void __exit
+static void /*__exit*/
 kpr_finalise (void)
 {
         LASSERT (list_empty (&kpr_nals));
@@ -427,10 +427,6 @@ kpr_initialise (void)
         CDEBUG(D_MALLOC, "kpr_initialise: kmem %d\n",
                atomic_read(&portal_kmemory));
 
-       rwlock_init(&kpr_rwlock);
-       INIT_LIST_HEAD(&kpr_routes);
-       INIT_LIST_HEAD(&kpr_nals);
-
         kpr_proc_init();
 
         PORTAL_SYMBOL_REGISTER(kpr_router_interface);
index 051d1bd..d0c4c88 100644 (file)
@@ -1,3 +1,4 @@
 Makefile
 Makefile.in
 .deps
+.*.o.cmd
index 389ffbb..4d04ffb 100644 (file)
@@ -260,7 +260,7 @@ pingcli_start(struct portal_ioctl_data *args)
 
 
 /* called by the portals_ioctl for ping requests */
-static int kping_client(struct portal_ioctl_data *args)
+int kping_client(struct portal_ioctl_data *args)
 {
         PORTAL_ALLOC (client, sizeof(struct pingcli_data));
         if (client == NULL)
@@ -282,7 +282,7 @@ static int __init pingcli_init(void)
 } /* pingcli_init() */
 
 
-static void __exit pingcli_cleanup(void)
+static void /*__exit*/ pingcli_cleanup(void)
 {
         PORTAL_SYMBOL_UNREGISTER (kping_client);
 } /* pingcli_cleanup() */
index 1037d09..873e11c 100644 (file)
 #include <asm/semaphore.h>
 
 #define STDSIZE (sizeof(int) + sizeof(int) + sizeof(struct timeval))
-#define MAXSIZE (16*1024*1024)
+#define MAXSIZE (16*1024)
 
 static unsigned ping_head_magic;
 static unsigned ping_bulk_magic;
-static int nal  = 0;                            // Your NAL,
+static int nal  = SOCKNAL;                            // Your NAL,
 static unsigned long packets_valid = 0;         // Valid packets 
 static int running = 1;
 atomic_t pkt;
@@ -282,7 +282,7 @@ static int __init pingsrv_init(void)
 } /* pingsrv_init() */
 
 
-static void __exit pingsrv_cleanup(void)
+static void /*__exit*/ pingsrv_cleanup(void)
 {
         remove_proc_entry ("net/pingsrv", NULL);
         
index 4cef08b..35e114b 100644 (file)
@@ -235,7 +235,7 @@ pingcli_start(struct portal_ioctl_data *args)
 
 
 /* called by the portals_ioctl for ping requests */
-static int kping_client(struct portal_ioctl_data *args)
+int kping_client(struct portal_ioctl_data *args)
 {
 
         PORTAL_ALLOC (client, sizeof(struct pingcli_data));
@@ -258,7 +258,7 @@ static int __init pingcli_init(void)
 } /* pingcli_init() */
 
 
-static void __exit pingcli_cleanup(void)
+static void /*__exit*/ pingcli_cleanup(void)
 {
         PORTAL_SYMBOL_UNREGISTER (kping_client);
 } /* pingcli_cleanup() */
index a18ea35..2b45a46 100644 (file)
@@ -269,7 +269,7 @@ static int __init pingsrv_init(void)
 } /* pingsrv_init() */
 
 
-static void __exit pingsrv_cleanup(void)
+static void /*__exit*/ pingsrv_cleanup(void)
 {
         remove_proc_entry ("net/pingsrv", NULL);
         
index 529bb2d..b73f042 100644 (file)
@@ -84,8 +84,8 @@ int portals_debug_copy_to_user(char *buf, unsigned long len)
 
 /* FIXME: I'm not very smart; someone smarter should make this better. */
 void
-portals_debug_msg (int subsys, int mask, char *file, char *fn, int line,
-                   const char *format, ...)
+portals_debug_msg (int subsys, int mask, char *file, const char *fn, 
+                   const int line, const char *format, ...)
 {
         va_list       ap;
         unsigned long flags;
index 9ab1c73..78271d5 100644 (file)
@@ -551,6 +551,8 @@ int jt_dbg_modules(int argc, char **argv)
                 {"mds_ext3", "lustre/mds"},
                 {"mds_extN", "lustre/mds"},
                 {"ptlbd", "lustre/ptlbd"},
+                {"mgmt_svc", "lustre/mgmt"},
+                {"mgmt_cli", "lustre/mgmt"},
                 {NULL, NULL}
         };
         char *path = "..";
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 37da12c..99bc59b 100644 (file)
@@ -21,12 +21,15 @@ do_stat (int fd)
 {
    static char  buffer[1024];
    static double last = 0.0;
+   static unsigned long long old_bytes;
+   static unsigned long      old_packets;
+   static unsigned long      old_errors;
    double now;
    double t;
-   long long bytes;
-   long      packets;
-   long      errors;
-   long      depth;
+   unsigned long long new_bytes, bytes;
+   unsigned long      new_packets, packets;
+   unsigned long      new_errors, errors;
+   unsigned long      depth;
    int    n;
    
    lseek (fd, 0, SEEK_SET);
@@ -39,7 +42,8 @@ do_stat (int fd)
    }    
    buffer[n] = 0;
    
-   n = sscanf (buffer, "%Ld %ld %ld %ld", &bytes, &packets, &errors, &depth);
+   n = sscanf (buffer, "%Lu %lu %lu %lu",
+              &new_bytes, &new_packets, &new_errors, &depth);
    
    if (n < 3)
    {
@@ -48,27 +52,44 @@ do_stat (int fd)
    }
    
    if (last == 0.0)
-      printf ("%Ld bytes, %ld packets (sz %Ld) %ld errors", 
-             bytes, packets, (long long)((packets == 0) ? 0LL : bytes/packets), errors);
+      printf ("%llu bytes, %lu packets (sz %lld), %lu errors", 
+             new_bytes, new_packets,
+             (long long)((new_packets == 0) ? 0LL : new_bytes/new_packets),
+             new_errors);
    else
    {
       t = now - last;
 
-      printf ("%9Ld (%7.2fMb/s), %7ld packets (sz %5Ld, %5ld/s) %ld errors (%ld/s)", 
+      if (new_bytes < old_bytes)
+         bytes = -1ULL - old_bytes + new_bytes + 1;
+      else
+         bytes = new_bytes - old_bytes;
+      if (new_packets < old_packets)
+         packets = -1UL - old_packets + new_packets + 1;
+      else
+         packets = new_packets - old_packets;
+      if (new_errors < old_errors)
+         errors = -1UL - old_errors + new_errors + 1;
+      else
+         errors = new_errors - old_errors;
+      
+      printf ("%9llu bytes (%7.2fMb/s), %7lu packets (sz %5lld, %5ld/s), %lu errors (%ld/s)", 
              bytes, ((double)bytes)/((1<<20) * t),
              packets, (long long)((packets == 0) ? 0LL : bytes/packets), (long)(packets/t),
              errors, (long)(errors/t));
    }
+   old_bytes = new_bytes;
+   old_packets = new_packets;
+   old_errors = new_errors;
 
    if (n == 4)
-      printf (" (%ld)\n", depth);
+      printf (", depth (%ld)\n", depth);
    else
       printf ("\n");
 
    fflush (stdout);
    
    lseek (fd, 0, SEEK_SET);
-   write (fd, "\n", 1);
    last = timenow();
 }
 
@@ -80,7 +101,7 @@ int main (int argc, char **argv)
    if (argc > 1)
       interval = atoi (argv[1]);
 
-   fd = open ("/proc/sys/portals/router", O_RDWR);
+   fd = open ("/proc/sys/portals/router", O_RDONLY);
    if (fd < 0)
    {
       fprintf (stderr, "Can't open stat: %s\n", strerror (errno));
index ec95f89..cb39d30 100755 (executable)
@@ -143,6 +143,7 @@ sub process_stats()
                        }
                }
                print "\n";
+               $| = 1;
        }
 }