Whamcloud - gitweb
merge b_devel to b_eq: 20030728
authorericm <ericm>
Mon, 28 Jul 2003 15:33:11 +0000 (15:33 +0000)
committerericm <ericm>
Mon, 28 Jul 2003 15:33:11 +0000 (15:33 +0000)
(1) portals

32 files changed:
lnet/archdep.m4
lnet/include/config.h.in
lnet/include/linux/kp30.h
lnet/include/lnet/lib-types.h
lnet/klnds/qswlnd/qswlnd.h
lnet/klnds/qswlnd/qswlnd_cb.c
lnet/klnds/socklnd/.cvsignore
lnet/klnds/socklnd/Makefile.mk
lnet/klnds/socklnd/socklnd.c
lnet/klnds/socklnd/socklnd.h
lnet/klnds/socklnd/socklnd_cb.c
lnet/libcfs/debug.c
lnet/lnet/api-init.c
lnet/utils/.cvsignore
lnet/utils/Makefile.am
lnet/utils/debug.c
lustre/portals/archdep.m4
lustre/portals/include/config.h.in
lustre/portals/include/linux/kp30.h
lustre/portals/include/portals/lib-types.h
lustre/portals/knals/qswnal/qswnal.h
lustre/portals/knals/qswnal/qswnal_cb.c
lustre/portals/knals/socknal/.cvsignore
lustre/portals/knals/socknal/Makefile.mk
lustre/portals/knals/socknal/socknal.c
lustre/portals/knals/socknal/socknal.h
lustre/portals/knals/socknal/socknal_cb.c
lustre/portals/libcfs/debug.c
lustre/portals/portals/api-init.c
lustre/portals/utils/.cvsignore
lustre/portals/utils/Makefile.am
lustre/portals/utils/debug.c

index c1455c3..db14c29 100644 (file)
@@ -198,7 +198,7 @@ if test $host_cpu != "lib" ; then
   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)
 
@@ -338,5 +338,5 @@ if test $RH_2_4_20 = 1; then
        AC_MSG_RESULT(redhat-2.4.20)
        CPPFLAGS="$CPPFLAGS -DCONFIG_RH_2_4_20"
 else
-       AC_MSG_RESULT($RELEASE)
+       AC_MSG_RESULT($LINUXRELEASE)
 fi 
index a4b1e1e..f9605ab 100644 (file)
@@ -1,14 +1,64 @@
-/* portals/include/config.h.in.  Generated automatically from configure.in by autoheader.  */
+/* portals/include/config.h.in.  Generated from configure.in by autoheader.  */
 
-/* The number of bytes in a unsigned long long.  */
-#undef SIZEOF_UNSIGNED_LONG_LONG
+/* Compile with orphan support */
+#undef ENABLE_ORPHANS
 
-/* Name of package */
-#undef PACKAGE
+/* Use the Pinger */
+#undef ENABLE_PINGER
 
-/* Version number of package */
-#undef VERSION
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
 
 /* IOCTL Buffer Size */
 #undef OBD_MAX_IOCTL_BUFFER
 
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* The size of a `unsigned long long', as computed by sizeof. */
+#undef SIZEOF_UNSIGNED_LONG_LONG
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION
index 6088b7f..2133391 100644 (file)
@@ -4,10 +4,6 @@
 #ifndef _KP30_INCLUDED
 #define _KP30_INCLUDED
 
-#ifdef __KERNEL__
-#include <linux/config.h>
-#endif
-
 #define PORTAL_DEBUG
 
 #ifndef offsetof
@@ -23,40 +19,34 @@ extern unsigned int portal_subsystem_debug;
 extern unsigned int portal_stack;
 extern unsigned int portal_debug;
 extern unsigned int portal_printk;
-/* Debugging subsystems  (8 bit ID)
- *
- * If you add debug subsystem #32, you need to send email to phil, because
- * you're going to break kernel subsystem debug filtering. */
-#define S_UNDEFINED    (0 << 24)
-#define S_MDC          (1 << 24)
-#define S_MDS          (2 << 24)
-#define S_OSC          (3 << 24)
-#define S_OST          (4 << 24)
-#define S_CLASS        (5 << 24)
-#define S_OBDFS        (6 << 24) /* obsolete */
-#define S_LLITE        (7 << 24)
-#define S_RPC          (8 << 24)
-#define S_EXT2OBD      (9 << 24) /* obsolete */
-#define S_PORTALS     (10 << 24)
-#define S_SOCKNAL     (11 << 24)
-#define S_QSWNAL      (12 << 24)
-#define S_PINGER      (13 << 24)
-#define S_FILTER      (14 << 24)
-#define S_TRACE       (15 << 24) /* obsolete */
-#define S_ECHO        (16 << 24)
-#define S_LDLM        (17 << 24)
-#define S_LOV         (18 << 24)
-#define S_GMNAL       (19 << 24)
-#define S_PTLROUTER   (20 << 24)
-#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
+/* Debugging subsystems (32 bits, non-overlapping) */
+#define S_UNDEFINED    (1 << 0)
+#define S_MDC          (1 << 1)
+#define S_MDS          (1 << 2)
+#define S_OSC          (1 << 3)
+#define S_OST          (1 << 4)
+#define S_CLASS        (1 << 5)
+#define S_LOG          (1 << 6)
+#define S_LLITE        (1 << 7)
+#define S_RPC          (1 << 8)
+#define S_MGMT         (1 << 9)
+#define S_PORTALS     (1 << 10)
+#define S_SOCKNAL     (1 << 11)
+#define S_QSWNAL      (1 << 12)
+#define S_PINGER      (1 << 13)
+#define S_FILTER      (1 << 14)
+#define S_PTLBD       (1 << 15)
+#define S_ECHO        (1 << 16)
+#define S_LDLM        (1 << 17)
+#define S_LOV         (1 << 18)
+#define S_GMNAL       (1 << 19)
+#define S_PTLROUTER   (1 << 20)
+#define S_COBD        (1 << 21)
+
+/* If you change these values, please keep portals/utils/debug.c
  * up to date! */
 
-/* Debugging masks (24 bits, non-overlapping) */
+/* Debugging masks (32 bits, non-overlapping) */
 #define D_TRACE     (1 << 0) /* ENTRY/EXIT markers */
 #define D_INODE     (1 << 1)
 #define D_SUPER     (1 << 2)
@@ -108,7 +98,7 @@ extern unsigned int portal_printk;
                       /*panic("LBUG");*/                                      \
                 }                                                             \
         } while (0)
-#else /* __KERNEL __ */
+#else /* __KERNEL__ */
 #define CHECK_STACK(stack) do { } while(0)
 #define CDEBUG_STACK (0L)
 #endif /* __KERNEL__ */
@@ -119,7 +109,7 @@ do {                                                                          \
         CHECK_STACK(CDEBUG_STACK);                                            \
         if (!(mask) || ((mask) & (D_ERROR | D_EMERG)) ||                      \
             (portal_debug & (mask) &&                                         \
-             portal_subsystem_debug & (1 << (DEBUG_SUBSYSTEM >> 24))))        \
+             portal_subsystem_debug & DEBUG_SUBSYSTEM))                       \
                 portals_debug_msg(DEBUG_SUBSYSTEM, mask,                      \
                                   __FILE__, __FUNCTION__, __LINE__,           \
                                   CDEBUG_STACK, format, ## a);                \
@@ -166,7 +156,6 @@ do {                                                                    \
 #define EXIT                            do { } while (0)
 #endif
 
-
 #ifdef __KERNEL__
 # include <linux/vmalloc.h>
 # include <linux/time.h>
@@ -572,7 +561,7 @@ int portals_debug_cleanup(void);
 int portals_debug_clear_buffer(void);
 int portals_debug_mark_buffer(char *text);
 int portals_debug_set_daemon(unsigned int cmd, unsigned int length,
-                char *file, unsigned int size);
+                             char *file, unsigned int size);
 __s32 portals_debug_copy_to_user(char *buf, unsigned long len);
 #if (__GNUC__)
 /* Use the special GNU C __attribute__ hack to have the compiler check the
@@ -588,9 +577,9 @@ void portals_debug_msg(int subsys, int mask, char *file, const char *fn,
                        const char *format, ...)
         __attribute__ ((format (printf, 7, 8)));
 #else
-void portals_debug_msg (int subsys, int mask, char *file, const char *fn,
-                        const 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, ...);
 #endif /* __GNUC__ */
 void portals_debug_set_level(unsigned int debug_level);
 
@@ -624,9 +613,9 @@ extern void kportal_blockallsigs (void);
 # define PORTAL_ALLOC(ptr, size) do { (ptr) = malloc(size); } while (0);
 # define PORTAL_FREE(a, b) do { free(a); } while (0);
 # define portals_debug_msg(subsys, mask, file, fn, line, stack, format, a...) \
-    printf ("%02x:%06x (@%lu %s:%s,l. %d %d %lu): " format,                    \
-            (subsys) >> 24, (mask), (long)time(0), file, fn, line,            \
-            getpid() , stack, ## a);
+    printf("%02x:%06x (@%lu %s:%s,l. %d %d %lu): " format,                    \
+           (subsys), (mask), (long)time(0), file, fn, line,                   \
+           getpid() , stack, ## a);
 #endif
 
 #ifndef CURRENT_TIME
@@ -917,13 +906,13 @@ ptl_handle_ni_t *kportal_get_ni (int nal);
 void kportal_put_ni (int nal);
 
 #ifdef __CYGWIN__
-#ifndef BITS_PER_LONG
-#if (~0UL) == 0xffffffffUL
-#define BITS_PER_LONG 32
-#else
-#define BITS_PER_LONG 64
-#endif
-#endif
+# ifndef BITS_PER_LONG
+#  if (~0UL) == 0xffffffffUL
+#   define BITS_PER_LONG 32
+#  else
+#   define BITS_PER_LONG 64
+#  endif
+# endif
 #endif
 
 #if (BITS_PER_LONG == 32 || __WORDSIZE == 32)
index 47c0dd2..9db8489 100644 (file)
@@ -137,11 +137,8 @@ typedef struct {
 } lib_counters_t;
 
 /* temporary expedient: limit number of entries in discontiguous MDs */
-#if PTL_LARGE_MTU
-# define PTL_MD_MAX_IOV        64
-#else
-# define PTL_MD_MAX_IOV 16
-#endif
+# define PTL_MTU        (512<<10)
+# define PTL_MD_MAX_IOV 128
 
 struct lib_msg_t {
         struct list_head  msg_list;
index 0eb4959..ef19ace 100644 (file)
@@ -95,12 +95,7 @@ typedef unsigned long kqsw_csum_t;
  * Performance Tuning defines
  * NB no mention of PAGE_SIZE for interoperability
  */
-#if PTL_LARGE_MTU
-# define KQSW_MAXPAYLOAD               (256<<10) /* biggest message this NAL will cope with */
-#else
-# define KQSW_MAXPAYLOAD               (64<<10) /* biggest message this NAL will cope with */
-#endif
-
+#define KQSW_MAXPAYLOAD                 PTL_MTU
 #define KQSW_SMALLPAYLOAD              ((4<<10) - KQSW_HDR_SIZE) /* small/large ep receiver breakpoint */
 
 #define KQSW_TX_MAXCONTIG              (1<<10) /* largest payload that gets made contiguous on transmit */
index c03d592..35c7c6c 100644 (file)
@@ -895,6 +895,11 @@ kqswnal_rxhandler(EP_RXD *rxd)
                 return;
         }
 
+        if (!in_interrupt()) {
+                kqswnal_rx (krx);
+                return;
+        }
+
         atomic_inc (&kqswnal_packets_received);
 
         spin_lock_irqsave (&kqswnal_data.kqn_sched_lock, flags);
index e995588..95973d6 100644 (file)
@@ -1,3 +1,4 @@
 .deps
 Makefile
 Makefile.in
+.*.o.cmd
index 46edf01..5c1b366 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 += ksocknal.o
 ksocknal-objs    := socknal.o socknal_cb.o
index 3e65faa..c9681a4 100644 (file)
@@ -166,7 +166,7 @@ ksocknal_add_sock (ptl_nid_t nid, int fd, int bind_irq)
         struct socket     *sock = NULL;
         ksock_sched_t     *sched = NULL;
         unsigned int       irq = 0;
-        struct net_device *dev = NULL;
+        struct dst_entry  *dst;
         int                ret;
         int                idx;
         ENTRY;
@@ -187,12 +187,16 @@ ksocknal_add_sock (ptl_nid_t nid, int fd, int bind_irq)
         if (!conn)
                 GOTO(error, ret);
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
         sock->sk->allocation = GFP_NOFS;    /* don't call info fs for alloc */
+#else
+#warning Zach, Eric: fix me!!
+#endif
 
         conn->ksnc_file = file;
         conn->ksnc_sock = sock;
-        conn->ksnc_saved_data_ready = sock->sk->data_ready;
-        conn->ksnc_saved_write_space = sock->sk->write_space;
+        conn->ksnc_saved_data_ready = sock->sk->sk_data_ready;
+        conn->ksnc_saved_write_space = sock->sk->sk_write_space;
         conn->ksnc_peernid = nid;
         atomic_set (&conn->ksnc_refcount, 1);    /* 1 ref for socklist */
 
@@ -204,22 +208,18 @@ ksocknal_add_sock (ptl_nid_t nid, int fd, int bind_irq)
         conn->ksnc_tx_ready = 0;
         conn->ksnc_tx_scheduled = 0;
 
-        /* XXX check it is OK to derefence sk->dst_cache->dev like this... */
-        lock_sock (conn->ksnc_sock->sk);
-
-        if (conn->ksnc_sock->sk->dst_cache != NULL) {
-                dev = conn->ksnc_sock->sk->dst_cache->dev;
-                if (dev != NULL) {
-                        irq = dev->irq;
+        dst = sk_dst_get (conn->ksnc_sock->sk);
+        if (dst != NULL) {
+                if (dst->dev != NULL) {
+                        irq = dst->dev->irq;
                         if (irq >= NR_IRQS) {
                                 CERROR ("Unexpected IRQ %x\n", irq);
                                 irq = 0;
                         }
                 }
+                dst_release (dst);
         }
 
-        release_sock (conn->ksnc_sock->sk);
-
         write_lock_irqsave (&ksocknal_data.ksnd_socklist_lock, flags);
 
         if (irq == 0 ||
@@ -268,9 +268,9 @@ ksocknal_add_sock (ptl_nid_t nid, int fd, int bind_irq)
                 ksocknal_bind_irq (irq, sched - ksocknal_data.ksnd_schedulers);
 
         /* NOW it's safe to get called back when socket is ready... */
-        sock->sk->user_data = conn;
-        sock->sk->data_ready = ksocknal_data_ready;
-        sock->sk->write_space = ksocknal_write_space;
+        sock->sk->sk_user_data = conn;
+        sock->sk->sk_data_ready = ksocknal_data_ready;
+        sock->sk->sk_write_space = ksocknal_write_space;
 
         /* ...which I call right now to get things going */
         ksocknal_data_ready (sock->sk, 0);
@@ -292,7 +292,7 @@ error:
 int
 ksocknal_close_sock(ptl_nid_t nid)
 {
-        long               flags;
+        unsigned long      flags;
         ksock_conn_t      *conn;
         LIST_HEAD         (death_row);
         struct list_head  *tmp;
@@ -329,8 +329,8 @@ ksocknal_close_sock(ptl_nid_t nid)
                 /* NB I _have_ to restore the callback, rather than storing
                  * a noop, since the socket could survive past this module
                  * being unloaded!! */
-                conn->ksnc_sock->sk->data_ready = conn->ksnc_saved_data_ready;
-                conn->ksnc_sock->sk->write_space = conn->ksnc_saved_write_space;
+                conn->ksnc_sock->sk->sk_data_ready = conn->ksnc_saved_data_ready;
+                conn->ksnc_sock->sk->sk_write_space = conn->ksnc_saved_write_space;
 
                 /* OK; no more callbacks, but they could be in progress now,
                  * so wait for them to complete... */
@@ -339,7 +339,7 @@ ksocknal_close_sock(ptl_nid_t nid)
                 /* ...however if I get the lock before a callback gets it,
                  * this will make them noop
                  */
-                conn->ksnc_sock->sk->user_data = NULL;
+                conn->ksnc_sock->sk->sk_user_data = NULL;
 
                 /* And drop the scheduler's connection count while I've got
                  * the exclusive lock */
@@ -385,8 +385,8 @@ ksocknal_push_conn (ksock_conn_t *conn)
         oldmm = get_fs ();
         set_fs (KERNEL_DS);
 
-        rc = sk->prot->setsockopt (sk, SOL_TCP, TCP_NODELAY,
-                                   (char *)&val, sizeof (val));
+        rc = sk->sk_prot->setsockopt (sk, SOL_TCP, TCP_NODELAY,
+                                      (char *)&val, sizeof (val));
         LASSERT (rc == 0);
 
         set_fs (oldmm);
@@ -505,16 +505,11 @@ _ksocknal_put_conn (ksock_conn_t *conn)
          * "That's a summons, mate..." */
 
         LASSERT (atomic_read (&conn->ksnc_refcount) == 0);
-        LASSERT (conn->ksnc_sock->sk->data_ready != ksocknal_data_ready);
-        LASSERT (conn->ksnc_sock->sk->write_space != ksocknal_write_space);
-        LASSERT (conn->ksnc_sock->sk->user_data == NULL);
+        LASSERT (conn->ksnc_sock->sk->sk_data_ready != ksocknal_data_ready);
+        LASSERT (conn->ksnc_sock->sk->sk_write_space != ksocknal_write_space);
+        LASSERT (conn->ksnc_sock->sk->sk_user_data == NULL);
         LASSERT (!conn->ksnc_rx_scheduled);
 
-        if (!in_interrupt()) {
-                ksocknal_close_conn (conn);
-                return;
-        }
-
         spin_lock_irqsave (&ksocknal_data.ksnd_reaper_lock, flags);
 
         list_add (&conn->ksnc_list, &ksocknal_data.ksnd_reaper_list);
index 62f9265..47ccd62 100644 (file)
 
 #define SOCKNAL_N_SCHED num_online_cpus()       /* # socknal schedulers */
 
-#if PTL_LARGE_MTU
-# define SOCKNAL_MAX_FWD_PAYLOAD (256<<10)      /* biggest payload I can forward */
-#else
-# define SOCKNAL_MAX_FWD_PAYLOAD (64<<10)       /* biggest payload I can forward */
-#endif
+#define SOCKNAL_MAX_FWD_PAYLOAD PTL_MTU         /* biggest payload I can forward */
 
 #define SOCKNAL_NLTXS           128             /* # normal transmit messages */
 #define SOCKNAL_NNBLK_LTXS     128             /* # transmit messages reserved if can't block */
 
 #define SOCKNAL_RESCHED         100             /* # scheduler loops before reschedule */
 
-#define SOCKNAL_TX_LOW_WATER(sk) (((sk)->sndbuf*8)/10)
+#define SOCKNAL_TX_LOW_WATER(sk) (((sk)->sk_sndbuf*8)/10)
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,72))
+# define sk_data_ready data_ready
+# define sk_write_space write_space
+# define sk_user_data   user_data
+# define sk_prot        prot
+# define sk_sndbuf      sndbuf
+# define sk_socket      socket
+#endif
 
 typedef struct                                  /* pool of forwarding buffers */
 {
@@ -242,7 +247,7 @@ typedef struct
         
         /* READER */
         struct list_head    ksnc_rx_list;       /* where I enq waiting input or a forwarding descriptor */
-        volatile int        ksnc_rx_ready;      /* data ready to read */
+        int                 ksnc_rx_ready;      /* data ready to read */
         int                 ksnc_rx_scheduled;  /* being progressed */
         int                 ksnc_rx_state;      /* what is being read */
         int                 ksnc_rx_nob_left;   /* # bytes to next hdr/body  */
@@ -258,7 +263,7 @@ typedef struct
         /* WRITER */
         struct list_head    ksnc_tx_list;       /* where I enq waiting for output space */
         struct list_head    ksnc_tx_queue;      /* packets waiting to be sent */
-        volatile int        ksnc_tx_ready;      /* write space */
+        int                 ksnc_tx_ready;      /* write space */
         int                 ksnc_tx_scheduled;  /* being progressed */
 
 } ksock_conn_t;
index bc770c8..552ea50 100644 (file)
@@ -141,7 +141,7 @@ ksocknal_dist(nal_cb_t *nal, ptl_nid_t nid, unsigned long *dist)
 ksock_ltx_t *
 ksocknal_get_ltx (int may_block)
 {
-        long             flags;
+        unsigned long flags;
         ksock_ltx_t *ltx = NULL;
 
         for (;;) {
@@ -253,7 +253,7 @@ ksocknal_send_iov (struct socket *sock, ksock_tx_t *tx, int more)
                 mm_segment_t oldmm = get_fs();
                 
                 set_fs (KERNEL_DS);
-                rc = sock->sk->prot->sendmsg(sock->sk, &msg, fragsize);
+                rc = sock_sendmsg(sock, &msg, fragsize);
                 set_fs (oldmm);
         } 
 
@@ -322,7 +322,7 @@ ksocknal_send_kiov (struct socket *sock, ksock_tx_t *tx, int more)
                 mm_segment_t  oldmm = get_fs();
                 
                 set_fs (KERNEL_DS);
-                rc = sock->sk->prot->sendmsg(sock->sk, &msg, fragsize);
+                rc = sock_sendmsg(sock, &msg, fragsize);
                 set_fs (oldmm);
                 kunmap (page);
         }
@@ -527,7 +527,7 @@ ksocknal_zc_callback (zccd_t *zcd)
 void
 ksocknal_tx_done (ksock_tx_t *tx)
 {
-        long           flags;
+        unsigned long flags;
         ksock_ltx_t   *ltx;
         ENTRY;
 
@@ -559,7 +559,7 @@ ksocknal_tx_done (ksock_tx_t *tx)
 }
 
 void
-ksocknal_process_transmit (ksock_sched_t *sched, long *irq_flags)
+ksocknal_process_transmit (ksock_sched_t *sched, unsigned long *irq_flags)
 {
         ksock_conn_t *conn;
         ksock_tx_t *tx;
@@ -882,7 +882,7 @@ ksocknal_fmb_callback (void *arg, int error)
         ptl_hdr_t         *hdr = (ptl_hdr_t *) page_address(fmb->fmb_pages[0]);
         ksock_conn_t      *conn = NULL;
         ksock_sched_t     *sched;
-        long               flags;
+        unsigned long      flags;
 
         if (error != 0)
                 CERROR("Failed to route packet from "LPX64" to "LPX64": %d\n",
@@ -930,7 +930,7 @@ ksocknal_get_idle_fmb (ksock_conn_t *conn)
 {
         int               payload_nob = conn->ksnc_rx_nob_left;
         int               packet_nob = sizeof (ptl_hdr_t) + payload_nob;
-        long              flags;
+        unsigned long     flags;
         ksock_fmb_pool_t *pool;
         ksock_fmb_t      *fmb;
 
@@ -1174,7 +1174,7 @@ ksocknal_new_packet (ksock_conn_t *conn, int nob_to_skip)
 }
 
 void
-ksocknal_process_receive (ksock_sched_t *sched, long *irq_flags)
+ksocknal_process_receive (ksock_sched_t *sched, unsigned long *irq_flags)
 {
         ksock_conn_t *conn;
         ksock_fmb_t  *fmb;
@@ -1295,10 +1295,11 @@ ksocknal_process_receive (ksock_sched_t *sched, long *irq_flags)
                 goto out;                       /* (later) */
 
         default:
-                LBUG ();
+                break;
         }
 
         /* Not Reached */
+        LBUG ();
 
  out:
         spin_lock_irqsave (&sched->kss_lock, *irq_flags);
@@ -1383,7 +1384,7 @@ int ksocknal_scheduler (void *arg)
         else
                 CERROR ("Can't set CPU affinity for %s\n", name);
 #endif /* CONFIG_SMP && CPU_AFFINITY */
-        
+
         spin_lock_irqsave (&sched->kss_lock, flags);
 
         while (!ksocknal_data.ksnd_shuttingdown) {
@@ -1460,10 +1461,10 @@ ksocknal_data_ready (struct sock *sk, int n)
         /* interleave correctly with closing sockets... */
         read_lock (&ksocknal_data.ksnd_socklist_lock);
 
-        conn = sk->user_data;
+        conn = sk->sk_user_data;
         if (conn == NULL) {             /* raced with ksocknal_close_sock */
-                LASSERT (sk->data_ready != &ksocknal_data_ready);
-                sk->data_ready (sk, n);
+                LASSERT (sk->sk_data_ready != &ksocknal_data_ready);
+                sk->sk_data_ready (sk, n);
         } else if (!conn->ksnc_rx_ready) {        /* new news */
                 /* Set ASAP in case of concurrent calls to me */
                 conn->ksnc_rx_ready = 1;
@@ -1504,11 +1505,11 @@ ksocknal_write_space (struct sock *sk)
         /* interleave correctly with closing sockets... */
         read_lock (&ksocknal_data.ksnd_socklist_lock);
 
-        conn = sk->user_data;
+        conn = sk->sk_user_data;
 
         CDEBUG(D_NET, "sk %p wspace %d low water %d conn %p%s%s%s\n",
                sk, tcp_wspace(sk), SOCKNAL_TX_LOW_WATER(sk), conn,
-               (conn == NULL) ? "" : (test_bit (0, &conn->ksnc_tx_ready) ?
+               (conn == NULL) ? "" : (conn->ksnc_tx_ready ?
                                       " ready" : " blocked"),
                (conn == NULL) ? "" : (conn->ksnc_tx_scheduled ?
                                       " scheduled" : " idle"),
@@ -1516,10 +1517,10 @@ ksocknal_write_space (struct sock *sk)
                                       " empty" : " queued"));
 
         if (conn == NULL) {             /* raced with ksocknal_close_sock */
-                LASSERT (sk->write_space != &ksocknal_write_space);
-                sk->write_space (sk);
+                LASSERT (sk->sk_write_space != &ksocknal_write_space);
+                sk->sk_write_space (sk);
         } else if (tcp_wspace(sk) >= SOCKNAL_TX_LOW_WATER(sk)) { /* got enough space */
-                clear_bit (SOCK_NOSPACE, &sk->socket->flags);
+                clear_bit (SOCK_NOSPACE, &sk->sk_socket->flags);
 
                 if (!conn->ksnc_tx_ready) {      /* new news */
                         /* Set ASAP in case of concurrent calls to me */
index 07c0bed..9d15c8f 100644 (file)
@@ -50,6 +50,7 @@
 # define DEBUG_SUBSYSTEM S_PORTALS
 
 #include <linux/kp30.h>
+#include <linux/portals_compat25.h>
 
 #define DEBUG_OVERFLOW 1024
 static char *debug_buf = NULL;
@@ -235,7 +236,7 @@ int portals_do_debug_dumplog(void *arg)
         reparent_to_init();
         journal_info = current->journal_info;
         current->journal_info = NULL;
-        sprintf(debug_file_name, "%s.%ld", debug_file_path, CURRENT_TIME);
+        sprintf(debug_file_name, "%s.%ld", debug_file_path, CURRENT_SECONDS);
         file = filp_open(debug_file_name, O_CREAT|O_TRUNC|O_RDWR, 0644);
 
         if (!file || IS_ERR(file)) {
@@ -730,8 +731,8 @@ portals_debug_msg(int subsys, int mask, char *file, const char *fn,
         do_gettimeofday(&tv);
 
         prefix_nob = snprintf(debug_buf + debug_off, max_nob,
-                              "%02x:%06x:%d:%lu.%06lu ",
-                              subsys >> 24, mask, smp_processor_id(),
+                              "%06x:%06x:%d:%lu.%06lu ",
+                              subsys, mask, smp_processor_id(),
                               tv.tv_sec, tv.tv_usec);
         max_nob -= prefix_nob;
 
@@ -754,7 +755,7 @@ portals_debug_msg(int subsys, int mask, char *file, const char *fn,
 
         va_start(ap, format);
         msg_nob += vsnprintf(debug_buf + debug_off + prefix_nob + msg_nob,
-                            max_nob, format, ap);
+                             max_nob, format, ap);
         max_nob -= msg_nob;
         va_end(ap);
 
@@ -813,7 +814,7 @@ void portals_run_lbug_upcall(char *file, const char *fn, const int line)
         envp[1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
         envp[2] = NULL;
 
-        rc = call_usermodehelper(argv[0], argv, envp);
+        rc = USERMODEHELPER(argv[0], argv, envp);
         if (rc < 0) {
                 CERROR("Error invoking lbug upcall %s %s %s %s %s: %d; check "
                        "/proc/sys/portals/upcall\n",                
index e59c922..dc1fead 100644 (file)
@@ -26,7 +26,7 @@
 #include <portals/api-support.h>
 
 int ptl_init;
-unsigned int portal_subsystem_debug = 0xfff7e3ff;
+unsigned int portal_subsystem_debug = ~0 - (S_PORTALS | S_QSWNAL | S_SOCKNAL | S_GMNAL);
 unsigned int portal_debug = ~0;
 unsigned int portal_printk;
 unsigned int portal_stack;
index 148310a..8e474ad 100644 (file)
@@ -5,4 +5,5 @@ debugctl
 ptlctl
 .deps
 routerstat
-wirecheck
\ No newline at end of file
+wirecheck
+.*.cmd
index 05af598..d51e3b3 100644 (file)
@@ -4,8 +4,8 @@
 # See the file COPYING in this distribution
 
 
-COMPILE = gcc -Wall -g -I$(srcdir)/../include 
-LINK = gcc -o $@
+COMPILE = $(CC) -Wall -g -I$(srcdir)/../include
+LINK = $(CC) -o $@
 
 sbin_PROGRAMS = acceptor ptlctl debugctl routerstat wirecheck
 lib_LIBRARIES = libptlctl.a
index 78271d5..0a009d2 100644 (file)
@@ -53,17 +53,18 @@ static char rawbuf[8192];
 static char *buf = rawbuf;
 static int max = 8192;
 //static int g_pfd = -1;
-static int subsystem_array[1 << 8];
+static int subsystem_mask = ~0;
 static int debug_mask = ~0;
 
 static const char *portal_debug_subsystems[] =
-        {"undefined", "mdc", "mds", "osc", "ost", "class", "obdfs", "llite",
-         "rpc", "ext2obd", "portals", "socknal", "qswnal", "pinger", "filter",
-         "obdtrace", "echo", "ldlm", "lov", "gmnal", "router", "ptldb", NULL};
+        {"undefined", "mdc", "mds", "osc", "ost", "class", "log", "llite",
+         "rpc", "mgmt", "portals", "socknal", "qswnal", "pinger", "filter",
+         "ptlbd", "echo", "ldlm", "lov", "gmnal", "router", "cobd", NULL};
 static const char *portal_debug_masks[] =
         {"trace", "inode", "super", "ext2", "malloc", "cache", "info", "ioctl",
          "blocks", "net", "warning", "buffs", "other", "dentry", "portals",
-         "page", "dlmtrace", "error", "emerg", "ha", "rpctrace", "vfstrace", NULL};
+         "page", "dlmtrace", "error", "emerg", "ha", "rpctrace", "vfstrace",
+         NULL};
 
 struct debug_daemon_cmd {
         char *cmd;
@@ -88,7 +89,10 @@ static int do_debug_mask(char *name, int enable)
                         printf("%s output from subsystem \"%s\"\n",
                                 enable ? "Enabling" : "Disabling",
                                 portal_debug_subsystems[i]);
-                        subsystem_array[i] = enable;
+                        if (enable)
+                                subsystem_mask |= (1 << i);
+                        else
+                                subsystem_mask &= ~(1 << i);
                         found = 1;
                 }
         }
@@ -111,7 +115,6 @@ static int do_debug_mask(char *name, int enable)
 
 int dbg_initialize(int argc, char **argv)
 {
-        memset(subsystem_array, 1, sizeof(subsystem_array));
         return 0;
 }
 
@@ -213,12 +216,7 @@ int jt_dbg_list(int argc, char **argv)
                 for (i = 0; portal_debug_masks[i] != NULL; i++)
                         printf(", %s", portal_debug_masks[i]);
                 printf("\n");
-        }
-        else if (strcasecmp(argv[1], "applymasks") == 0) {
-                unsigned int subsystem_mask = 0;
-                for (i = 0; portal_debug_subsystems[i] != NULL; i++) {
-                        if (subsystem_array[i]) subsystem_mask |= (1 << i);
-                }
+        } else if (strcasecmp(argv[1], "applymasks") == 0) {
                 applymask_all(subsystem_mask, debug_mask);
         }
         return 0;
@@ -230,12 +228,6 @@ static void dump_buffer(FILE *fd, char *buf, int size, int raw)
 {
         char *p, *z;
         unsigned long subsystem, debug, dropped = 0, kept = 0;
-        int max_sub, max_type;
-
-        for (max_sub = 0; portal_debug_subsystems[max_sub] != NULL; max_sub++)
-                ;
-        for (max_type = 0; portal_debug_masks[max_type] != NULL; max_type++)
-                ;
 
         while (size) {
                 p = memchr(buf, '\n', size);
@@ -247,8 +239,7 @@ static void dump_buffer(FILE *fd, char *buf, int size, int raw)
                 z++;
                 /* for some reason %*s isn't working. */
                 *p = '\0';
-                if (subsystem < max_sub &&
-                    subsystem_array[subsystem] &&
+                if ((subsystem_mask & subsystem) &&
                     (!debug || (debug_mask & debug))) {
                         if (raw)
                                 fprintf(fd, "%s\n", buf);
index c1455c3..db14c29 100644 (file)
@@ -198,7 +198,7 @@ if test $host_cpu != "lib" ; then
   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)
 
@@ -338,5 +338,5 @@ if test $RH_2_4_20 = 1; then
        AC_MSG_RESULT(redhat-2.4.20)
        CPPFLAGS="$CPPFLAGS -DCONFIG_RH_2_4_20"
 else
-       AC_MSG_RESULT($RELEASE)
+       AC_MSG_RESULT($LINUXRELEASE)
 fi 
index a4b1e1e..f9605ab 100644 (file)
@@ -1,14 +1,64 @@
-/* portals/include/config.h.in.  Generated automatically from configure.in by autoheader.  */
+/* portals/include/config.h.in.  Generated from configure.in by autoheader.  */
 
-/* The number of bytes in a unsigned long long.  */
-#undef SIZEOF_UNSIGNED_LONG_LONG
+/* Compile with orphan support */
+#undef ENABLE_ORPHANS
 
-/* Name of package */
-#undef PACKAGE
+/* Use the Pinger */
+#undef ENABLE_PINGER
 
-/* Version number of package */
-#undef VERSION
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
 
 /* IOCTL Buffer Size */
 #undef OBD_MAX_IOCTL_BUFFER
 
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* The size of a `unsigned long long', as computed by sizeof. */
+#undef SIZEOF_UNSIGNED_LONG_LONG
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION
index 6088b7f..2133391 100644 (file)
@@ -4,10 +4,6 @@
 #ifndef _KP30_INCLUDED
 #define _KP30_INCLUDED
 
-#ifdef __KERNEL__
-#include <linux/config.h>
-#endif
-
 #define PORTAL_DEBUG
 
 #ifndef offsetof
@@ -23,40 +19,34 @@ extern unsigned int portal_subsystem_debug;
 extern unsigned int portal_stack;
 extern unsigned int portal_debug;
 extern unsigned int portal_printk;
-/* Debugging subsystems  (8 bit ID)
- *
- * If you add debug subsystem #32, you need to send email to phil, because
- * you're going to break kernel subsystem debug filtering. */
-#define S_UNDEFINED    (0 << 24)
-#define S_MDC          (1 << 24)
-#define S_MDS          (2 << 24)
-#define S_OSC          (3 << 24)
-#define S_OST          (4 << 24)
-#define S_CLASS        (5 << 24)
-#define S_OBDFS        (6 << 24) /* obsolete */
-#define S_LLITE        (7 << 24)
-#define S_RPC          (8 << 24)
-#define S_EXT2OBD      (9 << 24) /* obsolete */
-#define S_PORTALS     (10 << 24)
-#define S_SOCKNAL     (11 << 24)
-#define S_QSWNAL      (12 << 24)
-#define S_PINGER      (13 << 24)
-#define S_FILTER      (14 << 24)
-#define S_TRACE       (15 << 24) /* obsolete */
-#define S_ECHO        (16 << 24)
-#define S_LDLM        (17 << 24)
-#define S_LOV         (18 << 24)
-#define S_GMNAL       (19 << 24)
-#define S_PTLROUTER   (20 << 24)
-#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
+/* Debugging subsystems (32 bits, non-overlapping) */
+#define S_UNDEFINED    (1 << 0)
+#define S_MDC          (1 << 1)
+#define S_MDS          (1 << 2)
+#define S_OSC          (1 << 3)
+#define S_OST          (1 << 4)
+#define S_CLASS        (1 << 5)
+#define S_LOG          (1 << 6)
+#define S_LLITE        (1 << 7)
+#define S_RPC          (1 << 8)
+#define S_MGMT         (1 << 9)
+#define S_PORTALS     (1 << 10)
+#define S_SOCKNAL     (1 << 11)
+#define S_QSWNAL      (1 << 12)
+#define S_PINGER      (1 << 13)
+#define S_FILTER      (1 << 14)
+#define S_PTLBD       (1 << 15)
+#define S_ECHO        (1 << 16)
+#define S_LDLM        (1 << 17)
+#define S_LOV         (1 << 18)
+#define S_GMNAL       (1 << 19)
+#define S_PTLROUTER   (1 << 20)
+#define S_COBD        (1 << 21)
+
+/* If you change these values, please keep portals/utils/debug.c
  * up to date! */
 
-/* Debugging masks (24 bits, non-overlapping) */
+/* Debugging masks (32 bits, non-overlapping) */
 #define D_TRACE     (1 << 0) /* ENTRY/EXIT markers */
 #define D_INODE     (1 << 1)
 #define D_SUPER     (1 << 2)
@@ -108,7 +98,7 @@ extern unsigned int portal_printk;
                       /*panic("LBUG");*/                                      \
                 }                                                             \
         } while (0)
-#else /* __KERNEL __ */
+#else /* __KERNEL__ */
 #define CHECK_STACK(stack) do { } while(0)
 #define CDEBUG_STACK (0L)
 #endif /* __KERNEL__ */
@@ -119,7 +109,7 @@ do {                                                                          \
         CHECK_STACK(CDEBUG_STACK);                                            \
         if (!(mask) || ((mask) & (D_ERROR | D_EMERG)) ||                      \
             (portal_debug & (mask) &&                                         \
-             portal_subsystem_debug & (1 << (DEBUG_SUBSYSTEM >> 24))))        \
+             portal_subsystem_debug & DEBUG_SUBSYSTEM))                       \
                 portals_debug_msg(DEBUG_SUBSYSTEM, mask,                      \
                                   __FILE__, __FUNCTION__, __LINE__,           \
                                   CDEBUG_STACK, format, ## a);                \
@@ -166,7 +156,6 @@ do {                                                                    \
 #define EXIT                            do { } while (0)
 #endif
 
-
 #ifdef __KERNEL__
 # include <linux/vmalloc.h>
 # include <linux/time.h>
@@ -572,7 +561,7 @@ int portals_debug_cleanup(void);
 int portals_debug_clear_buffer(void);
 int portals_debug_mark_buffer(char *text);
 int portals_debug_set_daemon(unsigned int cmd, unsigned int length,
-                char *file, unsigned int size);
+                             char *file, unsigned int size);
 __s32 portals_debug_copy_to_user(char *buf, unsigned long len);
 #if (__GNUC__)
 /* Use the special GNU C __attribute__ hack to have the compiler check the
@@ -588,9 +577,9 @@ void portals_debug_msg(int subsys, int mask, char *file, const char *fn,
                        const char *format, ...)
         __attribute__ ((format (printf, 7, 8)));
 #else
-void portals_debug_msg (int subsys, int mask, char *file, const char *fn,
-                        const 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, ...);
 #endif /* __GNUC__ */
 void portals_debug_set_level(unsigned int debug_level);
 
@@ -624,9 +613,9 @@ extern void kportal_blockallsigs (void);
 # define PORTAL_ALLOC(ptr, size) do { (ptr) = malloc(size); } while (0);
 # define PORTAL_FREE(a, b) do { free(a); } while (0);
 # define portals_debug_msg(subsys, mask, file, fn, line, stack, format, a...) \
-    printf ("%02x:%06x (@%lu %s:%s,l. %d %d %lu): " format,                    \
-            (subsys) >> 24, (mask), (long)time(0), file, fn, line,            \
-            getpid() , stack, ## a);
+    printf("%02x:%06x (@%lu %s:%s,l. %d %d %lu): " format,                    \
+           (subsys), (mask), (long)time(0), file, fn, line,                   \
+           getpid() , stack, ## a);
 #endif
 
 #ifndef CURRENT_TIME
@@ -917,13 +906,13 @@ ptl_handle_ni_t *kportal_get_ni (int nal);
 void kportal_put_ni (int nal);
 
 #ifdef __CYGWIN__
-#ifndef BITS_PER_LONG
-#if (~0UL) == 0xffffffffUL
-#define BITS_PER_LONG 32
-#else
-#define BITS_PER_LONG 64
-#endif
-#endif
+# ifndef BITS_PER_LONG
+#  if (~0UL) == 0xffffffffUL
+#   define BITS_PER_LONG 32
+#  else
+#   define BITS_PER_LONG 64
+#  endif
+# endif
 #endif
 
 #if (BITS_PER_LONG == 32 || __WORDSIZE == 32)
index 47c0dd2..9db8489 100644 (file)
@@ -137,11 +137,8 @@ typedef struct {
 } lib_counters_t;
 
 /* temporary expedient: limit number of entries in discontiguous MDs */
-#if PTL_LARGE_MTU
-# define PTL_MD_MAX_IOV        64
-#else
-# define PTL_MD_MAX_IOV 16
-#endif
+# define PTL_MTU        (512<<10)
+# define PTL_MD_MAX_IOV 128
 
 struct lib_msg_t {
         struct list_head  msg_list;
index 0eb4959..ef19ace 100644 (file)
@@ -95,12 +95,7 @@ typedef unsigned long kqsw_csum_t;
  * Performance Tuning defines
  * NB no mention of PAGE_SIZE for interoperability
  */
-#if PTL_LARGE_MTU
-# define KQSW_MAXPAYLOAD               (256<<10) /* biggest message this NAL will cope with */
-#else
-# define KQSW_MAXPAYLOAD               (64<<10) /* biggest message this NAL will cope with */
-#endif
-
+#define KQSW_MAXPAYLOAD                 PTL_MTU
 #define KQSW_SMALLPAYLOAD              ((4<<10) - KQSW_HDR_SIZE) /* small/large ep receiver breakpoint */
 
 #define KQSW_TX_MAXCONTIG              (1<<10) /* largest payload that gets made contiguous on transmit */
index c03d592..35c7c6c 100644 (file)
@@ -895,6 +895,11 @@ kqswnal_rxhandler(EP_RXD *rxd)
                 return;
         }
 
+        if (!in_interrupt()) {
+                kqswnal_rx (krx);
+                return;
+        }
+
         atomic_inc (&kqswnal_packets_received);
 
         spin_lock_irqsave (&kqswnal_data.kqn_sched_lock, flags);
index 46edf01..5c1b366 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 += ksocknal.o
 ksocknal-objs    := socknal.o socknal_cb.o
index 3e65faa..c9681a4 100644 (file)
@@ -166,7 +166,7 @@ ksocknal_add_sock (ptl_nid_t nid, int fd, int bind_irq)
         struct socket     *sock = NULL;
         ksock_sched_t     *sched = NULL;
         unsigned int       irq = 0;
-        struct net_device *dev = NULL;
+        struct dst_entry  *dst;
         int                ret;
         int                idx;
         ENTRY;
@@ -187,12 +187,16 @@ ksocknal_add_sock (ptl_nid_t nid, int fd, int bind_irq)
         if (!conn)
                 GOTO(error, ret);
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
         sock->sk->allocation = GFP_NOFS;    /* don't call info fs for alloc */
+#else
+#warning Zach, Eric: fix me!!
+#endif
 
         conn->ksnc_file = file;
         conn->ksnc_sock = sock;
-        conn->ksnc_saved_data_ready = sock->sk->data_ready;
-        conn->ksnc_saved_write_space = sock->sk->write_space;
+        conn->ksnc_saved_data_ready = sock->sk->sk_data_ready;
+        conn->ksnc_saved_write_space = sock->sk->sk_write_space;
         conn->ksnc_peernid = nid;
         atomic_set (&conn->ksnc_refcount, 1);    /* 1 ref for socklist */
 
@@ -204,22 +208,18 @@ ksocknal_add_sock (ptl_nid_t nid, int fd, int bind_irq)
         conn->ksnc_tx_ready = 0;
         conn->ksnc_tx_scheduled = 0;
 
-        /* XXX check it is OK to derefence sk->dst_cache->dev like this... */
-        lock_sock (conn->ksnc_sock->sk);
-
-        if (conn->ksnc_sock->sk->dst_cache != NULL) {
-                dev = conn->ksnc_sock->sk->dst_cache->dev;
-                if (dev != NULL) {
-                        irq = dev->irq;
+        dst = sk_dst_get (conn->ksnc_sock->sk);
+        if (dst != NULL) {
+                if (dst->dev != NULL) {
+                        irq = dst->dev->irq;
                         if (irq >= NR_IRQS) {
                                 CERROR ("Unexpected IRQ %x\n", irq);
                                 irq = 0;
                         }
                 }
+                dst_release (dst);
         }
 
-        release_sock (conn->ksnc_sock->sk);
-
         write_lock_irqsave (&ksocknal_data.ksnd_socklist_lock, flags);
 
         if (irq == 0 ||
@@ -268,9 +268,9 @@ ksocknal_add_sock (ptl_nid_t nid, int fd, int bind_irq)
                 ksocknal_bind_irq (irq, sched - ksocknal_data.ksnd_schedulers);
 
         /* NOW it's safe to get called back when socket is ready... */
-        sock->sk->user_data = conn;
-        sock->sk->data_ready = ksocknal_data_ready;
-        sock->sk->write_space = ksocknal_write_space;
+        sock->sk->sk_user_data = conn;
+        sock->sk->sk_data_ready = ksocknal_data_ready;
+        sock->sk->sk_write_space = ksocknal_write_space;
 
         /* ...which I call right now to get things going */
         ksocknal_data_ready (sock->sk, 0);
@@ -292,7 +292,7 @@ error:
 int
 ksocknal_close_sock(ptl_nid_t nid)
 {
-        long               flags;
+        unsigned long      flags;
         ksock_conn_t      *conn;
         LIST_HEAD         (death_row);
         struct list_head  *tmp;
@@ -329,8 +329,8 @@ ksocknal_close_sock(ptl_nid_t nid)
                 /* NB I _have_ to restore the callback, rather than storing
                  * a noop, since the socket could survive past this module
                  * being unloaded!! */
-                conn->ksnc_sock->sk->data_ready = conn->ksnc_saved_data_ready;
-                conn->ksnc_sock->sk->write_space = conn->ksnc_saved_write_space;
+                conn->ksnc_sock->sk->sk_data_ready = conn->ksnc_saved_data_ready;
+                conn->ksnc_sock->sk->sk_write_space = conn->ksnc_saved_write_space;
 
                 /* OK; no more callbacks, but they could be in progress now,
                  * so wait for them to complete... */
@@ -339,7 +339,7 @@ ksocknal_close_sock(ptl_nid_t nid)
                 /* ...however if I get the lock before a callback gets it,
                  * this will make them noop
                  */
-                conn->ksnc_sock->sk->user_data = NULL;
+                conn->ksnc_sock->sk->sk_user_data = NULL;
 
                 /* And drop the scheduler's connection count while I've got
                  * the exclusive lock */
@@ -385,8 +385,8 @@ ksocknal_push_conn (ksock_conn_t *conn)
         oldmm = get_fs ();
         set_fs (KERNEL_DS);
 
-        rc = sk->prot->setsockopt (sk, SOL_TCP, TCP_NODELAY,
-                                   (char *)&val, sizeof (val));
+        rc = sk->sk_prot->setsockopt (sk, SOL_TCP, TCP_NODELAY,
+                                      (char *)&val, sizeof (val));
         LASSERT (rc == 0);
 
         set_fs (oldmm);
@@ -505,16 +505,11 @@ _ksocknal_put_conn (ksock_conn_t *conn)
          * "That's a summons, mate..." */
 
         LASSERT (atomic_read (&conn->ksnc_refcount) == 0);
-        LASSERT (conn->ksnc_sock->sk->data_ready != ksocknal_data_ready);
-        LASSERT (conn->ksnc_sock->sk->write_space != ksocknal_write_space);
-        LASSERT (conn->ksnc_sock->sk->user_data == NULL);
+        LASSERT (conn->ksnc_sock->sk->sk_data_ready != ksocknal_data_ready);
+        LASSERT (conn->ksnc_sock->sk->sk_write_space != ksocknal_write_space);
+        LASSERT (conn->ksnc_sock->sk->sk_user_data == NULL);
         LASSERT (!conn->ksnc_rx_scheduled);
 
-        if (!in_interrupt()) {
-                ksocknal_close_conn (conn);
-                return;
-        }
-
         spin_lock_irqsave (&ksocknal_data.ksnd_reaper_lock, flags);
 
         list_add (&conn->ksnc_list, &ksocknal_data.ksnd_reaper_list);
index 62f9265..47ccd62 100644 (file)
 
 #define SOCKNAL_N_SCHED num_online_cpus()       /* # socknal schedulers */
 
-#if PTL_LARGE_MTU
-# define SOCKNAL_MAX_FWD_PAYLOAD (256<<10)      /* biggest payload I can forward */
-#else
-# define SOCKNAL_MAX_FWD_PAYLOAD (64<<10)       /* biggest payload I can forward */
-#endif
+#define SOCKNAL_MAX_FWD_PAYLOAD PTL_MTU         /* biggest payload I can forward */
 
 #define SOCKNAL_NLTXS           128             /* # normal transmit messages */
 #define SOCKNAL_NNBLK_LTXS     128             /* # transmit messages reserved if can't block */
 
 #define SOCKNAL_RESCHED         100             /* # scheduler loops before reschedule */
 
-#define SOCKNAL_TX_LOW_WATER(sk) (((sk)->sndbuf*8)/10)
+#define SOCKNAL_TX_LOW_WATER(sk) (((sk)->sk_sndbuf*8)/10)
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,72))
+# define sk_data_ready data_ready
+# define sk_write_space write_space
+# define sk_user_data   user_data
+# define sk_prot        prot
+# define sk_sndbuf      sndbuf
+# define sk_socket      socket
+#endif
 
 typedef struct                                  /* pool of forwarding buffers */
 {
@@ -242,7 +247,7 @@ typedef struct
         
         /* READER */
         struct list_head    ksnc_rx_list;       /* where I enq waiting input or a forwarding descriptor */
-        volatile int        ksnc_rx_ready;      /* data ready to read */
+        int                 ksnc_rx_ready;      /* data ready to read */
         int                 ksnc_rx_scheduled;  /* being progressed */
         int                 ksnc_rx_state;      /* what is being read */
         int                 ksnc_rx_nob_left;   /* # bytes to next hdr/body  */
@@ -258,7 +263,7 @@ typedef struct
         /* WRITER */
         struct list_head    ksnc_tx_list;       /* where I enq waiting for output space */
         struct list_head    ksnc_tx_queue;      /* packets waiting to be sent */
-        volatile int        ksnc_tx_ready;      /* write space */
+        int                 ksnc_tx_ready;      /* write space */
         int                 ksnc_tx_scheduled;  /* being progressed */
 
 } ksock_conn_t;
index bc770c8..552ea50 100644 (file)
@@ -141,7 +141,7 @@ ksocknal_dist(nal_cb_t *nal, ptl_nid_t nid, unsigned long *dist)
 ksock_ltx_t *
 ksocknal_get_ltx (int may_block)
 {
-        long             flags;
+        unsigned long flags;
         ksock_ltx_t *ltx = NULL;
 
         for (;;) {
@@ -253,7 +253,7 @@ ksocknal_send_iov (struct socket *sock, ksock_tx_t *tx, int more)
                 mm_segment_t oldmm = get_fs();
                 
                 set_fs (KERNEL_DS);
-                rc = sock->sk->prot->sendmsg(sock->sk, &msg, fragsize);
+                rc = sock_sendmsg(sock, &msg, fragsize);
                 set_fs (oldmm);
         } 
 
@@ -322,7 +322,7 @@ ksocknal_send_kiov (struct socket *sock, ksock_tx_t *tx, int more)
                 mm_segment_t  oldmm = get_fs();
                 
                 set_fs (KERNEL_DS);
-                rc = sock->sk->prot->sendmsg(sock->sk, &msg, fragsize);
+                rc = sock_sendmsg(sock, &msg, fragsize);
                 set_fs (oldmm);
                 kunmap (page);
         }
@@ -527,7 +527,7 @@ ksocknal_zc_callback (zccd_t *zcd)
 void
 ksocknal_tx_done (ksock_tx_t *tx)
 {
-        long           flags;
+        unsigned long flags;
         ksock_ltx_t   *ltx;
         ENTRY;
 
@@ -559,7 +559,7 @@ ksocknal_tx_done (ksock_tx_t *tx)
 }
 
 void
-ksocknal_process_transmit (ksock_sched_t *sched, long *irq_flags)
+ksocknal_process_transmit (ksock_sched_t *sched, unsigned long *irq_flags)
 {
         ksock_conn_t *conn;
         ksock_tx_t *tx;
@@ -882,7 +882,7 @@ ksocknal_fmb_callback (void *arg, int error)
         ptl_hdr_t         *hdr = (ptl_hdr_t *) page_address(fmb->fmb_pages[0]);
         ksock_conn_t      *conn = NULL;
         ksock_sched_t     *sched;
-        long               flags;
+        unsigned long      flags;
 
         if (error != 0)
                 CERROR("Failed to route packet from "LPX64" to "LPX64": %d\n",
@@ -930,7 +930,7 @@ ksocknal_get_idle_fmb (ksock_conn_t *conn)
 {
         int               payload_nob = conn->ksnc_rx_nob_left;
         int               packet_nob = sizeof (ptl_hdr_t) + payload_nob;
-        long              flags;
+        unsigned long     flags;
         ksock_fmb_pool_t *pool;
         ksock_fmb_t      *fmb;
 
@@ -1174,7 +1174,7 @@ ksocknal_new_packet (ksock_conn_t *conn, int nob_to_skip)
 }
 
 void
-ksocknal_process_receive (ksock_sched_t *sched, long *irq_flags)
+ksocknal_process_receive (ksock_sched_t *sched, unsigned long *irq_flags)
 {
         ksock_conn_t *conn;
         ksock_fmb_t  *fmb;
@@ -1295,10 +1295,11 @@ ksocknal_process_receive (ksock_sched_t *sched, long *irq_flags)
                 goto out;                       /* (later) */
 
         default:
-                LBUG ();
+                break;
         }
 
         /* Not Reached */
+        LBUG ();
 
  out:
         spin_lock_irqsave (&sched->kss_lock, *irq_flags);
@@ -1383,7 +1384,7 @@ int ksocknal_scheduler (void *arg)
         else
                 CERROR ("Can't set CPU affinity for %s\n", name);
 #endif /* CONFIG_SMP && CPU_AFFINITY */
-        
+
         spin_lock_irqsave (&sched->kss_lock, flags);
 
         while (!ksocknal_data.ksnd_shuttingdown) {
@@ -1460,10 +1461,10 @@ ksocknal_data_ready (struct sock *sk, int n)
         /* interleave correctly with closing sockets... */
         read_lock (&ksocknal_data.ksnd_socklist_lock);
 
-        conn = sk->user_data;
+        conn = sk->sk_user_data;
         if (conn == NULL) {             /* raced with ksocknal_close_sock */
-                LASSERT (sk->data_ready != &ksocknal_data_ready);
-                sk->data_ready (sk, n);
+                LASSERT (sk->sk_data_ready != &ksocknal_data_ready);
+                sk->sk_data_ready (sk, n);
         } else if (!conn->ksnc_rx_ready) {        /* new news */
                 /* Set ASAP in case of concurrent calls to me */
                 conn->ksnc_rx_ready = 1;
@@ -1504,11 +1505,11 @@ ksocknal_write_space (struct sock *sk)
         /* interleave correctly with closing sockets... */
         read_lock (&ksocknal_data.ksnd_socklist_lock);
 
-        conn = sk->user_data;
+        conn = sk->sk_user_data;
 
         CDEBUG(D_NET, "sk %p wspace %d low water %d conn %p%s%s%s\n",
                sk, tcp_wspace(sk), SOCKNAL_TX_LOW_WATER(sk), conn,
-               (conn == NULL) ? "" : (test_bit (0, &conn->ksnc_tx_ready) ?
+               (conn == NULL) ? "" : (conn->ksnc_tx_ready ?
                                       " ready" : " blocked"),
                (conn == NULL) ? "" : (conn->ksnc_tx_scheduled ?
                                       " scheduled" : " idle"),
@@ -1516,10 +1517,10 @@ ksocknal_write_space (struct sock *sk)
                                       " empty" : " queued"));
 
         if (conn == NULL) {             /* raced with ksocknal_close_sock */
-                LASSERT (sk->write_space != &ksocknal_write_space);
-                sk->write_space (sk);
+                LASSERT (sk->sk_write_space != &ksocknal_write_space);
+                sk->sk_write_space (sk);
         } else if (tcp_wspace(sk) >= SOCKNAL_TX_LOW_WATER(sk)) { /* got enough space */
-                clear_bit (SOCK_NOSPACE, &sk->socket->flags);
+                clear_bit (SOCK_NOSPACE, &sk->sk_socket->flags);
 
                 if (!conn->ksnc_tx_ready) {      /* new news */
                         /* Set ASAP in case of concurrent calls to me */
index 07c0bed..9d15c8f 100644 (file)
@@ -50,6 +50,7 @@
 # define DEBUG_SUBSYSTEM S_PORTALS
 
 #include <linux/kp30.h>
+#include <linux/portals_compat25.h>
 
 #define DEBUG_OVERFLOW 1024
 static char *debug_buf = NULL;
@@ -235,7 +236,7 @@ int portals_do_debug_dumplog(void *arg)
         reparent_to_init();
         journal_info = current->journal_info;
         current->journal_info = NULL;
-        sprintf(debug_file_name, "%s.%ld", debug_file_path, CURRENT_TIME);
+        sprintf(debug_file_name, "%s.%ld", debug_file_path, CURRENT_SECONDS);
         file = filp_open(debug_file_name, O_CREAT|O_TRUNC|O_RDWR, 0644);
 
         if (!file || IS_ERR(file)) {
@@ -730,8 +731,8 @@ portals_debug_msg(int subsys, int mask, char *file, const char *fn,
         do_gettimeofday(&tv);
 
         prefix_nob = snprintf(debug_buf + debug_off, max_nob,
-                              "%02x:%06x:%d:%lu.%06lu ",
-                              subsys >> 24, mask, smp_processor_id(),
+                              "%06x:%06x:%d:%lu.%06lu ",
+                              subsys, mask, smp_processor_id(),
                               tv.tv_sec, tv.tv_usec);
         max_nob -= prefix_nob;
 
@@ -754,7 +755,7 @@ portals_debug_msg(int subsys, int mask, char *file, const char *fn,
 
         va_start(ap, format);
         msg_nob += vsnprintf(debug_buf + debug_off + prefix_nob + msg_nob,
-                            max_nob, format, ap);
+                             max_nob, format, ap);
         max_nob -= msg_nob;
         va_end(ap);
 
@@ -813,7 +814,7 @@ void portals_run_lbug_upcall(char *file, const char *fn, const int line)
         envp[1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
         envp[2] = NULL;
 
-        rc = call_usermodehelper(argv[0], argv, envp);
+        rc = USERMODEHELPER(argv[0], argv, envp);
         if (rc < 0) {
                 CERROR("Error invoking lbug upcall %s %s %s %s %s: %d; check "
                        "/proc/sys/portals/upcall\n",                
index e59c922..dc1fead 100644 (file)
@@ -26,7 +26,7 @@
 #include <portals/api-support.h>
 
 int ptl_init;
-unsigned int portal_subsystem_debug = 0xfff7e3ff;
+unsigned int portal_subsystem_debug = ~0 - (S_PORTALS | S_QSWNAL | S_SOCKNAL | S_GMNAL);
 unsigned int portal_debug = ~0;
 unsigned int portal_printk;
 unsigned int portal_stack;
index 148310a..8e474ad 100644 (file)
@@ -5,4 +5,5 @@ debugctl
 ptlctl
 .deps
 routerstat
-wirecheck
\ No newline at end of file
+wirecheck
+.*.cmd
index 05af598..d51e3b3 100644 (file)
@@ -4,8 +4,8 @@
 # See the file COPYING in this distribution
 
 
-COMPILE = gcc -Wall -g -I$(srcdir)/../include 
-LINK = gcc -o $@
+COMPILE = $(CC) -Wall -g -I$(srcdir)/../include
+LINK = $(CC) -o $@
 
 sbin_PROGRAMS = acceptor ptlctl debugctl routerstat wirecheck
 lib_LIBRARIES = libptlctl.a
index 78271d5..0a009d2 100644 (file)
@@ -53,17 +53,18 @@ static char rawbuf[8192];
 static char *buf = rawbuf;
 static int max = 8192;
 //static int g_pfd = -1;
-static int subsystem_array[1 << 8];
+static int subsystem_mask = ~0;
 static int debug_mask = ~0;
 
 static const char *portal_debug_subsystems[] =
-        {"undefined", "mdc", "mds", "osc", "ost", "class", "obdfs", "llite",
-         "rpc", "ext2obd", "portals", "socknal", "qswnal", "pinger", "filter",
-         "obdtrace", "echo", "ldlm", "lov", "gmnal", "router", "ptldb", NULL};
+        {"undefined", "mdc", "mds", "osc", "ost", "class", "log", "llite",
+         "rpc", "mgmt", "portals", "socknal", "qswnal", "pinger", "filter",
+         "ptlbd", "echo", "ldlm", "lov", "gmnal", "router", "cobd", NULL};
 static const char *portal_debug_masks[] =
         {"trace", "inode", "super", "ext2", "malloc", "cache", "info", "ioctl",
          "blocks", "net", "warning", "buffs", "other", "dentry", "portals",
-         "page", "dlmtrace", "error", "emerg", "ha", "rpctrace", "vfstrace", NULL};
+         "page", "dlmtrace", "error", "emerg", "ha", "rpctrace", "vfstrace",
+         NULL};
 
 struct debug_daemon_cmd {
         char *cmd;
@@ -88,7 +89,10 @@ static int do_debug_mask(char *name, int enable)
                         printf("%s output from subsystem \"%s\"\n",
                                 enable ? "Enabling" : "Disabling",
                                 portal_debug_subsystems[i]);
-                        subsystem_array[i] = enable;
+                        if (enable)
+                                subsystem_mask |= (1 << i);
+                        else
+                                subsystem_mask &= ~(1 << i);
                         found = 1;
                 }
         }
@@ -111,7 +115,6 @@ static int do_debug_mask(char *name, int enable)
 
 int dbg_initialize(int argc, char **argv)
 {
-        memset(subsystem_array, 1, sizeof(subsystem_array));
         return 0;
 }
 
@@ -213,12 +216,7 @@ int jt_dbg_list(int argc, char **argv)
                 for (i = 0; portal_debug_masks[i] != NULL; i++)
                         printf(", %s", portal_debug_masks[i]);
                 printf("\n");
-        }
-        else if (strcasecmp(argv[1], "applymasks") == 0) {
-                unsigned int subsystem_mask = 0;
-                for (i = 0; portal_debug_subsystems[i] != NULL; i++) {
-                        if (subsystem_array[i]) subsystem_mask |= (1 << i);
-                }
+        } else if (strcasecmp(argv[1], "applymasks") == 0) {
                 applymask_all(subsystem_mask, debug_mask);
         }
         return 0;
@@ -230,12 +228,6 @@ static void dump_buffer(FILE *fd, char *buf, int size, int raw)
 {
         char *p, *z;
         unsigned long subsystem, debug, dropped = 0, kept = 0;
-        int max_sub, max_type;
-
-        for (max_sub = 0; portal_debug_subsystems[max_sub] != NULL; max_sub++)
-                ;
-        for (max_type = 0; portal_debug_masks[max_type] != NULL; max_type++)
-                ;
 
         while (size) {
                 p = memchr(buf, '\n', size);
@@ -247,8 +239,7 @@ static void dump_buffer(FILE *fd, char *buf, int size, int raw)
                 z++;
                 /* for some reason %*s isn't working. */
                 *p = '\0';
-                if (subsystem < max_sub &&
-                    subsystem_array[subsystem] &&
+                if ((subsystem_mask & subsystem) &&
                     (!debug || (debug_mask & debug))) {
                         if (raw)
                                 fprintf(fd, "%s\n", buf);