ia64 )
AC_MSG_RESULT($host_cpu)
- KCFLAGS='-gstabs -O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -pipe -ffixed-r13 -mfixed-range=f10-f15,f32-f127 -falign-functions=32 -mb-step'
+ KCFLAGS='-g -O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -pipe -ffixed-r13 -mfixed-range=f10-f15,f32-f127 -falign-functions=32 -mb-step'
KCPPFLAGS='-D__KERNEL__ -DMODULE'
MOD_LINK=elf64_ia64
;;
AC_MSG_RESULT(no)
fi
-AC_ARG_ENABLE(zerocopy, [ --enable-zerocopy enable socknal zerocopy],enable_zerocopy="-DSOCKNAL_ZC=1", enable_zercopy=$enable_zerocopy_temp)
+AC_ARG_ENABLE(zerocopy, [ --enable-zerocopy enable socknal zerocopy],enable_zerocopy=$enable_zerocopy_temp, enable_zerocopy="")
AC_ARG_ENABLE(affinity, [ --enable-affinity enable process/irq affinity],enable_affinity="-DCPU_AFFINITY=1", enable_affinity=$enable_affinity_temp)
#####################################
-/* ../include/config.h.in. Generated automatically from configure.in by autoheader. */
+/* portals/include/config.h.in. Generated from configure.in by autoheader. */
-/* Define if you have the readline library (-lreadline). */
-#undef HAVE_LIBREADLINE
+/* 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
-
#ifdef __KERNEL__
# include <linux/sched.h> /* THREAD_SIZE */
-
-#ifdef __ia64__
-#define CDEBUG_STACK ((unsigned long)__builtin_dwarf_cfa()&(THREAD_SIZE - 1))
#else
-#define CDEBUG_STACK (THREAD_SIZE - \
+# define THREAD_SIZE 8192
+#endif
+
+#ifdef __KERNEL__
+
+# ifdef __ia64__
+# define CDEBUG_STACK (THREAD_SIZE - \
+ ((unsigned long)__builtin_dwarf_cfa() & \
+ (THREAD_SIZE - 1)))
+# else
+# define CDEBUG_STACK (THREAD_SIZE - \
((unsigned long)__builtin_frame_address(0) & \
(THREAD_SIZE - 1)))
-#endif
+# endif
#define CHECK_STACK(stack) \
do { \
/*panic("LBUG");*/ \
} \
} while (0)
-#else
-#define CHECK_STACK(stack) do{}while(0)
+#else /* __KERNEL__ */
+#define CHECK_STACK(stack) do { } while(0)
#define CDEBUG_STACK (0L)
-#endif
+#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,
- const char *func, const 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
#define PORTAL_ALLOC(ptr, size) \
do { \
- long s = size; \
LASSERT (!in_interrupt()); \
- if (s > PORTAL_VMALLOC_SIZE) \
- (ptr) = vmalloc(s); \
+ if ((size) > PORTAL_VMALLOC_SIZE) \
+ (ptr) = vmalloc(size); \
else \
- (ptr) = kmalloc(s, GFP_KERNEL); \
+ (ptr) = kmalloc((size), GFP_NOFS); \
if ((ptr) == NULL) \
- CERROR("PORTALS: out of memory at %s:%d (tried to alloc" \
- " '" #ptr "' = %ld)\n", __FILE__, __LINE__, s); \
+ CERROR("PORTALS: out of memory at %s:%d (tried to alloc '"\
+ #ptr "' = %d)\n", __FILE__, __LINE__, (int)(size));\
else { \
- portal_kmem_inc((ptr), s); \
- memset((ptr), 0, s); \
+ portal_kmem_inc((ptr), (size)); \
+ memset((ptr), 0, (size)); \
} \
- CDEBUG(D_MALLOC, "kmalloced '" #ptr "': %ld at %p (tot %d).\n", \
- s, (ptr), atomic_read (&portal_kmemory)); \
+ CDEBUG(D_MALLOC, "kmalloced '" #ptr "': %d at %p (tot %d).\n", \
+ (int)(size), (ptr), atomic_read (&portal_kmemory)); \
} while (0)
#define PORTAL_FREE(ptr, size) \
do { \
- long s = (size); \
+ int s = (size); \
if ((ptr) == NULL) { \
- CERROR("PORTALS: free NULL '" #ptr "' (%ld bytes) at " \
+ CERROR("PORTALS: free NULL '" #ptr "' (%d bytes) at " \
"%s:%d\n", s, __FILE__, __LINE__); \
break; \
} \
else \
kfree(ptr); \
portal_kmem_dec((ptr), s); \
- CDEBUG(D_MALLOC, "kfreed '" #ptr "': %ld at %p (tot %d).\n", \
- s, (ptr), atomic_read (&portal_kmemory)); \
+ CDEBUG(D_MALLOC, "kfreed '" #ptr "': %d at %p (tot %d).\n", \
+ s, (ptr), atomic_read(&portal_kmemory)); \
} while (0)
#define PORTAL_SLAB_ALLOC(ptr, slab, size) \
do { \
- long s = (size); \
- LASSERT (!in_interrupt()); \
+ LASSERT(!in_interrupt()); \
(ptr) = kmem_cache_alloc((slab), SLAB_KERNEL); \
if ((ptr) == NULL) { \
CERROR("PORTALS: out of memory at %s:%d (tried to alloc" \
" '" #ptr "' from slab '" #slab "')\n", __FILE__, \
__LINE__); \
} else { \
- portal_kmem_inc((ptr), s); \
- memset((ptr), 0, s); \
+ portal_kmem_inc((ptr), (size)); \
+ memset((ptr), 0, (size)); \
} \
CDEBUG(D_MALLOC, "kmalloced '" #ptr "': %ld at %p (tot %d).\n", \
- s, (ptr), atomic_read (&portal_kmemory)); \
+ (int)(size), (ptr), atomic_read(&portal_kmemory)); \
} while (0)
#define PORTAL_SLAB_FREE(ptr, slab, size) \
do { \
- long s = (size); \
+ int s = (size); \
if ((ptr) == NULL) { \
- CERROR("PORTALS: free NULL '" #ptr "' (%ld bytes) at " \
+ CERROR("PORTALS: free NULL '" #ptr "' (%d bytes) at " \
"%s:%d\n", s, __FILE__, __LINE__); \
break; \
} \
memset((ptr), 0x5a, s); \
kmem_cache_free((slab), ptr); \
portal_kmem_dec((ptr), s); \
- CDEBUG(D_MALLOC, "kfreed '" #ptr "': %ld at %p (tot %d).\n", \
+ CDEBUG(D_MALLOC, "kfreed '" #ptr "': %d at %p (tot %d).\n", \
s, (ptr), atomic_read (&portal_kmemory)); \
} while (0)
}
static inline void
-kpr_fwd_init (kpr_fwd_desc_t *fwd, ptl_nid_t nid,
- int nob, int niov, struct iovec *iov,
+kpr_fwd_init (kpr_fwd_desc_t *fwd, ptl_nid_t nid,
+ int nob, int niov, struct iovec *iov,
kpr_fwd_callback_t callback, void *callback_arg)
{
fwd->kprfd_target_nid = nid;
# warning printf has been defined as a macro...
# undef printf
#endif
-void portals_debug_msg(int subsys, int mask, char *file, const char *fn,
- const int line, unsigned long stack, 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, const char *fn,
# ifdef PORTAL_DEBUG
# undef NDEBUG
# include <assert.h>
-# define LASSERT(e) assert(e)
+# define LASSERT(e) assert(e)
# else
# define LASSERT(e)
# endif
getpid() , stack, ## a);
#endif
+#ifndef CURRENT_TIME
+# define CURRENT_TIME time(0)
+#endif
+
#include <linux/portals_lib.h>
/*
#ifndef BITS_PER_LONG
#if (~0UL) == 0xffffffffUL
#define BITS_PER_LONG 32
-#else
+#else
#define BITS_PER_LONG 64
#endif
#endif
-/*
-*/
#ifndef _P30_INTERNAL_H_
#define _P30_INTERNAL_H_
lib_eq_alloc (nal_cb_t *nal)
{
/* NEVER called with statelock held */
- lib_eq_t *eq = kmem_cache_alloc(ptl_eq_slab, GFP_KERNEL);
-
+ lib_eq_t *eq = kmem_cache_alloc(ptl_eq_slab, GFP_NOFS);
+
if (eq == NULL)
return (NULL);
-
+
atomic_inc (&eq_in_use_count);
return (eq);
}
-static inline void
+static inline void
lib_eq_free (nal_cb_t *nal, lib_eq_t *eq)
{
/* ALWAYS called with statelock held */
atomic_dec (&eq_in_use_count);
- kmem_cache_free(ptl_eq_slab, eq);
+ kmem_cache_free(ptl_eq_slab, eq);
}
static inline lib_md_t *
lib_md_alloc (nal_cb_t *nal)
{
/* NEVER called with statelock held */
- lib_md_t *md = kmem_cache_alloc(ptl_md_slab, GFP_KERNEL);
+ lib_md_t *md = kmem_cache_alloc(ptl_md_slab, GFP_NOFS);
if (md == NULL)
return (NULL);
lib_me_alloc (nal_cb_t *nal)
{
/* NEVER called with statelock held */
- lib_me_t *me = kmem_cache_alloc(ptl_me_slab, GFP_KERNEL);
+ lib_me_t *me = kmem_cache_alloc(ptl_me_slab, GFP_NOFS);
if (me == NULL)
return (NULL);
-
+
atomic_inc (&me_in_use_count);
return (me);
}
lib_eq_alloc (nal_cb_t *nal)
{
/* NEVER called with statelock held */
- lib_eq_t *eq = kmem_cache_alloc(ptl_eq_slab, GFP_KERNEL);
-
+ lib_eq_t *eq = kmem_cache_alloc(ptl_eq_slab, GFP_NOFS);
+
if (eq == NULL)
return (NULL);
-
+
atomic_inc (&eq_in_use_count);
return (eq);
}
-static inline void
+static inline void
lib_eq_free (nal_cb_t *nal, lib_eq_t *eq)
{
/* ALWAYS called with statelock held */
atomic_dec (&eq_in_use_count);
- kmem_cache_free(ptl_eq_slab, eq);
+ kmem_cache_free(ptl_eq_slab, eq);
}
static inline lib_md_t *
lib_md_alloc (nal_cb_t *nal)
{
/* NEVER called with statelock held */
- lib_md_t *md = kmem_cache_alloc(ptl_md_slab, GFP_KERNEL);
+ lib_md_t *md = kmem_cache_alloc(ptl_md_slab, GFP_NOFS);
if (md == NULL)
return (NULL);
lib_me_alloc (nal_cb_t *nal)
{
/* NEVER called with statelock held */
- lib_me_t *me = kmem_cache_alloc(ptl_me_slab, GFP_KERNEL);
+ lib_me_t *me = kmem_cache_alloc(ptl_me_slab, GFP_NOFS);
if (me == NULL)
return (NULL);
-
+
atomic_inc (&me_in_use_count);
return (me);
}
#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.
int jt_ptl_disconnect(int argc, char **argv);
int jt_ptl_push_connection(int argc, char **argv);
int jt_ptl_ping(int argc, char **argv);
+int jt_ptl_shownid(int argc, char **argv);
int jt_ptl_mynid(int argc, char **argv);
int jt_ptl_add_uuid(int argc, char **argv);
int jt_ptl_add_uuid_old(int argc, char **argv); /* backwards compatibility */
-/*
-*/
-
#ifndef MYRNAL_H
#define MYRNAL_H
-/*
-*/
#ifndef _NAL_H_
#define _NAL_H_
-/*
- */
-
#ifndef _INCppidh_
#define _INCppidh_
int jt_ptl_disconnect(int argc, char **argv);
int jt_ptl_push_connection(int argc, char **argv);
int jt_ptl_ping(int argc, char **argv);
+int jt_ptl_shownid(int argc, char **argv);
int jt_ptl_mynid(int argc, char **argv);
int jt_ptl_add_uuid(int argc, char **argv);
int jt_ptl_add_uuid_old(int argc, char **argv); /* backwards compatibility */
/*
-*/
-/*
* stringtab.h
*/
kqswnal_init(int interface, ptl_pt_index_t ptl_size, ptl_ac_index_t ac_size,
ptl_pid_t requested_pid)
{
- ptl_nid_t mynid = ep_nodeid (kqswnal_data.kqn_epdev);
- int nnids = ep_numnodes (kqswnal_data.kqn_epdev);
+ ptl_nid_t mynid = kqswnal_elanid2nid (kqswnal_data.kqn_elanid);
+ int nnids = kqswnal_data.kqn_nnodes;
- CDEBUG(D_NET, "calling lib_init with nid "LPX64" of %d\n", mynid,nnids);
+ CDEBUG(D_NET, "calling lib_init with nid "LPX64" of %d\n", mynid, nnids);
lib_init(&kqswnal_lib, mynid, 0, nnids, ptl_size, ac_size);
return (&kqswnal_api);
}
-void /*__exit*/
+int
+kqswnal_cmd (struct portal_ioctl_data *data, void *private)
+{
+ LASSERT (data != NULL);
+
+ switch (data->ioc_nal_cmd) {
+ case NAL_CMD_REGISTER_MYNID:
+ CDEBUG (D_IOCTL, "setting NID offset to "LPX64" (was "LPX64")\n",
+ data->ioc_nid - kqswnal_data.kqn_elanid,
+ kqswnal_data.kqn_nid_offset);
+ kqswnal_data.kqn_nid_offset =
+ data->ioc_nid - kqswnal_data.kqn_elanid;
+ kqswnal_lib.ni.nid = data->ioc_nid;
+ return (0);
+
+ default:
+ return (-EINVAL);
+ }
+}
+
+void __exit
kqswnal_finalise (void)
{
switch (kqswnal_data.kqn_init)
return (-ENOMEM);
}
+ kqswnal_data.kqn_nid_offset = 0;
+ kqswnal_data.kqn_nnodes = ep_numnodes (kqswnal_data.kqn_epdev);
+ kqswnal_data.kqn_elanid = ep_nodeid (kqswnal_data.kqn_epdev);
+
/**********************************************************************/
/* Get the transmitter */
LASSERT (krx->krx_npages > 0);
for (j = 0; j < krx->krx_npages; j++)
{
- krx->krx_pages[j] = alloc_page (GFP_KERNEL);
+ krx->krx_pages[j] = alloc_page(GFP_KERNEL);
if (krx->krx_pages[j] == NULL)
{
kqswnal_finalise ();
rc = kpr_register (&kqswnal_data.kqn_router, &kqswnal_router_interface);
CDEBUG(D_NET, "Can't initialise routing interface (rc = %d): not routing\n",rc);
+ rc = kportal_nal_register (QSWNAL, &kqswnal_cmd, NULL);
+ if (rc != 0) {
+ CERROR ("Can't initialise command interface (rc = %d)\n", rc);
+ kqswnal_finalise ();
+ return (rc);
+ }
+
PORTAL_SYMBOL_REGISTER(kqswnal_ni);
kqswnal_data.kqn_init = KQN_INIT_ALL;
printk(KERN_INFO "Routing QSW NAL loaded on node %d of %d "
"(Routing %s, initial mem %d)\n",
- ep_nodeid (kqswnal_data.kqn_epdev),
- ep_numnodes (kqswnal_data.kqn_epdev),
+ kqswnal_data.kqn_elanid, kqswnal_data.kqn_nnodes,
kpr_routing (&kqswnal_data.kqn_router) ? "enabled" : "disabled",
pkmem);
#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 */
ELAN3_DMA_HANDLE *kqn_eptxdmahandle; /* elan reserved tx vaddrs */
ELAN3_DMA_HANDLE *kqn_eprxdmahandle; /* elan reserved rx vaddrs */
kpr_router_t kqn_router; /* connection to Kernel Portals Router module */
+
+ ptl_nid_t kqn_nid_offset; /* this cluster's NID offset */
+ int kqn_nnodes; /* this cluster's size */
+ int kqn_elanid; /* this nodes's elan ID */
} kqswnal_data_t;
/* kqn_init state */
extern int kqswnal_scheduler (void *);
extern void kqswnal_fwd_packet (void *arg, kpr_fwd_desc_t *fwd);
+static inline ptl_nid_t
+kqswnal_elanid2nid (int elanid)
+{
+ return (kqswnal_data.kqn_nid_offset + elanid);
+}
+
+static inline int
+kqswnal_nid2elanid (ptl_nid_t nid)
+{
+ /* not in this cluster? */
+ if (nid < kqswnal_data.kqn_nid_offset ||
+ nid >= kqswnal_data.kqn_nid_offset + kqswnal_data.kqn_nnodes)
+ return (-1);
+
+ return (nid - kqswnal_data.kqn_nid_offset);
+}
+
static inline void
kqswnal_requeue_rx (kqswnal_rx_t *krx)
{
static int
kqswnal_dist(nal_cb_t *nal, ptl_nid_t nid, unsigned long *dist)
{
- /* network distance doesn't mean much for this nal */
- *dist = (nid == nal->ni.nid) ? 0 : 1;
+ if (nid == nal->ni.nid)
+ *dist = 0; /* it's me */
+ else if (kqswnal_nid2elanid (nid) >= 0)
+ *dist = 1; /* it's my peer */
+ else
+ *dist = 2; /* via router */
return (0);
}
-int
-kqswnal_ispeer (ptl_nid_t nid)
-{
- unsigned int elanid = (unsigned int)nid;
-
- /* didn't lose high bits on conversion and it's in this machine? */
- return ((ptl_nid_t)elanid == nid &&
- elanid < ep_numnodes (kqswnal_data.kqn_epdev));
-}
-
void
kqswnal_unmap_tx (kqswnal_tx_t *ktx)
{
{
/* Don't block for transmit descriptor if we're in interrupt context */
int attr = in_interrupt() ? (EP_NO_SLEEP | EP_NO_ALLOC) : 0;
- int rc = ep_transmit_large(kqswnal_data.kqn_eptx, ktx->ktx_nid,
- ktx->ktx_port, attr, kqswnal_txhandler,
- ktx, ktx->ktx_iov, ktx->ktx_niov);
+ int dest = kqswnal_nid2elanid (ktx->ktx_nid);
long flags;
-
+ int rc;
+
+ LASSERT (dest >= 0); /* must be a peer */
+ rc = ep_transmit_large(kqswnal_data.kqn_eptx, dest,
+ ktx->ktx_port, attr, kqswnal_txhandler,
+ ktx, ktx->ktx_iov, ktx->ktx_niov);
if (rc == 0)
atomic_inc (&kqswnal_packets_launched);
return (-1);
}
- if (!kqswnal_ispeer (nid)) { /* Can't send direct: find gateway? */
+ if (kqswnal_nid2elanid (nid) < 0) { /* Can't send direct: find gateway? */
rc = kpr_lookup (&kqswnal_data.kqn_router, nid, &gatewaynid);
if (rc != 0) {
CERROR("Can't route to "LPX64": router error %d\n",
lib_finalize (&kqswnal_lib, private, cookie);
return (-1);
}
- if (!kqswnal_ispeer (gatewaynid)) {
+ if (kqswnal_nid2elanid (gatewaynid) < 0) {
CERROR("Bad gateway "LPX64" for "LPX64"\n",
gatewaynid, nid);
lib_finalize (&kqswnal_lib, private, cookie);
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 */
if (nid == kqswnal_lib.ni.nid) /* gateway is me */
nid = fwd->kprfd_target_nid; /* target is final dest */
- if (!kqswnal_ispeer (nid)) {
+ if (kqswnal_nid2elanid (nid) < 0) {
CERROR("Can't forward [%p] to "LPX64": not a peer\n", fwd, nid);
rc = -EHOSTUNREACH;
goto failed;
CERROR ("checksums for forwarded packets not implemented\n");
LBUG ();
#endif
- if (kqswnal_ispeer (dest_nid)) /* should have gone direct to peer */
+ if (kqswnal_nid2elanid (dest_nid) >= 0) /* should have gone direct to peer */
{
CERROR("dropping packet from "LPX64" for "LPX64
": target is peer\n", NTOH__u64(hdr->src_nid), dest_nid);
ksocknal_init(int interface, ptl_pt_index_t ptl_size,
ptl_ac_index_t ac_size, ptl_pid_t requested_pid)
{
- CDEBUG(D_NET, "calling lib_init with nid "LPX64"\n",
- ksocknal_data.ksnd_mynid);
- lib_init(&ksocknal_lib, ksocknal_data.ksnd_mynid, 0, 10, ptl_size,
- ac_size);
+ CDEBUG(D_NET, "calling lib_init with nid "LPX64"\n", (ptl_nid_t)0);
+ lib_init(&ksocknal_lib, (ptl_nid_t)0, 0, 10, ptl_size, ac_size);
return (&ksocknal_api);
}
CDEBUG(D_IOCTL, "setting mynid to "LPX64" (old nid="LPX64")\n",
nid, ni->nid);
- ksocknal_data.ksnd_mynid = nid;
ni->nid = nid;
return (0);
}
if (!conn)
GOTO(error, ret);
- memset (conn, 0, sizeof (conn)); /* zero for consistency */
+#warning ZAB: fix me for 2.5 sock->sk->allocation = GFP_NOFS; /* don't call info fs for alloc */
conn->ksnc_file = file;
conn->ksnc_sock = sock;
LASSERT (fmb->fmb_npages > 0);
for (j = 0; j < fmb->fmb_npages; j++) {
- fmb->fmb_pages[j] = alloc_page (GFP_KERNEL);
+ fmb->fmb_pages[j] = alloc_page(GFP_KERNEL);
if (fmb->fmb_pages[j] == NULL) {
ksocknal_module_fini ();
struct list_head ksnd_socklist; /* all my connections */
rwlock_t ksnd_socklist_lock; /* stabilise add/find/remove */
- ptl_nid_t ksnd_mynid;
nal_cb_t *ksnd_nal_cb;
spinlock_t ksnd_nal_cb_lock; /* lib cli/sti lock */
LASSERT (fmb->fmb_npages > 0);
for (j = 0; j < fmb->fmb_npages; j++)
{
- fmb->fmb_pages[j] = alloc_page (GFP_KERNEL);
+ fmb->fmb_pages[j] = alloc_page(GFP_KERNEL);
if (fmb->fmb_pages[j] == NULL)
{
* packet as a side-effect of another packet, such as when an ACK has
* been requested. -phil */
- CDEBUG(D_NET, "sending "LPSZ" bytes from [%d](%p,%d)... to nid: "LPX64" pid %d\n",
- payload_len, payload_niov,
+ CDEBUG(D_NET, "sending %d bytes from [%d](%p,%d)... to nid: "
+ LPX64" pid %d\n", (int)payload_len, payload_niov,
payload_niov > 0 ? payload_iov[0].iov_base : NULL,
- payload_niov > 0 ? payload_iov[0].iov_len : 0,
- nid, pid);
+ (int)(payload_niov > 0 ? payload_iov[0].iov_len : 0), nid, pid);
if ((conn = ktoenal_get_conn (nid)) == NULL)
{
/* FIXME: I'm not very smart; someone smarter should make this better. */
void
-portals_debug_msg (int subsys, int mask, char *file, const char *fn,
- const int line, unsigned long stack, 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;
argv[0] = portals_upcall;
argv[1] = "LBUG";
argv[2] = file;
- argv[3] = (char *)fn;
+ argv[3] = fn;
argv[4] = buf;
argv[5] = NULL;
#include <portals/lib-p30.h>
#include <portals/p30.h>
#include <linux/kp30.h>
+#include <linux/portals_compat25.h>
#include <linux/kernel_compat.h>
#define PORTAL_MINOR 240
struct semaphore nal_cmd_sem;
#ifdef PORTAL_DEBUG
-void kportal_assertion_failed(char *expr, char *file, const char *func,
+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,
return (-EINVAL);
err = PtlFailNid (*nip, data->ioc_nid, data->ioc_count);
+ kportal_put_ni (data->ioc_nal);
break;
}
LASSERT (nob == lib_iov_nob (fwd->kprfd_niov, fwd->kprfd_iov));
atomic_inc (&kpr_queue_depth);
+ atomic_inc (&src_ne->kpne_refcount); /* source nal is busy until fwd completes */
kpr_fwd_packets++; /* (loose) stats accounting */
kpr_fwd_bytes += nob;
- if (src_ne->kpne_shutdown) /* caller is shutting down */
+ if (src_ne->kpne_shutdown) /* caller is shutting down */
goto out;
- fwd->kprfd_router_arg = src_ne; /* stash caller's nal entry */
- atomic_inc (&src_ne->kpne_refcount); /* source nal is busy until fwd completes */
+ fwd->kprfd_router_arg = src_ne; /* stash caller's nal entry */
read_lock (&kpr_rwlock);
return(1);
}
-static int connection_input(connection c)
+static int connection_input(void *d)
{
- return((*c->m->handler)(c->m->handler_arg,c));
+ connection c = d;
+ return((*c->m->handler)(c->m->handler_arg,c));
}
* zero if the fixed port could not be bound
*/
manager init_connections(unsigned short pid,
- int (*input)(),
+ int (*input)(void *, void *),
void *a)
{
manager m=(manager)malloc(sizeof(struct manager));
manager m;
} *connection;
-connection force_tcp_connection(manager m,
- unsigned int ip,
- unsigned int short);
-manager init_connections(unsigned short,
- int (*f)(void *,connection),
- void *);
+connection force_tcp_connection(manager m, unsigned int ip, unsigned int short);
+manager init_connections(unsigned short, int (*f)(void *, void *), void *);
void remove_connection(void *arg);
void shutdown_connections(manager m);
-int read_connection(connection c,
- unsigned char *dest,
- int len);
+int read_connection(connection c, unsigned char *dest, int len);
return(1);
}
-static int connection_input(connection c)
+static int connection_input(void *d)
{
- return((*c->m->handler)(c->m->handler_arg,c));
+ connection c = d;
+ return((*c->m->handler)(c->m->handler_arg,c));
}
* zero if the fixed port could not be bound
*/
manager init_connections(unsigned short pid,
- int (*input)(),
+ int (*input)(void *, void *),
void *a)
{
manager m=(manager)malloc(sizeof(struct manager));
manager m;
} *connection;
-connection force_tcp_connection(manager m,
- unsigned int ip,
- unsigned int short);
-manager init_connections(unsigned short,
- int (*f)(void *,connection),
- void *);
+connection force_tcp_connection(manager m, unsigned int ip, unsigned int short);
+manager init_connections(unsigned short, int (*f)(void *, void *), void *);
void remove_connection(void *arg);
void shutdown_connections(manager m);
-int read_connection(connection c,
- unsigned char *dest,
- int len);
+int read_connection(connection c, unsigned char *dest, int len);
* available. It attempts to read the portals header and
* pass it to the generic library for processing.
*/
-static int from_connection(void *a,connection c)
+static int from_connection(void *a, void *d)
{
- bridge b=a;
- ptl_hdr_t hdr;
- if (read_connection(c, (unsigned char *)&hdr, sizeof(hdr))){
- lib_parse(b->nal_cb, &hdr, c);
- return(1);
- }
- return(0);
+ connection c = d;
+ bridge b=a;
+ ptl_hdr_t hdr;
+
+ if (read_connection(c, (unsigned char *)&hdr, sizeof(hdr))){
+ lib_parse(b->nal_cb, &hdr, c);
+ return(1);
+ }
+ return(0);
}
* available. It attempts to read the portals header and
* pass it to the generic library for processing.
*/
-static int from_connection(void *a,connection c)
+static int from_connection(void *a, void *d)
{
- bridge b=a;
- ptl_hdr_t hdr;
- if (read_connection(c, (unsigned char *)&hdr, sizeof(hdr))){
- lib_parse(b->nal_cb, &hdr, c);
- return(1);
- }
- return(0);
+ connection c = d;
+ bridge b=a;
+ ptl_hdr_t hdr;
+
+ if (read_connection(c, (unsigned char *)&hdr, sizeof(hdr))){
+ lib_parse(b->nal_cb, &hdr, c);
+ return(1);
+ }
+ return(0);
}
return ((e == NULL) ? "???" : e->name);
}
-static int
-nid2nal (ptl_nid_t nid)
-{
- /* BIG pragmatic assumption */
- return ((((__u32)nid) & 0xffff0000) != 0 ? SOCKNAL : QSWNAL);
-}
-
int
ptl_parse_nid (ptl_nid_t *nidp, char *str)
{
char *
ptl_nid2str (char *buffer, ptl_nid_t nid)
{
- switch (nid2nal(nid))
- {
- case QSWNAL:
- sprintf (buffer, LPD64, nid);
- return (buffer);
+ __u32 addr = htonl((__u32)nid); /* back to NETWORK byte order */
+ struct hostent *he = gethostbyaddr ((const char *)&addr, sizeof (addr), AF_INET);
- case SCIMACNAL:
- sprintf (buffer, LPX64, nid);
- return (buffer);
-
- case SOCKNAL: {
- __u32 addr = htonl((__u32)nid); /* back to NETWORK byte order */
- struct hostent *he = gethostbyaddr ((const char *)&addr, sizeof (addr), AF_INET);
-
- if (he != NULL)
- strcpy (buffer, he->h_name);
- else
- {
- addr = (__u32)nid;
- sprintf (buffer, "%d.%d.%d.%d",
- (addr>>24)&0xff, (addr>>16)&0xff, (addr>>8)&0xff, addr&0xff);
- }
- return (buffer);
- }
+ if (he != NULL)
+ strcpy (buffer, he->h_name);
+ else
+ sprintf (buffer, "0x"LPX64, nid);
- default:
- sprintf (buffer, "nid2nal broken");
- return (buffer);
- }
+ return (buffer);
}
int
return 0;
}
+int jt_ptl_shownid(int argc, char **argv)
+{
+ struct portal_ioctl_data data;
+ int rc;
+
+ if (argc > 1) {
+ fprintf(stderr, "usage: %s\n", argv[0]);
+ return 0;
+ }
+
+ if (g_nal == 0) {
+ fprintf(stderr, "Error: you must run the 'network' command first\n");
+ return -1;
+ }
+
+ PORTAL_IOC_INIT (data);
+ data.ioc_nal = g_nal;
+ rc = l_ioctl(PORTALS_DEV_ID, IOC_PORTAL_GET_NID, &data);
+ if (rc < 0)
+ fprintf(stderr, "getting my NID failed: %s\n",
+ strerror (errno));
+ else
+ printf(LPX64"\n", data.ioc_nid);
+ return 0;
+}
+
int jt_ptl_mynid(int argc, char **argv)
{
int rc;
- struct hostent *h;
- char buf[1024], *hostname;
+ char hostname[1024];
+ char *nidstr;
struct portal_ioctl_data data;
ptl_nid_t mynid;
if (argc > 2) {
- fprintf(stderr, "usage: %s [hostname]\n", argv[0]);
- fprintf(stderr, "hostname defaults to the hostname of the "
- "machine.\n");
+ fprintf(stderr, "usage: %s [NID]\n", argv[0]);
+ fprintf(stderr, "NID defaults to the primary IP address of the machine.\n");
return 0;
}
return -1;
}
- if (g_nal == QSWNAL) {
- fprintf(stderr, "'mynid' doesn't make any sense for elan.\n");
- return -1;
- } else if (g_nal == GMNAL) {
- fprintf(stderr, "'mynid' doesn't make any sense for GM.\n");
- return -1;
- } else if (g_nal == SCIMACNAL) {
- fprintf(stderr, "'mynid' doesn't make any sense for SCI.\n");
- return -1;
- }
-
- if (g_nal != SOCKNAL && g_nal != TOENAL) {
- fprintf(stderr, "This should never happen. Also it is very "
- "bad.\n");
+ if (argc >= 2)
+ nidstr = argv[1];
+ else if (gethostname(hostname, sizeof(hostname)) != 0) {
+ fprintf(stderr, "gethostname failed: %s\n",
+ strerror(errno));
return -1;
}
+ else
+ nidstr = hostname;
- if (argc == 1) {
- if (gethostname(buf, sizeof(buf)) != 0) {
- fprintf(stderr, "gethostname failed: %s\n",
- strerror(errno));
- return -1;
- }
- hostname = buf;
- } else {
- hostname = argv[1];
- }
-
- h = gethostbyname(hostname);
-
- if (!h) {
- fprintf(stderr, "cannot get address for host '%s': %d\n",
- hostname, h_errno);
+ rc = ptl_parse_nid (&mynid, nidstr);
+ if (rc != 0) {
+ fprintf (stderr, "Can't convert '%s' into a NID\n", nidstr);
return -1;
}
- mynid = (ptl_nid_t)ntohl (*(__u32 *)h->h_addr); /* HOST byte order */
PORTAL_IOC_INIT(data);
data.ioc_nid = mynid;
rc = l_ioctl(PORTALS_DEV_ID, IOC_PORTAL_NAL_CMD, &data);
if (rc < 0)
- fprintf(stderr, "IOC_PORTAL_REGISTER_MYNID failed: %s\n",
+ fprintf(stderr, "setting my NID failed: %s\n",
strerror(errno));
else
printf("registered my nid "LPX64" (%s)\n", mynid, hostname);
ptl_nid_t nid1;
ptl_nid_t nid2;
ptl_nid_t gateway_nid;
- int gateway_nal;
int rc;
if (argc < 3)
return (0);
}
+ if (g_nal == 0) {
+ fprintf(stderr, "Error: you must run the 'network' command "
+ "first.\n");
+ return (-1);
+ }
+
if (ptl_parse_nid (&gateway_nid, argv[1]) != 0)
{
fprintf (stderr, "Can't parse gateway NID \"%s\"\n", argv[1]);
return (-1);
}
- gateway_nal = nid2nal (gateway_nid);
-
if (ptl_parse_nid (&nid1, argv[2]) != 0)
{
fprintf (stderr, "Can't parse first target NID \"%s\"\n", argv[2]);
PORTAL_IOC_INIT(data);
data.ioc_nid = gateway_nid;
- data.ioc_nal = gateway_nal;
+ data.ioc_nal = g_nal;
data.ioc_nid2 = MIN (nid1, nid2);
data.ioc_nid3 = MAX (nid1, nid2);
{"disconnect", jt_ptl_disconnect, 0, "disconnect from a remote nid (args: [hostname]"},
{"push", jt_ptl_push_connection, 0, "flush connection to a remote nid (args: [hostname]"},
{"ping", jt_ptl_ping, 0, "do a ping test (args: nid [count] [size] [timeout])"},
+ {"shownid", jt_ptl_shownid, 0, "print the local NID"},
{"mynid", jt_ptl_mynid, 0, "inform the socknal of the local NID (args: [hostname])"},
{"add_route", jt_ptl_add_route, 0, "add an entry to the routing table (args: gatewayNID targetNID [targetNID])"},
{"del_route", jt_ptl_del_route, 0, "delete an entry from the routing table (args: targetNID"},
ia64 )
AC_MSG_RESULT($host_cpu)
- KCFLAGS='-gstabs -O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -pipe -ffixed-r13 -mfixed-range=f10-f15,f32-f127 -falign-functions=32 -mb-step'
+ KCFLAGS='-g -O2 -Wall -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -pipe -ffixed-r13 -mfixed-range=f10-f15,f32-f127 -falign-functions=32 -mb-step'
KCPPFLAGS='-D__KERNEL__ -DMODULE'
MOD_LINK=elf64_ia64
;;
AC_MSG_RESULT(no)
fi
-AC_ARG_ENABLE(zerocopy, [ --enable-zerocopy enable socknal zerocopy],enable_zerocopy="-DSOCKNAL_ZC=1", enable_zercopy=$enable_zerocopy_temp)
+AC_ARG_ENABLE(zerocopy, [ --enable-zerocopy enable socknal zerocopy],enable_zerocopy=$enable_zerocopy_temp, enable_zerocopy="")
AC_ARG_ENABLE(affinity, [ --enable-affinity enable process/irq affinity],enable_affinity="-DCPU_AFFINITY=1", enable_affinity=$enable_affinity_temp)
#####################################
-/* ../include/config.h.in. Generated automatically from configure.in by autoheader. */
+/* portals/include/config.h.in. Generated from configure.in by autoheader. */
-/* Define if you have the readline library (-lreadline). */
-#undef HAVE_LIBREADLINE
+/* 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
-
#ifdef __KERNEL__
# include <linux/sched.h> /* THREAD_SIZE */
-
-#ifdef __ia64__
-#define CDEBUG_STACK ((unsigned long)__builtin_dwarf_cfa()&(THREAD_SIZE - 1))
#else
-#define CDEBUG_STACK (THREAD_SIZE - \
+# define THREAD_SIZE 8192
+#endif
+
+#ifdef __KERNEL__
+
+# ifdef __ia64__
+# define CDEBUG_STACK (THREAD_SIZE - \
+ ((unsigned long)__builtin_dwarf_cfa() & \
+ (THREAD_SIZE - 1)))
+# else
+# define CDEBUG_STACK (THREAD_SIZE - \
((unsigned long)__builtin_frame_address(0) & \
(THREAD_SIZE - 1)))
-#endif
+# endif
#define CHECK_STACK(stack) \
do { \
/*panic("LBUG");*/ \
} \
} while (0)
-#else
-#define CHECK_STACK(stack) do{}while(0)
+#else /* __KERNEL__ */
+#define CHECK_STACK(stack) do { } while(0)
#define CDEBUG_STACK (0L)
-#endif
+#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,
- const char *func, const 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
#define PORTAL_ALLOC(ptr, size) \
do { \
- long s = size; \
LASSERT (!in_interrupt()); \
- if (s > PORTAL_VMALLOC_SIZE) \
- (ptr) = vmalloc(s); \
+ if ((size) > PORTAL_VMALLOC_SIZE) \
+ (ptr) = vmalloc(size); \
else \
- (ptr) = kmalloc(s, GFP_KERNEL); \
+ (ptr) = kmalloc((size), GFP_NOFS); \
if ((ptr) == NULL) \
- CERROR("PORTALS: out of memory at %s:%d (tried to alloc" \
- " '" #ptr "' = %ld)\n", __FILE__, __LINE__, s); \
+ CERROR("PORTALS: out of memory at %s:%d (tried to alloc '"\
+ #ptr "' = %d)\n", __FILE__, __LINE__, (int)(size));\
else { \
- portal_kmem_inc((ptr), s); \
- memset((ptr), 0, s); \
+ portal_kmem_inc((ptr), (size)); \
+ memset((ptr), 0, (size)); \
} \
- CDEBUG(D_MALLOC, "kmalloced '" #ptr "': %ld at %p (tot %d).\n", \
- s, (ptr), atomic_read (&portal_kmemory)); \
+ CDEBUG(D_MALLOC, "kmalloced '" #ptr "': %d at %p (tot %d).\n", \
+ (int)(size), (ptr), atomic_read (&portal_kmemory)); \
} while (0)
#define PORTAL_FREE(ptr, size) \
do { \
- long s = (size); \
+ int s = (size); \
if ((ptr) == NULL) { \
- CERROR("PORTALS: free NULL '" #ptr "' (%ld bytes) at " \
+ CERROR("PORTALS: free NULL '" #ptr "' (%d bytes) at " \
"%s:%d\n", s, __FILE__, __LINE__); \
break; \
} \
else \
kfree(ptr); \
portal_kmem_dec((ptr), s); \
- CDEBUG(D_MALLOC, "kfreed '" #ptr "': %ld at %p (tot %d).\n", \
- s, (ptr), atomic_read (&portal_kmemory)); \
+ CDEBUG(D_MALLOC, "kfreed '" #ptr "': %d at %p (tot %d).\n", \
+ s, (ptr), atomic_read(&portal_kmemory)); \
} while (0)
#define PORTAL_SLAB_ALLOC(ptr, slab, size) \
do { \
- long s = (size); \
- LASSERT (!in_interrupt()); \
+ LASSERT(!in_interrupt()); \
(ptr) = kmem_cache_alloc((slab), SLAB_KERNEL); \
if ((ptr) == NULL) { \
CERROR("PORTALS: out of memory at %s:%d (tried to alloc" \
" '" #ptr "' from slab '" #slab "')\n", __FILE__, \
__LINE__); \
} else { \
- portal_kmem_inc((ptr), s); \
- memset((ptr), 0, s); \
+ portal_kmem_inc((ptr), (size)); \
+ memset((ptr), 0, (size)); \
} \
CDEBUG(D_MALLOC, "kmalloced '" #ptr "': %ld at %p (tot %d).\n", \
- s, (ptr), atomic_read (&portal_kmemory)); \
+ (int)(size), (ptr), atomic_read(&portal_kmemory)); \
} while (0)
#define PORTAL_SLAB_FREE(ptr, slab, size) \
do { \
- long s = (size); \
+ int s = (size); \
if ((ptr) == NULL) { \
- CERROR("PORTALS: free NULL '" #ptr "' (%ld bytes) at " \
+ CERROR("PORTALS: free NULL '" #ptr "' (%d bytes) at " \
"%s:%d\n", s, __FILE__, __LINE__); \
break; \
} \
memset((ptr), 0x5a, s); \
kmem_cache_free((slab), ptr); \
portal_kmem_dec((ptr), s); \
- CDEBUG(D_MALLOC, "kfreed '" #ptr "': %ld at %p (tot %d).\n", \
+ CDEBUG(D_MALLOC, "kfreed '" #ptr "': %d at %p (tot %d).\n", \
s, (ptr), atomic_read (&portal_kmemory)); \
} while (0)
}
static inline void
-kpr_fwd_init (kpr_fwd_desc_t *fwd, ptl_nid_t nid,
- int nob, int niov, struct iovec *iov,
+kpr_fwd_init (kpr_fwd_desc_t *fwd, ptl_nid_t nid,
+ int nob, int niov, struct iovec *iov,
kpr_fwd_callback_t callback, void *callback_arg)
{
fwd->kprfd_target_nid = nid;
# warning printf has been defined as a macro...
# undef printf
#endif
-void portals_debug_msg(int subsys, int mask, char *file, const char *fn,
- const int line, unsigned long stack, 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, const char *fn,
# ifdef PORTAL_DEBUG
# undef NDEBUG
# include <assert.h>
-# define LASSERT(e) assert(e)
+# define LASSERT(e) assert(e)
# else
# define LASSERT(e)
# endif
getpid() , stack, ## a);
#endif
+#ifndef CURRENT_TIME
+# define CURRENT_TIME time(0)
+#endif
+
#include <linux/portals_lib.h>
/*
#ifndef BITS_PER_LONG
#if (~0UL) == 0xffffffffUL
#define BITS_PER_LONG 32
-#else
+#else
#define BITS_PER_LONG 64
#endif
#endif
lib_eq_alloc (nal_cb_t *nal)
{
/* NEVER called with statelock held */
- lib_eq_t *eq = kmem_cache_alloc(ptl_eq_slab, GFP_KERNEL);
-
+ lib_eq_t *eq = kmem_cache_alloc(ptl_eq_slab, GFP_NOFS);
+
if (eq == NULL)
return (NULL);
-
+
atomic_inc (&eq_in_use_count);
return (eq);
}
-static inline void
+static inline void
lib_eq_free (nal_cb_t *nal, lib_eq_t *eq)
{
/* ALWAYS called with statelock held */
atomic_dec (&eq_in_use_count);
- kmem_cache_free(ptl_eq_slab, eq);
+ kmem_cache_free(ptl_eq_slab, eq);
}
static inline lib_md_t *
lib_md_alloc (nal_cb_t *nal)
{
/* NEVER called with statelock held */
- lib_md_t *md = kmem_cache_alloc(ptl_md_slab, GFP_KERNEL);
+ lib_md_t *md = kmem_cache_alloc(ptl_md_slab, GFP_NOFS);
if (md == NULL)
return (NULL);
lib_me_alloc (nal_cb_t *nal)
{
/* NEVER called with statelock held */
- lib_me_t *me = kmem_cache_alloc(ptl_me_slab, GFP_KERNEL);
+ lib_me_t *me = kmem_cache_alloc(ptl_me_slab, GFP_NOFS);
if (me == NULL)
return (NULL);
-
+
atomic_inc (&me_in_use_count);
return (me);
}
#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.
-/*
-*/
-
#ifndef MYRNAL_H
#define MYRNAL_H
-/*
-*/
#ifndef _NAL_H_
#define _NAL_H_
-/*
- */
-
#ifndef _INCppidh_
#define _INCppidh_
int jt_ptl_disconnect(int argc, char **argv);
int jt_ptl_push_connection(int argc, char **argv);
int jt_ptl_ping(int argc, char **argv);
+int jt_ptl_shownid(int argc, char **argv);
int jt_ptl_mynid(int argc, char **argv);
int jt_ptl_add_uuid(int argc, char **argv);
int jt_ptl_add_uuid_old(int argc, char **argv); /* backwards compatibility */
/*
-*/
-/*
* stringtab.h
*/
kqswnal_init(int interface, ptl_pt_index_t ptl_size, ptl_ac_index_t ac_size,
ptl_pid_t requested_pid)
{
- ptl_nid_t mynid = ep_nodeid (kqswnal_data.kqn_epdev);
- int nnids = ep_numnodes (kqswnal_data.kqn_epdev);
+ ptl_nid_t mynid = kqswnal_elanid2nid (kqswnal_data.kqn_elanid);
+ int nnids = kqswnal_data.kqn_nnodes;
- CDEBUG(D_NET, "calling lib_init with nid "LPX64" of %d\n", mynid,nnids);
+ CDEBUG(D_NET, "calling lib_init with nid "LPX64" of %d\n", mynid, nnids);
lib_init(&kqswnal_lib, mynid, 0, nnids, ptl_size, ac_size);
return (&kqswnal_api);
}
-void /*__exit*/
+int
+kqswnal_cmd (struct portal_ioctl_data *data, void *private)
+{
+ LASSERT (data != NULL);
+
+ switch (data->ioc_nal_cmd) {
+ case NAL_CMD_REGISTER_MYNID:
+ CDEBUG (D_IOCTL, "setting NID offset to "LPX64" (was "LPX64")\n",
+ data->ioc_nid - kqswnal_data.kqn_elanid,
+ kqswnal_data.kqn_nid_offset);
+ kqswnal_data.kqn_nid_offset =
+ data->ioc_nid - kqswnal_data.kqn_elanid;
+ kqswnal_lib.ni.nid = data->ioc_nid;
+ return (0);
+
+ default:
+ return (-EINVAL);
+ }
+}
+
+void __exit
kqswnal_finalise (void)
{
switch (kqswnal_data.kqn_init)
return (-ENOMEM);
}
+ kqswnal_data.kqn_nid_offset = 0;
+ kqswnal_data.kqn_nnodes = ep_numnodes (kqswnal_data.kqn_epdev);
+ kqswnal_data.kqn_elanid = ep_nodeid (kqswnal_data.kqn_epdev);
+
/**********************************************************************/
/* Get the transmitter */
LASSERT (krx->krx_npages > 0);
for (j = 0; j < krx->krx_npages; j++)
{
- krx->krx_pages[j] = alloc_page (GFP_KERNEL);
+ krx->krx_pages[j] = alloc_page(GFP_KERNEL);
if (krx->krx_pages[j] == NULL)
{
kqswnal_finalise ();
rc = kpr_register (&kqswnal_data.kqn_router, &kqswnal_router_interface);
CDEBUG(D_NET, "Can't initialise routing interface (rc = %d): not routing\n",rc);
+ rc = kportal_nal_register (QSWNAL, &kqswnal_cmd, NULL);
+ if (rc != 0) {
+ CERROR ("Can't initialise command interface (rc = %d)\n", rc);
+ kqswnal_finalise ();
+ return (rc);
+ }
+
PORTAL_SYMBOL_REGISTER(kqswnal_ni);
kqswnal_data.kqn_init = KQN_INIT_ALL;
printk(KERN_INFO "Routing QSW NAL loaded on node %d of %d "
"(Routing %s, initial mem %d)\n",
- ep_nodeid (kqswnal_data.kqn_epdev),
- ep_numnodes (kqswnal_data.kqn_epdev),
+ kqswnal_data.kqn_elanid, kqswnal_data.kqn_nnodes,
kpr_routing (&kqswnal_data.kqn_router) ? "enabled" : "disabled",
pkmem);
#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 */
ELAN3_DMA_HANDLE *kqn_eptxdmahandle; /* elan reserved tx vaddrs */
ELAN3_DMA_HANDLE *kqn_eprxdmahandle; /* elan reserved rx vaddrs */
kpr_router_t kqn_router; /* connection to Kernel Portals Router module */
+
+ ptl_nid_t kqn_nid_offset; /* this cluster's NID offset */
+ int kqn_nnodes; /* this cluster's size */
+ int kqn_elanid; /* this nodes's elan ID */
} kqswnal_data_t;
/* kqn_init state */
extern int kqswnal_scheduler (void *);
extern void kqswnal_fwd_packet (void *arg, kpr_fwd_desc_t *fwd);
+static inline ptl_nid_t
+kqswnal_elanid2nid (int elanid)
+{
+ return (kqswnal_data.kqn_nid_offset + elanid);
+}
+
+static inline int
+kqswnal_nid2elanid (ptl_nid_t nid)
+{
+ /* not in this cluster? */
+ if (nid < kqswnal_data.kqn_nid_offset ||
+ nid >= kqswnal_data.kqn_nid_offset + kqswnal_data.kqn_nnodes)
+ return (-1);
+
+ return (nid - kqswnal_data.kqn_nid_offset);
+}
+
static inline void
kqswnal_requeue_rx (kqswnal_rx_t *krx)
{
static int
kqswnal_dist(nal_cb_t *nal, ptl_nid_t nid, unsigned long *dist)
{
- /* network distance doesn't mean much for this nal */
- *dist = (nid == nal->ni.nid) ? 0 : 1;
+ if (nid == nal->ni.nid)
+ *dist = 0; /* it's me */
+ else if (kqswnal_nid2elanid (nid) >= 0)
+ *dist = 1; /* it's my peer */
+ else
+ *dist = 2; /* via router */
return (0);
}
-int
-kqswnal_ispeer (ptl_nid_t nid)
-{
- unsigned int elanid = (unsigned int)nid;
-
- /* didn't lose high bits on conversion and it's in this machine? */
- return ((ptl_nid_t)elanid == nid &&
- elanid < ep_numnodes (kqswnal_data.kqn_epdev));
-}
-
void
kqswnal_unmap_tx (kqswnal_tx_t *ktx)
{
{
/* Don't block for transmit descriptor if we're in interrupt context */
int attr = in_interrupt() ? (EP_NO_SLEEP | EP_NO_ALLOC) : 0;
- int rc = ep_transmit_large(kqswnal_data.kqn_eptx, ktx->ktx_nid,
- ktx->ktx_port, attr, kqswnal_txhandler,
- ktx, ktx->ktx_iov, ktx->ktx_niov);
+ int dest = kqswnal_nid2elanid (ktx->ktx_nid);
long flags;
-
+ int rc;
+
+ LASSERT (dest >= 0); /* must be a peer */
+ rc = ep_transmit_large(kqswnal_data.kqn_eptx, dest,
+ ktx->ktx_port, attr, kqswnal_txhandler,
+ ktx, ktx->ktx_iov, ktx->ktx_niov);
if (rc == 0)
atomic_inc (&kqswnal_packets_launched);
return (-1);
}
- if (!kqswnal_ispeer (nid)) { /* Can't send direct: find gateway? */
+ if (kqswnal_nid2elanid (nid) < 0) { /* Can't send direct: find gateway? */
rc = kpr_lookup (&kqswnal_data.kqn_router, nid, &gatewaynid);
if (rc != 0) {
CERROR("Can't route to "LPX64": router error %d\n",
lib_finalize (&kqswnal_lib, private, cookie);
return (-1);
}
- if (!kqswnal_ispeer (gatewaynid)) {
+ if (kqswnal_nid2elanid (gatewaynid) < 0) {
CERROR("Bad gateway "LPX64" for "LPX64"\n",
gatewaynid, nid);
lib_finalize (&kqswnal_lib, private, cookie);
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 */
if (nid == kqswnal_lib.ni.nid) /* gateway is me */
nid = fwd->kprfd_target_nid; /* target is final dest */
- if (!kqswnal_ispeer (nid)) {
+ if (kqswnal_nid2elanid (nid) < 0) {
CERROR("Can't forward [%p] to "LPX64": not a peer\n", fwd, nid);
rc = -EHOSTUNREACH;
goto failed;
CERROR ("checksums for forwarded packets not implemented\n");
LBUG ();
#endif
- if (kqswnal_ispeer (dest_nid)) /* should have gone direct to peer */
+ if (kqswnal_nid2elanid (dest_nid) >= 0) /* should have gone direct to peer */
{
CERROR("dropping packet from "LPX64" for "LPX64
": target is peer\n", NTOH__u64(hdr->src_nid), dest_nid);
ksocknal_init(int interface, ptl_pt_index_t ptl_size,
ptl_ac_index_t ac_size, ptl_pid_t requested_pid)
{
- CDEBUG(D_NET, "calling lib_init with nid "LPX64"\n",
- ksocknal_data.ksnd_mynid);
- lib_init(&ksocknal_lib, ksocknal_data.ksnd_mynid, 0, 10, ptl_size,
- ac_size);
+ CDEBUG(D_NET, "calling lib_init with nid "LPX64"\n", (ptl_nid_t)0);
+ lib_init(&ksocknal_lib, (ptl_nid_t)0, 0, 10, ptl_size, ac_size);
return (&ksocknal_api);
}
CDEBUG(D_IOCTL, "setting mynid to "LPX64" (old nid="LPX64")\n",
nid, ni->nid);
- ksocknal_data.ksnd_mynid = nid;
ni->nid = nid;
return (0);
}
if (!conn)
GOTO(error, ret);
- memset (conn, 0, sizeof (conn)); /* zero for consistency */
+#warning ZAB: fix me for 2.5 sock->sk->allocation = GFP_NOFS; /* don't call info fs for alloc */
conn->ksnc_file = file;
conn->ksnc_sock = sock;
LASSERT (fmb->fmb_npages > 0);
for (j = 0; j < fmb->fmb_npages; j++) {
- fmb->fmb_pages[j] = alloc_page (GFP_KERNEL);
+ fmb->fmb_pages[j] = alloc_page(GFP_KERNEL);
if (fmb->fmb_pages[j] == NULL) {
ksocknal_module_fini ();
struct list_head ksnd_socklist; /* all my connections */
rwlock_t ksnd_socklist_lock; /* stabilise add/find/remove */
- ptl_nid_t ksnd_mynid;
nal_cb_t *ksnd_nal_cb;
spinlock_t ksnd_nal_cb_lock; /* lib cli/sti lock */
LASSERT (fmb->fmb_npages > 0);
for (j = 0; j < fmb->fmb_npages; j++)
{
- fmb->fmb_pages[j] = alloc_page (GFP_KERNEL);
+ fmb->fmb_pages[j] = alloc_page(GFP_KERNEL);
if (fmb->fmb_pages[j] == NULL)
{
* packet as a side-effect of another packet, such as when an ACK has
* been requested. -phil */
- CDEBUG(D_NET, "sending "LPSZ" bytes from [%d](%p,%d)... to nid: "LPX64" pid %d\n",
- payload_len, payload_niov,
+ CDEBUG(D_NET, "sending %d bytes from [%d](%p,%d)... to nid: "
+ LPX64" pid %d\n", (int)payload_len, payload_niov,
payload_niov > 0 ? payload_iov[0].iov_base : NULL,
- payload_niov > 0 ? payload_iov[0].iov_len : 0,
- nid, pid);
+ (int)(payload_niov > 0 ? payload_iov[0].iov_len : 0), nid, pid);
if ((conn = ktoenal_get_conn (nid)) == NULL)
{
/* FIXME: I'm not very smart; someone smarter should make this better. */
void
-portals_debug_msg (int subsys, int mask, char *file, const char *fn,
- const int line, unsigned long stack, 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;
argv[0] = portals_upcall;
argv[1] = "LBUG";
argv[2] = file;
- argv[3] = (char *)fn;
+ argv[3] = fn;
argv[4] = buf;
argv[5] = NULL;
#include <portals/lib-p30.h>
#include <portals/p30.h>
#include <linux/kp30.h>
+#include <linux/portals_compat25.h>
#include <linux/kernel_compat.h>
#define PORTAL_MINOR 240
struct semaphore nal_cmd_sem;
#ifdef PORTAL_DEBUG
-void kportal_assertion_failed(char *expr, char *file, const char *func,
+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,
return (-EINVAL);
err = PtlFailNid (*nip, data->ioc_nid, data->ioc_count);
+ kportal_put_ni (data->ioc_nal);
break;
}
LASSERT (nob == lib_iov_nob (fwd->kprfd_niov, fwd->kprfd_iov));
atomic_inc (&kpr_queue_depth);
+ atomic_inc (&src_ne->kpne_refcount); /* source nal is busy until fwd completes */
kpr_fwd_packets++; /* (loose) stats accounting */
kpr_fwd_bytes += nob;
- if (src_ne->kpne_shutdown) /* caller is shutting down */
+ if (src_ne->kpne_shutdown) /* caller is shutting down */
goto out;
- fwd->kprfd_router_arg = src_ne; /* stash caller's nal entry */
- atomic_inc (&src_ne->kpne_refcount); /* source nal is busy until fwd completes */
+ fwd->kprfd_router_arg = src_ne; /* stash caller's nal entry */
read_lock (&kpr_rwlock);
return(1);
}
-static int connection_input(connection c)
+static int connection_input(void *d)
{
- return((*c->m->handler)(c->m->handler_arg,c));
+ connection c = d;
+ return((*c->m->handler)(c->m->handler_arg,c));
}
* zero if the fixed port could not be bound
*/
manager init_connections(unsigned short pid,
- int (*input)(),
+ int (*input)(void *, void *),
void *a)
{
manager m=(manager)malloc(sizeof(struct manager));
manager m;
} *connection;
-connection force_tcp_connection(manager m,
- unsigned int ip,
- unsigned int short);
-manager init_connections(unsigned short,
- int (*f)(void *,connection),
- void *);
+connection force_tcp_connection(manager m, unsigned int ip, unsigned int short);
+manager init_connections(unsigned short, int (*f)(void *, void *), void *);
void remove_connection(void *arg);
void shutdown_connections(manager m);
-int read_connection(connection c,
- unsigned char *dest,
- int len);
+int read_connection(connection c, unsigned char *dest, int len);
* available. It attempts to read the portals header and
* pass it to the generic library for processing.
*/
-static int from_connection(void *a,connection c)
+static int from_connection(void *a, void *d)
{
- bridge b=a;
- ptl_hdr_t hdr;
- if (read_connection(c, (unsigned char *)&hdr, sizeof(hdr))){
- lib_parse(b->nal_cb, &hdr, c);
- return(1);
- }
- return(0);
+ connection c = d;
+ bridge b=a;
+ ptl_hdr_t hdr;
+
+ if (read_connection(c, (unsigned char *)&hdr, sizeof(hdr))){
+ lib_parse(b->nal_cb, &hdr, c);
+ return(1);
+ }
+ return(0);
}
return ((e == NULL) ? "???" : e->name);
}
-static int
-nid2nal (ptl_nid_t nid)
-{
- /* BIG pragmatic assumption */
- return ((((__u32)nid) & 0xffff0000) != 0 ? SOCKNAL : QSWNAL);
-}
-
int
ptl_parse_nid (ptl_nid_t *nidp, char *str)
{
char *
ptl_nid2str (char *buffer, ptl_nid_t nid)
{
- switch (nid2nal(nid))
- {
- case QSWNAL:
- sprintf (buffer, LPD64, nid);
- return (buffer);
+ __u32 addr = htonl((__u32)nid); /* back to NETWORK byte order */
+ struct hostent *he = gethostbyaddr ((const char *)&addr, sizeof (addr), AF_INET);
- case SCIMACNAL:
- sprintf (buffer, LPX64, nid);
- return (buffer);
-
- case SOCKNAL: {
- __u32 addr = htonl((__u32)nid); /* back to NETWORK byte order */
- struct hostent *he = gethostbyaddr ((const char *)&addr, sizeof (addr), AF_INET);
-
- if (he != NULL)
- strcpy (buffer, he->h_name);
- else
- {
- addr = (__u32)nid;
- sprintf (buffer, "%d.%d.%d.%d",
- (addr>>24)&0xff, (addr>>16)&0xff, (addr>>8)&0xff, addr&0xff);
- }
- return (buffer);
- }
+ if (he != NULL)
+ strcpy (buffer, he->h_name);
+ else
+ sprintf (buffer, "0x"LPX64, nid);
- default:
- sprintf (buffer, "nid2nal broken");
- return (buffer);
- }
+ return (buffer);
}
int
return 0;
}
+int jt_ptl_shownid(int argc, char **argv)
+{
+ struct portal_ioctl_data data;
+ int rc;
+
+ if (argc > 1) {
+ fprintf(stderr, "usage: %s\n", argv[0]);
+ return 0;
+ }
+
+ if (g_nal == 0) {
+ fprintf(stderr, "Error: you must run the 'network' command first\n");
+ return -1;
+ }
+
+ PORTAL_IOC_INIT (data);
+ data.ioc_nal = g_nal;
+ rc = l_ioctl(PORTALS_DEV_ID, IOC_PORTAL_GET_NID, &data);
+ if (rc < 0)
+ fprintf(stderr, "getting my NID failed: %s\n",
+ strerror (errno));
+ else
+ printf(LPX64"\n", data.ioc_nid);
+ return 0;
+}
+
int jt_ptl_mynid(int argc, char **argv)
{
int rc;
- struct hostent *h;
- char buf[1024], *hostname;
+ char hostname[1024];
+ char *nidstr;
struct portal_ioctl_data data;
ptl_nid_t mynid;
if (argc > 2) {
- fprintf(stderr, "usage: %s [hostname]\n", argv[0]);
- fprintf(stderr, "hostname defaults to the hostname of the "
- "machine.\n");
+ fprintf(stderr, "usage: %s [NID]\n", argv[0]);
+ fprintf(stderr, "NID defaults to the primary IP address of the machine.\n");
return 0;
}
return -1;
}
- if (g_nal == QSWNAL) {
- fprintf(stderr, "'mynid' doesn't make any sense for elan.\n");
- return -1;
- } else if (g_nal == GMNAL) {
- fprintf(stderr, "'mynid' doesn't make any sense for GM.\n");
- return -1;
- } else if (g_nal == SCIMACNAL) {
- fprintf(stderr, "'mynid' doesn't make any sense for SCI.\n");
- return -1;
- }
-
- if (g_nal != SOCKNAL && g_nal != TOENAL) {
- fprintf(stderr, "This should never happen. Also it is very "
- "bad.\n");
+ if (argc >= 2)
+ nidstr = argv[1];
+ else if (gethostname(hostname, sizeof(hostname)) != 0) {
+ fprintf(stderr, "gethostname failed: %s\n",
+ strerror(errno));
return -1;
}
+ else
+ nidstr = hostname;
- if (argc == 1) {
- if (gethostname(buf, sizeof(buf)) != 0) {
- fprintf(stderr, "gethostname failed: %s\n",
- strerror(errno));
- return -1;
- }
- hostname = buf;
- } else {
- hostname = argv[1];
- }
-
- h = gethostbyname(hostname);
-
- if (!h) {
- fprintf(stderr, "cannot get address for host '%s': %d\n",
- hostname, h_errno);
+ rc = ptl_parse_nid (&mynid, nidstr);
+ if (rc != 0) {
+ fprintf (stderr, "Can't convert '%s' into a NID\n", nidstr);
return -1;
}
- mynid = (ptl_nid_t)ntohl (*(__u32 *)h->h_addr); /* HOST byte order */
PORTAL_IOC_INIT(data);
data.ioc_nid = mynid;
rc = l_ioctl(PORTALS_DEV_ID, IOC_PORTAL_NAL_CMD, &data);
if (rc < 0)
- fprintf(stderr, "IOC_PORTAL_REGISTER_MYNID failed: %s\n",
+ fprintf(stderr, "setting my NID failed: %s\n",
strerror(errno));
else
printf("registered my nid "LPX64" (%s)\n", mynid, hostname);
ptl_nid_t nid1;
ptl_nid_t nid2;
ptl_nid_t gateway_nid;
- int gateway_nal;
int rc;
if (argc < 3)
return (0);
}
+ if (g_nal == 0) {
+ fprintf(stderr, "Error: you must run the 'network' command "
+ "first.\n");
+ return (-1);
+ }
+
if (ptl_parse_nid (&gateway_nid, argv[1]) != 0)
{
fprintf (stderr, "Can't parse gateway NID \"%s\"\n", argv[1]);
return (-1);
}
- gateway_nal = nid2nal (gateway_nid);
-
if (ptl_parse_nid (&nid1, argv[2]) != 0)
{
fprintf (stderr, "Can't parse first target NID \"%s\"\n", argv[2]);
PORTAL_IOC_INIT(data);
data.ioc_nid = gateway_nid;
- data.ioc_nal = gateway_nal;
+ data.ioc_nal = g_nal;
data.ioc_nid2 = MIN (nid1, nid2);
data.ioc_nid3 = MAX (nid1, nid2);
{"disconnect", jt_ptl_disconnect, 0, "disconnect from a remote nid (args: [hostname]"},
{"push", jt_ptl_push_connection, 0, "flush connection to a remote nid (args: [hostname]"},
{"ping", jt_ptl_ping, 0, "do a ping test (args: nid [count] [size] [timeout])"},
+ {"shownid", jt_ptl_shownid, 0, "print the local NID"},
{"mynid", jt_ptl_mynid, 0, "inform the socknal of the local NID (args: [hostname])"},
{"add_route", jt_ptl_add_route, 0, "add an entry to the routing table (args: gatewayNID targetNID [targetNID])"},
{"del_route", jt_ptl_del_route, 0, "delete an entry from the routing table (args: targetNID"},
printf "%10s", "stddev";
}
printf "\n";
+ $| = 1;
}
elsif ($cumulcount!=0) {
- printf "%-25s %-10Lu %-10Lu %-10Lu",
+ printf "%-25s %-10lu %-10lu %-10lu",
$name, $diff, ($diff/$tdiff), $cumulcount;
if (defined($sum)) {
$sum = $sum/$mhz;
$max = $max/$mhz;
}
- printf "%-8s %10Lu %12.2f %10Lu", $unit, $min, ($sum/$cumulcount), $max;
+ printf "%-8s %10lu %12.2f %10lu", $unit, $min, ($sum/$cumulcount), $max;
if (defined($sumsquare)) {
my $s = $sumsquare - (($sum_orig*$sum_orig)/$cumulcount);
if ($s >= 0) {
}
}
printf "\n";
+ $| = 1;
}
}
else {