#This patch was developed both in-house and from outside. We plan to submit it
#upstream, but do not yet have a target date for doing so
#
# HG changeset patch
# Parent cf8932ef545e7bd7c1ae33792e8c4053f8832755
remove -ldevinfo for Makefile
revert back man8 to man1m
diff -r cf8932ef545e Makefile.in
--- a/Makefile.in Mon Apr 25 16:24:32 2016 -0700
+++ b/Makefile.in Tue Apr 26 09:44:44 2016 -0700
@@ -87,6 +87,7 @@
src/perfquery$(EXEEXT) src/sminfo$(EXEEXT) \
src/smpdump$(EXEEXT) src/smpquery$(EXEEXT) \
src/saquery$(EXEEXT) src/vendstat$(EXEEXT) \
+ src/solaris_set_nodedesc$(EXEEXT) \
src/iblinkinfo$(EXEEXT) src/ibqueryerrors$(EXEEXT) \
src/ibcacheedit$(EXEEXT) src/ibccquery$(EXEEXT) \
src/ibccconfig$(EXEEXT) src/dump_fts$(EXEEXT) $(am__EXEEXT_1) \
@@ -302,6 +303,7 @@
am_src_ibsysstat_OBJECTS = ibsysstat.$(OBJEXT)
src_ibsysstat_OBJECTS = $(am_src_ibsysstat_OBJECTS)
src_ibsysstat_LDADD = $(LDADD)
+src_ibsysstat_LDADD += "-libverbs"
src_ibsysstat_DEPENDENCIES = libcommon.a
am_src_ibtracert_OBJECTS = ibtracert.$(OBJEXT)
src_ibtracert_OBJECTS = $(am_src_ibtracert_OBJECTS)
@@ -339,6 +341,11 @@
src_vendstat_OBJECTS = $(am_src_vendstat_OBJECTS)
src_vendstat_LDADD = $(LDADD)
src_vendstat_DEPENDENCIES = libcommon.a
+am_src_solaris_set_nodedesc_OBJECTS = solaris_set_nodedesc.$(OBJEXT)
+src_solaris_set_nodedesc_OBJECTS = $(am_src_solaris_set_nodedesc_OBJECTS)
+src_solaris_set_nodedesc_LDADD = $(LDADD)
+src_solaris_set_nodedesc_LDADD += "-libverbs -ldevinfo"
+src_solaris_set_nodedesc_DEPENDENCIES = libcommon.a
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
@@ -412,7 +419,7 @@
$(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_vendstat_SOURCES) $(src_solaris_set_nodedesc_SOURCES)
DIST_SOURCES = $(libcommon_a_SOURCES) $(src_dump_fts_SOURCES) \
$(src_ibaddr_SOURCES) $(src_ibcacheedit_SOURCES) \
$(src_ibccconfig_SOURCES) $(src_ibccquery_SOURCES) \
@@ -424,7 +431,7 @@
$(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_vendstat_SOURCES) $(src_solaris_set_nodedesc_SOURCES)
RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \
ctags-recursive dvi-recursive html-recursive info-recursive \
install-data-recursive install-dvi-recursive \
@@ -438,7 +445,7 @@
n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \
esac
-man8dir = $(mandir)/man8
+man8dir = $(mandir)/man1m
NROFF = nroff
MANS = $(man_MANS)
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
@@ -877,6 +884,7 @@
src_saquery_SOURCES = src/saquery.c
src_ibsendtrap_SOURCES = src/ibsendtrap.c
src_vendstat_SOURCES = src/vendstat.c
+src_solaris_set_nodedesc_SOURCES = src/solaris_set_nodedesc.c
src_mcm_rereg_test_SOURCES = src/mcm_rereg_test.c
src_iblinkinfo_SOURCES = src/iblinkinfo.c
src_ibccquery_SOURCES = src/ibccquery.c
@@ -1088,8 +1096,8 @@
while read type dir files; do \
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
test -z "$$files" || { \
- echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \
- $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) -m 755 $$files '$(DESTDIR)$(sbindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) -m 755 $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
} \
; done
@@ -1207,6 +1215,10 @@
src/vendstat$(EXEEXT): $(src_vendstat_OBJECTS) $(src_vendstat_DEPENDENCIES) $(EXTRA_src_vendstat_DEPENDENCIES) src/$(am__dirstamp)
@rm -f src/vendstat$(EXEEXT)
$(AM_V_CCLD)$(LINK) $(src_vendstat_OBJECTS) $(src_vendstat_LDADD) $(LIBS)
+
+src/solaris_set_nodedesc$(EXEEXT): $(src_solaris_set_nodedesc_OBJECTS) $(src_solaris_set_nodedesc_DEPENDENCIES) $(EXTRA_src_solaris_set_nodedesc_DEPENDENCIES) src/$(am__dirstamp)
+ @rm -f src/solaris_set_nodedesc$(EXEEXT)
+ $(AM_V_CCLD)$(LINK) $(src_solaris_set_nodedesc_OBJECTS) $(src_solaris_set_nodedesc_LDADD) $(LIBS)
install-sbinSCRIPTS: $(sbin_SCRIPTS)
@$(NORMAL_INSTALL)
@list='$(sbin_SCRIPTS)'; test -n "$(sbindir)" || list=; \
@@ -1274,6 +1286,7 @@
@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)/vendstat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/solaris_set_nodedesc.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
@@ -1646,6 +1659,20 @@
@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 vendstat.obj `if test -f 'src/vendstat.c'; then $(CYGPATH_W) 'src/vendstat.c'; else $(CYGPATH_W) '$(srcdir)/src/vendstat.c'; fi`
+solaris_set_nodedesc.o: src/solaris_set_nodedesc.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT solaris_set_nodedesc.o -MD -MP -MF $(DEPDIR)/solaris_set_nodedesc.Tpo -c -o solaris_set_nodedesc.o `test -f 'src/solaris_set_nodedesc.c' || echo '$(srcdir)/'`src/solaris_set_nodedesc.c
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/solaris_set_nodedesc.Tpo $(DEPDIR)/solaris_set_nodedec.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/solaris_set_nodedesc.c' object='solaris_set_nodedesc.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 solaris_set_nodedesc.o `test -f 'src/solaris_set_nodedesc.c' || echo '$(srcdir)/'`src/solaris_set_nodedesc.c
+
+solaris_set_nodedesc.obj: src/solaris_set_nodedesc.c
+@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT solaris_set_nodedesc.obj -MD -MP -MF $(DEPDIR)/solaris_set_nodedesc.Tpo -c -o solaris_set_nodedesc.obj `if test -f 'src/solaris_set_nodedesc.c'; then $(CYGPATH_W) 'src/solaris_set_nodedesc.c'; else $(CYGPATH_W) '$(srcdir)/src/solaris_set_nodedesc.c'; fi`
+@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/solaris_set_nodedesc.Tpo $(DEPDIR)/solaris_set_nodedesc.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/solaris_set_nodedesc.c' object='solaris_set_nodedesc.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 solaris_set_nodedesc.obj `if test -f 'src/solaris_set_nodedesc.c'; then $(CYGPATH_W) 'src/solaris_set_nodedesc.c'; else $(CYGPATH_W) '$(srcdir)/src/solaris_set_nodedesc.c'; fi`
+
mostlyclean-libtool:
-rm -f *.lo
@@ -1677,6 +1704,10 @@
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
sed 'N;N;s,\n, ,g' | { \
list=; while read file base inst; do \
+ ext='1m'; \
+ inst=`echo $$inst | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ inst=`echo $$inst | sed -e 's/^.*\///'`; \
+ inst=`echo $$inst | sed '$(transform)'`.$$ext; \
if test "$$base" = "$$inst"; then list="$$list $$file"; else \
echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \
$(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \
@@ -1697,6 +1728,10 @@
sed -n '/\.8[a-z]*$$/p'; \
} | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
-e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+ ext='1m'; \
+ files=`echo $$files | sed -e 's/\\.[0-9a-z]*$$//'`; \
+ files=`echo $$files | sed -e 's/^.*\///'`; \
+ files=`echo $$files | sed '$(transform)'`.$$ext; \
dir='$(DESTDIR)$(man8dir)'; $(am__uninstall_files_from_dir)
# This directory's subdirectories are mostly independent; you can cd
diff -r cf8932ef545e configure
--- a/configure Mon Apr 25 16:24:32 2016 -0700
+++ b/configure Tue Apr 26 09:44:44 2016 -0700
@@ -9739,6 +9739,7 @@
;;
esac
link_all_deplibs=yes
+ hardcode_libdir_flag_spec=
;;
sunos4*)
@@ -11822,7 +11823,7 @@
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
-LIBS="-losmcomp $LIBS"
+LIBS="$LDFLAGS -losmcomp $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
diff -r cf8932ef545e libibnetdisc/src/internal.h
--- a/libibnetdisc/src/internal.h Mon Apr 25 16:24:32 2016 -0700
+++ b/libibnetdisc/src/internal.h Tue Apr 26 09:44:44 2016 -0700
@@ -42,12 +42,56 @@
#include <complib/cl_qmap.h>
#include <glib.h>
+#if defined(__SVR4) && defined(__sun)
+#include <sys/varargs.h>
+
+static inline void
+ibnd_msg_internal(FILE *fd, const char *format, va_list alist)
+{
+ const char *filename;
+ char *filename_p;
+ char *format_p = format;
+
+ /*
+ * The filename returned by va_arg() has the full path. Skip "%s"
+ * from format="%s:%u; " and truncate full pathname of src file to
+ * start with infiniband-diags.
+ */
+ filename = va_arg(alist, const char *);
+ format_p += 2;
+ if ((filename_p = strstr(filename, "infiniband-diags-")) != NULL) {
+ (void) fprintf(fd, "%s", filename_p);
+ (void) vfprintf(fd, format_p, alist);
+ } else {
+ (void) fprintf(fd, "%s", filename);
+ (void) vfprintf(fd, format_p, alist);
+ }
+}
+
+static inline void
+ibnd_msg(FILE *fd, const char *format, ...)
+{
+ va_list alist;
+
+ va_start(alist, format);
+ ibnd_msg_internal(fd, format, alist);
+ va_end(alist);
+}
+
+#define IBND_DEBUG(fmt, ...) \
+ if (ibdebug) { \
+ ibnd_msg(stdout, "%s:%u; " fmt, __FILE__, __LINE__, ## __VA_ARGS__); \
+ }
+#define IBND_ERROR(fmt, ...) \
+ ibnd_msg(stderr, "%s:%u; " fmt, __FILE__, __LINE__, ## __VA_ARGS__)
+#else
#define IBND_DEBUG(fmt, ...) \
if (ibdebug) { \
printf("%s:%u; " fmt, __FILE__, __LINE__, ## __VA_ARGS__); \
}
#define IBND_ERROR(fmt, ...) \
fprintf(stderr, "%s:%u; " fmt, __FILE__, __LINE__, ## __VA_ARGS__)
+#endif
/* HASH table defines */
#define HASHGUID(guid) ((uint32_t)(((uint32_t)(guid) * 101) ^ ((uint32_t)((guid) >> 32) * 103)))
diff -r cf8932ef545e libibnetdisc/src/query_smp.c
--- a/libibnetdisc/src/query_smp.c Mon Apr 25 16:24:32 2016 -0700
+++ b/libibnetdisc/src/query_smp.c Tue Apr 26 09:44:44 2016 -0700
@@ -165,7 +165,7 @@
uint8_t *mad;
uint32_t trid;
uint8_t umad[sizeof(struct ib_user_mad) + IB_MAD_SIZE];
- int length = umad_size() + IB_MAD_SIZE;
+ int length = IB_MAD_SIZE;
memset(umad, 0, sizeof(umad));
diff -r cf8932ef545e scripts/IBswcountlimits.pm
--- a/scripts/IBswcountlimits.pm Mon Apr 25 16:24:32 2016 -0700
+++ b/scripts/IBswcountlimits.pm Tue Apr 26 09:44:44 2016 -0700
@@ -261,7 +261,8 @@
my $cache_file = get_cache_file($ca_name, $ca_port);
my $extra_params = get_ca_name_port_param_string($ca_name, $ca_port);
- if (`ibnetdiscover -g $extra_params > $cache_file`) {
+ my $rc = `ibnetdiscover -g $extra_params > $cache_file`;
+ if ("$?" ne "0") {
die "Execution of ibnetdiscover failed: $!\n";
}
}
diff -r cf8932ef545e scripts/ibcheckerrors.in
--- a/scripts/ibcheckerrors.in Mon Apr 25 16:24:32 2016 -0700
+++ b/scripts/ibcheckerrors.in Tue Apr 26 09:44:44 2016 -0700
@@ -74,7 +74,7 @@
text="`eval $netcmd`"
rv=$?
-echo "$text" | awk '
+echo "$text" | gawk '
BEGIN {
ne=0
}
diff -r cf8932ef545e scripts/ibcheckerrs.in
--- a/scripts/ibcheckerrs.in Mon Apr 25 16:24:32 2016 -0700
+++ b/scripts/ibcheckerrs.in Tue Apr 26 09:44:44 2016 -0700
@@ -144,7 +144,7 @@
fi
if [ "$guid_addr" ]; then
- if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | awk '/failed/{exit -1} {print $3}'`; then
+ if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | gawk '/failed/{exit -1} {print $3}'`; then
echo -n "guid $1 address resolution: "
red "FAILED"
exit -1
@@ -152,7 +152,7 @@
guid=$1
else
lid=$1
- if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | awk '/failed/{exit -1} {print $1}'`; then
+ if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | gawk '/failed/{exit -1} {print $1}'`; then
echo -n "lid $1 address resolution: "
red "FAILED"
exit -1
@@ -171,7 +171,7 @@
exit 0
fi
-if echo "$text" | awk -v mono=$bw -v brief=$brief -F '[.:]*' '
+if echo "$text" | gawk -v mono=$bw -v brief=$brief -F '[.:]*' '
function blue(s)
{
if (brief == "yes") {
diff -r cf8932ef545e scripts/ibchecknet.in
--- a/scripts/ibchecknet.in Mon Apr 25 16:24:32 2016 -0700
+++ b/scripts/ibchecknet.in Tue Apr 26 09:44:44 2016 -0700
@@ -67,7 +67,7 @@
text="`eval $netcmd`"
rv=$?
-echo "$text" | awk '
+echo "$text" | gawk '
BEGIN {
ne=0
pe=0
diff -r cf8932ef545e scripts/ibchecknode.in
--- a/scripts/ibchecknode.in Mon Apr 25 16:24:32 2016 -0700
+++ b/scripts/ibchecknode.in Tue Apr 26 09:44:44 2016 -0700
@@ -79,14 +79,14 @@
fi
if [ "$guid_addr" ]; then
- if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | awk '/failed/{exit -1} {print $3}'`; then
+ if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | gawk '/failed/{exit -1} {print $3}'`; then
echo -n "guid $1 address resolution: "
red "FAILED"
exit -1
fi
else
lid=$1
- if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | awk '/failed/{exit -1} {print $1}'`; then
+ if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | gawk '/failed/{exit -1} {print $1}'`; then
echo -n "lid $1 address resolution: "
red "FAILED"
exit -1
diff -r cf8932ef545e scripts/ibcheckport.in
--- a/scripts/ibcheckport.in Mon Apr 25 16:24:32 2016 -0700
+++ b/scripts/ibcheckport.in Tue Apr 26 09:44:44 2016 -0700
@@ -81,7 +81,7 @@
fi
if [ "$guid_addr" ]; then
- if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | awk '/failed/{exit -1} {print $3}'`; then
+ if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | gawk '/failed/{exit -1} {print $3}'`; then
echo -n "guid $1 address resolution: "
red "FAILED"
exit -1
@@ -89,14 +89,14 @@
guid=$1
else
lid=$1
- if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | awk '/failed/{exit -1} {print $1}'`; then
+ if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | gawk '/failed/{exit -1} {print $1}'`; then
echo -n "lid $1 address resolution: "
red "FAILED"
exit -1
fi
fi
-is_switch=`$IBPATH/smpquery $ca_info nodeinfo $lid $portnum | awk -F '[.:]*' '/^NodeType/{ if ($2 == "Switch") {print 1}}'`
+is_switch=`$IBPATH/smpquery $ca_info nodeinfo $lid $portnum | gawk -F '[.:]*' '/^NodeType/{ if ($2 == "Switch") {print 1}}'`
if [ "$is_switch" -a "$portnum" == "0" ]; then
ignore_check=true
@@ -104,7 +104,7 @@
text="`eval $IBPATH/smpquery $ca_info portinfo $lid $portnum`"
rv=$?
-if echo "$text" | awk -v ignore_check=$ignore_check -v mono=$bw -F '[.:]*' '
+if echo "$text" | gawk -v ignore_check=$ignore_check -v mono=$bw -F '[.:]*' '
function blue(s)
{
if (mono)
diff -r cf8932ef545e scripts/ibcheckportstate.in
--- a/scripts/ibcheckportstate.in Mon Apr 25 16:24:32 2016 -0700
+++ b/scripts/ibcheckportstate.in Tue Apr 26 09:44:44 2016 -0700
@@ -81,7 +81,7 @@
fi
if [ "$guid_addr" ]; then
- if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | awk '/failed/{exit -1} {print $3}'`; then
+ if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | gawk '/failed/{exit -1} {print $3}'`; then
echo -n "guid $1 address resolution: "
red "FAILED"
exit -1
@@ -89,7 +89,7 @@
guid=$1
else
lid=$1
- if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | awk '/failed/{exit -1} {print $1}'`; then
+ if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | gawk '/failed/{exit -1} {print $1}'`; then
echo -n "lid $1 address resolution: "
red "FAILED"
exit -1
@@ -99,7 +99,7 @@
text="`eval $IBPATH/smpquery $ca_info portinfo $lid $portnum`"
rv=$?
-if echo "$text" | awk -v mono=$bw -F '[.:]*' '
+if echo "$text" | gawk -v mono=$bw -F '[.:]*' '
function blue(s)
{
if (mono)
diff -r cf8932ef545e scripts/ibcheckportwidth.in
--- a/scripts/ibcheckportwidth.in Mon Apr 25 16:24:32 2016 -0700
+++ b/scripts/ibcheckportwidth.in Tue Apr 26 09:44:44 2016 -0700
@@ -81,7 +81,7 @@
fi
if [ "$guid_addr" ]; then
- if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | awk '/failed/{exit -1} {print $3}'`; then
+ if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | gawk '/failed/{exit -1} {print $3}'`; then
echo -n "guid $1 address resolution: "
red "FAILED"
exit -1
@@ -89,7 +89,7 @@
guid=$1
else
lid=$1
- if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | awk '/failed/{exit -1} {print $1}'`; then
+ if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | gawk '/failed/{exit -1} {print $1}'`; then
echo -n "lid $1 address resolution: "
red "FAILED"
exit -1
@@ -99,7 +99,7 @@
text="`eval $IBPATH/smpquery $ca_info portinfo $lid $portnum`"
rv=$?
-if echo "$text" | awk -v mono=$bw -F '[.:]*' '
+if echo "$text" | gawk -v mono=$bw -F '[.:]*' '
function blue(s)
{
if (mono)
diff -r cf8932ef545e scripts/ibcheckstate.in
--- a/scripts/ibcheckstate.in Mon Apr 25 16:24:32 2016 -0700
+++ b/scripts/ibcheckstate.in Tue Apr 26 09:44:44 2016 -0700
@@ -69,7 +69,7 @@
text="`eval $netcmd`"
rv=$?
-echo "$text" | awk '
+echo "$text" | gawk '
BEGIN {
ne=0
pe=0
diff -r cf8932ef545e scripts/ibcheckwidth.in
--- a/scripts/ibcheckwidth.in Mon Apr 25 16:24:32 2016 -0700
+++ b/scripts/ibcheckwidth.in Tue Apr 26 09:44:44 2016 -0700
@@ -69,7 +69,7 @@
text="`eval $netcmd`"
rv=$?
-echo "$text" | awk '
+echo "$text" | gawk '
BEGIN {
ne=0
pe=0
diff -r cf8932ef545e scripts/ibclearcounters.in
--- a/scripts/ibclearcounters.in Mon Apr 25 16:24:32 2016 -0700
+++ b/scripts/ibclearcounters.in Tue Apr 26 09:44:44 2016 -0700
@@ -59,7 +59,7 @@
text="`eval $netcmd`"
rv=$?
-echo "$text" | awk '
+echo "$text" | gawk '
function clear_counters(lid)
{
diff -r cf8932ef545e scripts/ibclearerrors.in
--- a/scripts/ibclearerrors.in Mon Apr 25 16:24:32 2016 -0700
+++ b/scripts/ibclearerrors.in Tue Apr 26 09:44:44 2016 -0700
@@ -63,7 +63,7 @@
text="`eval $netcmd`"
rv=$?
-echo "$text" | awk '
+echo "$text" | gawk '
function clear_all_errors(lid, port)
{
diff -r cf8932ef545e scripts/ibdatacounters.in
--- a/scripts/ibdatacounters.in Mon Apr 25 16:24:32 2016 -0700
+++ b/scripts/ibdatacounters.in Tue Apr 26 09:44:44 2016 -0700
@@ -74,7 +74,7 @@
text="`eval $netcmd`"
rv=$?
-echo "$text" | awk '
+echo "$text" | gawk '
BEGIN {
ne=0
}
diff -r cf8932ef545e scripts/ibdatacounts.in
--- a/scripts/ibdatacounts.in Mon Apr 25 16:24:32 2016 -0700
+++ b/scripts/ibdatacounts.in Tue Apr 26 09:44:44 2016 -0700
@@ -95,7 +95,7 @@
fi
if [ "$guid_addr" ]; then
- if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | awk '/failed/{exit -1} {print $3}'`; then
+ if ! lid=`$IBPATH/ibaddr $ca_info -G -L $1 | gawk '/failed/{exit -1} {print $3}'`; then
echo -n "guid $1 address resolution: "
red "FAILED"
exit -1
@@ -103,7 +103,7 @@
guid=$1
else
lid=$1
- if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | awk '/failed/{exit -1} {print $1}'`; then
+ if ! temp=`$IBPATH/ibaddr $ca_info -L $1 | gawk '/failed/{exit -1} {print $1}'`; then
echo -n "lid $1 address resolution: "
red "FAILED"
exit -1
@@ -118,7 +118,7 @@
text="`eval $IBPATH/perfquery $ca_info $lid $portnum`"
rv=$?
-if echo "$text" | awk -v mono=$bw -v brief=$brief -F '[.:]*' '
+if echo "$text" | gawk -v mono=$bw -v brief=$brief -F '[.:]*' '
function blue(s)
{
if (brief == "yes") {
diff -r cf8932ef545e scripts/ibdiscover.pl
--- a/scripts/ibdiscover.pl Mon Apr 25 16:24:32 2016 -0700
+++ b/scripts/ibdiscover.pl Tue Apr 26 09:44:44 2016 -0700
@@ -53,9 +53,10 @@
$localGuid = $local;
} else {
($localPort, $type, $remoteGuid, $remotePort) =
- /([\s\S]*)"([SH])\-000([a-f\d]*)"([\s\S]*)\n/;
+ /([\s\S]*)"([SH])\-([a-f\d]*)"([\s\S]*)\n/;
($localPort) = $localPort =~ /\[(\d*)]/;
($remotePort) = $remotePort =~ /\[(\d*)]/;
+ $remoteGuid =~ s/^0*//;
if ($remoteGuid ne "" && $localPort ne "") {
printf(TOPO2 "%d|%s|%d|%s\n",
$localPort, $localGuid, $remotePort, $remoteGuid);
diff -r cf8932ef545e scripts/ibhosts.in
--- a/scripts/ibhosts.in Mon Apr 25 16:24:32 2016 -0700
+++ b/scripts/ibhosts.in Tue Apr 26 09:44:44 2016 -0700
@@ -49,7 +49,7 @@
text="`eval $netcmd`"
rv=$?
-echo "$text" | awk '
+echo "$text" | gawk '
/^Ca/ {print $1 "\t: 0x" substr($3, 4, 16) " ports " $2 " "\
substr($0, match($0, "#[ \t]*")+RLENGTH)}
/^ib/ {print $0; next}
diff -r cf8932ef545e scripts/ibprintca.pl
--- a/scripts/ibprintca.pl Mon Apr 25 16:24:32 2016 -0700
+++ b/scripts/ibprintca.pl Tue Apr 26 09:44:44 2016 -0700
@@ -86,7 +86,7 @@
if ($list_hcas) {
system("ibhosts $cache_file");
- exit 1;
+ exit $?;
}
if ($target_hca eq "") {
diff -r cf8932ef545e scripts/ibprintrt.pl
--- a/scripts/ibprintrt.pl Mon Apr 25 16:24:32 2016 -0700
+++ b/scripts/ibprintrt.pl Tue Apr 26 09:44:44 2016 -0700
@@ -86,7 +86,7 @@
if ($list_rts) {
system("ibrouters $cache_file");
- exit 1;
+ exit $?;
}
if ($target_rt eq "") {
diff -r cf8932ef545e scripts/ibprintswitch.pl
--- a/scripts/ibprintswitch.pl Mon Apr 25 16:24:32 2016 -0700
+++ b/scripts/ibprintswitch.pl Tue Apr 26 09:44:44 2016 -0700
@@ -86,7 +86,7 @@
if ($list_switches) {
system("ibswitches $cache_file");
- exit 1;
+ exit $?;
}
if ($target_switch eq "") {
diff -r cf8932ef545e scripts/ibrouters.in
--- a/scripts/ibrouters.in Mon Apr 25 16:24:32 2016 -0700
+++ b/scripts/ibrouters.in Tue Apr 26 09:44:44 2016 -0700
@@ -49,7 +49,7 @@
text="`eval $netcmd`"
rv=$?
-echo "$text" | awk '
+echo "$text" | gawk '
/^Rt/ {print $1 "\t: 0x" substr($3, 4, 16) " ports " $2 " "\
substr($0, match($0, "#[ \t]*")+RLENGTH)}
/^ib/ {print $0; next}
diff -r cf8932ef545e scripts/ibstatus
--- a/scripts/ibstatus Mon Apr 25 16:24:32 2016 -0700
+++ b/scripts/ibstatus Tue Apr 26 09:44:44 2016 -0700
@@ -2,66 +2,137 @@
# Usage ibstatus [devname[:port]]
-infiniband_base="/sys/class/infiniband"
-def_ibdev="mthca0"
+ibvdevinfo="/usr/bin/ibv_devinfo"
+ibvdevinfo_results="/tmp/ibvdevinfo.output.$$"
+tmpout="/tmp/tmpout.$$"
usage() {
prog=`basename $0`
echo "Usage: " $prog " [-h] [devname[:portnum]]"
echo " -h: this help screen"
echo " Examples:"
- echo " $prog mthca1 # shows status of all ports of 'mthca1'"
- echo " $prog mthca0:2 # shows status port number 2 of 'mthca0'"
- echo " $prog # default: shows status of all '$def_ibdev' ports"
- exit -1
+ echo " $prog mlx4_1 # shows status of all ports of 'mlx4_1'"
+ echo " $prog mlx4_0:2 # shows status port number 2 of 'mlx4_0'"
+ echo " $prog # default: shows status of all IB ports"
+ exit 0
}
-fatal() {
- echo "Fatal error: " $*
- exit -1
-}
-
-
-port_status() {
- port_dir="$infiniband_base/$1/ports/$2"
- echo "Infiniband device '$1' port $2 status:"
- echo " default gid: " `[ -r $port_dir/gids/0 ] && cat $port_dir/gids/0 || echo unknown`
- echo " base lid: " `[ -r $port_dir/lid ] && cat $port_dir/lid || echo unknown`
- echo " sm lid: " `[ -r $port_dir/sm_lid ] && cat $port_dir/sm_lid || echo unknown`
- echo " state: " `[ -r $port_dir/state ] && cat $port_dir/state || echo unknown`
- echo " phys state: " `[ -r $port_dir/phys_state ] && cat $port_dir/phys_state || echo unknown`
- echo " rate: " `[ -r $port_dir/rate ] && cat $port_dir/rate || echo unknown`
- echo " link_layer: " `[ -r $port_dir/link_layer ] && cat $port_dir/link_layer || echo IB`
- echo
-}
-
-ib_status() {
- ports_dir="$infiniband_base/$1/ports"
-
- if ! [ -d "$ports_dir" ]; then
- fatal "device '$1': sys files not found ($ports_dir)"
- fi
-
- if [ "$2" = "+" ]; then
- ports=`(cd "$infiniband_base/$1/ports" 2>/dev/null || fatal No devices; echo *)`
- else
- ports=$2
- fi
-
- for i in $ports; do
- port_status $1 $i
- done
+get_status_ports() {
+ nawk '
+ BEGIN {
+ hcaid_in="'"$1"'"
+ port_in="'"$2"'"
+ if (hcaid_in == "+") {
+ hcaid_hit=1
+ if (port_in == "+")
+ port_hit=1
+ }
+ }
+ {
+ if ($0 ~ "hca_id") {
+ if (hcaid_in == "+") {
+ cur_hcaid = $2
+ } else if (hcaid_in == $2) {
+ hcaid_hit=1
+ if (port_in == "+")
+ port_hit=1
+ } else if (hcaid_hit == 1)
+ exit 0
+ }
+ if (hcaid_hit == 1) {
+ if ($0 ~ "port:") {
+ if (port_in == "+") {
+ cur_port=$2;
+ } else if (port_in == $2) {
+ port_hit=1
+ } else if (port_hit == 1)
+ exit 0
+ }
+ }
+ if (hcaid_hit == 1 && port_hit == 1) {
+ if ($0 ~ "state:" && $0 !~ "phys_state:") {
+ state=$2;
+ staten=$3
+ } else if ($0 ~ "sm_lid:") {
+ sm_lid=$2
+ } else if ($0 ~ "port_lid:") {
+ port_lid=$2
+ } else if ($0 ~ "active_width:") {
+ width = $2
+ sub("X$", "", width)
+ } else if ($0 ~ "active_speed:") {
+ speed=$2
+ } else if ($0 ~ "phys_state:") {
+ pstate=$2
+ pstaten=$3
+ } else if ($0 ~ "link_layer:") {
+ link=$2
+ } else if ($0 ~ "GID"){
+ gid=$NF
+ if (hcaid_in == "+") {
+ printf("Infiniband device '\''%s'\'' port %d status:\n", cur_hcaid, cur_port);
+ } else if (port_in == "+") {
+ printf("Infiniband device '\''%s'\'' port %d status:\n", hcaid_in, cur_port);
+ } else {
+ printf("Infiniband device '\''%s'\'' port %d status:\n", hcaid_in, port_in);
+ }
+ printf("\tdefault gid:\t%s\n", gid)
+ printf("\tstate:\t\t%d: %s\n", staten, state);
+ printf("\tphys state:\t%d: %s\n", pstaten, pstate);
+ printf("\tsm lid:\t\t0x%x\n", sm_lid)
+ printf("\tbase lid:\t0x%x\n", port_lid)
+ printf("\trate:\t\t%d Gb/sec (%dX)\n", width * speed, width)
+ printf("\tlink_layer:\t%s\n\n", link);
+ }
+ }
+ }
+ END {
+ if (hcaid_in != "+" && port_in == "+" && hcaid_hit == 0) {
+ printf("Fatal error: device '\''%s'\'' not found\n\n", hcaid_in)
+ exit 1;
+ }
+ if (hacid_in != "+" && port_in != "+" && port_hit == 0) {
+ printf("Fatal error: port '\''%s:%d'\'' not found\n\n", hcaid_in, port_in)
+ exit 1;
+ }
+ }' $tmpout
}
if [ "$1" = "-h" ]; then
usage
fi
+# Check to see if /usr/bin/ibv_devinfo exists.
+if [ ! -x $ibvdevinfo ]; then
+ echo "$ibvdevinfo doesn't exist!"
+ exit 1
+fi
+
+# Run ibv_devinfo and direct the output to $ibvdevinfo_results.
+$ibvdevinfo -v > $ibvdevinfo_results
+if [ $? != 0 ]; then
+ echo "$ibvdevinfo failed!"
+ exit 1
+fi
+#
+
+nhcas=`$ibvdevinfo -l | awk '/HCA/{print $1}'`
+if [ -z $nhcas ]; then
+ echo "No HCAs!"
+ rm -f $ibvdevinfo_results
+ exit 1
+fi
+
+egrep "port:|hca_id:|_lid|GID|state:|active_|link_layer:" $ibvdevinfo_results |grep -v _mtu | sed -e 's/(//' -e 's/)//' > $tmpout
+rm -f $ibvdevinfo_results
+
if [ -z "$1" ]; then
- cd $infiniband_base 2>/dev/null || fatal No devices
- for dev in *; do
- ib_status $dev "+";
- done
+ get_status_ports "+" "+"
+ if [ $? != 0 ]; then
+ rm -f $tmpout
+ exit 1
+ fi
+ rm -f $tmpout
exit 0
fi
@@ -73,6 +144,12 @@
port="+"
fi
- ib_status $dev $port
+ get_status_ports $dev $port
+ if [ $? != 0 ]; then
+ rm -f $tmpout
+ exit 1
+ fi
+
shift
done
+rm -f $tmpout
diff -r cf8932ef545e scripts/ibswitches.in
--- a/scripts/ibswitches.in Mon Apr 25 16:24:32 2016 -0700
+++ b/scripts/ibswitches.in Tue Apr 26 09:44:44 2016 -0700
@@ -49,7 +49,7 @@
text="`eval $netcmd`"
rv=$?
-echo "$text" | awk '
+echo "$text" | gawk '
/^Switch/ {
l=$0
desc=substr(l, match(l, "#[ \t]*")+RLENGTH)
diff -r cf8932ef545e scripts/set_nodedesc.sh
--- a/scripts/set_nodedesc.sh Mon Apr 25 16:24:32 2016 -0700
+++ b/scripts/set_nodedesc.sh Tue Apr 26 09:44:44 2016 -0700
@@ -1,5 +1,13 @@
#!/bin/sh
+# Call solaris_set_nodedesc, if operating system is SunOS
+os=`uname -s`
+if [ $os == "SunOS" ]; then
+ solaris_set_nodedesc "$@"
+ rc=$?
+ exit $rc
+fi
+
if [ -f /etc/sysconfig/network ]; then
. /etc/sysconfig/network
fi
diff -r cf8932ef545e src/ibnetdiscover.c
--- a/src/ibnetdiscover.c Mon Apr 25 16:24:32 2016 -0700
+++ b/src/ibnetdiscover.c Tue Apr 26 09:44:44 2016 -0700
@@ -582,7 +582,7 @@
}
fprintf(f, "\n# Spine Nodes");
- for (n = 1; n <= SPINES_MAX_NUM; n++) {
+ for (n = 0; n < SPINES_MAX_NUM; n++) {
if (ch->spinenode[n]) {
out_switch(ch->spinenode[n], group,
chname, NULL, NULL);
@@ -599,7 +599,7 @@
}
}
fprintf(f, "\n# Line Nodes");
- for (n = 1; n <= LINES_MAX_NUM; n++) {
+ for (n = 0; n < LINES_MAX_NUM; n++) {
if (ch->linenode[n]) {
out_switch(ch->linenode[n], group,
chname, NULL, NULL);
diff -r cf8932ef545e src/ibportstate.c
--- a/src/ibportstate.c Mon Apr 25 16:24:32 2016 -0700
+++ b/src/ibportstate.c Tue Apr 26 09:44:44 2016 -0700
@@ -382,6 +382,7 @@
int portnum = 0;
ib_portid_t selfportid = { 0 };
int selfport = 0;
+ int switch_lid = 0;
int changed = 0;
int i;
uint16_t devid, rem_devid;
@@ -515,6 +516,12 @@
port_op = QUERY;
is_switch = get_node_info(&portid, data);
+ if (!is_switch && (port_op == RESET || port_op == DISABLE ||
+ port_op == ENABLE)) {
+ mad_rpc_close_port(srcport);
+ exit(-1);
+ }
+
devid = (uint16_t) mad_get_field(data, 0, IB_NODE_DEVID_F);
if ((port_args[MKEY].set || port_args[MKEYLEASE].set ||
@@ -653,6 +660,12 @@
&lsee);
}
+ /* Get Switch LID from the default switch port */
+ if (!smp_query_via(data, &portid, IB_ATTR_PORT_INFO, 0, 0, srcport))
+ IBEXIT("could not get port LID");
+
+ switch_lid = mad_get_field(data, 0, IB_PORT_LID_F);
+
/* Setup portid for peer port */
memcpy(&peerportid, &portid, sizeof(peerportid));
peerportid.drpath.cnt = 1;
@@ -662,6 +675,7 @@
if (resolve_self(ibd_ca, ibd_ca_port, &selfportid,
&selfport, 0) < 0)
IBEXIT("could not resolve self");
+ peerportid.lid = switch_lid;
peerportid.drpath.drslid = (uint16_t) selfportid.lid;
peerportid.drpath.drdlid = 0xffff;
diff -r cf8932ef545e src/ibstat.c
--- a/src/ibstat.c Mon Apr 25 16:24:32 2016 -0700
+++ b/src/ibstat.c Tue Apr 26 09:44:44 2016 -0700
@@ -54,7 +54,7 @@
#include <ibdiag_common.h>
static char *node_type_str[] = {
- "???",
+ "Unknown",
"CA",
"Switch",
"Router",
@@ -67,11 +67,11 @@
return;
printf("%s '%s'\n",
((unsigned)ca->node_type <=
- IB_NODE_MAX ? node_type_str[ca->node_type] : "???"),
+ IB_NODE_MAX ? node_type_str[ca->node_type] : "Unknown"),
ca->ca_name);
printf("\t%s type: %s\n",
((unsigned)ca->node_type <=
- IB_NODE_MAX ? node_type_str[ca->node_type] : "???"),
+ IB_NODE_MAX ? node_type_str[ca->node_type] : "Unknown"),
ca->ca_type);
printf("\tNumber of ports: %d\n", ca->numports);
printf("\tFirmware version: %s\n", ca->fw_ver);
@@ -82,7 +82,7 @@
}
static char *port_state_str[] = {
- "???",
+ "Unknown",
"Down",
"Initializing",
"Armed",
@@ -176,10 +176,10 @@
printf("%sPort %d:\n", hdrpre, port->portnum);
printf("%sState: %s\n", pre,
(unsigned)port->state <=
- 4 ? port_state_str[port->state] : "???");
+ 4 ? port_state_str[port->state] : "Unknown");
printf("%sPhysical state: %s\n", pre,
(unsigned)port->phys_state <=
- 7 ? port_phy_state_str[port->phys_state] : "???");
+ 7 ? port_phy_state_str[port->phys_state] : "Unknown");
if (is_fdr10(port))
printf("%sRate: %d (FDR10)\n", pre, port->rate);
else
@@ -211,12 +211,12 @@
IBWARN("%s: '%s' has no port number %d - max (%d)",
((unsigned)ca.node_type <=
IB_NODE_MAX ? node_type_str[ca.node_type] :
- "???"), ca_name, portnum, ca.numports);
+ "Unknown"), ca_name, portnum, ca.numports);
return -1;
}
printf("%s: '%s'\n",
((unsigned)ca.node_type <=
- IB_NODE_MAX ? node_type_str[ca.node_type] : "???"),
+ IB_NODE_MAX ? node_type_str[ca.node_type] : "Unknown"),
ca.ca_name);
port_dump(ca.ports[portnum], 1);
return 0;
@@ -236,13 +236,13 @@
static int ports_list(char names[][UMAD_CA_NAME_LEN], int n)
{
- uint64_t guids[64];
+ uint64_t guids[MAX_PORTS];
int found, ports, i;
- for (i = 0, found = 0; i < n && found < 64; i++) {
+ for (i = 0, found = 0; i < n && found < MAX_PORTS; i++) {
if ((ports =
umad_get_ca_portguids(names[i], guids + found,
- 64 - found)) < 0)
+ MAX_PORTS - found)) < 0)
return -1;
found += ports;
}
diff -r cf8932ef545e src/ibsysstat.c
--- a/src/ibsysstat.c Mon Apr 25 16:24:32 2016 -0700
+++ b/src/ibsysstat.c Tue Apr 26 09:44:44 2016 -0700
@@ -40,6 +40,7 @@
#include <unistd.h>
#include <string.h>
#include <getopt.h>
+#include <signal.h>
#include <infiniband/umad.h>
#include <infiniband/mad.h>
@@ -143,7 +144,8 @@
break;
case IB_CPUINFO_ATTR:
s[0] = '\0';
- for (i = 0; i < host_ncpu && sz > 0; i++) {
+ for (i = 0; i < host_ncpu && sz > 0 && ret <
+ IB_VENDOR_RANGE2_DATA_SIZE; i++) {
n = snprintf(s, sz, "cpu %d: model %s MHZ %s\n",
i, cpus[i].model, cpus[i].mhz);
if (n >= sz) {
@@ -155,6 +157,8 @@
s += n;
ret += n;
}
+ if (i < host_ncpu)
+ IBWARN("cpuinfo truncated");
ret++;
break;
default:
@@ -163,6 +167,20 @@
return ret;
}
+void cleanup(int sig)
+{
+ int i;
+ for (i = 0; i < host_ncpu ; i++) {
+ if (cpus[i].model)
+ free(cpus[i].model);
+ if (cpus[i].mhz)
+ free(cpus[i].mhz);
+ }
+ mad_rpc_close_port(srcport);
+ (void) signal(SIGINT, SIG_DFL);
+ exit (0);
+}
+
static uint8_t buf[2048];
static char *ibsystat_serv(void)
@@ -172,6 +190,7 @@
int attr, mod, size;
DEBUG("starting to serve...");
+ (void) signal(SIGINT, cleanup);
while ((umad = mad_receive_via(buf, -1, srcport))) {
if (umad_status(buf)) {
@@ -262,7 +281,25 @@
char line[1024] = { 0 }, *s, *e;
FILE *f;
int ncpu = 0;
+#if defined(__SVR4) && defined(__sun)
+ int i;
+ char mhz[8];
+ sol_cpu_info_t *cpu_info;
+ ncpu = sol_get_cpu_info(&cpu_info);
+ ncpu = ncpu < MAX_CPUS ? ncpu : MAX_CPUS;
+ if (ncpu <= 0) {
+ IBWARN("couldn't get cpu info");
+ return 0;
+ }
+
+ for (i = 0; i < ncpu; i++) {
+ cpus[i].model = strdup(cpu_info[i].cpu_name);
+ snprintf(mhz, 8, "%d", cpu_info[i].cpu_mhz);
+ cpus[i].mhz = strdup(mhz);
+ }
+ free(cpu_info);
+#else
if (!(f = fopen("/proc/cpuinfo", "r"))) {
IBWARN("couldn't open /proc/cpuinfo");
return 0;
@@ -290,6 +327,7 @@
}
fclose(f);
+#endif
DEBUG("ncpu %d", ncpu);
@@ -315,7 +353,7 @@
{
int mgmt_classes[3] =
{ IB_SMI_CLASS, IB_SMI_DIRECT_CLASS, IB_SA_CLASS };
- int sysstat_class = IB_VENDOR_OPENIB_SYSSTAT_CLASS;
+ int sysstat_class = IB_VENDOR_OPENIB_SYSSTAT_CLASS, i;
ib_portid_t portid = { 0 };
int attr = IB_PING_ATTR;
char *err;
@@ -343,6 +381,8 @@
if (!srcport)
IBEXIT("Failed to open '%s' port '%d'", ibd_ca, ibd_ca_port);
+ bzero((void *)cpus, MAX_CPUS * sizeof (cpu_info));
+
if (server) {
if (mad_register_server_via(sysstat_class, 1, 0, oui, srcport) <
0)
@@ -367,5 +407,6 @@
IBEXIT("ibsystat to %s: %s", portid2str(&portid), err);
mad_rpc_close_port(srcport);
+
exit(0);
}
diff -r cf8932ef545e src/saquery.c
--- a/src/saquery.c Mon Apr 25 16:24:32 2016 -0700
+++ b/src/saquery.c Tue Apr 26 09:44:44 2016 -0700
@@ -99,7 +99,6 @@
/**
* Declare some globals because I don't want this to be too complex.
*/
-#define MAX_PORTS (8)
#define DEFAULT_SA_TIMEOUT_MS (1000)
enum {
@@ -1825,7 +1824,7 @@
requested_lid = (uint16_t) strtoul(argv[0], NULL, 0);
requested_lid_flag++;
} else if (node_print_desc == NAME_OF_GUID) {
- requested_guid = strtoul(argv[0], NULL, 0);
+ requested_guid = strtoull(argv[0], NULL, 0);
requested_guid_flag++;
} else
requested_name = argv[0];