1 /*
2 * Copyright (c) 2013-2016 Intel, Inc. All rights reserved
3 * Copyright (c) 2017 Los Alamos National Security, LLC. All rights
4 * reserved.
5 *
6 * $COPYRIGHT$
7 *
8 * Additional copyrights may follow
9 *
10 * $HEADER$
11 */
12
13 #ifndef OMPI_MTL_OFI_REQUEST_H
14 #define OMPI_MTL_OFI_REQUEST_H
15
16 #include "mtl_ofi.h"
17
18 #define TO_OFI_REQ(_ptr_ctx) \
19 container_of((_ptr_ctx), struct ompi_mtl_ofi_request_t, ctx)
20
21 typedef enum {
22 OMPI_MTL_OFI_SEND,
23 OMPI_MTL_OFI_RECV,
24 OMPI_MTL_OFI_ACK,
25 OMPI_MTL_OFI_PROBE
26 } ompi_mtl_ofi_request_type_t;
27
28 struct ompi_mtl_ofi_request_t;
29
30 struct ompi_mtl_ofi_request_t {
31 struct mca_mtl_request_t super;
32
33 /** OFI Request type */
34 ompi_mtl_ofi_request_type_t type;
35
36 /** OFI context */
37 struct fi_context ctx;
38
39 /** Completion count used by blocking and/or synchronous operations */
40 volatile int completion_count;
41
42 /** Event callback */
43 int (*event_callback)(struct fi_cq_tagged_entry *wc,
44 struct ompi_mtl_ofi_request_t*);
45
46 /** Error callback */
47 int (*error_callback)(struct fi_cq_err_entry *error,
48 struct ompi_mtl_ofi_request_t*);
49
50 /** Request status */
51 struct ompi_status_public_t status;
52
53 /** Match state used by Probe */
54 int match_state;
55
56 /** Reference to the communicator used to */
57 /* lookup source of an ANY_SOURCE Recv */
58 struct ompi_communicator_t *comm;
59
60 /** Reference to the MTL used to lookup */
61 /* source of an ANY_SOURCE Recv */
62 struct mca_mtl_base_module_t* mtl;
63
64 /** Pack buffer */
65 void *buffer;
66
67 /** Pack buffer size */
68 size_t length;
69
70 /** Pack buffer convertor */
71 struct opal_convertor_t *convertor;
72
73 /** Flag to prevent MPI_Cancel from cancelling a started Recv request */
74 volatile bool req_started;
75
76 /** Request's tag used in case of an error. Also for FI_CLAIM requests. */
77 uint64_t match_bits;
78
79 /** Used to build msg for fi_trecvmsg with FI_CLAIM */
80 uint64_t mask_bits;
81
82 /** Remote OFI address used when a Recv needs to be ACKed */
83 fi_addr_t remote_addr;
84
85 /** Parent request which needs to be ACKed (e.g. Synchronous Send) */
86 struct ompi_mtl_ofi_request_t *parent;
87
88 /** Pointer to Mrecv request to complete */
89 struct mca_mtl_request_t *mrecv_req;
90 };
91 typedef struct ompi_mtl_ofi_request_t ompi_mtl_ofi_request_t;
92
93 #endif