From 868bacf42bd3edfa47c76a06a7a32acaa18d02cc Mon Sep 17 00:00:00 2001 From: Li Dongyang Date: Tue, 29 Mar 2016 14:57:57 +1100 Subject: [PATCH] LU-6215 o2iblnd: ib_alloc_fast_reg_mr() removed in 4.3 ib_alloc_fast_reg_mr() is replaced by a more generic ib_alloc_mr() since kernel 4.3 Linux-commit: d9f272c523db47a56a64942eb6f25361c400de66 Signed-off-by: Li Dongyang Change-Id: I53f4e7c395c83d731aaa342f308f878b07b54d61 Reviewed-on: http://review.whamcloud.com/19185 Reviewed-by: Dmitry Eremin Tested-by: Jenkins Tested-by: Maloo Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- lnet/autoconf/lustre-lnet.m4 | 22 ++++++++++++++++++++++ lnet/klnds/o2iblnd/o2iblnd.c | 6 ++++++ 2 files changed, 28 insertions(+) diff --git a/lnet/autoconf/lustre-lnet.m4 b/lnet/autoconf/lustre-lnet.m4 index f049677..0e86a56 100644 --- a/lnet/autoconf/lustre-lnet.m4 +++ b/lnet/autoconf/lustre-lnet.m4 @@ -379,6 +379,28 @@ AS_IF([test $ENABLEO2IB != "no"], [ [struct ib_cq_init_attr is used by ib_create_cq]) ]) ]) + +# 4.3 removed ib_alloc_fast_reg_mr() +AS_IF([test $ENABLEO2IB != "no"], [ + LB_CHECK_COMPILE([if 'ib_alloc_fast_reg_mr' exists], + ib_alloc_fast_reg_mr, [ + #ifdef HAVE_COMPAT_RDMA + #undef PACKAGE_NAME + #undef PACKAGE_TARNAME + #undef PACKAGE_VERSION + #undef PACKAGE_STRING + #undef PACKAGE_BUGREPORT + #undef PACKAGE_URL + #include + #endif + #include + ],[ + ib_alloc_fast_reg_mr(NULL, 0); + ],[ + AC_DEFINE(HAVE_IB_ALLOC_FAST_REG_MR, 1, + [ib_alloc_fast_reg_mr is defined]) + ]) +]) ]) # LN_CONFIG_O2IB # diff --git a/lnet/klnds/o2iblnd/o2iblnd.c b/lnet/klnds/o2iblnd/o2iblnd.c index 0710987..38bb39d 100644 --- a/lnet/klnds/o2iblnd/o2iblnd.c +++ b/lnet/klnds/o2iblnd/o2iblnd.c @@ -1521,8 +1521,14 @@ static int kiblnd_alloc_freg_pool(kib_fmr_poolset_t *fps, kib_fmr_pool_t *fpo) goto out_middle; } +#ifdef HAVE_IB_ALLOC_FAST_REG_MR frd->frd_mr = ib_alloc_fast_reg_mr(fpo->fpo_hdev->ibh_pd, LNET_MAX_PAYLOAD/PAGE_SIZE); +#else + frd->frd_mr = ib_alloc_mr(fpo->fpo_hdev->ibh_pd, + IB_MR_TYPE_MEM_REG, + LNET_MAX_PAYLOAD/PAGE_SIZE); +#endif if (IS_ERR(frd->frd_mr)) { rc = PTR_ERR(frd->frd_mr); CERROR("Failed to allocate ib_fast_reg_mr: %d\n", rc); -- 1.8.3.1