AC_DEFINE(HAVE_IB_MAP_MR_SG, 1,
[ib_map_mr_sg exists])
])
+
+ # ib_query_device() removed in 4.5
+ LB_CHECK_COMPILE([if 'struct ib_device' has member 'attrs'],
+ ib_device.attrs, [
+ #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>
+ ],[
+ struct ib_device dev;
+ struct ib_device_attr dev_attr = {};
+ dev.attrs = dev_attr;
+ ],[
+ AC_DEFINE(HAVE_IB_DEVICE_ATTRS, 1,
+ [struct ib_device.attrs is defined])
+ ])
EXTRA_CHECK_INCLUDE=""
]) # ENABLEO2IB != "no"
]) # LN_CONFIG_O2IB
kib_fmr_pool_t *fpo;
int rc;
+#ifndef HAVE_IB_DEVICE_ATTRS
dev_attr = kmalloc(sizeof(*dev_attr), GFP_KERNEL);
if (!dev_attr)
return -ENOMEM;
+#endif
LIBCFS_CPT_ALLOC(fpo, lnet_cpt_table(), fps->fps_cpt, sizeof(*fpo));
if (!fpo) {
fpo->fpo_hdev = kiblnd_current_hdev(dev);
+#ifdef HAVE_IB_DEVICE_ATTRS
+ dev_attr = &fpo->fpo_hdev->ibh_ibdev->attrs;
+#else
rc = ib_query_device(fpo->fpo_hdev->ibh_ibdev, dev_attr);
if (rc) {
CERROR("Query device failed for %s: %d\n",
fpo->fpo_hdev->ibh_ibdev->name, rc);
goto out_dev_attr;
}
+#endif
/* Check for FMR or FastReg support */
fpo->fpo_is_fmr = 0;
if (rc)
goto out_fpo;
+#ifndef HAVE_IB_DEVICE_ATTRS
kfree(dev_attr);
+#endif
fpo->fpo_deadline = cfs_time_shift(IBLND_POOL_DEADLINE);
fpo->fpo_owner = fps;
*pp_fpo = fpo;
LIBCFS_FREE(fpo, sizeof(*fpo));
out_dev_attr:
+#ifndef HAVE_IB_DEVICE_ATTRS
kfree(dev_attr);
+#endif
return rc;
}
static int
kiblnd_hdev_get_attr(kib_hca_dev_t *hdev)
{
- struct ib_device_attr *attr;
- int rc;
+#ifndef HAVE_IB_DEVICE_ATTRS
+ struct ib_device_attr *attr;
+ int rc;
+#endif
/* It's safe to assume a HCA can handle a page size
* matching that of the native system */
hdev->ibh_page_size = 1 << PAGE_SHIFT;
hdev->ibh_page_mask = ~((__u64)hdev->ibh_page_size - 1);
+#ifdef HAVE_IB_DEVICE_ATTRS
+ hdev->ibh_mr_size = hdev->ibh_ibdev->attrs.max_mr_size;
+#else
LIBCFS_ALLOC(attr, sizeof(*attr));
if (attr == NULL) {
CERROR("Out of memory\n");
CERROR("Failed to query IB device: %d\n", rc);
return rc;
}
+#endif
if (hdev->ibh_mr_size == ~0ULL) {
hdev->ibh_mr_shift = 64;