1
1

Merge pull request #6805 from wckzhang/reachable

Reachable
Этот коммит содержится в:
Brian Barrett 2019-07-12 09:35:43 -07:00 коммит произвёл GitHub
родитель 6f1fa35432 c0c3e1b540
Коммит e5b7101a95
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 29 добавлений и 19 удалений

Просмотреть файл

@ -59,23 +59,23 @@ static int netlink_fini(void)
* Higher weightings are given to connections on the same
* network.
*/
static opal_reachable_t* netlink_reachable(opal_list_t *local_if,
opal_list_t *remote_if)
static opal_reachable_t* netlink_reachable(opal_list_t *local_ifs,
opal_list_t *remote_ifs)
{
opal_reachable_t *reachable_results = NULL;
int i, j;
opal_if_t *local_iter, *remote_iter;
reachable_results = opal_reachable_allocate(local_if->opal_list_length,
remote_if->opal_list_length);
reachable_results = opal_reachable_allocate(local_ifs->opal_list_length,
remote_ifs->opal_list_length);
if (NULL == reachable_results) {
return NULL;
}
i = 0;
OPAL_LIST_FOREACH(local_iter, local_if, opal_if_t) {
OPAL_LIST_FOREACH(local_iter, local_ifs, opal_if_t) {
j = 0;
OPAL_LIST_FOREACH(remote_iter, remote_if, opal_if_t) {
OPAL_LIST_FOREACH(remote_iter, remote_ifs, opal_if_t) {
reachable_results->weights[i][j] = get_weights(local_iter, remote_iter);
j++;
}

Просмотреть файл

@ -3,7 +3,7 @@
* Copyright (c) 2014-2015 Intel, Inc. All rights reserved.
* Copyright (c) 2015 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2017 Amazon.com, Inc. or its affiliates.
* Copyright (c) 2017-2019 Amazon.com, Inc. or its affiliates.
* All Rights reserved.
* $COPYRIGHT$
*
@ -58,18 +58,28 @@ typedef int (*opal_reachable_base_module_fini_fn_t)(void);
/* Build reachability matrix between local and remote ethernet
* interfaces
*
* @param local_ifs (IN) Local list of opal_if_t objects
* The opal_if_t objects must be fully populated
* @param remote_ifs (IN) Remote list of opal_if_t objects
* The opal_if_t objects must have the following fields populated:
* uint16_t af_family;
* struct sockaddr_storage if_addr;
* uint32_t if_mask;
* uint32_t if_bandwidth;
* @return opal_reachable_t The reachability matrix was successfully created
* @return NULL The reachability matrix could not be constructed
*
* Given a list of local interfaces and remote interfaces from a
* single peer, build a reachability matrix between the two peers.
* This function does not select the best pairing of local and remote
* interfaces, but only a (comparable) reachability between any pair
* of local/remote interfaces.
*
* @returns a reachable object containing the reachability matrix on
* success, NULL on failure.
*
*/
typedef opal_reachable_t*
(*opal_reachable_base_module_reachable_fn_t)(opal_list_t *local_if,
opal_list_t *remote_if);
(*opal_reachable_base_module_reachable_fn_t)(opal_list_t *local_ifs,
opal_list_t *remote_ifs);
/*

Просмотреть файл

@ -35,8 +35,8 @@
static int weighted_init(void);
static int weighted_fini(void);
static opal_reachable_t* weighted_reachable(opal_list_t *local_if,
opal_list_t *remote_if);
static opal_reachable_t* weighted_reachable(opal_list_t *local_ifs,
opal_list_t *remote_ifs);
static int get_weights(opal_if_t *local_if, opal_if_t *remote_if);
static int calculate_weight(int bandwidth_local, int bandwidth_remote,
@ -83,23 +83,23 @@ static int weighted_fini(void)
}
static opal_reachable_t* weighted_reachable(opal_list_t *local_if,
opal_list_t *remote_if)
static opal_reachable_t* weighted_reachable(opal_list_t *local_ifs,
opal_list_t *remote_ifs)
{
opal_reachable_t *reachable_results = NULL;
int i, j;
opal_if_t *local_iter, *remote_iter;
reachable_results = opal_reachable_allocate(opal_list_get_size(local_if),
opal_list_get_size(remote_if));
reachable_results = opal_reachable_allocate(opal_list_get_size(local_ifs),
opal_list_get_size(remote_ifs));
if (NULL == reachable_results) {
return NULL;
}
i = 0;
OPAL_LIST_FOREACH(local_iter, local_if, opal_if_t) {
OPAL_LIST_FOREACH(local_iter, local_ifs, opal_if_t) {
j = 0;
OPAL_LIST_FOREACH(remote_iter, remote_if, opal_if_t) {
OPAL_LIST_FOREACH(remote_iter, remote_ifs, opal_if_t) {
reachable_results->weights[i][j] = get_weights(local_iter, remote_iter);
j++;
}