Whamcloud - gitweb
Branch HEAD
authorliangzhen <liangzhen>
Fri, 1 Aug 2008 04:11:12 +0000 (04:11 +0000)
committerliangzhen <liangzhen>
Fri, 1 Aug 2008 04:11:12 +0000 (04:11 +0000)
Remove OFED version checking, add checking for specific API

b=14988
i=isaac

lnet/autoconf/lustre-lnet.m4
lnet/klnds/o2iblnd/o2iblnd.c
lnet/klnds/o2iblnd/o2iblnd.h

index df242b0..734d802 100644 (file)
@@ -460,6 +460,7 @@ if test $ENABLEO2IB -eq 0; then
        AC_MSG_RESULT([disabled])
 else
        o2ib_found=false
+
        for O2IBPATH in $O2IBPATHS; do
                if test \( -f ${O2IBPATH}/include/rdma/rdma_cm.h -a \
                           -f ${O2IBPATH}/include/rdma/ib_cm.h -a \
@@ -469,6 +470,7 @@ else
                        break
                fi
        done
+
        if ! $o2ib_found; then
                AC_MSG_RESULT([no])
                case $ENABLEO2IB in
@@ -536,23 +538,41 @@ else
                        fi
                fi
 
-               # version checking is a hack and isn't reliable,
-               # we need verify it with each new ofed release
-
-               if grep -q ib_dma_map_single \
-                       ${O2IBPATH}/include/rdma/ib_verbs.h; then
-                       if grep -q comp_vector \
-                               ${O2IBPATH}/include/rdma/ib_verbs.h; then
-                               IBLND_OFED_VERSION="1025"
-                       else
-                               IBLND_OFED_VERSION="1020"
-                       fi
-               else
-                       IBLND_OFED_VERSION="1010"
-               fi
-
-               AC_DEFINE_UNQUOTED(IBLND_OFED_VERSION, $IBLND_OFED_VERSION,
-                                  [OFED version])
+                LB_LINUX_TRY_COMPILE([
+                       #include <linux/version.h>
+                       #include <linux/pci.h>
+                       #if !HAVE_GFP_T
+                       typedef int gfp_t;
+                       #endif
+                       #include <rdma/ib_verbs.h>
+                ],[
+                        ib_dma_map_single(NULL, NULL, 0, 0);
+                        return 0;
+                ],[
+                        AC_MSG_RESULT(yes)
+                        AC_DEFINE(HAVE_OFED_IB_DMA_MAP, 1,
+                                  [ib_dma_map_single defined])
+                ],[
+                        AC_MSG_RESULT(NO)
+                ])
+
+                LB_LINUX_TRY_COMPILE([
+                       #include <linux/version.h>
+                       #include <linux/pci.h>
+                       #if !HAVE_GFP_T
+                       typedef int gfp_t;
+                       #endif
+                       #include <rdma/ib_verbs.h>
+                ],[
+                        ib_create_cq(NULL, NULL, NULL, NULL, 0, 0);
+                        return 0;
+                ],[
+                        AC_MSG_RESULT(yes)
+                        AC_DEFINE(HAVE_OFED_IB_COMP_VECTOR, 1,
+                                  [has completion vector])
+                ],[
+                        AC_MSG_RESULT(NO)
+                ])
 
                EXTRA_KCFLAGS="$EXTRA_KCFLAGS_save"
        fi
index 3aea97a..9ca7c28 100644 (file)
@@ -739,7 +739,7 @@ kiblnd_create_conn (kib_peer_t *peer, struct rdma_cm_id *cmid, int state)
                 }
         }
 
-#if (IBLND_OFED_VERSION == 1025)
+#ifdef HAVE_OFED_IB_COMP_VECTOR
         cq = ib_create_cq(cmid->device,
                           kiblnd_cq_completion, kiblnd_cq_event, conn,
                           IBLND_CQ_ENTRIES(), 0);
index 55d829d..d83caaa 100644 (file)
@@ -613,7 +613,7 @@ kiblnd_rd_size (kib_rdma_desc_t *rd)
 }
 #endif
 
-#if (IBLND_OFED_VERSION == 1020) || (IBLND_OFED_VERSION == 1025)
+#ifdef HAVE_OFED_IB_DMA_MAP
 
 static inline __u64 kiblnd_dma_map_single(struct ib_device *dev,
                                           void *msg, size_t size,
@@ -665,7 +665,7 @@ static inline unsigned int kiblnd_sg_dma_len(struct ib_device *dev,
 #define KIBLND_CONN_PARAM(e)            ((e)->param.conn.private_data)
 #define KIBLND_CONN_PARAM_LEN(e)        ((e)->param.conn.private_data_len)
 
-#elif (IBLND_OFED_VERSION == 1010)
+#else
 
 static inline dma_addr_t kiblnd_dma_map_single(struct ib_device *dev,
                                                void *msg, size_t size,