From fef9328314716dbdf9759141988f7b043206d601 Mon Sep 17 00:00:00 2001 From: Vinit Agnihotri Date: Tue, 27 Jan 2015 00:35:09 -0800 Subject: [PATCH] autoconf options for qib driver for RHEL 6.6 Reviewed-by: Mike Marciniszyn Signed-off-by: Vinit Agnihotri --- compat/compat-3.13.c | 16 +++++++- config/rdma.m4 | 96 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+), 2 deletions(-) diff --git a/compat/compat-3.13.c b/compat/compat-3.13.c index a76d1de..3f6cdc8 100644 --- a/compat/compat-3.13.c +++ b/compat/compat-3.13.c @@ -16,7 +16,6 @@ int pcie_get_mps(struct pci_dev *dev) } EXPORT_SYMBOL(pcie_get_mps); -#ifdef HAVE_PCI_DEV_PCIE_MPSS /** * pcie_set_mps - set PCI Express maximum payload size * @dev: PCI device to query @@ -28,17 +27,30 @@ EXPORT_SYMBOL(pcie_get_mps); int pcie_set_mps(struct pci_dev *dev, int mps) { u16 v; +#ifndef HAVE_PIC_DEV_PCIE_MPSS + int pos; + u16 reg16; +#endif if (mps < 128 || mps > 4096 || !is_power_of_2(mps)) return -EINVAL; v = ffs(mps) - 8; + +#ifdef HAVE_PCI_DEV_PCIE_MPSS if (v > dev->pcie_mpss) return -EINVAL; +#else + pos = pci_find_capability(dev, PCI_CAP_ID_EXP); + if (!pos) + return -EINVAL; + pci_read_config_word(dev, pos + PCI_EXP_DEVCAP, ®16); + if (v > (reg16 & PCI_EXP_DEVCAP_PAYLOAD)) + return -EINVAL; +#endif v <<= 5; return pcie_capability_clear_and_set_word(dev, PCI_EXP_DEVCTL, PCI_EXP_DEVCTL_PAYLOAD, v); } EXPORT_SYMBOL(pcie_set_mps); -#endif diff --git a/config/rdma.m4 b/config/rdma.m4 index fc0ae33..2c68652 100644 --- a/config/rdma.m4 +++ b/config/rdma.m4 @@ -139,6 +139,38 @@ AC_DEFUN([RDMA_CONFIG_COMPAT], dnl Examine kernel functionality AC_DEFUN([LINUX_CONFIG_COMPAT], [ + AC_MSG_CHECKING([if file_system_type has mount method]) + LB_LINUX_TRY_COMPILE([ + #include + ],[ + struct file_system_type fst; + + fst.mount = NULL; + return 0; + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_MOUNT_METHOD, 1, + [mount method defined]) + ],[ + AC_MSG_RESULT(no) + ]) + + AC_MSG_CHECKING([if kernel has get_next_ino]) + LB_LINUX_TRY_COMPILE([ + #include + ],[ + unsigned int ino; + + ino = get_next_ino(); + return 0; + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_GET_NEXT_INO, 1, + [get_next_ino defined]) + ],[ + AC_MSG_RESULT(no) + ]) + AC_MSG_CHECKING([if kernel has ktime_get_ns]) LB_LINUX_TRY_COMPILE([ #include @@ -346,6 +378,70 @@ AC_DEFUN([LINUX_CONFIG_COMPAT], AC_MSG_RESULT(no) ]) + AC_MSG_CHECKING([if pci.h pci_msix_vec_count]) + LB_LINUX_TRY_COMPILE([ + #include + ],[ + int x = pci_msix_vec_count(NULL); + + return 0; + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_PCI_MSIX_VEC_COUNT, 1, + [pci_msix_vec_count is defined]) + ],[ + AC_MSG_RESULT(no) + ]) + + AC_MSG_CHECKING([if pci_dev has msix_cap]) + LB_LINUX_TRY_COMPILE([ + #include + ],[ + struct pci_dev pdev; + pdev.msix_cap = 0; + + return 0; + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_PCI_MSIX_CAP, 1, + [msix_cap is defined]) + ],[ + AC_MSG_RESULT(no) + ]) + + AC_MSG_CHECKING([if mm_struct has pinned_vm]) + LB_LINUX_TRY_COMPILE([ + #include + ],[ + struct mm_types mmt; + mmt.pinned_vm = 0; + + return 0; + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_PINNED_VM, 1, + [pinned_vm is defined]) + ],[ + AC_MSG_RESULT(no) + ]) + + AC_MSG_CHECKING([if kernel has idr_alloc]) + LB_LINUX_TRY_COMPILE([ + #include + ],[ + int x; + x = idr_alloc(NULL, NULL, 0, 0, 0); + + return 0; + ],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_IDR_ALLOC, 1, + [idr_alloc is defined]) + ],[ + AC_MSG_RESULT(no) + ]) + + AC_MSG_CHECKING([if struct iscsi_transport has attr_is_visible]) LB_LINUX_TRY_COMPILE([ #include -- 2.41.0