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; } |