AM_INIT_AUTOMAKE(portals, builtin([esyscmd], [sed -ne '/.*define IVERSION /{ s/.*IVERSION //; p; }' libcfs/module.c]))
# AM_MAINTAINER_MODE
-sinclude(archdep.m4)
sinclude(build.m4)
-sinclude<portalsconf.m4)
+sinclude(archdep.m4)
+sinclude(portalsconf.m4)
if test x$enable_inkernel = xyes ; then
cp Kernelenv.mk Kernelenv.in
#define D_RPCTRACE (1 << 20) /* for distributed debugging */
#define D_VFSTRACE (1 << 21)
-#ifndef THREAD_SIZE
+#ifndef __KERNEL__
#define THREAD_SIZE 8192
#endif
#ifdef __arch_ia64__
}
#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);
}
#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);
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
* Copyright (c) 2001-2003 Cluster File Systems, Inc.
* Copyright (c) 2001-2002 Sandia National Laboratories
*
- * This file is part of Portals, http://www.sf.net/projects/sandiaportals/
+ * This file is part of Lustre, http://www.sf.net/projects/lustre/
*
- * Portals is free software; you can redistribute it and/or
- * modify it under the terms of version 2.1 of the GNU Lesser General
- * Public License as published by the Free Software Foundation.
+ * Lustre is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
*
- * Portals is distributed in the hope that it will be useful,
+ * Lustre is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with Portals; if not, write to the Free Software
+ * You should have received a copy of the GNU General Public License
+ * along with Lustre; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
* Copyright (c) 2001-2003 Cluster File Systems, Inc.
* Copyright (c) 2001-2002 Sandia National Laboratories
*
- * This file is part of Portals, http://www.sf.net/projects/sandiaportals/
+ * This file is part of Lustre, http://www.sf.net/projects/lustre/
*
- * Portals is free software; you can redistribute it and/or
- * modify it under the terms of version 2.1 of the GNU Lesser General
- * Public License as published by the Free Software Foundation.
+ * Lustre is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
*
- * Portals is distributed in the hope that it will be useful,
+ * Lustre is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with Portals; if not, write to the Free Software
+ * You should have received a copy of the GNU General Public License
+ * along with Lustre; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#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 ();
* Copyright (c) 2001-2003 Cluster File Systems, Inc.
* Copyright (c) 2001-2002 Sandia National Laboratories
*
- * This file is part of Portals, http://www.sf.net/projects/sandiaportals/
+ * This file is part of Lustre, http://www.sf.net/projects/lustre/
*
- * Portals is free software; you can redistribute it and/or
- * modify it under the terms of version 2.1 of the GNU Lesser General
- * Public License as published by the Free Software Foundation.
+ * Lustre is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
*
- * Portals is distributed in the hope that it will be useful,
+ * Lustre is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with Portals; if not, write to the Free Software
+ * You should have received a copy of the GNU General Public License
+ * along with Lustre; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
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);
* Copyright (c) 2001-2003 Cluster File Systems, Inc.
* Copyright (c) 2001-2002 Sandia National Laboratories
*
- * This file is part of Portals, http://www.sf.net/projects/sandiaportals/
+ * This file is part of Lustre, http://www.sf.net/projects/lustre/
*
- * Portals is free software; you can redistribute it and/or
- * modify it under the terms of version 2.1 of the GNU Lesser General
- * Public License as published by the Free Software Foundation.
+ * Lustre is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
*
- * Portals is distributed in the hope that it will be useful,
+ * Lustre is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with Portals; if not, write to the Free Software
+ * You should have received a copy of the GNU General Public License
+ * along with Lustre; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
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]);
}
* Copyright (c) 2001-2003 Cluster File Systems, Inc.
* Copyright (c) 2001-2002 Sandia National Laboratories
*
- * This file is part of Portals, http://www.sf.net/projects/sandiaportals/
+ * This file is part of Lustre, http://www.sf.net/projects/lustre/
*
- * Portals is free software; you can redistribute it and/or
- * modify it under the terms of version 2.1 of the GNU Lesser General
- * Public License as published by the Free Software Foundation.
+ * Lustre is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
*
- * Portals is distributed in the hope that it will be useful,
+ * Lustre is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with Portals; if not, write to the Free Software
+ * You should have received a copy of the GNU General Public License
+ * along with Lustre; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
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;
* Copyright (c) 2001-2003 Cluster File Systems, Inc.
* Copyright (c) 2001-2002 Sandia National Laboratories
*
- * This file is part of Portals, http://www.sf.net/projects/sandiaportals/
+ * This file is part of Lustre, http://www.sf.net/projects/lustre/
*
- * Portals is free software; you can redistribute it and/or
- * modify it under the terms of version 2.1 of the GNU Lesser General
- * Public License as published by the Free Software Foundation.
+ * Lustre is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
*
- * Portals is distributed in the hope that it will be useful,
+ * Lustre is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with Portals; if not, write to the Free Software
+ * You should have received a copy of the GNU General Public License
+ * along with Lustre; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
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);
* Copyright (c) 2001-2003 Cluster File Systems, Inc.
* Copyright (c) 2001-2002 Sandia National Laboratories
*
- * This file is part of Portals, http://www.sf.net/projects/sandiaportals/
+ * This file is part of Lustre, http://www.sf.net/projects/lustre/
*
- * Portals is free software; you can redistribute it and/or
- * modify it under the terms of version 2.1 of the GNU Lesser General
- * Public License as published by the Free Software Foundation.
+ * Lustre is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
*
- * Portals is distributed in the hope that it will be useful,
+ * Lustre is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with Portals; if not, write to the Free Software
+ * You should have received a copy of the GNU General Public License
+ * along with Lustre; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
AC_MSG_CHECKING(if quadrics kernel headers are present)
if test -d $LINUX/drivers/net/qsnet ; then
AC_MSG_RESULT(yes)
- QSWNAL="rqswnal"
+ QSWNAL="qswnal"
with_quadrics="-I$LINUX/drivers/net/qsnet/include"
:
elif test -d $LINUX/drivers/qsnet1 ; then
AC_MSG_RESULT(yes)
- QSWNAL="rqswnal"
+ QSWNAL="qswnal"
with_quadrics="-I$LINUX/drivers/qsnet1/include -DPROPRIETARY_ELAN"
:
elif test -d $LINUX/drivers/quadrics ; then
AC_MSG_RESULT(yes)
- QSWNAL="rqswnal"
+ QSWNAL="qswnal"
with_quadrics="-I$LINUX/drivers/quadrics/include -DPROPRIETARY_ELAN"
:
#elif test -d /usr/include/elan3 ; then
# AC_MSG_RESULT(yes)
-# QSWNAL="rqswnal"
+# QSWNAL="qswnal"
# with_quadrics=""
# :
else
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"},
AM_INIT_AUTOMAKE(portals, builtin([esyscmd], [sed -ne '/.*define IVERSION /{ s/.*IVERSION //; p; }' libcfs/module.c]))
# AM_MAINTAINER_MODE
-sinclude(archdep.m4)
sinclude(build.m4)
-sinclude<portalsconf.m4)
+sinclude(archdep.m4)
+sinclude(portalsconf.m4)
if test x$enable_inkernel = xyes ; then
cp Kernelenv.mk Kernelenv.in
#define D_RPCTRACE (1 << 20) /* for distributed debugging */
#define D_VFSTRACE (1 << 21)
-#ifndef THREAD_SIZE
+#ifndef __KERNEL__
#define THREAD_SIZE 8192
#endif
#ifdef __arch_ia64__
}
#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);
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
* Copyright (c) 2001-2003 Cluster File Systems, Inc.
* Copyright (c) 2001-2002 Sandia National Laboratories
*
- * This file is part of Portals, http://www.sf.net/projects/sandiaportals/
+ * This file is part of Lustre, http://www.sf.net/projects/lustre/
*
- * Portals is free software; you can redistribute it and/or
- * modify it under the terms of version 2.1 of the GNU Lesser General
- * Public License as published by the Free Software Foundation.
+ * Lustre is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
*
- * Portals is distributed in the hope that it will be useful,
+ * Lustre is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with Portals; if not, write to the Free Software
+ * You should have received a copy of the GNU General Public License
+ * along with Lustre; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
* Copyright (c) 2001-2003 Cluster File Systems, Inc.
* Copyright (c) 2001-2002 Sandia National Laboratories
*
- * This file is part of Portals, http://www.sf.net/projects/sandiaportals/
+ * This file is part of Lustre, http://www.sf.net/projects/lustre/
*
- * Portals is free software; you can redistribute it and/or
- * modify it under the terms of version 2.1 of the GNU Lesser General
- * Public License as published by the Free Software Foundation.
+ * Lustre is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
*
- * Portals is distributed in the hope that it will be useful,
+ * Lustre is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with Portals; if not, write to the Free Software
+ * You should have received a copy of the GNU General Public License
+ * along with Lustre; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#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 ();
* Copyright (c) 2001-2003 Cluster File Systems, Inc.
* Copyright (c) 2001-2002 Sandia National Laboratories
*
- * This file is part of Portals, http://www.sf.net/projects/sandiaportals/
+ * This file is part of Lustre, http://www.sf.net/projects/lustre/
*
- * Portals is free software; you can redistribute it and/or
- * modify it under the terms of version 2.1 of the GNU Lesser General
- * Public License as published by the Free Software Foundation.
+ * Lustre is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
*
- * Portals is distributed in the hope that it will be useful,
+ * Lustre is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with Portals; if not, write to the Free Software
+ * You should have received a copy of the GNU General Public License
+ * along with Lustre; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
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);
* Copyright (c) 2001-2003 Cluster File Systems, Inc.
* Copyright (c) 2001-2002 Sandia National Laboratories
*
- * This file is part of Portals, http://www.sf.net/projects/sandiaportals/
+ * This file is part of Lustre, http://www.sf.net/projects/lustre/
*
- * Portals is free software; you can redistribute it and/or
- * modify it under the terms of version 2.1 of the GNU Lesser General
- * Public License as published by the Free Software Foundation.
+ * Lustre is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
*
- * Portals is distributed in the hope that it will be useful,
+ * Lustre is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with Portals; if not, write to the Free Software
+ * You should have received a copy of the GNU General Public License
+ * along with Lustre; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
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]);
}
* Copyright (c) 2001-2003 Cluster File Systems, Inc.
* Copyright (c) 2001-2002 Sandia National Laboratories
*
- * This file is part of Portals, http://www.sf.net/projects/sandiaportals/
+ * This file is part of Lustre, http://www.sf.net/projects/lustre/
*
- * Portals is free software; you can redistribute it and/or
- * modify it under the terms of version 2.1 of the GNU Lesser General
- * Public License as published by the Free Software Foundation.
+ * Lustre is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
*
- * Portals is distributed in the hope that it will be useful,
+ * Lustre is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with Portals; if not, write to the Free Software
+ * You should have received a copy of the GNU General Public License
+ * along with Lustre; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
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;
* Copyright (c) 2001-2003 Cluster File Systems, Inc.
* Copyright (c) 2001-2002 Sandia National Laboratories
*
- * This file is part of Portals, http://www.sf.net/projects/sandiaportals/
+ * This file is part of Lustre, http://www.sf.net/projects/lustre/
*
- * Portals is free software; you can redistribute it and/or
- * modify it under the terms of version 2.1 of the GNU Lesser General
- * Public License as published by the Free Software Foundation.
+ * Lustre is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
*
- * Portals is distributed in the hope that it will be useful,
+ * Lustre is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with Portals; if not, write to the Free Software
+ * You should have received a copy of the GNU General Public License
+ * along with Lustre; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
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);
* Copyright (c) 2001-2003 Cluster File Systems, Inc.
* Copyright (c) 2001-2002 Sandia National Laboratories
*
- * This file is part of Portals, http://www.sf.net/projects/sandiaportals/
+ * This file is part of Lustre, http://www.sf.net/projects/lustre/
*
- * Portals is free software; you can redistribute it and/or
- * modify it under the terms of version 2.1 of the GNU Lesser General
- * Public License as published by the Free Software Foundation.
+ * Lustre is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
*
- * Portals is distributed in the hope that it will be useful,
+ * Lustre is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License for more details.
+ * GNU General Public License for more details.
*
- * You should have received a copy of the GNU Lesser General Public
- * License along with Portals; if not, write to the Free Software
+ * You should have received a copy of the GNU General Public License
+ * along with Lustre; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
AC_MSG_CHECKING(if quadrics kernel headers are present)
if test -d $LINUX/drivers/net/qsnet ; then
AC_MSG_RESULT(yes)
- QSWNAL="rqswnal"
+ QSWNAL="qswnal"
with_quadrics="-I$LINUX/drivers/net/qsnet/include"
:
elif test -d $LINUX/drivers/qsnet1 ; then
AC_MSG_RESULT(yes)
- QSWNAL="rqswnal"
+ QSWNAL="qswnal"
with_quadrics="-I$LINUX/drivers/qsnet1/include -DPROPRIETARY_ELAN"
:
elif test -d $LINUX/drivers/quadrics ; then
AC_MSG_RESULT(yes)
- QSWNAL="rqswnal"
+ QSWNAL="qswnal"
with_quadrics="-I$LINUX/drivers/quadrics/include -DPROPRIETARY_ELAN"
:
#elif test -d /usr/include/elan3 ; then
# AC_MSG_RESULT(yes)
-# QSWNAL="rqswnal"
+# QSWNAL="qswnal"
# with_quadrics=""
# :
else
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"},