-:    0:Source:/home/MPI/testing/mpich2/mpich2/src/mpid/ch3/src/ch3u_handle_send_req.c
        -:    0:Graph:ch3u_handle_send_req.gcno
        -:    0:Data:ch3u_handle_send_req.gcda
        -:    0:Runs:3459
        -:    0:Programs:899
        -:    1:/* -*- Mode: C; c-basic-offset:4 ; -*- */
        -:    2:/*
        -:    3: *  (C) 2001 by Argonne National Laboratory.
        -:    4: *      See COPYRIGHT in top-level directory.
        -:    5: */
        -:    6:
        -:    7:#include "mpidimpl.h"
        -:    8:
        -:    9:#undef FUNCNAME
        -:   10:#define FUNCNAME MPIDI_CH3U_Handle_send_req
        -:   11:#undef FCNAME
        -:   12:#define FCNAME MPIDI_QUOTE(FUNCNAME)
        -:   13:int MPIDI_CH3U_Handle_send_req(MPIDI_VC_t * vc, MPID_Request * sreq, 
        -:   14:			       int *complete)
    #####:   15:{
    #####:   16:    int mpi_errno = MPI_SUCCESS;
        -:   17:    int (*reqFn)(MPIDI_VC_t *, MPID_Request *, int *);
        -:   18:    MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3U_HANDLE_SEND_REQ);
        -:   19:
        -:   20:    MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3U_HANDLE_SEND_REQ);
        -:   21:
        -:   22:    /* Use the associated function rather than switching on the old ca field */
        -:   23:    /* Routines can call the attached function directly */
    #####:   24:    reqFn = sreq->dev.OnDataAvail;
    #####:   25:    if (!reqFn) {
    #####:   26:	MPIU_Assert(MPIDI_Request_get_type(sreq) != MPIDI_REQUEST_TYPE_GET_RESP);
    #####:   27:	MPIDI_CH3U_Request_complete(sreq);
    #####:   28:        *complete = 1;
        -:   29:    }
        -:   30:    else {
    #####:   31:	mpi_errno = reqFn( vc, sreq, complete );
        -:   32:    }
        -:   33:
        -:   34:    MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3U_HANDLE_SEND_REQ);
    #####:   35:    return mpi_errno;
        -:   36:}
        -:   37:
        -:   38:/* ----------------------------------------------------------------------- */
        -:   39:/* Here are the functions that implement the actions that are taken when 
        -:   40: * data is available for a send request (or other completion operations)
        -:   41: * These include "send" requests that are part of the RMA implementation.
        -:   42: */
        -:   43:/* ----------------------------------------------------------------------- */
        -:   44:
        -:   45:int MPIDI_CH3_ReqHandler_GetSendRespComplete( MPIDI_VC_t *vc ATTRIBUTE((unused)), 
        -:   46:					      MPID_Request *sreq, 
        -:   47:					      int *complete )
    10130:   48:{
    10130:   49:    int mpi_errno = MPI_SUCCESS;
        -:   50:
        -:   51:    /* FIXME: Should this test be an MPIU_Assert? */
    10130:   52:    if (sreq->dev.source_win_handle != MPI_WIN_NULL) {
        -:   53:	MPID_Win *win_ptr;
        -:   54:	/* Last RMA operation (get) from source. If active target RMA,
        -:   55:	   decrement window counter. If passive target RMA, 
        -:   56:	   release lock on window and grant next lock in the 
        -:   57:	   lock queue if there is any; no need to send rma done 
        -:   58:	   packet since the last operation is a get. */
        -:   59:	
     1680:   60:	MPID_Win_get_ptr(sreq->dev.target_win_handle, win_ptr);
     1680:   61:	if (win_ptr->current_lock_type == MPID_LOCK_NONE) {
        -:   62:	    /* FIXME: MT: this has to be done atomically */
      898:   63:	    win_ptr->my_counter -= 1;
        -:   64:	}
        -:   65:	else {
      782:   66:	    mpi_errno = MPIDI_CH3I_Release_lock(win_ptr);
        -:   67:	}
        -:   68:    }
        -:   69:
        -:   70:    /* mark data transfer as complete and decrement CC */
    10130:   71:    MPIDI_CH3U_Request_complete(sreq);
    10130:   72:    *complete = TRUE;
        -:   73:
    10130:   74:    return mpi_errno;
        -:   75:}
        -:   76:
        -:   77:int MPIDI_CH3_ReqHandler_SendReloadIOV( MPIDI_VC_t *vc ATTRIBUTE((unused)), MPID_Request *sreq, 
        -:   78:					int *complete )
      200:   79:{
        -:   80:    int mpi_errno;
        -:   81:
        -:   82:    /* setting the iov_offset to 0 here is critical, since it is intentionally
        -:   83:     * not set in the _load_send_iov function */
      200:   84:    sreq->dev.iov_offset = 0;
      200:   85:    sreq->dev.iov_count = MPID_IOV_LIMIT;
      200:   86:    mpi_errno = MPIDI_CH3U_Request_load_send_iov(sreq, sreq->dev.iov, 
        -:   87:						 &sreq->dev.iov_count);
      200:   88:    if (mpi_errno != MPI_SUCCESS) {
    #####:   89:	MPIU_ERR_SETFATALANDJUMP(mpi_errno, MPI_ERR_OTHER,"**ch3|loadsendiov");
        -:   90:    }
        -:   91:	    
      200:   92:    *complete = FALSE;
        -:   93:
      200:   94: fn_fail:
      200:   95:    return mpi_errno;
        -:   96:}