20 #ifndef MCA_PML_BFO_HEADER_H
21 #define MCA_PML_BFO_HEADER_H
23 #include "ompi_config.h"
24 #ifdef HAVE_SYS_TYPES_H
25 #include <sys/types.h>
27 #ifdef HAVE_NETINET_IN_H
28 #include <netinet/in.h>
31 #include "opal/types.h"
32 #include "opal/util/arch.h"
36 #define MCA_PML_BFO_HDR_TYPE_MATCH (MCA_BTL_TAG_PML + 1)
37 #define MCA_PML_BFO_HDR_TYPE_RNDV (MCA_BTL_TAG_PML + 2)
38 #define MCA_PML_BFO_HDR_TYPE_RGET (MCA_BTL_TAG_PML + 3)
39 #define MCA_PML_BFO_HDR_TYPE_ACK (MCA_BTL_TAG_PML + 4)
40 #define MCA_PML_BFO_HDR_TYPE_NACK (MCA_BTL_TAG_PML + 5)
41 #define MCA_PML_BFO_HDR_TYPE_FRAG (MCA_BTL_TAG_PML + 6)
42 #define MCA_PML_BFO_HDR_TYPE_GET (MCA_BTL_TAG_PML + 7)
43 #define MCA_PML_BFO_HDR_TYPE_PUT (MCA_BTL_TAG_PML + 8)
44 #define MCA_PML_BFO_HDR_TYPE_FIN (MCA_BTL_TAG_PML + 9)
46 #define MCA_PML_BFO_HDR_TYPE_RNDVRESTARTNOTIFY (MCA_BTL_TAG_PML + 10)
47 #define MCA_PML_BFO_HDR_TYPE_RNDVRESTARTACK (MCA_BTL_TAG_PML + 11)
48 #define MCA_PML_BFO_HDR_TYPE_RNDVRESTARTNACK (MCA_BTL_TAG_PML + 12)
49 #define MCA_PML_BFO_HDR_TYPE_RECVERRNOTIFY (MCA_BTL_TAG_PML + 13)
52 #define MCA_PML_BFO_HDR_FLAGS_ACK 1
53 #define MCA_PML_BFO_HDR_FLAGS_NBO 2
54 #define MCA_PML_BFO_HDR_FLAGS_PIN 4
55 #define MCA_PML_BFO_HDR_FLAGS_CONTIG 8
56 #define MCA_PML_BFO_HDR_FLAGS_NORDMA 16
58 #define MCA_PML_BFO_HDR_FLAGS_RESTART 32
70 #define MCA_PML_BFO_COMMON_HDR_NTOH(h)
71 #define MCA_PML_BFO_COMMON_HDR_HTON(h)
83 #if OPAL_ENABLE_HETEROGENEOUS_SUPPORT
84 uint8_t hdr_padding[2];
87 #if OPAL_ENABLE_HETEROGENEOUS_SUPPORT
88 #define OMPI_PML_BFO_MATCH_HDR_LEN 16
90 #define OMPI_PML_BFO_MATCH_HDR_LEN 14
95 #if OPAL_ENABLE_HETEROGENEOUS_SUPPORT && OPAL_ENABLE_DEBUG
96 #define MCA_PML_BFO_MATCH_HDR_FILL(h) \
98 (h).hdr_padding[0] = 0; \
99 (h).hdr_padding[1] = 0; \
102 #define MCA_PML_BFO_MATCH_HDR_FILL(h)
105 #define MCA_PML_BFO_MATCH_HDR_NTOH(h) \
107 MCA_PML_BFO_COMMON_HDR_NTOH((h).hdr_common); \
108 (h).hdr_ctx = ntohs((h).hdr_ctx); \
109 (h).hdr_src = ntohl((h).hdr_src); \
110 (h).hdr_tag = ntohl((h).hdr_tag); \
111 (h).hdr_seq = ntohs((h).hdr_seq); \
114 #define MCA_PML_BFO_MATCH_HDR_HTON(h) \
116 MCA_PML_BFO_COMMON_HDR_HTON((h).hdr_common); \
117 MCA_PML_BFO_MATCH_HDR_FILL(h); \
118 (h).hdr_ctx = htons((h).hdr_ctx); \
119 (h).hdr_src = htonl((h).hdr_src); \
120 (h).hdr_tag = htonl((h).hdr_tag); \
121 (h).hdr_seq = htons((h).hdr_seq); \
135 uint8_t hdr_restartseq;
140 #if OPAL_ENABLE_HETEROGENEOUS_SUPPORT && OPAL_ENABLE_DEBUG
141 #define MCA_PML_BFO_RNDV_HDR_FILL(h) \
142 MCA_PML_BFO_MATCH_HDR_FILL((h).hdr_match)
144 #define MCA_PML_BFO_RNDV_HDR_FILL(h)
150 #define MCA_PML_BFO_RNDV_HDR_NTOH(h) \
152 MCA_PML_BFO_MATCH_HDR_NTOH((h).hdr_match); \
153 (h).hdr_msg_length = ntoh64((h).hdr_msg_length); \
156 #define MCA_PML_BFO_RNDV_HDR_HTON(h) \
158 MCA_PML_BFO_MATCH_HDR_HTON((h).hdr_match); \
159 MCA_PML_BFO_RNDV_HDR_FILL(h); \
160 (h).hdr_msg_length = hton64((h).hdr_msg_length); \
169 #if OPAL_ENABLE_HETEROGENEOUS_SUPPORT
170 uint8_t hdr_padding[4];
177 #if OPAL_ENABLE_HETEROGENEOUS_SUPPORT && OPAL_ENABLE_DEBUG
178 #define MCA_PML_BFO_RGET_HDR_FILL(h) \
180 MCA_PML_BFO_RNDV_HDR_FILL((h).hdr_rndv); \
181 (h).hdr_padding[0] = 0; \
182 (h).hdr_padding[1] = 0; \
183 (h).hdr_padding[2] = 0; \
184 (h).hdr_padding[3] = 0; \
187 #define MCA_PML_BFO_RGET_HDR_FILL(h)
190 #define MCA_PML_BFO_RGET_HDR_NTOH(h) \
192 MCA_PML_BFO_RNDV_HDR_NTOH((h).hdr_rndv); \
193 (h).hdr_seg_cnt = ntohl((h).hdr_seg_cnt); \
196 #define MCA_PML_BFO_RGET_HDR_HTON(h) \
198 MCA_PML_BFO_RNDV_HDR_HTON((h).hdr_rndv); \
199 MCA_PML_BFO_RGET_HDR_FILL(h); \
200 (h).hdr_seg_cnt = htonl((h).hdr_seg_cnt); \
208 #if OPAL_ENABLE_HETEROGENEOUS_SUPPORT
209 uint8_t hdr_padding[6];
217 #if OPAL_ENABLE_HETEROGENEOUS_SUPPORT && OPAL_ENABLE_DEBUG
218 #define MCA_PML_BFO_FRAG_HDR_FILL(h) \
220 (h).hdr_padding[0] = 0; \
221 (h).hdr_padding[1] = 0; \
222 (h).hdr_padding[2] = 0; \
223 (h).hdr_padding[3] = 0; \
224 (h).hdr_padding[4] = 0; \
225 (h).hdr_padding[5] = 0; \
228 #define MCA_PML_BFO_FRAG_HDR_FILL(h)
231 #define MCA_PML_BFO_FRAG_HDR_NTOH(h) \
233 MCA_PML_BFO_COMMON_HDR_NTOH((h).hdr_common); \
234 (h).hdr_frag_offset = ntoh64((h).hdr_frag_offset); \
237 #define MCA_PML_BFO_FRAG_HDR_HTON(h) \
239 MCA_PML_BFO_COMMON_HDR_HTON((h).hdr_common); \
240 MCA_PML_BFO_FRAG_HDR_FILL(h); \
241 (h).hdr_frag_offset = hton64((h).hdr_frag_offset); \
250 #if OPAL_ENABLE_HETEROGENEOUS_SUPPORT
251 uint8_t hdr_padding[6];
259 #if OPAL_ENABLE_HETEROGENEOUS_SUPPORT && OPAL_ENABLE_DEBUG
260 #define MCA_PML_BFO_ACK_HDR_FILL(h) \
262 (h).hdr_padding[0] = 0; \
263 (h).hdr_padding[1] = 0; \
264 (h).hdr_padding[2] = 0; \
265 (h).hdr_padding[3] = 0; \
266 (h).hdr_padding[4] = 0; \
267 (h).hdr_padding[5] = 0; \
270 #define MCA_PML_BFO_ACK_HDR_FILL(h)
277 #define MCA_PML_BFO_ACK_HDR_NTOH(h) \
279 MCA_PML_BFO_COMMON_HDR_NTOH((h).hdr_common); \
280 (h).hdr_send_offset = ntoh64((h).hdr_send_offset); \
283 #define MCA_PML_BFO_ACK_HDR_HTON(h) \
285 MCA_PML_BFO_COMMON_HDR_HTON((h).hdr_common); \
286 MCA_PML_BFO_ACK_HDR_FILL(h); \
287 (h).hdr_send_offset = hton64((h).hdr_send_offset); \
296 #if OPAL_ENABLE_HETEROGENEOUS_SUPPORT
297 uint8_t hdr_padding[2];
310 #if OPAL_ENABLE_HETEROGENEOUS_SUPPORT && OPAL_ENABLE_DEBUG
311 #define MCA_PML_BFO_RDMA_HDR_FILL(h) \
313 (h).hdr_padding[0] = 0; \
314 (h).hdr_padding[1] = 0; \
317 #define MCA_PML_BFO_RDMA_HDR_FILL(h)
320 #define MCA_PML_BFO_RDMA_HDR_NTOH(h) \
322 MCA_PML_BFO_COMMON_HDR_NTOH((h).hdr_common); \
323 (h).hdr_seg_cnt = ntohl((h).hdr_seg_cnt); \
324 (h).hdr_rdma_offset = ntoh64((h).hdr_rdma_offset); \
327 #define MCA_PML_BFO_RDMA_HDR_HTON(h) \
329 MCA_PML_BFO_COMMON_HDR_HTON((h).hdr_common); \
330 MCA_PML_BFO_RDMA_HDR_FILL(h); \
331 (h).hdr_seg_cnt = htonl((h).hdr_seg_cnt); \
332 (h).hdr_rdma_offset = hton64((h).hdr_rdma_offset); \
341 #if OPAL_ENABLE_HETEROGENEOUS_SUPPORT
342 uint8_t hdr_padding[2];
354 #if OPAL_ENABLE_HETEROGENEOUS_SUPPORT && OPAL_ENABLE_DEBUG
355 #define MCA_PML_BFO_FIN_HDR_FILL(h) \
357 (h).hdr_padding[0] = 0; \
358 (h).hdr_padding[1] = 0; \
359 MCA_PML_BFO_MATCH_HDR_FILL((h).hdr_match); \
362 #define MCA_PML_BFO_FIN_HDR_FILL(h)
365 #define MCA_PML_BFO_FIN_HDR_NTOH(h) \
367 MCA_PML_BFO_COMMON_HDR_NTOH((h).hdr_common); \
368 MCA_PML_BFO_MATCH_HDR_NTOH((h).hdr_match); \
371 #define MCA_PML_BFO_FIN_HDR_HTON(h) \
373 MCA_PML_BFO_COMMON_HDR_HTON((h).hdr_common); \
374 MCA_PML_BFO_MATCH_HDR_HTON((h).hdr_match); \
375 MCA_PML_BFO_FIN_HDR_FILL(h); \
378 #if OPAL_ENABLE_HETEROGENEOUS_SUPPORT && OPAL_ENABLE_DEBUG
379 #define MCA_PML_BFO_FIN_HDR_FILL(h) \
381 (h).hdr_padding[0] = 0; \
382 (h).hdr_padding[1] = 0; \
385 #define MCA_PML_BFO_FIN_HDR_FILL(h)
388 #define MCA_PML_BFO_FIN_HDR_NTOH(h) \
390 MCA_PML_BFO_COMMON_HDR_NTOH((h).hdr_common); \
393 #define MCA_PML_BFO_FIN_HDR_HTON(h) \
395 MCA_PML_BFO_COMMON_HDR_HTON((h).hdr_common); \
396 MCA_PML_BFO_FIN_HDR_FILL(h); \
404 struct mca_pml_bfo_restart_hdr_t {
406 uint8_t hdr_restartseq;
407 #if OPAL_ENABLE_HETEROGENEOUS_SUPPORT
408 uint8_t hdr_padding[3];
412 int32_t hdr_dst_rank;
416 typedef struct mca_pml_bfo_restart_hdr_t mca_pml_bfo_restart_hdr_t;
421 #define MCA_PML_BFO_RESTART_HDR_NTOH(h) \
423 MCA_PML_BFO_MATCH_HDR_NTOH((h).hdr_match); \
424 (h).hdr_dst_rank = ntohl((h).hdr_dst_rank); \
425 (h).hdr_jobid = ntohl((h).hdr_jobid); \
426 (h).hdr_vpid = ntohl((h).hdr_vpid); \
429 #define MCA_PML_BFO_RESTART_HDR_HTON(h) \
431 MCA_PML_BFO_MATCH_HDR_HTON((h).hdr_match); \
432 (h).hdr_dst_rank = htonl((h).hdr_dst_rank); \
433 (h).hdr_jobid = htonl((h).hdr_jobid); \
434 (h).hdr_vpid = htonl((h).hdr_vpid); \
451 mca_pml_bfo_restart_hdr_t hdr_restart;
456 #if !defined(WORDS_BIGENDIAN) && OPAL_ENABLE_HETEROGENEOUS_SUPPORT
457 static inline __opal_attribute_always_inline__
void
460 if(!(hdr->hdr_common.
hdr_flags & MCA_PML_BFO_HDR_FLAGS_NBO))
464 case MCA_PML_BFO_HDR_TYPE_MATCH:
465 MCA_PML_BFO_MATCH_HDR_NTOH(hdr->hdr_match);
467 case MCA_PML_BFO_HDR_TYPE_RNDV:
468 MCA_PML_BFO_RNDV_HDR_NTOH(hdr->hdr_rndv);
470 case MCA_PML_BFO_HDR_TYPE_RGET:
471 MCA_PML_BFO_RGET_HDR_NTOH(hdr->hdr_rget);
473 case MCA_PML_BFO_HDR_TYPE_ACK:
474 MCA_PML_BFO_ACK_HDR_NTOH(hdr->hdr_ack);
476 case MCA_PML_BFO_HDR_TYPE_FRAG:
477 MCA_PML_BFO_FRAG_HDR_NTOH(hdr->hdr_frag);
479 case MCA_PML_BFO_HDR_TYPE_PUT:
480 MCA_PML_BFO_RDMA_HDR_NTOH(hdr->hdr_rdma);
482 case MCA_PML_BFO_HDR_TYPE_FIN:
483 MCA_PML_BFO_FIN_HDR_NTOH(hdr->hdr_fin);
491 #define bfo_hdr_ntoh(h, t) do{}while(0)
494 #if OPAL_ENABLE_HETEROGENEOUS_SUPPORT
495 #define bfo_hdr_hton(h, t, p) \
496 bfo_hdr_hton_intr((mca_pml_bfo_hdr_t*)h, t, p)
497 static inline __opal_attribute_always_inline__
void
501 #ifdef WORDS_BIGENDIAN
502 hdr->hdr_common.
hdr_flags |= MCA_PML_BFO_HDR_FLAGS_NBO;
505 if(!(proc->
proc_arch & OPAL_ARCH_ISBIGENDIAN))
508 hdr->hdr_common.
hdr_flags |= MCA_PML_BFO_HDR_FLAGS_NBO;
510 case MCA_PML_BFO_HDR_TYPE_MATCH:
511 MCA_PML_BFO_MATCH_HDR_HTON(hdr->hdr_match);
513 case MCA_PML_BFO_HDR_TYPE_RNDV:
514 MCA_PML_BFO_RNDV_HDR_HTON(hdr->hdr_rndv);
516 case MCA_PML_BFO_HDR_TYPE_RGET:
517 MCA_PML_BFO_RGET_HDR_HTON(hdr->hdr_rget);
519 case MCA_PML_BFO_HDR_TYPE_ACK:
520 MCA_PML_BFO_ACK_HDR_HTON(hdr->hdr_ack);
522 case MCA_PML_BFO_HDR_TYPE_FRAG:
523 MCA_PML_BFO_FRAG_HDR_HTON(hdr->hdr_frag);
525 case MCA_PML_BFO_HDR_TYPE_PUT:
526 MCA_PML_BFO_RDMA_HDR_HTON(hdr->hdr_rdma);
528 case MCA_PML_BFO_HDR_TYPE_FIN:
529 MCA_PML_BFO_FIN_HDR_HTON(hdr->hdr_fin);
538 #define bfo_hdr_hton(h, t, p) do{}while(0)
Common hdr attributes - must be first element in each hdr type.
Definition: pml_bfo_hdr.h:64
Header definition for a combined rdma rendezvous/get.
Definition: pml_bfo_hdr.h:166
ompi_ptr_t hdr_src_req
source request
Definition: pml_bfo_hdr.h:253
ompi_ptr_t hdr_src_req
pointer to source request
Definition: pml_bfo_hdr.h:212
Header definition for the first fragment, contains the attributes required to match the corresponding...
Definition: pml_bfo_hdr.h:77
int32_t hdr_tag
user tag
Definition: pml_bfo_hdr.h:81
Union of defined hdr types.
Definition: pml_bfo_hdr.h:441
ompi_ptr_t hdr_dst_req
matched receive request
Definition: pml_bfo_hdr.h:254
Process identification structure interface.
Remote Open MPI process structure.
Definition: proc.h:56
ompi_ptr_t hdr_req
destination request
Definition: pml_bfo_hdr.h:300
ompi_ptr_t hdr_src_req
pointer to source request - returned in ack
Definition: pml_bfo_hdr.h:132
Header used to initiate an RDMA operation.
Definition: pml_bfo_hdr.h:294
mca_btl_base_segment_t hdr_segs[1]
list of segments for rdma
Definition: pml_bfo_hdr.h:173
Header used to complete an RDMA operation.
Definition: pml_bfo_hdr.h:339
Header used to acknowledgment outstanding fragment(s).
Definition: pml_bfo_hdr.h:248
mca_pml_bfo_common_hdr_t hdr_common
common attributes
Definition: pml_bfo_hdr.h:78
Header definition for the first fragment when an acknowledgment is required.
Definition: pml_bfo_hdr.h:129
ompi_ptr_t hdr_des
source descriptor
Definition: pml_bfo_hdr.h:172
Byte Transfer Layer (BTL)
mca_pml_bfo_common_hdr_t hdr_common
common attributes
Definition: pml_bfo_hdr.h:207
int32_t hdr_src
source rank
Definition: pml_bfo_hdr.h:80
uint8_t hdr_type
type of envelope
Definition: pml_bfo_hdr.h:65
Header for subsequent fragments.
Definition: pml_bfo_hdr.h:206
uint64_t hdr_frag_offset
offset into message
Definition: pml_bfo_hdr.h:211
mca_btl_base_segment_t hdr_segs[1]
list of segments for rdma
Definition: pml_bfo_hdr.h:306
mca_pml_bfo_common_hdr_t hdr_common
common attributes
Definition: pml_bfo_hdr.h:340
uint64_t hdr_rdma_offset
current offset into user buffer
Definition: pml_bfo_hdr.h:305
uint32_t hdr_seg_cnt
number of segments for rdma
Definition: pml_bfo_hdr.h:299
ompi_ptr_t hdr_des
completed descriptor
Definition: pml_bfo_hdr.h:349
mca_pml_bfo_common_hdr_t hdr_common
common attributes
Definition: pml_bfo_hdr.h:295
uint16_t hdr_ctx
communicator index
Definition: pml_bfo_hdr.h:79
uint32_t proc_arch
architecture of this process
Definition: proc.h:66
ompi_ptr_t hdr_des
source descriptor
Definition: pml_bfo_hdr.h:304
uint16_t hdr_seq
message sequence number
Definition: pml_bfo_hdr.h:82
ompi_ptr_t hdr_dst_req
pointer to matched receive
Definition: pml_bfo_hdr.h:213
uint64_t hdr_send_offset
starting point of copy in/out
Definition: pml_bfo_hdr.h:255
uint32_t hdr_seg_cnt
number of segments for rdma
Definition: pml_bfo_hdr.h:168
uint64_t hdr_msg_length
message length
Definition: pml_bfo_hdr.h:131
mca_pml_bfo_common_hdr_t hdr_common
common attributes
Definition: pml_bfo_hdr.h:249
Describes a region/segment of memory that is addressable by an BTL.
Definition: btl.h:236
uint8_t hdr_flags
flags indicating how fragment should be processed
Definition: pml_bfo_hdr.h:66
uint32_t hdr_fail
RDMA operation failed.
Definition: pml_bfo_hdr.h:348