Expand the "btl_usnic" MPI_T enumeration to have strings of the form:
<usnic device name>,<eth device>,<ip address>/<CIDR prefix> For example: usnic_0,eth4,10.1.0.15/16 This is just handy for mapping the usnic_X device back to the IP network to which it corresponds. This commit was SVN r29656.
Этот коммит содержится в:
родитель
71c8b471d0
Коммит
e20217eccc
@ -379,15 +379,29 @@ static void setup_mpit_pvars_enum(void)
|
||||
mca_base_var_enum_value_t *devices;
|
||||
static mca_base_var_enum_t *devices_enum;
|
||||
struct ibv_device *device;
|
||||
ompi_btl_usnic_module_t *m;
|
||||
unsigned char *c;
|
||||
|
||||
devices = calloc(mca_btl_usnic_component.num_modules + 1,
|
||||
sizeof(*devices));
|
||||
assert(devices != NULL);
|
||||
|
||||
for (i = 0; i < mca_btl_usnic_component.num_modules; ++i) {
|
||||
device = mca_btl_usnic_component.usnic_active_modules[i]->device;
|
||||
char *str;
|
||||
|
||||
m = mca_btl_usnic_component.usnic_active_modules[i];
|
||||
c = (unsigned char*) &m->if_ipv4_addr;
|
||||
|
||||
device = m->device;
|
||||
devices[i].value = i;
|
||||
devices[i].string = ibv_get_device_name(device);
|
||||
rc = asprintf(&str, "%s,%s,%u.%u.%u.%u/%d",
|
||||
ibv_get_device_name(device),
|
||||
m->if_name,
|
||||
c[0], c[1], c[2], c[3],
|
||||
m->if_cidrmask);
|
||||
assert(rc > 0);
|
||||
devices[i].string = str;
|
||||
opal_output(0, "Set string: %s", str);
|
||||
}
|
||||
devices[i].string = NULL;
|
||||
|
||||
@ -410,6 +424,14 @@ static void setup_mpit_pvars_enum(void)
|
||||
NULL /* context */);
|
||||
assert(rc >= 0);
|
||||
|
||||
/* Free the strings (mca_base_var_enum_create() strdup()'ed them
|
||||
into private storage, so we don't need them any more) */
|
||||
for (i = 0; i < mca_btl_usnic_component.num_modules; ++i) {
|
||||
m = mca_btl_usnic_component.usnic_active_modules[i];
|
||||
device = m->device;
|
||||
free((char*) devices[i].string);
|
||||
}
|
||||
|
||||
/* The devices_enum has been RETAIN'ed by the pvar, so we can
|
||||
RELEASE it here, and the enum will be destroyed when the pvar
|
||||
is destroyed. */
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user