diff -Nru infiniband-diags-1.6.5/ChangeLog infiniband-diags-1.6.6/ChangeLog --- infiniband-diags-1.6.5/ChangeLog 2015-02-10 23:47:58.000000000 +0000 +++ infiniband-diags-1.6.6/ChangeLog 2015-10-13 03:54:39.000000000 +0000 @@ -1,6 +1,126 @@ ** Version: HEAD +Mon Oct 12 23:27:34 2015 -0400 Ira Weiny +275cc40ec83956755356eae55ee64dbf85699aec + + * update README/configure.ac for 1.6.6 + +Wed Sep 30 08:53:51 2015 -0400 Dan Ben Yosef +d64fcf4a3d0ae20fbf497b5605cb8071e334069d + + * libibnetdisc: Avoid pushing same pointer to the hash table + +Mon Oct 12 08:30:31 2015 -0400 Hal Rosenstock +bcdc2151bad1db24e7d96ac896d57a65c7f40cfc + + * perfquery.c: Fix smp_query_via return value checks + +Mon Oct 12 08:31:23 2015 -0400 Hal Rosenstock +0cd6d05da6a6d3b679535c38a64c9600378de076 + + * ibdiag_common.c: Move static to beginning of get_build_version declaration + +Thu Sep 10 19:26:08 2015 -0400 Ira Weiny +14f19aae87a59ef0df30585a7b0c3f6bea7eb274 + + * infiniband-diags: rdma-ndd: remove udev logging when not supported + +Mon Aug 31 10:49:04 2015 +0300 Dan Ben Yosef +3f1aed48b0fc27df9615d89399edd0ac623b2017 + + * perfquery -T (print Extended Speed Counters) times out on nodes supporting RS_FEC capability. + +Wed Sep 9 14:29:38 2015 +0300 Vladimir Koushnir +1a1565006b2a2996fcac4a117d7ffc9ebc3a1b7d + + * saquery.c: Fix saquery -D option + +Wed Jul 22 16:14:03 2015 +0200 Ana Guerrero López +552063e080c6dde686f961238e019172b3823a42 + + * rdma-ndd: fix compiler warnings. + +Wed Jul 15 14:08:49 2015 -0400 Hal Rosenstock +5de1f6de8825ba70d8553be957416ab271716379 + + * iblinkinfo.c: Close additional file descriptor in advance + +Thu Apr 16 18:27:39 2015 +0300 Vladimir Koushnir +9912de3d9dbdd31e67f736ea378d429429a81128 + + * vendstat: mad_rpc_close_port not called in corner cases + +Thu Jun 25 16:12:02 2015 +0200 Michal Schmidt +efecdfb8219ad3234ea61a349a2f7a28cee76439 + + * build-sys: avoid overlinking to libudev + +Thu Jun 25 16:12:01 2015 +0200 Michal Schmidt +01071153c35f18f93b6b19075ffcbc5a7290eaf2 + + * rdma-ndd: never use udev_get_sys_path() + +Thu May 7 13:54:52 2015 +0300 Hal Rosenstock +4989004236cb59d281c743a4b91275ef555951d8 + + * ibdiag_sa.c: In sa_get_handle, handle umad_open_port and umad_register failures + +Sun Apr 26 18:26:16 2015 +0300 Vladimir Koushnir +f68d857412a4499cdc42ddec1059388d7a94e25d + + * ibqueryerrors: improve code related to DR option + +Sun Apr 26 12:24:06 2015 +0300 Vladimir Koushnir +13e9d76a6af2e66186bd8aa77eab8f811decaee7 + + * ibqueryerrors: Close global file descriptor before running ibnd_discover_fabric + +Tue Apr 21 17:12:05 2015 +0300 Vladimir Koushnir +ae4e036450fafaafcf9abee7d2f74bfabd7d5f4a + + * ibqueryerrors: Fix crash when no SM is running + +Sun Apr 26 18:29:31 2015 +0300 Vladimir Koushnir +35c85ad05cff4ca7bc5875320a7a7296cbb16608 + + * ibqueryerrors: code improvement + +Thu Apr 16 16:56:40 2015 +0300 Vladimir Koushnir +f427cf58892426d1d9159019b42af94c48d06feb + + * dump_fts: Open global file descriptor after calling ibnd_discover_fabric + +Thu Apr 16 14:11:16 2015 +0300 Vladimir Koushnir +2a8621e70417c2f45e40acefe5ff96d8d85996f3 + + * query_smp.c: Avoid busy looping in process_one_recv + +Wed Apr 8 12:29:44 2015 +0300 Vladimir Koushnir +ad743ff6c6e2befa71801bc76bdc5d08d8f41131 + + * Remove redundant umad file descriptor from libibnetdisc + +Thu Apr 16 16:39:43 2015 +0300 Vladimir Koushnir +4e6bc81500fecbdece3c16862252a83cdeed3282 + + * ibqueryerrors: Resource leak in path_record_query + +Thu May 1 10:22:00 2014 -0400 Hal Rosenstock +1f4e356a5d156cd85d69f3b064bb1b7692778853 + + * perfquery.c: Change format of capability mask in IBWARN for consistency + +Wed Mar 11 01:41:35 2015 -0400 Ira Weiny +211eccc0447f4259cbdf9579786865ee8e3657ff + + * infiniband-diags/rdma-ndd: add --pidfile option + +Wed Mar 11 01:28:42 2015 -0400 Ira Weiny +62cbfb4ceb41884cd3563b700af7d46fb99572aa + + * infiniband-diags/rdma-ndd: Fix issues with install + Tue Feb 10 18:45:17 2015 -0500 Ira Weiny d5b64231f5c78296bb73724192863f3efe26cefe @@ -3324,6 +3444,118 @@ * infiniband-diags/Makefile.am: fix location of ibdiag_version.h +** Version: 1.6.5 + +Tue Feb 10 18:45:17 2015 -0500 Ira Weiny +d5b64231f5c78296bb73724192863f3efe26cefe + + * update README for 1.6.5 + +Wed Jan 28 17:58:29 2015 -0500 Dan Ben Yosef +9d3fcc8179850cf8c86da1567764b6b4762c27a9 + + * ibtracert.c: Remove checking the port 0 state for base switch port 0 + +Thu Feb 5 07:19:15 2015 -0500 Dan Ben Yosef +03d75bf07463a9f155ef41a5138d3f159d875e08 + + * Add new configure flag to enable/disable the rdma-ndd build + +Wed Jan 28 16:54:07 2015 -0500 Hal Rosenstock +10f9628178378fa92d20379d22fb4d93044f06dd + + * Align infiniband-diags MLNX device IDs with OpenSM + +Wed Jan 28 11:45:15 2015 -0500 Ira Weiny +b0a54c1a03d55fb530dd188b6c0e1b5339756c8c + + * infiniband-diags: update for udev changes. + +Wed Jan 28 11:23:53 2015 -0500 Ira Weiny +109b79f9c90fc6a6c573ba91076fa547be6faf60 + + * infiniband-diags/test-code: remove unused variables + +Wed Jan 14 09:07:10 2015 -0500 Hal Rosenstock +8c0ec71b83c532a2b7c8d24455798e56b267539f + + * vendstat.c: Add additional vendor IDs to ext_fw_info_device + +Wed Jan 14 09:07:03 2015 -0500 Hal Rosenstock +4b47135d15cec632ebbec28b61a526600e79dfc9 + + * ibnetdisc.c: Add additional supported device IDs to is_mlnx_ext_port_info_supported + +Wed Jan 14 09:06:54 2015 -0500 Hal Rosenstock +24c62b083d4f2dbff45a996f472e5ad74db20b5c + + * ibdiag_common.c: Add more supported device IDs in is_mlnx_ext_port_info_supported + +Fri Oct 24 19:57:38 2014 -0400 Ira Weiny +ae505415dabc34caba7e82ed93950823baf1f747 + + * infiniband-diags: add rdma-ndd daemon + +Fri Jan 9 10:17:36 2015 -0500 Hal Rosenstock +18f1a0f973cc5cff7328e4576149b26334441c15 + + * ibccconfig.c: Account for enhanced switch port 0 in SwitchPortCongestionSetting handling + +Fri Jan 9 10:17:30 2015 -0500 Hal Rosenstock +202382751b5ac01e32573c5ed122214ee0fa9295 + + * ibccquery.c: Account for enhanced switch port 0 in SwitchPortCongestionSetting handling + +Tue Nov 18 12:35:04 2014 -0500 Ira Weiny +0e96e79cfe01b82ab1b7e987a0148738d1fe9dfd + + * infiniband-diags: update smpquery man page + +Mon Nov 17 16:57:29 2014 +0200 Dan Ben Yosef +6393c5f7bf32cdf77c679a9abd9be577f9620b65 + + * New MAD SM:PortInfoExtended and changing PM:PortExtendedSpeedsCounters + +Wed Nov 5 15:22:05 2014 -0500 Hal Rosenstock +34a5d92f9387ce8d59b19f449e5095ab0fe11f34 + + * saquery.c: Return proper status from query_sa_cpi on bad result status + +Wed Nov 5 15:21:55 2014 -0500 Hal Rosenstock +0741d402601c6636e6e3a1f63016b7c860c29044 + + * saquery.c: Fix handling of cpi and ClassPortInfo options + +Fri Oct 17 17:09:54 2014 -0400 Hal Rosenstock +c7643611e3b0a05df79fc3126b34bed99aff3849 + + * ibping.c: Fix support of OUIs other than IB_OPENIB_OUI + +Tue Jun 10 14:23:13 2014 -0400 Hal Rosenstock +17a8d6db8cee297b9b66b91f36e20c8413b5aa8b + + * ibportstate.c: Cosmetic changes to MLNX Extended PortInfo + +Sat Apr 19 15:14:08 2014 -0700 Ira Weiny +6364d06406a95d1fed2397691ddd012493b0bdf6 + + * infiniband-diags: If rst2man is available fix missing source dir in configure + +Mon Mar 31 10:03:19 2014 +0300 Dan Ben Yosef +4549d891c11458b299e94751ef62d9f076dc5b49 + + * Fix missing source dir in configure.ac + +Wed Feb 26 10:25:43 2014 -0500 Hal Rosenstock +018c7f43f03a20b45bb4cecfa23063bbf37ae7f4 + + * saquery.c: In query_sa_cpi, make error message consistent + +Wed Feb 26 10:25:06 2014 -0500 Hal Rosenstock +b3d11492b5633b214e1843bf46a03f1a6c1288c9 + + * saquery.c: In print_node_record, change LID print format + ** Version: 1.6.4 Sat Jan 25 22:10:28 2014 -0800 Ira Weiny diff -Nru infiniband-diags-1.6.5/config.h.in infiniband-diags-1.6.6/config.h.in --- infiniband-diags-1.6.5/config.h.in 2015-02-10 23:47:51.000000000 +0000 +++ infiniband-diags-1.6.6/config.h.in 2015-10-13 03:31:05.000000000 +0000 @@ -24,9 +24,6 @@ /* Define to 1 if you have the `osmcomp' library (-losmcomp). */ #undef HAVE_LIBOSMCOMP -/* Define to 1 if you have the `udev' library (-ludev). */ -#undef HAVE_LIBUDEV - /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H @@ -72,8 +69,8 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H -/* Define to 1 if you have the `udev_get_sys_path' function. */ -#undef HAVE_UDEV_GET_SYS_PATH +/* whether libudev logging can be used */ +#undef HAVE_UDEV_LOGGING /* Define to 1 if struct umad_port has link_layer member */ #undef HAVE_UMAD_PORT_LINK_LAYER diff -Nru infiniband-diags-1.6.5/configure infiniband-diags-1.6.6/configure --- infiniband-diags-1.6.5/configure 2015-02-10 23:47:51.000000000 +0000 +++ infiniband-diags-1.6.6/configure 2015-10-13 03:30:57.000000000 +0000 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for infiniband-diags 1.6.5. +# Generated by GNU Autoconf 2.69 for infiniband-diags 1.6.6. # # Report bugs to . # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='infiniband-diags' PACKAGE_TARNAME='infiniband-diags' -PACKAGE_VERSION='1.6.5' -PACKAGE_STRING='infiniband-diags 1.6.5' +PACKAGE_VERSION='1.6.6' +PACKAGE_STRING='infiniband-diags 1.6.6' PACKAGE_BUGREPORT='linux-rdma@vger.kernel.org' PACKAGE_URL='' @@ -631,12 +631,13 @@ # include #endif" -ac_func_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS have_rst2man BUILD_DATE +UDEV_LIBS +UDEV_CFLAGS DEFAULT_STOP DEFAULT_START RDMA_SERVICE @@ -814,7 +815,9 @@ PKG_CONFIG_PATH PKG_CONFIG_LIBDIR GLIB_CFLAGS -GLIB_LIBS' +GLIB_LIBS +UDEV_CFLAGS +UDEV_LIBS' # Initialize some variables set by options. @@ -1355,7 +1358,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures infiniband-diags 1.6.5 to adapt to many kinds of systems. +\`configure' configures infiniband-diags 1.6.6 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1426,7 +1429,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of infiniband-diags 1.6.5:";; + short | recursive ) echo "Configuration of infiniband-diags 1.6.6:";; esac cat <<\_ACEOF @@ -1484,6 +1487,8 @@ path overriding pkg-config's built-in search path GLIB_CFLAGS C compiler flags for GLIB, overriding pkg-config GLIB_LIBS linker flags for GLIB, overriding pkg-config + UDEV_CFLAGS C compiler flags for UDEV, overriding pkg-config + UDEV_LIBS linker flags for UDEV, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -1551,7 +1556,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -infiniband-diags configure 1.6.5 +infiniband-diags configure 1.6.6 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1977,7 +1982,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by infiniband-diags $as_me 1.6.5, which was +It was created by infiniband-diags $as_me 1.6.6, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2257,7 +2262,6 @@ >$cache_file fi -as_fn_append ac_func_list " udev_get_sys_path" # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false @@ -2844,7 +2848,7 @@ # Define the identity of the package. PACKAGE='infiniband-diags' - VERSION='1.6.5' + VERSION='1.6.6' cat >>confdefs.h <<_ACEOF @@ -12605,81 +12609,122 @@ DEFAULT_STOP=$default_stop -if test x$rdmandd = xyes; then - ac_fn_c_check_header_mongrel "$LINENO" "libudev.h" "ac_cv_header_libudev_h" "$ac_includes_default" -if test "x$ac_cv_header_libudev_h" = xyes; then : - with_udev="yes" -else - with_udev="no" -fi +if test x$rdmandd = xyes; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for udev_monitor_ref in -ludev" >&5 -$as_echo_n "checking for udev_monitor_ref in -ludev... " >&6; } -if ${ac_cv_lib_udev_udev_monitor_ref+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ludev $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ +pkg_failed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for UDEV" >&5 +$as_echo_n "checking for UDEV... " >&6; } -/* 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 udev_monitor_ref (); -int -main () -{ -return udev_monitor_ref (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_udev_udev_monitor_ref=yes +if test -n "$UDEV_CFLAGS"; then + pkg_cv_UDEV_CFLAGS="$UDEV_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libudev\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libudev") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_UDEV_CFLAGS=`$PKG_CONFIG --cflags "libudev" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes else - ac_cv_lib_udev_udev_monitor_ref=no + pkg_failed=yes fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + else + pkg_failed=untried +fi +if test -n "$UDEV_LIBS"; then + pkg_cv_UDEV_LIBS="$UDEV_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libudev\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libudev") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_UDEV_LIBS=`$PKG_CONFIG --libs "libudev" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_udev_udev_monitor_ref" >&5 -$as_echo "$ac_cv_lib_udev_udev_monitor_ref" >&6; } -if test "x$ac_cv_lib_udev_udev_monitor_ref" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBUDEV 1 -_ACEOF - LIBS="-ludev $LIBS" + +if test $pkg_failed = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes else - as_fn_error $? "libudev is required for rdma-ndd..." "$LINENO" 5 + _pkg_short_errors_supported=no fi + if test $_pkg_short_errors_supported = yes; then + UDEV_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libudev" 2>&1` + else + UDEV_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libudev" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$UDEV_PKG_ERRORS" >&5 - ac_config_files="$ac_config_files doc/man/rdma-ndd.8 etc/rdma-ndd.init" + as_fn_error $? "Package requirements (libudev) were not met: +$UDEV_PKG_ERRORS +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. +Alternatively, you may set the environment variables UDEV_CFLAGS +and UDEV_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details." "$LINENO" 5 +elif test $pkg_failed = untried; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables UDEV_CFLAGS +and UDEV_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. - for ac_func in $ac_func_list -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF +To get pkg-config, see . +See \`config.log' for more details" "$LINENO" 5; } +else + UDEV_CFLAGS=$pkg_cv_UDEV_CFLAGS + UDEV_LIBS=$pkg_cv_UDEV_LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } fi -done + ac_config_files="$ac_config_files doc/man/rdma-ndd.8 etc/rdma-ndd.init" + if test "$with_udev" = "yes"; then + if test -n "$PKG_CONFIG" && \ + { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libudev >= 218\""; } >&5 + ($PKG_CONFIG --exists --print-errors "libudev >= 218") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + with_dev_logging=no +else + with_udev_logging=yes +fi + if test "$with_udev_logging" = "yes"; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_UDEV_LOGGING 1 +_ACEOF + + fi + fi fi @@ -13331,7 +13376,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by infiniband-diags $as_me 1.6.5, which was +This file was extended by infiniband-diags $as_me 1.6.6, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13397,7 +13442,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -infiniband-diags config.status 1.6.5 +infiniband-diags config.status 1.6.6 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -Nru infiniband-diags-1.6.5/configure.ac infiniband-diags-1.6.6/configure.ac --- infiniband-diags-1.6.5/configure.ac 2015-02-10 23:45:32.000000000 +0000 +++ infiniband-diags-1.6.6/configure.ac 2015-10-13 03:28:23.000000000 +0000 @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.57) -AC_INIT(infiniband-diags, 1.6.5, linux-rdma@vger.kernel.org) +AC_INIT(infiniband-diags, 1.6.6, linux-rdma@vger.kernel.org) AC_CONFIG_AUX_DIR(config) AC_CONFIG_MACRO_DIR(config) AM_CONFIG_HEADER(config.h) @@ -210,12 +210,20 @@ AC_SUBST(DEFAULT_START, $default_start) AC_SUBST(DEFAULT_STOP, $default_stop) -if test x$rdmandd = xyes; then - AC_CHECK_HEADER(libudev.h, with_udev="yes", with_udev="no") - AC_CHECK_LIB(udev, udev_monitor_ref, [], AC_MSG_ERROR(libudev is required for rdma-ndd...)) +AS_IF([test x$rdmandd = xyes], [ + PKG_CHECK_MODULES([UDEV], [libudev]) AC_CONFIG_FILES([doc/man/rdma-ndd.8 etc/rdma-ndd.init]) - AC_CHECK_FUNCS_ONCE(udev_get_sys_path) -fi + AC_SUBST([UDEV_CFLAGS]) + AC_SUBST([UDEV_LIBS]) + if test "$with_udev" = "yes"; then + PKG_CHECK_EXISTS(libudev >= 218, [with_dev_logging=no], + [with_udev_logging=yes]) + if test "$with_udev_logging" = "yes"; then + AC_DEFINE_UNQUOTED([HAVE_UDEV_LOGGING], 1, + [whether libudev logging can be used]) + fi + fi +]) dnl Generate doc/man/*.in files if possible DOC_DATE="`date +%Y-%m-%d`" diff -Nru infiniband-diags-1.6.5/debian/changelog infiniband-diags-1.6.6/debian/changelog --- infiniband-diags-1.6.5/debian/changelog 2015-07-22 14:33:51.000000000 +0000 +++ infiniband-diags-1.6.6/debian/changelog 2016-01-05 00:22:07.000000000 +0000 @@ -1,3 +1,14 @@ +infiniband-diags (1.6.6-1) unstable; urgency=medium + + * Team upload. + * New upstream release + * Remove patch 0001-rdma-ndd-fix-compiler-warnings.patch which has been + integrated upstream. + * Refresh patch comment_test_out + * Add patch to fix some spelling errors + + -- Mehdi Dogguy Tue, 05 Jan 2016 01:22:07 +0100 + infiniband-diags (1.6.5-1) unstable; urgency=medium * New upstream release. diff -Nru infiniband-diags-1.6.5/debian/patches/0001-rdma-ndd-fix-compiler-warnings.patch infiniband-diags-1.6.6/debian/patches/0001-rdma-ndd-fix-compiler-warnings.patch --- infiniband-diags-1.6.5/debian/patches/0001-rdma-ndd-fix-compiler-warnings.patch 2015-07-22 14:21:38.000000000 +0000 +++ infiniband-diags-1.6.6/debian/patches/0001-rdma-ndd-fix-compiler-warnings.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -From cf7e16f278535e234dbf1968a41d63f824adf13e Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Ana=20Guerrero=20L=C3=B3pez?= -Date: Wed, 22 Jul 2015 14:50:48 +0200 -Subject: [PATCH] rdma-ndd: fix compiler warnings. -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -This patch fixes -Wformat-security warnings, that in Debian (and Ubuntu) -are enabled by default: - -src/rdma-ndd.c: In function 'update_node_desc': -src/rdma-ndd.c:149:3: error: format not a string literal and no format arguments [-Werror=format-security] - fprintf(f, new_nd); - ^ -src/rdma-ndd.c: In function 'udev_log_fn': -src/rdma-ndd.c:247:2: error: format not a string literal and no format arguments [-Werror=format-security] - syslog(LOG_ERR, msg); - -Signed-off-by: Ana Guerrero López ---- - src/rdma-ndd.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -Index: infiniband-diags/src/rdma-ndd.c -=================================================================== ---- infiniband-diags.orig/src/rdma-ndd.c -+++ infiniband-diags/src/rdma-ndd.c -@@ -146,7 +146,7 @@ static int update_node_desc(const char * - syslog(LOG_INFO, "%s: change (%s) -> (%s)\n", - device, nd, new_nd); - rewind(f); -- fprintf(f, new_nd); -+ fprintf(f, "%s", new_nd); - } - - rc = 0; -@@ -244,7 +244,7 @@ static void udev_log_fn(struct udev *ud, - file, line, fn); - if (off < MSG_MAX-1) - vsnprintf(msg+off, MSG_MAX-off, format, args); -- syslog(LOG_ERR, msg); -+ syslog(LOG_ERR, "%s", msg); - } - - static void setup_udev(void) diff -Nru infiniband-diags-1.6.5/debian/patches/0002-Fix-spelling-errors.patch infiniband-diags-1.6.6/debian/patches/0002-Fix-spelling-errors.patch --- infiniband-diags-1.6.5/debian/patches/0002-Fix-spelling-errors.patch 1970-01-01 00:00:00.000000000 +0000 +++ infiniband-diags-1.6.6/debian/patches/0002-Fix-spelling-errors.patch 2016-01-05 00:19:21.000000000 +0000 @@ -0,0 +1,116 @@ +From: Mehdi Dogguy +Date: Tue, 5 Jan 2016 01:19:14 +0100 +Subject: Fix spelling errors + +--- + doc/man/iblinkinfo.8 | 2 +- + doc/man/iblinkinfo.8.in | 2 +- + doc/man/rdma-ndd.8 | 4 ++-- + doc/man/rdma-ndd.8.in | 4 ++-- + doc/rst/iblinkinfo.8.in.rst | 2 +- + doc/rst/rdma-ndd.8.in.rst | 4 ++-- + 6 files changed, 9 insertions(+), 9 deletions(-) + +diff --git a/doc/man/iblinkinfo.8 b/doc/man/iblinkinfo.8 +index 9b92952..9f5f18d 100644 +--- a/doc/man/iblinkinfo.8 ++++ b/doc/man/iblinkinfo.8 +@@ -133,7 +133,7 @@ Filter downports indicated in a ibnetdiscover cache. If a port was previously + indicated as down in the specified cache, and is still down, do not output it in the + resulting output. This option may be particularly useful for environments + where switches are not fully populated, thus much of the default iblinkinfo +-info is considered unuseful. See \fBibnetdiscover\fP for information on caching ++info is considered useless. See \fBibnetdiscover\fP for information on caching + ibnetdiscover output. + .SS Port Selection flags + .\" Define the common option -C +diff --git a/doc/man/iblinkinfo.8.in b/doc/man/iblinkinfo.8.in +index 1621404..60b9a45 100644 +--- a/doc/man/iblinkinfo.8.in ++++ b/doc/man/iblinkinfo.8.in +@@ -133,7 +133,7 @@ Filter downports indicated in a ibnetdiscover cache. If a port was previously + indicated as down in the specified cache, and is still down, do not output it in the + resulting output. This option may be particularly useful for environments + where switches are not fully populated, thus much of the default iblinkinfo +-info is considered unuseful. See \fBibnetdiscover\fP for information on caching ++info is considered useless. See \fBibnetdiscover\fP for information on caching + ibnetdiscover output. + .SS Port Selection flags + .\" Define the common option -C +diff --git a/doc/man/rdma-ndd.8 b/doc/man/rdma-ndd.8 +index 4906aac..f148a4d 100644 +--- a/doc/man/rdma-ndd.8 ++++ b/doc/man/rdma-ndd.8 +@@ -40,14 +40,14 @@ hostname changes and updates the Node Description of the rdma devices based on + those changes. + .SH DETAILS + .sp +-Full operation of this deamon requires kernels which support polling of the ++Full operation of this daemon requires kernels which support polling of the + procfs hostname file as well as libudev. + .sp + If your system does not support either of these features, the daemon will set + the Node Descriptions at start up and then sleep forever. + .SS Node Description format + .sp +-The deamon uses the nd_format configuration option within the ibdiags.conf ++The daemon uses the nd_format configuration option within the ibdiags.conf + file. %h and %d can be used as wildcards in that string to specify the dynamic + use of and respectively. + .sp +diff --git a/doc/man/rdma-ndd.8.in b/doc/man/rdma-ndd.8.in +index f0a542d..2d1a14a 100644 +--- a/doc/man/rdma-ndd.8.in ++++ b/doc/man/rdma-ndd.8.in +@@ -40,14 +40,14 @@ hostname changes and updates the Node Description of the rdma devices based on + those changes. + .SH DETAILS + .sp +-Full operation of this deamon requires kernels which support polling of the ++Full operation of this daemon requires kernels which support polling of the + procfs hostname file as well as libudev. + .sp + If your system does not support either of these features, the daemon will set + the Node Descriptions at start up and then sleep forever. + .SS Node Description format + .sp +-The deamon uses the nd_format configuration option within the ibdiags.conf ++The daemon uses the nd_format configuration option within the ibdiags.conf + file. %h and %d can be used as wildcards in that string to specify the dynamic + use of and respectively. + .sp +diff --git a/doc/rst/iblinkinfo.8.in.rst b/doc/rst/iblinkinfo.8.in.rst +index ee2aefb..108eafb 100644 +--- a/doc/rst/iblinkinfo.8.in.rst ++++ b/doc/rst/iblinkinfo.8.in.rst +@@ -81,7 +81,7 @@ Filter downports indicated in a ibnetdiscover cache. If a port was previously + indicated as down in the specified cache, and is still down, do not output it in the + resulting output. This option may be particularly useful for environments + where switches are not fully populated, thus much of the default iblinkinfo +-info is considered unuseful. See **ibnetdiscover** for information on caching ++info is considered useless. See **ibnetdiscover** for information on caching + ibnetdiscover output. + + +diff --git a/doc/rst/rdma-ndd.8.in.rst b/doc/rst/rdma-ndd.8.in.rst +index 708a5ab..1d126db 100644 +--- a/doc/rst/rdma-ndd.8.in.rst ++++ b/doc/rst/rdma-ndd.8.in.rst +@@ -27,7 +27,7 @@ those changes. + DETAILS + ======= + +-Full operation of this deamon requires kernels which support polling of the ++Full operation of this daemon requires kernels which support polling of the + procfs hostname file as well as libudev. + + If your system does not support either of these features, the daemon will set +@@ -37,7 +37,7 @@ the Node Descriptions at start up and then sleep forever. + Node Description format + ----------------------- + +-The deamon uses the nd_format configuration option within the ibdiags.conf ++The daemon uses the nd_format configuration option within the ibdiags.conf + file. %h and %d can be used as wildcards in that string to specify the dynamic + use of and respectively. + diff -Nru infiniband-diags-1.6.5/debian/patches/comment_test_out infiniband-diags-1.6.6/debian/patches/comment_test_out --- infiniband-diags-1.6.5/debian/patches/comment_test_out 2015-07-22 14:22:06.000000000 +0000 +++ infiniband-diags-1.6.6/debian/patches/comment_test_out 2016-01-05 00:19:21.000000000 +0000 @@ -1,19 +1,21 @@ +From: OFED and Debian Developement and Discussion + +Date: Tue, 5 Jan 2016 01:14:56 +0100 +Subject: comment_test_out + Do not run check_shells.sh This script is not included in the tarball and it doesn't be targetted to run at build time. ---- a/Makefile.in -+++ b/Makefile.in -@@ -573,7 +573,6 @@ src_ibcacheedit_LDFLAGS = -L$(top_buildd - src_dump_fts_SOURCES = src/dump_fts.c - src_dump_fts_LDFLAGS = -L$(top_builddir)/libibnetdisc -libnetdisc - BUILT_SOURCES = ibdiag_version --@HAVE_DASH_TRUE@TESTS = tests/check_shells.sh - EXTRA_DIST = doc scripts include infiniband-diags.spec.in infiniband-diags.spec \ - $(man_MANS) $(compat_man_pages) autogen.sh etc/* - +--- + Makefile.am | 4 ---- + Makefile.in | 1 - + 2 files changed, 5 deletions(-) + +diff --git a/Makefile.am b/Makefile.am +index 93af707..44d32ea 100644 --- a/Makefile.am +++ b/Makefile.am -@@ -135,10 +135,6 @@ ibdiag_version: +@@ -148,10 +148,6 @@ ibdiag_version: fi ; \ fi @@ -24,3 +26,15 @@ EXTRA_DIST = doc scripts include infiniband-diags.spec.in infiniband-diags.spec \ $(man_MANS) $(compat_man_pages) autogen.sh etc/* +diff --git a/Makefile.in b/Makefile.in +index 6573884..e3e4259 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -900,7 +900,6 @@ src_dump_fts_LDFLAGS = -L$(top_builddir)/libibnetdisc -libnetdisc + @ENABLE_RDMA_NDD_TRUE@src_rdma_ndd_CFLAGS = $(AM_CFLAGS) $(UDEV_CFLAGS) + @ENABLE_RDMA_NDD_TRUE@src_rdma_ndd_LDADD = libcommon.a $(UDEV_LIBS) + BUILT_SOURCES = ibdiag_version +-@HAVE_DASH_TRUE@TESTS = tests/check_shells.sh + EXTRA_DIST = doc scripts include infiniband-diags.spec.in infiniband-diags.spec \ + $(man_MANS) $(compat_man_pages) autogen.sh etc/* + diff -Nru infiniband-diags-1.6.5/debian/patches/series infiniband-diags-1.6.6/debian/patches/series --- infiniband-diags-1.6.5/debian/patches/series 2015-07-22 14:21:29.000000000 +0000 +++ infiniband-diags-1.6.6/debian/patches/series 2016-01-05 00:19:21.000000000 +0000 @@ -1,2 +1,2 @@ comment_test_out -0001-rdma-ndd-fix-compiler-warnings.patch +0002-Fix-spelling-errors.patch diff -Nru infiniband-diags-1.6.5/doc/man/rdma-ndd.8 infiniband-diags-1.6.6/doc/man/rdma-ndd.8 --- infiniband-diags-1.6.5/doc/man/rdma-ndd.8 2015-02-10 23:47:54.000000000 +0000 +++ infiniband-diags-1.6.6/doc/man/rdma-ndd.8 2015-10-13 03:35:47.000000000 +0000 @@ -64,6 +64,9 @@ .sp \fB\-\-foreground, \-f\fP Run in the foreground instead of as a daemon +.sp +\fB\-\-pidfile \fP +specify a pid file (daemon mode only) .SS Configuration flags .\" Define the common option -z . diff -Nru infiniband-diags-1.6.5/doc/man/rdma-ndd.8.in infiniband-diags-1.6.6/doc/man/rdma-ndd.8.in --- infiniband-diags-1.6.5/doc/man/rdma-ndd.8.in 2015-02-10 23:47:38.000000000 +0000 +++ infiniband-diags-1.6.6/doc/man/rdma-ndd.8.in 2015-10-13 03:35:46.000000000 +0000 @@ -64,6 +64,9 @@ .sp \fB\-\-foreground, \-f\fP Run in the foreground instead of as a daemon +.sp +\fB\-\-pidfile \fP +specify a pid file (daemon mode only) .SS Configuration flags .\" Define the common option -z . diff -Nru infiniband-diags-1.6.5/doc/rst/rdma-ndd.8.in.rst infiniband-diags-1.6.6/doc/rst/rdma-ndd.8.in.rst --- infiniband-diags-1.6.5/doc/rst/rdma-ndd.8.in.rst 2015-01-28 16:15:20.000000000 +0000 +++ infiniband-diags-1.6.6/doc/rst/rdma-ndd.8.in.rst 2015-06-12 14:54:44.000000000 +0000 @@ -58,6 +58,9 @@ **--foreground, -f** Run in the foreground instead of as a daemon +**--pidfile ** +specify a pid file (daemon mode only) + Configuration flags ------------------- diff -Nru infiniband-diags-1.6.5/etc/rdma-ndd.init infiniband-diags-1.6.6/etc/rdma-ndd.init --- infiniband-diags-1.6.5/etc/rdma-ndd.init 2015-02-10 23:47:54.000000000 +0000 +++ infiniband-diags-1.6.6/etc/rdma-ndd.init 2015-10-13 03:35:47.000000000 +0000 @@ -41,7 +41,9 @@ # notice, one of the license notices in the documentation # and/or other materials provided with the distribution. -pidfile=/var/run/rdma-ndd.pid +prefix=/usr/local +exec_prefix=${prefix} +pidfile=${prefix}/var/run/rdma-ndd.pid # Source function library. if [[ -s /etc/init.d/functions ]]; then @@ -73,7 +75,7 @@ return 1 fi echo -n "Starting RDMA Node Description Daemon: " - ${exec_prefix}/sbin/rdma-ndd > /dev/null + ${exec_prefix}/sbin/rdma-ndd --pidfile $pidfile > /dev/null RETVAL=$? if [[ $RETVAL -eq 0 ]]; then success diff -Nru infiniband-diags-1.6.5/etc/rdma-ndd.init.in infiniband-diags-1.6.6/etc/rdma-ndd.init.in --- infiniband-diags-1.6.5/etc/rdma-ndd.init.in 2015-01-28 16:15:20.000000000 +0000 +++ infiniband-diags-1.6.6/etc/rdma-ndd.init.in 2015-06-12 14:54:44.000000000 +0000 @@ -41,7 +41,9 @@ # notice, one of the license notices in the documentation # and/or other materials provided with the distribution. -pidfile=/var/run/rdma-ndd.pid +prefix=@prefix@ +exec_prefix=@exec_prefix@ +pidfile=@localstatedir@/run/rdma-ndd.pid # Source function library. if [[ -s /etc/init.d/functions ]]; then @@ -73,7 +75,7 @@ return 1 fi echo -n "Starting RDMA Node Description Daemon: " - @sbindir@/rdma-ndd > /dev/null + @sbindir@/rdma-ndd --pidfile $pidfile > /dev/null RETVAL=$? if [[ $RETVAL -eq 0 ]]; then success diff -Nru infiniband-diags-1.6.5/include/ibdiag_version.h infiniband-diags-1.6.6/include/ibdiag_version.h --- infiniband-diags-1.6.5/include/ibdiag_version.h 2015-02-10 23:47:54.000000000 +0000 +++ infiniband-diags-1.6.6/include/ibdiag_version.h 2015-10-13 03:52:38.000000000 +0000 @@ -34,6 +34,6 @@ #ifndef _IBDIAG_VERSION_H_ #define _IBDIAG_VERSION_H_ -#define IBDIAG_VERSION "1.6.5" +#define IBDIAG_VERSION "1.6.6" #endif /* _IBDIAG_VERSION_H_ */ diff -Nru infiniband-diags-1.6.5/infiniband-diags.spec infiniband-diags-1.6.6/infiniband-diags.spec --- infiniband-diags-1.6.5/infiniband-diags.spec 2015-02-10 23:47:54.000000000 +0000 +++ infiniband-diags-1.6.6/infiniband-diags.spec 2015-10-13 03:35:47.000000000 +0000 @@ -4,12 +4,12 @@ Summary: OpenFabrics Alliance InfiniBand Diagnostic Tools Name: infiniband-diags -Version: 1.6.5 +Version: 1.6.6 Release: %rel%{?dist} License: GPLv2 or BSD Group: System Environment/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -Source: http://www.openfabrics.org/downloads/management/infiniband-diags-1.6.5.tar.gz +Source: http://www.openfabrics.org/downloads/management/infiniband-diags-1.6.6.tar.gz Url: http://openfabrics.org/ BuildRequires: libibmad-devel, opensm-devel, libibumad-devel, glib2-devel, libudev-devel Requires: libibmad, opensm-libs, libibumad, glib2 diff -Nru infiniband-diags-1.6.5/libibnetdisc/Makefile.in infiniband-diags-1.6.6/libibnetdisc/Makefile.in --- infiniband-diags-1.6.5/libibnetdisc/Makefile.in 2015-02-10 23:47:52.000000000 +0000 +++ infiniband-diags-1.6.6/libibnetdisc/Makefile.in 2015-10-13 03:30:57.000000000 +0000 @@ -293,6 +293,8 @@ SHELL = @SHELL@ STRIP = @STRIP@ TARBALL = @TARBALL@ +UDEV_CFLAGS = @UDEV_CFLAGS@ +UDEV_LIBS = @UDEV_LIBS@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ diff -Nru infiniband-diags-1.6.5/libibnetdisc/src/ibnetdisc.c infiniband-diags-1.6.6/libibnetdisc/src/ibnetdisc.c --- infiniband-diags-1.6.5/libibnetdisc/src/ibnetdisc.c 2015-02-07 12:51:53.000000000 +0000 +++ infiniband-diags-1.6.6/libibnetdisc/src/ibnetdisc.c 2015-10-13 03:28:23.000000000 +0000 @@ -127,12 +127,6 @@ if (portid->lid) { /* If we were LID routed we need to set up the drslid */ - if (!scan->selfportid.lid) - if (ib_resolve_self_via(&scan->selfportid, NULL, NULL, - scan->ibmad_port) < 0) { - IBND_ERROR("Failed to resolve self\n"); - return -1; - } portid->drpath.drslid = (uint16_t) scan->selfportid.lid; portid->drpath.drdlid = 0xFFFF; } @@ -359,7 +353,12 @@ port->lmc = node->smalmc; } - add_to_portguid_hash(port, f_int->fabric.portstbl); + int rc1 = add_to_portguid_hash(port, f_int->fabric.portstbl); + if (rc1) + IBND_ERROR("Error Occurred when trying" + " to insert new port guid 0x%016" PRIx64 " to DB\n", + port->guid); + add_to_portlid_hash(port, f_int->lid2guid); if ((scan->cfg->flags & IBND_CONFIG_MLX_EPI) @@ -464,7 +463,11 @@ rc->path_portid = *path; memcpy(rc->info, node_info, sizeof(rc->info)); - add_to_nodeguid_hash(rc, f_int->fabric.nodestbl); + int rc1 = add_to_nodeguid_hash(rc, f_int->fabric.nodestbl); + if (rc1) + IBND_ERROR("Error Occurred when trying" + " to insert new node guid 0x%016" PRIx64 " to DB\n", + rc->guid); /* add this to the all nodes list */ rc->next = f_int->fabric.nodes; @@ -613,20 +616,42 @@ return rc->node; } -void add_to_nodeguid_hash(ibnd_node_t * node, ibnd_node_t * hash[]) +int add_to_nodeguid_hash(ibnd_node_t * node, ibnd_node_t * hash[]) { + int rc = 0; + ibnd_node_t *tblnode; int hash_idx = HASHGUID(node->guid) % HTSZ; + for (tblnode = hash[hash_idx]; tblnode; tblnode = tblnode->htnext) { + if (tblnode == node) { + IBND_ERROR("Duplicate Node: Node with guid 0x%016" + PRIx64 " already exists in nodes DB\n", + node->guid); + return 1; + } + } node->htnext = hash[hash_idx]; hash[hash_idx] = node; + return rc; } -void add_to_portguid_hash(ibnd_port_t * port, ibnd_port_t * hash[]) +int add_to_portguid_hash(ibnd_port_t * port, ibnd_port_t * hash[]) { + int rc = 0; + ibnd_port_t *tblport; int hash_idx = HASHGUID(port->guid) % HTSZ; + for (tblport = hash[hash_idx]; tblport; tblport = tblport->htnext) { + if (tblport == port) { + IBND_ERROR("Duplicate Port: Port with guid 0x%016" + PRIx64 " already exists in ports DB\n", + port->guid); + return 1; + } + } port->htnext = hash[hash_idx]; hash[hash_idx] = port; + return rc; } void create_lid2guid(f_internal_t *f_int) @@ -712,6 +737,7 @@ ib_portid_t my_portid = { 0 }; smp_engine_t engine; ibnd_scan_t scan; + struct ibmad_port *ibmad_port; int nc = 2; int mc[2] = { IB_SMI_CLASS, IB_SMI_DIRECT_CLASS }; @@ -735,20 +761,27 @@ scan.cfg = &config; scan.initial_hops = from->drpath.cnt; - if (smp_engine_init(&engine, ca_name, ca_port, &scan, &config)) { - free(f_int); + ibmad_port = mad_rpc_open_port(ca_name, ca_port, mc, nc); + if (!ibmad_port) { + IBND_ERROR("can't open MAD port (%s:%d)\n", ca_name, ca_port); return (NULL); } + mad_rpc_set_timeout(ibmad_port, cfg->timeout_ms); + mad_rpc_set_retries(ibmad_port, cfg->retries); + smp_mkey_set(ibmad_port, cfg->mkey); + + if (ib_resolve_self_via(&scan.selfportid, + NULL, NULL, ibmad_port) < 0) { + IBND_ERROR("Failed to resolve self\n"); + mad_rpc_close_port(ibmad_port); + return NULL; + } + mad_rpc_close_port(ibmad_port); - scan.ibmad_port = mad_rpc_open_port(ca_name, ca_port, mc, nc); - if (!scan.ibmad_port) { - IBND_ERROR("can't open MAD port (%s:%d)\n", ca_name, ca_port); - smp_engine_destroy(&engine); + if (smp_engine_init(&engine, ca_name, ca_port, &scan, &config)) { + free(f_int); return (NULL); } - mad_rpc_set_timeout(scan.ibmad_port, cfg->timeout_ms); - mad_rpc_set_retries(scan.ibmad_port, cfg->retries); - smp_mkey_set(scan.ibmad_port, cfg->mkey); IBND_DEBUG("from %s\n", portid2str(from)); @@ -763,11 +796,9 @@ goto error; smp_engine_destroy(&engine); - mad_rpc_close_port(scan.ibmad_port); return (ibnd_fabric_t *)f_int; error: smp_engine_destroy(&engine); - mad_rpc_close_port(scan.ibmad_port); ibnd_destroy_fabric(&f_int->fabric); return NULL; } diff -Nru infiniband-diags-1.6.5/libibnetdisc/src/ibnetdisc_cache.c infiniband-diags-1.6.6/libibnetdisc/src/ibnetdisc_cache.c --- infiniband-diags-1.6.5/libibnetdisc/src/ibnetdisc_cache.c 2015-01-28 16:15:20.000000000 +0000 +++ infiniband-diags-1.6.6/libibnetdisc/src/ibnetdisc_cache.c 2015-10-13 03:28:23.000000000 +0000 @@ -515,7 +515,13 @@ /* achu: needed if user wishes to re-cache a loaded fabric. * Otherwise, mostly unnecessary to do this. */ - add_to_portguid_hash(port_cache->port, fabric_cache->f_int->fabric.portstbl); + int rc = add_to_portguid_hash(port_cache->port, + fabric_cache->f_int->fabric.portstbl); + if (rc) { + IBND_DEBUG("Error Occurred when trying" + " to insert new port guid 0x%016" PRIx64 " to DB\n", + port_cache->port->guid); + } return 0; } @@ -538,8 +544,15 @@ node->next = fabric_cache->f_int->fabric.nodes; fabric_cache->f_int->fabric.nodes = node; - add_to_nodeguid_hash(node_cache->node, - fabric_cache->f_int->fabric.nodestbl); + int rc = add_to_nodeguid_hash(node_cache->node, + fabric_cache-> + f_int-> + fabric.nodestbl); + if (rc) { + IBND_DEBUG("Error Occurred when trying" + " to insert new node guid 0x%016" PRIx64 " to DB\n", + node_cache->node->guid); + } add_to_type_list(node_cache->node, fabric_cache->f_int); diff -Nru infiniband-diags-1.6.5/libibnetdisc/src/internal.h infiniband-diags-1.6.6/libibnetdisc/src/internal.h --- infiniband-diags-1.6.5/libibnetdisc/src/internal.h 2015-01-28 16:15:20.000000000 +0000 +++ infiniband-diags-1.6.6/libibnetdisc/src/internal.h 2015-10-13 03:28:23.000000000 +0000 @@ -71,7 +71,6 @@ ib_portid_t selfportid; f_internal_t *f_int; struct ibnd_config *cfg; - struct ibmad_port *ibmad_port; unsigned initial_hops; } ibnd_scan_t; @@ -107,9 +106,9 @@ int process_mads(smp_engine_t * engine); void smp_engine_destroy(smp_engine_t * engine); -void add_to_nodeguid_hash(ibnd_node_t * node, ibnd_node_t * hash[]); +int add_to_nodeguid_hash(ibnd_node_t * node, ibnd_node_t * hash[]); -void add_to_portguid_hash(ibnd_port_t * port, ibnd_port_t * hash[]); +int add_to_portguid_hash(ibnd_port_t * port, ibnd_port_t * hash[]); void add_to_portlid_hash(ibnd_port_t * port, GHashTable *htable); void add_to_type_list(ibnd_node_t * node, f_internal_t * fabric); diff -Nru infiniband-diags-1.6.5/libibnetdisc/src/query_smp.c infiniband-diags-1.6.6/libibnetdisc/src/query_smp.c --- infiniband-diags-1.6.5/libibnetdisc/src/query_smp.c 2015-01-28 16:15:20.000000000 +0000 +++ infiniband-diags-1.6.6/libibnetdisc/src/query_smp.c 2015-08-03 04:02:16.000000000 +0000 @@ -171,9 +171,7 @@ /* wait for the next message */ if ((rc = umad_recv(engine->umad_fd, umad, &length, - 0)) < 0) { - if (rc == -EWOULDBLOCK) - return 0; + -1)) < 0) { IBND_ERROR("umad_recv failed: %d\n", rc); return -1; } diff -Nru infiniband-diags-1.6.5/Makefile.am infiniband-diags-1.6.6/Makefile.am --- infiniband-diags-1.6.5/Makefile.am 2015-02-07 12:51:53.000000000 +0000 +++ infiniband-diags-1.6.6/Makefile.am 2015-08-03 04:02:16.000000000 +0000 @@ -130,6 +130,12 @@ src_dump_fts_SOURCES = src/dump_fts.c src_dump_fts_LDFLAGS = -L$(top_builddir)/libibnetdisc -libnetdisc +if ENABLE_RDMA_NDD +src_rdma_ndd_SOURCES = src/rdma-ndd.c +src_rdma_ndd_CFLAGS = $(AM_CFLAGS) $(UDEV_CFLAGS) +src_rdma_ndd_LDADD = libcommon.a $(UDEV_LIBS) +endif + BUILT_SOURCES = ibdiag_version ibdiag_version: if [ -x $(top_srcdir)/gen_ver.sh ] ; then \ @@ -162,6 +168,9 @@ if test ! -d $(DESTDIR)/$(sysconfdir)/infiniband-diags; then \ $(top_srcdir)/config/install-sh -m 755 -d $(DESTDIR)/$(sysconfdir)/infiniband-diags; \ fi + if test ! -d $(DESTDIR)/$(localstatedir)/run; then \ + mkdir -p $(DESTDIR)/$(localstatedir)/run; \ + fi $(top_srcdir)/config/install-sh -c -m 444 $(top_srcdir)/scripts/IBswcountlimits.pm $(DESTDIR)/$(PERL_INSTALLDIR)/IBswcountlimits.pm $(top_srcdir)/config/install-sh -c -m 444 $(top_srcdir)/etc/error_thresholds $(DESTDIR)/$(sysconfdir)/infiniband-diags $(top_srcdir)/config/install-sh -c -m 400 $(top_srcdir)/etc/ibdiag.conf $(DESTDIR)/$(sysconfdir)/infiniband-diags diff -Nru infiniband-diags-1.6.5/Makefile.in infiniband-diags-1.6.6/Makefile.in --- infiniband-diags-1.6.5/Makefile.in 2015-02-10 23:47:52.000000000 +0000 +++ infiniband-diags-1.6.6/Makefile.in 2015-10-13 03:30:57.000000000 +0000 @@ -315,10 +315,16 @@ src_perfquery_OBJECTS = $(am_src_perfquery_OBJECTS) src_perfquery_LDADD = $(LDADD) src_perfquery_DEPENDENCIES = libcommon.a -src_rdma_ndd_SOURCES = src/rdma-ndd.c -src_rdma_ndd_OBJECTS = rdma-ndd.$(OBJEXT) -src_rdma_ndd_LDADD = $(LDADD) -src_rdma_ndd_DEPENDENCIES = libcommon.a +am__src_rdma_ndd_SOURCES_DIST = src/rdma-ndd.c +@ENABLE_RDMA_NDD_TRUE@am_src_rdma_ndd_OBJECTS = \ +@ENABLE_RDMA_NDD_TRUE@ src_rdma_ndd-rdma-ndd.$(OBJEXT) +src_rdma_ndd_OBJECTS = $(am_src_rdma_ndd_OBJECTS) +am__DEPENDENCIES_1 = +@ENABLE_RDMA_NDD_TRUE@src_rdma_ndd_DEPENDENCIES = libcommon.a \ +@ENABLE_RDMA_NDD_TRUE@ $(am__DEPENDENCIES_1) +src_rdma_ndd_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(src_rdma_ndd_CFLAGS) \ + $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ am_src_saquery_OBJECTS = saquery.$(OBJEXT) src_saquery_OBJECTS = $(am_src_saquery_OBJECTS) src_saquery_LDADD = $(LDADD) @@ -410,9 +416,9 @@ $(src_ibsendtrap_SOURCES) $(src_ibstat_SOURCES) \ $(src_ibsysstat_SOURCES) $(src_ibtracert_SOURCES) \ $(src_mcm_rereg_test_SOURCES) $(src_perfquery_SOURCES) \ - src/rdma-ndd.c $(src_saquery_SOURCES) $(src_sminfo_SOURCES) \ - $(src_smpdump_SOURCES) $(src_smpquery_SOURCES) \ - $(src_vendstat_SOURCES) + $(src_rdma_ndd_SOURCES) $(src_saquery_SOURCES) \ + $(src_sminfo_SOURCES) $(src_smpdump_SOURCES) \ + $(src_smpquery_SOURCES) $(src_vendstat_SOURCES) DIST_SOURCES = $(libcommon_a_SOURCES) $(src_dump_fts_SOURCES) \ $(src_ibaddr_SOURCES) $(src_ibcacheedit_SOURCES) \ $(src_ibccconfig_SOURCES) $(src_ibccquery_SOURCES) \ @@ -422,9 +428,9 @@ $(src_ibsendtrap_SOURCES) $(src_ibstat_SOURCES) \ $(src_ibsysstat_SOURCES) $(src_ibtracert_SOURCES) \ $(src_mcm_rereg_test_SOURCES) $(src_perfquery_SOURCES) \ - src/rdma-ndd.c $(src_saquery_SOURCES) $(src_sminfo_SOURCES) \ - $(src_smpdump_SOURCES) $(src_smpquery_SOURCES) \ - $(src_vendstat_SOURCES) + $(am__src_rdma_ndd_SOURCES_DIST) $(src_saquery_SOURCES) \ + $(src_sminfo_SOURCES) $(src_smpdump_SOURCES) \ + $(src_smpquery_SOURCES) $(src_vendstat_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ @@ -765,6 +771,8 @@ SHELL = @SHELL@ STRIP = @STRIP@ TARBALL = @TARBALL@ +UDEV_CFLAGS = @UDEV_CFLAGS@ +UDEV_LIBS = @UDEV_LIBS@ VERSION = @VERSION@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ @@ -888,6 +896,9 @@ src_ibcacheedit_LDFLAGS = -L$(top_builddir)/libibnetdisc -libnetdisc src_dump_fts_SOURCES = src/dump_fts.c src_dump_fts_LDFLAGS = -L$(top_builddir)/libibnetdisc -libnetdisc +@ENABLE_RDMA_NDD_TRUE@src_rdma_ndd_SOURCES = src/rdma-ndd.c +@ENABLE_RDMA_NDD_TRUE@src_rdma_ndd_CFLAGS = $(AM_CFLAGS) $(UDEV_CFLAGS) +@ENABLE_RDMA_NDD_TRUE@src_rdma_ndd_LDADD = libcommon.a $(UDEV_LIBS) BUILT_SOURCES = ibdiag_version @HAVE_DASH_TRUE@TESTS = tests/check_shells.sh EXTRA_DIST = doc scripts include infiniband-diags.spec.in infiniband-diags.spec \ @@ -1186,7 +1197,7 @@ src/rdma-ndd$(EXEEXT): $(src_rdma_ndd_OBJECTS) $(src_rdma_ndd_DEPENDENCIES) $(EXTRA_src_rdma_ndd_DEPENDENCIES) src/$(am__dirstamp) @rm -f src/rdma-ndd$(EXEEXT) - $(AM_V_CCLD)$(LINK) $(src_rdma_ndd_OBJECTS) $(src_rdma_ndd_LDADD) $(LIBS) + $(AM_V_CCLD)$(src_rdma_ndd_LINK) $(src_rdma_ndd_OBJECTS) $(src_rdma_ndd_LDADD) $(LIBS) src/saquery$(EXEEXT): $(src_saquery_OBJECTS) $(src_saquery_DEPENDENCIES) $(EXTRA_src_saquery_DEPENDENCIES) src/$(am__dirstamp) @rm -f src/saquery$(EXEEXT) @@ -1268,11 +1279,11 @@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ibtracert.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mcm_rereg_test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/perfquery.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rdma-ndd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/saquery.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sminfo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smpdump.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smpquery.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/src_rdma_ndd-rdma-ndd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vendstat.Po@am__quote@ .c.o: @@ -1562,19 +1573,19 @@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o perfquery.obj `if test -f 'src/perfquery.c'; then $(CYGPATH_W) 'src/perfquery.c'; else $(CYGPATH_W) '$(srcdir)/src/perfquery.c'; fi` -rdma-ndd.o: src/rdma-ndd.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rdma-ndd.o -MD -MP -MF $(DEPDIR)/rdma-ndd.Tpo -c -o rdma-ndd.o `test -f 'src/rdma-ndd.c' || echo '$(srcdir)/'`src/rdma-ndd.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rdma-ndd.Tpo $(DEPDIR)/rdma-ndd.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/rdma-ndd.c' object='rdma-ndd.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rdma-ndd.o `test -f 'src/rdma-ndd.c' || echo '$(srcdir)/'`src/rdma-ndd.c - -rdma-ndd.obj: src/rdma-ndd.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT rdma-ndd.obj -MD -MP -MF $(DEPDIR)/rdma-ndd.Tpo -c -o rdma-ndd.obj `if test -f 'src/rdma-ndd.c'; then $(CYGPATH_W) 'src/rdma-ndd.c'; else $(CYGPATH_W) '$(srcdir)/src/rdma-ndd.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/rdma-ndd.Tpo $(DEPDIR)/rdma-ndd.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/rdma-ndd.c' object='rdma-ndd.obj' libtool=no @AMDEPBACKSLASH@ +src_rdma_ndd-rdma-ndd.o: src/rdma-ndd.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_rdma_ndd_CFLAGS) $(CFLAGS) -MT src_rdma_ndd-rdma-ndd.o -MD -MP -MF $(DEPDIR)/src_rdma_ndd-rdma-ndd.Tpo -c -o src_rdma_ndd-rdma-ndd.o `test -f 'src/rdma-ndd.c' || echo '$(srcdir)/'`src/rdma-ndd.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/src_rdma_ndd-rdma-ndd.Tpo $(DEPDIR)/src_rdma_ndd-rdma-ndd.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/rdma-ndd.c' object='src_rdma_ndd-rdma-ndd.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_rdma_ndd_CFLAGS) $(CFLAGS) -c -o src_rdma_ndd-rdma-ndd.o `test -f 'src/rdma-ndd.c' || echo '$(srcdir)/'`src/rdma-ndd.c + +src_rdma_ndd-rdma-ndd.obj: src/rdma-ndd.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_rdma_ndd_CFLAGS) $(CFLAGS) -MT src_rdma_ndd-rdma-ndd.obj -MD -MP -MF $(DEPDIR)/src_rdma_ndd-rdma-ndd.Tpo -c -o src_rdma_ndd-rdma-ndd.obj `if test -f 'src/rdma-ndd.c'; then $(CYGPATH_W) 'src/rdma-ndd.c'; else $(CYGPATH_W) '$(srcdir)/src/rdma-ndd.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/src_rdma_ndd-rdma-ndd.Tpo $(DEPDIR)/src_rdma_ndd-rdma-ndd.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/rdma-ndd.c' object='src_rdma_ndd-rdma-ndd.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o rdma-ndd.obj `if test -f 'src/rdma-ndd.c'; then $(CYGPATH_W) 'src/rdma-ndd.c'; else $(CYGPATH_W) '$(srcdir)/src/rdma-ndd.c'; fi` +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(src_rdma_ndd_CFLAGS) $(CFLAGS) -c -o src_rdma_ndd-rdma-ndd.obj `if test -f 'src/rdma-ndd.c'; then $(CYGPATH_W) 'src/rdma-ndd.c'; else $(CYGPATH_W) '$(srcdir)/src/rdma-ndd.c'; fi` saquery.o: src/saquery.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT saquery.o -MD -MP -MF $(DEPDIR)/saquery.Tpo -c -o saquery.o `test -f 'src/saquery.c' || echo '$(srcdir)/'`src/saquery.c @@ -2327,6 +2338,9 @@ if test ! -d $(DESTDIR)/$(sysconfdir)/infiniband-diags; then \ $(top_srcdir)/config/install-sh -m 755 -d $(DESTDIR)/$(sysconfdir)/infiniband-diags; \ fi + if test ! -d $(DESTDIR)/$(localstatedir)/run; then \ + mkdir -p $(DESTDIR)/$(localstatedir)/run; \ + fi $(top_srcdir)/config/install-sh -c -m 444 $(top_srcdir)/scripts/IBswcountlimits.pm $(DESTDIR)/$(PERL_INSTALLDIR)/IBswcountlimits.pm $(top_srcdir)/config/install-sh -c -m 444 $(top_srcdir)/etc/error_thresholds $(DESTDIR)/$(sysconfdir)/infiniband-diags $(top_srcdir)/config/install-sh -c -m 400 $(top_srcdir)/etc/ibdiag.conf $(DESTDIR)/$(sysconfdir)/infiniband-diags diff -Nru infiniband-diags-1.6.5/README infiniband-diags-1.6.6/README --- infiniband-diags-1.6.5/README 2015-02-10 23:45:32.000000000 +0000 +++ infiniband-diags-1.6.6/README 2015-10-13 03:28:23.000000000 +0000 @@ -17,39 +17,46 @@ 5) glib2 -Release notes v1.6.4 => 1.6.5 +Release notes v1.6.5 => 1.6.6 1) bug fixes - 2) updates for new hardware device IDs - 3) rdma-ndd daemon -Authors since 1.6.4 -Dan Ben Yosef - ibtracert.c: Remove checking the port 0 state for base switch port 0 - Add new configure flag to enable/disable the rdma-ndd build - New MAD SM:PortInfoExtended and changing PM:PortExtendedSpeedsCounters - Fix missing source dir in configure.ac - -Hal Rosenstock - Align infiniband-diags MLNX device IDs with OpenSM - vendstat.c: Add additional vendor IDs to ext_fw_info_device - ibnetdisc.c: Add additional supported device IDs to is_mlnx_ext_port_info_supported - ibdiag_common.c: Add more supported device IDs in is_mlnx_ext_port_info_supported - ibccconfig.c: Account for enhanced switch port 0 in SwitchPortCongestionSetting handling - ibccquery.c: Account for enhanced switch port 0 in SwitchPortCongestionSetting handling - saquery.c: Return proper status from query_sa_cpi on bad result status - saquery.c: Fix handling of cpi and ClassPortInfo options - ibping.c: Fix support of OUIs other than IB_OPENIB_OUI - ibportstate.c: Cosmetic changes to MLNX Extended PortInfo - saquery.c: In query_sa_cpi, make error message consistent - saquery.c: In print_node_record, change LID print format - -Ira Weiny - infiniband-diags: update for udev changes. - infiniband-diags/test-code: remove unused variables - infiniband-diags: add rdma-ndd daemon - infiniband-diags: update smpquery man page - infiniband-diags: If rst2man is available fix missing source dir in configure +Authors since 1.6.5 + +Ana Guerrero López (1): + rdma-ndd: fix compiler warnings. + +Dan Ben Yosef (2): + perfquery -T (print Extended Speed Counters) times out on nodes supporting + libibnetdisc: Avoid pushing same pointer to the hash table + +Hal Rosenstock (5): + perfquery.c: Change format of capability mask in IBWARN for consistency + ibdiag_sa.c: In sa_get_handle, handle umad_open_port and umad_register fai + iblinkinfo.c: Close additional file descriptor in advance + ibdiag_common.c: Move static to beginning of get_build_version declaration + perfquery.c: Fix smp_query_via return value checks + +Ira Weiny (3): + infiniband-diags/rdma-ndd: Fix issues with install + infiniband-diags/rdma-ndd: add --pidfile option + infiniband-diags: rdma-ndd: remove udev logging when not supported + +Michal Schmidt (2): + rdma-ndd: never use udev_get_sys_path() + build-sys: avoid overlinking to libudev + +Vladimir Koushnir (10): + ibqueryerrors: Resource leak in path_record_query + Remove redundant umad file descriptor from libibnetdisc + query_smp.c: Avoid busy looping in process_one_recv + dump_fts: Open global file descriptor after calling ibnd_discover_fabric + ibqueryerrors: code improvement + ibqueryerrors: Fix crash when no SM is running + ibqueryerrors: Close global file descriptor before running ibnd_discover_f + ibqueryerrors: improve code related to DR option + vendstat: mad_rpc_close_port not called in corner cases + saquery.c: Fix saquery -D option diff -Nru infiniband-diags-1.6.5/src/dump_fts.c infiniband-diags-1.6.6/src/dump_fts.c --- infiniband-diags-1.6.5/src/dump_fts.c 2015-01-28 16:15:20.000000000 +0000 +++ infiniband-diags-1.6.6/src/dump_fts.c 2015-08-03 04:02:16.000000000 +0000 @@ -457,33 +457,41 @@ if (argc > 1) endlid = strtoul(argv[1], 0, 0); - srcport = mad_rpc_open_port(ibd_ca, ibd_ca_port, mgmt_classes, 3); - if (!srcport) - IBEXIT("Failed to open '%s' port '%d'", ibd_ca, ibd_ca_port); - node_name_map = open_node_name_map(node_name_map_file); - smp_mkey_set(srcport, ibd_mkey); - - if (ibd_timeout) { - mad_rpc_set_timeout(srcport, ibd_timeout); + if (ibd_timeout) config.timeout_ms = ibd_timeout; - } config.flags = ibd_ibnetdisc_flags; config.mkey = ibd_mkey; if ((fabric = ibnd_discover_fabric(ibd_ca, ibd_ca_port, NULL, &config)) != NULL) { + + srcport = mad_rpc_open_port(ibd_ca, ibd_ca_port, mgmt_classes, 3); + if (!srcport) { + fprintf(stderr, + "Failed to open '%s' port '%d'\n", ibd_ca, ibd_ca_port); + rc = -1; + goto Exit; + } + smp_mkey_set(srcport, ibd_mkey); + + if (ibd_timeout) { + mad_rpc_set_timeout(srcport, ibd_timeout); + } + ibnd_iter_nodes_type(fabric, process_switch, IB_NODE_SWITCH, fabric); + + mad_rpc_close_port(srcport); + } else { fprintf(stderr, "Failed to discover fabric\n"); rc = -1; } - +Exit: ibnd_destroy_fabric(fabric); - mad_rpc_close_port(srcport); close_node_name_map(node_name_map); exit(rc); } diff -Nru infiniband-diags-1.6.5/src/ibdiag_common.c infiniband-diags-1.6.6/src/ibdiag_common.c --- infiniband-diags-1.6.5/src/ibdiag_common.c 2015-02-07 12:51:53.000000000 +0000 +++ infiniband-diags-1.6.6/src/ibdiag_common.c 2015-10-13 03:28:23.000000000 +0000 @@ -82,7 +82,7 @@ static struct option *long_opts = NULL; static const struct ibdiag_opt *opts_map[256]; -const static char *get_build_version(void) +static const char *get_build_version(void) { return "BUILD VERSION: " IBDIAG_VERSION " Build date: " __DATE__ " " __TIME__; @@ -507,7 +507,7 @@ uint32_t cap_mask; uint16_t cap_mask2; - if (smp_query_via(data, dest, IB_ATTR_PORT_INFO, port, 0, srcport) < 0) + if (!smp_query_via(data, dest, IB_ATTR_PORT_INFO, port, 0, srcport)) IBEXIT("port info query failed"); mad_decode_field(data, IB_PORT_CAPMASK_F, &cap_mask); diff -Nru infiniband-diags-1.6.5/src/ibdiag_sa.c infiniband-diags-1.6.6/src/ibdiag_sa.c --- infiniband-diags-1.6.5/src/ibdiag_sa.c 2015-01-28 16:15:20.000000000 +0000 +++ infiniband-diags-1.6.6/src/ibdiag_sa.c 2015-08-03 04:02:16.000000000 +0000 @@ -60,18 +60,32 @@ IBWARN("No SM/SA found on port %s:%d", ibd_ca ? "" : ibd_ca, ibd_ca_port); - free(handle); - return (NULL); + goto err; } handle->dport.qp = 1; if (!handle->dport.qkey) handle->dport.qkey = IB_DEFAULT_QP1_QKEY; - handle->fd = umad_open_port(ibd_ca, ibd_ca_port); - handle->agent = umad_register(handle->fd, IB_SA_CLASS, 2, 1, NULL); + if ((handle->fd = umad_open_port(ibd_ca, ibd_ca_port)) < 0) { + IBWARN("umad_open_port on port %s:%d failed", + ibd_ca ? "" : ibd_ca, + ibd_ca_port); + goto err; + } + if ((handle->agent = umad_register(handle->fd, IB_SA_CLASS, 2, 1, NULL)) < 0) { + umad_close_port(handle->fd); + IBWARN("umad_register for SA class failed on port %s:%d", + ibd_ca ? "" : ibd_ca, + ibd_ca_port); + goto err; + } return handle; + +err: + free(handle); + return (NULL); } void sa_free_handle(struct sa_handle * h) diff -Nru infiniband-diags-1.6.5/src/iblinkinfo.c infiniband-diags-1.6.6/src/iblinkinfo.c --- infiniband-diags-1.6.5/src/iblinkinfo.c 2015-02-10 23:45:24.000000000 +0000 +++ infiniband-diags-1.6.6/src/iblinkinfo.c 2015-09-19 21:56:45.000000000 +0000 @@ -594,6 +594,7 @@ ibnd_fabric_t *diff_fabric = NULL; struct ibmad_port *ibmad_port; ib_portid_t port_id = { 0 }; + uint8_t ni[IB_SMP_DATA_SIZE] = { 0 }; int mgmt_classes[3] = { IB_SMI_CLASS, IB_SMI_DIRECT_CLASS, IB_SA_CLASS }; @@ -659,6 +660,7 @@ node_name_map = open_node_name_map(node_name_map_file); if (dr_path && load_cache_file) { + mad_rpc_close_port(ibmad_port); fprintf(stderr, "Cannot specify cache and direct route path\n"); exit(1); } @@ -679,6 +681,16 @@ guid_str); } + if (!all && dr_path) { + if (!smp_query_via(ni, &port_id, IB_ATTR_NODE_INFO, 0, + ibd_timeout, ibmad_port)){ + mad_rpc_close_port(ibmad_port); + fprintf(stderr, "Failed to get local Node Info\n"); + exit(1); + } + } + mad_rpc_close_port(ibmad_port); + if (diff_cache_file && !(diff_fabric = ibnd_load_fabric(diff_cache_file, 0))) IBEXIT("loading cached fabric for diff failed\n"); @@ -723,11 +735,6 @@ fprintf(stderr, "Failed to find port: %s\n", guid_str); } else if (!all && dr_path) { ibnd_port_t *p = NULL; - uint8_t ni[IB_SMP_DATA_SIZE] = { 0 }; - - if (!smp_query_via(ni, &port_id, IB_ATTR_NODE_INFO, 0, - ibd_timeout, ibmad_port)) - return -1; mad_decode_field(ni, IB_NODE_PORT_GUID_F, &(guid)); p = ibnd_find_port_guid(fabric, guid); @@ -758,6 +765,5 @@ close_port: close_node_name_map(node_name_map); - mad_rpc_close_port(ibmad_port); exit(rc); } diff -Nru infiniband-diags-1.6.5/src/ibqueryerrors.c infiniband-diags-1.6.6/src/ibqueryerrors.c --- infiniband-diags-1.6.5/src/ibqueryerrors.c 2015-01-28 16:15:20.000000000 +0000 +++ infiniband-diags-1.6.6/src/ibqueryerrors.c 2015-08-03 04:02:16.000000000 +0000 @@ -326,7 +326,9 @@ uint8_t reversible = 0; struct sa_handle * h; - h = sa_get_handle(); + if (!(h = sa_get_handle())) + return -1; + ibd_timeout = DEFAULT_HALF_WORLD_PR_TIMEOUT; memset(&pr, 0, sizeof(pr)); @@ -344,6 +346,7 @@ (uint16_t)IB_SA_ATTR_PATHRECORD,0,cl_ntoh64(comp_mask),ibd_sakey, &pr, sizeof(pr), &result); if (ret) { + sa_free_handle(h); fprintf(stderr, "Query SA failed: %s; sa call path_query failed\n", strerror(ret)); return ret; } @@ -355,6 +358,7 @@ insert_lid2sl_table(&result); Exit: + sa_free_handle(h); sa_free_result_mad(&result); return ret; } @@ -998,18 +1002,19 @@ config.flags = ibd_ibnetdisc_flags; config.mkey = ibd_mkey; - node_name_map = open_node_name_map(node_name_map_file); - if (dr_path && load_cache_file) { + mad_rpc_close_port(ibmad_port); fprintf(stderr, "Cannot specify cache and direct route path\n"); exit(-1); } if (resolve_self(ibd_ca, ibd_ca_port, &self_portid, &port, &self_gid.raw) < 0) { + mad_rpc_close_port(ibmad_port); IBEXIT("can't resolve self port %s", argv[0]); - goto close_port; } + node_name_map = open_node_name_map(node_name_map_file); + /* limit the scan the fabric around the target */ if (dr_path) { if ((resolved = @@ -1028,10 +1033,13 @@ lid2sl_table[portid.lid] = portid.sl; } + mad_rpc_close_port(ibmad_port); + if (load_cache_file) { if ((fabric = ibnd_load_fabric(load_cache_file, 0)) == NULL) { fprintf(stderr, "loading cached fabric failed\n"); - exit(-1); + rc = -1; + goto close_name_map; } } else { if (resolved >= 0) { @@ -1049,12 +1057,27 @@ &config))) { fprintf(stderr, "discover failed\n"); rc = -1; - goto close_port; + goto close_name_map; } } set_thresholds(threshold_file); + /* reopen the global ibmad_port */ + ibmad_port = mad_rpc_open_port(ibd_ca, ibd_ca_port, + mgmt_classes, 4); + if (!ibmad_port) { + ibnd_destroy_fabric(fabric); + close_node_name_map(node_name_map); + IBEXIT("Failed to reopen port: %s:%d\n", + ibd_ca, ibd_ca_port); + } + + smp_mkey_set(ibmad_port, ibd_mkey); + + if (ibd_timeout) + mad_rpc_set_timeout(ibmad_port, ibd_timeout); + if (port_guid_str) { ibnd_port_t *port = ibnd_find_port_guid(fabric, port_guid); if (port) @@ -1063,28 +1086,29 @@ fprintf(stderr, "Failed to find node: %s\n", port_guid_str); } else if (dr_path) { - ibnd_port_t *port = ibnd_find_port_dr(fabric, dr_path); + ibnd_port_t *port; uint8_t ni[IB_SMP_DATA_SIZE] = { 0 }; - if (!smp_query_via(ni, &portid, IB_ATTR_NODE_INFO, 0, - ibd_timeout, ibmad_port)) { - rc = -1; - goto destroy_fabric; + ibd_timeout, ibmad_port)) { + fprintf(stderr, "Failed to query local Node Info\n"); + goto close_port; } + mad_decode_field(ni, IB_NODE_PORT_GUID_F, &(port_guid)); port = ibnd_find_port_guid(fabric, port_guid); if (port) { if(obtain_sl) if(path_record_query(self_gid,port->guid)) - goto destroy_fabric; + goto close_port; print_node(port->node, NULL); } else fprintf(stderr, "Failed to find node: %s\n", dr_path); } else { if(obtain_sl) if(path_record_query(self_gid,0)) - goto destroy_fabric; + goto close_port; + ibnd_iter_nodes(fabric, print_node, NULL); } @@ -1092,11 +1116,11 @@ if (rc) rc = 1; -destroy_fabric: - ibnd_destroy_fabric(fabric); - close_port: mad_rpc_close_port(ibmad_port); + ibnd_destroy_fabric(fabric); + +close_name_map: close_node_name_map(node_name_map); exit(rc); } diff -Nru infiniband-diags-1.6.5/src/perfquery.c infiniband-diags-1.6.6/src/perfquery.c --- infiniband-diags-1.6.5/src/perfquery.c 2015-01-28 16:15:20.000000000 +0000 +++ infiniband-diags-1.6.6/src/perfquery.c 2015-10-13 03:28:23.000000000 +0000 @@ -327,7 +327,7 @@ if (!(cap_mask & IB_PM_EXT_WIDTH_SUPPORTED) && !(cap_mask & IB_PM_EXT_WIDTH_NOIETF_SUP)) IBWARN - ("PerfMgt ClassPortInfo 0x%x; No extended counter support indicated\n", + ("PerfMgt ClassPortInfo CapMask 0x%02X; No extended counter support indicated\n", ntohs(cap_mask)); memset(pc, 0, sizeof(pc)); @@ -469,7 +469,7 @@ uint16_t cap_mask) { uint8_t data[IB_SMP_DATA_SIZE] = { 0 }; - uint16_t fec_mode_active = 0; + uint32_t fec_mode_active = 0; uint32_t pie_capmask = 0; if (cap_mask & IS_PM_RSFEC_COUNTERS_SUP) { if (!is_port_info_extended_supported(portid, port, srcport)) { @@ -477,8 +477,8 @@ return 0; } - if (smp_query_via(data, portid, IB_ATTR_PORT_INFO_EXT, port, 0, - srcport) < 0) + if (!smp_query_via(data, portid, IB_ATTR_PORT_INFO_EXT, port, 0, + srcport)) IBEXIT("smp query portinfo extended failed"); mad_decode_field(data, IB_PORT_EXT_CAPMASK_F, &pie_capmask); @@ -486,7 +486,7 @@ &fec_mode_active); if((pie_capmask & CL_NTOH32(IB_PORT_EXT_CAP_IS_FEC_MODE_SUPPORTED)) && - (CL_NTOH16(IB_PORT_EXT_RS_FEC_MODE_ACTIVE) == fec_mode_active)) + (CL_NTOH16(IB_PORT_EXT_RS_FEC_MODE_ACTIVE) == (fec_mode_active & 0xffff))) return 1; } @@ -915,8 +915,8 @@ if (all_ports_loop || (loop_ports && (all_ports || port == ALL_PORTS))) { - if (smp_query_via(data, &portid, IB_ATTR_NODE_INFO, 0, 0, - srcport) < 0) + if (!smp_query_via(data, &portid, IB_ATTR_NODE_INFO, 0, 0, + srcport)) IBEXIT("smp query nodeinfo failed"); node_type = mad_get_field(data, 0, IB_NODE_TYPE_F); mad_decode_field(data, IB_NODE_NPORTS_F, &num_ports); @@ -924,8 +924,8 @@ IBEXIT("smp query nodeinfo: num ports invalid"); if (node_type == IB_NODE_SWITCH) { - if (smp_query_via(data, &portid, IB_ATTR_SWITCH_INFO, - 0, 0, srcport) < 0) + if (!smp_query_via(data, &portid, IB_ATTR_SWITCH_INFO, + 0, 0, srcport)) IBEXIT("smp query nodeinfo failed"); enhancedport0 = mad_get_field(data, 0, IB_SW_ENHANCED_PORT0_F); diff -Nru infiniband-diags-1.6.5/src/rdma-ndd.c infiniband-diags-1.6.6/src/rdma-ndd.c --- infiniband-diags-1.6.5/src/rdma-ndd.c 2015-01-28 19:12:33.000000000 +0000 +++ infiniband-diags-1.6.6/src/rdma-ndd.c 2015-09-19 21:56:45.000000000 +0000 @@ -58,9 +58,7 @@ #include "ibdiag_common.h" #define SYS_HOSTNAME "/proc/sys/kernel/hostname" -#define DEF_SYS_DIR "/sys" -char *sys_dir = DEF_SYS_DIR; -#define SYS_INFINIBAND "class/infiniband" +#define SYS_INFINIBAND "/sys/class/infiniband" #define DEFAULT_RETRY_RATE 60 #define DEFAULT_RETRY_COUNT 0 #define DEFAULT_ND_FORMAT "%h %d" @@ -68,6 +66,7 @@ int failure_retry_rate = DEFAULT_RETRY_RATE; int set_retry_cnt = DEFAULT_RETRY_COUNT; int foreground = 0; +char *pidfile = NULL; static void newline_to_null(char *str) { @@ -121,8 +120,8 @@ char nd_file[PATH_MAX]; FILE *f; - snprintf(nd_file, sizeof(nd_file), "%s/%s/%s/node_desc", - sys_dir, SYS_INFINIBAND, device); + snprintf(nd_file, sizeof(nd_file), SYS_INFINIBAND "/%s/node_desc", + device); nd_file[sizeof(nd_file)-1] = '\0'; f = fopen(nd_file, "r+"); @@ -146,7 +145,7 @@ syslog(LOG_INFO, "%s: change (%s) -> (%s)\n", device, nd, new_nd); rewind(f); - fprintf(f, new_nd); + fprintf(f, "%s", new_nd); } rc = 0; @@ -159,14 +158,10 @@ { DIR *class_dir; struct dirent *dent; - char dev_dir[PATH_MAX]; - snprintf(dev_dir, sizeof(dev_dir), "%s/%s", sys_dir, SYS_INFINIBAND); - dev_dir[sizeof(dev_dir)-1] = '\0'; - - class_dir = opendir(dev_dir); + class_dir = opendir(SYS_INFINIBAND); if (!class_dir) { - syslog(LOG_INFO, "Failed to open %s", dev_dir); + syslog(LOG_INFO, "Failed to open " SYS_INFINIBAND); return -ENOSYS; } @@ -205,6 +200,9 @@ { unsigned long tmp; switch (ch) { + case 0: + pidfile = optarg; + break; case 'f': foreground = 1; break; @@ -234,6 +232,7 @@ return 0; } +#if HAVE_UDEV_LOGGING #define MSG_MAX 2048 static void udev_log_fn(struct udev *ud, int priority, const char *file, int line, const char *fn, const char *format, va_list args) @@ -244,8 +243,9 @@ file, line, fn); if (off < MSG_MAX-1) vsnprintf(msg+off, MSG_MAX-off, format, args); - syslog(LOG_ERR, msg); + syslog(LOG_ERR, "%s", msg); } +#endif static void setup_udev(void) { @@ -255,10 +255,9 @@ return; } +#if HAVE_UDEV_LOGGING udev_set_log_fn(udev, udev_log_fn); udev_set_log_priority(udev, LOG_INFO); -#if HAVE_UDEV_GET_SYS_PATH - sys_dir = (char *)udev_get_sys_path(udev); #endif } @@ -352,6 +351,29 @@ } } +static void remove_pidfile(void) +{ + if (pidfile) + unlink(pidfile); +} + +static void write_pidfile(void) +{ + FILE *f; + if (pidfile) { + remove_pidfile(); + f = fopen(pidfile, "w"); + if (f) { + fprintf(f, "%d\n", getpid()); + fclose(f); + } else { + syslog(LOG_ERR, "Failed to write pidfile : %s\n", + pidfile); + exit(errno); + } + } +} + int main(int argc, char *argv[]) { int fd; @@ -368,6 +390,7 @@ "Number of times to attempt to retry setting " "of the node description on failure\n"}, {"foreground", 'f', 0, NULL, "run in the foreground instead of as a daemon\n"}, + {"pidfile", 0, 1, "", "specify a pid file (daemon mode only)\n"}, {0} }; @@ -377,8 +400,6 @@ if (!ibd_nd_format) ibd_nd_format = DEFAULT_ND_FORMAT; - setup_udev(); - if (!foreground) { closelog(); openlog("rdma-ndd", LOG_PID, LOG_DAEMON); @@ -386,8 +407,11 @@ syslog(LOG_ERR, "Failed to daemonize\n"); exit(errno); } + write_pidfile(); } + setup_udev(); + syslog(LOG_INFO, "Node Descriptor format (%s)\n", ibd_nd_format); fd = open(SYS_HOSTNAME, O_RDONLY); @@ -398,5 +422,7 @@ monitor(); + remove_pidfile(); + return 0; } diff -Nru infiniband-diags-1.6.5/src/saquery.c infiniband-diags-1.6.6/src/saquery.c --- infiniband-diags-1.6.5/src/saquery.c 2015-02-10 23:45:24.000000000 +0000 +++ infiniband-diags-1.6.6/src/saquery.c 2015-10-12 23:12:13.000000000 +0000 @@ -1567,6 +1567,7 @@ break; case 'D': node_print_desc = ALL_DESC; + command = SAQUERY_CMD_NODE_RECORD; break; case 'c': command = SAQUERY_CMD_CLASS_PORT_INFO; diff -Nru infiniband-diags-1.6.5/src/vendstat.c infiniband-diags-1.6.6/src/vendstat.c --- infiniband-diags-1.6.5/src/vendstat.c 2015-02-07 12:51:53.000000000 +0000 +++ infiniband-diags-1.6.6/src/vendstat.c 2015-08-03 04:02:16.000000000 +0000 @@ -172,13 +172,14 @@ call.attrid = attr_id; call.mod = attr_mod; - if (!ib_vendor_call_via(data, portid, &call, srcport)) - IBEXIT("vendstat: method %u, attribute %u", method, attr_id); - + if (!ib_vendor_call_via(data, portid, &call, srcport)) { + fprintf(stderr,"vendstat: method %u, attribute %u failure\n", method, attr_id); + return -1; + } return 0; } -static void do_config_space_records(ib_portid_t *portid, unsigned set, +static int do_config_space_records(ib_portid_t *portid, unsigned set, is3_config_space_t *cs, unsigned records) { unsigned i; @@ -194,17 +195,19 @@ if (do_vendor(portid, srcport, IB_MLX_VENDOR_CLASS, set ? IB_MAD_METHOD_SET : IB_MAD_METHOD_GET, IB_MLX_IS3_CONFIG_SPACE_ACCESS, 2 << 22 | records << 16, - cs)) - IBEXIT("cannot %s config space records", set ? "set" : "get"); - + cs)) { + fprintf(stderr,"cannot %s config space records\n", set ? "set" : "get"); + return -1; + } for (i = 0; i < records; i++) { printf("Config space record at 0x%x: 0x%x\n", ntohl(cs->record[i].address), ntohl(cs->record[i].data & cs->record[i].mask)); } + return 0; } -static void counter_groups_info(ib_portid_t * portid, int port) +static int counter_groups_info(ib_portid_t * portid, int port) { char buf[1024]; is4_counter_group_info_t *cg_info; @@ -213,15 +216,17 @@ /* Counter Group Info */ memset(&buf, 0, sizeof(buf)); if (do_vendor(portid, srcport, IB_MLX_VENDOR_CLASS, IB_MAD_METHOD_GET, - IB_MLX_IS4_COUNTER_GROUP_INFO, port, buf)) - IBEXIT("counter group info query"); - + IB_MLX_IS4_COUNTER_GROUP_INFO, port, buf)) { + fprintf(stderr,"counter group info query failure\n"); + return -1; + } cg_info = (is4_counter_group_info_t *) & buf; num_cg = cg_info->num_of_counter_groups; printf("counter_group_info:\n"); printf("%d counter groups\n", num_cg); for (i = 0; i < num_cg; i++) printf("group%d mask %#x\n", i, ntohl(cg_info->group_masks[i])); + return 0; } /* Group0 counter config values */ @@ -236,7 +241,7 @@ static int cg0, cg1; -static void config_counter_groups(ib_portid_t * portid, int port) +static int config_counter_groups(ib_portid_t * portid, int port) { char buf[1024]; is4_config_counter_groups_t *cg_config; @@ -251,15 +256,19 @@ cg_config->group_selects[1].group_select = (uint8_t) cg1; if (do_vendor(portid, srcport, IB_MLX_VENDOR_CLASS, IB_MAD_METHOD_SET, - IB_MLX_IS4_CONFIG_COUNTER_GROUP, port, buf)) - IBEXIT("config counter group set"); - + IB_MLX_IS4_CONFIG_COUNTER_GROUP, port, buf)) { + fprintf(stderr, "config counter group set failure\n"); + return -1; + } /* get config counter groups */ memset(&buf, 0, sizeof(buf)); if (do_vendor(portid, srcport, IB_MLX_VENDOR_CLASS, IB_MAD_METHOD_GET, - IB_MLX_IS4_CONFIG_COUNTER_GROUP, port, buf)) - IBEXIT("config counter group query"); + IB_MLX_IS4_CONFIG_COUNTER_GROUP, port, buf)) { + fprintf(stderr, "config counter group query failure\n"); + return -1; + } + return 0; } static int general_info, xmit_wait, counter_group_info, config_counter_group; @@ -364,20 +373,26 @@ if (argc) { if (resolve_portid_str(ibd_ca, ibd_ca_port, &portid, argv[0], - ibd_dest_type, ibd_sm_id, srcport) < 0) + ibd_dest_type, ibd_sm_id, srcport) < 0) { + mad_rpc_close_port(srcport); IBEXIT("can't resolve destination port %s", argv[0]); + } } else { - if (resolve_self(ibd_ca, ibd_ca_port, &portid, &port, 0) < 0) + if (resolve_self(ibd_ca, ibd_ca_port, &portid, &port, 0) < 0) { + mad_rpc_close_port(srcport); IBEXIT("can't resolve self port %s", argv[0]); + } } if (counter_group_info) { counter_groups_info(&portid, port); + mad_rpc_close_port(srcport); exit(0); } if (config_counter_group) { config_counter_groups(&portid, port); + mad_rpc_close_port(srcport); exit(0); } @@ -388,6 +403,7 @@ if (write_cs_records) do_config_space_records(&portid, 1, &write_cs, write_cs_records); + mad_rpc_close_port(srcport); exit(0); } @@ -395,23 +411,27 @@ /* but vendors change the VendorId so how know for sure ? */ /* Only General Info and Port Xmit Wait Counters */ /* queries are currently supported */ - if (!general_info && !xmit_wait) + if (!general_info && !xmit_wait) { + mad_rpc_close_port(srcport); IBEXIT("at least one of -N and -w must be specified"); - + } /* Would need a list of these and it might not be complete */ /* so for right now, punt on this */ /* vendor ClassPortInfo is required attribute if class supported */ memset(&buf, 0, sizeof(buf)); if (do_vendor(&portid, srcport, IB_MLX_VENDOR_CLASS, IB_MAD_METHOD_GET, - CLASS_PORT_INFO, 0, buf)) + CLASS_PORT_INFO, 0, buf)) { + mad_rpc_close_port(srcport); IBEXIT("classportinfo query"); - + } memset(&buf, 0, sizeof(buf)); gi_is3 = (is3_general_info_t *) &buf; if (do_vendor(&portid, srcport, IB_MLX_VENDOR_CLASS, IB_MAD_METHOD_GET, - IB_MLX_IS3_GENERAL_INFO, 0, gi_is3)) + IB_MLX_IS3_GENERAL_INFO, 0, gi_is3)) { + mad_rpc_close_port(srcport); IBEXIT("generalinfo query"); + } if (is_ext_fw_info_supported(ntohs(gi_is3->hw_info.device_id))) { gi_is4 = (is4_general_info_t *) &buf; @@ -452,10 +472,11 @@ is3_config_space_t *cs; unsigned i; - if (ntohs(gi_is3->hw_info.device_id) != IS3_DEVICE_ID) + if (ntohs(gi_is3->hw_info.device_id) != IS3_DEVICE_ID) { + mad_rpc_close_port(srcport); IBEXIT("Unsupported device ID 0x%x", ntohs(gi_is3->hw_info.device_id)); - + } memset(&buf, 0, sizeof(buf)); /* Set record addresses for each port */ cs = (is3_config_space_t *) & buf; @@ -464,9 +485,10 @@ htonl(IB_MLX_IS3_PORT_XMIT_WAIT + ((i + 1) << 12)); if (do_vendor(&portid, srcport, IB_MLX_VENDOR_CLASS, IB_MAD_METHOD_GET, IB_MLX_IS3_CONFIG_SPACE_ACCESS, - 2 << 22 | 16 << 16, cs)) + 2 << 22 | 16 << 16, cs)) { + mad_rpc_close_port(srcport); IBEXIT("vendstat"); - + } for (i = 0; i < 16; i++) if (cs->record[i].data) /* PortXmitWait is 32 bit counter */ printf("Port %d: PortXmitWait 0x%x\n", i + 4, ntohl(cs->record[i].data)); /* port 4 is first port */ @@ -480,8 +502,10 @@ htonl(IB_MLX_IS3_PORT_XMIT_WAIT + ((i + 17) << 12)); if (do_vendor(&portid, srcport, IB_MLX_VENDOR_CLASS, IB_MAD_METHOD_GET, IB_MLX_IS3_CONFIG_SPACE_ACCESS, - 2 << 22 | 8 << 16, cs)) + 2 << 22 | 8 << 16, cs)) { + mad_rpc_close_port(srcport); IBEXIT("vendstat"); + } for (i = 0; i < 8; i++) if (cs->record[i].data) /* PortXmitWait is 32 bit counter */