|
|
f4cdaa |
From af898ec56092e273faa3abc7fe6d02c506e2f441 Mon Sep 17 00:00:00 2001
|
|
|
f4cdaa |
From: Honggang Li <honli@redhat.com>
|
|
|
f4cdaa |
Date: Thu, 4 Jun 2020 14:33:38 +0800
|
|
|
f4cdaa |
Subject: [PATCH] libibverbs: Fix ABI_placeholder1 and ABI_placeholder2
|
|
|
f4cdaa |
assignment
|
|
|
f4cdaa |
|
|
|
f4cdaa |
[ Upstream commit 88789b7ba618d55491026c74a9a31699805e5934 ]
|
|
|
f4cdaa |
|
|
|
f4cdaa |
The assignment of ABI_placeholder1 and ABI_placeholder2 must be
|
|
|
f4cdaa |
after the provider populated context_ex->ibv_create_flow and
|
|
|
f4cdaa |
context_ex->ibv_destroy_flow.
|
|
|
f4cdaa |
|
|
|
f4cdaa |
Applications, which compiled against old libibverbs released between
|
|
|
f4cdaa |
commit 501b53b30752 and 1111cf9895bb, will fail if they are linked
|
|
|
f4cdaa |
with libibverbs released after 1111cf9895bb and call ibv_create_flow.
|
|
|
f4cdaa |
|
|
|
f4cdaa |
[1] 501b53b30752 ("Fix create/destroy flow API")
|
|
|
f4cdaa |
|
|
|
f4cdaa |
Fixes: 1111cf9895bb ("verbs: Always allocate a verbs_context")
|
|
|
f4cdaa |
Signed-off-by: Honggang Li <honli@redhat.com>
|
|
|
f4cdaa |
Signed-off-by: Nicolas Morey-Chaisemartin <nmoreychaisemartin@suse.com>
|
|
|
f4cdaa |
---
|
|
|
f4cdaa |
libibverbs/device.c | 34 +++++++++++++++++-----------------
|
|
|
f4cdaa |
1 file changed, 17 insertions(+), 17 deletions(-)
|
|
|
f4cdaa |
|
|
|
f4cdaa |
diff --git a/libibverbs/device.c b/libibverbs/device.c
|
|
|
f4cdaa |
index d71051343b0b..04fc087d431d 100644
|
|
|
f4cdaa |
--- a/libibverbs/device.c
|
|
|
f4cdaa |
+++ b/libibverbs/device.c
|
|
|
f4cdaa |
@@ -240,23 +240,6 @@ int verbs_init_context(struct verbs_context *context_ex,
|
|
|
f4cdaa |
context_ex->context.abi_compat = __VERBS_ABI_IS_EXTENDED;
|
|
|
f4cdaa |
context_ex->sz = sizeof(*context_ex);
|
|
|
f4cdaa |
|
|
|
f4cdaa |
- /*
|
|
|
f4cdaa |
- * In order to maintain backward/forward binary compatibility
|
|
|
f4cdaa |
- * with apps compiled against libibverbs-1.1.8 that use the
|
|
|
f4cdaa |
- * flow steering addition, we need to set the two
|
|
|
f4cdaa |
- * ABI_placeholder entries to match the driver set flow
|
|
|
f4cdaa |
- * entries. This is because apps compiled against
|
|
|
f4cdaa |
- * libibverbs-1.1.8 use an inline ibv_create_flow and
|
|
|
f4cdaa |
- * ibv_destroy_flow function that looks in the placeholder
|
|
|
f4cdaa |
- * spots for the proper entry points. For apps compiled
|
|
|
f4cdaa |
- * against libibverbs-1.1.9 and later, the inline functions
|
|
|
f4cdaa |
- * will be looking in the right place.
|
|
|
f4cdaa |
- */
|
|
|
f4cdaa |
- context_ex->ABI_placeholder1 =
|
|
|
f4cdaa |
- (void (*)(void))context_ex->ibv_create_flow;
|
|
|
f4cdaa |
- context_ex->ABI_placeholder2 =
|
|
|
f4cdaa |
- (void (*)(void))context_ex->ibv_destroy_flow;
|
|
|
f4cdaa |
-
|
|
|
f4cdaa |
context_ex->priv = calloc(1, sizeof(*context_ex->priv));
|
|
|
f4cdaa |
if (!context_ex->priv) {
|
|
|
f4cdaa |
errno = ENOMEM;
|
|
|
f4cdaa |
@@ -314,6 +297,23 @@ static void set_lib_ops(struct verbs_context *vctx)
|
|
|
f4cdaa |
#undef ibv_query_port
|
|
|
f4cdaa |
vctx->context.ops._compat_query_port = ibv_query_port;
|
|
|
f4cdaa |
vctx->query_port = __lib_query_port;
|
|
|
f4cdaa |
+
|
|
|
f4cdaa |
+ /*
|
|
|
f4cdaa |
+ * In order to maintain backward/forward binary compatibility
|
|
|
f4cdaa |
+ * with apps compiled against libibverbs-1.1.8 that use the
|
|
|
f4cdaa |
+ * flow steering addition, we need to set the two
|
|
|
f4cdaa |
+ * ABI_placeholder entries to match the driver set flow
|
|
|
f4cdaa |
+ * entries. This is because apps compiled against
|
|
|
f4cdaa |
+ * libibverbs-1.1.8 use an inline ibv_create_flow and
|
|
|
f4cdaa |
+ * ibv_destroy_flow function that looks in the placeholder
|
|
|
f4cdaa |
+ * spots for the proper entry points. For apps compiled
|
|
|
f4cdaa |
+ * against libibverbs-1.1.9 and later, the inline functions
|
|
|
f4cdaa |
+ * will be looking in the right place.
|
|
|
f4cdaa |
+ */
|
|
|
f4cdaa |
+ vctx->ABI_placeholder1 =
|
|
|
f4cdaa |
+ (void (*)(void))vctx->ibv_create_flow;
|
|
|
f4cdaa |
+ vctx->ABI_placeholder2 =
|
|
|
f4cdaa |
+ (void (*)(void))vctx->ibv_destroy_flow;
|
|
|
f4cdaa |
}
|
|
|
f4cdaa |
|
|
|
f4cdaa |
struct ibv_context *verbs_open_device(struct ibv_device *device, void *private_data)
|
|
|
f4cdaa |
--
|
|
|
f4cdaa |
2.25.4
|
|
|
f4cdaa |
|