2005-08-02 17:20:50 +04:00
|
|
|
/*
|
2005-11-05 22:57:48 +03:00
|
|
|
* Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
|
|
|
|
* University Research and Technology
|
|
|
|
* Corporation. All rights reserved.
|
2008-12-18 01:15:12 +03:00
|
|
|
* Copyright (c) 2004-2008 The University of Tennessee and The University
|
2005-11-05 22:57:48 +03:00
|
|
|
* of Tennessee Research Foundation. All rights
|
|
|
|
* reserved.
|
2005-08-02 17:20:50 +04:00
|
|
|
* Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
|
|
|
|
* University of Stuttgart. All rights reserved.
|
|
|
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
* All rights reserved.
|
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MCA_BTL_TCP_FRAG_H
|
|
|
|
#define MCA_BTL_TCP_FRAG_H
|
|
|
|
|
|
|
|
|
|
|
|
#include "ompi_config.h"
|
2005-09-14 19:52:42 +04:00
|
|
|
|
|
|
|
#ifdef HAVE_SYS_TYPES_H
|
|
|
|
#include <sys/types.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_SYS_UIO_H
|
|
|
|
#include <sys/uio.h>
|
|
|
|
#endif
|
2007-07-10 07:46:57 +04:00
|
|
|
#ifdef HAVE_NET_UIO_H
|
|
|
|
#include <net/uio.h>
|
|
|
|
#endif
|
2005-09-14 19:52:42 +04:00
|
|
|
|
2005-08-02 17:20:50 +04:00
|
|
|
#include "btl_tcp.h"
|
|
|
|
#include "btl_tcp_hdr.h"
|
|
|
|
|
2009-08-20 15:42:18 +04:00
|
|
|
BEGIN_C_DECLS
|
2005-08-02 17:20:50 +04:00
|
|
|
|
2005-12-11 02:28:16 +03:00
|
|
|
#define MCA_BTL_TCP_FRAG_IOVEC_NUMBER 4
|
2005-08-02 17:20:50 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* TCP fragment derived type.
|
|
|
|
*/
|
|
|
|
struct mca_btl_tcp_frag_t {
|
|
|
|
mca_btl_base_descriptor_t base;
|
|
|
|
mca_btl_base_segment_t segments[2];
|
|
|
|
struct mca_btl_base_endpoint_t *endpoint;
|
|
|
|
struct mca_btl_tcp_module_t* btl;
|
|
|
|
mca_btl_tcp_hdr_t hdr;
|
2006-01-14 23:21:44 +03:00
|
|
|
struct iovec iov[MCA_BTL_TCP_FRAG_IOVEC_NUMBER + 1];
|
2005-08-02 17:20:50 +04:00
|
|
|
struct iovec *iov_ptr;
|
|
|
|
size_t iov_cnt;
|
|
|
|
size_t iov_idx;
|
|
|
|
size_t size;
|
|
|
|
int rc;
|
2006-05-25 20:57:14 +04:00
|
|
|
ompi_free_list_t* my_list;
|
2005-08-02 17:20:50 +04:00
|
|
|
};
|
|
|
|
typedef struct mca_btl_tcp_frag_t mca_btl_tcp_frag_t;
|
|
|
|
OBJ_CLASS_DECLARATION(mca_btl_tcp_frag_t);
|
|
|
|
|
|
|
|
typedef struct mca_btl_tcp_frag_t mca_btl_tcp_frag_eager_t;
|
|
|
|
|
|
|
|
OBJ_CLASS_DECLARATION(mca_btl_tcp_frag_eager_t);
|
|
|
|
|
|
|
|
typedef struct mca_btl_tcp_frag_t mca_btl_tcp_frag_max_t;
|
|
|
|
|
|
|
|
OBJ_CLASS_DECLARATION(mca_btl_tcp_frag_max_t);
|
|
|
|
|
|
|
|
typedef struct mca_btl_tcp_frag_t mca_btl_tcp_frag_user_t;
|
|
|
|
|
|
|
|
OBJ_CLASS_DECLARATION(mca_btl_tcp_frag_user_t);
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Macros to allocate/return descriptors from module specific
|
|
|
|
* free list(s).
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define MCA_BTL_TCP_FRAG_ALLOC_EAGER(frag, rc) \
|
|
|
|
{ \
|
2006-12-02 00:48:06 +03:00
|
|
|
ompi_free_list_item_t *item; \
|
2008-12-18 01:15:12 +03:00
|
|
|
OMPI_FREE_LIST_GET(&mca_btl_tcp_component.tcp_frag_eager, item, rc); \
|
2005-08-02 17:20:50 +04:00
|
|
|
frag = (mca_btl_tcp_frag_t*) item; \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define MCA_BTL_TCP_FRAG_ALLOC_MAX(frag, rc) \
|
|
|
|
{ \
|
2006-12-02 00:48:06 +03:00
|
|
|
ompi_free_list_item_t *item; \
|
2008-12-18 01:15:12 +03:00
|
|
|
OMPI_FREE_LIST_GET(&mca_btl_tcp_component.tcp_frag_max, item, rc); \
|
2005-08-02 17:20:50 +04:00
|
|
|
frag = (mca_btl_tcp_frag_t*) item; \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define MCA_BTL_TCP_FRAG_ALLOC_USER(frag, rc) \
|
|
|
|
{ \
|
2006-08-24 20:38:08 +04:00
|
|
|
ompi_free_list_item_t *item; \
|
2008-12-18 01:15:12 +03:00
|
|
|
OMPI_FREE_LIST_GET(&mca_btl_tcp_component.tcp_frag_user, item, rc); \
|
2005-08-02 17:20:50 +04:00
|
|
|
frag = (mca_btl_tcp_frag_t*) item; \
|
|
|
|
}
|
|
|
|
|
2006-05-25 20:57:14 +04:00
|
|
|
#define MCA_BTL_TCP_FRAG_RETURN(frag) \
|
2005-08-02 17:20:50 +04:00
|
|
|
{ \
|
2006-12-02 00:48:06 +03:00
|
|
|
OMPI_FREE_LIST_RETURN(frag->my_list, (ompi_free_list_item_t*)(frag)); \
|
2005-08-02 17:20:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
#define MCA_BTL_TCP_FRAG_INIT_DST(frag,ep) \
|
|
|
|
do { \
|
|
|
|
frag->rc = 0; \
|
|
|
|
frag->btl = ep->endpoint_btl; \
|
|
|
|
frag->endpoint = ep; \
|
|
|
|
frag->iov[0].iov_len = sizeof(frag->hdr); \
|
2006-08-24 20:38:08 +04:00
|
|
|
frag->iov[0].iov_base = (IOVBASE_TYPE*)&frag->hdr; \
|
2005-08-02 17:20:50 +04:00
|
|
|
frag->iov_cnt = 1; \
|
|
|
|
frag->iov_idx = 0; \
|
|
|
|
frag->iov_ptr = frag->iov; \
|
|
|
|
frag->base.des_src = NULL; \
|
2011-11-11 07:01:52 +04:00
|
|
|
frag->base.des_src_cnt = 0; \
|
2005-08-02 17:20:50 +04:00
|
|
|
frag->base.des_dst = frag->segments; \
|
|
|
|
frag->base.des_dst_cnt = 1; \
|
|
|
|
} while(0)
|
|
|
|
|
|
|
|
|
|
|
|
bool mca_btl_tcp_frag_send(mca_btl_tcp_frag_t*, int sd);
|
|
|
|
bool mca_btl_tcp_frag_recv(mca_btl_tcp_frag_t*, int sd);
|
|
|
|
|
|
|
|
|
2009-08-20 15:42:18 +04:00
|
|
|
END_C_DECLS
|
2005-08-02 17:20:50 +04:00
|
|
|
#endif
|