config.log
config.status
configure
+.*.o.cmd
-EXTRA_CFLAGS= -Ifs/lustre/include -Ifs/lustre/portals/include
+EXTRA_CFLAGS := -Ifs/lustre/include -Ifs/lustre/portals/include
+# portals/utils/debug.c wants <linux/version.h> from userspace. sigh.
+HOSTCFLAGS := -I@LINUX@/include $(EXTRA_CFLAGS)
+LIBREADLINE := @LIBREADLINE@
+# 2.5's makefiles aren't nice to cross dir libraries in host programs
+PTLCTLOBJS := debug.o l_ioctl.o parser.o portals.o
-EXTRA_CFLAGS= -Ifs/lustre/include -Ifs/lustre/portals/include
+EXTRA_CFLAGS := -Ifs/lustre/include -Ifs/lustre/portals/include
+HOSTCFLAGS := $(EXTRA_CFLAGS)
+# the kernel doesn't want us to build archives for host binaries :/
+PTLCTLOBJS := debug.o l_ioctl.o parser.o portals.o
-include fs/lustre/portals/Kernelenv
+include $(src)/Kernelenv
-obj-y += portals/
+# The ordering of these determines the order that each subsystem's
+# module_init() functions are called in. if these are changed make sure
+# they reflect the dependencies between each subsystem's _init functions.
obj-y += libcfs/
-obj-y += knals/
+obj-y += portals/
obj-y += router/
+obj-y += knals/
+obj-y += tests/
+
+obj-m += utils/
AC_ARG_WITH(linux, [ --with-linux=[path] set path to Linux source (default=/usr/src/linux)],LINUX=$with_linux,LINUX=/usr/src/linux)
AC_SUBST(LINUX)
+if test x$enable_inkernel = xyes ; then
+ echo ln -s `pwd` $LINUX/fs/lustre
+ rm $LINUX/fs/lustre
+ ln -s `pwd` $LINUX/fs/lustre
+fi
-# --------- UML? --------------------
+# --------------------
AC_MSG_CHECKING(if you are running user mode linux for $host_cpu ...)
if test $host_cpu = "lib" ; then
host_cpu="lib"
MOD_LINK=elf64_ia64
;;
+ x86_64 )
+ AC_MSG_RESULT($host_cpu)
+ KCFLAGS='-g -O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fomit-frame-pointer -mno-red-zone -mcmodel=kernel -pipe -fno-reorder-blocks -finline-limit=2000 -fno-strength-reduce -fno-asynchronous-unwind-tables'
+ KCPPFLAGS='-D__KERNEL__ -DMODULE'
+ MOD_LINK=elf_x86_64
+;;
+
sparc64 )
AC_MSG_RESULT($host_cpu)
KCFLAGS='-O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fomit-frame-pointer -fno-strict-aliasing -fno-common -Wno-unused -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow -ffixed-g4 -fcall-used-g5 -fcall-used-g7 -Wno-sign-compare -Wa,--undeclared-regs'
AC_MSG_ERROR(** cannot find $LINUX/include/linux/autoconf.h. Run make config in $LINUX.)
fi
-# ------------ RELEASE and moduledir ------------------
+# ------------ LINUXRELEASE and moduledir ------------------
AC_MSG_CHECKING(for Linux release)
dnl We need to rid ourselves of the nasty [ ] quotes.
changequote(, )
dnl Get release from version.h
- RELEASE="`sed -ne 's/.*UTS_RELEASE[ \"]*\([0-9.a-zA-Z_-]*\).*/\1/p' $LINUX/include/linux/version.h`"
+ LINUXRELEASE="`sed -ne 's/.*UTS_RELEASE[ \"]*\([0-9.a-zA-Z_-]*\).*/\1/p' $LINUX/include/linux/version.h`"
changequote([, ])
- moduledir='$(libdir)/modules/'$RELEASE/kernel
+ moduledir='$(libdir)/modules/'$LINUXRELEASE/kernel
AC_SUBST(moduledir)
modulefsdir='$(moduledir)/fs/$(PACKAGE)'
AC_SUBST(modulefsdir)
+ AC_MSG_RESULT($LINUXRELEASE)
+ AC_SUBST(LINUXRELEASE)
+
+# ------------ RELEASE --------------------------------
+ AC_MSG_CHECKING(lustre release)
+
+ dnl We need to rid ourselves of the nasty [ ] quotes.
+ changequote(, )
+ dnl Get release from version.h
+ RELEASE="`sed -ne 's/-/_/g' -e 's/.*UTS_RELEASE[ \"]*\([0-9.a-zA-Z_]*\).*/\1/p' $LINUX/include/linux/version.h`_`date +%Y%m%d%H%M`"
+ changequote([, ])
+
AC_MSG_RESULT($RELEASE)
AC_SUBST(RELEASE)
# This needs to run after we've defined the KCPPFLAGS
AC_MSG_CHECKING(for kernel version)
-AC_TRY_LINK([#define __KERNEL__
+AC_TRY_COMPILE([#define __KERNEL__
#include <linux/sched.h>],
[struct task_struct p;
p.sighand = NULL;],
-/* ../include/config.h.in. Generated automatically from configure.in by autoheader. */
+/* portals/include/config.h.in. Generated automatically from configure.in by autoheader. */
-/* Define if you have the readline library (-lreadline). */
-#undef HAVE_LIBREADLINE
+/* The number of bytes in a unsigned long long. */
+#undef SIZEOF_UNSIGNED_LONG_LONG
/* Name of package */
#undef PACKAGE
/* Version number of package */
#undef VERSION
+/* IOCTL Buffer Size */
+#undef OBD_MAX_IOCTL_BUFFER
+
#define LOWEST_BIT_SET(x) ((x) & ~((x) - 1))
-#ifndef CONFIG_SMP
-# define smp_processor_id() 0
-#endif
-
/*
* Debugging
*/
#define S_COBD (21 << 24)
#define S_PTLBD (22 << 24)
#define S_LOG (23 << 24)
+#define S_MGMT (24 << 24)
/* If you change these values, please keep portals/linux/utils/debug.c
* up to date! */
#define D_RPCTRACE (1 << 20) /* for distributed debugging */
#define D_VFSTRACE (1 << 21)
-#ifndef __KERNEL__
-#define THREAD_SIZE 8192
+#ifdef __KERNEL__
+# include <linux/sched.h> /* THREAD_SIZE */
+#else
+# define THREAD_SIZE 8192
#endif
-#ifdef __ia64__
-#define CDEBUG_STACK() (THREAD_SIZE - \
+
+#ifdef __KERNEL__
+# ifdef __ia64__
+# define CDEBUG_STACK (THREAD_SIZE - \
((unsigned long)__builtin_dwarf_cfa() & \
(THREAD_SIZE - 1)))
-#else
-#define CDEBUG_STACK() (THREAD_SIZE - \
+# else
+# define CDEBUG_STACK (THREAD_SIZE - \
((unsigned long)__builtin_frame_address(0) & \
(THREAD_SIZE - 1)))
-#endif
+# endif
-#ifdef __KERNEL__
#define CHECK_STACK(stack) \
do { \
if ((stack) > 3*THREAD_SIZE/4 && (stack) > portal_stack) { \
/*panic("LBUG");*/ \
} \
} while (0)
-#else
+#else /* __KERNEL __ */
#define CHECK_STACK(stack) do { } while(0)
-#endif
+#define CDEBUG_STACK (0L)
+#endif /* __KERNEL__ */
#if 1
#define CDEBUG(mask, format, a...) \
do { \
- CHECK_STACK(CDEBUG_STACK()); \
+ CHECK_STACK(CDEBUG_STACK); \
if (!(mask) || ((mask) & (D_ERROR | D_EMERG)) || \
(portal_debug & (mask) && \
portal_subsystem_debug & (1 << (DEBUG_SUBSYSTEM >> 24)))) \
portals_debug_msg(DEBUG_SUBSYSTEM, mask, \
__FILE__, __FUNCTION__, __LINE__, \
- CDEBUG_STACK(), format , ## a); \
+ CDEBUG_STACK, format, ## a); \
} while (0)
#define CWARN(format, a...) CDEBUG(D_WARNING, format, ## a)
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) */
#ifdef PORTAL_DEBUG
-extern void kportal_assertion_failed(char *expr,char *file,char *func,int line);
+extern void kportal_assertion_failed(char *expr, char *file, const char *func,
+ const int line);
#define LASSERT(e) ((e) ? 0 : kportal_assertion_failed( #e , __FILE__, \
__FUNCTION__, __LINE__))
#else
#endif /* PORTALS_PROFILING */
/* debug.c */
-void portals_run_lbug_upcall(char * file, char *fn, int line);
+void portals_run_lbug_upcall(char * file, const char *fn, const int line);
void portals_debug_dumplog(void);
int portals_debug_init(unsigned long bufsize);
int portals_debug_cleanup(void);
# warning printf has been defined as a macro...
# undef printf
#endif
-void portals_debug_msg (int subsys, int mask, char *file, char *fn, int line,
- unsigned long stack, const char *format, ...)
+void portals_debug_msg(int subsys, int mask, char *file, const char *fn,
+ const int line, unsigned long stack,
+ const char *format, ...)
__attribute__ ((format (printf, 7, 8)));
#else
-void portals_debug_msg (int subsys, int mask, char *file, char *fn,
- int line, unsigned long stack,
+void portals_debug_msg (int subsys, int mask, char *file, const char *fn,
+ const int line, unsigned long stack,
const char *format, ...);
#endif /* __GNUC__ */
void portals_debug_set_level(unsigned int debug_level);
-/*
-*/
#ifndef _P30_INTERNAL_H_
#define _P30_INTERNAL_H_
#ifndef _LINUX_LIST_H
-#define _LINUX_LIST_H
-
/*
* Simple doubly linked list implementation.
__list_del(entry->prev, entry->next);
INIT_LIST_HEAD(entry);
}
+#endif
+#ifndef list_for_each_entry
/**
* list_move - delete from one list and add as another's head
* @list: the entry to move
__list_del(list->prev, list->next);
list_add_tail(list, head);
}
+#endif
+#ifndef _LINUX_LIST_H
+#define _LINUX_LIST_H
/**
* list_empty - tests whether a list is empty
* @head: the list to test.
* vim:expandtab:shiftwidth=8:tabstop=8:
*
* Compile with:
- * cc -I../../portals/include -o fio fio.c -L../../portals/linux/utils -lptlctl
+ * cc -I../../portals/include -o fio fio.c -L../../portals/linux/utils -lptlctl
*/
#ifndef __LTRACE_H_
#define __LTRACE_H_
argv[0] = "debug_kernel";
argv[1] = fname;
argv[2] = "1";
-
+
fprintf(stderr, "[ptlctl] %s %s %s\n", argv[0], argv[1], argv[2]);
-
+
return jt_dbg_debug_kernel(3, argv);
}
static inline int ltrace_clear()
{
char* argv[1];
-
+
argv[0] = "clear";
-
+
fprintf(stderr, "[ptlctl] %s\n", argv[0]);
-
+
return jt_dbg_clear_debug_buf(1, argv);
}
{
char* argv[2];
char mark_buf[PATH_MAX];
-
+
snprintf(mark_buf, PATH_MAX, "====%d=%s", indent_level, text);
-
+
argv[0] = "mark";
argv[1] = mark_buf;
return jt_dbg_mark_debug_buf(2, argv);
char* argv[2];
argv[0] = "list";
argv[1] = "applymasks";
-
+
fprintf(stderr, "[ptlctl] %s %s\n", argv[0], argv[1]);
-
+
return jt_dbg_list(2, argv);
}
#ifdef PORTALS_DEV_ID
rc = register_ioc_dev(PORTALS_DEV_ID, PORTALS_DEV_PATH);
#endif
- ltrace_filter("class");
+ ltrace_filter("class");
ltrace_filter("socknal");
- ltrace_filter("qswnal");
- ltrace_filter("gmnal");
- ltrace_filter("portals");
-
- ltrace_show("all_types");
- ltrace_filter("trace");
- ltrace_filter("malloc");
- ltrace_filter("net");
- ltrace_filter("page");
- ltrace_filter("other");
- ltrace_filter("info");
+ ltrace_filter("qswnal");
+ ltrace_filter("gmnal");
+ ltrace_filter("portals");
+
+ ltrace_show("all_types");
+ ltrace_filter("trace");
+ ltrace_filter("malloc");
+ ltrace_filter("net");
+ ltrace_filter("page");
+ ltrace_filter("other");
+ ltrace_filter("info");
ltrace_applymasks();
return rc;
struct timezone tz;
int nob;
int underuml = !not_uml();
-
+
gettimeofday(&tv, &tz);
nob = snprintf(cmdbuf, LTRACE_MAX_NOB, "ps --no-headers -eo \"");
"(%s:%d:%s() %d+%lu): ",
"lltrace.h", __LINE__, __FUNCTION__, 0, 0L);
}
-
+
nob += snprintf(cmdbuf+nob, LTRACE_MAX_NOB, " %%p %%c\" >> %s", fname);
system(cmdbuf);
}
-/*
-*/
-
#ifndef MYRNAL_H
#define MYRNAL_H
-/*
-*/
#ifndef _NAL_H_
#define _NAL_H_
-/*
- */
-
#ifndef _INCppidh_
#define _INCppidh_
/*
-*/
-/*
* stringtab.h
*/
#define _P30_TYPES_H_
#ifdef __linux__
-#include <asm/types.h>
-#include <asm/timex.h>
+# include <asm/types.h>
+# include <asm/timex.h>
#else
-#include <sys/types.h>
+# include <sys/types.h>
typedef u_int32_t __u32;
typedef u_int64_t __u64;
-typedef unsigned long long cycles_t;
-static inline cycles_t get_cycles(void) { return 0; }
+#endif
+
+#ifdef __KERNEL__
+# include <linux/time.h>
+#else
+# include <sys/time.h>
+# define do_gettimeofday(tv) gettimeofday(tv, NULL)
#endif
typedef __u64 ptl_nid_t;
typedef ptl_handle_any_t ptl_handle_me_t;
#define PTL_HANDLE_NONE \
-((const ptl_handle_any_t){.nal_idx = -1, .cookie = -1})
+ ((const ptl_handle_any_t){.nal_idx = -1, .cookie = -1})
#define PTL_EQ_NONE PTL_HANDLE_NONE
static inline int PtlHandleEqual (ptl_handle_any_t h1, ptl_handle_any_t h2)
ptl_handle_me_t unlinked_me;
ptl_md_t mem_desc;
ptl_hdr_data_t hdr_data;
- cycles_t arrival_time;
+ struct timeval arrival_time;
volatile ptl_seq_t sequence;
} ptl_event_t;
-
typedef enum {
PTL_ACK_REQ,
PTL_NOACK_REQ
} ptl_ack_req_t;
-
typedef struct {
volatile ptl_seq_t sequence;
ptl_size_t size;
ptl_eq_t *eq;
} ptl_ni_t;
-
typedef struct {
int max_match_entries; /* max number of match entries */
int max_mem_descriptors; /* max number of memory descriptors */
Makefile
Makefile.in
+.*.o.cmd
-include ../Kernelenv
+include $(obj)/../Kernelenv
obj-y = socknal/
-# more coming...
\ No newline at end of file
+# more coming...
return &kgmnal_api;
}
-static void __exit
+static void /*__exit*/
kgmnal_finalize(void)
{
struct list_head *tmp;
#define KQSW_TX_MAXCONTIG (1<<10) /* largest payload that gets made contiguous on transmit */
#define KQSW_NTXMSGS 8 /* # normal transmit messages */
-#define KQSW_NNBLK_TXMSGS 128 /* # reserved transmit messages if can't block */
+#define KQSW_NNBLK_TXMSGS 256 /* # reserved transmit messages if can't block */
#define KQSW_NRXMSGS_LARGE 64 /* # large receive buffers */
#define KQSW_EP_ENVELOPES_LARGE 128 /* # large ep envelopes */
if (ktx == NULL) {
kqswnal_cerror_hdr (hdr);
lib_finalize (&kqswnal_lib, private, cookie);
+ return (-1);
}
memcpy (ktx->ktx_buffer, hdr, sizeof (*hdr)); /* copy hdr from caller's stack */
/* Called by kernel at module unload time */
-static void __exit
+static void /*__exit*/
kscimacnal_finalize(void)
{
/* FIXME: How should the shutdown procedure really look? */
int nloops = 0;
int id = sched - ksocknal_data.ksnd_schedulers;
char name[16];
-#if (CONFIG_SMP && CPU_AFFINITY)
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
- int cpu = cpu_logical_map(id % num_online_cpus());
-#else
-#warning "Take care of architecure specific logical APIC map"
- int cpu = 1; /* Have to change later. */
-#endif /* LINUX_VERSION_CODE */
-
- set_cpus_allowed (current, 1 << cpu);
- id = cpu;
-#endif /* CONFIG_SMP && CPU_AFFINITY */
snprintf (name, sizeof (name),"ksocknald[%d]", id);
kportal_daemonize (name);
kportal_blockallsigs ();
+
+#if (CONFIG_SMP && CPU_AFFINITY)
+ if ((cpu_online_map & (1 << id)) != 0)
+ current->cpus_allowed = (1 << id);
+ else
+ CERROR ("Can't set CPU affinity for %s\n", name);
+#endif /* CONFIG_SMP && CPU_AFFINITY */
spin_lock_irqsave (&sched->kss_lock, flags);
}
-void __exit
+void /*__exit*/
ktoenal_module_fini (void)
{
CDEBUG(D_MALLOC, "before NAL cleanup: kmem %d\n",
spin_lock_irqsave (&ktoenal_data.ksnd_sched_lock, *irq_flags);
goto get_fmb; /* => go get a fwd msg buffer */
default:
- LBUG ();
+ break;
}
/* Not Reached */
+ LBUG ();
}
PROF_START(lib_parse);
goto out; /* (later) */
default:
- LBUG ();
+ break;
}
/* Not Reached */
+ LBUG ();
out:
spin_lock_irqsave (&ktoenal_data.ksnd_sched_lock, *irq_flags);
Makefile
Makefile.in
link-stamp
+.*.o.cmd
include fs/lustre/portals/Kernelenv
obj-y += libcfs.o
-licfs-objs := module.o proc.o debug.o
\ No newline at end of file
+libcfs-objs := module.o proc.o debug.o
memset(debug_buf, 0, debug_size);
debug_wrapped = 0;
- printk(KERN_INFO "Portals: allocated %lu byte debug buffer at %p.\n",
- bufsize, debug_buf);
+ //printk(KERN_INFO "Portals: allocated %lu byte debug buffer at %p.\n",
+ //bufsize, debug_buf);
atomic_set(&debug_off_a, debug_off);
notifier_chain_register(&panic_notifier_list, &lustre_panic_notifier);
debug_size = bufsize;
if (debug_buf == NULL)
return -EINVAL;
- CDEBUG(0, "*******************************************************************************\n");
+ CDEBUG(0, "********************************************************\n");
CDEBUG(0, "DEBUG MARKER: %s\n", text);
- CDEBUG(0, "*******************************************************************************\n");
+ CDEBUG(0, "********************************************************\n");
return 0;
}
/* FIXME: I'm not very smart; someone smarter should make this better. */
void
-portals_debug_msg (int subsys, int mask, char *file, char *fn, int line,
- unsigned long stack, const char *format, ...)
+portals_debug_msg(int subsys, int mask, char *file, const char *fn,
+ const int line, unsigned long stack, const char *format, ...)
{
va_list ap;
unsigned long flags;
portal_debug = debug_level;
}
-void portals_run_lbug_upcall(char * file, char *fn, int line)
+void portals_run_lbug_upcall(char *file, const char *fn, const int line)
{
char *argv[6];
char *envp[3];
argv[0] = portals_upcall;
argv[1] = "LBUG";
argv[2] = file;
- argv[3] = fn;
+ argv[3] = (char *)fn;
argv[4] = buf;
argv[5] = NULL;
struct semaphore nal_cmd_sem;
#ifdef PORTAL_DEBUG
-void
-kportal_assertion_failed (char *expr, char *file, char *func, int line)
+void kportal_assertion_failed(char *expr, char *file, const char *func,
+ const int line)
{
- portals_debug_msg(0, D_EMERG, file, func, line, CDEBUG_STACK(),
+ portals_debug_msg(0, D_EMERG, file, func, line, CDEBUG_STACK,
"ASSERTION(%s) failed\n", expr);
LBUG_WITH_LOC(file, func, line);
}
return (-EINVAL);
err = PtlFailNid (*nip, data->ioc_nid, data->ioc_count);
+ kportal_put_ni (data->ioc_nal);
break;
}
.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 += portals.o
-portals-objs := lib-dispatch.o lib-eq.o lib-init.o lib-md.o lib-me.o lib-move.o lib-msg.o lib-ni.o lib-not-impl.o lib-pid.o api-eq.o api-errno.o api-init.o api-md.o api-me.o api-ni.o api-wrap.o
+portals-objs := lib-dispatch.o lib-eq.o lib-init.o lib-md.o lib-me.o \
+ lib-move.o lib-msg.o lib-ni.o lib-pid.o \
+ api-eq.o api-errno.o api-init.o api-me.o api-ni.o \
+ api-wrap.o
msg->send_ack = 0;
msg->md = md;
- msg->ev.arrival_time = get_cycles();
+ do_gettimeofday(&msg->ev.arrival_time);
md->pending++;
if (md->threshold != PTL_MD_THRESH_INF) {
LASSERT (md->threshold > 0);
.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 += kptlrouter.o
kptlrouter-objs := router.o proc.o
#include "router.h"
-struct list_head kpr_routes;
-struct list_head kpr_nals;
+LIST_HEAD(kpr_routes);
+LIST_HEAD(kpr_nals);
unsigned long long kpr_fwd_bytes;
unsigned long kpr_fwd_packets;
*
* Once in a blue moon we register/deregister NALs and add/remove routing
* entries (thread context only)... */
-rwlock_t kpr_rwlock;
+rwlock_t kpr_rwlock = RW_LOCK_UNLOCKED;
kpr_router_interface_t kpr_router_interface = {
kprri_register: kpr_register_nal,
int
kpr_register_nal (kpr_nal_interface_t *nalif, void **argp)
{
- long flags;
+ unsigned long flags;
struct list_head *e;
kpr_nal_entry_t *ne;
void
kpr_shutdown_nal (void *arg)
{
- long flags;
+ unsigned long flags;
kpr_nal_entry_t *ne = (kpr_nal_entry_t *)arg;
CDEBUG (D_OTHER, "Shutting down NAL %d\n", ne->kpne_interface.kprni_nalid);
void
kpr_deregister_nal (void *arg)
{
- long flags;
+ unsigned long flags;
kpr_nal_entry_t *ne = (kpr_nal_entry_t *)arg;
CDEBUG (D_OTHER, "Deregister NAL %d\n", ne->kpne_interface.kprni_nalid);
kpr_add_route (int gateway_nalid, ptl_nid_t gateway_nid, ptl_nid_t lo_nid,
ptl_nid_t hi_nid)
{
- long flags;
+ unsigned long flags;
struct list_head *e;
kpr_route_entry_t *re;
int
kpr_del_route (ptl_nid_t nid)
{
- long flags;
+ unsigned long flags;
struct list_head *e;
CDEBUG(D_OTHER, "Del route "LPX64"\n", nid);
return (-ENOENT);
}
-static void __exit
+static void /*__exit*/
kpr_finalise (void)
{
LASSERT (list_empty (&kpr_nals));
CDEBUG(D_MALLOC, "kpr_initialise: kmem %d\n",
atomic_read(&portal_kmemory));
- rwlock_init(&kpr_rwlock);
- INIT_LIST_HEAD(&kpr_routes);
- INIT_LIST_HEAD(&kpr_nals);
-
kpr_proc_init();
PORTAL_SYMBOL_REGISTER(kpr_router_interface);
Makefile
Makefile.in
.deps
+.*.o.cmd
/* called by the portals_ioctl for ping requests */
-static int kping_client(struct portal_ioctl_data *args)
+int kping_client(struct portal_ioctl_data *args)
{
PORTAL_ALLOC (client, sizeof(struct pingcli_data));
if (client == NULL)
} /* pingcli_init() */
-static void __exit pingcli_cleanup(void)
+static void /*__exit*/ pingcli_cleanup(void)
{
PORTAL_SYMBOL_UNREGISTER (kping_client);
} /* pingcli_cleanup() */
#include <asm/semaphore.h>
#define STDSIZE (sizeof(int) + sizeof(int) + sizeof(struct timeval))
-#define MAXSIZE (16*1024*1024)
+#define MAXSIZE (16*1024)
static unsigned ping_head_magic;
static unsigned ping_bulk_magic;
-static int nal = 0; // Your NAL,
+static int nal = SOCKNAL; // Your NAL,
static unsigned long packets_valid = 0; // Valid packets
static int running = 1;
atomic_t pkt;
} /* pingsrv_init() */
-static void __exit pingsrv_cleanup(void)
+static void /*__exit*/ pingsrv_cleanup(void)
{
remove_proc_entry ("net/pingsrv", NULL);
/* called by the portals_ioctl for ping requests */
-static int kping_client(struct portal_ioctl_data *args)
+int kping_client(struct portal_ioctl_data *args)
{
PORTAL_ALLOC (client, sizeof(struct pingcli_data));
} /* pingcli_init() */
-static void __exit pingcli_cleanup(void)
+static void /*__exit*/ pingcli_cleanup(void)
{
PORTAL_SYMBOL_UNREGISTER (kping_client);
} /* pingcli_cleanup() */
} /* pingsrv_init() */
-static void __exit pingsrv_cleanup(void)
+static void /*__exit*/ pingsrv_cleanup(void)
{
remove_proc_entry ("net/pingsrv", NULL);
/* FIXME: I'm not very smart; someone smarter should make this better. */
void
-portals_debug_msg (int subsys, int mask, char *file, char *fn, int line,
- const char *format, ...)
+portals_debug_msg (int subsys, int mask, char *file, const char *fn,
+ const int line, const char *format, ...)
{
va_list ap;
unsigned long flags;
/* FIXME: I'm not very smart; someone smarter should make this better. */
void
-portals_debug_msg (int subsys, int mask, char *file, char *fn, int line,
- const char *format, ...)
+portals_debug_msg (int subsys, int mask, char *file, const char *fn,
+ const int line, const char *format, ...)
{
va_list ap;
unsigned long flags;
{"mds_ext3", "lustre/mds"},
{"mds_extN", "lustre/mds"},
{"ptlbd", "lustre/ptlbd"},
+ {"mgmt_svc", "lustre/mgmt"},
+ {"mgmt_cli", "lustre/mgmt"},
{NULL, NULL}
};
char *path = "..";
#include <stdio.h>
#include <sys/types.h>
+#include <netdb.h>
#include <sys/socket.h>
#include <netinet/tcp.h>
#include <netdb.h>
return ((e == NULL) ? "???" : e->name);
}
+static struct hostent *
+ptl_gethostbyname(char * hname) {
+ struct hostent *he;
+ he = gethostbyname(hname);
+ if (!he) {
+ switch(h_errno) {
+ case HOST_NOT_FOUND:
+ case NO_ADDRESS:
+ fprintf(stderr, "Unable to resolve hostname: %s\n",
+ hname);
+ break;
+ default:
+ fprintf(stderr, "gethostbyname error: %s\n",
+ strerror(errno));
+ break;
+ }
+ return NULL;
+ }
+ return he;
+}
+
int
ptl_parse_nid (ptl_nid_t *nidp, char *str)
{
if ((('a' <= str[0] && str[0] <= 'z') ||
('A' <= str[0] && str[0] <= 'Z')) &&
- (he = gethostbyname (str)) != NULL)
+ (he = ptl_gethostbyname (str)) != NULL)
{
__u32 addr = *(__u32 *)he->h_addr;
goto usage;
}
- he = gethostbyname(argv[1]);
- if (!he) {
- fprintf(stderr, "gethostbyname error: %s\n",
- strerror(errno));
+ he = ptl_gethostbyname(argv[1]);
+ if (!he)
return -1;
- }
g_port = atol(argv[2]);
PORTAL_IOC_INIT(data);
if (argc == 2) {
- he = gethostbyname(argv[1]);
- if (!he) {
- fprintf(stderr, "gethostbyname error: %s\n",
- strerror(errno));
+ he = ptl_gethostbyname(argv[1]);
+ if (!he)
return -1;
- }
data.ioc_nid = ntohl (*(__u32 *)he->h_addr); /* HOST byte order */
PORTAL_IOC_INIT(data);
if (argc == 2) {
- he = gethostbyname(argv[1]);
- if (!he) {
- fprintf(stderr, "gethostbyname error: %s\n",
- strerror(errno));
+ he = ptl_gethostbyname(argv[1]);
+ if (!he)
return -1;
- }
data.ioc_nid = ntohl (*(__u32 *)he->h_addr); /* HOST byte order */
{
static char buffer[1024];
static double last = 0.0;
+ static unsigned long long old_bytes;
+ static unsigned long old_packets;
+ static unsigned long old_errors;
double now;
double t;
- long long bytes;
- long packets;
- long errors;
- long depth;
+ unsigned long long new_bytes, bytes;
+ unsigned long new_packets, packets;
+ unsigned long new_errors, errors;
+ unsigned long depth;
int n;
lseek (fd, 0, SEEK_SET);
}
buffer[n] = 0;
- n = sscanf (buffer, "%Ld %ld %ld %ld", &bytes, &packets, &errors, &depth);
+ n = sscanf (buffer, "%Lu %lu %lu %lu",
+ &new_bytes, &new_packets, &new_errors, &depth);
if (n < 3)
{
}
if (last == 0.0)
- printf ("%Ld bytes, %ld packets (sz %Ld) %ld errors",
- bytes, packets, (long long)((packets == 0) ? 0LL : bytes/packets), errors);
+ printf ("%llu bytes, %lu packets (sz %lld), %lu errors",
+ new_bytes, new_packets,
+ (long long)((new_packets == 0) ? 0LL : new_bytes/new_packets),
+ new_errors);
else
{
t = now - last;
- printf ("%9Ld (%7.2fMb/s), %7ld packets (sz %5Ld, %5ld/s) %ld errors (%ld/s)",
+ if (new_bytes < old_bytes)
+ bytes = -1ULL - old_bytes + new_bytes + 1;
+ else
+ bytes = new_bytes - old_bytes;
+ if (new_packets < old_packets)
+ packets = -1UL - old_packets + new_packets + 1;
+ else
+ packets = new_packets - old_packets;
+ if (new_errors < old_errors)
+ errors = -1UL - old_errors + new_errors + 1;
+ else
+ errors = new_errors - old_errors;
+
+ printf ("%9llu bytes (%7.2fMb/s), %7lu packets (sz %5lld, %5ld/s), %lu errors (%ld/s)",
bytes, ((double)bytes)/((1<<20) * t),
packets, (long long)((packets == 0) ? 0LL : bytes/packets), (long)(packets/t),
errors, (long)(errors/t));
}
+ old_bytes = new_bytes;
+ old_packets = new_packets;
+ old_errors = new_errors;
if (n == 4)
- printf (" (%ld)\n", depth);
+ printf (", depth (%ld)\n", depth);
else
printf ("\n");
fflush (stdout);
lseek (fd, 0, SEEK_SET);
- write (fd, "\n", 1);
last = timenow();
}
if (argc > 1)
interval = atoi (argv[1]);
- fd = open ("/proc/sys/portals/router", O_RDWR);
+ fd = open ("/proc/sys/portals/router", O_RDONLY);
if (fd < 0)
{
fprintf (stderr, "Can't open stat: %s\n", strerror (errno));
-include fs/lustre/portals/Kernelenv
+include $(src)/portals/Kernelenv
+
+# for scripts/version_tag.pl
+LINUX = @LINUX@
obj-y += portals/
+# obdclass has to come before anything that does class_register..
+obj-y += obdclass/
+obj-y += ptlrpc/
+obj-y += ldlm/
+obj-y += obdfilter/
+obj-y += mdc/
obj-y += mds/
+obj-y += obdecho/
+obj-y += osc/
+obj-y += ost/
+obj-y += lov/
+obj-y += llite/
+
+# portals needs to be before utils/, which pulls in ptlctl objects
+obj-m += utils/
+obj-m += tests/
# This code is issued under the GNU General Public License.
# See the file COPYING in this distribution
-include fs/lustre/portals/Kernelenv
+include $(src)/../portals/Kernelenv
obj-y += mds.o
-
-mds-objs := mds_lov.o handler.o mds_reint.o mds_fs.o lproc_mds.o mds_internal.h mds_updates.o mds_open.o simple.o target.o
+mds-objs := mds_lov.o handler.o mds_reint.o mds_fs.o lproc_mds.o mds_open.o \
+ mds_lib.o
+
config.log
config.status
configure
+.*.o.cmd
-EXTRA_CFLAGS= -Ifs/lustre/include -Ifs/lustre/portals/include
+EXTRA_CFLAGS := -Ifs/lustre/include -Ifs/lustre/portals/include
+# portals/utils/debug.c wants <linux/version.h> from userspace. sigh.
+HOSTCFLAGS := -I@LINUX@/include $(EXTRA_CFLAGS)
+LIBREADLINE := @LIBREADLINE@
+# 2.5's makefiles aren't nice to cross dir libraries in host programs
+PTLCTLOBJS := debug.o l_ioctl.o parser.o portals.o
-EXTRA_CFLAGS= -Ifs/lustre/include -Ifs/lustre/portals/include
+EXTRA_CFLAGS := -Ifs/lustre/include -Ifs/lustre/portals/include
+HOSTCFLAGS := $(EXTRA_CFLAGS)
+# the kernel doesn't want us to build archives for host binaries :/
+PTLCTLOBJS := debug.o l_ioctl.o parser.o portals.o
-include fs/lustre/portals/Kernelenv
+include $(src)/Kernelenv
-obj-y += portals/
+# The ordering of these determines the order that each subsystem's
+# module_init() functions are called in. if these are changed make sure
+# they reflect the dependencies between each subsystem's _init functions.
obj-y += libcfs/
-obj-y += knals/
+obj-y += portals/
obj-y += router/
+obj-y += knals/
+obj-y += tests/
+
+obj-m += utils/
AC_ARG_WITH(linux, [ --with-linux=[path] set path to Linux source (default=/usr/src/linux)],LINUX=$with_linux,LINUX=/usr/src/linux)
AC_SUBST(LINUX)
+if test x$enable_inkernel = xyes ; then
+ echo ln -s `pwd` $LINUX/fs/lustre
+ rm $LINUX/fs/lustre
+ ln -s `pwd` $LINUX/fs/lustre
+fi
-# --------- UML? --------------------
+# --------------------
AC_MSG_CHECKING(if you are running user mode linux for $host_cpu ...)
if test $host_cpu = "lib" ; then
host_cpu="lib"
MOD_LINK=elf64_ia64
;;
+ x86_64 )
+ AC_MSG_RESULT($host_cpu)
+ KCFLAGS='-g -O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -fomit-frame-pointer -mno-red-zone -mcmodel=kernel -pipe -fno-reorder-blocks -finline-limit=2000 -fno-strength-reduce -fno-asynchronous-unwind-tables'
+ KCPPFLAGS='-D__KERNEL__ -DMODULE'
+ MOD_LINK=elf_x86_64
+;;
+
sparc64 )
AC_MSG_RESULT($host_cpu)
KCFLAGS='-O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fomit-frame-pointer -fno-strict-aliasing -fno-common -Wno-unused -m64 -pipe -mno-fpu -mcpu=ultrasparc -mcmodel=medlow -ffixed-g4 -fcall-used-g5 -fcall-used-g7 -Wno-sign-compare -Wa,--undeclared-regs'
AC_MSG_ERROR(** cannot find $LINUX/include/linux/autoconf.h. Run make config in $LINUX.)
fi
-# ------------ RELEASE and moduledir ------------------
+# ------------ LINUXRELEASE and moduledir ------------------
AC_MSG_CHECKING(for Linux release)
dnl We need to rid ourselves of the nasty [ ] quotes.
changequote(, )
dnl Get release from version.h
- RELEASE="`sed -ne 's/.*UTS_RELEASE[ \"]*\([0-9.a-zA-Z_-]*\).*/\1/p' $LINUX/include/linux/version.h`"
+ LINUXRELEASE="`sed -ne 's/.*UTS_RELEASE[ \"]*\([0-9.a-zA-Z_-]*\).*/\1/p' $LINUX/include/linux/version.h`"
changequote([, ])
- moduledir='$(libdir)/modules/'$RELEASE/kernel
+ moduledir='$(libdir)/modules/'$LINUXRELEASE/kernel
AC_SUBST(moduledir)
modulefsdir='$(moduledir)/fs/$(PACKAGE)'
AC_SUBST(modulefsdir)
+ AC_MSG_RESULT($LINUXRELEASE)
+ AC_SUBST(LINUXRELEASE)
+
+# ------------ RELEASE --------------------------------
+ AC_MSG_CHECKING(lustre release)
+
+ dnl We need to rid ourselves of the nasty [ ] quotes.
+ changequote(, )
+ dnl Get release from version.h
+ RELEASE="`sed -ne 's/-/_/g' -e 's/.*UTS_RELEASE[ \"]*\([0-9.a-zA-Z_]*\).*/\1/p' $LINUX/include/linux/version.h`_`date +%Y%m%d%H%M`"
+ changequote([, ])
+
AC_MSG_RESULT($RELEASE)
AC_SUBST(RELEASE)
# This needs to run after we've defined the KCPPFLAGS
AC_MSG_CHECKING(for kernel version)
-AC_TRY_LINK([#define __KERNEL__
+AC_TRY_COMPILE([#define __KERNEL__
#include <linux/sched.h>],
[struct task_struct p;
p.sighand = NULL;],
-/* ../include/config.h.in. Generated automatically from configure.in by autoheader. */
+/* portals/include/config.h.in. Generated automatically from configure.in by autoheader. */
-/* Define if you have the readline library (-lreadline). */
-#undef HAVE_LIBREADLINE
+/* The number of bytes in a unsigned long long. */
+#undef SIZEOF_UNSIGNED_LONG_LONG
/* Name of package */
#undef PACKAGE
/* Version number of package */
#undef VERSION
+/* IOCTL Buffer Size */
+#undef OBD_MAX_IOCTL_BUFFER
+
#define LOWEST_BIT_SET(x) ((x) & ~((x) - 1))
-#ifndef CONFIG_SMP
-# define smp_processor_id() 0
-#endif
-
/*
* Debugging
*/
#define S_COBD (21 << 24)
#define S_PTLBD (22 << 24)
#define S_LOG (23 << 24)
+#define S_MGMT (24 << 24)
/* If you change these values, please keep portals/linux/utils/debug.c
* up to date! */
#define D_RPCTRACE (1 << 20) /* for distributed debugging */
#define D_VFSTRACE (1 << 21)
-#ifndef __KERNEL__
-#define THREAD_SIZE 8192
+#ifdef __KERNEL__
+# include <linux/sched.h> /* THREAD_SIZE */
+#else
+# define THREAD_SIZE 8192
#endif
-#ifdef __ia64__
-#define CDEBUG_STACK() (THREAD_SIZE - \
+
+#ifdef __KERNEL__
+# ifdef __ia64__
+# define CDEBUG_STACK (THREAD_SIZE - \
((unsigned long)__builtin_dwarf_cfa() & \
(THREAD_SIZE - 1)))
-#else
-#define CDEBUG_STACK() (THREAD_SIZE - \
+# else
+# define CDEBUG_STACK (THREAD_SIZE - \
((unsigned long)__builtin_frame_address(0) & \
(THREAD_SIZE - 1)))
-#endif
+# endif
-#ifdef __KERNEL__
#define CHECK_STACK(stack) \
do { \
if ((stack) > 3*THREAD_SIZE/4 && (stack) > portal_stack) { \
/*panic("LBUG");*/ \
} \
} while (0)
-#else
+#else /* __KERNEL __ */
#define CHECK_STACK(stack) do { } while(0)
-#endif
+#define CDEBUG_STACK (0L)
+#endif /* __KERNEL__ */
#if 1
#define CDEBUG(mask, format, a...) \
do { \
- CHECK_STACK(CDEBUG_STACK()); \
+ CHECK_STACK(CDEBUG_STACK); \
if (!(mask) || ((mask) & (D_ERROR | D_EMERG)) || \
(portal_debug & (mask) && \
portal_subsystem_debug & (1 << (DEBUG_SUBSYSTEM >> 24)))) \
portals_debug_msg(DEBUG_SUBSYSTEM, mask, \
__FILE__, __FUNCTION__, __LINE__, \
- CDEBUG_STACK(), format , ## a); \
+ CDEBUG_STACK, format, ## a); \
} while (0)
#define CWARN(format, a...) CDEBUG(D_WARNING, format, ## a)
#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) */
#ifdef PORTAL_DEBUG
-extern void kportal_assertion_failed(char *expr,char *file,char *func,int line);
+extern void kportal_assertion_failed(char *expr, char *file, const char *func,
+ const int line);
#define LASSERT(e) ((e) ? 0 : kportal_assertion_failed( #e , __FILE__, \
__FUNCTION__, __LINE__))
#else
#endif /* PORTALS_PROFILING */
/* debug.c */
-void portals_run_lbug_upcall(char * file, char *fn, int line);
+void portals_run_lbug_upcall(char * file, const char *fn, const int line);
void portals_debug_dumplog(void);
int portals_debug_init(unsigned long bufsize);
int portals_debug_cleanup(void);
# warning printf has been defined as a macro...
# undef printf
#endif
-void portals_debug_msg (int subsys, int mask, char *file, char *fn, int line,
- unsigned long stack, const char *format, ...)
+void portals_debug_msg(int subsys, int mask, char *file, const char *fn,
+ const int line, unsigned long stack,
+ const char *format, ...)
__attribute__ ((format (printf, 7, 8)));
#else
-void portals_debug_msg (int subsys, int mask, char *file, char *fn,
- int line, unsigned long stack,
+void portals_debug_msg (int subsys, int mask, char *file, const char *fn,
+ const int line, unsigned long stack,
const char *format, ...);
#endif /* __GNUC__ */
void portals_debug_set_level(unsigned int debug_level);
#ifndef _LINUX_LIST_H
-#define _LINUX_LIST_H
-
/*
* Simple doubly linked list implementation.
__list_del(entry->prev, entry->next);
INIT_LIST_HEAD(entry);
}
+#endif
+#ifndef list_for_each_entry
/**
* list_move - delete from one list and add as another's head
* @list: the entry to move
__list_del(list->prev, list->next);
list_add_tail(list, head);
}
+#endif
+#ifndef _LINUX_LIST_H
+#define _LINUX_LIST_H
/**
* list_empty - tests whether a list is empty
* @head: the list to test.
* vim:expandtab:shiftwidth=8:tabstop=8:
*
* Compile with:
- * cc -I../../portals/include -o fio fio.c -L../../portals/linux/utils -lptlctl
+ * cc -I../../portals/include -o fio fio.c -L../../portals/linux/utils -lptlctl
*/
#ifndef __LTRACE_H_
#define __LTRACE_H_
argv[0] = "debug_kernel";
argv[1] = fname;
argv[2] = "1";
-
+
fprintf(stderr, "[ptlctl] %s %s %s\n", argv[0], argv[1], argv[2]);
-
+
return jt_dbg_debug_kernel(3, argv);
}
static inline int ltrace_clear()
{
char* argv[1];
-
+
argv[0] = "clear";
-
+
fprintf(stderr, "[ptlctl] %s\n", argv[0]);
-
+
return jt_dbg_clear_debug_buf(1, argv);
}
{
char* argv[2];
char mark_buf[PATH_MAX];
-
+
snprintf(mark_buf, PATH_MAX, "====%d=%s", indent_level, text);
-
+
argv[0] = "mark";
argv[1] = mark_buf;
return jt_dbg_mark_debug_buf(2, argv);
char* argv[2];
argv[0] = "list";
argv[1] = "applymasks";
-
+
fprintf(stderr, "[ptlctl] %s %s\n", argv[0], argv[1]);
-
+
return jt_dbg_list(2, argv);
}
#ifdef PORTALS_DEV_ID
rc = register_ioc_dev(PORTALS_DEV_ID, PORTALS_DEV_PATH);
#endif
- ltrace_filter("class");
+ ltrace_filter("class");
ltrace_filter("socknal");
- ltrace_filter("qswnal");
- ltrace_filter("gmnal");
- ltrace_filter("portals");
-
- ltrace_show("all_types");
- ltrace_filter("trace");
- ltrace_filter("malloc");
- ltrace_filter("net");
- ltrace_filter("page");
- ltrace_filter("other");
- ltrace_filter("info");
+ ltrace_filter("qswnal");
+ ltrace_filter("gmnal");
+ ltrace_filter("portals");
+
+ ltrace_show("all_types");
+ ltrace_filter("trace");
+ ltrace_filter("malloc");
+ ltrace_filter("net");
+ ltrace_filter("page");
+ ltrace_filter("other");
+ ltrace_filter("info");
ltrace_applymasks();
return rc;
struct timezone tz;
int nob;
int underuml = !not_uml();
-
+
gettimeofday(&tv, &tz);
nob = snprintf(cmdbuf, LTRACE_MAX_NOB, "ps --no-headers -eo \"");
"(%s:%d:%s() %d+%lu): ",
"lltrace.h", __LINE__, __FUNCTION__, 0, 0L);
}
-
+
nob += snprintf(cmdbuf+nob, LTRACE_MAX_NOB, " %%p %%c\" >> %s", fname);
system(cmdbuf);
}
-/*
-*/
-
#ifndef MYRNAL_H
#define MYRNAL_H
-/*
-*/
#ifndef _NAL_H_
#define _NAL_H_
-/*
- */
-
#ifndef _INCppidh_
#define _INCppidh_
/*
-*/
-/*
* stringtab.h
*/
#define _P30_TYPES_H_
#ifdef __linux__
-#include <asm/types.h>
-#include <asm/timex.h>
+# include <asm/types.h>
+# include <asm/timex.h>
#else
-#include <sys/types.h>
+# include <sys/types.h>
typedef u_int32_t __u32;
typedef u_int64_t __u64;
-typedef unsigned long long cycles_t;
-static inline cycles_t get_cycles(void) { return 0; }
+#endif
+
+#ifdef __KERNEL__
+# include <linux/time.h>
+#else
+# include <sys/time.h>
+# define do_gettimeofday(tv) gettimeofday(tv, NULL)
#endif
typedef __u64 ptl_nid_t;
typedef ptl_handle_any_t ptl_handle_me_t;
#define PTL_HANDLE_NONE \
-((const ptl_handle_any_t){.nal_idx = -1, .cookie = -1})
+ ((const ptl_handle_any_t){.nal_idx = -1, .cookie = -1})
#define PTL_EQ_NONE PTL_HANDLE_NONE
static inline int PtlHandleEqual (ptl_handle_any_t h1, ptl_handle_any_t h2)
ptl_handle_me_t unlinked_me;
ptl_md_t mem_desc;
ptl_hdr_data_t hdr_data;
- cycles_t arrival_time;
+ struct timeval arrival_time;
volatile ptl_seq_t sequence;
} ptl_event_t;
-
typedef enum {
PTL_ACK_REQ,
PTL_NOACK_REQ
} ptl_ack_req_t;
-
typedef struct {
volatile ptl_seq_t sequence;
ptl_size_t size;
ptl_eq_t *eq;
} ptl_ni_t;
-
typedef struct {
int max_match_entries; /* max number of match entries */
int max_mem_descriptors; /* max number of memory descriptors */
Makefile
Makefile.in
+.*.o.cmd
-include ../Kernelenv
+include $(obj)/../Kernelenv
obj-y = socknal/
-# more coming...
\ No newline at end of file
+# more coming...
return &kgmnal_api;
}
-static void __exit
+static void /*__exit*/
kgmnal_finalize(void)
{
struct list_head *tmp;
#define KQSW_TX_MAXCONTIG (1<<10) /* largest payload that gets made contiguous on transmit */
#define KQSW_NTXMSGS 8 /* # normal transmit messages */
-#define KQSW_NNBLK_TXMSGS 128 /* # reserved transmit messages if can't block */
+#define KQSW_NNBLK_TXMSGS 256 /* # reserved transmit messages if can't block */
#define KQSW_NRXMSGS_LARGE 64 /* # large receive buffers */
#define KQSW_EP_ENVELOPES_LARGE 128 /* # large ep envelopes */
if (ktx == NULL) {
kqswnal_cerror_hdr (hdr);
lib_finalize (&kqswnal_lib, private, cookie);
+ return (-1);
}
memcpy (ktx->ktx_buffer, hdr, sizeof (*hdr)); /* copy hdr from caller's stack */
/* Called by kernel at module unload time */
-static void __exit
+static void /*__exit*/
kscimacnal_finalize(void)
{
/* FIXME: How should the shutdown procedure really look? */
int nloops = 0;
int id = sched - ksocknal_data.ksnd_schedulers;
char name[16];
-#if (CONFIG_SMP && CPU_AFFINITY)
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
- int cpu = cpu_logical_map(id % num_online_cpus());
-#else
-#warning "Take care of architecure specific logical APIC map"
- int cpu = 1; /* Have to change later. */
-#endif /* LINUX_VERSION_CODE */
-
- set_cpus_allowed (current, 1 << cpu);
- id = cpu;
-#endif /* CONFIG_SMP && CPU_AFFINITY */
snprintf (name, sizeof (name),"ksocknald[%d]", id);
kportal_daemonize (name);
kportal_blockallsigs ();
+
+#if (CONFIG_SMP && CPU_AFFINITY)
+ if ((cpu_online_map & (1 << id)) != 0)
+ current->cpus_allowed = (1 << id);
+ else
+ CERROR ("Can't set CPU affinity for %s\n", name);
+#endif /* CONFIG_SMP && CPU_AFFINITY */
spin_lock_irqsave (&sched->kss_lock, flags);
}
-void __exit
+void /*__exit*/
ktoenal_module_fini (void)
{
CDEBUG(D_MALLOC, "before NAL cleanup: kmem %d\n",
spin_lock_irqsave (&ktoenal_data.ksnd_sched_lock, *irq_flags);
goto get_fmb; /* => go get a fwd msg buffer */
default:
- LBUG ();
+ break;
}
/* Not Reached */
+ LBUG ();
}
PROF_START(lib_parse);
goto out; /* (later) */
default:
- LBUG ();
+ break;
}
/* Not Reached */
+ LBUG ();
out:
spin_lock_irqsave (&ktoenal_data.ksnd_sched_lock, *irq_flags);
Makefile
Makefile.in
link-stamp
+.*.o.cmd
include fs/lustre/portals/Kernelenv
obj-y += libcfs.o
-licfs-objs := module.o proc.o debug.o
\ No newline at end of file
+libcfs-objs := module.o proc.o debug.o
memset(debug_buf, 0, debug_size);
debug_wrapped = 0;
- printk(KERN_INFO "Portals: allocated %lu byte debug buffer at %p.\n",
- bufsize, debug_buf);
+ //printk(KERN_INFO "Portals: allocated %lu byte debug buffer at %p.\n",
+ //bufsize, debug_buf);
atomic_set(&debug_off_a, debug_off);
notifier_chain_register(&panic_notifier_list, &lustre_panic_notifier);
debug_size = bufsize;
if (debug_buf == NULL)
return -EINVAL;
- CDEBUG(0, "*******************************************************************************\n");
+ CDEBUG(0, "********************************************************\n");
CDEBUG(0, "DEBUG MARKER: %s\n", text);
- CDEBUG(0, "*******************************************************************************\n");
+ CDEBUG(0, "********************************************************\n");
return 0;
}
/* FIXME: I'm not very smart; someone smarter should make this better. */
void
-portals_debug_msg (int subsys, int mask, char *file, char *fn, int line,
- unsigned long stack, const char *format, ...)
+portals_debug_msg(int subsys, int mask, char *file, const char *fn,
+ const int line, unsigned long stack, const char *format, ...)
{
va_list ap;
unsigned long flags;
portal_debug = debug_level;
}
-void portals_run_lbug_upcall(char * file, char *fn, int line)
+void portals_run_lbug_upcall(char *file, const char *fn, const int line)
{
char *argv[6];
char *envp[3];
argv[0] = portals_upcall;
argv[1] = "LBUG";
argv[2] = file;
- argv[3] = fn;
+ argv[3] = (char *)fn;
argv[4] = buf;
argv[5] = NULL;
struct semaphore nal_cmd_sem;
#ifdef PORTAL_DEBUG
-void
-kportal_assertion_failed (char *expr, char *file, char *func, int line)
+void kportal_assertion_failed(char *expr, char *file, const char *func,
+ const int line)
{
- portals_debug_msg(0, D_EMERG, file, func, line, CDEBUG_STACK(),
+ portals_debug_msg(0, D_EMERG, file, func, line, CDEBUG_STACK,
"ASSERTION(%s) failed\n", expr);
LBUG_WITH_LOC(file, func, line);
}
return (-EINVAL);
err = PtlFailNid (*nip, data->ioc_nid, data->ioc_count);
+ kportal_put_ni (data->ioc_nal);
break;
}
.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 += portals.o
-portals-objs := lib-dispatch.o lib-eq.o lib-init.o lib-md.o lib-me.o lib-move.o lib-msg.o lib-ni.o lib-not-impl.o lib-pid.o api-eq.o api-errno.o api-init.o api-md.o api-me.o api-ni.o api-wrap.o
+portals-objs := lib-dispatch.o lib-eq.o lib-init.o lib-md.o lib-me.o \
+ lib-move.o lib-msg.o lib-ni.o lib-pid.o \
+ api-eq.o api-errno.o api-init.o api-me.o api-ni.o \
+ api-wrap.o
msg->send_ack = 0;
msg->md = md;
- msg->ev.arrival_time = get_cycles();
+ do_gettimeofday(&msg->ev.arrival_time);
md->pending++;
if (md->threshold != PTL_MD_THRESH_INF) {
LASSERT (md->threshold > 0);
.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 += kptlrouter.o
kptlrouter-objs := router.o proc.o
#include "router.h"
-struct list_head kpr_routes;
-struct list_head kpr_nals;
+LIST_HEAD(kpr_routes);
+LIST_HEAD(kpr_nals);
unsigned long long kpr_fwd_bytes;
unsigned long kpr_fwd_packets;
*
* Once in a blue moon we register/deregister NALs and add/remove routing
* entries (thread context only)... */
-rwlock_t kpr_rwlock;
+rwlock_t kpr_rwlock = RW_LOCK_UNLOCKED;
kpr_router_interface_t kpr_router_interface = {
kprri_register: kpr_register_nal,
int
kpr_register_nal (kpr_nal_interface_t *nalif, void **argp)
{
- long flags;
+ unsigned long flags;
struct list_head *e;
kpr_nal_entry_t *ne;
void
kpr_shutdown_nal (void *arg)
{
- long flags;
+ unsigned long flags;
kpr_nal_entry_t *ne = (kpr_nal_entry_t *)arg;
CDEBUG (D_OTHER, "Shutting down NAL %d\n", ne->kpne_interface.kprni_nalid);
void
kpr_deregister_nal (void *arg)
{
- long flags;
+ unsigned long flags;
kpr_nal_entry_t *ne = (kpr_nal_entry_t *)arg;
CDEBUG (D_OTHER, "Deregister NAL %d\n", ne->kpne_interface.kprni_nalid);
kpr_add_route (int gateway_nalid, ptl_nid_t gateway_nid, ptl_nid_t lo_nid,
ptl_nid_t hi_nid)
{
- long flags;
+ unsigned long flags;
struct list_head *e;
kpr_route_entry_t *re;
int
kpr_del_route (ptl_nid_t nid)
{
- long flags;
+ unsigned long flags;
struct list_head *e;
CDEBUG(D_OTHER, "Del route "LPX64"\n", nid);
return (-ENOENT);
}
-static void __exit
+static void /*__exit*/
kpr_finalise (void)
{
LASSERT (list_empty (&kpr_nals));
CDEBUG(D_MALLOC, "kpr_initialise: kmem %d\n",
atomic_read(&portal_kmemory));
- rwlock_init(&kpr_rwlock);
- INIT_LIST_HEAD(&kpr_routes);
- INIT_LIST_HEAD(&kpr_nals);
-
kpr_proc_init();
PORTAL_SYMBOL_REGISTER(kpr_router_interface);
Makefile
Makefile.in
.deps
+.*.o.cmd
/* called by the portals_ioctl for ping requests */
-static int kping_client(struct portal_ioctl_data *args)
+int kping_client(struct portal_ioctl_data *args)
{
PORTAL_ALLOC (client, sizeof(struct pingcli_data));
if (client == NULL)
} /* pingcli_init() */
-static void __exit pingcli_cleanup(void)
+static void /*__exit*/ pingcli_cleanup(void)
{
PORTAL_SYMBOL_UNREGISTER (kping_client);
} /* pingcli_cleanup() */
#include <asm/semaphore.h>
#define STDSIZE (sizeof(int) + sizeof(int) + sizeof(struct timeval))
-#define MAXSIZE (16*1024*1024)
+#define MAXSIZE (16*1024)
static unsigned ping_head_magic;
static unsigned ping_bulk_magic;
-static int nal = 0; // Your NAL,
+static int nal = SOCKNAL; // Your NAL,
static unsigned long packets_valid = 0; // Valid packets
static int running = 1;
atomic_t pkt;
} /* pingsrv_init() */
-static void __exit pingsrv_cleanup(void)
+static void /*__exit*/ pingsrv_cleanup(void)
{
remove_proc_entry ("net/pingsrv", NULL);
/* called by the portals_ioctl for ping requests */
-static int kping_client(struct portal_ioctl_data *args)
+int kping_client(struct portal_ioctl_data *args)
{
PORTAL_ALLOC (client, sizeof(struct pingcli_data));
} /* pingcli_init() */
-static void __exit pingcli_cleanup(void)
+static void /*__exit*/ pingcli_cleanup(void)
{
PORTAL_SYMBOL_UNREGISTER (kping_client);
} /* pingcli_cleanup() */
} /* pingsrv_init() */
-static void __exit pingsrv_cleanup(void)
+static void /*__exit*/ pingsrv_cleanup(void)
{
remove_proc_entry ("net/pingsrv", NULL);
/* FIXME: I'm not very smart; someone smarter should make this better. */
void
-portals_debug_msg (int subsys, int mask, char *file, char *fn, int line,
- const char *format, ...)
+portals_debug_msg (int subsys, int mask, char *file, const char *fn,
+ const int line, const char *format, ...)
{
va_list ap;
unsigned long flags;
{"mds_ext3", "lustre/mds"},
{"mds_extN", "lustre/mds"},
{"ptlbd", "lustre/ptlbd"},
+ {"mgmt_svc", "lustre/mgmt"},
+ {"mgmt_cli", "lustre/mgmt"},
{NULL, NULL}
};
char *path = "..";
#include <stdio.h>
#include <sys/types.h>
+#include <netdb.h>
#include <sys/socket.h>
#include <netinet/tcp.h>
#include <netdb.h>
return ((e == NULL) ? "???" : e->name);
}
+static struct hostent *
+ptl_gethostbyname(char * hname) {
+ struct hostent *he;
+ he = gethostbyname(hname);
+ if (!he) {
+ switch(h_errno) {
+ case HOST_NOT_FOUND:
+ case NO_ADDRESS:
+ fprintf(stderr, "Unable to resolve hostname: %s\n",
+ hname);
+ break;
+ default:
+ fprintf(stderr, "gethostbyname error: %s\n",
+ strerror(errno));
+ break;
+ }
+ return NULL;
+ }
+ return he;
+}
+
int
ptl_parse_nid (ptl_nid_t *nidp, char *str)
{
if ((('a' <= str[0] && str[0] <= 'z') ||
('A' <= str[0] && str[0] <= 'Z')) &&
- (he = gethostbyname (str)) != NULL)
+ (he = ptl_gethostbyname (str)) != NULL)
{
__u32 addr = *(__u32 *)he->h_addr;
goto usage;
}
- he = gethostbyname(argv[1]);
- if (!he) {
- fprintf(stderr, "gethostbyname error: %s\n",
- strerror(errno));
+ he = ptl_gethostbyname(argv[1]);
+ if (!he)
return -1;
- }
g_port = atol(argv[2]);
PORTAL_IOC_INIT(data);
if (argc == 2) {
- he = gethostbyname(argv[1]);
- if (!he) {
- fprintf(stderr, "gethostbyname error: %s\n",
- strerror(errno));
+ he = ptl_gethostbyname(argv[1]);
+ if (!he)
return -1;
- }
data.ioc_nid = ntohl (*(__u32 *)he->h_addr); /* HOST byte order */
PORTAL_IOC_INIT(data);
if (argc == 2) {
- he = gethostbyname(argv[1]);
- if (!he) {
- fprintf(stderr, "gethostbyname error: %s\n",
- strerror(errno));
+ he = ptl_gethostbyname(argv[1]);
+ if (!he)
return -1;
- }
data.ioc_nid = ntohl (*(__u32 *)he->h_addr); /* HOST byte order */
{
static char buffer[1024];
static double last = 0.0;
+ static unsigned long long old_bytes;
+ static unsigned long old_packets;
+ static unsigned long old_errors;
double now;
double t;
- long long bytes;
- long packets;
- long errors;
- long depth;
+ unsigned long long new_bytes, bytes;
+ unsigned long new_packets, packets;
+ unsigned long new_errors, errors;
+ unsigned long depth;
int n;
lseek (fd, 0, SEEK_SET);
}
buffer[n] = 0;
- n = sscanf (buffer, "%Ld %ld %ld %ld", &bytes, &packets, &errors, &depth);
+ n = sscanf (buffer, "%Lu %lu %lu %lu",
+ &new_bytes, &new_packets, &new_errors, &depth);
if (n < 3)
{
}
if (last == 0.0)
- printf ("%Ld bytes, %ld packets (sz %Ld) %ld errors",
- bytes, packets, (long long)((packets == 0) ? 0LL : bytes/packets), errors);
+ printf ("%llu bytes, %lu packets (sz %lld), %lu errors",
+ new_bytes, new_packets,
+ (long long)((new_packets == 0) ? 0LL : new_bytes/new_packets),
+ new_errors);
else
{
t = now - last;
- printf ("%9Ld (%7.2fMb/s), %7ld packets (sz %5Ld, %5ld/s) %ld errors (%ld/s)",
+ if (new_bytes < old_bytes)
+ bytes = -1ULL - old_bytes + new_bytes + 1;
+ else
+ bytes = new_bytes - old_bytes;
+ if (new_packets < old_packets)
+ packets = -1UL - old_packets + new_packets + 1;
+ else
+ packets = new_packets - old_packets;
+ if (new_errors < old_errors)
+ errors = -1UL - old_errors + new_errors + 1;
+ else
+ errors = new_errors - old_errors;
+
+ printf ("%9llu bytes (%7.2fMb/s), %7lu packets (sz %5lld, %5ld/s), %lu errors (%ld/s)",
bytes, ((double)bytes)/((1<<20) * t),
packets, (long long)((packets == 0) ? 0LL : bytes/packets), (long)(packets/t),
errors, (long)(errors/t));
}
+ old_bytes = new_bytes;
+ old_packets = new_packets;
+ old_errors = new_errors;
if (n == 4)
- printf (" (%ld)\n", depth);
+ printf (", depth (%ld)\n", depth);
else
printf ("\n");
fflush (stdout);
lseek (fd, 0, SEEK_SET);
- write (fd, "\n", 1);
last = timenow();
}
if (argc > 1)
interval = atoi (argv[1]);
- fd = open ("/proc/sys/portals/router", O_RDWR);
+ fd = open ("/proc/sys/portals/router", O_RDONLY);
if (fd < 0)
{
fprintf (stderr, "Can't open stat: %s\n", strerror (errno));
}
}
print "\n";
+ $| = 1;
}
}