You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(26) |
Aug
(122) |
Sep
(89) |
Oct
(123) |
Nov
(76) |
Dec
(190) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(70) |
Feb
(224) |
Mar
(148) |
Apr
(48) |
May
(36) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Kevin P. <ped...@us...> - 2003-06-03 17:36:01
|
Update of /cvsroot/sandiaportals/portals/include/portals In directory sc8-pr-cvs1:/tmp/cvs-serv18844 Modified Files: Tag: Portals_Update-branch arg-blocks.h Log Message: Fix compile of Portals_Update-branch Index: arg-blocks.h =================================================================== RCS file: /cvsroot/sandiaportals/portals/include/portals/arg-blocks.h,v retrieving revision 1.9.2.1 retrieving revision 1.9.2.2 diff -u -w -b -B -p -r1.9.2.1 -r1.9.2.2 --- arg-blocks.h 21 Nov 2002 00:45:46 -0000 1.9.2.1 +++ arg-blocks.h 3 Jun 2003 17:35:57 -0000 1.9.2.2 @@ -192,6 +192,7 @@ typedef struct PtlMDUpdate_internal_in { int old_inout_valid; ptl_md_t new_inout; int new_inout_valid; + ptl_handle_eq_t new_eq; } PtlMDUpdate_internal_in; typedef struct PtlMDUpdate_internal_out { |
From: Phil S. <ps...@us...> - 2003-05-18 23:21:08
|
Update of /cvsroot/sandiaportals/portals/lib In directory sc8-pr-cvs1:/tmp/cvs-serv11612/lib Modified Files: Tag: b_proto lib-move.c Log Message: Quiet the "dropping ACK" CERROR to a CDEBUG, now that we cause it a lot Index: lib-move.c =================================================================== RCS file: /cvsroot/sandiaportals/portals/lib/lib-move.c,v retrieving revision 1.52.2.5.2.2 retrieving revision 1.52.2.5.2.3 diff -u -w -b -B -p -r1.52.2.5.2.2 -r1.52.2.5.2.3 --- lib-move.c 18 May 2003 15:50:31 -0000 1.52.2.5.2.2 +++ lib-move.c 18 May 2003 23:20:34 -0000 1.52.2.5.2.3 @@ -871,7 +871,8 @@ static int parse_ack(nal_cb_t * nal, ptl /* 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 " + /* Lustre does this frequently, so don't CERROR */ + 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, |
From: Phil S. <ps...@us...> - 2003-05-18 15:50:34
|
Update of /cvsroot/sandiaportals/portals/lib In directory sc8-pr-cvs1:/tmp/cvs-serv15057/lib Modified Files: Tag: b_proto lib-move.c Log Message: Merging b_devel into b_proto, 20030518 Index: lib-move.c =================================================================== RCS file: /cvsroot/sandiaportals/portals/lib/lib-move.c,v retrieving revision 1.52.2.5.2.1 retrieving revision 1.52.2.5.2.2 diff -u -w -b -B -p -r1.52.2.5.2.1 -r1.52.2.5.2.2 --- lib-move.c 15 May 2003 20:03:15 -0000 1.52.2.5.2.1 +++ lib-move.c 18 May 2003 15:50:31 -0000 1.52.2.5.2.2 @@ -544,6 +544,7 @@ get_new_msg (nal_cb_t *nal, lib_md_t *md msg->send_ack = 0; msg->md = md; + msg->ev.arrival_time = get_cycles(); md->pending++; if (md->threshold != PTL_MD_THRESH_INF) { LASSERT (md->threshold > 0); |
From: Phil S. <ps...@us...> - 2003-05-18 15:50:34
|
Update of /cvsroot/sandiaportals/portals/include/portals In directory sc8-pr-cvs1:/tmp/cvs-serv15057/include/portals Modified Files: Tag: b_proto types.h Log Message: Merging b_devel into b_proto, 20030518 Index: types.h =================================================================== RCS file: /cvsroot/sandiaportals/portals/include/portals/types.h,v retrieving revision 1.31.2.2.6.1 retrieving revision 1.31.2.2.6.2 diff -u -w -b -B -p -r1.31.2.2.6.1 -r1.31.2.2.6.2 --- types.h 15 May 2003 20:03:15 -0000 1.31.2.2.6.1 +++ types.h 18 May 2003 15:50:31 -0000 1.31.2.2.6.2 @@ -3,10 +3,13 @@ #ifdef __linux__ #include <asm/types.h> +#include <asm/timex.h> #else #include <sys/types.h> typedef u_int32_t __u32; typedef u_int64_t __u64; +typedef unsigned long long cycles_t; +static inline cycles_t get_cycles(void) { return 0; } #endif typedef __u64 ptl_nid_t; @@ -105,6 +108,7 @@ typedef struct { ptl_handle_me_t unlinked_me; ptl_md_t mem_desc; ptl_hdr_data_t hdr_data; + cycles_t arrival_time; volatile ptl_seq_t sequence; } ptl_event_t; |
From: Robert R. <rr...@us...> - 2003-05-16 20:32:33
|
Update of /cvsroot/sandiaportals/portals/linux/oslib In directory sc8-pr-cvs1:/tmp/cvs-serv14671/linux/oslib Modified Files: Tag: b_proto debug.c Log Message: - fix warning and add a newline to the right debug daemon message Index: debug.c =================================================================== RCS file: /cvsroot/sandiaportals/portals/linux/oslib/debug.c,v retrieving revision 1.46.2.13 retrieving revision 1.46.2.13.2.1 diff -u -w -b -B -p -r1.46.2.13 -r1.46.2.13.2.1 --- debug.c 14 May 2003 17:22:52 -0000 1.46.2.13 +++ debug.c 16 May 2003 20:32:29 -0000 1.46.2.13.2.1 @@ -24,6 +24,7 @@ #include <linux/config.h> #include <linux/module.h> +#include <linux/kmod.h> #include <linux/notifier.h> #include <linux/kernel.h> #include <linux/kernel.h> @@ -288,7 +289,7 @@ int portals_debug_daemon(void *arg) CERROR("cannot open %s for logging", debug_daemon_file_path); GOTO(out1, PTR_ERR(file)); } else { - printk(KERN_ALERT "daemon dumping log to %s ... writing ... ", + printk(KERN_ALERT "daemon dumping log to %s ... writing ...\n", debug_daemon_file_path); } |
From: Hariharan T. <th...@us...> - 2003-05-16 05:54:27
|
Update of /cvsroot/sandiaportals/portals/lib In directory sc8-pr-cvs1:/tmp/cvs-serv11672/lib Modified Files: Tag: b_devel lib-move.c Log Message: Added timestamp to ptl_event_t to track request wait/delivery times. Bugzilla#1107. Index: lib-move.c =================================================================== RCS file: /cvsroot/sandiaportals/portals/lib/lib-move.c,v retrieving revision 1.52.2.5 retrieving revision 1.52.2.6 diff -u -w -b -B -p -r1.52.2.5 -r1.52.2.6 --- lib-move.c 9 May 2003 14:32:49 -0000 1.52.2.5 +++ lib-move.c 16 May 2003 05:54:24 -0000 1.52.2.6 @@ -544,6 +544,7 @@ get_new_msg (nal_cb_t *nal, lib_md_t *md msg->send_ack = 0; msg->md = md; + msg->ev.arrival_time = get_cycles(); md->pending++; if (md->threshold != PTL_MD_THRESH_INF) { LASSERT (md->threshold > 0); |
From: Hariharan T. <th...@us...> - 2003-05-16 05:54:27
|
Update of /cvsroot/sandiaportals/portals/include/portals In directory sc8-pr-cvs1:/tmp/cvs-serv11672/include/portals Modified Files: Tag: b_devel types.h Log Message: Added timestamp to ptl_event_t to track request wait/delivery times. Bugzilla#1107. Index: types.h =================================================================== RCS file: /cvsroot/sandiaportals/portals/include/portals/types.h,v retrieving revision 1.31.2.2 retrieving revision 1.31.2.3 diff -u -w -b -B -p -r1.31.2.2 -r1.31.2.3 --- types.h 31 Mar 2003 20:22:30 -0000 1.31.2.2 +++ types.h 16 May 2003 05:54:24 -0000 1.31.2.3 @@ -3,10 +3,13 @@ #ifdef __linux__ #include <asm/types.h> +#include <asm/timex.h> #else #include <sys/types.h> typedef u_int32_t __u32; typedef u_int64_t __u64; +typedef unsigned long long cycles_t; +static inline cycles_t get_cycles(void) { return 0; } #endif typedef __u64 ptl_nid_t; @@ -110,6 +113,7 @@ typedef struct { ptl_handle_me_t unlinked_me; ptl_md_t mem_desc; ptl_hdr_data_t hdr_data; + cycles_t arrival_time; volatile ptl_seq_t sequence; } ptl_event_t; |
From: Eric B. <ee...@us...> - 2003-05-15 20:04:19
|
Update of /cvsroot/sandiaportals/portals/include/portals In directory sc8-pr-cvs1:/tmp/cvs-serv14938/include/portals Modified Files: Tag: b_proto arg-blocks.h internal.h lib-p30.h lib-types.h nal.h types.h Log Message: * PTL_HANDLE_NONE defined as the definitive invalid handle. PTL_EQ_NONE is just another name for the same thing. * PtlHandleEqual(ptl_handle_any_t, ptl_handle_any_t) defined for checking if handles refer to the same thing. * "One-shot" portals handles. Portals MD and ME handles are only valid until the ME/MD is unlinked, and never get re-used in the lifetime of the interface they were created on. * "One-shot" wire handles. No aliasing, even over reboots ensures acked PUTs and GETs only match the MD they were initiated with. * Put the kernel initialisation mutex into PtlNIInit(), to ensure serialised updates to the idx->NAL lookup table. Same mutex now serialises lib_init() * Fixed bug in ptl_handle2md() that could cause PtlMDUnlink() to return PTL_INV_MD when it should have returned PTL_MD_INUSE.\ * Fixed some test programs that thought they could know the numeric value of PTL_EQ_NONE. Index: arg-blocks.h =================================================================== RCS file: /cvsroot/sandiaportals/portals/include/portals/arg-blocks.h,v retrieving revision 1.9.14.1 retrieving revision 1.9.14.1.4.1 diff -u -w -b -B -p -r1.9.14.1 -r1.9.14.1.4.1 --- arg-blocks.h 13 Mar 2003 15:20:33 -0000 1.9.14.1 +++ arg-blocks.h 15 May 2003 20:03:15 -0000 1.9.14.1.4.1 @@ -19,12 +19,12 @@ #define PTL_NIDEBUG 4 #define PTL_MEATTACH 5 #define PTL_MEINSERT 6 -#define PTL_MEPREPEND 7 +// #define PTL_MEPREPEND 7 #define PTL_MEUNLINK 8 #define PTL_TBLDUMP 9 #define PTL_MEDUMP 10 #define PTL_MDATTACH 11 -#define PTL_MDINSERT 12 +// #define PTL_MDINSERT 12 #define PTL_MDBIND 13 #define PTL_MDUPDATE 14 #define PTL_MDUNLINK 15 Index: internal.h =================================================================== RCS file: /cvsroot/sandiaportals/portals/include/portals/internal.h,v retrieving revision 1.3 retrieving revision 1.3.22.1 diff -u -w -b -B -p -r1.3 -r1.3.22.1 --- internal.h 8 Apr 2002 17:56:47 -0000 1.3 +++ internal.h 15 May 2003 20:03:15 -0000 1.3.22.1 @@ -15,12 +15,6 @@ extern int ptl_init; /* Has the library be initialized */ -#define PTL_MAX_INTERFACES 8 -#define PTL_INTERFACE_NUM(h) (((h).nal_idx) % PTL_MAX_INTERFACES) -#define PTL_INTERFACE(h) (ptl_interfaces[ PTL_INTERFACE_NUM(h) ]) - -extern nal_t *ptl_interfaces[]; - extern int ptl_ni_init(void); extern int ptl_me_init(void); extern int ptl_md_init(void); @@ -38,5 +32,15 @@ extern void ptl_eq_fini(void); extern void ptl_me_ni_fini(nal_t * nal); extern void ptl_md_ni_fini(nal_t * nal); extern void ptl_eq_ni_fini(nal_t * nal); + +static inline ptl_eq_t * +ptl_handle2usereq (ptl_handle_eq_t *handle) +{ + /* EQ handles are a little wierd. On the "user" side, the cookie + * is just a pointer to a queue of events in shared memory. It's + * cb_eq_handle is the "real" handle which we pass when we + * call do_forward(). */ + return (ptl_eq_t *)((unsigned long)handle->cookie); +} #endif Index: lib-p30.h =================================================================== RCS file: /cvsroot/sandiaportals/portals/include/portals/lib-p30.h,v retrieving revision 1.42.2.1 retrieving revision 1.42.2.1.6.1 diff -u -w -b -B -p -r1.42.2.1 -r1.42.2.1.6.1 --- lib-p30.h 31 Mar 2003 20:22:25 -0000 1.42.2.1 +++ lib-p30.h 15 May 2003 20:03:15 -0000 1.42.2.1.6.1 @@ -24,6 +24,12 @@ #include <portals/lib-nal.h> #include <portals/lib-dispatch.h> +static inline int ptl_is_wire_handle_none (ptl_handle_wire_t *wh) +{ + return (wh->wh_interface_cookie == PTL_WIRE_HANDLE_NONE.wh_interface_cookie && + wh->wh_object_cookie == PTL_WIRE_HANDLE_NONE.wh_object_cookie); +} + #ifdef __KERNEL__ #define state_lock(nal,flagsp) \ do { \ @@ -61,20 +67,10 @@ do { extern int lib_freelist_init (nal_cb_t *nal, lib_freelist_t *fl, int nobj, int objsize); extern void lib_freelist_fini (nal_cb_t *nal, lib_freelist_t *fl); -static inline int -lib_freelist_owns (lib_freelist_t *fl, void *obj) -{ - unsigned long o = (unsigned long)obj; - unsigned long base = (unsigned long)fl->fl_objs; - - return (o >= base && - o < base + fl->fl_nobjs * fl->fl_objsize && - (o - base) % fl->fl_objsize == offsetof (lib_freeobj_t, fo_contents)); -} - static inline void * lib_freelist_alloc (lib_freelist_t *fl) { + /* ALWAYS called with statelock held */ lib_freeobj_t *o; if (list_empty (&fl->fl_list)) @@ -88,6 +84,7 @@ lib_freelist_alloc (lib_freelist_t *fl) static inline void lib_freelist_free (lib_freelist_t *fl, void *obj) { + /* ALWAYS called with statelock held */ lib_freeobj_t *o = list_entry (obj, lib_freeobj_t, fo_contents); list_add (&o->fo_list, &fl->fl_list); @@ -105,7 +102,6 @@ lib_eq_alloc (nal_cb_t *nal) eq = (lib_eq_t *)lib_freelist_alloc (&nal->ni.ni_free_eqs); state_unlock (nal, &flags); - LASSERT (eq == NULL || eq->eq_nal == NULL); /* assign only when active */ return (eq); } @@ -113,32 +109,9 @@ static inline void lib_eq_free (nal_cb_t *nal, lib_eq_t *eq) { /* ALWAYS called with statelock held */ - eq->eq_nal = NULL; lib_freelist_free (&nal->ni.ni_free_eqs, eq); } -static inline void -ptl_eq2handle (ptl_handle_any_t *handle, lib_eq_t *eq, nal_cb_t *nal) -{ - /* ALWAYS called with statelock held */ - handle->handle_idx = (eq == NULL) ? PTL_INV_HNDL : (unsigned long)eq; -} - -static inline lib_eq_t * -ptl_handle2eq (ptl_handle_any_t *handle, nal_cb_t *nal) -{ - /* ALWAYS called with statelock held */ - lib_eq_t *eq = (lib_eq_t *)handle->handle_idx; - - if (!ptl_is_valid_handle (handle) || - !lib_freelist_owns (&nal->ni.ni_free_eqs, eq) || - eq->eq_nal != nal) /* active for this nal */ - return (NULL); - - return (eq); -} - - static inline lib_md_t * lib_md_alloc (nal_cb_t *nal) { @@ -150,7 +123,6 @@ lib_md_alloc (nal_cb_t *nal) md = (lib_md_t *)lib_freelist_alloc (&nal->ni.ni_free_mds); state_unlock (nal, &flags); - LASSERT (md == NULL || md->md_nal == NULL); /* assign only when active */ return (md); } @@ -158,33 +130,9 @@ static inline void lib_md_free (nal_cb_t *nal, lib_md_t *md) { /* ALWAYS called with statelock held */ - md->md_nal = NULL; lib_freelist_free (&nal->ni.ni_free_mds, md); } -static inline void -ptl_md2handle (ptl_handle_any_t *handle, lib_md_t *md, nal_cb_t *nal) -{ - /* ALWAYS called with statelock held */ - handle->handle_idx = (md == NULL) ? PTL_INV_HNDL : (unsigned long)md; -} - -static inline lib_md_t * -ptl_handle2md (ptl_handle_any_t *handle, nal_cb_t *nal) -{ - /* ALWAYS called with statelock held */ - lib_md_t *md = (lib_md_t *)handle->handle_idx; - - if (!ptl_is_valid_handle (handle) || - !lib_freelist_owns (&nal->ni.ni_free_mds, md) || - md->md_nal != nal || /* not active for this nal */ - (md->md_flags & PTL_MD_FLAG_UNLINK) != 0) /* not unlinked already */ - return (NULL); - - return (md); -} - - static inline lib_me_t * lib_me_alloc (nal_cb_t *nal) { @@ -196,7 +144,6 @@ lib_me_alloc (nal_cb_t *nal) me = (lib_me_t *)lib_freelist_alloc (&nal->ni.ni_free_mes); state_unlock (nal, &flags); - LASSERT (me == NULL || me->me_nal == NULL); /* assign only when active */ return (me); } @@ -204,32 +151,9 @@ static inline void lib_me_free (nal_cb_t *nal, lib_me_t *me) { /* ALWAYS called with statelock held */ - me->me_nal = NULL; lib_freelist_free (&nal->ni.ni_free_mes, me); } -static inline void -ptl_me2handle (ptl_handle_any_t *handle, lib_me_t *me, nal_cb_t *nal) -{ - /* ALWAYS called with statelock held */ - handle->handle_idx = (me == NULL) ? PTL_INV_HNDL : (unsigned long)me; -} - -static inline lib_me_t * -ptl_handle2me (ptl_handle_any_t *handle, nal_cb_t *nal) -{ - /* ALWAYS called with statelock held */ - lib_me_t *me = (lib_me_t *)handle->handle_idx; - - if (!ptl_is_valid_handle (handle) || - !lib_freelist_owns (&nal->ni.ni_free_mes, me) || - me->me_nal != nal) /* not active for this nal */ - return (NULL); - - return (me); -} - - static inline lib_msg_t * lib_msg_alloc (nal_cb_t *nal) { @@ -246,17 +170,6 @@ lib_msg_free (nal_cb_t *nal, lib_msg_t * #else -/* the code below relies on having the function - * kmem_cache_validate - * available in linux/mm/slab.c. This function checks if pointers - * are indeed pointing to allocated objects in slabs. - * a patch for this is included with the patches subdirectory - * - * NB portals only relies on kmem_cache_validate letting you know if - * you can dereference the pointer. It then checks obj->obj_nal to see - * if the object is owned by the relevent NAL (NULL when unused). - */ - extern kmem_cache_t *ptl_md_slab; extern kmem_cache_t *ptl_msg_slab; extern kmem_cache_t *ptl_me_slab; @@ -276,7 +189,6 @@ lib_eq_alloc (nal_cb_t *nal) return (NULL); atomic_inc (&eq_in_use_count); - LASSERT (eq->eq_nal == NULL); /* assign only when active */ return (eq); } @@ -284,33 +196,10 @@ static inline void lib_eq_free (nal_cb_t *nal, lib_eq_t *eq) { /* ALWAYS called with statelock held */ - eq->eq_nal = NULL; atomic_dec (&eq_in_use_count); kmem_cache_free(ptl_eq_slab, eq); } -static inline void -ptl_eq2handle (ptl_handle_any_t *handle, lib_eq_t *eq, nal_cb_t *nal) -{ - /* ALWAYS called with statelock held */ - handle->handle_idx = (eq == NULL) ? PTL_INV_HNDL : (unsigned long)eq; -} - -static inline struct lib_eq_t * -ptl_handle2eq (ptl_handle_any_t *handle, nal_cb_t *nal) -{ - /* ALWAYS called with statelock held */ - lib_eq_t *eq = (lib_eq_t *)handle->handle_idx; - - if (!ptl_is_valid_handle(handle) || - !kmem_cache_validate(ptl_eq_slab, eq) || - eq->eq_nal != nal) /* must be owned by this nal */ - return (NULL); - - return (eq); -} - - static inline lib_md_t * lib_md_alloc (nal_cb_t *nal) { @@ -321,7 +210,6 @@ lib_md_alloc (nal_cb_t *nal) return (NULL); atomic_inc (&md_in_use_count); - LASSERT (md->md_nal == NULL); /* assign only when active */ return (md); } @@ -329,34 +217,10 @@ static inline void lib_md_free (nal_cb_t *nal, lib_md_t *md) { /* ALWAYS called with statelock held */ - md->md_nal = NULL; atomic_dec (&md_in_use_count); kmem_cache_free(ptl_md_slab, md); } -static inline void -ptl_md2handle (ptl_handle_any_t *handle, lib_md_t *md, nal_cb_t *nal) -{ - /* ALWAYS called with statelock held */ - handle->handle_idx = (md == NULL) ? PTL_INV_HNDL : (unsigned long)md; -} - -static inline struct lib_md_t * -ptl_handle2md (ptl_handle_any_t *handle, nal_cb_t *nal) -{ - /* ALWAYS called with statelock held */ - lib_md_t *md = (lib_md_t *)handle->handle_idx; - - if (!ptl_is_valid_handle(handle) || - !kmem_cache_validate(ptl_md_slab, md) || - md->md_nal != nal || /* not active for this nal */ - (md->md_flags & PTL_MD_FLAG_UNLINK) != 0) /* not unlinked already */ - return (NULL); - - return (md); -} - - static inline lib_me_t * lib_me_alloc (nal_cb_t *nal) { @@ -367,7 +231,6 @@ lib_me_alloc (nal_cb_t *nal) return (NULL); atomic_inc (&me_in_use_count); - LASSERT (me->me_nal == NULL); /* assign only when active */ return (me); } @@ -375,54 +238,105 @@ static inline void lib_me_free(nal_cb_t *nal, lib_me_t *me) { /* ALWAYS called with statelock held */ - me->me_nal = NULL; atomic_dec (&me_in_use_count); kmem_cache_free(ptl_me_slab, me); } +static inline lib_msg_t * +lib_msg_alloc(nal_cb_t *nal) +{ + /* ALWAYS called with statelock held */ + lib_msg_t *msg = kmem_cache_alloc(ptl_msg_slab, GFP_ATOMIC); + + if (msg == NULL) + return (NULL); + + atomic_inc (&msg_in_use_count); + return (msg); +} + static inline void -ptl_me2handle (ptl_handle_any_t *handle, lib_me_t *me, nal_cb_t *nal) +lib_msg_free(nal_cb_t *nal, lib_msg_t *msg) { /* ALWAYS called with statelock held */ - handle->handle_idx = (me == NULL) ? PTL_INV_HNDL : (unsigned long)me; + atomic_dec (&msg_in_use_count); + kmem_cache_free(ptl_msg_slab, msg); } +#endif -static inline struct lib_me_t * -ptl_handle2me(ptl_handle_any_t *handle, nal_cb_t *nal) +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 void lib_invalidate_handle (nal_cb_t *nal, lib_handle_t *lh); + +static inline void +ptl_eq2handle (ptl_handle_eq_t *handle, lib_eq_t *eq) +{ + handle->cookie = eq->eq_lh.lh_cookie; +} + +static inline lib_eq_t * +ptl_handle2eq (ptl_handle_eq_t *handle, nal_cb_t *nal) { /* ALWAYS called with statelock held */ - lib_me_t *me = (lib_me_t *)handle->handle_idx; + lib_handle_t *lh = lib_lookup_cookie (nal, handle->cookie); - if (!ptl_is_valid_handle(handle) || - !kmem_cache_validate(ptl_me_slab, me) || - me->me_nal != nal) /* not active for this nal */ + if (lh == NULL) return (NULL); - return (me); + return (lh_entry (lh, lib_eq_t, eq_lh)); } +static inline void +ptl_md2handle (ptl_handle_md_t *handle, lib_md_t *md) +{ + handle->cookie = md->md_lh.lh_cookie; +} -static inline lib_msg_t * -lib_msg_alloc(nal_cb_t *nal) +static inline lib_md_t * +ptl_handle2md (ptl_handle_md_t *handle, nal_cb_t *nal) { /* ALWAYS called with statelock held */ - lib_msg_t *msg = kmem_cache_alloc(ptl_msg_slab, GFP_ATOMIC); + lib_handle_t *lh = lib_lookup_cookie (nal, handle->cookie); - if (msg == NULL) + if (lh == NULL) return (NULL); - atomic_inc (&msg_in_use_count); - return (msg); + return (lh_entry (lh, lib_md_t, md_lh)); +} + +static inline lib_md_t * +ptl_wire_handle2md (ptl_handle_wire_t *wh, nal_cb_t *nal) +{ + /* ALWAYS called with statelock held */ + lib_handle_t *lh; + + if (wh->wh_interface_cookie != nal->ni.ni_interface_cookie) + return (NULL); + + lh = lib_lookup_cookie (nal, wh->wh_object_cookie); + if (lh == NULL) + return (NULL); + + return (lh_entry (lh, lib_md_t, md_lh)); } static inline void -lib_msg_free(nal_cb_t *nal, lib_msg_t *msg) +ptl_me2handle (ptl_handle_me_t *handle, lib_me_t *me) +{ + handle->cookie = me->me_lh.lh_cookie; +} + +static inline lib_me_t * +ptl_handle2me (ptl_handle_me_t *handle, nal_cb_t *nal) { /* ALWAYS called with statelock held */ - atomic_dec (&msg_in_use_count); - kmem_cache_free(ptl_msg_slab, msg); + lib_handle_t *lh = lib_lookup_cookie (nal, handle->cookie); + + if (lh == NULL) + return (NULL); + + return (lh_entry (lh, lib_me_t, me_lh)); } -#endif extern int lib_init(nal_cb_t * cb, ptl_nid_t nid, ptl_pid_t pid, int gsize, ptl_pt_index_t tbl_size, ptl_ac_index_t ac_size); Index: lib-types.h =================================================================== RCS file: /cvsroot/sandiaportals/portals/include/portals/lib-types.h,v retrieving revision 1.33.2.3 retrieving revision 1.33.2.3.2.1 diff -u -w -b -B -p -r1.33.2.3 -r1.33.2.3.2.1 --- lib-types.h 6 May 2003 14:28:00 -0000 1.33.2.3 +++ lib-types.h 15 May 2003 20:03:15 -0000 1.33.2.3.2.1 @@ -30,41 +30,18 @@ typedef struct lib_me_t lib_me_t; typedef struct lib_md_t lib_md_t; typedef struct lib_eq_t lib_eq_t; -/* FIXME: need to set up the cookies properly. For now it is just nal_idx */ +/* 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 + * during that object's lifetime (i.e. no cookie re-use). */ typedef struct { - __u64 handle_cookie; - __u64 handle_idx; + __u64 wh_interface_cookie; + __u64 wh_object_cookie; } ptl_handle_wire_t; -static inline void ptl_handle_pack(ptl_handle_wire_t *w, ptl_handle_any_t *h) -{ - w->handle_cookie = h->nal_idx; - w->handle_idx = h->handle_idx; -} - -static inline void ptl_handle_unpack(ptl_handle_any_t *h, ptl_handle_wire_t *w) -{ - h->nal_idx = (unsigned long)w->handle_cookie; - h->handle_idx = (unsigned long)w->handle_idx; -} - -static inline int ptl_is_invalid_wire(ptl_handle_wire_t *w) -{ -#if 0 - /* RSN we want all bits set as the unique invalid wire handle */ - return (w->handle_idx == (__u64)(-1) && - w->handle_cookie == (__u64)(-1)); -#else - /* backwards compatible */ - return (w->handle_idx == (__u64)(-1)); -#endif -} - -static inline void ptl_set_invalid_wire(ptl_handle_wire_t *w) -{ - w->handle_idx = (__u64)(-1); - w->handle_cookie = (__u64)(-1); -} +/* byte-flip insensitive! */ +#define PTL_WIRE_HANDLE_NONE \ +((const ptl_handle_wire_t) {.wh_interface_cookie = -1, .wh_object_cookie = -1}) typedef enum { PTL_MSG_ACK = 0, @@ -186,28 +163,37 @@ struct lib_ac_t { int next_free; }; +typedef struct { + struct list_head lh_hash_chain; + __u64 lh_cookie; +} lib_handle_t; + +#define lh_entry(ptr, type, member) \ + ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) + struct lib_eq_t { struct list_head eq_list; + lib_handle_t eq_lh; ptl_seq_t sequence; ptl_size_t size; ptl_event_t *base; int eq_refcount; int (*event_callback) (ptl_event_t * event); void *eq_addrkey; - nal_cb_t *eq_nal; }; struct lib_me_t { struct list_head me_list; + lib_handle_t me_lh; ptl_process_id_t match_id; ptl_match_bits_t match_bits, ignore_bits; ptl_unlink_t unlink; lib_md_t *md; - nal_cb_t *me_nal; }; struct lib_md_t { struct list_head md_list; + lib_handle_t md_lh; lib_me_t *me; user_ptr start; ptl_size_t offset; @@ -220,7 +206,6 @@ struct lib_md_t { unsigned int md_flags; void *user_ptr; lib_eq_t *eq; - nal_cb_t *md_nal; void *md_addrkey; unsigned int md_niov; /* # frags */ union { @@ -266,6 +251,11 @@ typedef struct { lib_ac_t ac; lib_counters_t counters; + int ni_lh_hash_size; /* size of lib handle hash table */ + struct list_head *ni_lh_hash_table; /* all extant lib handles, this interface */ + __u64 ni_next_object_cookie; /* cookie generator */ + __u64 ni_interface_cookie; /* uniquely identifies this ni in this epoch */ + struct list_head ni_test_peers; #ifndef PTL_USE_SLAB_CACHE @@ -274,7 +264,6 @@ typedef struct { lib_freelist_t ni_free_mds; lib_freelist_t ni_free_eqs; #endif - struct list_head ni_active_mes; struct list_head ni_active_msgs; struct list_head ni_active_mds; struct list_head ni_active_eqs; Index: nal.h =================================================================== RCS file: /cvsroot/sandiaportals/portals/include/portals/nal.h,v retrieving revision 1.7 retrieving revision 1.7.20.1 diff -u -w -b -B -p -r1.7 -r1.7.20.1 --- nal.h 22 Aug 2002 13:53:01 -0000 1.7 +++ nal.h 15 May 2003 20:03:15 -0000 1.7.20.1 @@ -41,7 +41,7 @@ typedef nal_t *(ptl_interface_t) (int, p extern nal_t *PTL_IFACE_IP(int, ptl_pt_index_t, ptl_ac_index_t, ptl_pid_t requested_pid); extern nal_t *PTL_IFACE_MYR(int, ptl_pt_index_t, ptl_ac_index_t, ptl_pid_t requested_pid); -inline nal_t *ptl_hndl2nal(ptl_handle_any_t * any); +extern nal_t *ptl_hndl2nal(ptl_handle_any_t * any); #ifndef PTL_IFACE_DEFAULT #define PTL_IFACE_DEFAULT (PTL_IFACE_IP) Index: types.h =================================================================== RCS file: /cvsroot/sandiaportals/portals/include/portals/types.h,v retrieving revision 1.31.2.2 retrieving revision 1.31.2.2.6.1 diff -u -w -b -B -p -r1.31.2.2 -r1.31.2.2.6.1 --- types.h 31 Mar 2003 20:22:30 -0000 1.31.2.2 +++ types.h 15 May 2003 20:03:15 -0000 1.31.2.2.6.1 @@ -18,8 +18,8 @@ typedef __u64 ptl_hdr_data_t; typedef __u32 ptl_size_t; typedef struct { - unsigned long nal_idx; - unsigned long handle_idx; + unsigned long nal_idx; /* which network interface */ + __u64 cookie; /* which thing on that interface */ } ptl_handle_any_t; typedef ptl_handle_any_t ptl_handle_ni_t; @@ -27,22 +27,17 @@ typedef ptl_handle_any_t ptl_handle_eq_t typedef ptl_handle_any_t ptl_handle_md_t; typedef ptl_handle_any_t ptl_handle_me_t; -#define PTL_INV_HNDL 0xFFFFFFFF +#define PTL_HANDLE_NONE \ +((const ptl_handle_any_t){.nal_idx = -1, .cookie = -1}) +#define PTL_EQ_NONE PTL_HANDLE_NONE -#define PTL_EQ_NONE ((ptl_handle_eq_t){.nal_idx = 0, .handle_idx = PTL_INV_HNDL}) - -#define PTL_NID_ANY ((ptl_nid_t) -1) -#define PTL_PID_ANY ((ptl_pid_t) -1) - -static inline int ptl_is_valid_handle(ptl_handle_any_t *h) +static inline int PtlHandleEqual (ptl_handle_any_t h1, ptl_handle_any_t h2) { - return (h->handle_idx != PTL_INV_HNDL); + return (h1.nal_idx == h2.nal_idx && h1.cookie == h2.cookie); } -static inline void ptl_set_inv_handle(ptl_handle_any_t *h) -{ - h->handle_idx = PTL_INV_HNDL; -} +#define PTL_NID_ANY ((ptl_nid_t) -1) +#define PTL_PID_ANY ((ptl_pid_t) -1) typedef struct { ptl_nid_t nid; |
From: Eric B. <ee...@us...> - 2003-05-15 20:04:15
|
Update of /cvsroot/sandiaportals/portals/linux/p3mod In directory sc8-pr-cvs1:/tmp/cvs-serv14938/linux/p3mod Modified Files: Tag: b_proto stat.h Log Message: * PTL_HANDLE_NONE defined as the definitive invalid handle. PTL_EQ_NONE is just another name for the same thing. * PtlHandleEqual(ptl_handle_any_t, ptl_handle_any_t) defined for checking if handles refer to the same thing. * "One-shot" portals handles. Portals MD and ME handles are only valid until the ME/MD is unlinked, and never get re-used in the lifetime of the interface they were created on. * "One-shot" wire handles. No aliasing, even over reboots ensures acked PUTs and GETs only match the MD they were initiated with. * Put the kernel initialisation mutex into PtlNIInit(), to ensure serialised updates to the idx->NAL lookup table. Same mutex now serialises lib_init() * Fixed bug in ptl_handle2md() that could cause PtlMDUnlink() to return PTL_INV_MD when it should have returned PTL_MD_INUSE.\ * Fixed some test programs that thought they could know the numeric value of PTL_EQ_NONE. Index: stat.h =================================================================== RCS file: /cvsroot/sandiaportals/portals/linux/p3mod/stat.h,v retrieving revision 1.2 retrieving revision 1.2.22.1 diff -u -w -b -B -p -r1.2 -r1.2.22.1 --- stat.h 21 Jul 2002 04:25:17 -0000 1.2 +++ stat.h 15 May 2003 20:03:15 -0000 1.2.22.1 @@ -32,7 +32,7 @@ typedef struct { unsigned long FwdRetLen; /* Fwd return argument list length */ unsigned long FwdRetLenMax; /* Max return fwd argument list len */ unsigned long FwdRetLenMin; /* Min return fwd argument list len */ - unsigned long dispatch[LIB_MAX_DISPATCH]; /* Func called through fwd */ + unsigned long dispatch[LIB_MAX_DISPATCH + 1]; /* Func called through fwd */ } nalstat_t; extern nalstat_t nalstat; |
From: Eric B. <ee...@us...> - 2003-05-15 20:03:50
|
Update of /cvsroot/sandiaportals/portals/lib In directory sc8-pr-cvs1:/tmp/cvs-serv14938/lib Modified Files: Tag: b_proto lib-eq.c lib-init.c lib-md.c lib-me.c lib-move.c lib-msg.c Log Message: * PTL_HANDLE_NONE defined as the definitive invalid handle. PTL_EQ_NONE is just another name for the same thing. * PtlHandleEqual(ptl_handle_any_t, ptl_handle_any_t) defined for checking if handles refer to the same thing. * "One-shot" portals handles. Portals MD and ME handles are only valid until the ME/MD is unlinked, and never get re-used in the lifetime of the interface they were created on. * "One-shot" wire handles. No aliasing, even over reboots ensures acked PUTs and GETs only match the MD they were initiated with. * Put the kernel initialisation mutex into PtlNIInit(), to ensure serialised updates to the idx->NAL lookup table. Same mutex now serialises lib_init() * Fixed bug in ptl_handle2md() that could cause PtlMDUnlink() to return PTL_INV_MD when it should have returned PTL_MD_INUSE.\ * Fixed some test programs that thought they could know the numeric value of PTL_EQ_NONE. Index: lib-eq.c =================================================================== RCS file: /cvsroot/sandiaportals/portals/lib/lib-eq.c,v retrieving revision 1.18.2.1 retrieving revision 1.18.2.1.6.1 diff -u -w -b -B -p -r1.18.2.1 -r1.18.2.1.6.1 --- lib-eq.c 31 Mar 2003 20:22:32 -0000 1.18.2.1 +++ lib-eq.c 15 May 2003 20:03:15 -0000 1.18.2.1.6.1 @@ -75,14 +75,13 @@ int do_PtlEQAlloc_internal(nal_cb_t * na eq->size = args->count_in; eq->eq_refcount = 0; eq->event_callback = args->callback_in; - eq->eq_nal = nal; + lib_initialise_handle (nal, &eq->eq_lh); list_add (&eq->eq_list, &nal->ni.ni_active_eqs); - ptl_eq2handle(&ret->handle_out, eq, nal); - state_unlock(nal, &flags); + ptl_eq2handle(&ret->handle_out, eq); return (ret->rc = PTL_OK); } @@ -117,6 +116,7 @@ int do_PtlEQFree_internal(nal_cb_t * nal nal->cb_unmap(nal, 1, &iov, &eq->eq_addrkey); } + lib_invalidate_handle (nal, &eq->eq_lh); list_del (&eq->eq_list); lib_eq_free (nal, eq); ret->rc = PTL_OK; Index: lib-init.c =================================================================== RCS file: /cvsroot/sandiaportals/portals/lib/lib-init.c,v retrieving revision 1.30.2.1 retrieving revision 1.30.2.1.4.1 diff -u -w -b -B -p -r1.30.2.1 -r1.30.2.1.4.1 --- lib-init.c 13 Mar 2003 15:20:41 -0000 1.30.2.1 +++ lib-init.c 15 May 2003 20:03:15 -0000 1.30.2.1.4.1 @@ -35,10 +35,7 @@ # endif #else # include <string.h> -#endif - -#ifdef __KERNEL__ -DECLARE_MUTEX(ptl_init_mutex); +# include <sys/time.h> #endif #ifdef PTL_USE_SLAB_CACHE @@ -239,6 +236,105 @@ kportal_descriptor_cleanup (nal_cb_t *na #endif +__u64 +lib_create_interface_cookie (nal_cb_t *nal) +{ + /* NB the interface cookie in wire handles guards against delayed + * replies and ACKs appearing valid in a new instance of the same + * interface. Initialisation time, even if it's only implemented + * to millisecond resolution is probably easily good enough. */ + struct timeval tv; + __u64 cookie; +#ifndef __KERNEL__ + int rc = gettimeofday (&tv, NULL); + LASSERT (rc == 0); +#else + do_gettimeofday(&tv); +#endif + cookie = tv.tv_sec; + cookie *= 1000000; + cookie += tv.tv_usec; + return (cookie); +} + +int +lib_setup_handle_hash (nal_cb_t *nal) +{ + lib_ni_t *ni = &nal->ni; + int i; + + /* Arbitrary choice of hash table size */ +#ifdef __KERNEL__ + ni->ni_lh_hash_size = PAGE_SIZE / sizeof (struct list_head); +#else + ni->ni_lh_hash_size = (MAX_MES + MAX_MDS + MAX_EQS)/4; +#endif + ni->ni_lh_hash_table = + (struct list_head *)nal->cb_malloc (nal, ni->ni_lh_hash_size + * sizeof (struct list_head)); + if (ni->ni_lh_hash_table == NULL) + return (PTL_NOSPACE); + + 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; + + return (PTL_OK); +} + +void +lib_cleanup_handle_hash (nal_cb_t *nal) +{ + lib_ni_t *ni = &nal->ni; + + if (ni->ni_lh_hash_table == NULL) + return; + + nal->cb_free (nal, ni->ni_lh_hash_table, + ni->ni_lh_hash_size * sizeof (struct list_head)); +} + +lib_handle_t * +lib_lookup_cookie (nal_cb_t *nal, __u64 cookie) +{ + /* ALWAYS called with statelock held */ + lib_ni_t *ni = &nal->ni; + struct list_head *list; + struct list_head *el; + unsigned int hash; + + hash = ((unsigned int)cookie) % ni->ni_lh_hash_size; + list = &ni->ni_lh_hash_table[hash]; + + list_for_each (el, list) { + lib_handle_t *lh = list_entry (el, lib_handle_t, lh_hash_chain); + + if (lh->lh_cookie == cookie) + return (lh); + } + + return (NULL); +} + +void +lib_initialise_handle (nal_cb_t *nal, lib_handle_t *lh) +{ + /* ALWAYS called with statelock held */ + lib_ni_t *ni = &nal->ni; + unsigned int hash; + + 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]); +} + +void +lib_invalidate_handle (nal_cb_t *nal, lib_handle_t *lh) +{ + list_del (&lh->lh_hash_chain); +} + int lib_init(nal_cb_t * nal, ptl_nid_t nid, ptl_pid_t pid, int gsize, ptl_pt_index_t ptl_size, ptl_ac_index_t acl_size) @@ -248,9 +344,7 @@ lib_init(nal_cb_t * nal, ptl_nid_t nid, int i; ENTRY; -#ifdef __KERNEL__ - down (&ptl_init_mutex); -#endif + /* NB serialised in PtlNIInit() */ if (ni->refcnt != 0) { /* already initialised */ ni->refcnt++; @@ -267,13 +361,18 @@ lib_init(nal_cb_t * nal, ptl_nid_t nid, if (rc != PTL_OK) goto out; - INIT_LIST_HEAD (&ni->ni_active_mes); INIT_LIST_HEAD (&ni->ni_active_msgs); INIT_LIST_HEAD (&ni->ni_active_mds); INIT_LIST_HEAD (&ni->ni_active_eqs); INIT_LIST_HEAD (&ni->ni_test_peers); + ni->ni_interface_cookie = lib_create_interface_cookie (nal); + ni->ni_next_object_cookie = 0; + rc = lib_setup_handle_hash (nal); + if (rc != PTL_OK) + goto out; + ni->nid = nid; ni->pid = pid; @@ -294,11 +393,11 @@ lib_init(nal_cb_t * nal, ptl_nid_t nid, ni->refcnt++; out: - if (rc != PTL_OK) + if (rc != PTL_OK) { + lib_cleanup_handle_hash (nal); kportal_descriptor_cleanup (nal); -#ifdef __KERNEL__ - up (&ptl_init_mutex); -#endif + } + RETURN (rc); } @@ -308,9 +407,6 @@ lib_fini(nal_cb_t * nal) lib_ni_t *ni = &nal->ni; int idx; -#ifdef __KERNEL__ - down (&ptl_init_mutex); -#endif ni->refcnt--; if (ni->refcnt != 0) @@ -362,11 +458,9 @@ lib_fini(nal_cb_t * nal) nal->cb_free(nal, ni->tbl.tbl, sizeof(struct list_head) * ni->tbl.size); ni->up = 0; + lib_cleanup_handle_hash (nal); kportal_descriptor_cleanup (nal); out: -#ifdef __KERNEL__ - up (&ptl_init_mutex); -#endif return (PTL_OK); } Index: lib-md.c =================================================================== RCS file: /cvsroot/sandiaportals/portals/lib/lib-md.c,v retrieving revision 1.37.2.1 retrieving revision 1.37.2.1.6.1 diff -u -w -b -B -p -r1.37.2.1 -r1.37.2.1.6.1 --- lib-md.c 31 Mar 2003 20:22:32 -0000 1.37.2.1 +++ lib-md.c 15 May 2003 20:03:15 -0000 1.37.2.1.6.1 @@ -40,8 +40,6 @@ void lib_md_unlink(nal_cb_t * nal, lib_m { lib_me_t *me = md->me; - LASSERT (md->md_nal != NULL); /* must be an active md */ - if (md->pending != 0) { CDEBUG(D_NET, "Queueing unlink of md %p\n", md); md->md_flags |= PTL_MD_FLAG_UNLINK; @@ -70,6 +68,7 @@ void lib_md_unlink(nal_cb_t * nal, lib_m LASSERT (md->eq->eq_refcount >= 0); } + lib_invalidate_handle (nal, &md->md_lh); list_del (&md->md_list); lib_md_free(nal, md); } @@ -89,7 +88,7 @@ static int lib_md_build(nal_cb_t *nal, l * otherwise caller may only lib_md_free() it. */ - if (ptl_is_valid_handle(eqh)) { + if (!PtlHandleEqual (*eqh, PTL_EQ_NONE)) { eq = ptl_handle2eq(eqh, nal); if (eq == NULL) return PTL_INV_EQ; @@ -197,10 +196,8 @@ static int lib_md_build(nal_cb_t *nal, l if (eq != NULL) eq->eq_refcount++; - LASSERT (new->md_nal == NULL); - /* It's good; let handle2md succeed and add to active mds */ - new->md_nal = nal; + lib_initialise_handle (nal, &new->md_lh); list_add (&new->md_list, &nal->ni.ni_active_mds); return PTL_OK; @@ -220,7 +217,7 @@ void lib_md_deconstruct(nal_cb_t * nal, new->max_size = md->max_size; new->options = md->options; new->user_ptr = md->user_ptr; - ptl_eq2handle(&new->eventq, md->eq, nal); + ptl_eq2handle(&new->eventq, md->eq); new->niov = ((md->options & (PTL_MD_IOV | PTL_MD_KIOV)) == 0) ? 0 : md->md_niov; } @@ -261,7 +258,7 @@ int do_PtlMDAttach(nal_cb_t * nal, void me->md = md; md->me = me; - ptl_md2handle(&ret->handle_out, md, nal); + ptl_md2handle(&ret->handle_out, md); state_unlock (nal, &flags); return (PTL_OK); @@ -300,7 +297,7 @@ int do_PtlMDBind(nal_cb_t * nal, void *p &args->md_in, &args->eq_in, PTL_UNLINK); if (ret->rc == PTL_OK) { - ptl_md2handle(&ret->handle_out, md, nal); + ptl_md2handle(&ret->handle_out, md); state_unlock(nal, &flags); return (PTL_OK); @@ -328,6 +325,12 @@ int do_PtlMDUnlink(nal_cb_t * nal, void } else if (md->pending != 0) { /* being filled/spilled */ ret->rc = PTL_MD_INUSE; } else { + /* Callers attempting to unlink a busy MD which will get + * unlinked once the net op completes should see INUSE, + * before completion and INV_MD thereafter. LASSERT we've + * got that right... */ + LASSERT ((md->md_flags & PTL_MD_FLAG_UNLINK) == 0); + lib_md_deconstruct(nal, md, &ret->status_out); lib_md_unlink(nal, md); ret->rc = PTL_OK; @@ -376,7 +379,7 @@ int do_PtlMDUpdate_internal(nal_cb_t * n goto out; } - if (ptl_is_valid_handle(&args->testq_in)) { + if (!PtlHandleEqual (args->testq_in, PTL_EQ_NONE)) { test_eq = ptl_handle2eq(&args->testq_in, nal); if (test_eq == NULL) { ret->rc = PTL_INV_EQ; Index: lib-me.c =================================================================== RCS file: /cvsroot/sandiaportals/portals/lib/lib-me.c,v retrieving revision 1.39.2.2 retrieving revision 1.39.2.2.4.1 diff -u -w -b -B -p -r1.39.2.2 -r1.39.2.2.4.1 --- lib-me.c 27 Apr 2003 14:05:26 -0000 1.39.2.2 +++ lib-me.c 15 May 2003 20:03:15 -0000 1.39.2.2.4.1 @@ -33,8 +33,7 @@ #include <portals/lib-p30.h> #include <portals/arg-blocks.h> -static void lib_me_dump(nal_cb_t * nal, lib_me_t * me, - unsigned long currentp); +static void lib_me_dump(nal_cb_t * nal, lib_me_t * me); int do_PtlMEAttach(nal_cb_t * nal, void *private, void *v_args, void *v_ret) { @@ -63,14 +62,15 @@ int do_PtlMEAttach(nal_cb_t * nal, void me->ignore_bits = args->ignore_bits_in; me->unlink = args->unlink_in; me->md = NULL; - me->me_nal = nal; + + lib_initialise_handle (nal, &me->me_lh); if (args->position_in == PTL_INS_AFTER) list_add_tail(&me->me_list, &(tbl->tbl[args->index_in])); else list_add(&me->me_list, &(tbl->tbl[args->index_in])); - ptl_me2handle(&ret->handle_out, me, nal); + ptl_me2handle(&ret->handle_out, me); state_unlock(nal, &flags); @@ -106,14 +106,15 @@ int do_PtlMEInsert(nal_cb_t * nal, void new->ignore_bits = args->ignore_bits_in; new->unlink = args->unlink_in; new->md = NULL; - new->me_nal = nal; + + lib_initialise_handle (nal, &new->me_lh); if (args->position_in == PTL_INS_AFTER) list_add_tail(&new->me_list, &me->me_list); else list_add(&new->me_list, &me->me_list); - ptl_me2handle(&ret->handle_out, new, nal); + ptl_me2handle(&ret->handle_out, new); state_unlock(nal, &flags); @@ -149,7 +150,7 @@ void lib_me_unlink(nal_cb_t *nal, lib_me if (ni->debug & PTL_DEBUG_UNLINK) { ptl_handle_any_t handle; - ptl_me2handle(&handle, me, nal); + ptl_me2handle(&handle, me); } list_del (&me->me_list); @@ -159,6 +160,7 @@ void lib_me_unlink(nal_cb_t *nal, lib_me lib_md_unlink(nal, me->md); } + lib_invalidate_handle (nal, &me->me_lh); lib_me_free(nal, me); } @@ -179,8 +181,8 @@ int do_PtlTblDump(nal_cb_t * nal, void * state_lock(nal, &flags); list_for_each(tmp, &(tbl->tbl[args->index_in])) { lib_me_t *me = list_entry(tmp, lib_me_t, me_list); - ptl_me2handle(&handle, me, nal); - lib_me_dump(nal, me, handle.handle_idx); + ptl_me2handle(&handle, me); + lib_me_dump(nal, me); } state_unlock(nal, &flags); @@ -200,7 +202,7 @@ int do_PtlMEDump(nal_cb_t * nal, void *p if (me == NULL) { ret->rc = PTL_INV_ME; } else { - lib_me_dump(nal, me, args->current_in.handle_idx); + lib_me_dump(nal, me); ret->rc = PTL_OK; } @@ -209,10 +211,10 @@ int do_PtlMEDump(nal_cb_t * nal, void *p return ret->rc; } -static void lib_me_dump(nal_cb_t * nal, lib_me_t * me, - unsigned long currentp) +static void lib_me_dump(nal_cb_t * nal, lib_me_t * me) { - nal->cb_printf(nal, "Match Entry %p (%ld)\n", me, currentp); + nal->cb_printf(nal, "Match Entry %p ("LPX64")\n", me, + me->me_lh.lh_cookie); nal->cb_printf(nal, "\tMatch/Ignore\t= %016lx / %016lx\n", me->match_bits, me->ignore_bits); Index: lib-move.c =================================================================== RCS file: /cvsroot/sandiaportals/portals/lib/lib-move.c,v retrieving revision 1.52.2.5 retrieving revision 1.52.2.5.2.1 diff -u -w -b -B -p -r1.52.2.5 -r1.52.2.5.2.1 --- lib-move.c 9 May 2003 14:32:49 -0000 1.52.2.5 +++ lib-move.c 15 May 2003 20:03:15 -0000 1.52.2.5.2.1 @@ -577,7 +577,6 @@ static int parse_put(nal_cb_t * nal, ptl lib_md_t *md; lib_msg_t *msg; unsigned long flags; - ptl_handle_any_t handle; /* Convert put fields to host byte order */ hdr->msg.put.match_bits = NTOH__u64 (hdr->msg.put.match_bits); @@ -595,11 +594,10 @@ static int parse_put(nal_cb_t * nal, ptl goto drop; md = me->md; - ptl_md2handle(&handle, md, nal); CDEBUG(D_NET, "Incoming put index %x from "LPU64"/%u of length %d/%d " - "into md %lx [%d] + %d\n", hdr->msg.put.ptl_index, + "into md "LPX64" [%d] + %d\n", hdr->msg.put.ptl_index, hdr->src_nid, hdr->src_pid, mlength, PTL_HDR_LENGTH(hdr), - handle.handle_idx, md->md_niov, offset); + md->md_lh.lh_cookie, md->md_niov, offset); msg = get_new_msg (nal, md); if (msg == NULL) { @@ -608,7 +606,7 @@ static int parse_put(nal_cb_t * nal, ptl goto drop; } - if (!ptl_is_invalid_wire(&hdr->msg.put.ack_wmd) && + if (!ptl_is_wire_handle_none(&hdr->msg.put.ack_wmd) && !(md->options & PTL_MD_ACK_DISABLE)) { msg->send_ack = 1; msg->ack_wmd = hdr->msg.put.ack_wmd; @@ -635,7 +633,7 @@ static int parse_put(nal_cb_t * nal, ptl * remember the ME handle anyway and check again when we're * allocating our slot in the event queue. */ - ptl_me2handle (&msg->ev.unlinked_me, me, nal); + ptl_me2handle (&msg->ev.unlinked_me, me); lib_md_deconstruct(nal, md, &msg->ev.mem_desc); } @@ -674,7 +672,6 @@ static int parse_get(nal_cb_t * nal, ptl lib_msg_t *msg; ptl_hdr_t reply; unsigned long flags; - ptl_handle_any_t handle; int rc; /* Convert get fields to host byte order */ @@ -699,11 +696,10 @@ static int parse_get(nal_cb_t * nal, ptl goto drop; md = me->md; - ptl_md2handle(&handle, md, nal); CDEBUG(D_NET, "Incoming get index %d from "LPU64".%u of length %d/%d " - "from md %ld [%d] + %d\n", hdr->msg.get.ptl_index, + "from md "LPX64" [%d] + %d\n", hdr->msg.get.ptl_index, hdr->src_nid, hdr->src_pid, mlength, PTL_HDR_LENGTH(hdr), - handle.handle_idx, md->md_niov, offset); + md->md_lh.lh_cookie, md->md_niov, offset); msg = get_new_msg (nal, md); if (msg == NULL) { @@ -730,7 +726,7 @@ static int parse_get(nal_cb_t * nal, ptl * remember the ME handle anyway and check again when we're * allocating our slot in the event queue. */ - ptl_me2handle (&msg->ev.unlinked_me, me, nal); + ptl_me2handle (&msg->ev.unlinked_me, me); lib_md_deconstruct(nal, md, &msg->ev.mem_desc); } @@ -780,7 +776,6 @@ static int parse_get(nal_cb_t * nal, ptl static int parse_reply(nal_cb_t * nal, ptl_hdr_t * hdr, void *private) { lib_ni_t *ni = &nal->ni; - ptl_handle_md_t mdh; lib_md_t *md; int rlength; int length; @@ -794,14 +789,14 @@ static int parse_reply(nal_cb_t * nal, p state_lock(nal, &flags); -#warning FIXME: convert this to proper cookie checking of handle - ptl_handle_unpack(&mdh, &hdr->msg.reply.dst_wmd); - md = ptl_handle2md(&mdh, nal); + /* NB handles only looked up by creator (no flips) */ + md = ptl_wire_handle2md(&hdr->msg.reply.dst_wmd, nal); if (md == NULL || md->threshold == 0) { - CERROR (LPU64": Dropping REPLY from "LPU64" for %s MD %ld\n", + CERROR (LPU64": Dropping REPLY from "LPU64" for %s MD "LPX64"."LPX64"\n", ni->nid, hdr->src_nid, md == NULL ? "invalid" : "inactive", - mdh.handle_idx); + hdr->msg.reply.dst_wmd.wh_interface_cookie, + hdr->msg.reply.dst_wmd.wh_object_cookie); goto drop; } @@ -812,16 +807,18 @@ static int parse_reply(nal_cb_t * nal, p if (length > md->length) { if ((md->options & PTL_MD_TRUNCATE) == 0) { CERROR (LPU64": Dropping REPLY from "LPU64 - " length %d for MD %ld would overflow (%d)\n", + " length %d for MD "LPX64" would overflow (%d)\n", ni->nid, hdr->src_nid, length, - mdh.handle_idx, md->length); + hdr->msg.reply.dst_wmd.wh_object_cookie, + md->length); goto drop; } length = md->length; } - CDEBUG(D_NET, "Reply from "LPU64" of length %d/%d into md %ld\n", - hdr->src_nid, length, rlength, mdh.handle_idx); + CDEBUG(D_NET, "Reply from "LPU64" of length %d/%d into md "LPX64"\n", + hdr->src_nid, length, rlength, + hdr->msg.reply.dst_wmd.wh_object_cookie); msg = get_new_msg (nal, md); if (msg == NULL) { @@ -860,7 +857,6 @@ static int parse_reply(nal_cb_t * nal, p static int parse_ack(nal_cb_t * nal, ptl_hdr_t * hdr, void *private) { lib_ni_t *ni = &nal->ni; - ptl_handle_md_t mdh; lib_md_t *md; lib_msg_t *msg = NULL; unsigned long flags; @@ -871,23 +867,20 @@ static int parse_ack(nal_cb_t * nal, ptl state_lock(nal, &flags); -#warning FIXME: convert this to proper cookie checking of handle - ptl_handle_unpack(&mdh, &hdr->msg.ack.dst_wmd); - md = ptl_handle2md(&mdh, nal); - if (md == NULL) { - CERROR(LPU64": Dropping ACK from "LPU64" to invalid md %ld\n", - ni->nid, hdr->src_nid, mdh.handle_idx); - goto drop; - } - - if (!md->threshold) { - CERROR(LPU64": Dropping ACK from "LPU64" to inactive MD %ld\n", - ni->nid, hdr->src_nid, mdh.handle_idx); + /* 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 " + LPX64"."LPX64"\n", ni->nid, hdr->src_nid, + (md == NULL) ? "invalid" : "inactive", + hdr->msg.ack.dst_wmd.wh_interface_cookie, + hdr->msg.ack.dst_wmd.wh_object_cookie); goto drop; } - CDEBUG(D_NET, LPU64": ACK from "LPU64" into md %ld\n", - ni->nid, hdr->src_nid, mdh.handle_idx); + CDEBUG(D_NET, LPU64": ACK from "LPU64" into md "LPX64"\n", + ni->nid, hdr->src_nid, + hdr->msg.ack.dst_wmd.wh_object_cookie); msg = get_new_msg (nal, md); if (msg == NULL) { @@ -956,8 +949,8 @@ void print_hdr(nal_cb_t * nal, ptl_hdr_t " Ptl index %d, ack md "LPX64"."LPX64", " "match bits "LPX64"\n", hdr->msg.put.ptl_index, - hdr->msg.put.ack_wmd.handle_cookie, - hdr->msg.put.ack_wmd.handle_idx, + hdr->msg.put.ack_wmd.wh_interface_cookie, + hdr->msg.put.ack_wmd.wh_object_cookie, hdr->msg.put.match_bits); nal->cb_printf(nal, " Length %d, offset %d, hdr data "LPX64"\n", @@ -969,8 +962,8 @@ void print_hdr(nal_cb_t * nal, ptl_hdr_t nal->cb_printf(nal, " Ptl index %d, return md "LPX64"."LPX64", " "match bits "LPX64"\n", hdr->msg.get.ptl_index, - hdr->msg.get.return_wmd.handle_cookie, - hdr->msg.get.return_wmd.handle_idx, + hdr->msg.get.return_wmd.wh_interface_cookie, + hdr->msg.get.return_wmd.wh_object_cookie, hdr->msg.get.match_bits); nal->cb_printf(nal, " Length %d, src offset %d\n", @@ -981,16 +974,16 @@ void print_hdr(nal_cb_t * nal, ptl_hdr_t case PTL_MSG_ACK: nal->cb_printf(nal, " dst md "LPX64"."LPX64", " "manipulated length %d\n", - hdr->msg.ack.dst_wmd.handle_cookie, - hdr->msg.ack.dst_wmd.handle_idx, + hdr->msg.ack.dst_wmd.wh_interface_cookie, + hdr->msg.ack.dst_wmd.wh_object_cookie, hdr->msg.ack.mlength); break; case PTL_MSG_REPLY: nal->cb_printf(nal, " dst md "LPX64"."LPX64", " "length %d\n", - hdr->msg.reply.dst_wmd.handle_cookie, - hdr->msg.reply.dst_wmd.handle_idx, + hdr->msg.reply.dst_wmd.wh_interface_cookie, + hdr->msg.reply.dst_wmd.wh_object_cookie, PTL_HDR_LENGTH(hdr)); } @@ -1133,11 +1126,13 @@ int do_PtlPut(nal_cb_t * nal, void *priv hdr.src_pid = HTON__u32 (ni->pid); PTL_HDR_LENGTH(&hdr) = HTON__u32 (md->length); - if (args->ack_req_in == PTL_ACK_REQ) -#warning FIXME: convert this to proper cookie checking of handle - ptl_handle_pack(&hdr.msg.put.ack_wmd, &args->md_in); - else - ptl_set_invalid_wire(&hdr.msg.put.ack_wmd); + /* NB handles only looked up by creator (no flips) */ + if (args->ack_req_in == PTL_ACK_REQ) { + hdr.msg.put.ack_wmd.wh_interface_cookie = ni->ni_interface_cookie; + hdr.msg.put.ack_wmd.wh_object_cookie = md->md_lh.lh_cookie; + } else { + hdr.msg.put.ack_wmd = PTL_WIRE_HANDLE_NONE; + } hdr.msg.put.match_bits = HTON__u64 (args->match_bits_in); hdr.msg.put.ptl_index = HTON__u32 (args->portal_in); @@ -1209,8 +1204,6 @@ int do_PtlGet(nal_cb_t * nal, void *priv lib_ni_t *ni = &nal->ni; ptl_process_id_t *id = &args->target_in; lib_md_t *md; - ptl_handle_md_t rmd; - unsigned long flags; if (!list_empty (&nal->ni.ni_test_peers) && /* normally we don't */ @@ -1241,9 +1234,10 @@ int do_PtlGet(nal_cb_t * nal, void *priv hdr.src_pid = HTON__u32 (ni->pid); PTL_HDR_LENGTH(&hdr) = 0; -#warning FIXME: convert this to proper cookie checking of handle - ptl_md2handle(&rmd, md, nal); - ptl_handle_pack(&hdr.msg.get.return_wmd, &rmd); + /* NB handles only looked up by creator (no flips) */ + hdr.msg.get.return_wmd.wh_interface_cookie = ni->ni_interface_cookie; + hdr.msg.get.return_wmd.wh_object_cookie = md->md_lh.lh_cookie; + hdr.msg.get.match_bits = HTON__u64 (args->match_bits_in); hdr.msg.get.ptl_index = HTON__u32 (args->portal_in); hdr.msg.get.src_offset = HTON__u32 (args->offset_in); Index: lib-msg.c =================================================================== RCS file: /cvsroot/sandiaportals/portals/lib/lib-msg.c,v retrieving revision 1.42.2.1 retrieving revision 1.42.2.1.6.1 diff -u -w -b -B -p -r1.42.2.1 -r1.42.2.1.6.1 --- lib-msg.c 31 Mar 2003 20:22:38 -0000 1.42.2.1 +++ lib-msg.c 15 May 2003 20:03:15 -0000 1.42.2.1.6.1 @@ -51,7 +51,7 @@ int lib_finalize(nal_cb_t * nal, void *p if (msg->send_ack) { ptl_hdr_t ack; - LASSERT (!ptl_is_invalid_wire (&msg->ack_wmd)); + LASSERT (!ptl_is_wire_handle_none (&msg->ack_wmd)); memset (&ack, 0, sizeof (ack)); ack.type = HTON__u32 (PTL_MSG_ACK); @@ -102,7 +102,7 @@ int lib_finalize(nal_cb_t * nal, void *p */ if ((md->md_flags & PTL_MD_FLAG_AUTO_UNLINKED) == 0 || /* not auto-unlinked */ md->pending != 1) /* not last ref */ - ptl_set_inv_handle (&ev->unlinked_me); + ev->unlinked_me = PTL_HANDLE_NONE; /* Copy the event into the allocated slot, ensuring all the * rest of the event's contents have been copied _before_ |
From: Eric B. <ee...@us...> - 2003-05-15 20:03:50
|
Update of /cvsroot/sandiaportals/portals/linux/tests In directory sc8-pr-cvs1:/tmp/cvs-serv14938/linux/tests Modified Files: Tag: b_proto ping_cli.c ping_srv.c sping_cli.c sping_srv.c Log Message: * PTL_HANDLE_NONE defined as the definitive invalid handle. PTL_EQ_NONE is just another name for the same thing. * PtlHandleEqual(ptl_handle_any_t, ptl_handle_any_t) defined for checking if handles refer to the same thing. * "One-shot" portals handles. Portals MD and ME handles are only valid until the ME/MD is unlinked, and never get re-used in the lifetime of the interface they were created on. * "One-shot" wire handles. No aliasing, even over reboots ensures acked PUTs and GETs only match the MD they were initiated with. * Put the kernel initialisation mutex into PtlNIInit(), to ensure serialised updates to the idx->NAL lookup table. Same mutex now serialises lib_init() * Fixed bug in ptl_handle2md() that could cause PtlMDUnlink() to return PTL_INV_MD when it should have returned PTL_MD_INUSE.\ * Fixed some test programs that thought they could know the numeric value of PTL_EQ_NONE. Index: ping_cli.c =================================================================== RCS file: /cvsroot/sandiaportals/portals/linux/tests/ping_cli.c,v retrieving revision 1.23.2.4 retrieving revision 1.23.2.4.2.1 diff -u -w -b -B -p -r1.23.2.4 -r1.23.2.4.2.1 --- ping_cli.c 19 Mar 2003 19:06:42 -0000 1.23.2.4 +++ ping_cli.c 15 May 2003 20:03:16 -0000 1.23.2.4.2.1 @@ -201,7 +201,7 @@ pingcli_start(struct portal_ioctl_data * client->md_out_head.threshold = args->ioc_count; client->md_out_head.options = PTL_MD_OP_PUT; client->md_out_head.user_ptr = NULL; - client->md_out_head.eventq.handle_idx = -1; + client->md_out_head.eventq = PTL_EQ_NONE; memcpy (client->outbuf, &ping_head_magic, sizeof(ping_bulk_magic)); Index: ping_srv.c =================================================================== RCS file: /cvsroot/sandiaportals/portals/linux/tests/ping_srv.c,v retrieving revision 1.22.2.4 retrieving revision 1.22.2.4.2.1 diff -u -w -b -B -p -r1.22.2.4 -r1.22.2.4.2.1 --- ping_srv.c 12 May 2003 15:11:04 -0000 1.22.2.4 +++ ping_srv.c 15 May 2003 20:03:17 -0000 1.22.2.4.2.1 @@ -131,7 +131,7 @@ int pingsrv_thread(void *arg) server->mdout.threshold = 1; server->mdout.options = PTL_MD_OP_PUT; server->mdout.user_ptr = NULL; - server->mdout.eventq.handle_idx = -1; + server->mdout.eventq = PTL_EQ_NONE; /* Bind the outgoing buffer */ if ((rc = PtlMDBind (server->ni, server->mdout, Index: sping_cli.c =================================================================== RCS file: /cvsroot/sandiaportals/portals/linux/tests/sping_cli.c,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.3.2.1 diff -u -w -b -B -p -r1.2.2.3 -r1.2.2.3.2.1 --- sping_cli.c 17 Mar 2003 15:07:09 -0000 1.2.2.3 +++ sping_cli.c 15 May 2003 20:03:17 -0000 1.2.2.3.2.1 @@ -196,7 +196,7 @@ pingcli_start(struct portal_ioctl_data * client->md_out_head.threshold = 1; client->md_out_head.options = PTL_MD_OP_PUT; client->md_out_head.user_ptr = NULL; - client->md_out_head.eventq.handle_idx = -1; + client->md_out_head.eventq = PTL_EQ_NONE; memcpy (client->outbuf, &ping_head_magic, sizeof(ping_head_magic)); Index: sping_srv.c =================================================================== RCS file: /cvsroot/sandiaportals/portals/linux/tests/sping_srv.c,v retrieving revision 1.2.2.4 retrieving revision 1.2.2.4.2.1 diff -u -w -b -B -p -r1.2.2.4 -r1.2.2.4.2.1 --- sping_srv.c 12 May 2003 15:11:06 -0000 1.2.2.4 +++ sping_srv.c 15 May 2003 20:03:17 -0000 1.2.2.4.2.1 @@ -123,7 +123,7 @@ int pingsrv_thread(void *arg) server->mdout.threshold = 1; server->mdout.options = PTL_MD_OP_PUT; server->mdout.user_ptr = NULL; - server->mdout.eventq.handle_idx = -1; + server->mdout.eventq = PTL_EQ_NONE; /* Bind the outgoing buffer */ if ((rc = PtlMDBind (server->ni, server->mdout, |
From: Eric B. <ee...@us...> - 2003-05-15 20:03:48
|
Update of /cvsroot/sandiaportals/portals/api In directory sc8-pr-cvs1:/tmp/cvs-serv14938/api Modified Files: Tag: b_proto api-eq.c api-ni.c api-wrap.c Log Message: * PTL_HANDLE_NONE defined as the definitive invalid handle. PTL_EQ_NONE is just another name for the same thing. * PtlHandleEqual(ptl_handle_any_t, ptl_handle_any_t) defined for checking if handles refer to the same thing. * "One-shot" portals handles. Portals MD and ME handles are only valid until the ME/MD is unlinked, and never get re-used in the lifetime of the interface they were created on. * "One-shot" wire handles. No aliasing, even over reboots ensures acked PUTs and GETs only match the MD they were initiated with. * Put the kernel initialisation mutex into PtlNIInit(), to ensure serialised updates to the idx->NAL lookup table. Same mutex now serialises lib_init() * Fixed bug in ptl_handle2md() that could cause PtlMDUnlink() to return PTL_INV_MD when it should have returned PTL_MD_INUSE.\ * Fixed some test programs that thought they could know the numeric value of PTL_EQ_NONE. Index: api-eq.c =================================================================== RCS file: /cvsroot/sandiaportals/portals/api/api-eq.c,v retrieving revision 1.25 retrieving revision 1.25.6.1 diff -u -w -b -B -p -r1.25 -r1.25.6.1 --- api-eq.c 10 Mar 2003 07:29:56 -0000 1.25 +++ api-eq.c 15 May 2003 20:03:14 -0000 1.25.6.1 @@ -52,17 +52,21 @@ void ptl_eq_ni_fini(nal_t * nal) int PtlEQGet(ptl_handle_eq_t eventq, ptl_event_t * ev) { - ptl_eq_t *eq = (ptl_eq_t *)eventq.handle_idx; + ptl_eq_t *eq; int rc, new_index; unsigned long flags; ptl_event_t *new_event; nal_t *nal; ENTRY; + if (!ptl_init) + RETURN(PTL_NOINIT); + nal = ptl_hndl2nal(&eventq); if (!nal) - RETURN(PTL_NOINIT); + RETURN(PTL_INV_EQ); + eq = ptl_handle2usereq(&eventq); nal->lock(nal, &flags); /* size must be a power of 2 to handle a wrapped sequence # */ @@ -79,6 +83,11 @@ int PtlEQGet(ptl_handle_eq_t eventq, ptl } *ev = *new_event; + + /* Set the unlinked_me interface number if there is one to pass + * back, since the NAL hasn't a clue what it is and therefore can't + * set it. */ + if (!PtlHandleEqual (ev->unlinked_me, PTL_HANDLE_NONE)) ev->unlinked_me.nal_idx = eventq.nal_idx; /* ensure event is delivered correctly despite possible @@ -100,12 +109,11 @@ int PtlEQGet(ptl_handle_eq_t eventq, ptl int PtlEQWait(ptl_handle_eq_t eventq_in, ptl_event_t *event_out) { int rc; - nal_t *nal = ptl_hndl2nal(&eventq_in); - - if (!nal) - return PTL_NOINIT; + /* PtlEQGet does the handle checking */ while ((rc = PtlEQGet(eventq_in, event_out)) == PTL_EQ_EMPTY) { + nal_t *nal = ptl_hndl2nal(&eventq_in); + if (nal->yield) nal->yield(nal); } @@ -151,44 +159,3 @@ int PtlEQWait_timeout(ptl_handle_eq_t ev #endif -int PtlMDUpdate(ptl_handle_md_t md_in, ptl_md_t * old_inout, - ptl_md_t * new_inout, ptl_handle_eq_t testq_in) -{ - int rc; - int testq = testq_in.handle_idx; - ptl_eq_t *eq; - ptl_seq_t sequence = -1; - nal_t *nal; - - nal = ptl_hndl2nal(&md_in); - if (!nal) - return PTL_NOINIT; - - eq = &nal->ni.eq[testq]; - - if (ptl_is_valid_handle(&testq_in)) { - /* substitute lib eventq handle */ - sequence = eq->sequence; - } - - /* - * Validating the addresseses here is a little tricky. - * We should validate them now, before performing the update. - * That way there is no race condition if a message comes in after - * the update but before we validate. - * - * Cleaning up afterwards is a little tricky, too. - * - * EEB: moved validate into PtlMDUpdate_internal - */ - - rc = PtlMDUpdate_internal(md_in, old_inout, new_inout, testq_in, - sequence); - - /* - * We do not need to invalidate anything here. If the memory - * descriptor is not updated the library will invalidate the - * buffer. - */ - return rc; -} Index: api-ni.c =================================================================== RCS file: /cvsroot/sandiaportals/portals/api/api-ni.c,v retrieving revision 1.12.2.1 retrieving revision 1.12.2.1.6.1 diff -u -w -b -B -p -r1.12.2.1 -r1.12.2.1.6.1 --- api-ni.c 8 Apr 2003 08:41:08 -0000 1.12.2.1 +++ api-ni.c 15 May 2003 20:03:14 -0000 1.12.2.1.6.1 @@ -29,13 +29,19 @@ static nal_t *ptl_interfaces[MAX_NIS]; int ptl_num_interfaces = 0; -inline nal_t *ptl_hndl2nal(ptl_handle_any_t * any) +nal_t *ptl_hndl2nal(ptl_handle_any_t *handle) { - if (any->nal_idx < MAX_NIS) { - return ptl_interfaces[any->nal_idx]; - } else { - return 0; - } + unsigned int idx = handle->nal_idx; + + /* XXX we really rely on the caller NOT racing with interface + * 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 < MAX_NIS) + return ptl_interfaces[idx]; + + return NULL; } int ptl_ni_init(void) @@ -62,6 +68,29 @@ void ptl_ni_fini(void) } } +#ifdef __KERNEL__ +DECLARE_MUTEX(ptl_ni_init_mutex); + +static void ptl_ni_init_mutex_enter (void) +{ + down (&ptl_ni_init_mutex); +} + +static void ptl_ni_init_mutex_exit (void) +{ + up (&ptl_ni_init_mutex); +} + +#else +static void ptl_ni_init_mutex_enter (void) +{ +} + +static void ptl_ni_init_mutex_exit (void) +{ +} + +#endif int PtlNIInit(ptl_interface_t interface, ptl_pt_index_t ptl_size, ptl_ac_index_t acl_size, ptl_pid_t requested_pid, @@ -73,18 +102,21 @@ int PtlNIInit(ptl_interface_t interface, if (!ptl_init) return PTL_NOINIT; + ptl_ni_init_mutex_enter (); + nal = interface(ptl_num_interfaces, ptl_size, acl_size, requested_pid); - if (!nal) + if (!nal) { + ptl_ni_init_mutex_exit (); return PTL_NAL_FAILED; - -#warning FIXME: need to serialise here + } for (i = 0; i < ptl_num_interfaces; i++) { if (ptl_interfaces[i] == nal) { nal->refct++; handle->nal_idx = i; fprintf(stderr, "Returning existing NAL (%d)\n", i); + ptl_ni_init_mutex_exit (); return PTL_OK; } } @@ -94,6 +126,7 @@ int PtlNIInit(ptl_interface_t interface, if (ptl_num_interfaces >= MAX_NIS) { if (nal->shutdown) nal->shutdown (nal, ptl_num_interfaces); + ptl_ni_init_mutex_exit (); return PTL_NOSPACE; } @@ -102,6 +135,7 @@ int PtlNIInit(ptl_interface_t interface, ptl_eq_ni_init(nal); ptl_me_ni_init(nal); + ptl_ni_init_mutex_exit (); return PTL_OK; } @@ -114,22 +148,31 @@ int PtlNIFini(ptl_handle_ni_t ni) if (!ptl_init) return PTL_NOINIT; - nal = PTL_INTERFACE(ni); + ptl_ni_init_mutex_enter (); + + nal = ptl_hndl2nal (&ni); + if (nal == NULL) { + ptl_ni_init_mutex_exit (); + return PTL_INV_HANDLE; + } + nal->refct--; - if (nal->refct > 0) + if (nal->refct > 0) { + ptl_ni_init_mutex_exit (); return PTL_OK; + } ptl_me_ni_fini(nal); ptl_eq_ni_fini(nal); rc = PTL_OK; if (nal->shutdown) - rc = nal->shutdown(nal, PTL_INTERFACE_NUM(ni)); + rc = nal->shutdown(nal, ni.nal_idx); - ptl_interfaces[PTL_INTERFACE_NUM(ni)] = NULL; + ptl_interfaces[ni.nal_idx] = NULL; ptl_num_interfaces--; - + ptl_ni_init_mutex_exit (); return rc; } Index: api-wrap.c =================================================================== RCS file: /cvsroot/sandiaportals/portals/api/api-wrap.c,v retrieving revision 1.22.2.1 retrieving revision 1.22.2.1.4.1 diff -u -w -b -B -p -r1.22.2.1 -r1.22.2.1.4.1 --- api-wrap.c 13 Mar 2003 15:20:22 -0000 1.22.2.1 +++ api-wrap.c 15 May 2003 20:03:14 -0000 1.22.2.1.4.1 @@ -40,11 +40,11 @@ static int do_forward(ptl_handle_any_t a nal = ptl_hndl2nal(&any_h); if (!nal) - return PTL_NOINIT; + return PTL_INV_HANDLE; nal->forward(nal, cmd, argbuf, argsize, retbuf, retsize); - return 0; + return PTL_OK; } int PtlGetId(ptl_handle_ni_t ni_handle, ptl_process_id_t *id) @@ -57,7 +57,7 @@ int PtlGetId(ptl_handle_ni_t ni_handle, rc = do_forward(ni_handle, PTL_GETID, &args, sizeof(args), &ret, sizeof(ret)); - if (rc) + if (rc != PTL_OK) return rc; if (id) @@ -72,11 +72,6 @@ int PtlFailNid (ptl_handle_ni_t interfac PtlFailNid_out ret; int rc; - if (!ptl_init) { - fprintf (stderr, "PtlFailNid: Not initialized\n"); - return (PTL_NOINIT); - } - args.interface = interface; args.nid = nid; args.threshold = threshold; @@ -84,7 +79,7 @@ int PtlFailNid (ptl_handle_ni_t interfac rc = do_forward (interface, PTL_FAILNID, &args, sizeof(args), &ret, sizeof (ret)); - return ((rc != 0) ? rc : ret.rc); + return ((rc != PTL_OK) ? rc : ret.rc); } int PtlNIStatus(ptl_handle_ni_t interface_in, ptl_sr_index_t register_in, @@ -94,27 +89,15 @@ int PtlNIStatus(ptl_handle_ni_t interfac PtlNIStatus_out ret; int rc; - if (!ptl_init) { - fprintf(stderr, "PtlNIStatus: Not initialized\n"); - return PTL_NOINIT; - } - - /* - * Copy arguments into the argument block to - * hand to the forwarding object - */ args.interface_in = interface_in; args.register_in = register_in; rc = do_forward(interface_in, PTL_NISTATUS, &args, sizeof(args), &ret, sizeof(ret)); - if (rc) + if (rc != PTL_OK) return rc; - /* - * Copy the results into the return block - */ if (status_out) *status_out = ret.status_out; @@ -128,31 +111,15 @@ int PtlNIDist(ptl_handle_ni_t interface_ PtlNIDist_out ret; int rc; - if (!ptl_init) { - fprintf(stderr, "PtlNIDist: Not initialized\n"); - return PTL_NOINIT; - } - - if (!distance_out) { - return PTL_SEGV; - } - - /* - * Copy arguments into the argument block to - * hand to the forwarding object - */ args.interface_in = interface_in; args.process_in = process_in; rc = do_forward(interface_in, PTL_NIDIST, &args, sizeof(args), &ret, sizeof(ret)); - if (rc) + if (rc != PTL_OK) return rc; - /* - * Copy the results into the return block - */ if (distance_out) *distance_out = ret.distance_out; @@ -167,23 +134,13 @@ unsigned int PtlNIDebug(ptl_handle_ni_t PtlNIDebug_out ret; int rc; - if (!ptl_init) { - fprintf(stderr, "PtlNIDebug: Not initialized\n"); - return PTL_NOINIT; - } - - /* - * Copy arguments into the argument block to - * hand to the forwarding object - */ args.mask_in = mask_in; rc = do_forward(ni, PTL_NIDEBUG, &args, sizeof(args), &ret, sizeof(ret)); - if (rc) { + if (rc != PTL_OK) return rc; - } return ret.rc; } @@ -197,15 +154,6 @@ int PtlMEAttach(ptl_handle_ni_t interfac PtlMEAttach_out ret; int rc; - if (!ptl_init) { - fprintf(stderr, "PtlMEAttach: Not initialized\n"); - return PTL_NOINIT; - } - - /* - * Copy arguments into the argument block to - * hand to the forwarding object - */ args.interface_in = interface_in; args.index_in = index_in; args.match_id_in = match_id_in; @@ -217,15 +165,12 @@ int PtlMEAttach(ptl_handle_ni_t interfac rc = do_forward(interface_in, PTL_MEATTACH, &args, sizeof(args), &ret, sizeof(ret)); - if (rc) + if (rc != PTL_OK) return rc; - /* - * Copy the results into the return block - */ if (handle_out) { - *handle_out = ret.handle_out; handle_out->nal_idx = interface_in.nal_idx; + handle_out->cookie = ret.handle_out.cookie; } return ret.rc; @@ -240,15 +185,6 @@ int PtlMEInsert(ptl_handle_me_t current_ PtlMEInsert_out ret; int rc; - if (!ptl_init) { - fprintf(stderr, "PtlMEInsert: Not initialized\n"); - return PTL_NOINIT; - } - - /* - * Copy arguments into the argument block to - * hand to the forwarding object - */ args.current_in = current_in; args.match_id_in = match_id_in; args.match_bits_in = match_bits_in; @@ -259,15 +195,12 @@ int PtlMEInsert(ptl_handle_me_t current_ rc = do_forward(current_in, PTL_MEINSERT, &args, sizeof(args), &ret, sizeof(ret)); - if (rc) - return rc; + if (rc != PTL_OK) + return (rc == PTL_INV_HANDLE) ? PTL_INV_ME : rc; - /* - * Copy the results into the return block - */ if (handle_out) { - *handle_out = ret.handle_out; handle_out->nal_idx = current_in.nal_idx; + handle_out->cookie = ret.handle_out.cookie; } return ret.rc; } @@ -278,23 +211,14 @@ int PtlMEUnlink(ptl_handle_me_t current_ PtlMEUnlink_out ret; int rc; - if (!ptl_init) { - fprintf(stderr, "PtlMEUnlink: Not initialized\n"); - return PTL_NOINIT; - } - - /* - * Copy arguments into the argument block to - * hand to the forwarding object - */ args.current_in = current_in; args.unlink_in = PTL_RETAIN; rc = do_forward(current_in, PTL_MEUNLINK, &args, sizeof(args), &ret, sizeof(ret)); - if (rc) - return rc; + if (rc != PTL_OK) + return (rc == PTL_INV_HANDLE) ? PTL_INV_ME : rc; return ret.rc; } @@ -305,21 +229,12 @@ int PtlTblDump(ptl_handle_ni_t ni, int i PtlTblDump_out ret; int rc; - if (!ptl_init) { - fprintf(stderr, "PtlTblDump: Not initialized\n"); - return PTL_NOINIT; - } - - /* - * Copy arguments into the argument block to - * hand to the forwarding object - */ args.index_in = index_in; rc = do_forward(ni, PTL_TBLDUMP, &args, sizeof(args), &ret, sizeof(ret)); - if (rc) + if (rc != PTL_OK) return rc; return ret.rc; @@ -331,22 +246,13 @@ int PtlMEDump(ptl_handle_me_t current_in PtlMEDump_out ret; int rc; - if (!ptl_init) { - fprintf(stderr, "PtlMEDump: Not initialized\n"); - return PTL_NOINIT; - } - - /* - * Copy arguments into the argument block to - * hand to the forwarding object - */ args.current_in = current_in; rc = do_forward(current_in, PTL_MEDUMP, &args, sizeof(args), &ret, sizeof(ret)); - if (rc) - return rc; + if (rc != PTL_OK) + return (rc == PTL_INV_HANDLE) ? PTL_INV_ME : rc; return ret.rc; } @@ -364,7 +270,7 @@ static int validate_md(ptl_handle_any_t nal = ptl_hndl2nal(¤t_in); if (!nal) - return PTL_NOINIT; + return PTL_INV_HANDLE; if (nal->validate != NULL) /* nal->validate not a NOOP */ { @@ -390,16 +296,12 @@ static int validate_md(ptl_handle_any_t return 0; } -static inline void md2eq(ptl_handle_any_t *handle, ptl_md_t *md) +static ptl_handle_eq_t md2eq (ptl_md_t *md) { - ptl_eq_t *eq; - if (!ptl_is_valid_handle(&md->eventq)) { - ptl_set_inv_handle(handle); - return; - } + if (PtlHandleEqual (md->eventq, PTL_EQ_NONE)) + return (PTL_EQ_NONE); - eq = (ptl_eq_t *)md->eventq.handle_idx; - memcpy(handle, &eq->cb_eq_handle, sizeof(*handle)); + return (ptl_handle2usereq (&md->eventq)->cb_eq_handle); } @@ -411,25 +313,23 @@ int PtlMDAttach(ptl_handle_me_t me_in, p int rc; rc = validate_md(me_in, md_in); - if (rc) - RETURN(rc); - - md2eq(&args.eq_in, &md_in); + if (rc == PTL_OK) { + args.eq_in = md2eq(&md_in); args.me_in = me_in; args.md_in = md_in; args.unlink_in = unlink_in; - rc = do_forward(me_in, PTL_MDATTACH, &args, sizeof(args), &ret, - sizeof(ret)); + rc = do_forward(me_in, PTL_MDATTACH, + &args, sizeof(args), &ret, sizeof(ret)); + } - if (rc) - RETURN(rc); + if (rc != PTL_OK) + return (rc == PTL_INV_HANDLE) ? PTL_INV_ME : rc; if (handle_out) { - handle_out->handle_idx = ret.handle_out.handle_idx; handle_out->nal_idx = me_in.nal_idx; + handle_out->cookie = ret.handle_out.cookie; } - return ret.rc; } @@ -443,27 +343,23 @@ int PtlMDBind(ptl_handle_ni_t ni_in, ptl int rc; rc = validate_md(ni_in, md_in); - if (rc) - RETURN(rc); + if (rc != PTL_OK) + return rc; - md2eq(&args.eq_in, &md_in); + args.eq_in = md2eq(&md_in); args.ni_in = ni_in; args.md_in = md_in; - rc = do_forward(ni_in, PTL_MDBIND, &args, sizeof(args), &ret, - sizeof(ret)); + rc = do_forward(ni_in, PTL_MDBIND, + &args, sizeof(args), &ret, sizeof(ret)); - if (rc) + if (rc != PTL_OK) return rc; - /* - * Copy the results into the return block - */ if (handle_out) { - handle_out->handle_idx = ret.handle_out.handle_idx; handle_out->nal_idx = ni_in.nal_idx; + handle_out->cookie = ret.handle_out.cookie; } - return ret.rc; } @@ -467,17 +363,14 @@ int PtlMDBind(ptl_handle_ni_t ni_in, ptl return ret.rc; } -int PtlMDUpdate_internal(ptl_handle_md_t md_in, ptl_md_t * old_inout, - ptl_md_t * new_inout, ptl_handle_eq_t testq_in, - ptl_seq_t sequence_in) +int PtlMDUpdate(ptl_handle_md_t md_in, ptl_md_t *old_inout, + ptl_md_t *new_inout, ptl_handle_eq_t testq_in) { PtlMDUpdate_internal_in args; PtlMDUpdate_internal_out ret; int rc; args.md_in = md_in; - args.testq_in = testq_in; - args.sequence_in = sequence_in; if (old_inout) { args.old_inout = *old_inout; @@ -487,22 +380,28 @@ int PtlMDUpdate_internal(ptl_handle_md_t if (new_inout) { rc = validate_md (md_in, *new_inout); - if (rc != 0) - return (rc); + if (rc != PTL_OK) + return (rc == PTL_INV_HANDLE) ? PTL_INV_MD : rc; args.new_inout = *new_inout; args.new_inout_valid = 1; } else args.new_inout_valid = 0; + if (PtlHandleEqual (testq_in, PTL_EQ_NONE)) { + args.testq_in = PTL_EQ_NONE; + args.sequence_in = -1; + } else { + ptl_eq_t *eq = ptl_handle2usereq (&testq_in); + + args.testq_in = eq->cb_eq_handle; + args.sequence_in = eq->sequence; + } + rc = do_forward(md_in, PTL_MDUPDATE, &args, sizeof(args), &ret, sizeof(ret)); + if (rc != PTL_OK) + return (rc == PTL_INV_HANDLE) ? PTL_INV_MD : rc; - if (rc) - return rc; - - /* - * Copy the results into the return block - */ if (old_inout) *old_inout = ret.old_inout; @@ -515,21 +414,11 @@ int PtlMDUnlink(ptl_handle_md_t md_in) PtlMDUnlink_out ret; int rc; - if (!ptl_init) { - fprintf(stderr, "PtlMDUnlink: Not initialized\n"); - return PTL_NOINIT; - } - - /* - * Copy arguments into the argument block to - * hand to the forwarding object - */ args.md_in = md_in; rc = do_forward(md_in, PTL_MDUNLINK, &args, sizeof(args), &ret, sizeof(ret)); - - if (rc) - return rc; + if (rc != PTL_OK) + return (rc == PTL_INV_HANDLE) ? PTL_INV_MD : rc; return ret.rc; } @@ -546,10 +434,13 @@ int PtlEQAlloc(ptl_handle_ni_t interface int rc, i; nal_t *nal; - nal = ptl_hndl2nal(&interface); - if (!nal) + if (!ptl_init) return PTL_NOINIT; + nal = ptl_hndl2nal (&interface); + if (nal == NULL) + return PTL_INV_HANDLE; + if (count != LOWEST_BIT_SET(count)) { /* not a power of 2 already */ do { /* knock off all but the top bit... */ count &= ~LOWEST_BIT_SET (count); @@ -570,7 +461,7 @@ int PtlEQAlloc(ptl_handle_ni_t interface if (nal->validate != NULL) { rc = nal->validate(nal, ev, count * sizeof(ptl_event_t)); - if (rc) + if (rc != PTL_OK) goto fail; } @@ -582,7 +473,7 @@ int PtlEQAlloc(ptl_handle_ni_t interface rc = do_forward(interface, PTL_EQALLOC, &args, sizeof(args), &ret, sizeof(ret)); - if (rc) + if (rc != PTL_OK) goto fail; if (ret.rc) GOTO(fail, rc = ret.rc); @@ -593,14 +484,22 @@ int PtlEQAlloc(ptl_handle_ni_t interface goto fail; } - ret.handle_out.nal_idx = interface.nal_idx; - memcpy(&eq->cb_eq_handle, &ret.handle_out, sizeof(ret.handle_out)); - eq->sequence = 1; eq->size = count; eq->base = ev; - handle_out->handle_idx = (unsigned long)eq; + + /* EQ handles are a little wierd. PtlEQGet() just looks at the + * queued events in shared memory. It doesn't want to do_forward() + * at all, so the cookie in the EQ handle we pass out of here is + * simply a pointer to the event queue we just set up. We stash + * the handle returned by do_forward(), so we can pass it back via + * do_forward() when we need to. */ + + eq->cb_eq_handle.nal_idx = interface.nal_idx; + eq->cb_eq_handle.cookie = ret.handle_out.cookie; + handle_out->nal_idx = interface.nal_idx; + handle_out->cookie = (__u64)((unsigned long)eq); return PTL_OK; fail: @@ -615,16 +514,13 @@ int PtlEQFree(ptl_handle_eq_t eventq) ptl_eq_t *eq; int rc; - eq = (ptl_eq_t *)eventq.handle_idx; - memcpy(&args.eventq_in, &eq->cb_eq_handle, sizeof(eq->cb_eq_handle)); + eq = ptl_handle2usereq (&eventq); + args.eventq_in = eq->cb_eq_handle; rc = do_forward(eq->cb_eq_handle, PTL_EQFREE, &args, sizeof(args), &ret, sizeof(ret)); - /* - * The library will have already invalidated this region - * as a result of the EQFree call. - */ + /* XXX we're betting rc == PTL_OK here */ PORTAL_FREE(eq->base, eq->size * sizeof(ptl_event_t)); PORTAL_FREE(eq, sizeof(*eq)); @@ -638,11 +534,6 @@ int PtlACEntry(ptl_handle_ni_t ni_in, pt PtlACEntry_out ret; int rc; - if (!ptl_init) { - fprintf(stderr, "PtlACEntry: Not initialized\n"); - return PTL_NOINIT; - } - /* * Copy arguments into the argument block to * hand to the forwarding object @@ -655,7 +546,7 @@ int PtlACEntry(ptl_handle_ni_t ni_in, pt rc = do_forward(ni_in, PTL_ACENTRY, &args, sizeof(args), &ret, sizeof(ret)); - return ret.rc; + return (rc != PTL_OK) ? rc : ret.rc; } int PtlPut(ptl_handle_md_t md_in, ptl_ack_req_t ack_req_in, @@ -667,11 +558,6 @@ int PtlPut(ptl_handle_md_t md_in, ptl_ac PtlPut_out ret; int rc; - if (!ptl_init) { - fprintf(stderr, "PtlPut: Not initialized\n"); - return PTL_NOINIT; - } - /* * Copy arguments into the argument block to * hand to the forwarding object @@ -687,7 +573,7 @@ int PtlPut(ptl_handle_md_t md_in, ptl_ac rc = do_forward(md_in, PTL_PUT, &args, sizeof(args), &ret, sizeof(ret)); - return ret.rc; + return (rc != PTL_OK) ? rc : ret.rc; } int PtlGet(ptl_handle_md_t md_in, ptl_process_id_t target_in, @@ -698,11 +584,6 @@ int PtlGet(ptl_handle_md_t md_in, ptl_pr PtlGet_out ret; int rc; - if (!ptl_init) { - fprintf(stderr, "PtlGet: Not initialized\n"); - return PTL_NOINIT; - } - /* * Copy arguments into the argument block to * hand to the forwarding object @@ -716,5 +597,5 @@ int PtlGet(ptl_handle_md_t md_in, ptl_pr rc = do_forward(md_in, PTL_GET, &args, sizeof(args), &ret, sizeof(ret)); - return ret.rc; + return (rc != PTL_OK) ? rc : ret.rc; } |
From: Eric B. <ee...@us...> - 2003-05-15 20:03:20
|
Update of /cvsroot/sandiaportals/portals/user/tests In directory sc8-pr-cvs1:/tmp/cvs-serv14938/user/tests Modified Files: Tag: b_proto pingclient.c Log Message: * PTL_HANDLE_NONE defined as the definitive invalid handle. PTL_EQ_NONE is just another name for the same thing. * PtlHandleEqual(ptl_handle_any_t, ptl_handle_any_t) defined for checking if handles refer to the same thing. * "One-shot" portals handles. Portals MD and ME handles are only valid until the ME/MD is unlinked, and never get re-used in the lifetime of the interface they were created on. * "One-shot" wire handles. No aliasing, even over reboots ensures acked PUTs and GETs only match the MD they were initiated with. * Put the kernel initialisation mutex into PtlNIInit(), to ensure serialised updates to the idx->NAL lookup table. Same mutex now serialises lib_init() * Fixed bug in ptl_handle2md() that could cause PtlMDUnlink() to return PTL_INV_MD when it should have returned PTL_MD_INUSE.\ * Fixed some test programs that thought they could know the numeric value of PTL_EQ_NONE. Index: pingclient.c =================================================================== RCS file: /cvsroot/sandiaportals/portals/user/tests/pingclient.c,v retrieving revision 1.3.2.1 retrieving revision 1.3.2.1.2.1 diff -u -w -b -B -p -r1.3.2.1 -r1.3.2.1.2.1 --- pingclient.c 17 Mar 2003 00:47:19 -0000 1.3.2.1 +++ pingclient.c 15 May 2003 20:03:17 -0000 1.3.2.1.2.1 @@ -70,7 +70,7 @@ static int pingcli_start(void *data) goto error_1; } - printf("going to attach ni=%ld rc=%d\n", ni.handle_idx, rc); + printf("going to attach ni=%ld rc=%d\n", ni.nal_idx, rc); id_local.nid = PTL_NID_ANY; id_local.pid = PTL_PID_ANY; @@ -111,7 +111,7 @@ static int pingcli_start(void *data) // md_outgoing.max_offset = args->size+128; md_outgoing.options = PTL_MD_OP_PUT; md_outgoing.user_ptr = NULL; - md_outgoing.eventq.handle_idx = -1; + md_outgoing.eventq = PTL_EQ_NONE; if ((rc = PtlMDBind(ni, md_outgoing, &md2))) { test_fail("PtlMDBind", rc); |
From: Eric B. <ee...@us...> - 2003-05-15 20:03:20
|
Update of /cvsroot/sandiaportals/portals/linux/rqswnal In directory sc8-pr-cvs1:/tmp/cvs-serv14938/linux/rqswnal Modified Files: Tag: b_proto qswnal_cb.c Log Message: * PTL_HANDLE_NONE defined as the definitive invalid handle. PTL_EQ_NONE is just another name for the same thing. * PtlHandleEqual(ptl_handle_any_t, ptl_handle_any_t) defined for checking if handles refer to the same thing. * "One-shot" portals handles. Portals MD and ME handles are only valid until the ME/MD is unlinked, and never get re-used in the lifetime of the interface they were created on. * "One-shot" wire handles. No aliasing, even over reboots ensures acked PUTs and GETs only match the MD they were initiated with. * Put the kernel initialisation mutex into PtlNIInit(), to ensure serialised updates to the idx->NAL lookup table. Same mutex now serialises lib_init() * Fixed bug in ptl_handle2md() that could cause PtlMDUnlink() to return PTL_INV_MD when it should have returned PTL_MD_INUSE.\ * Fixed some test programs that thought they could know the numeric value of PTL_EQ_NONE. Index: qswnal_cb.c =================================================================== RCS file: /cvsroot/sandiaportals/portals/linux/rqswnal/qswnal_cb.c,v retrieving revision 1.24.2.4 retrieving revision 1.24.2.4.2.1 diff -u -w -b -B -p -r1.24.2.4 -r1.24.2.4.2.1 --- qswnal_cb.c 6 May 2003 14:28:01 -0000 1.24.2.4 +++ qswnal_cb.c 15 May 2003 20:03:16 -0000 1.24.2.4.2.1 @@ -513,8 +513,8 @@ kqswnal_cerror_hdr(ptl_hdr_t * hdr) CERROR(" Ptl index %d, ack md "LPX64"."LPX64", " "match bits "LPX64"\n", NTOH__u32 (hdr->msg.put.ptl_index), - NTOH__u64 (hdr->msg.put.ack_wmd.handle_cookie), - NTOH__u64 (hdr->msg.put.ack_wmd.handle_idx), + hdr->msg.put.ack_wmd.wh_interface_cookie, + hdr->msg.put.ack_wmd.wh_object_cookie, NTOH__u64 (hdr->msg.put.match_bits)); CERROR(" Length %d, offset %d, hdr data "LPX64"\n", NTOH__u32(PTL_HDR_LENGTH(hdr)), @@ -526,8 +526,8 @@ kqswnal_cerror_hdr(ptl_hdr_t * hdr) CERROR(" Ptl index %d, return md "LPX64"."LPX64", " "match bits "LPX64"\n", NTOH__u32 (hdr->msg.get.ptl_index), - NTOH__u64 (hdr->msg.get.return_wmd.handle_cookie), - NTOH__u64 (hdr->msg.get.return_wmd.handle_idx), + hdr->msg.get.return_wmd.wh_interface_cookie, + hdr->msg.get.return_wmd.wh_object_cookie, hdr->msg.get.match_bits); CERROR(" Length %d, src offset %d\n", NTOH__u32 (hdr->msg.get.sink_length), @@ -536,15 +536,15 @@ kqswnal_cerror_hdr(ptl_hdr_t * hdr) case PTL_MSG_ACK: CERROR(" dst md "LPX64"."LPX64", manipulated length %d\n", - NTOH__u64 (hdr->msg.ack.dst_wmd.handle_cookie), - NTOH__u64 (hdr->msg.ack.dst_wmd.handle_idx), + hdr->msg.ack.dst_wmd.wh_interface_cookie, + hdr->msg.ack.dst_wmd.wh_object_cookie, NTOH__u32 (hdr->msg.ack.mlength)); break; case PTL_MSG_REPLY: CERROR(" dst md "LPX64"."LPX64", length %d\n", - NTOH__u64 (hdr->msg.reply.dst_wmd.handle_cookie), - NTOH__u64 (hdr->msg.reply.dst_wmd.handle_idx), + hdr->msg.reply.dst_wmd.wh_interface_cookie, + hdr->msg.reply.dst_wmd.wh_object_cookie, NTOH__u32 (PTL_HDR_LENGTH(hdr))); } |
From: Hariharan T. <th...@us...> - 2003-05-14 20:46:13
|
Update of /cvsroot/sandiaportals/portals/linux/oslib In directory sc8-pr-cvs1:/tmp/cvs-serv18173/linux/oslib Modified Files: Tag: b_devel module.c Log Message: bug#1274 - debug_daemon must able to take file size greater than 5000 Index: module.c =================================================================== RCS file: /cvsroot/sandiaportals/portals/linux/oslib/module.c,v retrieving revision 1.80.2.11 retrieving revision 1.80.2.12 diff -u -w -b -B -p -r1.80.2.11 -r1.80.2.12 --- module.c 12 May 2003 15:11:04 -0000 1.80.2.11 +++ module.c 14 May 2003 20:46:08 -0000 1.80.2.12 @@ -322,7 +322,7 @@ static int kportal_ioctl(struct inode *i (unsigned int) data->ioc_count, (unsigned int) data->ioc_inllen1, (char *) data->ioc_inlbuf1, - (unsigned int) data->ioc_inllen2)); + (unsigned int) data->ioc_misc)); case IOC_PORTAL_GET_DEBUG: { __s32 size = portals_debug_copy_to_user(data->ioc_pbuf1, data->ioc_plen1); |
From: Hariharan T. <th...@us...> - 2003-05-14 20:46:13
|
Update of /cvsroot/sandiaportals/portals/linux/utils In directory sc8-pr-cvs1:/tmp/cvs-serv18173/linux/utils Modified Files: Tag: b_devel debug.c Log Message: bug#1274 - debug_daemon must able to take file size greater than 5000 Index: debug.c =================================================================== RCS file: /cvsroot/sandiaportals/portals/linux/utils/debug.c,v retrieving revision 1.10.2.5 retrieving revision 1.10.2.6 diff -u -w -b -B -p -r1.10.2.5 -r1.10.2.6 --- debug.c 1 May 2003 05:11:00 -0000 1.10.2.5 +++ debug.c 14 May 2003 20:46:09 -0000 1.10.2.6 @@ -376,7 +376,7 @@ int jt_dbg_debug_daemon(int argc, char * ok: data.ioc_inllen1 = strlen(argv[2]) + 1; data.ioc_inlbuf1 = argv[2]; - data.ioc_inllen2 = 0; + data.ioc_misc = 0; if (argc == 4) { unsigned long size; errno = 0; @@ -386,7 +386,7 @@ ok: argv[3], strerror(errno)); return -1; } - data.ioc_inllen2 = size; + data.ioc_misc = size; } } data.ioc_count = cmd; |
From: Robert R. <rr...@us...> - 2003-05-14 17:22:55
|
Update of /cvsroot/sandiaportals/portals/linux/oslib In directory sc8-pr-cvs1:/tmp/cvs-serv303/linux/oslib Modified Files: Tag: b_devel debug.c proc.c Log Message: b=1046 r=shaver - new portals upcall. Currently only used for LBUG upcalls. Index: debug.c =================================================================== RCS file: /cvsroot/sandiaportals/portals/linux/oslib/debug.c,v retrieving revision 1.46.2.12 retrieving revision 1.46.2.13 diff -u -w -b -B -p -r1.46.2.12 -r1.46.2.13 --- debug.c 13 May 2003 15:38:37 -0000 1.46.2.12 +++ debug.c 14 May 2003 17:22:52 -0000 1.46.2.13 @@ -216,6 +216,8 @@ spinlock_t portals_debug_lock = SPIN_LOC char debug_file_path[1024] = "/tmp/lustre-log"; char debug_file_name[1024]; int handled_panic; /* to avoid recursive calls to notifiers */ +char portals_upcall[1024] = "/usr/lib/lustre/portals_upcall"; + int portals_do_debug_dumplog(void *arg) { @@ -778,6 +780,41 @@ void portals_debug_set_level(unsigned in portal_debug = debug_level; } +void portals_run_lbug_upcall(char * file, char *fn, int line) +{ + char *argv[6]; + char *envp[3]; + char buf[32]; + int rc; + + ENTRY; + snprintf (buf, sizeof buf, "%d", line); + + argv[0] = portals_upcall; + argv[1] = "LBUG"; + argv[2] = file; + argv[3] = fn; + argv[4] = buf; + argv[5] = NULL; + + envp[0] = "HOME=/"; + envp[1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin"; + envp[2] = NULL; + + rc = call_usermodehelper(argv[0], argv, envp); + if (rc < 0) { + CERROR("Error invoking lbug upcall %s %s %s %s %s: %d; check " + "/proc/sys/portals/upcall\n", + argv[0], argv[1], argv[2], argv[3], argv[4], rc); + + } else { + CERROR("Invoked upcall %s %s %s %s %s\n", + argv[0], argv[1], argv[2], argv[3], argv[4]); + } +} + + EXPORT_SYMBOL(portals_debug_dumplog); EXPORT_SYMBOL(portals_debug_msg); EXPORT_SYMBOL(portals_debug_set_level); +EXPORT_SYMBOL(portals_run_lbug_upcall); Index: proc.c =================================================================== RCS file: /cvsroot/sandiaportals/portals/linux/oslib/proc.c,v retrieving revision 1.24.2.2 retrieving revision 1.24.2.3 diff -u -w -b -B -p -r1.24.2.2 -r1.24.2.3 --- proc.c 2 Apr 2003 18:35:07 -0000 1.24.2.2 +++ proc.c 14 May 2003 17:22:52 -0000 1.24.2.3 @@ -57,6 +57,7 @@ static struct ctl_table_header *portals_table_header = NULL; extern char debug_file_path[1024]; extern char debug_daemon_file_path[1024]; +extern char portals_upcall[1024]; #define PSDEV_PORTALS (0x100) #define PSDEV_DEBUG 1 /* control debugging */ @@ -64,8 +65,9 @@ extern char debug_daemon_file_path[1024] #define PSDEV_PRINTK 3 /* force all errors to console */ #define PSDEV_DEBUG_PATH 4 /* crashdump log location */ #define PSDEV_DEBUG_DUMP_PATH 5 /* crashdump tracelog location */ +#define PSDEV_PORTALS_UPCALL 6 /* User mode upcall script */ -#define PORTALS_PRIMARY_CTLCNT 5 +#define PORTALS_PRIMARY_CTLCNT 6 static struct ctl_table portals_table[PORTALS_PRIMARY_CTLCNT + 1] = { {PSDEV_DEBUG, "debug", &portal_debug, sizeof(int), 0644, NULL, &proc_dointvec}, @@ -77,6 +79,9 @@ static struct ctl_table portals_table[PO sizeof(debug_file_path), 0644, NULL, &proc_dostring, &sysctl_string}, {PSDEV_DEBUG_DUMP_PATH, "debug_daemon_path", debug_daemon_file_path, sizeof(debug_daemon_file_path), 0644, NULL, &proc_dostring, + &sysctl_string}, + {PSDEV_PORTALS_UPCALL, "upcall", portals_upcall, + sizeof(portals_upcall), 0644, NULL, &proc_dostring, &sysctl_string}, {0} }; |
From: Robert R. <rr...@us...> - 2003-05-14 17:22:55
|
Update of /cvsroot/sandiaportals/portals/include/linux In directory sc8-pr-cvs1:/tmp/cvs-serv303/include/linux Modified Files: Tag: b_devel kp30.h Log Message: b=1046 r=shaver - new portals upcall. Currently only used for LBUG upcalls. Index: kp30.h =================================================================== RCS file: /cvsroot/sandiaportals/portals/include/linux/kp30.h,v retrieving revision 1.111.2.16 retrieving revision 1.111.2.17 diff -u -w -b -B -p -r1.111.2.16 -r1.111.2.17 --- kp30.h 12 May 2003 15:11:03 -0000 1.111.2.16 +++ kp30.h 14 May 2003 17:22:51 -0000 1.111.2.17 @@ -217,6 +217,7 @@ extern void kportal_assertion_failed(cha do { \ CEMERG("LBUG - trying to dump log to /tmp/lustre-log\n"); \ portals_debug_dumplog(); \ + portals_run_lbug_upcall(__FILE__, __FUNCTION__, __LINE__); \ panic("LBUG"); \ } while (0) #else @@ -224,6 +225,7 @@ do { do { \ CEMERG("LBUG\n"); \ portals_debug_dumplog(); \ + portals_run_lbug_upcall(__FILE__, __FUNCTION__, __LINE__); \ set_task_state(current, TASK_UNINTERRUPTIBLE); \ schedule(); \ } while (0) @@ -553,6 +555,7 @@ extern struct prof_ent prof_ents[MAX_PRO #endif /* PORTALS_PROFILING */ /* debug.c */ +void portals_run_lbug_upcall(char * file, char *fn, int line); void portals_debug_dumplog(void); int portals_debug_init(unsigned long bufsize); int portals_debug_cleanup(void); |
From: Robert R. <rr...@us...> - 2003-05-13 15:38:41
|
Update of /cvsroot/sandiaportals/portals/linux/oslib In directory sc8-pr-cvs1:/tmp/cvs-serv22208/linux/oslib Modified Files: Tag: b_devel debug.c Log Message: add a newline Index: debug.c =================================================================== RCS file: /cvsroot/sandiaportals/portals/linux/oslib/debug.c,v retrieving revision 1.46.2.11 retrieving revision 1.46.2.12 diff -u -w -b -B -p -r1.46.2.11 -r1.46.2.12 --- debug.c 25 Apr 2003 20:42:00 -0000 1.46.2.11 +++ debug.c 13 May 2003 15:38:37 -0000 1.46.2.12 @@ -237,7 +237,7 @@ int portals_do_debug_dumplog(void *arg) CERROR("cannot open %s for dumping", debug_file_name); GOTO(out, PTR_ERR(file)); } else { - printk(KERN_ALERT "dumping log to %s ... writing ... ", + printk(KERN_ALERT "dumping log to %s ... writing ...\n", debug_file_name); } |
From: Eric B. <ee...@us...> - 2003-05-12 15:12:06
|
Update of /cvsroot/sandiaportals/portals/linux In directory sc8-pr-cvs1:/tmp/cvs-serv11944/linux Modified Files: Tag: b_devel Makefile.am configure.in Log Message: * Added Nikke's scimacnal Index: Makefile.am =================================================================== RCS file: /cvsroot/sandiaportals/portals/linux/Makefile.am,v retrieving revision 1.19 retrieving revision 1.19.2.1 diff -u -w -b -B -p -r1.19 -r1.19.2.1 --- Makefile.am 3 Mar 2003 17:23:27 -0000 1.19 +++ Makefile.am 12 May 2003 15:11:04 -0000 1.19.2.1 @@ -5,7 +5,7 @@ EXTRA_DIST = Rules.linux archdep.m4 MCP DIST_SUBDIRS = p3mod oslib socknal utils tests packaging router \ - rqswnal gmnal rtscts ptrxtx toenal + rqswnal gmnal rtscts ptrxtx toenal scimacnal SUBDIRS = oslib socknal utils tests packaging router \ p3mod ptrxtx rtscts toenal \ - @QSWNAL@ @GMNAL@ + @QSWNAL@ @GMNAL@ @SCIMACNAL@ Index: configure.in =================================================================== RCS file: /cvsroot/sandiaportals/portals/linux/configure.in,v retrieving revision 1.52.2.1 retrieving revision 1.52.2.2 diff -u -w -b -B -p -r1.52.2.1 -r1.52.2.2 --- configure.in 18 Apr 2003 18:35:00 -0000 1.52.2.1 +++ configure.in 12 May 2003 15:11:04 -0000 1.52.2.2 @@ -130,6 +130,26 @@ 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) + + AC_MSG_CHECKING(if make dep has been run in kernel source) if test -f $LINUX/include/linux/config.h ; then AC_MSG_RESULT(yes) @@ -147,7 +167,7 @@ fi AC_SUBST(MOD_LINK) KINCFLAGS='-I. -I$(LINUX)/include -I$(top_srcdir)/include -I$(top_srcdir)/../include ' -CPPFLAGS="$KINCFLAGS $ARCHCPPFLAGS $enable_zerocopy $enable_affinity $with_quadrics $with_gm " +CPPFLAGS="$KINCFLAGS $ARCHCPPFLAGS $enable_zerocopy $enable_affinity $with_quadrics $with_gm $with_scamac " CPLANTFL="-I$CPLANT/include -I$CPLANT/compute/OS/Myrinet -I$CPLANT/compute/OS/Myrinet/include -I.. -I$CPLANT/compute/OS -I$CPLANT/include/sys -I/usr/src/sandiaportals/portals/include/portals -I$CPLANT/include/portals -I$CPLANT/compute/OS/Myrinet/util -I../MCP " AC_SUBST(CPLANTFL) @@ -184,5 +204,6 @@ AC_OUTPUT([Makefile rtscts/Makefile rtsc p3mod/Makefile oslib/Makefile socknal/Makefile \ rqswnal/Makefile gmnal/Makefile tests/Makefile \ utils/Makefile router/Makefile packaging/Makefile \ - packaging/portals.spec ptrxtx/Makefile toenal/Makefile]) + packaging/portals.spec ptrxtx/Makefile toenal/Makefile \ + scimacnal/Makefile]) |
From: Eric B. <ee...@us...> - 2003-05-12 15:11:39
|
Update of /cvsroot/sandiaportals/portals/linux/oslib In directory sc8-pr-cvs1:/tmp/cvs-serv11944/linux/oslib Modified Files: Tag: b_devel module.c Log Message: * Added Nikke's scimacnal Index: module.c =================================================================== RCS file: /cvsroot/sandiaportals/portals/linux/oslib/module.c,v retrieving revision 1.80.2.10 retrieving revision 1.80.2.11 diff -u -w -b -B -p -r1.80.2.10 -r1.80.2.11 --- module.c 8 Apr 2003 18:49:07 -0000 1.80.2.10 +++ module.c 12 May 2003 15:11:04 -0000 1.80.2.11 @@ -217,6 +217,8 @@ kportal_get_ni (int nal) case TCPNAL: /* userspace NAL */ return (NULL); + case SCIMACNAL: + return (PORTAL_SYMBOL_GET(kscimacnal_ni)); default: /* A warning to a naive caller */ CERROR ("unknown nal: %d\n", nal); @@ -245,6 +247,9 @@ kportal_put_ni (int nal) case TCPNAL: /* A lesson to a malicious caller */ LBUG (); + case SCIMACNAL: + PORTAL_SYMBOL_PUT(kscimacnal_ni); + break; default: CERROR ("unknown nal: %d\n", nal); } |
From: Eric B. <ee...@us...> - 2003-05-12 15:11:36
|
Update of /cvsroot/sandiaportals/portals/include/linux In directory sc8-pr-cvs1:/tmp/cvs-serv11944/include/linux Modified Files: Tag: b_devel kp30.h Log Message: * Added Nikke's scimacnal Index: kp30.h =================================================================== RCS file: /cvsroot/sandiaportals/portals/include/linux/kp30.h,v retrieving revision 1.111.2.15 retrieving revision 1.111.2.16 diff -u -w -b -B -p -r1.111.2.15 -r1.111.2.16 --- kp30.h 3 May 2003 21:07:11 -0000 1.111.2.15 +++ kp30.h 12 May 2003 15:11:03 -0000 1.111.2.16 @@ -862,6 +862,7 @@ enum { GMNAL, TOENAL, TCPNAL, + SCIMACNAL, NAL_ENUM_END_MARKER }; @@ -870,6 +871,7 @@ extern ptl_handle_ni_t kqswnal_ni; extern ptl_handle_ni_t ksocknal_ni; extern ptl_handle_ni_t ktoenal_ni; extern ptl_handle_ni_t kgmnal_ni; +extern ptl_handle_ni_t kscimacnal_ni; #endif #define NAL_MAX_NR (NAL_ENUM_END_MARKER - 1) |
From: Eric B. <ee...@us...> - 2003-05-12 15:11:09
|
Update of /cvsroot/sandiaportals/portals/linux/tests In directory sc8-pr-cvs1:/tmp/cvs-serv11944/linux/tests Modified Files: Tag: b_devel ping_srv.c sping_srv.c Log Message: * Added Nikke's scimacnal Index: ping_srv.c =================================================================== RCS file: /cvsroot/sandiaportals/portals/linux/tests/ping_srv.c,v retrieving revision 1.22.2.3 retrieving revision 1.22.2.4 diff -u -w -b -B -p -r1.22.2.3 -r1.22.2.4 --- ping_srv.c 31 Mar 2003 20:22:49 -0000 1.22.2.3 +++ ping_srv.c 12 May 2003 15:11:04 -0000 1.22.2.4 @@ -297,7 +297,8 @@ static void __exit pingsrv_cleanup(void) MODULE_PARM(nal, "i"); -MODULE_PARM_DESC(nal, "Use the specified NAL (4-toenal, 2-ksocknal, 1-kqswnal)"); +MODULE_PARM_DESC(nal, "Use the specified NAL " + "(6-kscimacnal, 4-toenal, 2-ksocknal, 1-kqswnal)"); MODULE_AUTHOR("Brian Behlendorf (LLNL)"); MODULE_DESCRIPTION("A kernel space ping server for portals testing"); Index: sping_srv.c =================================================================== RCS file: /cvsroot/sandiaportals/portals/linux/tests/sping_srv.c,v retrieving revision 1.2.2.3 retrieving revision 1.2.2.4 diff -u -w -b -B -p -r1.2.2.3 -r1.2.2.4 --- sping_srv.c 31 Mar 2003 20:22:51 -0000 1.2.2.3 +++ sping_srv.c 12 May 2003 15:11:06 -0000 1.2.2.4 @@ -284,7 +284,8 @@ static void __exit pingsrv_cleanup(void) MODULE_PARM(nal, "i"); -MODULE_PARM_DESC(nal, "Use the specified NAL (4-toenal, 2-ksocknal, 1-kqswnal)"); +MODULE_PARM_DESC(nal, "Use the specified NAL " + "(6-kscimacnal, 4-toenal, 2-ksocknal, 1-kqswnal)"); MODULE_AUTHOR("Brian Behlendorf (LLNL)"); MODULE_DESCRIPTION("A kernel space ping server for portals testing"); |
From: Eric B. <ee...@us...> - 2003-05-12 15:11:09
|
Update of /cvsroot/sandiaportals/portals/linux/utils In directory sc8-pr-cvs1:/tmp/cvs-serv11944/linux/utils Modified Files: Tag: b_devel portals.c Log Message: * Added Nikke's scimacnal Index: portals.c =================================================================== RCS file: /cvsroot/sandiaportals/portals/linux/utils/portals.c,v retrieving revision 1.12.2.3 retrieving revision 1.12.2.4 diff -u -w -b -B -p -r1.12.2.3 -r1.12.2.4 --- portals.c 6 May 2003 14:28:01 -0000 1.12.2.3 +++ portals.c 12 May 2003 15:11:06 -0000 1.12.2.4 @@ -64,6 +64,7 @@ static name2num_t nalnames[] = { {"toe", TOENAL}, {"elan", QSWNAL}, {"gm", GMNAL}, + {"scimac", SCIMACNAL}, {NULL, -1} }; @@ -147,6 +148,12 @@ ptl_parse_nid (ptl_nid_t *nidp, char *st return (0); } + if (sscanf (str, "%x", &a) == 1) + { + *nidp = (ptl_nid_t) a; + return (0); + } + return (-1); } @@ -159,6 +166,10 @@ ptl_nid2str (char *buffer, ptl_nid_t nid sprintf (buffer, LPD64, nid); return (buffer); + case SCIMACNAL: + sprintf (buffer, LPX64, nid); + return (buffer); + case SOCKNAL: { __u32 addr = htonl((__u32)nid); /* back to NETWORK byte order */ struct hostent *he = gethostbyaddr ((const char *)&addr, sizeof (addr), AF_INET); @@ -505,6 +516,16 @@ int jt_ptl_connect(int argc, char **argv g_nid = atoi(argv[1]); } else if (g_nal == GMNAL) { g_nid = atoi(argv[1]); + } else if (g_nal == SCIMACNAL) { + unsigned int tmpnid; + if(sscanf(argv[1], "%x", &tmpnid) == 1) { + g_nid=tmpnid; + } + else { + fprintf(stderr, "nid %s invalid for SCI nal\n", argv[1]); + } + + } else { fprintf(stderr, "This should never happen. Also it is very " "bad.\n"); @@ -558,6 +579,9 @@ int jt_ptl_disconnect(int argc, char **a } else if (g_nal == GMNAL) { printf("'disconnect' doesn't make any sense for " "GM.\n"); + } else if (g_nal == SCIMACNAL) { + printf("'disconnect' doesn't make any sense for " + "SCI.\n"); } else { fprintf(stderr, "This should never happen. Also it is very " "bad.\n"); @@ -610,6 +634,8 @@ int jt_ptl_push_connection (int argc, ch printf("'push' doesn't make any sense for elan.\n"); } else if (g_nal == GMNAL) { printf("'push' doesn't make any sense for GM.\n"); + } else if (g_nal == SCIMACNAL) { + printf("'push' doesn't make any sense for SCI.\n"); } else { fprintf(stderr, "This should never happen. Also it is very " "bad.\n"); @@ -704,6 +730,9 @@ int jt_ptl_mynid(int argc, char **argv) return -1; } else if (g_nal == GMNAL) { fprintf(stderr, "'mynid' doesn't make any sense for GM.\n"); + return -1; + } else if (g_nal == SCIMACNAL) { + fprintf(stderr, "'mynid' doesn't make any sense for SCI.\n"); return -1; } |
From: Eric B. <ee...@us...> - 2003-05-12 15:11:09
|
Update of /cvsroot/sandiaportals/portals/linux/scimacnal In directory sc8-pr-cvs1:/tmp/cvs-serv11944/linux/scimacnal Added Files: Tag: b_devel .cvsignore Makefile.am README.scimacnal scimac.conf scimacnal.c scimacnal.h scimacnal_cb.c Log Message: * Added Nikke's scimacnal --- NEW FILE --- .deps Makefile Makefile.in --- NEW FILE --- # This code is issued under the GNU General Public License. # See the file COPYING in this distribution include ../Rules.linux MODULE = kscimacnal modulenet_DATA = kscimacnal.o EXTRA_PROGRAMS = kscimacnal DEFS = kscimacnal_SOURCES = scimacnal.c scimacnal_cb.c scimacnal.h --- NEW FILE --- scimacnal - A NAL for the Scali ScaMAC midlayer. The ScaMAC midlayer is a simplified API to the SCI high performance interconnect. In order to use this NAL you'll need to tune scimac to use larger buffers. See scimac.conf in this directory for an example. Overall performance and stability isn't great but this can be attributed to the scimac driver which apparently is in need of some development. TODO: Routing isn't yet implemented. --- NEW FILE --- # Configuration file for the scimac driver - lustre friendly settings # # The maximal number of message headers to use in the system. scimac_max_no_hdrs = 32 # The maximal number of eager buffers to use in the system. scimac_max_no_ebufs = 8 # The maximal size in bytes of each eager buffer. scimac_max_ebuf_size = 65536 # Enable use of a kernel thread to defer reception of packets. # Default is to use a tasklet (sw interrupt). scimac_use_ulevel_recv = 1 # The maximal number of packets queued for transfer per path at any one time. scimac_max_send_queuelen = 2000 # The packet retransmit time in milliseconds. # The time elapsed since a packet was attempted sent until the packet is resent. scimac_pkt_rexmit_time = 200 # The packet's maximal retransmit time in milliseconds. # The total time that a packet will be attempted sent before it is dropped. scimac_max_rexmit_time = 5000 # The lowest valid node identifier in the system. scimac_min_nodeid_number = 0x100 # The largest valid node identifier in the system. scimac_max_nodeid_number = 0xff00 # The incremental nodeid step in the system. scimac_nodeid_increment = 0x100 --- NEW FILE --- /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- * vim:expandtab:shiftwidth=8:tabstop=8:cindent: * * Copyright (C) 2003 High Performance Computing Center North (HPC2N) * Author: Niklas Edmundsson <ni...@hp...> * Based on gmnal, which is based on ksocknal and qswnal * * This file is part of Portals, http://www.sf.net/projects/lustre/ * * Portals 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, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Portals; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ #include "scimacnal.h" ptl_handle_ni_t kscimacnal_ni; nal_t kscimacnal_api; kscimacnal_data_t kscimacnal_data; kpr_nal_interface_t kscimacnal_router_interface = { kprni_nalid: SCIMACNAL, kprni_arg: NULL, kprni_fwd: kscimacnal_fwd_packet, }; static int kscimacnal_forward(nal_t *nal, int id, void *args, size_t args_len, void *ret, size_t ret_len) { kscimacnal_data_t *ksci = nal->nal_data; nal_cb_t *nal_cb = ksci->ksci_cb; LASSERT (nal == &kscimacnal_api); LASSERT (ksci == &kscimacnal_data); LASSERT (nal_cb == &kscimacnal_lib); lib_dispatch(nal_cb, ksci, id, args, ret); /* nal needs ksci */ return PTL_OK; } static void kscimacnal_lock(nal_t *nal, unsigned long *flags) { kscimacnal_data_t *ksci = nal->nal_data; nal_cb_t *nal_cb = ksci->ksci_cb; LASSERT (nal == &kscimacnal_api); LASSERT (ksci == &kscimacnal_data); LASSERT (nal_cb == &kscimacnal_lib); nal_cb->cb_cli(nal_cb,flags); } static void kscimacnal_unlock(nal_t *nal, unsigned long *flags) { kscimacnal_data_t *ksci = nal->nal_data; nal_cb_t *nal_cb = ksci->ksci_cb; LASSERT (nal == &kscimacnal_api); LASSERT (ksci == &kscimacnal_data); LASSERT (nal_cb == &kscimacnal_lib); nal_cb->cb_sti(nal_cb,flags); } static int kscimacnal_shutdown(nal_t *nal, int ni) { LASSERT (nal == &kscimacnal_api); return 0; } static void kscimacnal_yield( nal_t *nal ) { LASSERT (nal == &kscimacnal_api); if (current->need_resched) schedule(); return; } static nal_t *kscimacnal_init(int interface, ptl_pt_index_t ptl_size, ptl_ac_index_t ac_size, ptl_pid_t requested_pid) { int nnids = 512; /* FIXME: Need ScaMac funktion to get #nodes */ CDEBUG(D_NET, "calling lib_init with nid 0x%Lx nnids %d\n", kscimacnal_data.ksci_nid, nnids); lib_init(&kscimacnal_lib, kscimacnal_data.ksci_nid, 0, nnids,ptl_size, ac_size); return &kscimacnal_api; } /* Called by kernel at module unload time */ static void __exit kscimacnal_finalize(void) { /* FIXME: How should the shutdown procedure really look? */ kscimacnal_data.ksci_shuttingdown=1; PORTAL_SYMBOL_UNREGISTER(kscimacnal_ni); PtlNIFini(kscimacnal_ni); lib_fini(&kscimacnal_lib); mac_finish(kscimacnal_data.ksci_machandle); CDEBUG (D_MALLOC, "done kmem %d\n", atomic_read (&portal_kmemory)); return; } /* Called by kernel at module insertion time */ static int __init kscimacnal_initialize(void) { int rc; unsigned long nid=0; mac_handle_t *machandle = NULL; CDEBUG (D_MALLOC, "start kmem %d\n", atomic_read (&portal_kmemory)); kscimacnal_api.forward = kscimacnal_forward; kscimacnal_api.shutdown = kscimacnal_shutdown; kscimacnal_api.yield = kscimacnal_yield; kscimacnal_api.validate = NULL; /* our api validate is a NOOP */ kscimacnal_api.lock= kscimacnal_lock; kscimacnal_api.unlock= kscimacnal_unlock; kscimacnal_api.nal_data = &kscimacnal_data; kscimacnal_lib.nal_data = &kscimacnal_data; memset(&kscimacnal_data, 0, sizeof(kscimacnal_data)); kscimacnal_data.ksci_cb = &kscimacnal_lib; /* We're not using this, but cli/sti callbacks does... ??? */ spin_lock_init(&kscimacnal_data.ksci_dispatch_lock); /* FIXME: We only support one adapter for now */ machandle = mac_init(0, MAC_SAPID_LUSTRE, kscimacnal_rx, &kscimacnal_data); if(!machandle) { CERROR("mac_init() failed\n"); return -1; } kscimacnal_data.ksci_machandle = machandle; /* Make sure the scimac MTU is tuned */ if(mac_get_mtusize(machandle) < SCIMACNAL_MTU) { CERROR("scimac mtu of %ld smaller than SCIMACNAL MTU of %d\n", mac_get_mtusize(machandle), SCIMACNAL_MTU); CERROR("Consult README.scimacnal for more information\n"); mac_finish(machandle); return -1; } /* Get the node ID */ /* mac_get_physaddrlen() is a function instead of define, sigh */ LASSERT(mac_get_physaddrlen(machandle) <= sizeof(nid)); if(mac_get_physaddr(machandle, (mac_physaddr_t *) &nid)) { CERROR("mac_get_physaddr() failed\n"); mac_finish(machandle); return -1; } nid = ntohl(nid); kscimacnal_data.ksci_nid = nid; /* Initialize Network Interface */ /* FIXME: What do the magic numbers mean? Documentation anyone? */ rc = PtlNIInit(kscimacnal_init, 32, 4, 0, &kscimacnal_ni); if (rc) { CERROR("PtlNIInit failed %d\n", rc); mac_finish(machandle); return (-ENOMEM); } PORTAL_SYMBOL_REGISTER(kscimacnal_ni); /* We're done now, it's OK for the RX callback to do stuff */ kscimacnal_data.ksci_init = 1; return 0; } MODULE_AUTHOR("Niklas Edmundsson <ni...@hp...>"); MODULE_DESCRIPTION("Kernel Scali ScaMAC SCI NAL v0.0"); MODULE_LICENSE("GPL"); module_init (kscimacnal_initialize); module_exit (kscimacnal_finalize); EXPORT_SYMBOL(kscimacnal_ni); --- NEW FILE --- /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- * vim:expandtab:shiftwidth=8:tabstop=8:cindent: * * Copyright (C) 2003 High Performance Computing Center North (HPC2N) * Author: Niklas Edmundsson <ni...@hp...> */ #ifndef _SCIMACNAL_H #define _SCIMACNAL_H #include <linux/config.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/mm.h> #include <linux/string.h> #include <linux/stat.h> #include <linux/errno.h> #include <linux/locks.h> #include <linux/unistd.h> #include <linux/init.h> #include <asm/system.h> #include <asm/uaccess.h> #include <linux/fs.h> #include <linux/file.h> #include <linux/stat.h> #include <linux/list.h> #include <asm/uaccess.h> #include <asm/segment.h> #include <asm/page.h> /* For PAGE_SIZE */ #define DEBUG_SUBSYSTEM S_UNDEFINED #include <linux/kp30.h> #include <portals/p30.h> #include <portals/lib-p30.h> #include <scamac.h> #ifndef MAC_SAPID_LUSTRE #define MAC_SAPID_LUSTRE MAC_SAPID_TEST1 #endif /* MAC_SAPID_LUSTRE */ #define SCIMACNAL_MTU 65536 /* FIXME: What is really the MTU of lustre? */ #if PTL_MD_MAX_IOV*PAGE_SIZE > SCIMACNAL_MTU #error Max MTU of ScaMAC is 64k, PTL_MD_MAX_IOV*PAGE_SIZE is bigger. #endif typedef struct { mac_handle_t *handle; mac_mblk_t *msg; mac_msg_type_t type; void *userdata; } kscimacnal_rx_t; typedef struct { nal_cb_t *ktx_nal; void *ktx_private; lib_msg_t *ktx_cookie; ptl_hdr_t ktx_hdr; } kscimacnal_tx_t; typedef struct { char ksci_init; char ksci_shuttingdown; ptl_nid_t ksci_nid; nal_cb_t *ksci_cb; spinlock_t ksci_dispatch_lock; mac_handle_t *ksci_machandle; } kscimacnal_data_t; extern kscimacnal_data_t kscimacnal_data; extern nal_t kscimacnal_api; extern nal_cb_t kscimacnal_lib; void kscimacnal_fwd_packet (void *arg, kpr_fwd_desc_t *fwd); void kscimacnal_rx(mac_handle_t *handle, mac_mblk_t *msg, mac_msg_type_t type, void *userdata); #endif /* _SCIMACNAL_H */ --- NEW FILE --- /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- * vim:expandtab:shiftwidth=8:tabstop=8:cindent: * * Copyright (C) 2003 High Performance Computing Center North (HPC2N) * Author: Niklas Edmundsson <ni...@hp...> * * This file is part of Portals, http://www.sf.net/projects/lustre/ * * Portals 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, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Portals; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ #include "scimacnal.h" static int kscimacnal_read (nal_cb_t *nal, void *private, void *dst_addr, user_ptr src_addr, size_t len) { CDEBUG(D_NET, "0x%Lx: reading %ld bytes from %p -> %p\n", nal->ni.nid, (long)len, src_addr, dst_addr ); memcpy( dst_addr, src_addr, len ); return 0; } static int kscimacnal_write(nal_cb_t *nal, void *private, user_ptr dst_addr, void *src_addr, size_t len) { CDEBUG(D_NET, "0x%Lx: writing %ld bytes from %p -> %p\n", nal->ni.nid, (long)len, src_addr, dst_addr ); memcpy( dst_addr, src_addr, len ); return 0; } static void * kscimacnal_malloc(nal_cb_t *nal, size_t len) { void *buf; PORTAL_ALLOC(buf, len); return buf; } static void kscimacnal_free(nal_cb_t *nal, void *buf, size_t len) { PORTAL_FREE(buf, len); } static void kscimacnal_printf(nal_cb_t *nal, const char *fmt, ...) { va_list ap; char msg[256]; if (portal_debug & D_NET) { va_start( ap, fmt ); vsnprintf( msg, sizeof(msg), fmt, ap ); va_end( ap ); printk("CPUId: %d %s",smp_processor_id(), msg); } } static void kscimacnal_cli(nal_cb_t *nal, unsigned long *flags) { kscimacnal_data_t *data= nal->nal_data; spin_lock_irqsave(&data->ksci_dispatch_lock,*flags); } static void kscimacnal_sti(nal_cb_t *nal, unsigned long *flags) { kscimacnal_data_t *data= nal->nal_data; spin_unlock_irqrestore(&data->ksci_dispatch_lock,*flags); } static int kscimacnal_dist(nal_cb_t *nal, ptl_nid_t nid, unsigned long *dist) { /* FIXME: Network distance has a meaning, but is there no easy * way to figure it out (depends on routing) */ if ( nal->ni.nid == nid ) { *dist = 0; } else { *dist = 1; } return 0; } static char * get_mac_error(mac_status_t status) { switch(status) { case MAC_MSG_STAT_OK: return "MAC_MSG_STAT_OK"; case MAC_MSG_STAT_FREED: return "MAC_MSG_STAT_FREED"; case MAC_MSG_STAT_ABORTED: return "MAC_MSG_STAT_ABORTED"; case MAC_MSG_STAT_TIMEDOUT: return "MAC_MSG_STAT_TIMEDOUT"; case MAC_MSG_STAT_NODEUNREACH: return "MAC_MSG_STAT_NODEUNREACH"; case MAC_MSG_STAT_NETDOWN: return "MAC_MSG_STAT_NETDOWN"; case MAC_MSG_STAT_RESET: return "MAC_MSG_STAT_RESET"; case MAC_MSG_STAT_INITFAILED: return "MAC_MSG_STAT_INITFAILED"; case MAC_MSG_STAT_SYNCFAILED: return "MAC_MSG_STAT_SYNCFAILED"; case MAC_MSG_STAT_BADPROTO: return "MAC_MSG_STAT_BADPROTO"; case MAC_MSG_STAT_NOBUFSPACE: return "MAC_MSG_STAT_NOBUFSPACE"; case MAC_MSG_STAT_CONGESTION: return "MAC_MSG_STAT_CONGESTION"; case MAC_MSG_STAT_OTHER: return "MAC_MSG_STAT_OTHER"; default: return "Unknown error"; } } /* FIXME add routing code here ? */ /* Called by ScaMac when transmission is complete (ie. message is released) */ static void kscimacnal_txrelease(mac_mblk_t *msg, mac_msg_status_t status, void *context) { kscimacnal_tx_t *ktx = (kscimacnal_tx_t *)context; int err=0; LASSERT (ktx != NULL); /* Euh, there is no feedback when transmission fails?! */ switch(status) { case MAC_MSG_STAT_OK: /* normal */ break; default: CERROR("%s (%d):\n", get_mac_error(status), status); err = -EIO; break; } lib_finalize(ktx->ktx_nal, ktx->ktx_private, ktx->ktx_cookie); PORTAL_FREE(ktx, (sizeof(kscimacnal_tx_t))); } /* Called by portals when it wants to send a message. * Since ScaMAC has it's own TX thread we don't bother setting up our own. */ static int kscimacnal_send(nal_cb_t *nal, void *private, lib_msg_t *cookie, ptl_hdr_t *hdr, int type, ptl_nid_t nid, ptl_pid_t pid, unsigned int payload_niov, struct iovec *payload_iov, size_t payload_len) { kscimacnal_tx_t *ktx=NULL; kscimacnal_data_t *ksci = nal->nal_data; int rc=0; int buf_len = sizeof(ptl_hdr_t) + payload_len; mac_mblk_t *msg=NULL, *lastblk, *newblk; unsigned long physaddr; CDEBUG(D_NET, "sending %d bytes from %p to nid 0x%Lx niov: %d\n", payload_len, payload_iov, nid, payload_niov); LASSERT(ksci != NULL); LASSERT(hdr != NULL); /* Do real check if we can send this */ if (buf_len > mac_get_mtusize(ksci->ksci_machandle)) { CERROR("kscimacnal:request exceeds TX MTU size (%ld).\n", mac_get_mtusize(ksci->ksci_machandle)); return -EINVAL; } /* save transaction info for later finalize and cleanup */ PORTAL_ALLOC(ktx, (sizeof(kscimacnal_tx_t))); if (!ktx) { return -ENOMEM; } /* *SIGH* hdr is a stack variable in the calling function, so we * need to copy it to a buffer. Zerocopy magic (or is it just * deferred memcpy?) is annoying sometimes. */ memcpy(&ktx->ktx_hdr, hdr, sizeof(ptl_hdr_t)); /* First, put the header in the main message mblk */ msg = mac_alloc_mblk(&ktx->ktx_hdr, sizeof(ptl_hdr_t), kscimacnal_txrelease, ktx); if (!msg) { PORTAL_FREE(ktx, (sizeof(kscimacnal_tx_t))); return -ENOMEM; } mac_put_mblk(msg, sizeof(ptl_hdr_t)); lastblk=msg; /* Allocate additional mblks for each iov as needed. * Essentially lib_copy_iov2buf with a twist or two */ while (payload_len > 0) { ptl_size_t nob; LASSERT (payload_niov > 0); nob = MIN (payload_iov->iov_len, payload_len); /* We don't need a callback on the additional mblks, since * all release callbacks seems to be called when the entire * message has been sent */ newblk=mac_alloc_mblk(payload_iov->iov_base, nob, NULL, NULL); if(!newblk) { mac_free_msg(msg); PORTAL_FREE(ktx, (sizeof(kscimacnal_tx_t))); return -ENOMEM; } mac_put_mblk(newblk, nob); mac_link_mblk(lastblk, newblk); lastblk=newblk; payload_len -= nob; payload_niov--; payload_iov++; } ktx->ktx_nal = nal; ktx->ktx_private = private; ktx->ktx_cookie = cookie; CDEBUG(D_NET, "mac_send %d bytes to nid: 0x%Lx\n", buf_len, nid); physaddr = htonl(nid); if((rc=mac_send(ksci->ksci_machandle, msg, (mac_physaddr_t *) &physaddr))) { CERROR("kscimacnal: mac_send() failed, rc=%d\n", rc); mac_free_msg(msg); PORTAL_FREE(ktx, (sizeof(kscimacnal_tx_t))); return rc; } return 0; } void kscimacnal_fwd_packet (void *arg, kpr_fwd_desc_t *fwd) { CERROR ("forwarding not implemented\n"); } /* Process a received portals packet */ /* Called by the ScaMac RX thread when a packet is received */ void kscimacnal_rx(mac_handle_t *handle, mac_mblk_t *msg, mac_msg_type_t type, void *userdata) { ptl_hdr_t *hdr = NULL; kscimacnal_rx_t krx; mac_size_t size; kscimacnal_data_t *ksci = userdata; LASSERT(ksci != NULL); if ( !ksci->ksci_init || ksci->ksci_shuttingdown || type == MAC_MSG_TYPE_CTRL || type == MAC_MSG_TYPE_OTHER ) { /* We're not interested in messages not for us, ignore */ mac_free_msg(msg); return; } size = mac_msg_size(msg); CDEBUG(D_NET,"msg %p type %d, size %ld bytes (%ld mblks)\n", msg, type, size, mac_msg_mblks(msg)); if( size < sizeof( ptl_hdr_t ) ) { /* XXX what's this for? */ if (ksci->ksci_shuttingdown) return; CERROR("kscimacnal: did not receive complete portal header," "size= %ld\n", size); /* Free the message before exiting */ mac_free_msg(msg); return; } /* Provide everything we know */ krx.handle = handle; krx.msg = msg; krx.type = type; krx.userdata = userdata; /* mac_msg_next returns the next mblk with unread data */ hdr = mac_get_mblk(mac_msg_next(msg), sizeof(ptl_hdr_t) ); if(!hdr) { CERROR("kscimacnal: no data block in message %p\n", msg); mac_free_msg(msg); return; } if ( hdr->dest_nid == kscimacnal_lib.ni.nid ) { PROF_START(lib_parse); /* sets wanted_len, iovs etc and calls our callback */ lib_parse(&kscimacnal_lib, hdr, &krx); PROF_FINISH(lib_parse); #if 0 /* FIXME: Is it possible to detect this? */ } else if (kgmnal_ispeer(hdr->dest_nid)) { /* should have gone direct to peer */ CERROR("dropping packet from 0x%llx to 0x%llx:" "target is a peer\n", hdr->src_nid, hdr->dest_nid); kgmnal_requeue_rx(&krx); #endif /* if 0 FIXME */ } else { /* forward to gateway */ CERROR("forwarding not implemented, mynid=0x%llx dest=0x%llx\n", kscimacnal_lib.ni.nid, hdr->dest_nid); } mac_free_msg(msg); CDEBUG(D_NET, "msg %p: Done\n", msg); } /* Called by portals to process a recieved packet */ static int kscimacnal_recv(nal_cb_t *nal, void *private, lib_msg_t *cookie, unsigned int niov, struct iovec *iov, size_t mlen, size_t rlen) { kscimacnal_rx_t *krx = private; mac_mblk_t *mblk; void *src; mac_size_t pkt_len; ptl_size_t iovused=0; LASSERT (krx != NULL); LASSERT (krx->msg != NULL); CDEBUG(D_NET,"msg %p: mlen=%d, rlen=%d, niov=%d\n", krx->msg, mlen, rlen, niov); /* What was actually received must be >= what sender claims to have * sent. This is an LASSERT, since lib-move doesn't check cb return * code yet. Also, rlen seems to be negative when mlen==0 so don't * assert on that. */ LASSERT (mlen==0 || mac_msg_size(krx->msg) >= sizeof(ptl_hdr_t)+rlen); LASSERT (mlen==0 || mlen <= rlen); PROF_START(memcpy); /* mac_msg_next returns next mblk with unread data (ie. can * be same mblk */ while (mlen != 0 && (mblk = mac_msg_next(krx->msg))) { pkt_len = mac_mblk_len(mblk); src = mac_get_mblk(mblk, pkt_len); /* Next unread block */ CDEBUG(D_NET,"msg %p: mblk: %p pkt_len: %ld src: %p\n", krx->msg, mblk, pkt_len, src); LASSERT(src != NULL); /* Essentially lib_copy_buf2iov but with continuation support, * we "gracefully" thrash the argument vars ;) */ while (pkt_len > 0) { ptl_size_t nob; LASSERT (niov > 0); LASSERT(iovused < iov->iov_len); nob = MIN (iov->iov_len-iovused, pkt_len); CDEBUG(D_NET, "iovbase: %p iovlen: %d src: %p nob: %d " "iovused: %d\n", iov->iov_base, iov->iov_len, src, nob, iovused); memcpy (iov->iov_base+iovused, src, nob); pkt_len -= nob; src += nob; if(nob+iovused < iov->iov_len) { /* We didn't use all of the iov */ iovused+=nob; } else { niov--; iov++; iovused=0; } } } PROF_FINISH(memcpy); CDEBUG(D_NET, "Calling lib_finalize.\n"); PROF_START(lib_finalize); lib_finalize(nal, private, cookie); PROF_FINISH(lib_finalize); CDEBUG(D_NET, "Done.\n"); return rlen; } nal_cb_t kscimacnal_lib = { nal_data: &kscimacnal_data, /* NAL private data */ cb_send: kscimacnal_send, cb_send_pages: NULL, /* Ignore for now */ cb_recv: kscimacnal_recv, cb_recv_pages: NULL, cb_read: kscimacnal_read, cb_write: kscimacnal_write, cb_malloc: kscimacnal_malloc, cb_free: kscimacnal_free, cb_printf: kscimacnal_printf, cb_cli: kscimacnal_cli, cb_sti: kscimacnal_sti, cb_dist: kscimacnal_dist }; |