From c9214cc53e2e6350616316ff33fd9ce608ecefc7 Mon Sep 17 00:00:00 2001 From: William Zhang Date: Thu, 11 Jul 2019 21:26:08 +0000 Subject: [PATCH 1/2] reachable: Change list name from *_if to *_ifs The parameter names were misleading due to implying a single interface instead of a list. This will provide more clarity in distinguishing the list of interfaces from each individual interface. Signed-off-by: William Zhang --- .../reachable/netlink/reachable_netlink_module.c | 12 ++++++------ opal/mca/reachable/reachable.h | 4 ++-- opal/mca/reachable/weighted/reachable_weighted.c | 16 ++++++++-------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/opal/mca/reachable/netlink/reachable_netlink_module.c b/opal/mca/reachable/netlink/reachable_netlink_module.c index 11ba4f4864..efb5ee6585 100644 --- a/opal/mca/reachable/netlink/reachable_netlink_module.c +++ b/opal/mca/reachable/netlink/reachable_netlink_module.c @@ -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++; } diff --git a/opal/mca/reachable/reachable.h b/opal/mca/reachable/reachable.h index 8f3a4659cb..e179abb329 100644 --- a/opal/mca/reachable/reachable.h +++ b/opal/mca/reachable/reachable.h @@ -68,8 +68,8 @@ typedef int (*opal_reachable_base_module_fini_fn_t)(void); * 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); /* diff --git a/opal/mca/reachable/weighted/reachable_weighted.c b/opal/mca/reachable/weighted/reachable_weighted.c index 512282a403..ff5c60548a 100644 --- a/opal/mca/reachable/weighted/reachable_weighted.c +++ b/opal/mca/reachable/weighted/reachable_weighted.c @@ -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++; } From c0c3e1b540c1a1c1165f5030d3098c950e7d263e Mon Sep 17 00:00:00 2001 From: William Zhang Date: Thu, 11 Jul 2019 21:21:22 +0000 Subject: [PATCH 2/2] reachable: Update documentation on reachable function Added information on the type of objects provided in the list as well as the required fields for them. Signed-off-by: William Zhang --- opal/mca/reachable/reachable.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/opal/mca/reachable/reachable.h b/opal/mca/reachable/reachable.h index e179abb329..5f6b193829 100644 --- a/opal/mca/reachable/reachable.h +++ b/opal/mca/reachable/reachable.h @@ -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,14 +58,24 @@ 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_ifs,