1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil -*- */
2 /*
3 * Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
4 * Copyright (c) 2015 Los Alamos National Security, LLC. All rights
5 * reserved.
6 * Copyright (c) 2017 Amazon.com, Inc. or its affiliates.
7 * All Rights reserved.
8 * $COPYRIGHT$
9 *
10 * Additional copyrights may follow
11 *
12 * $HEADER$
13 */
14
15 #ifndef OPAL_REACHABLE_H
16 #define OPAL_REACHABLE_H
17
18 #include "opal_config.h"
19 #include "opal/types.h"
20 #include "opal/class/opal_object.h"
21
22 #include "opal/mca/mca.h"
23 #include "opal/mca/if/if.h"
24
25
26 BEGIN_C_DECLS
27
28 /**
29 * Reachability matrix between endpoints of a given pair of hosts
30 *
31 * The output of the reachable() call is a opal_reachable_t, which
32 * gives an matrix of the connectivity between local and remote
33 * ethernet endpoints. Any given value in weights is the connectivity
34 * between the local endpoint index (first index) and the remote
35 * endpoint index (second index), and is a value between 0 and INT_MAX
36 * representing a relative connectivity.
37 */
38 struct opal_reachable_t {
39 opal_object_t super;
40 /** number of local interfaces passed to reachable() */
41 int num_local;
42 /** number of remote interfaces passed to reachable() */
43 int num_remote;
44 /** matric of connectivity weights */
45 int **weights;
46 /** \internal */
47 void *memory;
48 };
49 typedef struct opal_reachable_t opal_reachable_t;
50 OBJ_CLASS_DECLARATION(opal_reachable_t);
51
52 /* Init */
53 typedef int (*opal_reachable_base_module_init_fn_t)(void);
54
55 /* Finalize */
56 typedef int (*opal_reachable_base_module_fini_fn_t)(void);
57
58 /* Build reachability matrix between local and remote ethernet
59 * interfaces
60 *
61 * Given a list of local interfaces and remote interfaces from a
62 * single peer, build a reachability matrix between the two peers.
63 * This function does not select the best pairing of local and remote
64 * interfaces, but only a (comparable) reachability between any pair
65 * of local/remote interfaces.
66 *
67 * @returns a reachable object containing the reachability matrix on
68 * success, NULL on failure.
69 */
70 typedef opal_reachable_t*
71 (*opal_reachable_base_module_reachable_fn_t)(opal_list_t *local_if,
72 opal_list_t *remote_if);
73
74
75 /*
76 * the standard public API data structure
77 */
78 typedef struct {
79 /* currently used APIs */
80 opal_reachable_base_module_init_fn_t init;
81 opal_reachable_base_module_fini_fn_t finalize;
82 opal_reachable_base_module_reachable_fn_t reachable;
83 } opal_reachable_base_module_t;
84
85 typedef struct {
86 mca_base_component_t base_version;
87 mca_base_component_data_t base_data;
88 int priority;
89 } opal_reachable_base_component_t;
90
91 /*
92 * Macro for use in components that are of type reachable
93 */
94 #define OPAL_REACHABLE_BASE_VERSION_2_0_0 \
95 OPAL_MCA_BASE_VERSION_2_1_0("reachable", 2, 0, 0)
96
97 /* Global structure for accessing reachability functions */
98 OPAL_DECLSPEC extern opal_reachable_base_module_t opal_reachable;
99
100
101 END_C_DECLS
102
103 #endif