Skip to content
Snippets Groups Projects
Commit 6bcfb041 authored by Danny Auble's avatar Danny Auble
Browse files

INFINIBAND - make it work correctly on old and new code.

parent 42370556
No related branches found
No related tags found
No related merge requests found
...@@ -33,10 +33,13 @@ AC_DEFUN([X_AC_OFED], ...@@ -33,10 +33,13 @@ AC_DEFUN([X_AC_OFED],
CPPFLAGS="-I$d/include $CPPFLAGS" CPPFLAGS="-I$d/include $CPPFLAGS"
_x_ac_ofed_libs_save="$LIBS" _x_ac_ofed_libs_save="$LIBS"
LIBS="-L$d/$bit -libmad -libumad $LIBS" LIBS="-L$d/$bit -libmad -libumad $LIBS"
AC_LINK_IFELSE(
AC_LINK_IFELSE( [AC_LANG_CALL([], mad_rpc_open_port)],
[AC_LANG_CALL([], mad_rpc_open_port)], AS_VAR_SET(x_ac_cv_ofed_dir, $d), [])
AS_VAR_SET(x_ac_cv_ofed_dir, $d), []) AC_LINK_IFELSE(
[AC_LANG_CALL([], pma_query_via)],
[have_pma_query_via=yes],
[AC_MSG_RESULT(Using old libmad)])
CPPFLAGS="$_x_ac_ofed_cppflags_save" CPPFLAGS="$_x_ac_ofed_cppflags_save"
LIBS="$_x_ac_ofed_libs_save" LIBS="$_x_ac_ofed_libs_save"
test -n "$x_ac_cv_ofed_dir" && break test -n "$x_ac_cv_ofed_dir" && break
...@@ -52,6 +55,9 @@ AS_VAR_SET(x_ac_cv_ofed_dir, $d), []) ...@@ -52,6 +55,9 @@ AS_VAR_SET(x_ac_cv_ofed_dir, $d), [])
OFED_LDFLAGS="-Wl,-rpath -Wl,$x_ac_cv_ofed_dir/$bit -L$x_ac_cv_ofed_dir/$bit" OFED_LDFLAGS="-Wl,-rpath -Wl,$x_ac_cv_ofed_dir/$bit -L$x_ac_cv_ofed_dir/$bit"
OFED_LIBS="-libmad -libumad" OFED_LIBS="-libmad -libumad"
AC_DEFINE(HAVE_OFED, 1, [Define to 1 if ofed library found]) AC_DEFINE(HAVE_OFED, 1, [Define to 1 if ofed library found])
if test ! -z "$have_pma_query_via" ; then
AC_DEFINE(HAVE_OFED_PMA_QUERY_VIA, 1, [Define to 1 if using code with pma_query_via])
fi
fi fi
AC_SUBST(OFED_LIBS) AC_SUBST(OFED_LIBS)
......
...@@ -191,6 +191,9 @@ ...@@ -191,6 +191,9 @@
/* Define to 1 if ofed library found */ /* Define to 1 if ofed library found */
#undef HAVE_OFED #undef HAVE_OFED
/* Define to 1 if using code with pma_query_via */
#undef HAVE_OFED_PMA_QUERY_VIA
/* define if you have openssl. */ /* define if you have openssl. */
#undef HAVE_OPENSSL #undef HAVE_OPENSSL
......
...@@ -19801,8 +19801,7 @@ else ...@@ -19801,8 +19801,7 @@ else
CPPFLAGS="-I$d/include $CPPFLAGS" CPPFLAGS="-I$d/include $CPPFLAGS"
_x_ac_ofed_libs_save="$LIBS" _x_ac_ofed_libs_save="$LIBS"
LIBS="-L$d/$bit -libmad -libumad $LIBS" LIBS="-L$d/$bit -libmad -libumad $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */ /* end confdefs.h. */
   
/* Override any GCC internal prototype to avoid an error. /* Override any GCC internal prototype to avoid an error.
...@@ -19823,6 +19822,32 @@ _ACEOF ...@@ -19823,6 +19822,32 @@ _ACEOF
if ac_fn_c_try_link "$LINENO"; then : if ac_fn_c_try_link "$LINENO"; then :
x_ac_cv_ofed_dir=$d x_ac_cv_ofed_dir=$d
fi fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply. */
#ifdef __cplusplus
extern "C"
#endif
char pma_query_via ();
int
main ()
{
return pma_query_via ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
have_pma_query_via=yes
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: Using old libmad" >&5
$as_echo "Using old libmad" >&6; }
fi
rm -f core conftest.err conftest.$ac_objext \ rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext conftest$ac_exeext conftest.$ac_ext
CPPFLAGS="$_x_ac_ofed_cppflags_save" CPPFLAGS="$_x_ac_ofed_cppflags_save"
...@@ -19846,6 +19871,11 @@ $as_echo "$as_me: WARNING: unable to locate ofed installation" >&2;} ...@@ -19846,6 +19871,11 @@ $as_echo "$as_me: WARNING: unable to locate ofed installation" >&2;}
   
$as_echo "#define HAVE_OFED 1" >>confdefs.h $as_echo "#define HAVE_OFED 1" >>confdefs.h
   
if test ! -z "$have_pma_query_via" ; then
$as_echo "#define HAVE_OFED_PMA_QUERY_VIA 1" >>confdefs.h
fi
fi fi
   
   
......
...@@ -148,6 +148,50 @@ static pthread_t thread_ofed_id_run = 0; ...@@ -148,6 +148,50 @@ static pthread_t thread_ofed_id_run = 0;
static pthread_t cleanup_handler_thread = 0; static pthread_t cleanup_handler_thread = 0;
static pthread_mutex_t ofed_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t ofed_lock = PTHREAD_MUTEX_INITIALIZER;
static uint8_t *_slurm_pma_query_via(void *rcvbuf, ib_portid_t * dest, int port,
unsigned timeout, unsigned id,
const struct ibmad_port *srcport)
{
#ifdef HAVE_OFED_PMA_QUERY_VIA
return pma_query_via(rcvbuf, dest, port, timeout, id, srcport);
#else
switch (id) {
case CLASS_PORT_INFO:
return perf_classportinfo_query_via(
pc, &portid, port, ibd_timeout, srcport);
break;
case IB_GSI_PORT_COUNTERS_EXT:
return port_performance_ext_query_via(
pc, &portid, port, ibd_timeout, srcport);
break;
default:
error("_slurm_pma_query_via: unhandled id");
}
return NULL;
#endif
}
static uint8_t *_slurm_performance_reset_via(void *rcvbuf, ib_portid_t * dest,
int port, unsigned mask,
unsigned timeout, unsigned id,
const struct ibmad_port *srcport)
{
#ifdef HAVE_OFED_PMA_QUERY_VIA
return performance_reset_via(
pc, &portid, port, mask, ibd_timeout, id, srcport);
#else
switch (id) {
case IB_GSI_PORT_COUNTERS_EXT:
return port_performance_ext_reset_via(
pc, &portid, port, mask, ibd_timeout, srcport);
break;
default:
error("_slurm_performance_reset_via: unhandled id");
}
return NULL;
#endif
}
static void _task_sleep(int rem) static void _task_sleep(int rem)
{ {
while (rem) while (rem)
...@@ -173,8 +217,8 @@ static int _read_ofed_values(void) ...@@ -173,8 +217,8 @@ static int _read_ofed_values(void)
memset(pc, 0, sizeof(pc)); memset(pc, 0, sizeof(pc));
memcpy(&cap_mask, pc + 2, sizeof(cap_mask)); memcpy(&cap_mask, pc + 2, sizeof(cap_mask));
if (!port_performance_ext_query_via(pc, &portid, port, ibd_timeout, if (!_slurm_pma_query_via(pc, &portid, port, ibd_timeout,
srcport)) { IB_GSI_PORT_COUNTERS_EXT, srcport)) {
error("ofed: %m"); error("ofed: %m");
exit(1); exit(1);
} }
...@@ -203,8 +247,10 @@ static int _read_ofed_values(void) ...@@ -203,8 +247,10 @@ static int _read_ofed_values(void)
if (send_val > reset_limit || recv_val > reset_limit) { if (send_val > reset_limit || recv_val > reset_limit) {
/* reset cost ~70 mirco secs */ /* reset cost ~70 mirco secs */
if (!port_performance_ext_reset_via(pc, &portid, port, mask, if (!_slurm_performance_reset_via(pc, &portid, port, mask,
ibd_timeout, srcport)) { ibd_timeout,
IB_GSI_PORT_COUNTERS_EXT,
srcport)) {
error("perf reset\n"); error("perf reset\n");
exit(1); exit(1);
} }
...@@ -282,20 +328,22 @@ static int _thread_init(void) ...@@ -282,20 +328,22 @@ static int _thread_init(void)
error("can't resolve self port %d", port); error("can't resolve self port %d", port);
memset(pc, 0, sizeof(pc)); memset(pc, 0, sizeof(pc));
if (!perf_classportinfo_query_via(pc, &portid, port, ibd_timeout, if (!_slurm_pma_query_via(pc, &portid, port, ibd_timeout,
srcport)) CLASS_PORT_INFO, srcport))
error("classportinfo query\n"); error("classportinfo query\n");
memcpy(&cap_mask, pc + 2, sizeof(cap_mask)); memcpy(&cap_mask, pc + 2, sizeof(cap_mask));
if (!port_performance_ext_query_via(pc, &portid, port, ibd_timeout, if (!_slurm_pma_query_via(pc, &portid, port, ibd_timeout,
srcport)) { IB_GSI_PORT_COUNTERS_EXT, srcport)) {
error("ofed\n"); error("ofed\n");
exit(1); exit(1);
} }
/* reset cost ~70 mirco secs */ /* reset cost ~70 mirco secs */
if (!port_performance_ext_reset_via(pc, &portid, port, mask, if (!_slurm_performance_reset_via(pc, &portid, port, mask,
ibd_timeout, srcport)) { ibd_timeout,
IB_GSI_PORT_COUNTERS_EXT,
srcport)) {
error("perf reset\n"); error("perf reset\n");
exit(1); exit(1);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment