A flags argument was added to ib_alloc_pd() in Linux 4.9 commit
ed082d36a7b2c27d1cda55fdfb28af18040c4a89. The fix for LU-9026, Lustre
commit
e4297ef38561f1e788ba73ca0c8078a09dc8c303, accounted for this
change by checking for the removal of ib_get_dma_mr() (which happened
separately). However, SLES 12 SP3 beta 1 adopted the extra argument
to ib_alloc_pd(), but retains the ib_get_dma_mr() function. As a
result, we need an explicit check for the two argument version of
ib_alloc_pd().
Signed-off-by: Chris Horn <hornc@cray.com>
Change-Id: Iecde347e9f18149cac63e243082a2686de260ba7
Reviewed-on: https://review.whamcloud.com/26934
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Tested-by: Jenkins
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
[struct ib_device.attrs is defined])
])
+ # A flags argument was added to ib_alloc_pd() in Linux 4.9,
+ # commit ed082d36a7b2c27d1cda55fdfb28af18040c4a89
+ LB_CHECK_COMPILE([if 2arg 'ib_alloc_pd' exists],
+ ib_alloc_pd, [
+ #ifdef HAVE_COMPAT_RDMA
+ #undef PACKAGE_NAME
+ #undef PACKAGE_TARNAME
+ #undef PACKAGE_VERSION
+ #undef PACKAGE_STRING
+ #undef PACKAGE_BUGREPORT
+ #undef PACKAGE_URL
+ #include <linux/compat-2.6.h>
+ #endif
+ #include <rdma/ib_verbs.h>
+ ],[
+ ib_alloc_pd(NULL, 0);
+ ],[
+ AC_DEFINE(HAVE_IB_ALLOC_PD_2ARGS, 1,
+ [ib_alloc_pd has 2 arguments])
+ ])
+
LB_CHECK_COMPILE([if function 'ib_inc_rkey' is defined],
ib_inc_rkey, [
#ifdef HAVE_COMPAT_RDMA
hdev->ibh_cmid = cmid;
hdev->ibh_ibdev = cmid->device;
-#ifdef HAVE_IB_GET_DMA_MR
- pd = ib_alloc_pd(cmid->device);
-#else
+#ifdef HAVE_IB_ALLOC_PD_2ARGS
pd = ib_alloc_pd(cmid->device, 0);
+#else
+ pd = ib_alloc_pd(cmid->device);
#endif
if (IS_ERR(pd)) {
rc = PTR_ERR(pd);