[ofa-general] [PATCH] srptools: eliminate libibcommon dependencies

Sasha Khapyorsky sashak at voltaire.com
Wed Jan 7 20:53:29 PST 2009


Eliminate libibcommon dependencies - this library will be removed soon.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---

On 23:51 Wed 07 Jan     , Vladimir Sokolovsky wrote:
>
> Ishai (srptools maintainer) has reimplemented these functions in srptools,

In order to eliminate libibcommon stuff something like this is needed
too (compilation only was tested).

Sasha

 Makefile.am                   |    2 +-
 configure.in                  |    2 --
 srp_daemon/srp_daemon.c       |    1 -
 srp_daemon/srp_daemon.h       |   18 ++++++++++++++++++
 srp_daemon/srp_handle_traps.c |    4 ++--
 5 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index dcca848..be1e07a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,7 +6,7 @@ man_MANS = man/ibsrpdm.1 man/srp_daemon.1
 src_ibsrpdm_CFLAGS = -Wall
 src_ibsrpdm_SOURCES = src/srp-dm.c
 
-srp_daemon_srp_daemon_LDADD = -libumad -libcommon -libverbs -lpthread
+srp_daemon_srp_daemon_LDADD = -libumad -libverbs -lpthread
 srp_daemon_srp_daemon_CFLAGS = -Wall -I $(DESTDIR)$(includedir) -fno-strict-aliasing
 srp_daemon_srp_daemon_SOURCES = srp_daemon/srp_daemon.c srp_daemon/srp_handle_traps.c srp_daemon/srp_sync.c
 
diff --git a/configure.in b/configure.in
index e06feaf..053133e 100644
--- a/configure.in
+++ b/configure.in
@@ -20,8 +20,6 @@ AC_PROG_CC
 # Checks for libraries.
 if test "$disable_libcheck" != "yes"
 then
-AC_CHECK_LIB([ibcommon], [stack_dump], [],
-	AC_MSG_ERROR([srptools require libibcommon.]))
 AC_CHECK_LIB([ibumad], [umad_init], [],
 	AC_MSG_ERROR([srptools require libibumad.]))
 AC_CHECK_LIB([ibverbs], [ibv_get_device_list], [],
diff --git a/srp_daemon/srp_daemon.c b/srp_daemon/srp_daemon.c
index 936bcbd..5e1e198 100644
--- a/srp_daemon/srp_daemon.c
+++ b/srp_daemon/srp_daemon.c
@@ -58,7 +58,6 @@
 #include <pthread.h>
 #include <string.h>
 #include <infiniband/umad.h>
-#include <infiniband/common.h>
 #include "srp_ib_types.h"
 
 #include "srp_daemon.h"
diff --git a/srp_daemon/srp_daemon.h b/srp_daemon/srp_daemon.h
index eb05d9f..77dcc0d 100644
--- a/srp_daemon/srp_daemon.h
+++ b/srp_daemon/srp_daemon.h
@@ -37,6 +37,8 @@
 #define SRP_DM_H
 
 #include <stdint.h>
+#include <endian.h>
+#include <byteswap.h>
 #include <infiniband/verbs.h>
 
 #include "srp_ib_types.h"
@@ -369,6 +371,22 @@ struct resources {
 
 static const int   node_table_response_size = 1 << 18;
 
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#ifndef ntohll
+#define ntohll(x) bswap_64(x)
+#endif
+#ifndef htonll
+#define htonll(x) bswap_64(x)
+#endif
+#elif __BYTE_ORDER == __BIG_ENDIAN
+#ifndef ntohll
+#define ntohll(x) (x)
+#endif
+#ifndef htonll
+#define htonll(x) (x)
+#endif
+#endif	/* __BYTE_ORDER == __BIG_ENDIAN */
+
 #define pr_human(arg...)				\
 	do {						\
 		if (!config->cmd && !config->execute)	\
diff --git a/srp_daemon/srp_handle_traps.c b/srp_daemon/srp_handle_traps.c
index d973c21..b5f9f83 100644
--- a/srp_daemon/srp_handle_traps.c
+++ b/srp_daemon/srp_handle_traps.c
@@ -42,7 +42,6 @@
 #include <time.h>
 #include <errno.h>
 #include <string.h>
-#include <infiniband/common.h>
 #include <infiniband/verbs.h>
 
 #include "srp_ib_types.h"
@@ -558,7 +557,8 @@ static int register_to_trap(struct ud_resources *res, int dest_lid, int trap_num
 		pthread_mutex_lock(res->mad_buffer_mutex);
 		res->mad_buffer->base_ver = 0; // flag that the buffer is empty
 		pthread_mutex_unlock(res->mad_buffer_mutex);
-		mad_hdr->trans_id = htonll(trans_id++);
+		trans_id++;
+		mad_hdr->trans_id = htonll(trans_id);
 
 		ret = ibv_post_send(res->qp, &sr, bad_wr);
 		if (ret) {
-- 
1.6.0.4.766.g6fc4a




More information about the general mailing list