From 502c17fc5451587223b1ebb38fb5b6740e3d2404 Mon Sep 17 00:00:00 2001 From: zab Date: Mon, 26 May 2003 22:50:00 +0000 Subject: [PATCH] - bring recent b_devel changes into b_ad, only minor corrections needed. the only significant of which was making sure changes in super.c made it to b_ad's llite_lib.c --- lnet/Makefile.am | 7 +- lnet/archdep.m4 | 113 ++++++++++++++++++++++++--- lnet/build.m4 | 15 +--- lnet/include/lnet/lib-lnet.h | 20 ++--- lnet/include/lnet/lib-p30.h | 20 ++--- lnet/include/lnet/lib-types.h | 23 ++++-- lnet/klnds/qswlnd/Makefile.am | 1 + lnet/lnet/api-ni.c | 25 ++++-- lnet/lnet/lib-eq.c | 2 +- lnet/lnet/lib-init.c | 16 +++- lnet/lnet/lib-md.c | 2 +- lnet/lnet/lib-me.c | 4 +- lnet/lnet/lib-move.c | 94 ++++++++++++++++++++++- lnet/portalsconf.m4 | 118 ----------------------------- lnet/utils/.cvsignore | 1 + lnet/utils/Makefile.am | 4 +- lnet/utils/debug.c | 6 +- lustre/portals/Makefile.am | 7 +- lustre/portals/archdep.m4 | 113 ++++++++++++++++++++++++--- lustre/portals/build.m4 | 15 +--- lustre/portals/include/portals/lib-p30.h | 20 ++--- lustre/portals/include/portals/lib-types.h | 23 ++++-- lustre/portals/knals/qswnal/Makefile.am | 1 + lustre/portals/portals/api-ni.c | 25 ++++-- lustre/portals/portals/lib-eq.c | 2 +- lustre/portals/portals/lib-init.c | 16 +++- lustre/portals/portals/lib-md.c | 2 +- lustre/portals/portals/lib-me.c | 4 +- lustre/portals/portals/lib-move.c | 94 ++++++++++++++++++++++- lustre/portals/portalsconf.m4 | 118 ----------------------------- lustre/portals/utils/.cvsignore | 1 + lustre/portals/utils/Makefile.am | 4 +- lustre/portals/utils/debug.c | 6 +- 33 files changed, 557 insertions(+), 365 deletions(-) delete mode 100644 lnet/portalsconf.m4 delete mode 100644 lustre/portals/portalsconf.m4 diff --git a/lnet/Makefile.am b/lnet/Makefile.am index 3c42103..9c84d8e 100644 --- a/lnet/Makefile.am +++ b/lnet/Makefile.am @@ -3,6 +3,11 @@ # 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 diff --git a/lnet/archdep.m4 b/lnet/archdep.m4 index ad00a5e..3a433be 100644 --- a/lnet/archdep.m4 +++ b/lnet/archdep.m4 @@ -57,6 +57,7 @@ case ${host_cpu} in AC_MSG_RESULT($host_cpu) KCFLAGS='-g -Wall ' KCPPFLAGS='-D__arch_lib__ ' + libdir='${exec_prefix}/lib/lustre' MOD_LINK=elf_i386 ;; um ) @@ -194,18 +195,112 @@ if test $host_cpu != "lib" ; then 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) + + diff --git a/lnet/build.m4 b/lnet/build.m4 index 4e8dbbb..025f243 100644 --- a/lnet/build.m4 +++ b/lnet/build.m4 @@ -1,5 +1,4 @@ - -# ---------- directories --------- +# ---------- other tests and settings --------- # --------- unsigned long long sane? ------- @@ -94,15 +93,3 @@ fi 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. ----------------- - - diff --git a/lnet/include/lnet/lib-lnet.h b/lnet/include/lnet/lib-lnet.h index ec3393b..4a61e76 100644 --- a/lnet/include/lnet/lib-lnet.h +++ b/lnet/include/lnet/lib-lnet.h @@ -264,8 +264,8 @@ lib_msg_free(nal_cb_t *nal, lib_msg_t *msg) } #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 @@ -278,8 +278,8 @@ static inline lib_eq_t * 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); @@ -296,8 +296,8 @@ static inline lib_md_t * 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); @@ -313,7 +313,8 @@ ptl_wire_handle2md (ptl_handle_wire_t *wh, nal_cb_t *nal) 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); @@ -330,8 +331,8 @@ static inline lib_me_t * 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); @@ -369,6 +370,7 @@ extern void lib_copy_buf2iov (int niov, struct iovec *iov, char *dest, ptl_size_ 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); diff --git a/lnet/include/lnet/lib-p30.h b/lnet/include/lnet/lib-p30.h index ec3393b..4a61e76 100644 --- a/lnet/include/lnet/lib-p30.h +++ b/lnet/include/lnet/lib-p30.h @@ -264,8 +264,8 @@ lib_msg_free(nal_cb_t *nal, lib_msg_t *msg) } #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 @@ -278,8 +278,8 @@ static inline lib_eq_t * 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); @@ -296,8 +296,8 @@ static inline lib_md_t * 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); @@ -313,7 +313,8 @@ ptl_wire_handle2md (ptl_handle_wire_t *wh, nal_cb_t *nal) 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); @@ -330,8 +331,8 @@ static inline lib_me_t * 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); @@ -369,6 +370,7 @@ extern void lib_copy_buf2iov (int niov, struct iovec *iov, char *dest, ptl_size_ 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); diff --git a/lnet/include/lnet/lib-types.h b/lnet/include/lnet/lib-types.h index 08ea118..47c0dd2 100644 --- a/lnet/include/lnet/lib-types.h +++ b/lnet/include/lnet/lib-types.h @@ -31,6 +31,8 @@ typedef struct lib_me_t lib_me_t; 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 @@ -38,7 +40,7 @@ typedef struct lib_eq_t lib_eq_t; 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 \ @@ -63,7 +65,7 @@ typedef struct ptl_ack { 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; @@ -72,7 +74,7 @@ typedef struct ptl_put { 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; @@ -82,7 +84,7 @@ typedef struct ptl_get { 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 */ @@ -90,7 +92,7 @@ typedef struct ptl_reply { 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; @@ -104,7 +106,7 @@ typedef struct { 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 */ @@ -122,7 +124,7 @@ typedef struct { __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 @@ -241,6 +243,13 @@ typedef struct { 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; diff --git a/lnet/klnds/qswlnd/Makefile.am b/lnet/klnds/qswlnd/Makefile.am index 6759b96..3eb4dd5 100644 --- a/lnet/klnds/qswlnd/Makefile.am +++ b/lnet/klnds/qswlnd/Makefile.am @@ -13,4 +13,5 @@ EXTRA_PROGRAMS = kqswnal #CFLAGS:= @KCFLAGS@ #CPPFLAGS:=@KCPPFLAGS@ DEFS = +CPPFLAGS=@CPPFLAGS@ @with_quadrics@ kqswnal_SOURCES = qswnal.c qswnal_cb.c qswnal.h diff --git a/lnet/lnet/api-ni.c b/lnet/lnet/api-ni.c index 1957822..b2e069e 100644 --- a/lnet/lnet/api-ni.c +++ b/lnet/lnet/api-ni.c @@ -25,7 +25,11 @@ #include -#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; @@ -37,7 +41,11 @@ nal_t *ptl_hndl2nal(ptl_handle_any_t *handle) * 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]; @@ -48,6 +56,8 @@ int ptl_ni_init(void) { int i; + LASSERT (MAX_NIS <= (NI_HANDLE_MASK + 1)); + for (i = 0; i < MAX_NIS; i++) ptl_interfaces[i] = NULL; @@ -114,7 +124,7 @@ int PtlNIInit(ptl_interface_t interface, ptl_pt_index_t ptl_size, 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; @@ -122,7 +132,6 @@ int PtlNIInit(ptl_interface_t interface, ptl_pt_index_t ptl_size, } nal->refct = 1; - handle->nal_idx = ptl_num_interfaces; if (ptl_num_interfaces >= MAX_NIS) { if (nal->shutdown) nal->shutdown (nal, ptl_num_interfaces); @@ -130,6 +139,7 @@ int PtlNIInit(ptl_interface_t interface, ptl_pt_index_t ptl_size, 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); @@ -143,6 +153,7 @@ int PtlNIInit(ptl_interface_t interface, ptl_pt_index_t ptl_size, int PtlNIFini(ptl_handle_ni_t ni) { nal_t *nal; + int idx; int rc; if (!ptl_init) @@ -156,6 +167,8 @@ int PtlNIFini(ptl_handle_ni_t ni) return PTL_INV_HANDLE; } + idx = ni.nal_idx & NI_HANDLE_MASK; + nal->refct--; if (nal->refct > 0) { ptl_ni_init_mutex_exit (); @@ -167,9 +180,9 @@ int PtlNIFini(ptl_handle_ni_t ni) 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 (); diff --git a/lnet/lnet/lib-eq.c b/lnet/lnet/lib-eq.c index 6238895..ce343c1 100644 --- a/lnet/lnet/lib-eq.c +++ b/lnet/lnet/lib-eq.c @@ -76,7 +76,7 @@ int do_PtlEQAlloc_internal(nal_cb_t * nal, void *private, void *v_args, 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); diff --git a/lnet/lnet/lib-init.c b/lnet/lnet/lib-init.c index 2df4120..99c4d32 100644 --- a/lnet/lnet/lib-init.c +++ b/lnet/lnet/lib-init.c @@ -278,7 +278,7 @@ lib_setup_handle_hash (nal_cb_t *nal) 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); } @@ -296,7 +296,7 @@ lib_cleanup_handle_hash (nal_cb_t *nal) } 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; @@ -304,6 +304,9 @@ lib_lookup_cookie (nal_cb_t *nal, __u64 cookie) 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]; @@ -318,13 +321,16 @@ lib_lookup_cookie (nal_cb_t *nal, __u64 cookie) } 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]); } @@ -351,6 +357,8 @@ lib_init(nal_cb_t * nal, ptl_nid_t nid, ptl_pid_t pid, int gsize, goto out; } + lib_assert_wire_constants (); + /* * Allocate the portal table for this interface * and all per-interface objects. diff --git a/lnet/lnet/lib-md.c b/lnet/lnet/lib-md.c index 2ca200b..a79e2be 100644 --- a/lnet/lnet/lib-md.c +++ b/lnet/lnet/lib-md.c @@ -197,7 +197,7 @@ static int lib_md_build(nal_cb_t *nal, lib_md_t *new, void *private, 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; diff --git a/lnet/lnet/lib-me.c b/lnet/lnet/lib-me.c index 5a80e0a..bd1af5b 100644 --- a/lnet/lnet/lib-me.c +++ b/lnet/lnet/lib-me.c @@ -63,7 +63,7 @@ int do_PtlMEAttach(nal_cb_t * nal, void *private, void *v_args, void *v_ret) 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])); @@ -107,7 +107,7 @@ int do_PtlMEInsert(nal_cb_t * nal, void *private, void *v_args, void *v_ret) 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); diff --git a/lnet/lnet/lib-move.c b/lnet/lnet/lib-move.c index 413f74e..fde4f16 100644 --- a/lnet/lnet/lib-move.c +++ b/lnet/lnet/lib-move.c @@ -871,7 +871,7 @@ static int parse_ack(nal_cb_t * nal, ptl_hdr_t * hdr, void *private) /* 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, @@ -1285,3 +1285,95 @@ int do_PtlGet(nal_cb_t * nal, void *private, void *v_args, void *v_ret) 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); +} diff --git a/lnet/portalsconf.m4 b/lnet/portalsconf.m4 deleted file mode 100644 index 7bd3919..0000000 --- a/lnet/portalsconf.m4 +++ /dev/null @@ -1,118 +0,0 @@ -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) diff --git a/lnet/utils/.cvsignore b/lnet/utils/.cvsignore index bf37bf4..8e474ad 100644 --- a/lnet/utils/.cvsignore +++ b/lnet/utils/.cvsignore @@ -5,4 +5,5 @@ debugctl ptlctl .deps routerstat +wirecheck .*.cmd diff --git a/lnet/utils/Makefile.am b/lnet/utils/Makefile.am index 065fcf9..05af598 100644 --- a/lnet/utils/Makefile.am +++ b/lnet/utils/Makefile.am @@ -7,11 +7,13 @@ 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 diff --git a/lnet/utils/debug.c b/lnet/utils/debug.c index 13572dc..9ab1c73d 100644 --- a/lnet/utils/debug.c +++ b/lnet/utils/debug.c @@ -319,8 +319,6 @@ int jt_dbg_debug_kernel(int argc, char **argv) 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) @@ -532,8 +530,8 @@ int jt_dbg_modules(int argc, char **argv) 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"}, diff --git a/lustre/portals/Makefile.am b/lustre/portals/Makefile.am index 3c42103..9c84d8e 100644 --- a/lustre/portals/Makefile.am +++ b/lustre/portals/Makefile.am @@ -3,6 +3,11 @@ # 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 diff --git a/lustre/portals/archdep.m4 b/lustre/portals/archdep.m4 index ad00a5e..3a433be 100644 --- a/lustre/portals/archdep.m4 +++ b/lustre/portals/archdep.m4 @@ -57,6 +57,7 @@ case ${host_cpu} in AC_MSG_RESULT($host_cpu) KCFLAGS='-g -Wall ' KCPPFLAGS='-D__arch_lib__ ' + libdir='${exec_prefix}/lib/lustre' MOD_LINK=elf_i386 ;; um ) @@ -194,18 +195,112 @@ if test $host_cpu != "lib" ; then 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) + + diff --git a/lustre/portals/build.m4 b/lustre/portals/build.m4 index 4e8dbbb..025f243 100644 --- a/lustre/portals/build.m4 +++ b/lustre/portals/build.m4 @@ -1,5 +1,4 @@ - -# ---------- directories --------- +# ---------- other tests and settings --------- # --------- unsigned long long sane? ------- @@ -94,15 +93,3 @@ fi 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. ----------------- - - diff --git a/lustre/portals/include/portals/lib-p30.h b/lustre/portals/include/portals/lib-p30.h index ec3393b..4a61e76 100644 --- a/lustre/portals/include/portals/lib-p30.h +++ b/lustre/portals/include/portals/lib-p30.h @@ -264,8 +264,8 @@ lib_msg_free(nal_cb_t *nal, lib_msg_t *msg) } #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 @@ -278,8 +278,8 @@ static inline lib_eq_t * 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); @@ -296,8 +296,8 @@ static inline lib_md_t * 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); @@ -313,7 +313,8 @@ ptl_wire_handle2md (ptl_handle_wire_t *wh, nal_cb_t *nal) 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); @@ -330,8 +331,8 @@ static inline lib_me_t * 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); @@ -369,6 +370,7 @@ extern void lib_copy_buf2iov (int niov, struct iovec *iov, char *dest, ptl_size_ 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); diff --git a/lustre/portals/include/portals/lib-types.h b/lustre/portals/include/portals/lib-types.h index 08ea118..47c0dd2 100644 --- a/lustre/portals/include/portals/lib-types.h +++ b/lustre/portals/include/portals/lib-types.h @@ -31,6 +31,8 @@ typedef struct lib_me_t lib_me_t; 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 @@ -38,7 +40,7 @@ typedef struct lib_eq_t lib_eq_t; 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 \ @@ -63,7 +65,7 @@ typedef struct ptl_ack { 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; @@ -72,7 +74,7 @@ typedef struct ptl_put { 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; @@ -82,7 +84,7 @@ typedef struct ptl_get { 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 */ @@ -90,7 +92,7 @@ typedef struct ptl_reply { 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; @@ -104,7 +106,7 @@ typedef struct { 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 */ @@ -122,7 +124,7 @@ typedef struct { __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 @@ -241,6 +243,13 @@ typedef struct { 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; diff --git a/lustre/portals/knals/qswnal/Makefile.am b/lustre/portals/knals/qswnal/Makefile.am index 6759b96..3eb4dd5 100644 --- a/lustre/portals/knals/qswnal/Makefile.am +++ b/lustre/portals/knals/qswnal/Makefile.am @@ -13,4 +13,5 @@ EXTRA_PROGRAMS = kqswnal #CFLAGS:= @KCFLAGS@ #CPPFLAGS:=@KCPPFLAGS@ DEFS = +CPPFLAGS=@CPPFLAGS@ @with_quadrics@ kqswnal_SOURCES = qswnal.c qswnal_cb.c qswnal.h diff --git a/lustre/portals/portals/api-ni.c b/lustre/portals/portals/api-ni.c index 1957822..b2e069e 100644 --- a/lustre/portals/portals/api-ni.c +++ b/lustre/portals/portals/api-ni.c @@ -25,7 +25,11 @@ #include -#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; @@ -37,7 +41,11 @@ nal_t *ptl_hndl2nal(ptl_handle_any_t *handle) * 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]; @@ -48,6 +56,8 @@ int ptl_ni_init(void) { int i; + LASSERT (MAX_NIS <= (NI_HANDLE_MASK + 1)); + for (i = 0; i < MAX_NIS; i++) ptl_interfaces[i] = NULL; @@ -114,7 +124,7 @@ int PtlNIInit(ptl_interface_t interface, ptl_pt_index_t ptl_size, 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; @@ -122,7 +132,6 @@ int PtlNIInit(ptl_interface_t interface, ptl_pt_index_t ptl_size, } nal->refct = 1; - handle->nal_idx = ptl_num_interfaces; if (ptl_num_interfaces >= MAX_NIS) { if (nal->shutdown) nal->shutdown (nal, ptl_num_interfaces); @@ -130,6 +139,7 @@ int PtlNIInit(ptl_interface_t interface, ptl_pt_index_t ptl_size, 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); @@ -143,6 +153,7 @@ int PtlNIInit(ptl_interface_t interface, ptl_pt_index_t ptl_size, int PtlNIFini(ptl_handle_ni_t ni) { nal_t *nal; + int idx; int rc; if (!ptl_init) @@ -156,6 +167,8 @@ int PtlNIFini(ptl_handle_ni_t ni) return PTL_INV_HANDLE; } + idx = ni.nal_idx & NI_HANDLE_MASK; + nal->refct--; if (nal->refct > 0) { ptl_ni_init_mutex_exit (); @@ -167,9 +180,9 @@ int PtlNIFini(ptl_handle_ni_t ni) 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 (); diff --git a/lustre/portals/portals/lib-eq.c b/lustre/portals/portals/lib-eq.c index 6238895..ce343c1 100644 --- a/lustre/portals/portals/lib-eq.c +++ b/lustre/portals/portals/lib-eq.c @@ -76,7 +76,7 @@ int do_PtlEQAlloc_internal(nal_cb_t * nal, void *private, void *v_args, 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); diff --git a/lustre/portals/portals/lib-init.c b/lustre/portals/portals/lib-init.c index 2df4120..99c4d32 100644 --- a/lustre/portals/portals/lib-init.c +++ b/lustre/portals/portals/lib-init.c @@ -278,7 +278,7 @@ lib_setup_handle_hash (nal_cb_t *nal) 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); } @@ -296,7 +296,7 @@ lib_cleanup_handle_hash (nal_cb_t *nal) } 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; @@ -304,6 +304,9 @@ lib_lookup_cookie (nal_cb_t *nal, __u64 cookie) 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]; @@ -318,13 +321,16 @@ lib_lookup_cookie (nal_cb_t *nal, __u64 cookie) } 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]); } @@ -351,6 +357,8 @@ lib_init(nal_cb_t * nal, ptl_nid_t nid, ptl_pid_t pid, int gsize, goto out; } + lib_assert_wire_constants (); + /* * Allocate the portal table for this interface * and all per-interface objects. diff --git a/lustre/portals/portals/lib-md.c b/lustre/portals/portals/lib-md.c index 2ca200b..a79e2be 100644 --- a/lustre/portals/portals/lib-md.c +++ b/lustre/portals/portals/lib-md.c @@ -197,7 +197,7 @@ static int lib_md_build(nal_cb_t *nal, lib_md_t *new, void *private, 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; diff --git a/lustre/portals/portals/lib-me.c b/lustre/portals/portals/lib-me.c index 5a80e0a..bd1af5b 100644 --- a/lustre/portals/portals/lib-me.c +++ b/lustre/portals/portals/lib-me.c @@ -63,7 +63,7 @@ int do_PtlMEAttach(nal_cb_t * nal, void *private, void *v_args, void *v_ret) 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])); @@ -107,7 +107,7 @@ int do_PtlMEInsert(nal_cb_t * nal, void *private, void *v_args, void *v_ret) 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); diff --git a/lustre/portals/portals/lib-move.c b/lustre/portals/portals/lib-move.c index 413f74e..fde4f16 100644 --- a/lustre/portals/portals/lib-move.c +++ b/lustre/portals/portals/lib-move.c @@ -871,7 +871,7 @@ static int parse_ack(nal_cb_t * nal, ptl_hdr_t * hdr, void *private) /* 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, @@ -1285,3 +1285,95 @@ int do_PtlGet(nal_cb_t * nal, void *private, void *v_args, void *v_ret) 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); +} diff --git a/lustre/portals/portalsconf.m4 b/lustre/portals/portalsconf.m4 deleted file mode 100644 index 7bd3919..0000000 --- a/lustre/portals/portalsconf.m4 +++ /dev/null @@ -1,118 +0,0 @@ -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) diff --git a/lustre/portals/utils/.cvsignore b/lustre/portals/utils/.cvsignore index bf37bf4..8e474ad 100644 --- a/lustre/portals/utils/.cvsignore +++ b/lustre/portals/utils/.cvsignore @@ -5,4 +5,5 @@ debugctl ptlctl .deps routerstat +wirecheck .*.cmd diff --git a/lustre/portals/utils/Makefile.am b/lustre/portals/utils/Makefile.am index 065fcf9..05af598 100644 --- a/lustre/portals/utils/Makefile.am +++ b/lustre/portals/utils/Makefile.am @@ -7,11 +7,13 @@ 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 diff --git a/lustre/portals/utils/debug.c b/lustre/portals/utils/debug.c index 13572dc..9ab1c73d 100644 --- a/lustre/portals/utils/debug.c +++ b/lustre/portals/utils/debug.c @@ -319,8 +319,6 @@ int jt_dbg_debug_kernel(int argc, char **argv) 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) @@ -532,8 +530,8 @@ int jt_dbg_modules(int argc, char **argv) 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"}, -- 1.8.3.1