OpenMPI  0.1.1
osc_pt2pt_header.h
1 /*
2  * Copyright (c) 2004-2005 The Trustees of Indiana University.
3  * All rights reserved.
4  * Copyright (c) 2004-2005 The Trustees of the University of Tennessee.
5  * All rights reserved.
6  * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
7  * University of Stuttgart. All rights reserved.
8  * Copyright (c) 2004-2005 The Regents of the University of California.
9  * All rights reserved.
10  * Copyright (c) 2006-2007 Los Alamos National Security, LLC. All rights
11  * reserved.
12  * Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
13  * $COPYRIGHT$
14  *
15  * Additional copyrights may follow
16  *
17  * $HEADER$
18  */
19 
20 #ifndef OMPI_MCA_OSC_PT2PT_HDR_H
21 #define OMPI_MCA_OSC_PT2PT_HDR_H
22 
23 #ifdef HAVE_NETINET_IN_H
24 #include <netinet/in.h>
25 #endif
26 
27 #include "opal/types.h"
28 
29 #define OMPI_OSC_PT2PT_HDR_PUT 0x0001
30 #define OMPI_OSC_PT2PT_HDR_ACC 0x0002
31 #define OMPI_OSC_PT2PT_HDR_GET 0x0003
32 #define OMPI_OSC_PT2PT_HDR_REPLY 0x0004
33 #define OMPI_OSC_PT2PT_HDR_POST 0x0005
34 #define OMPI_OSC_PT2PT_HDR_COMPLETE 0x0006
35 #define OMPI_OSC_PT2PT_HDR_LOCK_REQ 0x0007
36 #define OMPI_OSC_PT2PT_HDR_UNLOCK_REQ 0x0008
37 #define OMPI_OSC_PT2PT_HDR_UNLOCK_REPLY 0x0009
38 
39 #define OMPI_OSC_PT2PT_HDR_FLAG_NBO 0x0001
40 
42  uint8_t hdr_type;
43  uint8_t hdr_flags;
44 #if OPAL_ENABLE_HETEROGENEOUS_SUPPORT
45  uint8_t padding[2];
46 #endif
47 };
49 
50 #define OMPI_OSC_PT2PT_BASE_HDR_NTOH(h)
51 #define OMPI_OSC_PT2PT_BASE_HDR_HTON(h)
52 
55 
56  int32_t hdr_origin;
57  ompi_ptr_t hdr_origin_sendreq;
58  int32_t hdr_origin_tag;
59 
60  uint64_t hdr_target_disp;
61  int32_t hdr_target_count;
62  int32_t hdr_target_op;
63 
64  int32_t hdr_msg_length; /* 0 if payload is not included */
65 };
67 
68 #define OMPI_OSC_PT2PT_SEND_HDR_HTON(hdr) \
69  do { \
70  OMPI_OSC_PT2PT_BASE_HDR_HTON((hdr).hdr_base) \
71  (hdr).hdr_origin = htonl((hdr).hdr_origin); \
72  (hdr).hdr_origin_tag = htonl((hdr).hdr_origin_tag); \
73  (hdr).hdr_target_disp = hton64((hdr).hdr_target_disp); \
74  (hdr).hdr_target_count = htonl((hdr).hdr_target_count); \
75  (hdr).hdr_target_op = htonl((hdr).hdr_target_op); \
76  (hdr).hdr_msg_length = htonl((hdr).hdr_msg_length); \
77  } while (0)
78 
79 #define OMPI_OSC_PT2PT_SEND_HDR_NTOH(hdr) \
80  do { \
81  OMPI_OSC_PT2PT_BASE_HDR_NTOH((hdr).hdr_base) \
82  (hdr).hdr_origin = ntohl((hdr).hdr_origin); \
83  (hdr).hdr_origin_tag = ntohl((hdr).hdr_origin_tag); \
84  (hdr).hdr_target_disp = ntoh64((hdr).hdr_target_disp); \
85  (hdr).hdr_target_count = ntohl((hdr).hdr_target_count); \
86  (hdr).hdr_target_op = ntohl((hdr).hdr_target_op); \
87  (hdr).hdr_msg_length = ntohl((hdr).hdr_msg_length); \
88  } while (0)
89 
90 
93  int32_t hdr_target_tag;
94  ompi_ptr_t hdr_origin_sendreq;
95  int32_t hdr_msg_length;
96 };
98 
99 #define OMPI_OSC_PT2PT_REPLY_HDR_HTON(hdr) \
100  do { \
101  OMPI_OSC_PT2PT_BASE_HDR_HTON((hdr).hdr_base) \
102  (hdr).hdr_target_tag = htonl((hdr).hdr_target_tag); \
103  (hdr).hdr_msg_length = htonl((hdr).hdr_msg_length); \
104  } while (0)
105 
106 #define OMPI_OSC_PT2PT_REPLY_HDR_NTOH(hdr) \
107  do { \
108  OMPI_OSC_PT2PT_BASE_HDR_NTOH((hdr).hdr_base) \
109  (hdr).hdr_target_tag = ntohl((hdr).hdr_target_tag); \
110  (hdr).hdr_msg_length = ntohl((hdr).hdr_msg_length); \
111  } while (0)
112 
113 
116  int32_t hdr_value[2];
117 };
119 
120 #define OMPI_OSC_PT2PT_CONTROL_HDR_HTON(hdr) \
121  do { \
122  OMPI_OSC_PT2PT_BASE_HDR_HTON((hdr).hdr_base) \
123  (hdr).hdr_value[0] = htonl((hdr).hdr_value[0]); \
124  (hdr).hdr_value[1] = htonl((hdr).hdr_value[1]); \
125  } while (0)
126 
127 #define OMPI_OSC_PT2PT_CONTROL_HDR_NTOH(hdr) \
128  do { \
129  OMPI_OSC_PT2PT_BASE_HDR_NTOH((hdr).hdr_base) \
130  (hdr).hdr_value[0] = ntohl((hdr).hdr_value[0]); \
131  (hdr).hdr_value[1] = ntohl((hdr).hdr_value[1]); \
132  } while (0)
133 
134 #endif /* OMPI_MCA_OSC_PT2PT_HDR_H */
Definition: osc_pt2pt_header.h:53
Definition: osc_pt2pt_header.h:91
Definition: osc_pt2pt_header.h:41
Definition: types.h:52
Definition: osc_pt2pt_header.h:114