OpenMPI  0.1.1
oob_tcp_msg.h File Reference

contains the data structure we will use to describe a message More...

#include "orte_config.h"
#include "orte/types.h"
#include <errno.h>
#include "orte/mca/oob/oob.h"
#include "oob_tcp_hdr.h"

Go to the source code of this file.

Data Structures

struct  mca_oob_tcp_msg_t
 describes each message being progressed. More...
 

Macros

#define MCA_OOB_TCP_IOV_MAX   16
 
#define MCA_OOB_TCP_MSG_ALLOC(msg, rc)
 Get a new structure for use with a message. More...
 
#define MCA_OOB_TCP_MSG_RETURN(msg)
 return a message structure that is no longer needed More...
 

Typedefs

typedef struct mca_oob_tcp_msg_t mca_oob_tcp_msg_t
 Convenience typedef.
 

Enumerations

enum  mca_oob_tcp_type_t { MCA_OOB_TCP_POSTED, MCA_OOB_TCP_UNEXPECTED }
 

Functions

 OBJ_CLASS_DECLARATION (mca_oob_tcp_msg_t)
 
int mca_oob_tcp_msg_wait (mca_oob_tcp_msg_t *msg, int *size)
 Wait for a msg to complete. More...
 
int mca_oob_tcp_msg_timedwait (mca_oob_tcp_msg_t *msg, int *size, struct timespec *ts)
 Wait - up to a timeout - for a msg to complete. More...
 
int mca_oob_tcp_msg_complete (mca_oob_tcp_msg_t *msg, orte_process_name_t *peer)
 Signal that a message has completed. More...
 
int mca_oob_tcp_msg_copy (mca_oob_tcp_msg_t *msg, struct iovec *iov, int count)
 Called to copy the results of a message into user supplied iovec array. More...
 
bool mca_oob_tcp_msg_send_handler (mca_oob_tcp_msg_t *msg, struct mca_oob_tcp_peer_t *peer)
 Called asynchronously to progress sending a message from the event library thread. More...
 
bool mca_oob_tcp_msg_recv_handler (mca_oob_tcp_msg_t *msg, struct mca_oob_tcp_peer_t *peer)
 Called asynchronously to progress sending a message from the event library thread. More...
 
void mca_oob_tcp_msg_recv_complete (mca_oob_tcp_msg_t *msg, struct mca_oob_tcp_peer_t *peer)
 The message has been completely received - so attempt to match against posted recvs. More...
 
mca_oob_tcp_msg_tmca_oob_tcp_msg_match_recv (orte_process_name_t *name, int tag)
 Match name to a message that has been received asynchronously (unexpected). More...
 
mca_oob_tcp_msg_tmca_oob_tcp_msg_match_post (orte_process_name_t *name, int tag)
 Match name to a posted recv request. More...
 
static struct iovecmca_oob_tcp_msg_iov_alloc (mca_oob_tcp_msg_t *msg, int count)
 Allocate space for iovec array - if the request number of elements is less than MCA_OOB_TCP_IOV_MAX then use the array allocated along w/ the message - otherwise allocate count elements. More...
 
static void mca_oob_tcp_msg_iov_return (mca_oob_tcp_msg_t *msg, struct iovec *iov)
 Release resource held by iovec array if this is not part of the message. More...
 

Detailed Description

contains the data structure we will use to describe a message

Macro Definition Documentation

#define MCA_OOB_TCP_MSG_ALLOC (   msg,
  rc 
)
Value:
{ \
opal_free_list_item_t* item; \
OPAL_FREE_LIST_GET(&mca_oob_tcp_component.tcp_msgs, item, rc); \
msg = (mca_oob_tcp_msg_t*)item; \
}
opal_free_list_t tcp_msgs
free list of messages
Definition: oob_tcp.h:208
describes each message being progressed.
Definition: oob_tcp_msg.h:47

Get a new structure for use with a message.

Referenced by mca_oob_tcp_recv_nb().

#define MCA_OOB_TCP_MSG_RETURN (   msg)
Value:
{ \
/* frees the iovec allocated during the send/receive */ \
if(NULL != msg->msg_rwiov) \
mca_oob_tcp_msg_iov_return(msg,msg->msg_rwiov); \
if(NULL != msg->msg_rwbuf) \
free(msg->msg_rwbuf); \
OPAL_FREE_LIST_RETURN(&mca_oob_tcp_component.tcp_msgs, \
&msg->super); \
}
opal_free_list_t tcp_msgs
free list of messages
Definition: oob_tcp.h:208
static void mca_oob_tcp_msg_iov_return(mca_oob_tcp_msg_t *msg, struct iovec *iov)
Release resource held by iovec array if this is not part of the message.
Definition: oob_tcp_msg.h:208

return a message structure that is no longer needed

Referenced by mca_oob_tcp_msg_complete(), mca_oob_tcp_msg_recv_complete(), mca_oob_tcp_recv_cancel(), and mca_oob_tcp_recv_nb().

Function Documentation

int mca_oob_tcp_msg_copy ( mca_oob_tcp_msg_t msg,
struct iovec iov,
int  count 
)

Called to copy the results of a message into user supplied iovec array.

Parameters
msg(IN) Message send that is in progress.
iov(IN) Iovec array of user supplied buffers.
Return values
countNumber of elements in iovec array.

References mca_oob_tcp_msg_t::msg_flags, mca_oob_tcp_msg_t::msg_hdr, mca_oob_tcp_msg_t::msg_rwbuf, mca_oob_tcp_hdr_t::msg_size, and ORTE_RML_ALLOC.

static struct iovec* mca_oob_tcp_msg_iov_alloc ( mca_oob_tcp_msg_t msg,
int  count 
)
static

Allocate space for iovec array - if the request number of elements is less than MCA_OOB_TCP_IOV_MAX then use the array allocated along w/ the message - otherwise allocate count elements.

Parameters
msg(IN) Message to allocate array.
count(IN) the number of iovecs
Returns
Array of iovec elements.
static void mca_oob_tcp_msg_iov_return ( mca_oob_tcp_msg_t msg,
struct iovec iov 
)
inlinestatic

Release resource held by iovec array if this is not part of the message.

Parameters
msg(IN) Message to allocate array.
iov(IN) Iovec array to return.
mca_oob_tcp_msg_t* mca_oob_tcp_msg_match_post ( orte_process_name_t name,
int  tag 
)

Match name to a posted recv request.

Parameters
name(IN) Name associated with peer or wildcard to match first posted recv.
tag(IN) Message tag.
Returns
msg Matched message or NULL.

Note - this routine requires the caller to be holding the module lock.

References mca_oob_tcp_msg_t::msg_flags, mca_oob_tcp_msg_t::msg_hdr, mca_oob_tcp_msg_t::msg_peer, mca_oob_tcp_hdr_t::msg_tag, opal_list_get_end(), opal_list_get_first(), opal_list_get_next, opal_list_remove_item(), ORTE_NAME, ORTE_RML_PERSISTENT, mca_oob_tcp_msg_t::super, and mca_oob_tcp_component_t::tcp_msg_post.

mca_oob_tcp_msg_t* mca_oob_tcp_msg_match_recv ( orte_process_name_t name,
int  tag 
)

Match name to a message that has been received asynchronously (unexpected).

Parameters
name(IN) Name associated with peer or wildcard to match first posted recv.
tag(IN) Message tag.
Returns
msg Matched message or NULL.

Note - this routine requires the caller to be holding the module lock.

References mca_oob_tcp_msg_t::msg_hdr, mca_oob_tcp_hdr_t::msg_tag, opal_list_get_end(), opal_list_get_first(), opal_list_get_next, ORTE_NAME, and mca_oob_tcp_component_t::tcp_msg_recv.

Referenced by mca_oob_tcp_recv_nb().

void mca_oob_tcp_msg_recv_complete ( mca_oob_tcp_msg_t msg,
mca_oob_tcp_peer_t peer 
)

The message has been completely received - so attempt to match against posted recvs.

The message has been completely received - so attempt to match against posted recvs.

References MCA_OOB_TCP_MSG_RETURN, mca_oob_tcp_msg_t::msg_hdr, mca_oob_tcp_hdr_t::msg_type, opal_output(), ORTE_PROC_MY_NAME, and mca_oob_tcp_peer_t::peer_name.

bool mca_oob_tcp_msg_recv_handler ( mca_oob_tcp_msg_t msg,
struct mca_oob_tcp_peer_t peer 
)

Called asynchronously to progress sending a message from the event library thread.

Parameters
msg(IN) Message send that is in progress.
peer(IN) Peer theat we are recieving from.
Return values
boolBool flag indicating wether operation has completed.

References MCA_OOB_TCP_HDR_NTOH, mca_oob_tcp_peer_close(), mca_oob_tcp_msg_t::msg_hdr, mca_oob_tcp_msg_t::msg_rwbuf, mca_oob_tcp_msg_t::msg_rwiov, mca_oob_tcp_msg_t::msg_rwnum, mca_oob_tcp_msg_t::msg_rwptr, mca_oob_tcp_hdr_t::msg_size, mca_oob_tcp_hdr_t::msg_type, opal_output(), ORTE_PROC_MY_NAME, mca_oob_tcp_peer_t::peer_name, and mca_oob_tcp_component_t::tcp_debug.

bool mca_oob_tcp_msg_send_handler ( mca_oob_tcp_msg_t msg,
struct mca_oob_tcp_peer_t peer 
)

Called asynchronously to progress sending a message from the event library thread.

Parameters
msg(IN) Message send that is in progress.
peer(IN) Peer we are sending to.
Return values
Numberof bytes copied.

References mca_oob_tcp_peer_close(), mca_oob_tcp_msg_t::msg_rc, mca_oob_tcp_msg_t::msg_rwnum, mca_oob_tcp_msg_t::msg_rwptr, opal_output(), ORTE_PROC_MY_NAME, mca_oob_tcp_peer_t::peer_name, and mca_oob_tcp_peer_t::peer_sd.

Referenced by mca_oob_tcp_peer_send().

int mca_oob_tcp_msg_timedwait ( mca_oob_tcp_msg_t msg,
int *  size,
struct timespec ts 
)

Wait - up to a timeout - for a msg to complete.

Parameters
msg(IN) Message to wait on.
size(OUT) Number of bytes delivered.
Return values
ORTE_SUCCESSor error code on failure.
int mca_oob_tcp_msg_wait ( mca_oob_tcp_msg_t msg,
int *  size 
)

Wait for a msg to complete.

Parameters
msg(IN) Message to wait on.
size(OUT) Number of bytes delivered.
Return values
ORTE_SUCCESSor error code on failure.