2004-02-10 03:09:36 +03:00
|
|
|
/*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
2004-03-19 17:08:34 +03:00
|
|
|
#include <string.h>
|
2004-01-14 18:57:54 +03:00
|
|
|
#include "ptl_base_comm.h"
|
|
|
|
|
2004-03-18 17:05:32 +03:00
|
|
|
static void mca_pml_ptl_comm_construct(mca_pml_ptl_comm_t* comm);
|
|
|
|
static void mca_pml_ptl_comm_destruct(mca_pml_ptl_comm_t* comm);
|
2004-02-04 20:11:57 +03:00
|
|
|
|
|
|
|
|
2004-03-18 17:05:32 +03:00
|
|
|
lam_class_t mca_pml_ptl_comm_t_class = {
|
|
|
|
"mca_pml_ptl_comm_t",
|
2004-02-13 01:42:39 +03:00
|
|
|
OBJ_CLASS(lam_object_t),
|
2004-02-10 17:04:27 +03:00
|
|
|
(lam_construct_t)mca_pml_ptl_comm_construct,
|
|
|
|
(lam_destruct_t)mca_pml_ptl_comm_destruct
|
2004-01-29 02:47:02 +03:00
|
|
|
};
|
2004-02-10 03:09:36 +03:00
|
|
|
|
2004-02-10 17:04:27 +03:00
|
|
|
|
2004-03-18 17:05:32 +03:00
|
|
|
static void mca_pml_ptl_comm_construct(mca_pml_ptl_comm_t* comm)
|
2004-01-29 02:47:02 +03:00
|
|
|
{
|
2004-02-10 17:04:27 +03:00
|
|
|
OBJ_CONSTRUCT(&comm->c_wild_receives, lam_list_t);
|
2004-03-31 21:00:38 +04:00
|
|
|
OBJ_CONSTRUCT(&comm->c_matching_lock, lam_mutex_t);
|
|
|
|
comm->c_recv_seq = 0;
|
2004-01-29 02:47:02 +03:00
|
|
|
}
|
2004-01-14 18:57:54 +03:00
|
|
|
|
2004-03-26 17:15:20 +03:00
|
|
|
|
2004-03-18 17:05:32 +03:00
|
|
|
static void mca_pml_ptl_comm_destruct(mca_pml_ptl_comm_t* comm)
|
2004-01-14 18:57:54 +03:00
|
|
|
{
|
2004-02-10 03:09:36 +03:00
|
|
|
free(comm->c_msg_seq);
|
|
|
|
free(comm->c_next_msg_seq);
|
|
|
|
free(comm->c_unexpected_frags);
|
|
|
|
free(comm->c_frags_cant_match);
|
|
|
|
free(comm->c_specific_receives);
|
2004-02-10 19:53:41 +03:00
|
|
|
OBJ_DESTRUCT(&comm->c_wild_receives);
|
2004-03-31 21:00:38 +04:00
|
|
|
OBJ_DESTRUCT(&comm->c_matching_lock);
|
2004-01-14 18:57:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-03-18 17:05:32 +03:00
|
|
|
int mca_pml_ptl_comm_init_size(mca_pml_ptl_comm_t* comm, size_t size)
|
2004-01-14 18:57:54 +03:00
|
|
|
{
|
2004-01-29 02:47:02 +03:00
|
|
|
size_t i;
|
|
|
|
|
|
|
|
/* send message sequence-number support - sender side */
|
2004-04-12 19:39:15 +04:00
|
|
|
comm->c_msg_seq = malloc(sizeof(mca_ptl_sequence_t) * size);
|
2004-01-29 02:47:02 +03:00
|
|
|
if(NULL == comm->c_msg_seq)
|
|
|
|
return LAM_ERR_OUT_OF_RESOURCE;
|
2004-04-12 19:39:15 +04:00
|
|
|
memset(comm->c_msg_seq, 0, sizeof(mca_ptl_sequence_t) * size);
|
2004-01-29 02:47:02 +03:00
|
|
|
|
|
|
|
/* send message sequence-number support - receiver side */
|
2004-04-12 19:39:15 +04:00
|
|
|
comm->c_next_msg_seq = malloc(sizeof(mca_ptl_sequence_t) * size);
|
2004-01-29 02:47:02 +03:00
|
|
|
if(NULL == comm->c_next_msg_seq)
|
|
|
|
return LAM_ERR_OUT_OF_RESOURCE;
|
2004-04-12 19:39:15 +04:00
|
|
|
memset(comm->c_next_msg_seq, 0, sizeof(mca_ptl_sequence_t) * size);
|
2004-01-29 02:47:02 +03:00
|
|
|
|
|
|
|
/* unexpected fragments queues */
|
2004-02-10 03:09:36 +03:00
|
|
|
comm->c_unexpected_frags = malloc(sizeof(lam_list_t) * size);
|
2004-01-30 02:50:31 +03:00
|
|
|
if(NULL == comm->c_unexpected_frags)
|
2004-01-29 02:47:02 +03:00
|
|
|
return LAM_ERR_OUT_OF_RESOURCE;
|
2004-03-12 01:02:01 +03:00
|
|
|
for(i=0; i<size; i++) {
|
|
|
|
lam_list_t* object = comm->c_unexpected_frags+i;
|
|
|
|
OBJ_CONSTRUCT(object, lam_list_t);
|
|
|
|
}
|
2004-01-29 02:47:02 +03:00
|
|
|
|
|
|
|
/* out-of-order fragments queues */
|
2004-02-10 03:09:36 +03:00
|
|
|
comm->c_frags_cant_match = malloc(sizeof(lam_list_t) * size);
|
2004-01-30 02:50:31 +03:00
|
|
|
if(NULL == comm->c_frags_cant_match)
|
2004-01-29 02:47:02 +03:00
|
|
|
return LAM_ERR_OUT_OF_RESOURCE;
|
2004-03-12 01:02:01 +03:00
|
|
|
for(i=0; i<size; i++) {
|
|
|
|
lam_list_t* object = comm->c_frags_cant_match+i;
|
|
|
|
OBJ_CONSTRUCT(object, lam_list_t);
|
|
|
|
}
|
2004-01-29 02:47:02 +03:00
|
|
|
|
|
|
|
/* queues of unmatched specific (source process specified) receives */
|
2004-02-10 03:09:36 +03:00
|
|
|
comm->c_specific_receives = malloc(sizeof(lam_list_t) * size);
|
2004-01-30 02:50:31 +03:00
|
|
|
if(NULL == comm->c_specific_receives)
|
2004-01-29 02:47:02 +03:00
|
|
|
return LAM_ERR_OUT_OF_RESOURCE;
|
2004-03-12 01:02:01 +03:00
|
|
|
for(i=0; i<size; i++) {
|
|
|
|
lam_list_t *object = comm->c_specific_receives+i;
|
|
|
|
OBJ_CONSTRUCT(object, lam_list_t);
|
|
|
|
}
|
2004-01-29 02:47:02 +03:00
|
|
|
return LAM_SUCCESS;
|
2004-01-14 18:57:54 +03:00
|
|
|
}
|
|
|
|
|
2004-01-29 02:47:02 +03:00
|
|
|
|