Whamcloud - gitweb
Branch HEAD
authorliangzhen <liangzhen>
Tue, 23 Oct 2007 07:23:22 +0000 (07:23 +0000)
committerliangzhen <liangzhen>
Tue, 23 Oct 2007 07:23:22 +0000 (07:23 +0000)
Support both ofed 1.2.0 and 1.2.5

b=13378
i=isaac

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

index 133c4a1..8dfedd9 100644 (file)
@@ -4,7 +4,7 @@ tbd         Cluster File Systems, Inc. <info@clusterfs.com>
        socklnd   - any kernel supported by Lustre,
        qswlnd    - Qsnet kernel modules 5.20 and later,
        openiblnd - IbGold 1.8.2,
-       o2iblnd   - OFED 1.1 and 1.2,
+       o2iblnd   - OFED 1.1 and 1.2.0, 1.2.5
        viblnd    - Voltaire ibhost 3.4.5 and later,
        ciblnd    - Topspin 3.2.0,
        iiblnd    - Infiniserv 3.3 + PathBits patch,
@@ -20,7 +20,7 @@ tbd         Cluster File Systems, Inc. <info@clusterfs.com>
        socklnd   - any kernel supported by Lustre,
        qswlnd    - Qsnet kernel modules 5.20 and later,
        openiblnd - IbGold 1.8.2,
-       o2iblnd   - OFED 1.1 and 1.2,
+       o2iblnd   - OFED 1.1 and 1.2.0, 1.2.5.
        viblnd    - Voltaire ibhost 3.4.5 and later,
        ciblnd    - Topspin 3.2.0,
        iiblnd    - Infiniserv 3.3 + PathBits patch,
index 4e88907..5c2dc39 100644 (file)
@@ -536,6 +536,7 @@ else
        EXTRA_LNET_INCLUDE="$O2IBCPPFLAGS $EXTRA_LNET_INCLUDE"
        LB_LINUX_TRY_COMPILE([
                #include <linux/version.h>
+               #include <linux/pci.h>
                #if !HAVE_GFP_T
                typedef int gfp_t;
                #endif
@@ -568,11 +569,19 @@ else
                O2IBCPPFLAGS=""
        ])
 
+# version checking is a hack and isn't reliable, we need verify it
+# with each new ofed release
+
        IB_DMA_MAP="`grep -c ib_dma_map_single ${O2IBPATH}/include/rdma/ib_verbs.h`"
        if test "$IB_DMA_MAP" != 0 ; then
-               IBLND_OFED_VERSION="102"
+               IB_COMP_VECT="`grep -c comp_vector ${O2IBPATH}/include/rdma/ib_verbs.h`"
+               if test "$IB_COMP_VECT" != 0 ; then
+                       IBLND_OFED_VERSION="1025"
+               else
+                       IBLND_OFED_VERSION="1020"
+               fi
        else
-               IBLND_OFED_VERSION="101"
+               IBLND_OFED_VERSION="1010"
        fi
 
         AC_DEFINE_UNQUOTED(IBLND_OFED_VERSION, $IBLND_OFED_VERSION,
index 226d453..ae9e882 100644 (file)
@@ -716,9 +716,15 @@ kiblnd_create_conn (kib_peer_t *peer, struct rdma_cm_id *cmid, int state)
                 }
         }
 
+#if (IBLND_OFED_VERSION == 1025)
+        cq = ib_create_cq(cmid->device,
+                          kiblnd_cq_completion, kiblnd_cq_event, conn,
+                          IBLND_CQ_ENTRIES(), 0);
+#else
         cq = ib_create_cq(cmid->device,
                           kiblnd_cq_completion, kiblnd_cq_event, conn,
                           IBLND_CQ_ENTRIES());
+#endif
         if (!IS_ERR(cq)) {
                 conn->ibc_cq = cq;
         } else {
index 5933551..2ada24f 100644 (file)
@@ -49,6 +49,7 @@
 #include <linux/kmod.h>
 #include <linux/sysctl.h>
 #include <linux/random.h>
+#include <linux/pci.h>
 
 #include <net/sock.h>
 #include <linux/in.h>
@@ -570,7 +571,7 @@ kiblnd_rd_size (kib_rdma_desc_t *rd)
 }
 #endif
 
-#if (IBLND_OFED_VERSION == 102)
+#if (IBLND_OFED_VERSION == 1020) || (IBLND_OFED_VERSION == 1025)
 
 static inline __u64 kiblnd_dma_map_single(struct ib_device *dev,
                                           void *msg, size_t size,
@@ -622,7 +623,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 == 101)
+#elif (IBLND_OFED_VERSION == 1010)
 
 static inline dma_addr_t kiblnd_dma_map_single(struct ib_device *dev,
                                                void *msg, size_t size,
index 3f271df..c2e10e3 100644 (file)
@@ -1326,9 +1326,12 @@ void
 kiblnd_connect_peer (kib_peer_t *peer)
 {
         struct rdma_cm_id *cmid;
-        struct sockaddr_in sockaddr;
+        kib_net_t         *net = peer->ibp_ni->ni_data;
+        struct sockaddr_in srcaddr;
+        struct sockaddr_in dstaddr;
         int                rc;
 
+        LASSERT (net != NULL);
         LASSERT (peer->ibp_connecting > 0);
 
         cmid = rdma_create_id(kiblnd_cm_callback, peer, RDMA_PS_TCP);
@@ -1339,14 +1342,20 @@ kiblnd_connect_peer (kib_peer_t *peer)
                 goto failed;
         }
 
-        memset(&sockaddr, 0, sizeof(sockaddr));
-        sockaddr.sin_family = AF_INET;
-        sockaddr.sin_port = htons(*kiblnd_tunables.kib_service);
-        sockaddr.sin_addr.s_addr = htonl(LNET_NIDADDR(peer->ibp_nid));
+        memset(&srcaddr, 0, sizeof(srcaddr));
+        srcaddr.sin_family = AF_INET;
+        srcaddr.sin_addr.s_addr = htonl(net->ibn_dev->ibd_ifip);
+
+        memset(&dstaddr, 0, sizeof(dstaddr));
+        dstaddr.sin_family = AF_INET;
+        dstaddr.sin_port = htons(*kiblnd_tunables.kib_service);
+        dstaddr.sin_addr.s_addr = htonl(LNET_NIDADDR(peer->ibp_nid));
 
         kiblnd_peer_addref(peer);               /* cmid's ref */
 
-        rc = rdma_resolve_addr(cmid, NULL, (struct sockaddr *)&sockaddr,
+        rc = rdma_resolve_addr(cmid,
+                               (struct sockaddr *)&srcaddr,
+                               (struct sockaddr *)&dstaddr,
                                *kiblnd_tunables.kib_timeout * 1000);
         if (rc == 0)
                 return;