2013-07-20 02:13:58 +04:00
|
|
|
/*
|
2014-01-08 20:57:14 +04:00
|
|
|
* Copyright (c) 2013-2014 Cisco Systems, Inc. All rights reserved.
|
2013-07-20 02:13:58 +04:00
|
|
|
* $COPYRIGHT$
|
|
|
|
*
|
|
|
|
* Additional copyrights may follow
|
|
|
|
*
|
|
|
|
* $HEADER$
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef BTL_USNIC_UTIL_H
|
|
|
|
#define BTL_USNIC_UTIL_H
|
|
|
|
|
2013-11-05 02:52:03 +04:00
|
|
|
#include "opal/datatype/opal_convertor.h"
|
|
|
|
|
2013-07-20 02:13:58 +04:00
|
|
|
#include "btl_usnic.h"
|
|
|
|
|
2014-02-26 11:50:26 +04:00
|
|
|
#ifndef MIN
|
|
|
|
# define MIN(a,b) ((a) < (b) ? (a) : (b))
|
|
|
|
#endif
|
|
|
|
|
2013-12-20 21:37:22 +04:00
|
|
|
/* avoid "defined but not used" warnings */
|
2014-01-08 20:57:14 +04:00
|
|
|
static inline int __opal_attribute_always_inline__ usnic_fls(int x)
|
2013-12-20 21:37:22 +04:00
|
|
|
__opal_attribute_unused__;
|
|
|
|
|
2014-01-08 20:57:14 +04:00
|
|
|
static inline int __opal_attribute_always_inline__ usnic_fls(int x)
|
2013-07-20 02:13:58 +04:00
|
|
|
{
|
|
|
|
int r = 32;
|
|
|
|
|
2014-01-08 20:57:14 +04:00
|
|
|
if (!x) {
|
2013-07-20 02:13:58 +04:00
|
|
|
return 0;
|
2014-01-08 20:57:14 +04:00
|
|
|
}
|
2013-07-20 02:13:58 +04:00
|
|
|
if (!(x & 0xffff0000u)) {
|
|
|
|
x <<= 16;
|
|
|
|
r -= 16;
|
|
|
|
}
|
|
|
|
if (!(x & 0xff000000u)) {
|
|
|
|
x <<= 8;
|
|
|
|
r -= 8;
|
|
|
|
}
|
|
|
|
if (!(x & 0xf0000000u)) {
|
|
|
|
x <<= 4;
|
|
|
|
r -= 4;
|
|
|
|
}
|
|
|
|
if (!(x & 0xc0000000u)) {
|
|
|
|
x <<= 2;
|
|
|
|
r -= 2;
|
|
|
|
}
|
|
|
|
if (!(x & 0x80000000u)) {
|
|
|
|
r -= 1;
|
|
|
|
}
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
2013-11-05 02:52:03 +04:00
|
|
|
/* a helper function that just declutters convertor packing */
|
2014-01-08 20:57:14 +04:00
|
|
|
static inline void
|
2013-11-05 02:52:03 +04:00
|
|
|
usnic_convertor_pack_simple(
|
|
|
|
opal_convertor_t *convertor,
|
|
|
|
void *dest,
|
|
|
|
size_t max_bytes_to_pack,
|
|
|
|
size_t *bytes_packed)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
struct iovec iov;
|
|
|
|
uint32_t iov_count;
|
|
|
|
|
|
|
|
iov.iov_base = (IOVBASE_TYPE*)dest;
|
|
|
|
iov.iov_len = max_bytes_to_pack;
|
|
|
|
iov_count = 1;
|
|
|
|
*bytes_packed = max_bytes_to_pack;
|
|
|
|
rc = opal_convertor_pack(convertor, &iov, &iov_count, bytes_packed);
|
|
|
|
if (OPAL_UNLIKELY(rc < 0)) {
|
|
|
|
BTL_ERROR(("opal_convertor_pack error"));
|
|
|
|
abort(); /* XXX */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-12-03 00:09:46 +03:00
|
|
|
static inline int
|
|
|
|
usnic_netmask_to_cidrlen(
|
|
|
|
uint32_t netmask_be)
|
|
|
|
{
|
|
|
|
return 33 - ffs(ntohl(netmask_be));
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline uint32_t
|
|
|
|
usnic_cidrlen_to_netmask(
|
|
|
|
int cidrlen)
|
|
|
|
{
|
|
|
|
uint32_t mask;
|
|
|
|
|
|
|
|
mask = ~0 << (32 - cidrlen);
|
|
|
|
return htonl(mask);
|
|
|
|
}
|
|
|
|
|
2013-07-20 02:13:58 +04:00
|
|
|
/*
|
|
|
|
* Safely (but abnornmally) exit this process without abort()'ing (and
|
|
|
|
* leaving a corefile).
|
|
|
|
*/
|
2014-12-03 00:09:46 +03:00
|
|
|
struct opal_btl_usnic_module_t;
|
|
|
|
void opal_btl_usnic_exit(struct opal_btl_usnic_module_t *module);
|
2013-07-20 02:13:58 +04:00
|
|
|
|
2014-06-18 19:19:36 +04:00
|
|
|
/*
|
2014-12-03 00:09:46 +03:00
|
|
|
* Print a show_help message and then call opal_btl_usnic_exit().
|
2014-06-18 19:19:36 +04:00
|
|
|
*/
|
2014-12-03 00:09:46 +03:00
|
|
|
void opal_btl_usnic_util_abort(const char *msg, const char *file, int line);
|
2014-06-18 19:19:36 +04:00
|
|
|
|
|
|
|
/*
|
2014-12-03 00:09:46 +03:00
|
|
|
* Long enough to hold "xxx.xxx.xxx.xxx/xx"
|
2014-06-18 19:19:36 +04:00
|
|
|
*/
|
2014-12-03 00:09:46 +03:00
|
|
|
#define IPV4STRADDRLEN 20
|
2014-06-18 19:19:36 +04:00
|
|
|
|
2014-02-27 02:21:25 +04:00
|
|
|
/*
|
2014-12-03 00:09:46 +03:00
|
|
|
* If netmask==0, it is not included in the output string. addr is
|
2014-02-27 02:21:25 +04:00
|
|
|
* expected to be in network byte order.
|
|
|
|
*/
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
|
|
|
void opal_btl_usnic_snprintf_ipv4_addr(char *out, size_t maxlen,
|
2014-12-03 00:09:46 +03:00
|
|
|
uint32_t addr, uint32_t netmask);
|
2013-07-20 02:13:58 +04:00
|
|
|
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
|
|
|
void opal_btl_usnic_snprintf_bool_array(char *s, size_t slen, bool a[], size_t alen);
|
2013-10-23 19:51:11 +04:00
|
|
|
|
2014-12-03 00:09:46 +03:00
|
|
|
void opal_btl_usnic_dump_hex(void *vaddr, int len);
|
2013-07-20 02:13:58 +04:00
|
|
|
|
George did the work and deserves all the credit for it. Ralph did the merge, and deserves whatever blame results from errors in it :-)
WHAT: Open our low-level communication infrastructure by moving all necessary components (btl/rcache/allocator/mpool) down in OPAL
All the components required for inter-process communications are currently deeply integrated in the OMPI layer. Several groups/institutions have express interest in having a more generic communication infrastructure, without all the OMPI layer dependencies. This communication layer should be made available at a different software level, available to all layers in the Open MPI software stack. As an example, our ORTE layer could replace the current OOB and instead use the BTL directly, gaining access to more reactive network interfaces than TCP. Similarly, external software libraries could take advantage of our highly optimized AM (active message) communication layer for their own purpose. UTK with support from Sandia, developped a version of Open MPI where the entire communication infrastucture has been moved down to OPAL (btl/rcache/allocator/mpool). Most of the moved components have been updated to match the new schema, with few exceptions (mainly BTLs where I have no way of compiling/testing them). Thus, the completion of this RFC is tied to being able to completing this move for all BTLs. For this we need help from the rest of the Open MPI community, especially those supporting some of the BTLs. A non-exhaustive list of BTLs that qualify here is: mx, portals4, scif, udapl, ugni, usnic.
This commit was SVN r32317.
2014-07-26 04:47:28 +04:00
|
|
|
size_t opal_btl_usnic_convertor_pack_peek(const opal_convertor_t *conv,
|
2013-11-05 02:52:03 +04:00
|
|
|
size_t max_len);
|
|
|
|
|
2013-07-20 02:13:58 +04:00
|
|
|
#endif /* BTL_USNIC_UTIL_H */
|