# This code is issued under the GNU General Public License.
# See the file COPYING in this distribution
-EXTRA_DIST = Rules.linux archdep.m4 MCP
+#EXTRA_DIST = Rules.linux archdep.m4 MCP
+EXTRA_DIST = Rules.linux archdep.m4
DIST_SUBDIRS = libcfs portals knals unals utils tests doc router
+if LIBLUSTRE
+SUBDIRS = portals unals utils
+else
SUBDIRS = libcfs portals knals unals utils tests doc router
+endif
AC_MSG_RESULT($host_cpu)
KCFLAGS='-g -Wall '
KCPPFLAGS='-D__arch_lib__ '
+ libdir='${exec_prefix}/lib/lustre'
MOD_LINK=elf_i386
;;
um )
fi
fi
-# ---------- SMP -------------------
-#AC_MSG_CHECKING(for SMP)
-#if egrep -e SMP=y $LINUX/.config >/dev/null 2>&1; then
-# SMPFLAG=
-# AC_MSG_RESULT(yes)
+# ---------- Portals flags --------------------
+
+#AC_PREFIX_DEFAULT([])
+#if test "x$prefix" = xNONE || test "x$prefix" = x; then
+# usrprefix=/usr
#else
-# SMPFLAG=
-# AC_MSG_RESULT(no)
+# usrprefix='${prefix}'
#fi
+#AC_SUBST(usrprefix)
+
+AC_MSG_CHECKING(if kernel has CPU affinity support)
+if test "$target_cpu" != ia64 ; then
+ enable_affinity_temp="-DCPU_AFFINITY=1"
+ AC_MSG_RESULT(yes)
+else
+ enable_affinity_temp=""
+ AC_MSG_RESULT(no)
+fi
+
+AC_MSG_CHECKING(if kernel has zero-copy TCP support)
+ZCCD="`grep -c zccd $LINUX/include/linux/skbuff.h`"
+if test "$ZCCD" != 0 ; then
+ enable_zerocopy_temp="-DSOCKNAL_ZC=1"
+ AC_MSG_RESULT(yes)
+else
+ enable_zerocopy_temp=""
+ 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(affinity, [ --enable-affinity enable process/irq affinity],enable_affinity="-DCPU_AFFINITY=1", enable_affinity=$enable_affinity_temp)
+#####################################
+
+AC_MSG_CHECKING(if quadrics kernel headers are present)
+if test -d $LINUX/drivers/net/qsnet ; then
+ AC_MSG_RESULT(yes)
+ QSWNAL="qswnal"
+ with_quadrics="-I$LINUX/drivers/net/qsnet/include"
+ :
+elif test -d $LINUX/drivers/qsnet1 ; then
+ AC_MSG_RESULT(yes)
+ QSWNAL="qswnal"
+ with_quadrics="-I$LINUX/drivers/qsnet1/include -DPROPRIETARY_ELAN"
+ :
+elif test -d $LINUX/drivers/quadrics ; then
+ AC_MSG_RESULT(yes)
+ QSWNAL="qswnal"
+ with_quadrics="-I$LINUX/drivers/quadrics/include -DPROPRIETARY_ELAN"
+ :
+#elif test -d /usr/include/elan3 ; then
+# AC_MSG_RESULT(yes)
+# QSWNAL="qswnal"
+# with_quadrics=""
+# :
+else
+ AC_MSG_RESULT(no)
+ QSWNAL=""
+ with_quadrics=""
+ :
+fi
+AC_SUBST(with_quadrics)
+AC_SUBST(QSWNAL)
+
+# R. Read 5/02
+GMNAL=""
+echo "checking with-gm=" ${with_gm}
+if test "${with_gm+set}" = set; then
+ if test "${with_gm}" = yes; then
+ with_gm="-I/usr/local/gm/include"
+ else
+ with_gm=-I"$with_gm/include"
+ fi
+ GMNAL="gmnal"
+else
+# default case - no GM
+ with_gm=""
+fi
+AC_SUBST(with_gm)
+AC_SUBST(GMNAL)
+
+
+def_scamac=/opt/scali/include
+AC_ARG_WITH(scamac, [ --with-scamac=[yes/no/path] Path to ScaMAC includes (default=/opt/scali/include)], with_scamac=$withval, with_scamac=$def_scamac)
+AC_MSG_CHECKING(if ScaMAC headers are present)
+if test "$with_scamac" = yes; then
+ with_scamac=$def_scamac
+fi
+if test "$with_scamac" != no -a -f ${with_scamac}/scamac.h; then
+ AC_MSG_RESULT(yes)
+ SCIMACNAL="scimacnal"
+ with_scamac="-I${with_scamac} -I${with_scamac}/icm"
+else
+ AC_MSG_RESULT(no)
+ SCIMACNAL=""
+ with_scamac=""
+fi
+
+AC_SUBST(with_scamac)
+AC_SUBST(SCIMACNAL)
CFLAGS="$KCFLAGS"
-CPPFLAGS="$KINCFLAGS $KCPPFLAGS $MFLAGS "
+CPPFLAGS="$KINCFLAGS $KCPPFLAGS $MFLAGS $enable_zerocopy $enable_affinity $with_quadrics $with_gm $with_scamac "
AC_SUBST(MOD_LINK)
-AC_SUBST(LINUX25)
\ No newline at end of file
+AC_SUBST(LINUX25)
+AM_CONDITIONAL(LIBLUSTRE, test x$host_cpu = xlib)
+
+
-
-# ---------- directories ---------
+# ---------- other tests and settings ---------
# --------- unsigned long long sane? -------
AC_SUBST(LIBEFENCE)
AC_SUBST(HAVE_LIBEFENCE)
-AM_CONDITIONAL(LIBLUSTRE, test x$host_cpu = xlib)
-AC_MSG_CHECKING(if you are building lib lustre)
-if test "$host_cpu" = "lib"; then
- AC_MSG_RESULT(yes)
- libdir='${exec_prefix}/lib/lustre'
-else
- AC_MSG_RESULT(no)
-fi
-
-# end -------- Kernel build environment. -----------------
-
-
}
#endif
-extern lib_handle_t *lib_lookup_cookie (nal_cb_t *nal, __u64 cookie);
-extern void lib_initialise_handle (nal_cb_t *nal, lib_handle_t *lh);
+extern lib_handle_t *lib_lookup_cookie (nal_cb_t *nal, __u64 cookie, int type);
+extern void lib_initialise_handle (nal_cb_t *nal, lib_handle_t *lh, int type);
extern void lib_invalidate_handle (nal_cb_t *nal, lib_handle_t *lh);
static inline void
ptl_handle2eq (ptl_handle_eq_t *handle, nal_cb_t *nal)
{
/* ALWAYS called with statelock held */
- lib_handle_t *lh = lib_lookup_cookie (nal, handle->cookie);
-
+ lib_handle_t *lh = lib_lookup_cookie (nal, handle->cookie,
+ PTL_COOKIE_TYPE_EQ);
if (lh == NULL)
return (NULL);
ptl_handle2md (ptl_handle_md_t *handle, nal_cb_t *nal)
{
/* ALWAYS called with statelock held */
- lib_handle_t *lh = lib_lookup_cookie (nal, handle->cookie);
-
+ lib_handle_t *lh = lib_lookup_cookie (nal, handle->cookie,
+ PTL_COOKIE_TYPE_MD);
if (lh == NULL)
return (NULL);
if (wh->wh_interface_cookie != nal->ni.ni_interface_cookie)
return (NULL);
- lh = lib_lookup_cookie (nal, wh->wh_object_cookie);
+ lh = lib_lookup_cookie (nal, wh->wh_object_cookie,
+ PTL_COOKIE_TYPE_MD);
if (lh == NULL)
return (NULL);
ptl_handle2me (ptl_handle_me_t *handle, nal_cb_t *nal)
{
/* ALWAYS called with statelock held */
- lib_handle_t *lh = lib_lookup_cookie (nal, handle->cookie);
-
+ lib_handle_t *lh = lib_lookup_cookie (nal, handle->cookie,
+ PTL_COOKIE_TYPE_ME);
if (lh == NULL)
return (NULL);
extern ptl_size_t lib_kiov_nob (int niov, ptl_kiov_t *iov);
extern void lib_copy_kiov2buf (char *dest, int niov, ptl_kiov_t *iov, ptl_size_t len);
extern void lib_copy_buf2kiov (int niov, ptl_kiov_t *iov, char *src, ptl_size_t len);
+extern void lib_assert_wire_constants (void);
extern void lib_recv (nal_cb_t *nal, void *private, lib_msg_t *msg, lib_md_t *md,
ptl_size_t offset, ptl_size_t mlen, ptl_size_t rlen);
}
#endif
-extern lib_handle_t *lib_lookup_cookie (nal_cb_t *nal, __u64 cookie);
-extern void lib_initialise_handle (nal_cb_t *nal, lib_handle_t *lh);
+extern lib_handle_t *lib_lookup_cookie (nal_cb_t *nal, __u64 cookie, int type);
+extern void lib_initialise_handle (nal_cb_t *nal, lib_handle_t *lh, int type);
extern void lib_invalidate_handle (nal_cb_t *nal, lib_handle_t *lh);
static inline void
ptl_handle2eq (ptl_handle_eq_t *handle, nal_cb_t *nal)
{
/* ALWAYS called with statelock held */
- lib_handle_t *lh = lib_lookup_cookie (nal, handle->cookie);
-
+ lib_handle_t *lh = lib_lookup_cookie (nal, handle->cookie,
+ PTL_COOKIE_TYPE_EQ);
if (lh == NULL)
return (NULL);
ptl_handle2md (ptl_handle_md_t *handle, nal_cb_t *nal)
{
/* ALWAYS called with statelock held */
- lib_handle_t *lh = lib_lookup_cookie (nal, handle->cookie);
-
+ lib_handle_t *lh = lib_lookup_cookie (nal, handle->cookie,
+ PTL_COOKIE_TYPE_MD);
if (lh == NULL)
return (NULL);
if (wh->wh_interface_cookie != nal->ni.ni_interface_cookie)
return (NULL);
- lh = lib_lookup_cookie (nal, wh->wh_object_cookie);
+ lh = lib_lookup_cookie (nal, wh->wh_object_cookie,
+ PTL_COOKIE_TYPE_MD);
if (lh == NULL)
return (NULL);
ptl_handle2me (ptl_handle_me_t *handle, nal_cb_t *nal)
{
/* ALWAYS called with statelock held */
- lib_handle_t *lh = lib_lookup_cookie (nal, handle->cookie);
-
+ lib_handle_t *lh = lib_lookup_cookie (nal, handle->cookie,
+ PTL_COOKIE_TYPE_ME);
if (lh == NULL)
return (NULL);
extern ptl_size_t lib_kiov_nob (int niov, ptl_kiov_t *iov);
extern void lib_copy_kiov2buf (char *dest, int niov, ptl_kiov_t *iov, ptl_size_t len);
extern void lib_copy_buf2kiov (int niov, ptl_kiov_t *iov, char *src, ptl_size_t len);
+extern void lib_assert_wire_constants (void);
extern void lib_recv (nal_cb_t *nal, void *private, lib_msg_t *msg, lib_md_t *md,
ptl_size_t offset, ptl_size_t mlen, ptl_size_t rlen);
typedef struct lib_md_t lib_md_t;
typedef struct lib_eq_t lib_eq_t;
+#define WIRE_ATTR __attribute__((packed))
+
/* The wire handle's interface cookie only matches one network interface in
* one epoch (i.e. new cookie when the interface restarts or the node
* reboots). The object cookie only matches one object on that interface
typedef struct {
__u64 wh_interface_cookie;
__u64 wh_object_cookie;
-} ptl_handle_wire_t;
+} WIRE_ATTR ptl_handle_wire_t;
/* byte-flip insensitive! */
#define PTL_WIRE_HANDLE_NONE \
ptl_handle_wire_t dst_wmd;
ptl_match_bits_t match_bits;
ptl_size_t length; /* common length (0 for acks) moving out RSN */
-} ptl_ack_t;
+} WIRE_ATTR ptl_ack_t;
typedef struct ptl_put {
ptl_pt_index_t ptl_index;
ptl_size_t length; /* common length moving out RSN */
ptl_size_t offset;
ptl_hdr_data_t hdr_data;
-} ptl_put_t;
+} WIRE_ATTR ptl_put_t;
typedef struct ptl_get {
ptl_pt_index_t ptl_index;
ptl_size_t src_offset;
ptl_size_t return_offset; /* unused: going RSN */
ptl_size_t sink_length;
-} ptl_get_t;
+} WIRE_ATTR ptl_get_t;
typedef struct ptl_reply {
__u32 unused1; /* unused fields going RSN */
ptl_size_t dst_offset; /* unused: going RSN */
__u32 unused2;
ptl_size_t length; /* common length moving out RSN */
-} ptl_reply_t;
+} WIRE_ATTR ptl_reply_t;
typedef struct {
ptl_nid_t dest_nid;
ptl_get_t get;
ptl_reply_t reply;
} msg;
-} ptl_hdr_t;
+} WIRE_ATTR ptl_hdr_t;
/* All length fields in individual unions at same offset */
/* LASSERT for same in lib-move.c */
__u32 magic; /* PORTALS_PROTO_MAGIC */
__u16 version_major; /* increment on incompatible change */
__u16 version_minor; /* increment on compatible change */
-} ptl_magicversion_t;
+} WIRE_ATTR ptl_magicversion_t;
#define PORTALS_PROTO_MAGIC 0xeebc0ded
unsigned int tp_threshold; /* # failures to simulate */
} lib_test_peer_t;
+#define PTL_COOKIE_TYPE_MD 1
+#define PTL_COOKIE_TYPE_ME 2
+#define PTL_COOKIE_TYPE_EQ 3
+#define PTL_COOKIE_TYPES 4
+/* PTL_COOKIE_TYPES must be a power of 2, so the cookie type can be
+ * extracted by masking with (PTL_COOKIE_TYPES - 1) */
+
typedef struct {
int up;
int refcnt;
#CFLAGS:= @KCFLAGS@
#CPPFLAGS:=@KCPPFLAGS@
DEFS =
+CPPFLAGS=@CPPFLAGS@ @with_quadrics@
kqswnal_SOURCES = qswnal.c qswnal_cb.c qswnal.h
#include <portals/api-support.h>
-#define MAX_NIS 8
+/* Put some magic in the NI handle so uninitialised/zeroed handles are easy
+ * to spot */
+#define NI_HANDLE_MAGIC 0xebc0de00
+#define NI_HANDLE_MASK 0x000000ff
+#define MAX_NIS 8
static nal_t *ptl_interfaces[MAX_NIS];
int ptl_num_interfaces = 0;
* setup/teardown. That ensures her NI handle can't get
* invalidated out from under her (or worse, swapped for a
* completely different interface!) */
-
+
+ if (((idx ^ NI_HANDLE_MAGIC) & ~NI_HANDLE_MASK) != 0)
+ return NULL;
+
+ idx &= NI_HANDLE_MASK;
if (idx < MAX_NIS)
return ptl_interfaces[idx];
{
int i;
+ LASSERT (MAX_NIS <= (NI_HANDLE_MASK + 1));
+
for (i = 0; i < MAX_NIS; i++)
ptl_interfaces[i] = NULL;
for (i = 0; i < ptl_num_interfaces; i++) {
if (ptl_interfaces[i] == nal) {
nal->refct++;
- handle->nal_idx = i;
+ handle->nal_idx = (NI_HANDLE_MAGIC & ~NI_HANDLE_MASK) | i;
fprintf(stderr, "Returning existing NAL (%d)\n", i);
ptl_ni_init_mutex_exit ();
return PTL_OK;
}
nal->refct = 1;
- handle->nal_idx = ptl_num_interfaces;
if (ptl_num_interfaces >= MAX_NIS) {
if (nal->shutdown)
nal->shutdown (nal, ptl_num_interfaces);
return PTL_NOSPACE;
}
+ handle->nal_idx = (NI_HANDLE_MAGIC & ~NI_HANDLE_MASK) | ptl_num_interfaces;
ptl_interfaces[ptl_num_interfaces++] = nal;
ptl_eq_ni_init(nal);
int PtlNIFini(ptl_handle_ni_t ni)
{
nal_t *nal;
+ int idx;
int rc;
if (!ptl_init)
return PTL_INV_HANDLE;
}
+ idx = ni.nal_idx & NI_HANDLE_MASK;
+
nal->refct--;
if (nal->refct > 0) {
ptl_ni_init_mutex_exit ();
rc = PTL_OK;
if (nal->shutdown)
- rc = nal->shutdown(nal, ni.nal_idx);
+ rc = nal->shutdown(nal, idx);
- ptl_interfaces[ni.nal_idx] = NULL;
+ ptl_interfaces[idx] = NULL;
ptl_num_interfaces--;
ptl_ni_init_mutex_exit ();
eq->eq_refcount = 0;
eq->event_callback = args->callback_in;
- lib_initialise_handle (nal, &eq->eq_lh);
+ lib_initialise_handle (nal, &eq->eq_lh, PTL_COOKIE_TYPE_EQ);
list_add (&eq->eq_list, &nal->ni.ni_active_eqs);
state_unlock(nal, &flags);
for (i = 0; i < ni->ni_lh_hash_size; i++)
INIT_LIST_HEAD (&ni->ni_lh_hash_table[i]);
- ni->ni_next_object_cookie = 0;
+ ni->ni_next_object_cookie = PTL_COOKIE_TYPES;
return (PTL_OK);
}
}
lib_handle_t *
-lib_lookup_cookie (nal_cb_t *nal, __u64 cookie)
+lib_lookup_cookie (nal_cb_t *nal, __u64 cookie, int type)
{
/* ALWAYS called with statelock held */
lib_ni_t *ni = &nal->ni;
struct list_head *el;
unsigned int hash;
+ if ((cookie & (PTL_COOKIE_TYPES - 1)) != type)
+ return (NULL);
+
hash = ((unsigned int)cookie) % ni->ni_lh_hash_size;
list = &ni->ni_lh_hash_table[hash];
}
void
-lib_initialise_handle (nal_cb_t *nal, lib_handle_t *lh)
+lib_initialise_handle (nal_cb_t *nal, lib_handle_t *lh, int type)
{
/* ALWAYS called with statelock held */
lib_ni_t *ni = &nal->ni;
unsigned int hash;
+
+ LASSERT (type >= 0 && type < PTL_COOKIE_TYPES);
+ lh->lh_cookie = ni->ni_next_object_cookie | type;
+ ni->ni_next_object_cookie += PTL_COOKIE_TYPES;
- lh->lh_cookie = ni->ni_next_object_cookie++;
hash = ((unsigned int)lh->lh_cookie) % ni->ni_lh_hash_size;
list_add (&lh->lh_hash_chain, &ni->ni_lh_hash_table[hash]);
}
goto out;
}
+ lib_assert_wire_constants ();
+
/*
* Allocate the portal table for this interface
* and all per-interface objects.
eq->eq_refcount++;
/* It's good; let handle2md succeed and add to active mds */
- lib_initialise_handle (nal, &new->md_lh);
+ lib_initialise_handle (nal, &new->md_lh, PTL_COOKIE_TYPE_MD);
list_add (&new->md_list, &nal->ni.ni_active_mds);
return PTL_OK;
me->unlink = args->unlink_in;
me->md = NULL;
- lib_initialise_handle (nal, &me->me_lh);
+ lib_initialise_handle (nal, &me->me_lh, PTL_COOKIE_TYPE_ME);
if (args->position_in == PTL_INS_AFTER)
list_add_tail(&me->me_list, &(tbl->tbl[args->index_in]));
new->unlink = args->unlink_in;
new->md = NULL;
- lib_initialise_handle (nal, &new->me_lh);
+ lib_initialise_handle (nal, &new->me_lh, PTL_COOKIE_TYPE_ME);
if (args->position_in == PTL_INS_AFTER)
list_add_tail(&new->me_list, &me->me_list);
/* NB handles only looked up by creator (no flips) */
md = ptl_wire_handle2md(&hdr->msg.ack.dst_wmd, nal);
if (md == NULL || md->threshold == 0) {
- CERROR(LPU64": Dropping ACK from "LPU64" to %s MD "
+ CDEBUG(D_INFO, LPU64": Dropping ACK from "LPU64" to %s MD "
LPX64"."LPX64"\n", ni->nid, hdr->src_nid,
(md == NULL) ? "invalid" : "inactive",
hdr->msg.ack.dst_wmd.wh_interface_cookie,
return ret->rc = PTL_OK;
}
+
+void lib_assert_wire_constants (void)
+{
+ /* Wire protocol assertions generated by 'wirecheck' */
+
+ /* Constants... */
+ LASSERT (PORTALS_PROTO_MAGIC == 0xeebc0ded);
+ LASSERT (PORTALS_PROTO_VERSION_MAJOR == 0);
+ LASSERT (PORTALS_PROTO_VERSION_MINOR == 1);
+ LASSERT (PTL_MSG_ACK == 0);
+ LASSERT (PTL_MSG_PUT == 1);
+ LASSERT (PTL_MSG_GET == 2);
+ LASSERT (PTL_MSG_REPLY == 3);
+ LASSERT (PTL_MSG_HELLO == 4);
+
+ /* Checks for struct ptl_handle_wire_t */
+ LASSERT (sizeof (ptl_handle_wire_t) == 16);
+ LASSERT (offsetof (ptl_handle_wire_t, wh_interface_cookie) == 0);
+ LASSERT (sizeof (((ptl_handle_wire_t *)0)->wh_interface_cookie) == 8);
+ LASSERT (offsetof (ptl_handle_wire_t, wh_object_cookie) == 8);
+ LASSERT (sizeof (((ptl_handle_wire_t *)0)->wh_object_cookie) == 8);
+
+ /* Checks for struct ptl_magicversion_t */
+ LASSERT (sizeof (ptl_magicversion_t) == 8);
+ LASSERT (offsetof (ptl_magicversion_t, magic) == 0);
+ LASSERT (sizeof (((ptl_magicversion_t *)0)->magic) == 4);
+ LASSERT (offsetof (ptl_magicversion_t, version_major) == 4);
+ LASSERT (sizeof (((ptl_magicversion_t *)0)->version_major) == 2);
+ LASSERT (offsetof (ptl_magicversion_t, version_minor) == 6);
+ LASSERT (sizeof (((ptl_magicversion_t *)0)->version_minor) == 2);
+
+ /* Checks for struct ptl_hdr_t */
+ LASSERT (sizeof (ptl_hdr_t) == 72);
+ LASSERT (offsetof (ptl_hdr_t, dest_nid) == 0);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->dest_nid) == 8);
+ LASSERT (offsetof (ptl_hdr_t, src_nid) == 8);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->src_nid) == 8);
+ LASSERT (offsetof (ptl_hdr_t, dest_pid) == 16);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->dest_pid) == 4);
+ LASSERT (offsetof (ptl_hdr_t, src_pid) == 20);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->src_pid) == 4);
+ LASSERT (offsetof (ptl_hdr_t, type) == 24);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->type) == 4);
+
+ /* Ack */
+ LASSERT (offsetof (ptl_hdr_t, msg.ack.mlength) == 28);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.ack.mlength) == 4);
+ LASSERT (offsetof (ptl_hdr_t, msg.ack.dst_wmd) == 32);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.ack.dst_wmd) == 16);
+ LASSERT (offsetof (ptl_hdr_t, msg.ack.match_bits) == 48);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.ack.match_bits) == 8);
+ LASSERT (offsetof (ptl_hdr_t, msg.ack.length) == 56);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.ack.length) == 4);
+
+ /* Put */
+ LASSERT (offsetof (ptl_hdr_t, msg.put.ptl_index) == 28);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.put.ptl_index) == 4);
+ LASSERT (offsetof (ptl_hdr_t, msg.put.ack_wmd) == 32);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.put.ack_wmd) == 16);
+ LASSERT (offsetof (ptl_hdr_t, msg.put.match_bits) == 48);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.put.match_bits) == 8);
+ LASSERT (offsetof (ptl_hdr_t, msg.put.length) == 56);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.put.length) == 4);
+ LASSERT (offsetof (ptl_hdr_t, msg.put.offset) == 60);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.put.offset) == 4);
+ LASSERT (offsetof (ptl_hdr_t, msg.put.hdr_data) == 64);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.put.hdr_data) == 8);
+
+ /* Get */
+ LASSERT (offsetof (ptl_hdr_t, msg.get.ptl_index) == 28);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.get.ptl_index) == 4);
+ LASSERT (offsetof (ptl_hdr_t, msg.get.return_wmd) == 32);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.get.return_wmd) == 16);
+ LASSERT (offsetof (ptl_hdr_t, msg.get.match_bits) == 48);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.get.match_bits) == 8);
+ LASSERT (offsetof (ptl_hdr_t, msg.get.length) == 56);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.get.length) == 4);
+ LASSERT (offsetof (ptl_hdr_t, msg.get.src_offset) == 60);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.get.src_offset) == 4);
+ LASSERT (offsetof (ptl_hdr_t, msg.get.return_offset) == 64);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.get.return_offset) == 4);
+ LASSERT (offsetof (ptl_hdr_t, msg.get.sink_length) == 68);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.get.sink_length) == 4);
+
+ /* Reply */
+ LASSERT (offsetof (ptl_hdr_t, msg.reply.dst_wmd) == 32);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.reply.dst_wmd) == 16);
+ LASSERT (offsetof (ptl_hdr_t, msg.reply.dst_offset) == 48);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.reply.dst_offset) == 4);
+ LASSERT (offsetof (ptl_hdr_t, msg.reply.length) == 56);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.reply.length) == 4);
+}
+++ /dev/null
-AC_PREFIX_DEFAULT([])
-if test "x$prefix" = xNONE || test "x$prefix" = x; then
- usrprefix=/usr
-else
- usrprefix='${prefix}'
-fi
-AC_SUBST(usrprefix)
-
-AC_ARG_ENABLE(rtscts-myrinet, [ --enable-rtscts-myrinet enable rtscts over myrinet support])
-AM_CONDITIONAL(RTSCTS_MYRINET, test "$enable_rtscts_myrinet" = yes)
-
-
-CPLANT_ARCH=${target_cpu}
-case ${CPLANT_ARCH} in
-alpha*)
- RTSCTSLIB_CFLAGS='-O4 -mno-fp-regs'
- RTSCTSLIB_DEFS=-Ddec_linux
- ;;
-i*86)
- RTSCTSLIB_CFLAGS=-O4
- RTSCTSLIB_DEFS=-Dintel_linux
- ;;
-#*)
-# AC_MSG_ERROR([Unrecognized architecture '$CPLANT_ARCH' for rtscts])
-# ;;
-esac
-AC_SUBST(CPLANT_ARCH)
-AC_SUBST(RTSCTSLIB_CFLAGS)
-AC_SUBST(RTSCTSLIB_DEFS)
-
-AC_MSG_CHECKING(if kernel has CPU affinity support)
-if test "$target_cpu" != ia64 ; then
- enable_affinity_temp="-DCPU_AFFINITY=1"
- AC_MSG_RESULT(yes)
-else
- enable_affinity_temp=""
- AC_MSG_RESULT(no)
-fi
-AC_MSG_CHECKING(if kernel has zero-copy TCP support)
-ZCCD="`grep -c zccd $LINUX/include/linux/skbuff.h`"
-if test "$ZCCD" != 0 ; then
- enable_zerocopy_temp="-DSOCKNAL_ZC=1"
- AC_MSG_RESULT(yes)
-else
- enable_zerocopy_temp=""
- 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(affinity, [ --enable-affinity enable process/irq affinity],enable_affinity="-DCPU_AFFINITY=1", enable_affinity=$enable_affinity_temp)
-#####################################
-
-AC_MSG_CHECKING(if quadrics kernel headers are present)
-if test -d $LINUX/drivers/net/qsnet ; then
- AC_MSG_RESULT(yes)
- QSWNAL="qswnal"
- with_quadrics="-I$LINUX/drivers/net/qsnet/include"
- :
-elif test -d $LINUX/drivers/qsnet1 ; then
- AC_MSG_RESULT(yes)
- QSWNAL="qswnal"
- with_quadrics="-I$LINUX/drivers/qsnet1/include -DPROPRIETARY_ELAN"
- :
-elif test -d $LINUX/drivers/quadrics ; then
- AC_MSG_RESULT(yes)
- QSWNAL="qswnal"
- with_quadrics="-I$LINUX/drivers/quadrics/include -DPROPRIETARY_ELAN"
- :
-#elif test -d /usr/include/elan3 ; then
-# AC_MSG_RESULT(yes)
-# QSWNAL="qswnal"
-# with_quadrics=""
-# :
-else
- AC_MSG_RESULT(no)
- QSWNAL=""
- with_quadrics=""
- :
-fi
-AC_SUBST(with_quadrics)
-AC_SUBST(QSWNAL)
-
-# R. Read 5/02
-GMNAL=""
-echo "checking with-gm=" ${with_gm}
-if test "${with_gm+set}" = set; then
- if test "${with_gm}" = yes; then
- with_gm="-I/usr/local/gm/include"
- else
- with_gm=-I"$with_gm/include"
- fi
- GMNAL="gmnal"
-else
-# default case - no GM
- with_gm=""
-fi
-AC_SUBST(with_gm)
-AC_SUBST(GMNAL)
-
-
-def_scamac=/opt/scali/include
-AC_ARG_WITH(scamac, [ --with-scamac=[yes/no/path] Path to ScaMAC includes (default=/opt/scali/include)], with_scamac=$withval, with_scamac=$def_scamac)
-AC_MSG_CHECKING(if ScaMAC headers are present)
-if test "$with_scamac" = yes; then
- with_scamac=$def_scamac
-fi
-if test "$with_scamac" != no -a -f ${with_scamac}/scamac.h; then
- AC_MSG_RESULT(yes)
- SCIMACNAL="scimacnal"
- with_scamac="-I${with_scamac} -I${with_scamac}/icm"
-else
- AC_MSG_RESULT(no)
- SCIMACNAL=""
- with_scamac=""
-fi
-AC_SUBST(with_scamac)
-AC_SUBST(SCIMACNAL)
ptlctl
.deps
routerstat
+wirecheck
.*.cmd
COMPILE = gcc -Wall -g -I$(srcdir)/../include
LINK = gcc -o $@
-sbin_PROGRAMS = acceptor ptlctl debugctl routerstat
+sbin_PROGRAMS = acceptor ptlctl debugctl routerstat wirecheck
lib_LIBRARIES = libptlctl.a
acceptor_SOURCES = acceptor.c # -lefence
+wirecheck_SOURCES = wirecheck.c
+
libptlctl_a_SOURCES = portals.c debug.c l_ioctl.c parser.c parser.h
ptlctl_SOURCES = ptlctl.c
newdata = (struct portal_ioctl_data *)buf;
if (newdata->ioc_size > 0)
dump_buffer(fd, databuf, newdata->ioc_size, raw);
- else
- fprintf(stderr, "No data in the debug buffer.\n");
out:
if (databuf)
struct mod_paths {
char *name, *path;
} *mp, mod_paths[] = {
- {"portals", "portals/linux/oslib"},
- {"ksocknal", "portals/linux/socknal"},
+ {"portals", "lustre/portals/libcfs"},
+ {"ksocknal", "lustre/portals/knals/socknal"},
{"obdclass", "lustre/obdclass"},
{"ptlrpc", "lustre/ptlrpc"},
{"obdext2", "lustre/obdext2"},
# This code is issued under the GNU General Public License.
# See the file COPYING in this distribution
-EXTRA_DIST = Rules.linux archdep.m4 MCP
+#EXTRA_DIST = Rules.linux archdep.m4 MCP
+EXTRA_DIST = Rules.linux archdep.m4
DIST_SUBDIRS = libcfs portals knals unals utils tests doc router
+if LIBLUSTRE
+SUBDIRS = portals unals utils
+else
SUBDIRS = libcfs portals knals unals utils tests doc router
+endif
AC_MSG_RESULT($host_cpu)
KCFLAGS='-g -Wall '
KCPPFLAGS='-D__arch_lib__ '
+ libdir='${exec_prefix}/lib/lustre'
MOD_LINK=elf_i386
;;
um )
fi
fi
-# ---------- SMP -------------------
-#AC_MSG_CHECKING(for SMP)
-#if egrep -e SMP=y $LINUX/.config >/dev/null 2>&1; then
-# SMPFLAG=
-# AC_MSG_RESULT(yes)
+# ---------- Portals flags --------------------
+
+#AC_PREFIX_DEFAULT([])
+#if test "x$prefix" = xNONE || test "x$prefix" = x; then
+# usrprefix=/usr
#else
-# SMPFLAG=
-# AC_MSG_RESULT(no)
+# usrprefix='${prefix}'
#fi
+#AC_SUBST(usrprefix)
+
+AC_MSG_CHECKING(if kernel has CPU affinity support)
+if test "$target_cpu" != ia64 ; then
+ enable_affinity_temp="-DCPU_AFFINITY=1"
+ AC_MSG_RESULT(yes)
+else
+ enable_affinity_temp=""
+ AC_MSG_RESULT(no)
+fi
+
+AC_MSG_CHECKING(if kernel has zero-copy TCP support)
+ZCCD="`grep -c zccd $LINUX/include/linux/skbuff.h`"
+if test "$ZCCD" != 0 ; then
+ enable_zerocopy_temp="-DSOCKNAL_ZC=1"
+ AC_MSG_RESULT(yes)
+else
+ enable_zerocopy_temp=""
+ 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(affinity, [ --enable-affinity enable process/irq affinity],enable_affinity="-DCPU_AFFINITY=1", enable_affinity=$enable_affinity_temp)
+#####################################
+
+AC_MSG_CHECKING(if quadrics kernel headers are present)
+if test -d $LINUX/drivers/net/qsnet ; then
+ AC_MSG_RESULT(yes)
+ QSWNAL="qswnal"
+ with_quadrics="-I$LINUX/drivers/net/qsnet/include"
+ :
+elif test -d $LINUX/drivers/qsnet1 ; then
+ AC_MSG_RESULT(yes)
+ QSWNAL="qswnal"
+ with_quadrics="-I$LINUX/drivers/qsnet1/include -DPROPRIETARY_ELAN"
+ :
+elif test -d $LINUX/drivers/quadrics ; then
+ AC_MSG_RESULT(yes)
+ QSWNAL="qswnal"
+ with_quadrics="-I$LINUX/drivers/quadrics/include -DPROPRIETARY_ELAN"
+ :
+#elif test -d /usr/include/elan3 ; then
+# AC_MSG_RESULT(yes)
+# QSWNAL="qswnal"
+# with_quadrics=""
+# :
+else
+ AC_MSG_RESULT(no)
+ QSWNAL=""
+ with_quadrics=""
+ :
+fi
+AC_SUBST(with_quadrics)
+AC_SUBST(QSWNAL)
+
+# R. Read 5/02
+GMNAL=""
+echo "checking with-gm=" ${with_gm}
+if test "${with_gm+set}" = set; then
+ if test "${with_gm}" = yes; then
+ with_gm="-I/usr/local/gm/include"
+ else
+ with_gm=-I"$with_gm/include"
+ fi
+ GMNAL="gmnal"
+else
+# default case - no GM
+ with_gm=""
+fi
+AC_SUBST(with_gm)
+AC_SUBST(GMNAL)
+
+
+def_scamac=/opt/scali/include
+AC_ARG_WITH(scamac, [ --with-scamac=[yes/no/path] Path to ScaMAC includes (default=/opt/scali/include)], with_scamac=$withval, with_scamac=$def_scamac)
+AC_MSG_CHECKING(if ScaMAC headers are present)
+if test "$with_scamac" = yes; then
+ with_scamac=$def_scamac
+fi
+if test "$with_scamac" != no -a -f ${with_scamac}/scamac.h; then
+ AC_MSG_RESULT(yes)
+ SCIMACNAL="scimacnal"
+ with_scamac="-I${with_scamac} -I${with_scamac}/icm"
+else
+ AC_MSG_RESULT(no)
+ SCIMACNAL=""
+ with_scamac=""
+fi
+
+AC_SUBST(with_scamac)
+AC_SUBST(SCIMACNAL)
CFLAGS="$KCFLAGS"
-CPPFLAGS="$KINCFLAGS $KCPPFLAGS $MFLAGS "
+CPPFLAGS="$KINCFLAGS $KCPPFLAGS $MFLAGS $enable_zerocopy $enable_affinity $with_quadrics $with_gm $with_scamac "
AC_SUBST(MOD_LINK)
-AC_SUBST(LINUX25)
\ No newline at end of file
+AC_SUBST(LINUX25)
+AM_CONDITIONAL(LIBLUSTRE, test x$host_cpu = xlib)
+
+
-
-# ---------- directories ---------
+# ---------- other tests and settings ---------
# --------- unsigned long long sane? -------
AC_SUBST(LIBEFENCE)
AC_SUBST(HAVE_LIBEFENCE)
-AM_CONDITIONAL(LIBLUSTRE, test x$host_cpu = xlib)
-AC_MSG_CHECKING(if you are building lib lustre)
-if test "$host_cpu" = "lib"; then
- AC_MSG_RESULT(yes)
- libdir='${exec_prefix}/lib/lustre'
-else
- AC_MSG_RESULT(no)
-fi
-
-# end -------- Kernel build environment. -----------------
-
-
}
#endif
-extern lib_handle_t *lib_lookup_cookie (nal_cb_t *nal, __u64 cookie);
-extern void lib_initialise_handle (nal_cb_t *nal, lib_handle_t *lh);
+extern lib_handle_t *lib_lookup_cookie (nal_cb_t *nal, __u64 cookie, int type);
+extern void lib_initialise_handle (nal_cb_t *nal, lib_handle_t *lh, int type);
extern void lib_invalidate_handle (nal_cb_t *nal, lib_handle_t *lh);
static inline void
ptl_handle2eq (ptl_handle_eq_t *handle, nal_cb_t *nal)
{
/* ALWAYS called with statelock held */
- lib_handle_t *lh = lib_lookup_cookie (nal, handle->cookie);
-
+ lib_handle_t *lh = lib_lookup_cookie (nal, handle->cookie,
+ PTL_COOKIE_TYPE_EQ);
if (lh == NULL)
return (NULL);
ptl_handle2md (ptl_handle_md_t *handle, nal_cb_t *nal)
{
/* ALWAYS called with statelock held */
- lib_handle_t *lh = lib_lookup_cookie (nal, handle->cookie);
-
+ lib_handle_t *lh = lib_lookup_cookie (nal, handle->cookie,
+ PTL_COOKIE_TYPE_MD);
if (lh == NULL)
return (NULL);
if (wh->wh_interface_cookie != nal->ni.ni_interface_cookie)
return (NULL);
- lh = lib_lookup_cookie (nal, wh->wh_object_cookie);
+ lh = lib_lookup_cookie (nal, wh->wh_object_cookie,
+ PTL_COOKIE_TYPE_MD);
if (lh == NULL)
return (NULL);
ptl_handle2me (ptl_handle_me_t *handle, nal_cb_t *nal)
{
/* ALWAYS called with statelock held */
- lib_handle_t *lh = lib_lookup_cookie (nal, handle->cookie);
-
+ lib_handle_t *lh = lib_lookup_cookie (nal, handle->cookie,
+ PTL_COOKIE_TYPE_ME);
if (lh == NULL)
return (NULL);
extern ptl_size_t lib_kiov_nob (int niov, ptl_kiov_t *iov);
extern void lib_copy_kiov2buf (char *dest, int niov, ptl_kiov_t *iov, ptl_size_t len);
extern void lib_copy_buf2kiov (int niov, ptl_kiov_t *iov, char *src, ptl_size_t len);
+extern void lib_assert_wire_constants (void);
extern void lib_recv (nal_cb_t *nal, void *private, lib_msg_t *msg, lib_md_t *md,
ptl_size_t offset, ptl_size_t mlen, ptl_size_t rlen);
typedef struct lib_md_t lib_md_t;
typedef struct lib_eq_t lib_eq_t;
+#define WIRE_ATTR __attribute__((packed))
+
/* The wire handle's interface cookie only matches one network interface in
* one epoch (i.e. new cookie when the interface restarts or the node
* reboots). The object cookie only matches one object on that interface
typedef struct {
__u64 wh_interface_cookie;
__u64 wh_object_cookie;
-} ptl_handle_wire_t;
+} WIRE_ATTR ptl_handle_wire_t;
/* byte-flip insensitive! */
#define PTL_WIRE_HANDLE_NONE \
ptl_handle_wire_t dst_wmd;
ptl_match_bits_t match_bits;
ptl_size_t length; /* common length (0 for acks) moving out RSN */
-} ptl_ack_t;
+} WIRE_ATTR ptl_ack_t;
typedef struct ptl_put {
ptl_pt_index_t ptl_index;
ptl_size_t length; /* common length moving out RSN */
ptl_size_t offset;
ptl_hdr_data_t hdr_data;
-} ptl_put_t;
+} WIRE_ATTR ptl_put_t;
typedef struct ptl_get {
ptl_pt_index_t ptl_index;
ptl_size_t src_offset;
ptl_size_t return_offset; /* unused: going RSN */
ptl_size_t sink_length;
-} ptl_get_t;
+} WIRE_ATTR ptl_get_t;
typedef struct ptl_reply {
__u32 unused1; /* unused fields going RSN */
ptl_size_t dst_offset; /* unused: going RSN */
__u32 unused2;
ptl_size_t length; /* common length moving out RSN */
-} ptl_reply_t;
+} WIRE_ATTR ptl_reply_t;
typedef struct {
ptl_nid_t dest_nid;
ptl_get_t get;
ptl_reply_t reply;
} msg;
-} ptl_hdr_t;
+} WIRE_ATTR ptl_hdr_t;
/* All length fields in individual unions at same offset */
/* LASSERT for same in lib-move.c */
__u32 magic; /* PORTALS_PROTO_MAGIC */
__u16 version_major; /* increment on incompatible change */
__u16 version_minor; /* increment on compatible change */
-} ptl_magicversion_t;
+} WIRE_ATTR ptl_magicversion_t;
#define PORTALS_PROTO_MAGIC 0xeebc0ded
unsigned int tp_threshold; /* # failures to simulate */
} lib_test_peer_t;
+#define PTL_COOKIE_TYPE_MD 1
+#define PTL_COOKIE_TYPE_ME 2
+#define PTL_COOKIE_TYPE_EQ 3
+#define PTL_COOKIE_TYPES 4
+/* PTL_COOKIE_TYPES must be a power of 2, so the cookie type can be
+ * extracted by masking with (PTL_COOKIE_TYPES - 1) */
+
typedef struct {
int up;
int refcnt;
#CFLAGS:= @KCFLAGS@
#CPPFLAGS:=@KCPPFLAGS@
DEFS =
+CPPFLAGS=@CPPFLAGS@ @with_quadrics@
kqswnal_SOURCES = qswnal.c qswnal_cb.c qswnal.h
#include <portals/api-support.h>
-#define MAX_NIS 8
+/* Put some magic in the NI handle so uninitialised/zeroed handles are easy
+ * to spot */
+#define NI_HANDLE_MAGIC 0xebc0de00
+#define NI_HANDLE_MASK 0x000000ff
+#define MAX_NIS 8
static nal_t *ptl_interfaces[MAX_NIS];
int ptl_num_interfaces = 0;
* setup/teardown. That ensures her NI handle can't get
* invalidated out from under her (or worse, swapped for a
* completely different interface!) */
-
+
+ if (((idx ^ NI_HANDLE_MAGIC) & ~NI_HANDLE_MASK) != 0)
+ return NULL;
+
+ idx &= NI_HANDLE_MASK;
if (idx < MAX_NIS)
return ptl_interfaces[idx];
{
int i;
+ LASSERT (MAX_NIS <= (NI_HANDLE_MASK + 1));
+
for (i = 0; i < MAX_NIS; i++)
ptl_interfaces[i] = NULL;
for (i = 0; i < ptl_num_interfaces; i++) {
if (ptl_interfaces[i] == nal) {
nal->refct++;
- handle->nal_idx = i;
+ handle->nal_idx = (NI_HANDLE_MAGIC & ~NI_HANDLE_MASK) | i;
fprintf(stderr, "Returning existing NAL (%d)\n", i);
ptl_ni_init_mutex_exit ();
return PTL_OK;
}
nal->refct = 1;
- handle->nal_idx = ptl_num_interfaces;
if (ptl_num_interfaces >= MAX_NIS) {
if (nal->shutdown)
nal->shutdown (nal, ptl_num_interfaces);
return PTL_NOSPACE;
}
+ handle->nal_idx = (NI_HANDLE_MAGIC & ~NI_HANDLE_MASK) | ptl_num_interfaces;
ptl_interfaces[ptl_num_interfaces++] = nal;
ptl_eq_ni_init(nal);
int PtlNIFini(ptl_handle_ni_t ni)
{
nal_t *nal;
+ int idx;
int rc;
if (!ptl_init)
return PTL_INV_HANDLE;
}
+ idx = ni.nal_idx & NI_HANDLE_MASK;
+
nal->refct--;
if (nal->refct > 0) {
ptl_ni_init_mutex_exit ();
rc = PTL_OK;
if (nal->shutdown)
- rc = nal->shutdown(nal, ni.nal_idx);
+ rc = nal->shutdown(nal, idx);
- ptl_interfaces[ni.nal_idx] = NULL;
+ ptl_interfaces[idx] = NULL;
ptl_num_interfaces--;
ptl_ni_init_mutex_exit ();
eq->eq_refcount = 0;
eq->event_callback = args->callback_in;
- lib_initialise_handle (nal, &eq->eq_lh);
+ lib_initialise_handle (nal, &eq->eq_lh, PTL_COOKIE_TYPE_EQ);
list_add (&eq->eq_list, &nal->ni.ni_active_eqs);
state_unlock(nal, &flags);
for (i = 0; i < ni->ni_lh_hash_size; i++)
INIT_LIST_HEAD (&ni->ni_lh_hash_table[i]);
- ni->ni_next_object_cookie = 0;
+ ni->ni_next_object_cookie = PTL_COOKIE_TYPES;
return (PTL_OK);
}
}
lib_handle_t *
-lib_lookup_cookie (nal_cb_t *nal, __u64 cookie)
+lib_lookup_cookie (nal_cb_t *nal, __u64 cookie, int type)
{
/* ALWAYS called with statelock held */
lib_ni_t *ni = &nal->ni;
struct list_head *el;
unsigned int hash;
+ if ((cookie & (PTL_COOKIE_TYPES - 1)) != type)
+ return (NULL);
+
hash = ((unsigned int)cookie) % ni->ni_lh_hash_size;
list = &ni->ni_lh_hash_table[hash];
}
void
-lib_initialise_handle (nal_cb_t *nal, lib_handle_t *lh)
+lib_initialise_handle (nal_cb_t *nal, lib_handle_t *lh, int type)
{
/* ALWAYS called with statelock held */
lib_ni_t *ni = &nal->ni;
unsigned int hash;
+
+ LASSERT (type >= 0 && type < PTL_COOKIE_TYPES);
+ lh->lh_cookie = ni->ni_next_object_cookie | type;
+ ni->ni_next_object_cookie += PTL_COOKIE_TYPES;
- lh->lh_cookie = ni->ni_next_object_cookie++;
hash = ((unsigned int)lh->lh_cookie) % ni->ni_lh_hash_size;
list_add (&lh->lh_hash_chain, &ni->ni_lh_hash_table[hash]);
}
goto out;
}
+ lib_assert_wire_constants ();
+
/*
* Allocate the portal table for this interface
* and all per-interface objects.
eq->eq_refcount++;
/* It's good; let handle2md succeed and add to active mds */
- lib_initialise_handle (nal, &new->md_lh);
+ lib_initialise_handle (nal, &new->md_lh, PTL_COOKIE_TYPE_MD);
list_add (&new->md_list, &nal->ni.ni_active_mds);
return PTL_OK;
me->unlink = args->unlink_in;
me->md = NULL;
- lib_initialise_handle (nal, &me->me_lh);
+ lib_initialise_handle (nal, &me->me_lh, PTL_COOKIE_TYPE_ME);
if (args->position_in == PTL_INS_AFTER)
list_add_tail(&me->me_list, &(tbl->tbl[args->index_in]));
new->unlink = args->unlink_in;
new->md = NULL;
- lib_initialise_handle (nal, &new->me_lh);
+ lib_initialise_handle (nal, &new->me_lh, PTL_COOKIE_TYPE_ME);
if (args->position_in == PTL_INS_AFTER)
list_add_tail(&new->me_list, &me->me_list);
/* NB handles only looked up by creator (no flips) */
md = ptl_wire_handle2md(&hdr->msg.ack.dst_wmd, nal);
if (md == NULL || md->threshold == 0) {
- CERROR(LPU64": Dropping ACK from "LPU64" to %s MD "
+ CDEBUG(D_INFO, LPU64": Dropping ACK from "LPU64" to %s MD "
LPX64"."LPX64"\n", ni->nid, hdr->src_nid,
(md == NULL) ? "invalid" : "inactive",
hdr->msg.ack.dst_wmd.wh_interface_cookie,
return ret->rc = PTL_OK;
}
+
+void lib_assert_wire_constants (void)
+{
+ /* Wire protocol assertions generated by 'wirecheck' */
+
+ /* Constants... */
+ LASSERT (PORTALS_PROTO_MAGIC == 0xeebc0ded);
+ LASSERT (PORTALS_PROTO_VERSION_MAJOR == 0);
+ LASSERT (PORTALS_PROTO_VERSION_MINOR == 1);
+ LASSERT (PTL_MSG_ACK == 0);
+ LASSERT (PTL_MSG_PUT == 1);
+ LASSERT (PTL_MSG_GET == 2);
+ LASSERT (PTL_MSG_REPLY == 3);
+ LASSERT (PTL_MSG_HELLO == 4);
+
+ /* Checks for struct ptl_handle_wire_t */
+ LASSERT (sizeof (ptl_handle_wire_t) == 16);
+ LASSERT (offsetof (ptl_handle_wire_t, wh_interface_cookie) == 0);
+ LASSERT (sizeof (((ptl_handle_wire_t *)0)->wh_interface_cookie) == 8);
+ LASSERT (offsetof (ptl_handle_wire_t, wh_object_cookie) == 8);
+ LASSERT (sizeof (((ptl_handle_wire_t *)0)->wh_object_cookie) == 8);
+
+ /* Checks for struct ptl_magicversion_t */
+ LASSERT (sizeof (ptl_magicversion_t) == 8);
+ LASSERT (offsetof (ptl_magicversion_t, magic) == 0);
+ LASSERT (sizeof (((ptl_magicversion_t *)0)->magic) == 4);
+ LASSERT (offsetof (ptl_magicversion_t, version_major) == 4);
+ LASSERT (sizeof (((ptl_magicversion_t *)0)->version_major) == 2);
+ LASSERT (offsetof (ptl_magicversion_t, version_minor) == 6);
+ LASSERT (sizeof (((ptl_magicversion_t *)0)->version_minor) == 2);
+
+ /* Checks for struct ptl_hdr_t */
+ LASSERT (sizeof (ptl_hdr_t) == 72);
+ LASSERT (offsetof (ptl_hdr_t, dest_nid) == 0);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->dest_nid) == 8);
+ LASSERT (offsetof (ptl_hdr_t, src_nid) == 8);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->src_nid) == 8);
+ LASSERT (offsetof (ptl_hdr_t, dest_pid) == 16);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->dest_pid) == 4);
+ LASSERT (offsetof (ptl_hdr_t, src_pid) == 20);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->src_pid) == 4);
+ LASSERT (offsetof (ptl_hdr_t, type) == 24);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->type) == 4);
+
+ /* Ack */
+ LASSERT (offsetof (ptl_hdr_t, msg.ack.mlength) == 28);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.ack.mlength) == 4);
+ LASSERT (offsetof (ptl_hdr_t, msg.ack.dst_wmd) == 32);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.ack.dst_wmd) == 16);
+ LASSERT (offsetof (ptl_hdr_t, msg.ack.match_bits) == 48);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.ack.match_bits) == 8);
+ LASSERT (offsetof (ptl_hdr_t, msg.ack.length) == 56);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.ack.length) == 4);
+
+ /* Put */
+ LASSERT (offsetof (ptl_hdr_t, msg.put.ptl_index) == 28);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.put.ptl_index) == 4);
+ LASSERT (offsetof (ptl_hdr_t, msg.put.ack_wmd) == 32);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.put.ack_wmd) == 16);
+ LASSERT (offsetof (ptl_hdr_t, msg.put.match_bits) == 48);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.put.match_bits) == 8);
+ LASSERT (offsetof (ptl_hdr_t, msg.put.length) == 56);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.put.length) == 4);
+ LASSERT (offsetof (ptl_hdr_t, msg.put.offset) == 60);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.put.offset) == 4);
+ LASSERT (offsetof (ptl_hdr_t, msg.put.hdr_data) == 64);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.put.hdr_data) == 8);
+
+ /* Get */
+ LASSERT (offsetof (ptl_hdr_t, msg.get.ptl_index) == 28);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.get.ptl_index) == 4);
+ LASSERT (offsetof (ptl_hdr_t, msg.get.return_wmd) == 32);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.get.return_wmd) == 16);
+ LASSERT (offsetof (ptl_hdr_t, msg.get.match_bits) == 48);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.get.match_bits) == 8);
+ LASSERT (offsetof (ptl_hdr_t, msg.get.length) == 56);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.get.length) == 4);
+ LASSERT (offsetof (ptl_hdr_t, msg.get.src_offset) == 60);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.get.src_offset) == 4);
+ LASSERT (offsetof (ptl_hdr_t, msg.get.return_offset) == 64);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.get.return_offset) == 4);
+ LASSERT (offsetof (ptl_hdr_t, msg.get.sink_length) == 68);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.get.sink_length) == 4);
+
+ /* Reply */
+ LASSERT (offsetof (ptl_hdr_t, msg.reply.dst_wmd) == 32);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.reply.dst_wmd) == 16);
+ LASSERT (offsetof (ptl_hdr_t, msg.reply.dst_offset) == 48);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.reply.dst_offset) == 4);
+ LASSERT (offsetof (ptl_hdr_t, msg.reply.length) == 56);
+ LASSERT (sizeof (((ptl_hdr_t *)0)->msg.reply.length) == 4);
+}
+++ /dev/null
-AC_PREFIX_DEFAULT([])
-if test "x$prefix" = xNONE || test "x$prefix" = x; then
- usrprefix=/usr
-else
- usrprefix='${prefix}'
-fi
-AC_SUBST(usrprefix)
-
-AC_ARG_ENABLE(rtscts-myrinet, [ --enable-rtscts-myrinet enable rtscts over myrinet support])
-AM_CONDITIONAL(RTSCTS_MYRINET, test "$enable_rtscts_myrinet" = yes)
-
-
-CPLANT_ARCH=${target_cpu}
-case ${CPLANT_ARCH} in
-alpha*)
- RTSCTSLIB_CFLAGS='-O4 -mno-fp-regs'
- RTSCTSLIB_DEFS=-Ddec_linux
- ;;
-i*86)
- RTSCTSLIB_CFLAGS=-O4
- RTSCTSLIB_DEFS=-Dintel_linux
- ;;
-#*)
-# AC_MSG_ERROR([Unrecognized architecture '$CPLANT_ARCH' for rtscts])
-# ;;
-esac
-AC_SUBST(CPLANT_ARCH)
-AC_SUBST(RTSCTSLIB_CFLAGS)
-AC_SUBST(RTSCTSLIB_DEFS)
-
-AC_MSG_CHECKING(if kernel has CPU affinity support)
-if test "$target_cpu" != ia64 ; then
- enable_affinity_temp="-DCPU_AFFINITY=1"
- AC_MSG_RESULT(yes)
-else
- enable_affinity_temp=""
- AC_MSG_RESULT(no)
-fi
-AC_MSG_CHECKING(if kernel has zero-copy TCP support)
-ZCCD="`grep -c zccd $LINUX/include/linux/skbuff.h`"
-if test "$ZCCD" != 0 ; then
- enable_zerocopy_temp="-DSOCKNAL_ZC=1"
- AC_MSG_RESULT(yes)
-else
- enable_zerocopy_temp=""
- 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(affinity, [ --enable-affinity enable process/irq affinity],enable_affinity="-DCPU_AFFINITY=1", enable_affinity=$enable_affinity_temp)
-#####################################
-
-AC_MSG_CHECKING(if quadrics kernel headers are present)
-if test -d $LINUX/drivers/net/qsnet ; then
- AC_MSG_RESULT(yes)
- QSWNAL="qswnal"
- with_quadrics="-I$LINUX/drivers/net/qsnet/include"
- :
-elif test -d $LINUX/drivers/qsnet1 ; then
- AC_MSG_RESULT(yes)
- QSWNAL="qswnal"
- with_quadrics="-I$LINUX/drivers/qsnet1/include -DPROPRIETARY_ELAN"
- :
-elif test -d $LINUX/drivers/quadrics ; then
- AC_MSG_RESULT(yes)
- QSWNAL="qswnal"
- with_quadrics="-I$LINUX/drivers/quadrics/include -DPROPRIETARY_ELAN"
- :
-#elif test -d /usr/include/elan3 ; then
-# AC_MSG_RESULT(yes)
-# QSWNAL="qswnal"
-# with_quadrics=""
-# :
-else
- AC_MSG_RESULT(no)
- QSWNAL=""
- with_quadrics=""
- :
-fi
-AC_SUBST(with_quadrics)
-AC_SUBST(QSWNAL)
-
-# R. Read 5/02
-GMNAL=""
-echo "checking with-gm=" ${with_gm}
-if test "${with_gm+set}" = set; then
- if test "${with_gm}" = yes; then
- with_gm="-I/usr/local/gm/include"
- else
- with_gm=-I"$with_gm/include"
- fi
- GMNAL="gmnal"
-else
-# default case - no GM
- with_gm=""
-fi
-AC_SUBST(with_gm)
-AC_SUBST(GMNAL)
-
-
-def_scamac=/opt/scali/include
-AC_ARG_WITH(scamac, [ --with-scamac=[yes/no/path] Path to ScaMAC includes (default=/opt/scali/include)], with_scamac=$withval, with_scamac=$def_scamac)
-AC_MSG_CHECKING(if ScaMAC headers are present)
-if test "$with_scamac" = yes; then
- with_scamac=$def_scamac
-fi
-if test "$with_scamac" != no -a -f ${with_scamac}/scamac.h; then
- AC_MSG_RESULT(yes)
- SCIMACNAL="scimacnal"
- with_scamac="-I${with_scamac} -I${with_scamac}/icm"
-else
- AC_MSG_RESULT(no)
- SCIMACNAL=""
- with_scamac=""
-fi
-AC_SUBST(with_scamac)
-AC_SUBST(SCIMACNAL)
ptlctl
.deps
routerstat
+wirecheck
.*.cmd
COMPILE = gcc -Wall -g -I$(srcdir)/../include
LINK = gcc -o $@
-sbin_PROGRAMS = acceptor ptlctl debugctl routerstat
+sbin_PROGRAMS = acceptor ptlctl debugctl routerstat wirecheck
lib_LIBRARIES = libptlctl.a
acceptor_SOURCES = acceptor.c # -lefence
+wirecheck_SOURCES = wirecheck.c
+
libptlctl_a_SOURCES = portals.c debug.c l_ioctl.c parser.c parser.h
ptlctl_SOURCES = ptlctl.c
newdata = (struct portal_ioctl_data *)buf;
if (newdata->ioc_size > 0)
dump_buffer(fd, databuf, newdata->ioc_size, raw);
- else
- fprintf(stderr, "No data in the debug buffer.\n");
out:
if (databuf)
struct mod_paths {
char *name, *path;
} *mp, mod_paths[] = {
- {"portals", "portals/linux/oslib"},
- {"ksocknal", "portals/linux/socknal"},
+ {"portals", "lustre/portals/libcfs"},
+ {"ksocknal", "lustre/portals/knals/socknal"},
{"obdclass", "lustre/obdclass"},
{"ptlrpc", "lustre/ptlrpc"},
{"obdext2", "lustre/obdext2"},