1 /*
2 * Copyright (c) 2004-2005 The Trustees of Indiana University and Indiana
3 * University Research and Technology
4 * Corporation. All rights reserved.
5 * Copyright (c) 2004-2005 The University of Tennessee and The University
6 * of Tennessee Research Foundation. All rights
7 * reserved.
8 * Copyright (c) 2004-2005 High Performance Computing Center Stuttgart,
9 * University of Stuttgart. All rights reserved.
10 * Copyright (c) 2004-2006 The Regents of the University of California.
11 * All rights reserved.
12 * Copyright (c) 2006 QLogic Corporation. All rights reserved.
13 * Copyright (c) 2015 Intel, Inc. All rights reserved
14 * $COPYRIGHT$
15 *
16 * Additional copyrights may follow
17 *
18 * $HEADER$
19 */
20
21 #ifndef MCA_MTL_PSM2_ENDPOINT_H
22 #define MCA_MTL_PSM2_ENDPOINT_H
23
24 #include "opal/class/opal_list.h"
25 #include "opal/mca/event/event.h"
26 #include "ompi/mca/mtl/mtl.h"
27 #include "mtl_psm2.h"
28
29 #include "psm2.h"
30
31 BEGIN_C_DECLS
32
33 OBJ_CLASS_DECLARATION(mca_mtl_psm2_endpoint_t);
34
35 /**
36 * An abstraction that represents a connection to a endpoint process.
37 * An instance of mca_mtl_psm2_endpoint_t is associated w/ each process
38 * and MTL pair at startup. However, connections to the endpoint
39 * are established dynamically on an as-needed basis:
40 */
41
42 struct mca_mtl_psm2_endpoint_t {
43 opal_list_item_t super;
44
45 struct mca_mtl_psm2_module_t* mtl_psm2_module;
46 /**< MTL instance that created this connection */
47
48 psm2_epid_t peer_epid;
49 /**< The unique epid for the opened port */
50
51 psm2_epaddr_t peer_addr;
52 /**< The connected endpoint handle*/
53 };
54
55 typedef struct mca_mtl_psm2_endpoint_t mca_mtl_psm2_endpoint_t;
56 OBJ_CLASS_DECLARATION(mca_mtl_psm2_endpoint);
57
58 static inline mca_mtl_psm2_endpoint_t *ompi_mtl_psm2_get_endpoint (struct mca_mtl_base_module_t* mtl, ompi_proc_t *ompi_proc)
59 {
60 if (OPAL_UNLIKELY(NULL == ompi_proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_MTL])) {
61 ompi_mtl_psm2_add_procs (mtl, 1, &ompi_proc);
62 }
63
64 return ompi_proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_MTL];
65 }
66
67 END_C_DECLS
68 #endif