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-2005 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-2006 The Regents of the University of California.
12 * All rights reserved.
13 * Copyright (c) 2006 QLogic Corporation. All rights reserved.
14 * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
15 * reserved.
16 * $COPYRIGHT$
17 *
18 * Additional copyrights may follow
19 *
20 * $HEADER$
21 */
22
23 #ifndef MCA_MTL_PSM_ENDPOINT_H
24 #define MCA_MTL_PSM_ENDPOINT_H
25
26 #include "opal/class/opal_list.h"
27 #include "opal/mca/event/event.h"
28 #include "ompi/mca/mtl/mtl.h"
29 #include "mtl_psm.h"
30
31 #include "psm.h"
32
33 BEGIN_C_DECLS
34
35 OBJ_CLASS_DECLARATION(mca_mtl_psm_endpoint_t);
36
37 /**
38 * An abstraction that represents a connection to a endpoint process.
39 * An instance of mca_mtl_psm_endpoint_t is associated w/ each process
40 * and MTL pair at startup. However, connections to the endpoint
41 * are established dynamically on an as-needed basis:
42 */
43
44 struct mca_mtl_psm_endpoint_t {
45 opal_list_item_t super;
46
47 struct mca_mtl_psm_module_t* mtl_psm_module;
48 /**< MTL instance that created this connection */
49
50 psm_epid_t peer_epid;
51 /**< The unique epid for the opened port */
52
53 psm_epaddr_t peer_addr;
54 /**< The connected endpoint handle*/
55 };
56
57 typedef struct mca_mtl_psm_endpoint_t mca_mtl_psm_endpoint_t;
58 OBJ_CLASS_DECLARATION(mca_mtl_psm_endpoint);
59
60 static inline mca_mtl_psm_endpoint_t *ompi_mtl_psm_get_endpoint (struct mca_mtl_base_module_t* mtl, ompi_proc_t *ompi_proc)
61 {
62 if (OPAL_UNLIKELY(NULL == ompi_proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_MTL])) {
63 ompi_mtl_psm_add_procs (mtl, 1, &ompi_proc);
64 }
65
66 return ompi_proc->proc_endpoints[OMPI_PROC_ENDPOINT_TAG_MTL];
67 }
68
69 END_C_DECLS
70 #endif