Skip to content

Commit e5b7101

Browse files
authored
Merge pull request #6805 from wckzhang/reachable
Reachable
2 parents 6f1fa35 + c0c3e1b commit e5b7101

File tree

3 files changed

+29
-19
lines changed

3 files changed

+29
-19
lines changed

opal/mca/reachable/netlink/reachable_netlink_module.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,23 +59,23 @@ static int netlink_fini(void)
5959
* Higher weightings are given to connections on the same
6060
* network.
6161
*/
62-
static opal_reachable_t* netlink_reachable(opal_list_t *local_if,
63-
opal_list_t *remote_if)
62+
static opal_reachable_t* netlink_reachable(opal_list_t *local_ifs,
63+
opal_list_t *remote_ifs)
6464
{
6565
opal_reachable_t *reachable_results = NULL;
6666
int i, j;
6767
opal_if_t *local_iter, *remote_iter;
6868

69-
reachable_results = opal_reachable_allocate(local_if->opal_list_length,
70-
remote_if->opal_list_length);
69+
reachable_results = opal_reachable_allocate(local_ifs->opal_list_length,
70+
remote_ifs->opal_list_length);
7171
if (NULL == reachable_results) {
7272
return NULL;
7373
}
7474

7575
i = 0;
76-
OPAL_LIST_FOREACH(local_iter, local_if, opal_if_t) {
76+
OPAL_LIST_FOREACH(local_iter, local_ifs, opal_if_t) {
7777
j = 0;
78-
OPAL_LIST_FOREACH(remote_iter, remote_if, opal_if_t) {
78+
OPAL_LIST_FOREACH(remote_iter, remote_ifs, opal_if_t) {
7979
reachable_results->weights[i][j] = get_weights(local_iter, remote_iter);
8080
j++;
8181
}

opal/mca/reachable/reachable.h

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
44
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
55
* reserved.
6-
* Copyright (c) 2017 Amazon.com, Inc. or its affiliates.
6+
* Copyright (c) 2017-2019 Amazon.com, Inc. or its affiliates.
77
* All Rights reserved.
88
* $COPYRIGHT$
99
*
@@ -58,18 +58,28 @@ typedef int (*opal_reachable_base_module_fini_fn_t)(void);
5858
/* Build reachability matrix between local and remote ethernet
5959
* interfaces
6060
*
61+
* @param local_ifs (IN) Local list of opal_if_t objects
62+
* The opal_if_t objects must be fully populated
63+
* @param remote_ifs (IN) Remote list of opal_if_t objects
64+
* The opal_if_t objects must have the following fields populated:
65+
* uint16_t af_family;
66+
* struct sockaddr_storage if_addr;
67+
* uint32_t if_mask;
68+
* uint32_t if_bandwidth;
69+
* @return opal_reachable_t The reachability matrix was successfully created
70+
* @return NULL The reachability matrix could not be constructed
71+
*
6172
* Given a list of local interfaces and remote interfaces from a
6273
* single peer, build a reachability matrix between the two peers.
6374
* This function does not select the best pairing of local and remote
6475
* interfaces, but only a (comparable) reachability between any pair
6576
* of local/remote interfaces.
6677
*
67-
* @returns a reachable object containing the reachability matrix on
68-
* success, NULL on failure.
78+
*
6979
*/
7080
typedef opal_reachable_t*
71-
(*opal_reachable_base_module_reachable_fn_t)(opal_list_t *local_if,
72-
opal_list_t *remote_if);
81+
(*opal_reachable_base_module_reachable_fn_t)(opal_list_t *local_ifs,
82+
opal_list_t *remote_ifs);
7383

7484

7585
/*

opal/mca/reachable/weighted/reachable_weighted.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535

3636
static int weighted_init(void);
3737
static int weighted_fini(void);
38-
static opal_reachable_t* weighted_reachable(opal_list_t *local_if,
39-
opal_list_t *remote_if);
38+
static opal_reachable_t* weighted_reachable(opal_list_t *local_ifs,
39+
opal_list_t *remote_ifs);
4040

4141
static int get_weights(opal_if_t *local_if, opal_if_t *remote_if);
4242
static int calculate_weight(int bandwidth_local, int bandwidth_remote,
@@ -83,23 +83,23 @@ static int weighted_fini(void)
8383
}
8484

8585

86-
static opal_reachable_t* weighted_reachable(opal_list_t *local_if,
87-
opal_list_t *remote_if)
86+
static opal_reachable_t* weighted_reachable(opal_list_t *local_ifs,
87+
opal_list_t *remote_ifs)
8888
{
8989
opal_reachable_t *reachable_results = NULL;
9090
int i, j;
9191
opal_if_t *local_iter, *remote_iter;
9292

93-
reachable_results = opal_reachable_allocate(opal_list_get_size(local_if),
94-
opal_list_get_size(remote_if));
93+
reachable_results = opal_reachable_allocate(opal_list_get_size(local_ifs),
94+
opal_list_get_size(remote_ifs));
9595
if (NULL == reachable_results) {
9696
return NULL;
9797
}
9898

9999
i = 0;
100-
OPAL_LIST_FOREACH(local_iter, local_if, opal_if_t) {
100+
OPAL_LIST_FOREACH(local_iter, local_ifs, opal_if_t) {
101101
j = 0;
102-
OPAL_LIST_FOREACH(remote_iter, remote_if, opal_if_t) {
102+
OPAL_LIST_FOREACH(remote_iter, remote_ifs, opal_if_t) {
103103
reachable_results->weights[i][j] = get_weights(local_iter, remote_iter);
104104
j++;
105105
}

0 commit comments

Comments
 (0)