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)
AC_MSG_RESULT(redhat-2.4.20)
CPPFLAGS="$CPPFLAGS -DCONFIG_RH_2_4_20"
else
- AC_MSG_RESULT($RELEASE)
+ AC_MSG_RESULT($LINUXRELEASE)
fi
-/* 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
#ifndef _KP30_INCLUDED
#define _KP30_INCLUDED
-#ifdef __KERNEL__
-#include <linux/config.h>
-#endif
-
#define PORTAL_DEBUG
#ifndef offsetof
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)
/*panic("LBUG");*/ \
} \
} while (0)
-#else /* __KERNEL __ */
+#else /* __KERNEL__ */
#define CHECK_STACK(stack) do { } while(0)
#define CDEBUG_STACK (0L)
#endif /* __KERNEL__ */
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); \
#define EXIT do { } while (0)
#endif
-
#ifdef __KERNEL__
# include <linux/vmalloc.h>
# include <linux/time.h>
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
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);
# 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
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)
} 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;
* 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 */
return;
}
+ if (!in_interrupt()) {
+ kqswnal_rx (krx);
+ return;
+ }
+
atomic_inc (&kqswnal_packets_received);
spin_lock_irqsave (&kqswnal_data.kqn_sched_lock, flags);
.deps
Makefile
Makefile.in
+.*.o.cmd
# 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
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;
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 */
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 ||
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);
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;
/* 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... */
/* ...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 */
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);
* "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);
#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 */
{
/* 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 */
/* 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;
ksock_ltx_t *
ksocknal_get_ltx (int may_block)
{
- long flags;
+ unsigned long flags;
ksock_ltx_t *ltx = NULL;
for (;;) {
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);
}
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);
}
void
ksocknal_tx_done (ksock_tx_t *tx)
{
- long flags;
+ unsigned long flags;
ksock_ltx_t *ltx;
ENTRY;
}
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;
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",
{
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;
}
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;
goto out; /* (later) */
default:
- LBUG ();
+ break;
}
/* Not Reached */
+ LBUG ();
out:
spin_lock_irqsave (&sched->kss_lock, *irq_flags);
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) {
/* 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;
/* 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"),
" 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 */
# define DEBUG_SUBSYSTEM S_PORTALS
#include <linux/kp30.h>
+#include <linux/portals_compat25.h>
#define DEBUG_OVERFLOW 1024
static char *debug_buf = NULL;
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)) {
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;
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);
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",
#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;
ptlctl
.deps
routerstat
-wirecheck
\ No newline at end of file
+wirecheck
+.*.cmd
# 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
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;
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;
}
}
int dbg_initialize(int argc, char **argv)
{
- memset(subsystem_array, 1, sizeof(subsystem_array));
return 0;
}
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;
{
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);
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);
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)
AC_MSG_RESULT(redhat-2.4.20)
CPPFLAGS="$CPPFLAGS -DCONFIG_RH_2_4_20"
else
- AC_MSG_RESULT($RELEASE)
+ AC_MSG_RESULT($LINUXRELEASE)
fi
-/* 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
#ifndef _KP30_INCLUDED
#define _KP30_INCLUDED
-#ifdef __KERNEL__
-#include <linux/config.h>
-#endif
-
#define PORTAL_DEBUG
#ifndef offsetof
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)
/*panic("LBUG");*/ \
} \
} while (0)
-#else /* __KERNEL __ */
+#else /* __KERNEL__ */
#define CHECK_STACK(stack) do { } while(0)
#define CDEBUG_STACK (0L)
#endif /* __KERNEL__ */
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); \
#define EXIT do { } while (0)
#endif
-
#ifdef __KERNEL__
# include <linux/vmalloc.h>
# include <linux/time.h>
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
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);
# 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
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)
} 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;
* 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 */
return;
}
+ if (!in_interrupt()) {
+ kqswnal_rx (krx);
+ return;
+ }
+
atomic_inc (&kqswnal_packets_received);
spin_lock_irqsave (&kqswnal_data.kqn_sched_lock, flags);
.deps
Makefile
Makefile.in
+.*.o.cmd
# 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
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;
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 */
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 ||
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);
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;
/* 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... */
/* ...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 */
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);
* "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);
#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 */
{
/* 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 */
/* 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;
ksock_ltx_t *
ksocknal_get_ltx (int may_block)
{
- long flags;
+ unsigned long flags;
ksock_ltx_t *ltx = NULL;
for (;;) {
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);
}
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);
}
void
ksocknal_tx_done (ksock_tx_t *tx)
{
- long flags;
+ unsigned long flags;
ksock_ltx_t *ltx;
ENTRY;
}
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;
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",
{
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;
}
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;
goto out; /* (later) */
default:
- LBUG ();
+ break;
}
/* Not Reached */
+ LBUG ();
out:
spin_lock_irqsave (&sched->kss_lock, *irq_flags);
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) {
/* 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;
/* 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"),
" 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 */
# define DEBUG_SUBSYSTEM S_PORTALS
#include <linux/kp30.h>
+#include <linux/portals_compat25.h>
#define DEBUG_OVERFLOW 1024
static char *debug_buf = NULL;
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)) {
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;
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);
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",
#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;
ptlctl
.deps
routerstat
-wirecheck
\ No newline at end of file
+wirecheck
+.*.cmd
# 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
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;
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;
}
}
int dbg_initialize(int argc, char **argv)
{
- memset(subsystem_array, 1, sizeof(subsystem_array));
return 0;
}
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;
{
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);
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);