From 394e5abd04dba5421ba8fd700a3c7f32125963ce Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Thu, 18 Nov 2004 20:20:42 +0000 Subject: [PATCH] Create function to specifically initialize the header depending on the communication type. This commit was SVN r3625. --- src/mca/ptl/gm/src/ptl_gm_sendfrag.h | 67 ++++++++++++++-------------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/src/mca/ptl/gm/src/ptl_gm_sendfrag.h b/src/mca/ptl/gm/src/ptl_gm_sendfrag.h index 447be2faa9..954e64396e 100644 --- a/src/mca/ptl/gm/src/ptl_gm_sendfrag.h +++ b/src/mca/ptl/gm/src/ptl_gm_sendfrag.h @@ -81,44 +81,45 @@ extern "C" { int flags ); static inline int - mca_ptl_gm_send_frag_init( struct mca_ptl_gm_send_frag_t* sendfrag, - struct mca_ptl_gm_peer_t * ptl_peer, - struct mca_pml_base_send_request_t * sendreq, - size_t offset, - size_t* size, - int flags ) + mca_ptl_gm_init_header_match( struct mca_ptl_gm_send_frag_t* sendfrag, + struct mca_pml_base_send_request_t * sendreq, + int flags ) + { + mca_ptl_base_header_t *hdr = (mca_ptl_base_header_t *)sendfrag->send_buf; + + hdr->hdr_common.hdr_flags = flags; + hdr->hdr_common.hdr_type = MCA_PTL_HDR_TYPE_MATCH; + + hdr->hdr_match.hdr_contextid = sendreq->req_base.req_comm->c_contextid; + hdr->hdr_match.hdr_src = sendreq->req_base.req_comm->c_my_rank; + hdr->hdr_match.hdr_dst = sendreq->req_base.req_peer; + hdr->hdr_match.hdr_tag = sendreq->req_base.req_tag; + hdr->hdr_match.hdr_msg_length = sendreq->req_bytes_packed; + hdr->hdr_match.hdr_msg_seq = sendreq->req_base.req_sequence; + sendfrag->type = MATCH; + + return OMPI_SUCCESS; + } + + static inline int + mca_ptl_gm_init_header_frag( struct mca_ptl_gm_send_frag_t* sendfrag, + struct mca_ptl_gm_peer_t * ptl_peer, + struct mca_pml_base_send_request_t * sendreq, + size_t offset, + size_t* size, + int flags ) { mca_ptl_base_header_t *hdr = (mca_ptl_base_header_t *)sendfrag->send_buf; - sendfrag->status = -1; - sendfrag->type = -1; - sendfrag->wait_for_ack = 0; - sendfrag->put_sent = -1; - sendfrag->send_complete = -1; - hdr->hdr_common.hdr_flags = flags; - if (offset == 0) { - /* When the offset is ZERO we send the match header. */ - hdr->hdr_common.hdr_type = MCA_PTL_HDR_TYPE_MATCH; - - hdr->hdr_match.hdr_contextid = sendreq->req_base.req_comm->c_contextid; - hdr->hdr_match.hdr_src = sendreq->req_base.req_comm->c_my_rank; - hdr->hdr_match.hdr_dst = sendreq->req_base.req_peer; - hdr->hdr_match.hdr_tag = sendreq->req_base.req_tag; - hdr->hdr_match.hdr_msg_length = sendreq->req_bytes_packed; - hdr->hdr_match.hdr_msg_seq = sendreq->req_base.req_sequence; - sendfrag->type = MATCH; - } else { - hdr->hdr_common.hdr_type = MCA_PTL_HDR_TYPE_FRAG; - hdr->hdr_frag.hdr_frag_offset = offset; - hdr->hdr_frag.hdr_frag_length = *size; - hdr->hdr_frag.hdr_src_ptr.lval = 0; - hdr->hdr_frag.hdr_src_ptr.pval = sendfrag; /* pointer to the frag */ - hdr->hdr_frag.hdr_dst_ptr = sendreq->req_peer_match; - - sendfrag->type = FRAG; - } + hdr->hdr_common.hdr_type = MCA_PTL_HDR_TYPE_FRAG; + hdr->hdr_frag.hdr_frag_offset = offset; + hdr->hdr_frag.hdr_frag_length = *size; + hdr->hdr_frag.hdr_src_ptr.lval = 0; + hdr->hdr_frag.hdr_src_ptr.pval = sendfrag; /* pointer to the frag */ + hdr->hdr_frag.hdr_dst_ptr = sendreq->req_peer_match; + sendfrag->type = FRAG; return OMPI_SUCCESS; }