[Pkg-ofed-commits] [libmthca] 03/13: Imported Upstream version 1.0.2

Ana Beatriz Guerrero López ana at moszumanska.debian.org
Wed Jul 2 13:50:50 UTC 2014


This is an automated email from the git hooks/post-receive script.

ana pushed a commit to branch master
in repository libmthca.

commit ab794cbbaac796de455fc7738d57a438fe218907
Author: Ana Guerrero López <ana at ekaia.org>
Date:   Wed Jul 2 15:50:33 2014 +0200

    Imported Upstream version 1.0.2
---
 ChangeLog        |  50 ++++++++
 README           |   2 +-
 config.h.in      |   9 ++
 configure        | 355 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
 configure.in     |  12 +-
 libmthca.spec    |  10 +-
 libmthca.spec.in |   8 +-
 src/ah.c         |   3 +-
 src/cq.c         |  15 ++-
 src/memfree.c    |   3 +-
 src/mthca.c      |  93 ++++++++++++---
 src/mthca.map    |   4 +-
 src/qp.c         |  42 +++----
 src/srq.c        |  39 +++---
 14 files changed, 558 insertions(+), 87 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index bd30a98..2743cf4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,53 @@
+2006-06-13  Roland Dreier  <rdreier at cisco.com>
+
+	* Release version 1.0.2.
+
+2006-06-13  Michael S. Tsirkin  <mst at mellanox.co.il>
+
+	* src/cq.c (mthca_poll_one): Add workaround for MemFree FW bug
+	that causes wrong WQE addr to be reported.
+
+2006-05-24  Roland Dreier  <rdreier at cisco.com>
+
+	* src/mthca.c: If <sysfs/libsysfs.h> is detected, include it
+	explicitly.  This lets things build when sysfs headers are
+	installed on the build system even when building against
+	libibverbs 1.1 (which does not include sysfs headers implicitly).
+
+	* src/ah.c, src/cq.c, src/memfree.c, src/mthca.c, src/qp.c,
+	src/srq.c: Add include of <string.h>, since it may no long be
+	implicitly included from libsysfs headers when building with
+	libibverbs 1.1.
+
+2006-05-24  Michael S. Tsirkin  <mst at mellanox.co.il>
+
+	* src/srq.c (mthca_tavor_post_srq_recv): Fix posting of lists of
+	receives that have exactly a multiple of 256 entries (same as QP
+	bug fixed below).
+
+2006-05-22  Roland Dreier  <rdreier at cisco.com>
+
+	* configure.in, src/mthca.c (openib_driver_init): Check for the
+	presence of <sysfs/libsysfs.h>, and if it is not installed, don't
+	export the old openib_driver_init() entry point.
+
+2006-05-18  Michael S. Tsirkin  <mst at mellanox.co.il>
+
+	* src/qp.c (mthca_tavor_post_recv): Fix posting of lists of
+	receives that have exactly a multiple of 256 entries.
+
+2006-05-08  Jack Morgenstein  <jackm at mellanox.co.il>
+
+	* src/mthca.c: Add include files needed for open() if
+	HAVE_IBV_READ_SYSFS_FILE is not defined (so libmthca includes a
+	private local definition of ibv_read_sysfs_file()).
+
+2006-04-11  Roland Dreier  <rdreier at cisco.com>
+
+	* src/mthca.c (ibv_driver_init, openib_driver_init): Add new
+	forward-compatible driver entry point.  Make old entry point a
+	simple wrapper for the new one.
+
 2006-03-14  Roland Dreier  <rdreier at cisco.com>
 
 	* Release version 1.0.1.
diff --git a/README b/README
index d516e54..224ec0d 100644
--- a/README
+++ b/README
@@ -20,7 +20,7 @@ libmthca currently supports HCAs based on the following Mellanox chips:
 
     MT23108 InfiniHost (PCI-X)
     MT25208 InfiniHost III Ex (PCI Express)
-    MT25208 InfiniHost III Lx (PCI Express)
+    MT25204 InfiniHost III Lx (PCI Express)
 
 Both non-DDR and DDR HCAs are supported, and the MT25208 is supported
 with both MT23108-compatible and native MemFree firmware.
diff --git a/config.h.in b/config.h.in
index f47f8d5..67ff881 100644
--- a/config.h.in
+++ b/config.h.in
@@ -3,9 +3,15 @@
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #undef HAVE_DLFCN_H
 
+/* Define to 1 if you have the `ibv_read_sysfs_file' function. */
+#undef HAVE_IBV_READ_SYSFS_FILE
+
 /* Define to 1 if you have the <inttypes.h> header file. */
 #undef HAVE_INTTYPES_H
 
+/* Define to 1 if you have the `ibverbs' library (-libverbs). */
+#undef HAVE_LIBIBVERBS
+
 /* Define to 1 if you have the <memory.h> header file. */
 #undef HAVE_MEMORY_H
 
@@ -21,6 +27,9 @@
 /* Define to 1 if you have the <string.h> header file. */
 #undef HAVE_STRING_H
 
+/* Define to 1 if you have the <sysfs/libsysfs.h> header file. */
+#undef HAVE_SYSFS_LIBSYSFS_H
+
 /* Define to 1 if you have the <sys/stat.h> header file. */
 #undef HAVE_SYS_STAT_H
 
diff --git a/configure b/configure
index fc0c601..64b8372 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.59 for libmthca 1.0.1.
+# Generated by GNU Autoconf 2.59 for libmthca 1.0.2.
 #
 # Report bugs to <openib-general at openib.org>.
 #
@@ -423,8 +423,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
 # Identity of this package.
 PACKAGE_NAME='libmthca'
 PACKAGE_TARNAME='libmthca'
-PACKAGE_VERSION='1.0.1'
-PACKAGE_STRING='libmthca 1.0.1'
+PACKAGE_VERSION='1.0.2'
+PACKAGE_STRING='libmthca 1.0.2'
 PACKAGE_BUGREPORT='openib-general at openib.org'
 
 ac_unique_file="src/mthca.h"
@@ -954,7 +954,7 @@ if test "$ac_init_help" = "long"; then
   # 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 libmthca 1.0.1 to adapt to many kinds of systems.
+\`configure' configures libmthca 1.0.2 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1020,7 +1020,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of libmthca 1.0.1:";;
+     short | recursive ) echo "Configuration of libmthca 1.0.2:";;
    esac
   cat <<\_ACEOF
 
@@ -1159,7 +1159,7 @@ fi
 test -n "$ac_init_help" && exit 0
 if $ac_init_version; then
   cat <<\_ACEOF
-libmthca configure 1.0.1
+libmthca configure 1.0.2
 generated by GNU Autoconf 2.59
 
 Copyright (C) 2003 Free Software Foundation, Inc.
@@ -1173,7 +1173,7 @@ cat >&5 <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by libmthca $as_me 1.0.1, which was
+It was created by libmthca $as_me 1.0.2, which was
 generated by GNU Autoconf 2.59.  Invocation command line was
 
   $ $0 $@
@@ -1819,7 +1819,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE=libmthca
- VERSION=1.0.1
+ VERSION=1.0.2
 
 
 cat >>confdefs.h <<_ACEOF
@@ -20462,6 +20462,234 @@ fi
 
 
 
+echo "$as_me:$LINENO: checking for ibv_get_device_list in -libverbs" >&5
+echo $ECHO_N "checking for ibv_get_device_list in -libverbs... $ECHO_C" >&6
+if test "${ac_cv_lib_ibverbs_ibv_get_device_list+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-libverbs  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char ibv_get_device_list ();
+int
+main ()
+{
+ibv_get_device_list ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_ibverbs_ibv_get_device_list=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_cv_lib_ibverbs_ibv_get_device_list=no
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_ibverbs_ibv_get_device_list" >&5
+echo "${ECHO_T}$ac_cv_lib_ibverbs_ibv_get_device_list" >&6
+if test $ac_cv_lib_ibverbs_ibv_get_device_list = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBIBVERBS 1
+_ACEOF
+
+  LIBS="-libverbs $LIBS"
+
+else
+  { { echo "$as_me:$LINENO: error: ibv_get_device_list() not found.  libmthca requires libibverbs." >&5
+echo "$as_me: error: ibv_get_device_list() not found.  libmthca requires libibverbs." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+
+
+for ac_header in sysfs/libsysfs.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ac_header_compiler=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+    ac_cpp_err=$ac_cpp_err$ac_c_werror_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+  ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+  yes:no: )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+    ac_header_preproc=yes
+    ;;
+  no:yes:* )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+    (
+      cat <<\_ASBOX
+## ---------------------------------------- ##
+## Report this to openib-general at openib.org ##
+## ---------------------------------------- ##
+_ASBOX
+    ) |
+      sed "s/^/$as_me: WARNING:     /" >&2
+    ;;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=\$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
 if test "${ac_cv_header_infiniband_driver_h+set}" = set; then
   echo "$as_me:$LINENO: checking for infiniband/driver.h" >&5
 echo $ECHO_N "checking for infiniband/driver.h... $ECHO_C" >&6
@@ -20602,8 +20830,8 @@ fi
 if test $ac_cv_header_infiniband_driver_h = yes; then
   :
 else
-  { { echo "$as_me:$LINENO: error: <infiniband/driver.h> not found.  Is libibverbs installed?" >&5
-echo "$as_me: error: <infiniband/driver.h> not found.  Is libibverbs installed?" >&2;}
+  { { echo "$as_me:$LINENO: error: <infiniband/driver.h> not found.  libmthca requires libibverbs." >&5
+echo "$as_me: error: <infiniband/driver.h> not found.  libmthca requires libibverbs." >&2;}
    { (exit 1); exit 1; }; }
 fi
 
@@ -21297,6 +21525,109 @@ _ACEOF
 
 
 
+
+for ac_func in ibv_read_sysfs_file
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+    which can conflict with char $ac_func (); below.
+    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+    <limits.h> exists even on freestanding compilers.  */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+    to always fail with ENOSYS.  Some functions are actually named
+    something starting with __ and the normal name is an alias.  */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+char (*f) () = $ac_func;
+#endif
+#ifdef __cplusplus
+}
+#endif
+
+int
+main ()
+{
+return f != $ac_func;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+	 { ac_try='test -z "$ac_c_werror_flag"
+			 || test ! -s conftest.err'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; } &&
+	 { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_ac_var=no"
+fi
+rm -f conftest.err conftest.$ac_objext \
+      conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+
 echo "$as_me:$LINENO: checking whether ld accepts --version-script" >&5
 echo $ECHO_N "checking whether ld accepts --version-script... $ECHO_C" >&6
 if test "${ac_cv_version_script+set}" = set; then
@@ -21721,7 +22052,7 @@ _ASBOX
 } >&5
 cat >&5 <<_CSEOF
 
-This file was extended by libmthca $as_me 1.0.1, which was
+This file was extended by libmthca $as_me 1.0.2, which was
 generated by GNU Autoconf 2.59.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -21784,7 +22115,7 @@ _ACEOF
 
 cat >>$CONFIG_STATUS <<_ACEOF
 ac_cs_version="\\
-libmthca config.status 1.0.1
+libmthca config.status 1.0.2
 configured by $0, generated by GNU Autoconf 2.59,
   with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
 
diff --git a/configure.in b/configure.in
index b38bc70..63b2942 100644
--- a/configure.in
+++ b/configure.in
@@ -1,27 +1,33 @@
 dnl Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.57)
-AC_INIT(libmthca, 1.0.1, openib-general at openib.org)
+AC_INIT(libmthca, 1.0.2, openib-general at openib.org)
 AC_CONFIG_SRCDIR([src/mthca.h])
 AC_CONFIG_AUX_DIR(config)
 AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(libmthca, 1.0.1)
+AM_INIT_AUTOMAKE(libmthca, 1.0.2)
 AM_PROG_LIBTOOL
 
 dnl Checks for programs
 AC_PROG_CC
 
 dnl Checks for libraries
+AC_CHECK_LIB(ibverbs, ibv_get_device_list, [],
+    AC_MSG_ERROR([ibv_get_device_list() not found.  libmthca requires libibverbs.]))
 
 dnl Checks for header files.
+AC_CHECK_HEADERS(sysfs/libsysfs.h)
 AC_CHECK_HEADER(infiniband/driver.h, [],
-    AC_MSG_ERROR([<infiniband/driver.h> not found.  Is libibverbs installed?]))
+    AC_MSG_ERROR([<infiniband/driver.h> not found.  libmthca requires libibverbs.]))
 AC_HEADER_STDC
 
 dnl Checks for typedefs, structures, and compiler characteristics.
 AC_C_CONST
 AC_CHECK_SIZEOF(long)
 
+dnl Checks for library functions
+AC_CHECK_FUNCS(ibv_read_sysfs_file)
+
 AC_CACHE_CHECK(whether ld accepts --version-script, ac_cv_version_script,
     if test -n "`$LD --help < /dev/null 2>/dev/null | grep version-script`"; then
         ac_cv_version_script=yes
diff --git a/libmthca.spec b/libmthca.spec
index 3979d40..ea359a6 100644
--- a/libmthca.spec
+++ b/libmthca.spec
@@ -1,16 +1,16 @@
-# $Id: libmthca.spec.in 5800 2006-03-14 00:06:30Z roland $
+# $Id: libmthca.spec.in 5829 2006-03-15 00:51:29Z roland $
 
-%define ver      1.0.1
+%define ver      1.0.2
 
 Name: libmthca
-Version: 1.0.1
+Version: 1.0.2
 Release: 1%{?dist}
 Summary: Mellanox InfiniBand HCA Userspace Driver
 
 Group: System Environment/Libraries
 License: GPL/BSD
 Url: http://openib.org/
-Source: http://openib.org/downloads/libmthca-1.0.1.tar.gz
+Source: http://openib.org/downloads/libmthca-1.0.2.tar.gz
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires: libibverbs-devel >= 1.0-0.5.rc7
@@ -55,7 +55,7 @@ rm -rf $RPM_BUILD_ROOT
 %{_libdir}/infiniband/mthca.a
 
 %changelog
-* Mon Mar 13 2006 Roland Dreier <rdreier at cisco.com> - 1.0.1-1
+* Mon Mar 14 2006 Roland Dreier <rdreier at cisco.com> - 1.0.2-1
 - New upstream release
 
 * Thu Feb 16 2006 Roland Dreier <rdreier at cisco.com> - 1.0-1
diff --git a/libmthca.spec.in b/libmthca.spec.in
index e008c6e..5b6630a 100644
--- a/libmthca.spec.in
+++ b/libmthca.spec.in
@@ -1,16 +1,16 @@
-# $Id: libmthca.spec.in 5800 2006-03-14 00:06:30Z roland $
+# $Id: libmthca.spec.in 5829 2006-03-15 00:51:29Z roland $
 
 %define ver      @VERSION@
 
 Name: libmthca
-Version: 1.0.1
+Version: 1.0.2
 Release: 1%{?dist}
 Summary: Mellanox InfiniBand HCA Userspace Driver
 
 Group: System Environment/Libraries
 License: GPL/BSD
 Url: http://openib.org/
-Source: http://openib.org/downloads/libmthca-1.0.1.tar.gz
+Source: http://openib.org/downloads/libmthca-1.0.2.tar.gz
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires: libibverbs-devel >= 1.0-0.5.rc7
@@ -55,7 +55,7 @@ rm -rf $RPM_BUILD_ROOT
 %{_libdir}/infiniband/mthca.a
 
 %changelog
-* Mon Mar 13 2006 Roland Dreier <rdreier at cisco.com> - 1.0.1-1
+* Mon Mar 14 2006 Roland Dreier <rdreier at cisco.com> - 1.0.2-1
 - New upstream release
 
 * Thu Feb 16 2006 Roland Dreier <rdreier at cisco.com> - 1.0-1
diff --git a/src/ah.c b/src/ah.c
index 9308c3b..3902698 100644
--- a/src/ah.c
+++ b/src/ah.c
@@ -29,7 +29,7 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  *
- * $Id: ah.c 4001 2005-11-09 18:26:28Z roland $
+ * $Id: ah.c 7475 2006-05-24 16:25:02Z roland $
  */
 
 #if HAVE_CONFIG_H
@@ -39,6 +39,7 @@
 #include <stdlib.h>
 #include <netinet/in.h>
 #include <pthread.h>
+#include <string.h>
 
 #include "mthca.h"
 
diff --git a/src/cq.c b/src/cq.c
index ac26271..4ace543 100644
--- a/src/cq.c
+++ b/src/cq.c
@@ -31,7 +31,7 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  *
- * $Id: cq.c 5402 2006-02-14 03:39:35Z roland $
+ * $Id: cq.c 7974 2006-06-13 18:32:27Z roland $
  */
 
 #if HAVE_CONFIG_H
@@ -42,6 +42,7 @@
 #include <stdlib.h>
 #include <pthread.h>
 #include <netinet/in.h>
+#include <string.h>
 
 #include <infiniband/opcode.h>
 
@@ -346,8 +347,18 @@ static inline int mthca_poll_one(struct mthca_cq *cq,
 		wc->wr_id = srq->wrid[wqe_index];
 		mthca_free_srq_wqe(srq, wqe_index);
 	} else {
+		int32_t wqe;
 		wq = &(*cur_qp)->rq;
-		wqe_index = ntohl(cqe->wqe) >> wq->wqe_shift;
+		wqe = ntohl(cqe->wqe);
+		wqe_index = wqe >> wq->wqe_shift;
+		/*
+		 * WQE addr == base - 1 might be reported by Sinai FW
+		 * 1.0.800 and Arbel FW 5.1.400 in receive completion
+		 * with error instead of (rq size - 1).  This bug
+		 * should be fixed in later FW revisions.
+		 */
+		if (wqe_index < 0)
+			wqe_index = wq->max - 1;
 		wc->wr_id = (*cur_qp)->wrid[wqe_index];
 	}
 
diff --git a/src/memfree.c b/src/memfree.c
index ab4f56d..e493878 100644
--- a/src/memfree.c
+++ b/src/memfree.c
@@ -29,7 +29,7 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  *
- * $Id: memfree.c 5473 2006-02-23 18:35:32Z roland $
+ * $Id: memfree.c 7475 2006-05-24 16:25:02Z roland $
  */
 
 #if HAVE_CONFIG_H
@@ -39,6 +39,7 @@
 #include <stdlib.h>
 #include <netinet/in.h>
 #include <pthread.h>
+#include <string.h>
 
 #include "mthca.h"
 
diff --git a/src/mthca.c b/src/mthca.c
index 27b9525..2ecb449 100644
--- a/src/mthca.c
+++ b/src/mthca.c
@@ -30,7 +30,7 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  *
- * $Id: mthca.c 5399 2006-02-14 01:15:51Z roland $
+ * $Id: mthca.c 7475 2006-05-24 16:25:02Z roland $
  */
 
 #if HAVE_CONFIG_H
@@ -43,6 +43,17 @@
 #include <errno.h>
 #include <sys/mman.h>
 #include <pthread.h>
+#include <string.h>
+
+#ifdef HAVE_SYSFS_LIBSYSFS_H
+#include <sysfs/libsysfs.h>
+#endif
+
+#ifndef HAVE_IBV_READ_SYSFS_FILE
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#endif
 
 #include "mthca.h"
 #include "mthca-abi.h"
@@ -217,29 +228,53 @@ static struct ibv_device_ops mthca_dev_ops = {
 	.free_context  = mthca_free_context
 };
 
-struct ibv_device *openib_driver_init(struct sysfs_class_device *sysdev)
+/*
+ * Keep a private implementation of HAVE_IBV_READ_SYSFS_FILE to handle
+ * old versions of libibverbs that didn't implement it.  This can be
+ * removed when libibverbs 1.0.3 or newer is available "everywhere."
+ */
+#ifndef HAVE_IBV_READ_SYSFS_FILE
+static int ibv_read_sysfs_file(const char *dir, const char *file,
+			       char *buf, size_t size)
 {
-	struct sysfs_device    *pcidev;
-	struct sysfs_attribute *attr;
+	char path[256];
+	int fd;
+	int len;
+
+	snprintf(path, sizeof path, "%s/%s", dir, file);
+
+	fd = open(path, O_RDONLY);
+	if (fd < 0)
+		return -1;
+
+	len = read(fd, buf, size);
+
+	close(fd);
+
+	if (len > 0 && buf[len - 1] == '\n')
+		buf[--len] = '\0';
+
+	return len;
+}
+#endif /* HAVE_IBV_READ_SYSFS_FILE */
+
+struct ibv_device *ibv_driver_init(const char *uverbs_sys_path,
+				   int abi_version)
+{
+	char			value[8];
 	struct mthca_device    *dev;
 	unsigned                vendor, device;
 	int                     i;
 
-	pcidev = sysfs_get_classdev_device(sysdev);
-	if (!pcidev)
-		return NULL;
-
-	attr = sysfs_get_device_attr(pcidev, "vendor");
-	if (!attr)
+	if (ibv_read_sysfs_file(uverbs_sys_path, "device/vendor",
+				value, sizeof value) < 0)
 		return NULL;
-	sscanf(attr->value, "%i", &vendor);
-	sysfs_close_attribute(attr);
+	sscanf(value, "%i", &vendor);
 
-	attr = sysfs_get_device_attr(pcidev, "device");
-	if (!attr)
+	if (ibv_read_sysfs_file(uverbs_sys_path, "device/device",
+				value, sizeof value) < 0)
 		return NULL;
-	sscanf(attr->value, "%i", &device);
-	sysfs_close_attribute(attr);
+	sscanf(value, "%i", &device);
 
 	for (i = 0; i < sizeof hca_table / sizeof hca_table[0]; ++i)
 		if (vendor == hca_table[i].vendor &&
@@ -252,8 +287,8 @@ found:
 	dev = malloc(sizeof *dev);
 	if (!dev) {
 		fprintf(stderr, PFX "Fatal: couldn't allocate device for %s\n",
-			sysdev->name);
-		abort();
+			uverbs_sys_path);
+		return NULL;
 	}
 
 	dev->ibv_dev.ops = mthca_dev_ops;
@@ -262,3 +297,25 @@ found:
 
 	return &dev->ibv_dev;
 }
+
+/*
+ * Export the old libsysfs sysfs_class_device-based driver entry point
+ * if libsysfs headers are installed.  It doesn't hurt to export it,
+ * even if libibverbs is new enough not to use it; but if libsysfs
+ * headers are not installed, we can assume that the version of
+ * libibverbs we are building against is new enough not to use
+ * openib_driver_init().
+ */
+#ifdef HAVE_SYSFS_LIBSYSFS_H
+struct ibv_device *openib_driver_init(struct sysfs_class_device *sysdev)
+{
+	int abi_ver = 0;
+	char value[8];
+
+	if (ibv_read_sysfs_file(sysdev->path, "abi_version",
+				value, sizeof value) > 0)
+		abi_ver = strtol(value, NULL, 10);
+
+	return ibv_driver_init(sysdev->path, abi_ver);
+}
+#endif /* HAVE_SYSFS_LIBSYSFS_H */
diff --git a/src/mthca.map b/src/mthca.map
index 0d13d3b..59a8bae 100644
--- a/src/mthca.map
+++ b/src/mthca.map
@@ -1,4 +1,6 @@
 {
-	global: openib_driver_init;
+	global:
+		ibv_driver_init;
+		openib_driver_init;
 	local: *;
 };
diff --git a/src/qp.c b/src/qp.c
index 4c20d65..bee1c94 100644
--- a/src/qp.c
+++ b/src/qp.c
@@ -30,7 +30,7 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  *
- * $Id: qp.c 5520 2006-02-28 05:06:28Z roland $
+ * $Id: qp.c 7475 2006-05-24 16:25:02Z roland $
  */
 
 #if HAVE_CONFIG_H
@@ -40,6 +40,7 @@
 #include <stdlib.h>
 #include <netinet/in.h>
 #include <pthread.h>
+#include <string.h>
 
 #include "mthca.h"
 #include "doorbell.h"
@@ -332,25 +333,7 @@ int mthca_tavor_post_recv(struct ibv_qp *ibqp, struct ibv_recv_wr *wr,
 
 	ind = qp->rq.next_ind;
 
-	for (nreq = 0; wr; ++nreq, wr = wr->next) {
-		if (nreq == MTHCA_TAVOR_MAX_WQES_PER_RECV_DB) {
-			nreq = 0;
-
-			doorbell[0] = htonl((qp->rq.next_ind << qp->rq.wqe_shift) | size0);
-			doorbell[1] = htonl(ibqp->qp_num << 8);
-
-			/*
-			 * Make sure that descriptors are written
-			 * before doorbell is rung.
-			 */
-			mb();
-
-			mthca_write64(doorbell, to_mctx(ibqp->context), MTHCA_RECV_DOORBELL);
-
-			qp->rq.head += MTHCA_TAVOR_MAX_WQES_PER_RECV_DB;
-			size0 = 0;
-		}
-
+	for (nreq = 0; wr; wr = wr->next) {
 		if (wq_overflow(&qp->rq, nreq, to_mcq(qp->ibv_qp.recv_cq))) {
 			ret = -1;
 			*bad_wr = wr;
@@ -400,6 +383,25 @@ int mthca_tavor_post_recv(struct ibv_qp *ibqp, struct ibv_recv_wr *wr,
 		++ind;
 		if (ind >= qp->rq.max)
 			ind -= qp->rq.max;
+
+		++nreq;
+		if (nreq == MTHCA_TAVOR_MAX_WQES_PER_RECV_DB) {
+			nreq = 0;
+
+			doorbell[0] = htonl((qp->rq.next_ind << qp->rq.wqe_shift) | size0);
+			doorbell[1] = htonl(ibqp->qp_num << 8);
+
+			/*
+			 * Make sure that descriptors are written
+			 * before doorbell is rung.
+			 */
+			mb();
+
+			mthca_write64(doorbell, to_mctx(ibqp->context), MTHCA_RECV_DOORBELL);
+
+			qp->rq.head += MTHCA_TAVOR_MAX_WQES_PER_RECV_DB;
+			size0 = 0;
+		}
 	}
 
 out:
diff --git a/src/srq.c b/src/srq.c
index 45b54da..1855262 100644
--- a/src/srq.c
+++ b/src/srq.c
@@ -29,7 +29,7 @@
  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  * SOFTWARE.
  *
- * $Id: srq.c 4017 2005-11-10 17:20:24Z roland $
+ * $Id: srq.c 7475 2006-05-24 16:25:02Z roland $
  */
 
 #if HAVE_CONFIG_H
@@ -39,6 +39,7 @@
 #include <stdlib.h>
 #include <netinet/in.h>
 #include <pthread.h>
+#include <string.h>
 
 #include "mthca.h"
 #include "doorbell.h"
@@ -97,24 +98,7 @@ int mthca_tavor_post_srq_recv(struct ibv_srq *ibsrq,
 
 	first_ind = srq->first_free;
 
-	for (nreq = 0; wr; ++nreq, wr = wr->next) {
-		if (nreq == MTHCA_TAVOR_MAX_WQES_PER_RECV_DB) {
-			nreq = 0;
-
-			doorbell[0] = htonl(first_ind << srq->wqe_shift);
-			doorbell[1] = htonl(srq->srqn << 8);
-
-			/*
-			 * Make sure that descriptors are written
-			 * before doorbell is rung.
-			 */
-			mb();
-
-			mthca_write64(doorbell, to_mctx(ibsrq->context), MTHCA_RECV_DOORBELL);
-
-			first_ind = srq->first_free;
-		}
-
+	for (nreq = 0; wr; wr = wr->next) {
 		ind = srq->first_free;
 
 		if (ind < 0) {
@@ -172,6 +156,23 @@ int mthca_tavor_post_srq_recv(struct ibv_srq *ibsrq,
 
 		srq->wrid[ind]  = wr->wr_id;
 		srq->first_free = next_ind;
+
+		if (++nreq == MTHCA_TAVOR_MAX_WQES_PER_RECV_DB) {
+			nreq = 0;
+
+			doorbell[0] = htonl(first_ind << srq->wqe_shift);
+			doorbell[1] = htonl(srq->srqn << 8);
+
+			/*
+			 * Make sure that descriptors are written
+			 * before doorbell is rung.
+			 */
+			mb();
+
+			mthca_write64(doorbell, to_mctx(ibsrq->context), MTHCA_RECV_DOORBELL);
+
+			first_ind = srq->first_free;
+		}
 	}
 
 	if (nreq) {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ofed/libmthca.git



More information about the Pkg-ofed-commits mailing list