int MPIDI_CH3U_Handle_ordered_recv_pkt(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt, void *data, intptr_t *buflen, MPIR_Request ** rreqp) { int mpi_errno = MPI_SUCCESS; static MPIDI_CH3_PktHandler_Fcn *pktArray[MPIDI_CH3_PKT_END_CH3+1]; static int needsInit = 1; MPIR_FUNC_VERBOSE_STATE_DECL(MPID_STATE_MPIDI_CH3U_HANDLE_ORDERED_RECV_PKT); MPIR_FUNC_VERBOSE_ENTER(MPID_STATE_MPIDI_CH3U_HANDLE_ORDERED_RECV_PKT); MPL_DBG_STMT(MPIDI_CH3_DBG_OTHER,VERBOSE,MPIDI_DBG_Print_packet(pkt)); /* FIXME: We can turn this into something like MPIR_Assert(pkt->type <= MAX_PACKET_TYPE); mpi_errno = MPIDI_CH3_ProgressFunctions[pkt->type](vc,pkt,rreqp); in the progress engine itself. Then this routine is not necessary. */ if (needsInit) { MPIDI_CH3_PktHandler_Init( pktArray, MPIDI_CH3_PKT_END_CH3 ); needsInit = 0; } /* Packet type is an enum and hence >= 0 */ MPIR_Assert(pkt->type <= MPIDI_CH3_PKT_END_CH3); mpi_errno = pktArray[pkt->type](vc, pkt, data, buflen, rreqp); MPIR_FUNC_VERBOSE_EXIT(MPID_STATE_MPIDI_CH3U_HANDLE_ORDERED_RECV_PKT); return mpi_errno; }
int MPIDI_CH3I_Progress_init(void) { int i; int mpi_errno = MPI_SUCCESS; MPIR_FUNC_VERBOSE_STATE_DECL(MPID_STATE_MPIDI_CH3I_PROGRESS_INIT); MPIR_FUNC_VERBOSE_ENTER(MPID_STATE_MPIDI_CH3I_PROGRESS_INIT); MPIR_THREAD_CHECK_BEGIN; /* FIXME should be appropriately abstracted somehow */ # if defined(MPICH_IS_THREADED) && (MPICH_THREAD_GRANULARITY == MPICH_THREAD_GRANULARITY__GLOBAL) { int err; MPID_Thread_cond_create(&MPIDI_CH3I_progress_completion_cond, &err); MPIR_Assert(err == 0); } # endif MPIR_THREAD_CHECK_END; mpi_errno = MPIDI_CH3I_Sock_init(); if (mpi_errno != MPI_SUCCESS) { MPIR_ERR_POP(mpi_errno); } /* create sock set */ mpi_errno = MPIDI_CH3I_Sock_create_set(&MPIDI_CH3I_sock_set); if (mpi_errno != MPI_SUCCESS) { MPIR_ERR_POP(mpi_errno); } /* establish non-blocking listener */ mpi_errno = MPIDU_CH3I_SetupListener( MPIDI_CH3I_sock_set ); if (mpi_errno) { MPIR_ERR_POP(mpi_errno); } /* Initialize the code to handle incoming packets */ mpi_errno = MPIDI_CH3_PktHandler_Init( pktArray, MPIDI_CH3_PKT_END_CH3+1 ); if (mpi_errno) { MPIR_ERR_POP(mpi_errno); } /* Initialize progress hook slots */ for (i = 0; i < MAX_PROGRESS_HOOKS; i++) { progress_hooks[i].func_ptr = NULL; progress_hooks[i].active = FALSE; } fn_exit: MPIR_FUNC_VERBOSE_EXIT(MPID_STATE_MPIDI_CH3I_PROGRESS_INIT); return mpi_errno; fn_fail: goto fn_exit; }