2004-10-28 01:52:01 +00:00
|
|
|
/*
|
2005-11-05 19:57:48 +00:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2004-11-28 20:09:25 +00:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
2005-03-24 12:43:37 +00:00
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
2004-11-22 01:38:40 +00:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
2004-10-28 01:52:01 +00:00
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* @file
|
|
|
|
*/
|
|
|
|
#ifndef MCA_PTL_MX_MODULE_H
|
|
|
|
#define MCA_PTL_MX_MODULE_H
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
|
|
|
#include "ptl_mx.h"
|
|
|
|
#include "ptl_mx_recvfrag.h"
|
|
|
|
#include "ptl_mx_sendfrag.h"
|
|
|
|
|
2004-11-11 16:07:51 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Post a receive for short messages (<32 K)
|
|
|
|
*/
|
|
|
|
|
2004-11-17 22:47:08 +00:00
|
|
|
#define MCA_PTL_MX_POST(ptl, match, header_size) \
|
2004-11-11 15:01:48 +00:00
|
|
|
do { \
|
|
|
|
mca_ptl_mx_recv_frag_t *frag; \
|
|
|
|
mx_return_t mx_return; \
|
|
|
|
int rc; \
|
|
|
|
\
|
|
|
|
MCA_PTL_MX_RECV_FRAG_ALLOC(frag, rc); \
|
|
|
|
if(rc != OMPI_SUCCESS) { \
|
2005-07-03 23:31:27 +00:00
|
|
|
opal_output(0, "mca_ptl_mx_match: unable to allocate resources.\n"); \
|
2004-11-17 22:47:08 +00:00
|
|
|
break; \
|
2004-11-11 15:01:48 +00:00
|
|
|
} \
|
2004-11-17 22:47:08 +00:00
|
|
|
frag->frag_size = 0; \
|
2004-11-11 15:01:48 +00:00
|
|
|
frag->frag_recv.frag_base.frag_owner = &ptl->super; \
|
|
|
|
frag->frag_recv.frag_base.frag_peer = NULL; \
|
|
|
|
frag->frag_recv.frag_base.frag_size = 0; \
|
|
|
|
frag->frag_recv.frag_base.frag_addr = frag->frag_data; \
|
|
|
|
frag->frag_recv.frag_is_buffered = true; \
|
|
|
|
frag->frag_recv.frag_request = NULL; \
|
2004-11-17 22:47:08 +00:00
|
|
|
frag->frag_segments[0].segment_length = header_size; \
|
|
|
|
frag->frag_segments[1].segment_ptr = frag->frag_data; \
|
|
|
|
frag->frag_segments[1].segment_length = sizeof(frag->frag_data); \
|
2004-11-11 15:01:48 +00:00
|
|
|
frag->frag_segment_count = 2; \
|
|
|
|
mx_return = mx_irecv( \
|
|
|
|
ptl->mx_endpoint, \
|
|
|
|
frag->frag_segments, \
|
|
|
|
frag->frag_segment_count, \
|
2004-11-17 22:47:08 +00:00
|
|
|
match, \
|
2004-11-11 15:01:48 +00:00
|
|
|
MX_MATCH_MASK_NONE, \
|
|
|
|
frag, \
|
|
|
|
&frag->frag_request); \
|
|
|
|
if(mx_return != MX_SUCCESS) { \
|
2005-07-03 23:31:27 +00:00
|
|
|
opal_output(0, "mca_ptl_mx_match: mx_irecv() failed with status=%dn", mx_return); \
|
2004-11-11 16:07:51 +00:00
|
|
|
MCA_PTL_MX_RECV_FRAG_RETURN(frag); \
|
2004-11-11 15:01:48 +00:00
|
|
|
} \
|
|
|
|
} while(0)
|
|
|
|
|
|
|
|
|
2004-10-28 01:52:01 +00:00
|
|
|
/**
|
|
|
|
* Routine to process complete request(s).
|
|
|
|
*/
|
|
|
|
|
2004-11-04 01:01:08 +00:00
|
|
|
#define MCA_PTL_MX_PROGRESS(ptl, mx_status) \
|
2004-10-28 16:31:13 +00:00
|
|
|
do { \
|
2004-10-28 16:29:14 +00:00
|
|
|
mca_ptl_base_frag_t* frag; \
|
|
|
|
frag = (mca_ptl_base_frag_t*)mx_status.context; \
|
|
|
|
switch(frag->frag_type) { \
|
|
|
|
case MCA_PTL_FRAGMENT_SEND: \
|
|
|
|
{ \
|
|
|
|
mca_ptl_mx_send_frag_t* sendfrag = (mca_ptl_mx_send_frag_t*)frag; \
|
2004-10-28 22:23:22 +00:00
|
|
|
MCA_PTL_MX_SEND_FRAG_PROGRESS(sendfrag); \
|
2004-10-28 16:29:14 +00:00
|
|
|
break; \
|
|
|
|
} \
|
|
|
|
case MCA_PTL_FRAGMENT_RECV: \
|
|
|
|
{ \
|
|
|
|
mca_ptl_mx_recv_frag_t* recvfrag = (mca_ptl_mx_recv_frag_t*)frag; \
|
|
|
|
mca_ptl_base_header_t* hdr = \
|
|
|
|
&recvfrag->frag_recv.frag_base.frag_header; \
|
|
|
|
switch(hdr->hdr_common.hdr_type) { \
|
|
|
|
case MCA_PTL_HDR_TYPE_MATCH: \
|
|
|
|
{ \
|
2004-11-17 22:47:08 +00:00
|
|
|
recvfrag->frag_size = hdr->hdr_match.hdr_msg_length; \
|
2004-10-28 20:43:17 +00:00
|
|
|
MCA_PTL_MX_RECV_FRAG_MATCH(recvfrag,hdr); \
|
2005-07-03 22:45:48 +00:00
|
|
|
OPAL_THREAD_ADD32(&ptl->mx_recvs_posted, -1); \
|
2004-10-28 16:29:14 +00:00
|
|
|
break; \
|
|
|
|
} \
|
2004-11-17 22:47:08 +00:00
|
|
|
case MCA_PTL_HDR_TYPE_RNDV: \
|
|
|
|
{ \
|
|
|
|
recvfrag->frag_size = hdr->hdr_rndv.hdr_frag_length; \
|
2004-12-02 01:00:59 +00:00
|
|
|
MCA_PTL_MX_RECV_FRAG_RNDV(recvfrag,hdr); \
|
2004-11-17 22:47:08 +00:00
|
|
|
MCA_PTL_MX_POST(ptl, MCA_PTL_HDR_TYPE_RNDV, \
|
|
|
|
sizeof(mca_ptl_base_rendezvous_header_t)); \
|
|
|
|
break; \
|
|
|
|
} \
|
2004-10-28 16:29:14 +00:00
|
|
|
case MCA_PTL_HDR_TYPE_FRAG: \
|
2004-10-28 20:43:17 +00:00
|
|
|
{ \
|
2004-10-29 11:56:09 +00:00
|
|
|
MCA_PTL_MX_RECV_FRAG_FRAG(recvfrag); \
|
2004-10-28 16:29:14 +00:00
|
|
|
break; \
|
2004-10-28 20:43:17 +00:00
|
|
|
} \
|
2004-10-28 16:29:14 +00:00
|
|
|
case MCA_PTL_HDR_TYPE_ACK: \
|
2004-10-28 20:43:17 +00:00
|
|
|
{ \
|
2004-10-28 22:23:22 +00:00
|
|
|
mca_ptl_mx_send_frag_t* sendfrag; \
|
2005-05-09 19:37:10 +00:00
|
|
|
mca_ptl_base_send_request_t* sendreq; \
|
2004-10-28 22:23:22 +00:00
|
|
|
sendfrag = (mca_ptl_mx_send_frag_t*) \
|
|
|
|
hdr->hdr_ack.hdr_src_ptr.pval; \
|
|
|
|
sendreq = sendfrag->frag_send.frag_request; \
|
|
|
|
sendreq->req_peer_match = hdr->hdr_ack.hdr_dst_match; \
|
|
|
|
MCA_PTL_MX_SEND_FRAG_PROGRESS(sendfrag); \
|
|
|
|
MCA_PTL_MX_RECV_FRAG_RETURN(recvfrag); \
|
2004-11-17 22:47:08 +00:00
|
|
|
MCA_PTL_MX_POST(ptl, MCA_PTL_HDR_TYPE_ACK, \
|
|
|
|
sizeof(mca_ptl_base_ack_header_t)); \
|
2004-10-28 16:29:14 +00:00
|
|
|
break; \
|
2004-10-28 20:43:17 +00:00
|
|
|
} \
|
2004-10-28 16:29:14 +00:00
|
|
|
} \
|
|
|
|
break; \
|
|
|
|
} \
|
|
|
|
default: \
|
|
|
|
{ \
|
2005-07-03 23:31:27 +00:00
|
|
|
opal_output(0, "mca_ptl_mx_progress: invalid request type: %d", \
|
2004-10-28 16:29:14 +00:00
|
|
|
frag->frag_type); \
|
|
|
|
break; \
|
|
|
|
} \
|
|
|
|
} \
|
2004-10-28 16:31:13 +00:00
|
|
|
} while(0)
|
2004-10-28 01:52:01 +00:00
|
|
|
|
2004-10-29 20:21:30 +00:00
|
|
|
void mca_ptl_mx_enable(void);
|
|
|
|
void mca_ptl_mx_disable(void);
|
|
|
|
|
2004-10-28 01:52:01 +00:00
|
|
|
#endif
|
|
|
|
|