[ofa-general] ***SPAM*** [PATCH] management: remove libibcommon dependencies
Sasha Khapyorsky
sashak at voltaire.com
Sun Dec 21 16:49:45 PST 2008
Remove libibcommon dependencies from libibmad and infiniband-diags.
Actually libibcommon is not used anymore in management tree.
Macros IBWARN(), IBPANIC(), ALIGN() and functions htonll(), htohll() and
xdump() are part of libibmad now.
Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
infiniband-diags/configure.in | 5 ---
infiniband-diags/infiniband-diags.spec.in | 2 +-
infiniband-diags/src/grouping.c | 1 -
infiniband-diags/src/ibaddr.c | 1 -
infiniband-diags/src/ibnetdiscover.c | 1 -
infiniband-diags/src/ibping.c | 10 ++++++-
infiniband-diags/src/ibportstate.c | 1 -
infiniband-diags/src/ibroute.c | 1 -
infiniband-diags/src/ibstat.c | 1 -
infiniband-diags/src/ibsysstat.c | 1 -
infiniband-diags/src/ibtracert.c | 1 -
infiniband-diags/src/mcm_rereg_test.c | 1 -
infiniband-diags/src/perfquery.c | 1 -
infiniband-diags/src/sminfo.c | 1 -
infiniband-diags/src/smpdump.c | 1 -
infiniband-diags/src/smpquery.c | 1 -
infiniband-diags/src/vendstat.c | 1 -
libibmad/configure.in | 5 ---
libibmad/include/infiniband/mad.h | 44 +++++++++++++++++++++++++++++
libibmad/libibmad.ver | 2 +-
libibmad/src/dump.c | 28 +++++++++++++++++-
libibmad/src/fields.c | 1 -
libibmad/src/gs.c | 1 -
libibmad/src/libibmad.map | 1 +
libibmad/src/mad.c | 1 -
libibmad/src/portid.c | 1 -
libibmad/src/register.c | 1 -
libibmad/src/resolve.c | 1 -
libibmad/src/rpc.c | 1 -
libibmad/src/sa.c | 1 -
libibmad/src/serv.c | 1 -
libibmad/src/smp.c | 1 -
libibmad/src/vendor.c | 1 -
33 files changed, 83 insertions(+), 39 deletions(-)
diff --git a/infiniband-diags/configure.in b/infiniband-diags/configure.in
index 17204a4..58eea0a 100644
--- a/infiniband-diags/configure.in
+++ b/infiniband-diags/configure.in
@@ -32,8 +32,6 @@ AC_PROG_LIBTOOL
if test "$disable_libcheck" != "yes"
then
dnl Checks for libraries
-AC_CHECK_LIB(ibcommon, ibpanic, [],
- AC_MSG_ERROR([ibpanic() not found. diags require libibcommon.]))
AC_CHECK_LIB(ibumad, umad_init, [],
AC_MSG_ERROR([umad_init() not found. diags require libibumad.]))
AC_CHECK_LIB(ibmad, mad_dump_int, [],
@@ -53,9 +51,6 @@ AC_HEADER_STDC
AC_CHECK_HEADERS([stdlib.h string.h unistd.h fcntl.h inttypes.h netinet/in.h sys/ioctl.h syslog.h])
if test "$disable_libcheck" != "yes"
then
-AC_CHECK_HEADER(infiniband/common.h, [],
- AC_MSG_ERROR([<infiniband/common.h> not found. diags require libibcommon.])
-)
AC_CHECK_HEADER(infiniband/umad.h, [],
AC_MSG_ERROR([<infiniband/umad.h> not found. diags require libibumad.])
)
diff --git a/infiniband-diags/infiniband-diags.spec.in b/infiniband-diags/infiniband-diags.spec.in
index 9c8c0c4..3791eb4 100644
--- a/infiniband-diags/infiniband-diags.spec.in
+++ b/infiniband-diags/infiniband-diags.spec.in
@@ -11,7 +11,7 @@ Group: System Environment/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Source: http://www.openfabrics.org/downloads/management/@TARBALL@
Url: http://openfabrics.org/
-BuildRequires: libibmad-devel, opensm-devel, libibcommon-devel, libibumad-devel
+BuildRequires: libibmad-devel, opensm-devel, libibumad-devel
Provides: perl(IBswcountlimits)
Obsoletes: openib-diags
diff --git a/infiniband-diags/src/grouping.c b/infiniband-diags/src/grouping.c
index f1a996f..94ab859 100644
--- a/infiniband-diags/src/grouping.c
+++ b/infiniband-diags/src/grouping.c
@@ -44,7 +44,6 @@
#include <stdlib.h>
#include <inttypes.h>
-#include <infiniband/common.h>
#include <infiniband/mad.h>
#include "ibnetdiscover.h"
diff --git a/infiniband-diags/src/ibaddr.c b/infiniband-diags/src/ibaddr.c
index f48a9c9..4d6c50d 100644
--- a/infiniband-diags/src/ibaddr.c
+++ b/infiniband-diags/src/ibaddr.c
@@ -42,7 +42,6 @@
#include <getopt.h>
#include <arpa/inet.h>
-#include <infiniband/common.h>
#include <infiniband/umad.h>
#include <infiniband/mad.h>
diff --git a/infiniband-diags/src/ibnetdiscover.c b/infiniband-diags/src/ibnetdiscover.c
index 2cfaa8a..296cb07 100644
--- a/infiniband-diags/src/ibnetdiscover.c
+++ b/infiniband-diags/src/ibnetdiscover.c
@@ -47,7 +47,6 @@
#include <errno.h>
#include <inttypes.h>
-#include <infiniband/common.h>
#include <infiniband/umad.h>
#include <infiniband/mad.h>
#include <infiniband/complib/cl_nodenamemap.h>
diff --git a/infiniband-diags/src/ibping.c b/infiniband-diags/src/ibping.c
index 4fd2dcb..4b99725 100644
--- a/infiniband-diags/src/ibping.c
+++ b/infiniband-diags/src/ibping.c
@@ -43,8 +43,8 @@
#include <string.h>
#include <signal.h>
#include <getopt.h>
+#include <sys/time.h>
-#include <infiniband/common.h>
#include <infiniband/umad.h>
#include <infiniband/mad.h>
@@ -60,6 +60,14 @@ static char last_host[IB_VENDOR_RANGE2_DATA_SIZE];
char *argv0 = "ibping";
+static uint64_t getcurrenttime(void)
+{
+ struct timeval tv;
+
+ gettimeofday(&tv, 0);
+ return (uint64_t)tv.tv_sec * 1000000 + tv.tv_usec;
+}
+
static void
get_host_and_domain(char *data, int sz)
{
diff --git a/infiniband-diags/src/ibportstate.c b/infiniband-diags/src/ibportstate.c
index 36453bb..a82bb14 100644
--- a/infiniband-diags/src/ibportstate.c
+++ b/infiniband-diags/src/ibportstate.c
@@ -43,7 +43,6 @@
#include <string.h>
#include <getopt.h>
-#include <infiniband/common.h>
#include <infiniband/umad.h>
#include <infiniband/mad.h>
diff --git a/infiniband-diags/src/ibroute.c b/infiniband-diags/src/ibroute.c
index f2ee170..921b5dd 100644
--- a/infiniband-diags/src/ibroute.c
+++ b/infiniband-diags/src/ibroute.c
@@ -46,7 +46,6 @@
#include <netinet/in.h>
#include <ctype.h>
-#include <infiniband/common.h>
#include <infiniband/umad.h>
#include <infiniband/mad.h>
#include <infiniband/complib/cl_nodenamemap.h>
diff --git a/infiniband-diags/src/ibstat.c b/infiniband-diags/src/ibstat.c
index 5d2113e..6bd3c8a 100644
--- a/infiniband-diags/src/ibstat.c
+++ b/infiniband-diags/src/ibstat.c
@@ -44,7 +44,6 @@
#include <getopt.h>
#include <netinet/in.h>
-#include <infiniband/common.h>
#include <infiniband/umad.h>
#include <infiniband/mad.h>
diff --git a/infiniband-diags/src/ibsysstat.c b/infiniband-diags/src/ibsysstat.c
index e3d0b9f..d881e5b 100644
--- a/infiniband-diags/src/ibsysstat.c
+++ b/infiniband-diags/src/ibsysstat.c
@@ -43,7 +43,6 @@
#include <string.h>
#include <getopt.h>
-#include <infiniband/common.h>
#include <infiniband/umad.h>
#include <infiniband/mad.h>
diff --git a/infiniband-diags/src/ibtracert.c b/infiniband-diags/src/ibtracert.c
index bde0ea7..7a28940 100644
--- a/infiniband-diags/src/ibtracert.c
+++ b/infiniband-diags/src/ibtracert.c
@@ -46,7 +46,6 @@
#include <inttypes.h>
#include <errno.h>
-#include <infiniband/common.h>
#include <infiniband/umad.h>
#include <infiniband/mad.h>
#include <infiniband/complib/cl_nodenamemap.h>
diff --git a/infiniband-diags/src/mcm_rereg_test.c b/infiniband-diags/src/mcm_rereg_test.c
index 0ba9901..9285b95 100644
--- a/infiniband-diags/src/mcm_rereg_test.c
+++ b/infiniband-diags/src/mcm_rereg_test.c
@@ -36,7 +36,6 @@
#include <errno.h>
#include <inttypes.h>
-#include <infiniband/common.h>
#include <infiniband/umad.h>
#include <infiniband/mad.h>
diff --git a/infiniband-diags/src/perfquery.c b/infiniband-diags/src/perfquery.c
index 7a53e92..d2c5904 100644
--- a/infiniband-diags/src/perfquery.c
+++ b/infiniband-diags/src/perfquery.c
@@ -43,7 +43,6 @@
#include <getopt.h>
#include <netinet/in.h>
-#include <infiniband/common.h>
#include <infiniband/umad.h>
#include <infiniband/mad.h>
diff --git a/infiniband-diags/src/sminfo.c b/infiniband-diags/src/sminfo.c
index c811057..bdcdad9 100644
--- a/infiniband-diags/src/sminfo.c
+++ b/infiniband-diags/src/sminfo.c
@@ -42,7 +42,6 @@
#include <inttypes.h>
#include <getopt.h>
-#include <infiniband/common.h>
#include <infiniband/umad.h>
#include <infiniband/mad.h>
diff --git a/infiniband-diags/src/smpdump.c b/infiniband-diags/src/smpdump.c
index e26b369..6f7bae2 100644
--- a/infiniband-diags/src/smpdump.c
+++ b/infiniband-diags/src/smpdump.c
@@ -45,7 +45,6 @@
#include <getopt.h>
#include <netinet/in.h>
-#include <infiniband/common.h>
#include <infiniband/mad.h>
#include <infiniband/umad.h>
diff --git a/infiniband-diags/src/smpquery.c b/infiniband-diags/src/smpquery.c
index ed8ec83..6071245 100644
--- a/infiniband-diags/src/smpquery.c
+++ b/infiniband-diags/src/smpquery.c
@@ -47,7 +47,6 @@
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
-#include <infiniband/common.h>
#include <infiniband/umad.h>
#include <infiniband/mad.h>
#include <infiniband/complib/cl_nodenamemap.h>
diff --git a/infiniband-diags/src/vendstat.c b/infiniband-diags/src/vendstat.c
index 0674986..9295898 100644
--- a/infiniband-diags/src/vendstat.c
+++ b/infiniband-diags/src/vendstat.c
@@ -42,7 +42,6 @@
#include <getopt.h>
#include <netinet/in.h>
-#include <infiniband/common.h>
#include <infiniband/umad.h>
#include <infiniband/mad.h>
diff --git a/libibmad/configure.in b/libibmad/configure.in
index 22ea5ef..e7c2deb 100644
--- a/libibmad/configure.in
+++ b/libibmad/configure.in
@@ -31,8 +31,6 @@ AC_PROG_CC
dnl Checks for libraries
if test "$disable_libcheck" != "yes"
then
-AC_CHECK_LIB(ibcommon, ibpanic, [],
- AC_MSG_ERROR([ibpanic() not found. libibmad requires libibcommon.]))
AC_CHECK_LIB(ibumad, umad_init, [],
AC_MSG_ERROR([umad_init() not found. libibmad requires libibumad.]))
fi
@@ -42,9 +40,6 @@ AC_HEADER_STDC
AC_CHECK_HEADERS([netinet/in.h stdlib.h string.h sys/time.h unistd.h])
if test "$disable_libcheck" != "yes"
then
-AC_CHECK_HEADER(infiniband/common.h, [],
- AC_MSG_ERROR([<infiniband/common.h> not found. libibmad requires libibcommon.])
-)
AC_CHECK_HEADER(infiniband/umad.h, [],
AC_MSG_ERROR([<infiniband/umad.h> not found. libibmad requires libibumad.])
)
diff --git a/libibmad/include/infiniband/mad.h b/libibmad/include/infiniband/mad.h
index fd0deff..989e474 100644
--- a/libibmad/include/infiniband/mad.h
+++ b/libibmad/include/infiniband/mad.h
@@ -35,6 +35,11 @@
#include <stdint.h>
#include <string.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <byteswap.h>
#ifdef __cplusplus
# define BEGIN_C_DECLS extern "C" {
@@ -835,6 +840,45 @@ ib_mad_dump_fn
extern int ibdebug;
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#ifndef ntohll
+static inline uint64_t ntohll(uint64_t x) {
+ return bswap_64(x);
+}
+#endif
+#ifndef htonll
+static inline uint64_t htonll(uint64_t x) {
+ return bswap_64(x);
+}
+#endif
+#elif __BYTE_ORDER == __BIG_ENDIAN
+#ifndef ntohll
+static inline uint64_t ntohll(uint64_t x) {
+ return x;
+}
+#endif
+#ifndef htonll
+static inline uint64_t htonll(uint64_t x) {
+ return x;
+}
+#endif
+#endif /* __BYTE_ORDER == __BIG_ENDIAN */
+
+/* Misc. macros: */
+/** align value \a l to \a size (ceil) */
+#define ALIGN(l, size) (((l) + ((size) - 1)) / (size) * (size))
+
+/** printf style warning MACRO, includes name of function and pid */
+#define IBWARN(fmt, ...) fprintf(stdout, "ibwarn: [%d] %s: " fmt, getpid(), __func__, ## __VA_ARGS__)
+
+/** printf style abort MACRO, includes name of function and pid */
+#define IBPANIC(fmt, ...) do { \
+ fprintf(stdout, "ibpanic: [%d] %s: " fmt, getpid(), __func__, ## __VA_ARGS__); \
+ exit(-1); \
+} while(0)
+
+void xdump(FILE *file, char *msg, void *p, int size);
+
END_C_DECLS
#endif /* _MAD_H_ */
diff --git a/libibmad/libibmad.ver b/libibmad/libibmad.ver
index 51f2b71..7e93c16 100644
--- a/libibmad/libibmad.ver
+++ b/libibmad/libibmad.ver
@@ -6,4 +6,4 @@
# API_REV - advance on any added API
# RUNNING_REV - advance any change to the vendor files
# AGE - number of backward versions the API still supports
-LIBVERSION=4:0:3
+LIBVERSION=5:0:4
diff --git a/libibmad/src/dump.c b/libibmad/src/dump.c
index 49bb34b..38a2254 100644
--- a/libibmad/src/dump.c
+++ b/libibmad/src/dump.c
@@ -44,7 +44,6 @@
#include <netinet/in.h>
#include <mad.h>
-#include <infiniband/common.h>
void
mad_dump_int(char *buf, int bufsz, void *val, int valsz)
@@ -729,3 +728,30 @@ mad_dump_perfcounters_ext(char *buf, int bufsz, void *val, int valsz)
{
_dump_fields(buf, bufsz, val, IB_PC_EXT_FIRST_F, IB_PC_EXT_LAST_F);
}
+
+void xdump(FILE *file, char *msg, void *p, int size)
+{
+#define HEX(x) ((x) < 10 ? '0' + (x) : 'a' + ((x) -10))
+ uint8_t *cp = p;
+ int i;
+
+ if (msg)
+ fputs(msg, file);
+
+ for (i = 0; i < size;) {
+ fputc(HEX(*cp >> 4), file);
+ fputc(HEX(*cp & 0xf), file);
+ if (++i >= size)
+ break;
+ fputc(HEX(cp[1] >> 4), file);
+ fputc(HEX(cp[1] & 0xf), file);
+ if ((++i) % 16)
+ fputc(' ', file);
+ else
+ fputc('\n', file);
+ cp += 2;
+ }
+ if (i % 16) {
+ fputc('\n', file);
+ }
+}
diff --git a/libibmad/src/fields.c b/libibmad/src/fields.c
index ffbfc76..50611c5 100644
--- a/libibmad/src/fields.c
+++ b/libibmad/src/fields.c
@@ -41,7 +41,6 @@
#include <string.h>
#include <mad.h>
-#include <infiniband/common.h>
/*
* BITSOFFS and BE_OFFS are required due the fact that the bit offsets are inconsistently
diff --git a/libibmad/src/gs.c b/libibmad/src/gs.c
index cade54b..89c927e 100644
--- a/libibmad/src/gs.c
+++ b/libibmad/src/gs.c
@@ -42,7 +42,6 @@
#include <pthread.h>
#include <sys/time.h>
-#include <infiniband/common.h>
#include <infiniband/umad.h>
#include "mad.h"
diff --git a/libibmad/src/libibmad.map b/libibmad/src/libibmad.map
index ea1ed4b..927e51c 100644
--- a/libibmad/src/libibmad.map
+++ b/libibmad/src/libibmad.map
@@ -1,5 +1,6 @@
IBMAD_1.3 {
global:
+ xdump;
mad_dump_field;
mad_dump_val;
mad_print_field;
diff --git a/libibmad/src/mad.c b/libibmad/src/mad.c
index fc73a7a..f0fffcd 100644
--- a/libibmad/src/mad.c
+++ b/libibmad/src/mad.c
@@ -42,7 +42,6 @@
#include <pthread.h>
#include <sys/time.h>
-#include <infiniband/common.h>
#include <infiniband/umad.h>
#include <mad.h>
diff --git a/libibmad/src/portid.c b/libibmad/src/portid.c
index 24a555b..a84baee 100644
--- a/libibmad/src/portid.c
+++ b/libibmad/src/portid.c
@@ -45,7 +45,6 @@
#include <arpa/inet.h>
#include <mad.h>
-#include <infiniband/common.h>
#undef DEBUG
#define DEBUG if (ibdebug) IBWARN
diff --git a/libibmad/src/register.c b/libibmad/src/register.c
index 8e59e6e..a33acd8 100644
--- a/libibmad/src/register.c
+++ b/libibmad/src/register.c
@@ -43,7 +43,6 @@
#include <string.h>
#include <errno.h>
-#include <infiniband/common.h>
#include <infiniband/umad.h>
#include "mad.h"
diff --git a/libibmad/src/resolve.c b/libibmad/src/resolve.c
index 25062f6..f012543 100644
--- a/libibmad/src/resolve.c
+++ b/libibmad/src/resolve.c
@@ -42,7 +42,6 @@
#include <string.h>
#include <sys/time.h>
-#include <infiniband/common.h>
#include <infiniband/umad.h>
#include <mad.h>
diff --git a/libibmad/src/rpc.c b/libibmad/src/rpc.c
index 34a6b9a..df28f65 100644
--- a/libibmad/src/rpc.c
+++ b/libibmad/src/rpc.c
@@ -43,7 +43,6 @@
#include <string.h>
#include <errno.h>
-#include <infiniband/common.h>
#include <infiniband/umad.h>
#include "mad.h"
diff --git a/libibmad/src/sa.c b/libibmad/src/sa.c
index 2e092ec..192f56e 100644
--- a/libibmad/src/sa.c
+++ b/libibmad/src/sa.c
@@ -43,7 +43,6 @@
#include <sys/time.h>
#include <mad.h>
-#include <infiniband/common.h>
#undef DEBUG
#define DEBUG if (ibdebug) IBWARN
diff --git a/libibmad/src/serv.c b/libibmad/src/serv.c
index 9b20cb6..a90e961 100644
--- a/libibmad/src/serv.c
+++ b/libibmad/src/serv.c
@@ -43,7 +43,6 @@
#include <string.h>
#include <netinet/in.h>
-#include <infiniband/common.h>
#include <infiniband/umad.h>
#include <mad.h>
diff --git a/libibmad/src/smp.c b/libibmad/src/smp.c
index 2c2bde2..d190af0 100644
--- a/libibmad/src/smp.c
+++ b/libibmad/src/smp.c
@@ -43,7 +43,6 @@
#include <sys/time.h>
#include <mad.h>
-#include <infiniband/common.h>
#undef DEBUG
#define DEBUG if (ibdebug) IBWARN
diff --git a/libibmad/src/vendor.c b/libibmad/src/vendor.c
index 468e2d3..04e7641 100644
--- a/libibmad/src/vendor.c
+++ b/libibmad/src/vendor.c
@@ -43,7 +43,6 @@
#include <sys/time.h>
#include <mad.h>
-#include <infiniband/common.h>
#undef DEBUG
#define DEBUG if (ibdebug) IBWARN
--
1.6.0.4.766.g6fc4a
More information about the general
mailing list