1
1

Add public functions for retrieving the MAC and MTU (paired with

r28344).

This commit was SVN r28345.

The following SVN revision numbers were found above:
  r28344 --> open-mpi/ompi@e88881c25f
Этот коммит содержится в:
Jeff Squyres 2013-04-17 22:32:32 +00:00
родитель e88881c25f
Коммит c722440411
2 изменённых файлов: 58 добавлений и 1 удалений

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

@ -10,7 +10,7 @@
* Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
* Copyright (c) 2010-2013 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -390,6 +390,46 @@ int opal_ifindextomask(int if_index, uint32_t* if_mask, int length)
return OPAL_ERROR;
}
/*
* Lookup the interface by opal_list index and return the
* MAC assigned to the interface.
*/
int btl_usnic_opal_ifindextomac(int if_index, uint8_t mac[6])
{
opal_if_t* intf;
for (intf = (opal_if_t*)opal_list_get_first(&opal_if_list);
intf != (opal_if_t*)opal_list_get_end(&opal_if_list);
intf = (opal_if_t*)opal_list_get_next(intf)) {
if (intf->if_index == if_index) {
memcpy(mac, &intf->if_mac, 6);
return OPAL_SUCCESS;
}
}
return OPAL_ERROR;
}
/*
* Lookup the interface by opal_list index and return the
* MTU assigned to the interface.
*/
int btl_usnic_opal_ifindextomtu(int if_index, int *if_mtu)
{
opal_if_t* intf;
for (intf = (opal_if_t*)opal_list_get_first(&opal_if_list);
intf != (opal_if_t*)opal_list_get_end(&opal_if_list);
intf = (opal_if_t*)opal_list_get_next(intf)) {
if (intf->if_index == if_index) {
*if_mtu = intf->if_mtu;
return OPAL_SUCCESS;
}
}
return OPAL_ERROR;
}
/*
* Lookup the interface by opal_list index and return the
* flags assigned to the interface.

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

@ -12,6 +12,7 @@
* Copyright (c) 2007 Los Alamos National Security, LLC. All rights
* reserved.
* Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved.
* Copyright (c) 2013 Cisco Systems, Inc. All rights reserved.
* $COPYRIGHT$
*
* Additional copyrights may follow
@ -154,6 +155,22 @@ OPAL_DECLSPEC int opal_ifindextoaddr(int if_index, struct sockaddr*,
*/
OPAL_DECLSPEC int opal_ifindextomask(int if_index, uint32_t*, int);
/**
* Lookup an interface by index and return its MAC address.
*
* @param if_index (IN) Interface index
* @param if_mac (OUT) Interface's MAC address
*/
OPAL_DECLSPEC int btl_usnic_opal_ifindextomac(int if_index, uint8_t if_mac[6]);
/**
* Lookup an interface by index and return its MTU.
*
* @param if_index (IN) Interface index
* @param if_mtu (OUT) Interface's MTU
*/
OPAL_DECLSPEC int btl_usnic_opal_ifindextomtu(int if_index, int *if_mtu);
/**
* Lookup an interface by index and return its flags.
*