~ubuntu-branches/ubuntu/trusty/libmlx4/trusty-updates

« back to all changes in this revision

Viewing changes to debian/patches/Remove-compatibility-with-older-libibverbs.patch

  • Committer: Package Import Robot
  • Author(s): Rafael David Tinoco
  • Date: 2015-08-05 16:27:04 UTC
  • Revision ID: package-import@ubuntu.com-20150805162704-hq80tvu6tp6p8375
Tags: 1.0.5-1ubuntu1.1
* Remove compatibility with older libibverbs (LP: #1409904)
* Update to use libibverbs extensions support (LP: #1409904)
* Add receive flow steering support (LP: #1409904)
* Add checksum offload support capability (LP: #1409904)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Description: Remove compatibility with libibverbs < 1.1.7-1ubuntu1
 
2
 
 
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 
 
6
sense once we do that.
 
7
 
 
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>
 
11
 
 
12
Origin: upstream, commit: bcc5d064268073cb996bdbac1ae36728db3b2c96
 
13
Bug-Ubuntu: https://launchpad.net/bugs/1409904
 
14
Last-Update: 2015-02-09
 
15
 
 
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 \
 
20
     src/srq.c src/verbs.c
 
21
 
 
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
 
29
-else
 
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)
 
34
-endif
 
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
 
41
 
 
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
 
47
 AC_C_CONST
 
48
 AC_CHECK_SIZEOF(long)
 
49
 
 
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.]))
 
53
+
 
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.])
 
65
 fi
 
66
 
 
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)
 
71
-
 
72
 dnl Now check if for libibverbs 1.0 vs 1.1
 
73
 dummy=if$$
 
74
 cat <<IBV_VERSION > $dummy.c
 
75
@@ -68,8 +67,9 @@ IBV_DEVICE_LIBRARY_EXTENSION
 
76
 IBV_VERSION
 
77
 IBV_DEVICE_LIBRARY_EXTENSION=`$CC $CPPFLAGS -E $dummy.c 2> /dev/null | tail -1`
 
78
 rm -f $dummy.c
 
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.])
 
83
+fi
 
84
 AC_SUBST(IBV_DEVICE_LIBRARY_EXTENSION)
 
85
 
 
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)
 
92
 
 
93
-BuildRequires: libibverbs-devel >= 1.1-0.1.rc2
 
94
+BuildRequires: libibverbs-devel >= 1.1.7
 
95
 
 
96
 %description
 
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
 
100
@@ -40,25 +40,6 @@
 
101
 
 
102
 #include "mlx4.h"
 
103
 
 
104
-#if !(defined(HAVE_IBV_DONTFORK_RANGE) && defined(HAVE_IBV_DOFORK_RANGE))
 
105
-
 
106
-/*
 
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.
 
110
- */
 
111
-static int ibv_dontfork_range(void *base, size_t size)
 
112
-{
 
113
-       return 0;
 
114
-}
 
115
-
 
116
-static int ibv_dofork_range(void *base, size_t size)
 
117
-{
 
118
-       return 0;
 
119
-}
 
120
-
 
121
-#endif /* HAVE_IBV_DONTFORK_RANGE && HAVE_IBV_DOFORK_RANGE */
 
122
-
 
123
 int mlx4_alloc_buf(struct mlx4_buf *buf, size_t size, int page_size)
 
124
 {
 
125
        int ret;
 
126
--- libmlx4-1.0.5.orig/src/mlx4.c
 
127
+++ libmlx4-1.0.5/src/mlx4.c
 
128
@@ -42,10 +42,6 @@
 
129
 #include <pthread.h>
 
130
 #include <string.h>
 
131
 
 
132
-#ifndef HAVE_IBV_REGISTER_DRIVER
 
133
-#include <sysfs/libsysfs.h>
 
134
-#endif
 
135
-
 
136
 #include "mlx4.h"
 
137
 #include "mlx4-abi.h"
 
138
 
 
139
@@ -268,25 +264,7 @@ found:
 
140
        return &dev->ibv_dev;
 
141
 }
 
142
 
 
143
-#ifdef HAVE_IBV_REGISTER_DRIVER
 
144
 static __attribute__((constructor)) void mlx4_register_driver(void)
 
145
 {
 
146
        ibv_register_driver("mlx4", mlx4_driver_init);
 
147
 }
 
148
-#else
 
149
-/*
 
150
- * Export the old libsysfs sysfs_class_device-based driver entry point
 
151
- * if libibverbs does not export an ibv_register_driver() function.
 
152
- */
 
153
-struct ibv_device *openib_driver_init(struct sysfs_class_device *sysdev)
 
154
-{
 
155
-       int abi_version = 0;
 
156
-       char value[8];
 
157
-
 
158
-       if (ibv_read_sysfs_file(sysdev->path, "abi_version",
 
159
-                               value, sizeof value) > 0)
 
160
-               abi_ver = strtol(value, NULL, 10);
 
161
-
 
162
-       return mlx4_driver_init(sysdev->path, abi_version);
 
163
-}
 
164
-#endif /* HAVE_IBV_REGISTER_DRIVER */
 
165
--- libmlx4-1.0.5.orig/src/mlx4.h
 
166
+++ libmlx4-1.0.5/src/mlx4.h
 
167
@@ -83,10 +83,6 @@
 
168
 
 
169
 #define PFX            "mlx4: "
 
170
 
 
171
-#ifndef HAVE_IBV_QPT_RAW_PACKET
 
172
-#define IBV_QPT_RAW_PACKET             8
 
173
-#endif
 
174
-
 
175
 enum {
 
176
        MLX4_STAT_RATE_OFFSET           = 5
 
177
 };
 
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
 
181
 {
 
182
        struct ibv_mr *mr;
 
183
        struct ibv_reg_mr cmd;
 
184
+       struct ibv_reg_mr_resp resp;
 
185
        int ret;
 
186
 
 
187
        mr = malloc(sizeof *mr);
 
188
        if (!mr)
 
189
                return NULL;
 
190
 
 
191
-#ifdef IBV_CMD_REG_MR_HAS_RESP_PARAMS
 
192
-       {
 
193
-               struct ibv_reg_mr_resp resp;
 
194
-
 
195
-               ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t) addr,
 
196
-                                    access, mr, &cmd, sizeof cmd,
 
197
-                                    &resp, sizeof resp);
 
198
-       }
 
199
-#else
 
200
-       ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t) addr, access, mr,
 
201
-                            &cmd, sizeof cmd);
 
202
-#endif
 
203
+       ret = ibv_cmd_reg_mr(pd, addr, length, (uintptr_t) addr,
 
204
+                            access, mr, &cmd, sizeof cmd,
 
205
+                            &resp, sizeof resp);
 
206
        if (ret) {
 
207
                free(mr);
 
208
                return NULL;
 
209
@@ -227,6 +219,7 @@ int mlx4_resize_cq(struct ibv_cq *ibcq,
 
210
 {
 
211
        struct mlx4_cq *cq = to_mcq(ibcq);
 
212
        struct mlx4_resize_cq cmd;
 
213
+       struct ibv_resize_cq_resp resp;
 
214
        struct mlx4_buf buf;
 
215
        int old_cqe, outst_cqe, ret;
 
216
 
 
217
@@ -256,15 +249,8 @@ int mlx4_resize_cq(struct ibv_cq *ibcq,
 
218
        old_cqe = ibcq->cqe;
 
219
        cmd.buf_addr = (uintptr_t) buf.buf;
 
220
 
 
221
-#ifdef IBV_CMD_RESIZE_CQ_HAS_RESP_PARAMS
 
222
-       {
 
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);
 
226
-       }
 
227
-#else
 
228
-       ret = ibv_cmd_resize_cq(ibcq, cqe - 1, &cmd.ibv_cmd, sizeof cmd);
 
229
-#endif
 
230
+       ret = ibv_cmd_resize_cq(ibcq, cqe - 1, &cmd.ibv_cmd, sizeof cmd,
 
231
+                               &resp, sizeof resp);
 
232
        if (ret) {
 
233
                mlx4_free_buf(&buf);
 
234
                goto out;