1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2 /*
3 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
4 * University Research and Technology
5 * Corporation. All rights reserved.
6 * Copyright (c) 2004-2006 The University of Tennessee and The University
7 * of Tennessee Research Foundation. All rights
8 * reserved.
9 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
10 * University of Stuttgart. All rights reserved.
11 * Copyright (c) 2004-2005 The Regents of the University of California.
12 * All rights reserved.
13 * Copyright (c) 2017-2018 Los Alamos National Security, LLC. All rights
14 * reserved.
15 * Copyright (c) 2018 Intel, Inc, All rights reserved
16 * $COPYRIGHT$
17 *
18 * Additional copyrights may follow
19 *
20 * $HEADER$
21 */
22
23 #ifndef MCA_BTL_OFI_ENDPOINT_H
24 #define MCA_BTL_OFI_ENDPOINT_H
25
26 #include "opal/class/opal_list.h"
27 #include "opal/mca/event/event.h"
28
29 #include "btl_ofi.h"
30
31 BEGIN_C_DECLS
32
33 #if OPAL_HAVE_THREAD_LOCAL
34 extern opal_thread_local mca_btl_ofi_context_t *my_context;
35 #endif /* OPAL_HAVE_THREAD_LOCAL */
36
37 struct mca_btl_base_endpoint_t {
38 opal_list_item_t super;
39
40 struct fid_ep *ofi_endpoint;
41 fi_addr_t peer_addr;
42
43 /** endpoint proc */
44 opal_proc_t *ep_proc;
45
46 /** mutex to protect this structure */
47 opal_mutex_t ep_lock;
48 };
49
50 typedef struct mca_btl_base_endpoint_t mca_btl_base_endpoint_t;
51 typedef mca_btl_base_endpoint_t mca_btl_ofi_endpoint_t;
52 OBJ_CLASS_DECLARATION(mca_btl_ofi_endpoint_t);
53
54 int init_context_freelists(mca_btl_ofi_context_t *context);
55
56 mca_btl_base_endpoint_t *mca_btl_ofi_endpoint_create (opal_proc_t *proc, struct fid_ep *ep);
57
58 /* contexts */
59 mca_btl_ofi_context_t *mca_btl_ofi_context_alloc_scalable(struct fi_info *info,
60 struct fid_domain *domain,
61 struct fid_ep *sep,
62 struct fid_av *av,
63 size_t num_contexts);
64
65 mca_btl_ofi_context_t *mca_btl_ofi_context_alloc_normal(struct fi_info *info,
66 struct fid_domain *domain,
67 struct fid_ep *ep,
68 struct fid_av *av);
69 void mca_btl_ofi_context_finalize(mca_btl_ofi_context_t *context, bool scalable_ep);
70
71 mca_btl_ofi_context_t *get_ofi_context(mca_btl_ofi_module_t *btl);
72 mca_btl_ofi_context_t *get_ofi_context_rr(mca_btl_ofi_module_t *btl);
73
74 END_C_DECLS
75 #endif