From 91b26eba67c4152afaca03e7e90b689ca2e27fdb Mon Sep 17 00:00:00 2001 From: Jon Mason Date: Tue, 2 Dec 2008 22:42:01 +0000 Subject: [PATCH] This commit adds comments regarding IP Aliases and the default behavior when determining which IP address to use when transmitting data. Also it adds logic to prevent usage of more than one of the btl_openib_if_include, btl_openib_if_exclude, btl_openib_ipaddr_include, or btl_openib_ipaddr_exclude MCA parameters. This should complete the code modifications needed for ticket 1665. This commit was SVN r20052. --- ompi/mca/btl/openib/btl_openib_component.c | 18 ++++++++++++++--- ompi/mca/btl/openib/btl_openib_iwarp.c | 20 ++++++++++++++++++- .../connect/btl_openib_connect_rdmacm.c | 9 ++++++++- ompi/mca/btl/openib/help-mpi-btl-openib.txt | 9 ++++++--- 4 files changed, 48 insertions(+), 8 deletions(-) diff --git a/ompi/mca/btl/openib/btl_openib_component.c b/ompi/mca/btl/openib/btl_openib_component.c index 23120a5e6f..95994aa20d 100644 --- a/ompi/mca/btl/openib/btl_openib_component.c +++ b/ompi/mca/btl/openib/btl_openib_component.c @@ -2029,6 +2029,7 @@ btl_openib_component_init(int *num_btl_modules, int index, value; bool found; mca_base_param_source_t source; + int list_count = 0; /* initialization */ *num_btl_modules = 0; @@ -2208,12 +2209,23 @@ btl_openib_component_init(int *num_btl_modules, mca_btl_openib_component.if_include_list = mca_btl_openib_component.if_exclude_list = mca_btl_openib_component.if_list = NULL; - if (NULL != mca_btl_openib_component.if_include && - NULL != mca_btl_openib_component.if_exclude) { + + if (NULL != mca_btl_openib_component.if_include) + list_count++; + if (NULL != mca_btl_openib_component.if_exclude) + list_count++; + if (NULL != mca_btl_openib_component.ipaddr_include) + list_count++; + if (NULL != mca_btl_openib_component.ipaddr_exclude) + list_count++; + + if (list_count > 1) { orte_show_help("help-mpi-btl-openib.txt", "specified include and exclude", true, mca_btl_openib_component.if_include, - mca_btl_openib_component.if_exclude, NULL); + mca_btl_openib_component.if_exclude, + mca_btl_openib_component.ipaddr_include, + mca_btl_openib_component.ipaddr_exclude, NULL); goto no_btls; } else if (NULL != mca_btl_openib_component.if_include) { mca_btl_openib_component.if_include_list = diff --git a/ompi/mca/btl/openib/btl_openib_iwarp.c b/ompi/mca/btl/openib/btl_openib_iwarp.c index 965a46b494..8af83f92f7 100644 --- a/ompi/mca/btl/openib/btl_openib_iwarp.c +++ b/ompi/mca/btl/openib/btl_openib_iwarp.c @@ -68,6 +68,18 @@ static char *stringify(uint32_t addr) } #endif +/* Note that each device port can have multiple IP addresses associated with it + * (aka IP aliasing). However, the openib module only knows about (device,port) + * tuples -- not IP addresses (only the RDMA CM CPC knows which IP addresses are + * associated with each (device,port) tuple). Thus, any searching of device + * list for the IP Address or subnets may not work as one might expect. The + * current behavior is to return the IP address (or subnet) of the *first* + * instance of the device on the list. This behavior is uniform for subnet and + * IP addresses and thus should not cause any mismatches. If this behavior is + * not preferred by the user, the MCA parameters to include/exclude specific IP + * addresses can be used to precisely specify which addresses are used (e.g., to + * effect specific subnet routing). + */ uint64_t mca_btl_openib_get_iwarp_subnet_id(struct ibv_device *ib_dev) { opal_list_item_t *item; @@ -93,6 +105,13 @@ uint64_t mca_btl_openib_get_iwarp_subnet_id(struct ibv_device *ib_dev) return 0; } +/* This function should not be necessary, as rdma_get_local_addr would be more + * correct in returning the IP address given the cm_id (and not necessitate + * having to do a list look up). Unfortunately, the subnet and IP address look + * up needs to match or there could be a mismatch if IP Aliases are being used. + * For more information on this, please read comment above + * mca_btl_openib_get_iwarp_subnet_id. + */ uint32_t mca_btl_openib_rdma_get_ipv4addr(struct ibv_context *verbs, uint8_t port) { @@ -157,7 +176,6 @@ static int dev_specified(char *name, int port) static int ipaddr_specified(struct sockaddr_in *ipaddr, uint32_t netmask) { - if (NULL != mca_btl_openib_component.ipaddr_include) { char **list; int i; diff --git a/ompi/mca/btl/openib/connect/btl_openib_connect_rdmacm.c b/ompi/mca/btl/openib/connect/btl_openib_connect_rdmacm.c index 602faaaaef..e511449a41 100644 --- a/ompi/mca/btl/openib/connect/btl_openib_connect_rdmacm.c +++ b/ompi/mca/btl/openib/connect/btl_openib_connect_rdmacm.c @@ -1601,7 +1601,14 @@ static int ipaddrcheck(id_context_t *context, int server_tcp_port = rdma_get_src_port(context->id); char *str; - /* Look up the IP address of this device/port */ + /* Look up the IP address of this device/port. This call should not be + * necessary, as rdma_get_local_addr would be more correct in returning the + * IP address given the cm_id (and not necessitate having to do a list look + * up). Unfortunately, the subnet and IP address look up needs to match or + * there could be a mismatch if IP Aliases are being used. For more + * information on this, please read comment above + * mca_btl_openib_get_iwarp_subnet_id in btl_openib_iwarp.c + */ ipaddr = mca_btl_openib_rdma_get_ipv4addr(openib_btl->device->ib_dev_context, openib_btl->port_num); diff --git a/ompi/mca/btl/openib/help-mpi-btl-openib.txt b/ompi/mca/btl/openib/help-mpi-btl-openib.txt index fc0cc04f4d..3e8a477df6 100644 --- a/ompi/mca/btl/openib/help-mpi-btl-openib.txt +++ b/ompi/mca/btl/openib/help-mpi-btl-openib.txt @@ -300,14 +300,17 @@ recompiling Open MPI against your OpenFabrics library installation to get more information. # [specified include and exclude] -ERROR: You have specified both the btl_openib_if_include and -btl_openib_if_exclude MCA parameters. These two parameters are -mutually exclusive; you can only specify one or the other. +ERROR: You have specified more than one of the btl_openib_if_include, +btl_openib_if_exclude, btl_openib_ipaddr_include, or btl_openib_ipaddr_exclude +MCA parameters. These four parameters are mutually exclusive; you can only +specify one. For reference, the values that you specified are: btl_openib_if_include: %s btl_openib_if_exclude: %s + btl_openib_ipaddr_include: %s + btl_openib_ipaddr_exclude: %s # [nonexistent port] WARNING: One or more nonexistent OpenFabrics devices/ports were