1
Description: Remove compatibility with libibverbs < 1.1.7-1ubuntu1
3
Since the changes to add verbs extensions / XRC support will break
4
compatibility with libibverbs < 1.1.7-1ubuntu1, take this chance to
5
strip out all the backwards compatibility code that won't make any
8
Author: Roland Dreier <roland@purestorage.com>
9
Signed-off-by: Roland Dreier <roland@purestorage.com>
10
Signed-off-by: Rafael David Tinoco <inaddy@ubuntu.com>
12
Origin: upstream, commit: bcc5d064268073cb996bdbac1ae36728db3b2c96
13
Bug-Ubuntu: https://launchpad.net/bugs/1409904
14
Last-Update: 2015-02-09
16
--- libmlx4-1.0.5.orig/Makefile.am
17
+++ libmlx4-1.0.5/Makefile.am
18
@@ -5,19 +5,12 @@ mlx4_version_script = @MLX4_VERSION_SCRI
19
MLX4_SOURCES = src/buf.c src/cq.c src/dbrec.c src/mlx4.c src/qp.c \
22
-if HAVE_IBV_DEVICE_LIBRARY_EXTENSION
23
- lib_LTLIBRARIES = src/libmlx4.la
24
- src_libmlx4_la_SOURCES = $(MLX4_SOURCES)
25
- src_libmlx4_la_LDFLAGS = -avoid-version -release @IBV_DEVICE_LIBRARY_EXTENSION@ \
26
- $(mlx4_version_script)
27
- mlx4confdir = $(sysconfdir)/libibverbs.d
28
- mlx4conf_DATA = mlx4.driver
30
- mlx4libdir = $(libdir)/infiniband
31
- mlx4lib_LTLIBRARIES = src/mlx4.la
32
- src_mlx4_la_SOURCES = $(MLX4_SOURCES)
33
- src_mlx4_la_LDFLAGS = -avoid-version -module $(mlx4_version_script)
35
+lib_LTLIBRARIES = src/libmlx4.la
36
+src_libmlx4_la_SOURCES = $(MLX4_SOURCES)
37
+src_libmlx4_la_LDFLAGS = -avoid-version -release @IBV_DEVICE_LIBRARY_EXTENSION@ \
38
+ $(mlx4_version_script)
39
+mlx4confdir = $(sysconfdir)/libibverbs.d
40
+mlx4conf_DATA = mlx4.driver
42
EXTRA_DIST = src/doorbell.h src/mlx4.h src/mlx4-abi.h src/wqe.h \
43
src/mlx4.map libmlx4.spec.in mlx4.driver
44
--- libmlx4-1.0.5.orig/configure.ac
45
+++ libmlx4-1.0.5/configure.ac
46
@@ -45,21 +45,20 @@ dnl Checks for typedefs, structures, and
50
+dnl Checks for library functions
51
+AC_CHECK_FUNC(ibv_register_driver, [],
52
+ AC_MSG_ERROR([ibv_register_driver() not found. libmlx4 requires libibverbs >= 1.1.7.]))
54
AC_CACHE_CHECK([for IBV_QPT_RAW_PACKET],
55
[ac_cv_ibv_qpt_raw_packet],
56
- [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
57
+ [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([#include <infiniband/verbs.h>],
58
[enum ibv_qp_type qpt = IBV_QPT_RAW_PACKET;])],
59
[ac_cv_ibv_qpt_raw_packet=yes],
60
[ac_cv_ibv_qpt_raw_packet=no])])
61
-if test $ac_cv_ibv_qpt_raw_packet = yes; then
62
- AC_DEFINE([HAVE_IBV_QPT_RAW_PACKET], 1, [libibverbs has raw packet QP support])
63
+if test $ac_cv_ibv_qpt_raw_packet = no; then
64
+ AC_MSG_ERROR([IBV_QPT_RAW_PACKET not found. libmlx4 requires libibverbs >= 1.1.7.])
67
-dnl Checks for library functions
68
-AC_CHECK_FUNC(ibv_read_sysfs_file, [],
69
- AC_MSG_ERROR([ibv_read_sysfs_file() not found. libmlx4 requires libibverbs >= 1.0.3.]))
70
-AC_CHECK_FUNCS(ibv_dontfork_range ibv_dofork_range ibv_register_driver)
72
dnl Now check if for libibverbs 1.0 vs 1.1
74
cat <<IBV_VERSION > $dummy.c
75
@@ -68,8 +67,9 @@ IBV_DEVICE_LIBRARY_EXTENSION
77
IBV_DEVICE_LIBRARY_EXTENSION=`$CC $CPPFLAGS -E $dummy.c 2> /dev/null | tail -1`
79
-AM_CONDITIONAL(HAVE_IBV_DEVICE_LIBRARY_EXTENSION,
80
- test $IBV_DEVICE_LIBRARY_EXTENSION != IBV_DEVICE_LIBRARY_EXTENSION)
81
+if test $IBV_DEVICE_LIBRARY_EXTENSION = IBV_DEVICE_LIBRARY_EXTENSION; then
82
+ AC_MSG_ERROR([libibverbs does not define IBV_DEVICE_LIBRARY_EXTENSION.])
84
AC_SUBST(IBV_DEVICE_LIBRARY_EXTENSION)
86
AC_CACHE_CHECK(whether ld accepts --version-script, ac_cv_version_script,
87
--- libmlx4-1.0.5.orig/libmlx4.spec.in
88
+++ libmlx4-1.0.5/libmlx4.spec.in
89
@@ -9,7 +9,7 @@ Url: http://openfabrics.org/
90
Source: http://openfabrics.org/downloads/mlx4/libmlx4-1.0.5.tar.gz
91
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
93
-BuildRequires: libibverbs-devel >= 1.1-0.1.rc2
94
+BuildRequires: libibverbs-devel >= 1.1.7
97
libmlx4 provides a device-specific userspace driver for Mellanox
98
--- libmlx4-1.0.5.orig/src/buf.c
99
+++ libmlx4-1.0.5/src/buf.c
104
-#if !(defined(HAVE_IBV_DONTFORK_RANGE) && defined(HAVE_IBV_DOFORK_RANGE))
107
- * If libibverbs isn't exporting these functions, then there's no
108
- * point in doing it here, because the rest of libibverbs isn't going
109
- * to be fork-safe anyway.
111
-static int ibv_dontfork_range(void *base, size_t size)
116
-static int ibv_dofork_range(void *base, size_t size)
121
-#endif /* HAVE_IBV_DONTFORK_RANGE && HAVE_IBV_DOFORK_RANGE */
123
int mlx4_alloc_buf(struct mlx4_buf *buf, size_t size, int page_size)
126
--- libmlx4-1.0.5.orig/src/mlx4.c
127
+++ libmlx4-1.0.5/src/mlx4.c
132
-#ifndef HAVE_IBV_REGISTER_DRIVER
133
-#include <sysfs/libsysfs.h>
137
#include "mlx4-abi.h"
139
@@ -268,25 +264,7 @@ found:
140
return &dev->ibv_dev;
143
-#ifdef HAVE_IBV_REGISTER_DRIVER
144
static __attribute__((constructor)) void mlx4_register_driver(void)
146
ibv_register_driver("mlx4", mlx4_driver_init);
150
- * Export the old libsysfs sysfs_class_device-based driver entry point
151
- * if libibverbs does not export an ibv_register_driver() function.
153
-struct ibv_device *openib_driver_init(struct sysfs_class_device *sysdev)
155
- int abi_version = 0;
158
- if (ibv_read_sysfs_file(sysdev->path, "abi_version",
159
- value, sizeof value) > 0)
160
- abi_ver = strtol(value, NULL, 10);
162
- return mlx4_driver_init(sysdev->path, abi_version);
164
-#endif /* HAVE_IBV_REGISTER_DRIVER */
165
--- libmlx4-1.0.5.orig/src/mlx4.h
166
+++ libmlx4-1.0.5/src/mlx4.h
171
-#ifndef HAVE_IBV_QPT_RAW_PACKET
172
-#define IBV_QPT_RAW_PACKET 8
176
MLX4_STAT_RATE_OFFSET = 5
178
--- libmlx4-1.0.5.orig/src/verbs.c
179
+++ libmlx4-1.0.5/src/verbs.c
180
@@ -112,24 +112,16 @@ struct ibv_mr *mlx4_reg_mr(struct ibv_pd
183
struct ibv_reg_mr cmd;
184
+ struct ibv_reg_mr_resp resp;
187
mr = malloc(sizeof *mr);
191
-#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS
193
- struct ibv_reg_mr_resp resp;
195
- ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t) addr,
196
- access, mr, &cmd, sizeof cmd,
197
- &resp, sizeof resp);
200
- ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t) addr, access, mr,
203
+ ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t) addr,
204
+ access, mr, &cmd, sizeof cmd,
205
+ &resp, sizeof resp);
209
@@ -227,6 +219,7 @@ int mlx4_resize_cq(struct ibv_cq *ibcq,
211
struct mlx4_cq *cq = to_mcq(ibcq);
212
struct mlx4_resize_cq cmd;
213
+ struct ibv_resize_cq_resp resp;
215
int old_cqe, outst_cqe, ret;
217
@@ -256,15 +249,8 @@ int mlx4_resize_cq(struct ibv_cq *ibcq,
219
cmd.buf_addr = (uintptr_t) buf.buf;
221
-#ifdef IBV_CMD_RESIZE_CQ_HAS_RESP_PARAMS
223
- struct ibv_resize_cq_resp resp;
224
- ret = ibv_cmd_resize_cq(ibcq, cqe - 1, &cmd.ibv_cmd, sizeof cmd,
225
- &resp, sizeof resp);
228
- ret = ibv_cmd_resize_cq(ibcq, cqe - 1, &cmd.ibv_cmd, sizeof cmd);
230
+ ret = ibv_cmd_resize_cq(ibcq, cqe - 1, &cmd.ibv_cmd, sizeof cmd,
231
+ &resp, sizeof resp);