File: btl_udapl_eager_rdma.h

package info (click to toggle)
openmpi 1.6.5-9.1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 91,652 kB
  • sloc: ansic: 408,966; cpp: 44,454; sh: 27,828; makefile: 10,486; asm: 3,882; python: 1,239; lex: 805; perl: 549; csh: 253; fortran: 232; f90: 126; tcl: 12
file content (105 lines) | stat: -rw-r--r-- 3,753 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
 * Copyright (c) 2006      Sun Microsystems, Inc.  All rights reserved.
 *
 * $COPYRIGHT$
 *
 * Additional copyrights may follow
 *
 * $HEADER$
 */

#ifndef MCA_BTL_UDAPL_EAGER_RDMA_H
#define MCA_BTL_UDAPL_EAGER_RDMA_H

/* Open MPI includes */
#include "ompi/mca/btl/udapl/btl_udapl_endpoint.h" 


BEGIN_C_DECLS

/*
 * Describe endpoint local memory region.
 */
struct mca_btl_udapl_eager_rdma_local_t {
    ompi_ptr_t		base;		/**< points to fragment structures */
    struct mca_btl_udapl_reg_t* reg;
    uint8_t 		head; 		/**< RDMA buffer to poll */
    int32_t 		credits; 	/**< number of local rdma buffers ready to be reclaimed,
					   reused. Initially equal to 0. */
    opal_mutex_t 	lock; /**< protect access to RDMA buffer */    
};
typedef struct mca_btl_udapl_eager_rdma_local_t mca_btl_udapl_eager_rdma_local_t;

/*
 * Describe endpoint remote memory region.
 */
struct mca_btl_udapl_eager_rdma_remote_t {
    ompi_ptr_t		base;   /**< points to start of data region, not
				   fragment structures */
    DAT_RMR_CONTEXT	rkey; 	/**< key required to access remote memory */ 
    uint8_t 		head; 	/**< RDMA buffer to use */
    int32_t 		tokens; /**< number of available rdma buffers, initially equal
				   to mca parameter eager_rdma_num  */
    opal_mutex_t 	lock; /**< protect access to RDMA buffer */    
};
typedef struct mca_btl_udapl_eager_rdma_remote_t mca_btl_udapl_eager_rdma_remote_t;

/*
 * Encapsulate data that describes a remote memory region. 
 */
struct mca_btl_udapl_eager_rdma_connect_t {
	mca_btl_udapl_control_header_t control;
	uint32_t 	rkey;
        ompi_ptr_t 	rdma_start;
};
typedef struct mca_btl_udapl_eager_rdma_connect_t mca_btl_udapl_eager_rdma_connect_t;
    
/*
 * Encapsulate data that describes rdma credit information.
 */
struct mca_btl_udapl_eager_rdma_credit_t {
	mca_btl_udapl_control_header_t control;
        uint32_t 	credits;
};
typedef struct mca_btl_udapl_eager_rdma_credit_t mca_btl_udapl_eager_rdma_credit_t;
    
#define EAGER_RDMA_BUFFER_AVAILABLE (0)
#define EAGER_RDMA_BUFFER_IN_USE (0xff)

#define MCA_BTL_UDAPL_RDMA_FRAG_IN_USE(F) do {               \
    *(volatile uint8_t*) ((char*)(F) + 				\
    (mca_btl_udapl_component.udapl_eager_rdma_frag_size -		\
    (sizeof(mca_btl_udapl_footer_t)))); 			\
    } while (0) 

#define MCA_BTL_UDAPL_RDMA_FRAG_ASSIGN_IN_USE(F) do {           	\
    *(volatile uint8_t*) ((char*)(F) + 					\
    (mca_btl_udapl_component.udapl_eager_rdma_frag_size-			\
    (sizeof(mca_btl_udapl_footer_t)))) = EAGER_RDMA_BUFFER_IN_USE; \
    } while (0) 

#define MCA_BTL_UDAPL_RDMA_FRAG_ASSIGN_AVAILABLE(F) do {                	\
    *(volatile uint8_t*) ((char*)(F) + 						\
    (mca_btl_udapl_component.udapl_eager_rdma_frag_size -				\
    (sizeof(mca_btl_udapl_footer_t)))) = EAGER_RDMA_BUFFER_AVAILABLE; 	\
    } while (0) 
    
/* Retrieve the rdma fragment at location I */
#define MCA_BTL_UDAPL_GET_LOCAL_RDMA_FRAG(E, I)                         \
            (mca_btl_udapl_frag_t*)                                     \
            ((char*)(E)->endpoint_eager_rdma_local.base.pval +          \
            (I) * sizeof(mca_btl_udapl_frag_eager_rdma_t))

/*
 * Increment the index I by one while not exceeding the total number of
 * available eager rdma fragments
 */
#define MCA_BTL_UDAPL_RDMA_NEXT_INDEX(I) do {                                   \
                            (I) = ((I) + 1);                                    \
                            if((I) ==                                           \
                                mca_btl_udapl_component.udapl_eager_rdma_num)         \
                                (I) = 0;                                            \
                        } while (0)
    
END_C_DECLS
#endif