Whamcloud - gitweb
LU-709 build: cleanup lustre-lnet.m4 and ofed.m4
[fs/lustre-release.git] / lnet / klnds / o2iblnd / o2iblnd.c
index 216dbff..e9ebd5f 100644 (file)
@@ -1,6 +1,4 @@
-/* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
- * vim:expandtab:shiftwidth=8:tabstop=8:
- *
+/*
  * GPL HEADER START
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -28,6 +26,8 @@
 /*
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright (c) 2011, Whamcloud, Inc.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -623,6 +623,10 @@ kiblnd_debug_conn (kib_conn_t *conn)
         cfs_list_for_each(tmp, &conn->ibc_early_rxs)
                 kiblnd_debug_rx(cfs_list_entry(tmp, kib_rx_t, rx_list));
 
+        CDEBUG(D_CONSOLE, "   tx_noops:\n");
+        cfs_list_for_each(tmp, &conn->ibc_tx_noops)
+                kiblnd_debug_tx(cfs_list_entry(tmp, kib_tx_t, tx_list));
+
         CDEBUG(D_CONSOLE, "   tx_queue_nocred:\n");
         cfs_list_for_each(tmp, &conn->ibc_tx_queue_nocred)
                 kiblnd_debug_tx(cfs_list_entry(tmp, kib_tx_t, tx_list));
@@ -729,6 +733,7 @@ kiblnd_create_conn(kib_peer_t *peer, struct rdma_cm_id *cmid,
         conn->ibc_cmid = cmid;
 
         CFS_INIT_LIST_HEAD(&conn->ibc_early_rxs);
+        CFS_INIT_LIST_HEAD(&conn->ibc_tx_noops);
         CFS_INIT_LIST_HEAD(&conn->ibc_tx_queue);
         CFS_INIT_LIST_HEAD(&conn->ibc_tx_queue_rsrvd);
         CFS_INIT_LIST_HEAD(&conn->ibc_tx_queue_nocred);
@@ -892,6 +897,7 @@ kiblnd_destroy_conn (kib_conn_t *conn)
         LASSERT (!cfs_in_interrupt());
         LASSERT (cfs_atomic_read(&conn->ibc_refcount) == 0);
         LASSERT (cfs_list_empty(&conn->ibc_early_rxs));
+        LASSERT (cfs_list_empty(&conn->ibc_tx_noops));
         LASSERT (cfs_list_empty(&conn->ibc_tx_queue));
         LASSERT (cfs_list_empty(&conn->ibc_tx_queue_rsrvd));
         LASSERT (cfs_list_empty(&conn->ibc_tx_queue_nocred));
@@ -1623,7 +1629,7 @@ kiblnd_fmr_pool_map(kib_fmr_poolset_t *fps, __u64 *pages, int npages,
                 fps->fps_version ++;
                 cfs_list_add_tail(&fpo->fpo_list, &fps->fps_pool_list);
         } else {
-                fps->fps_next_retry = cfs_time_shift(10);
+                fps->fps_next_retry = cfs_time_shift(IBLND_POOL_RETRY);
         }
         cfs_spin_unlock(&fps->fps_lock);
 
@@ -1818,8 +1824,7 @@ kiblnd_pool_alloc_node(kib_poolset_t *ps)
         if (rc == 0) {
                 cfs_list_add_tail(&pool->po_list, &ps->ps_pool_list);
         } else {
-                /* retry 10 seconds later */
-                ps->ps_next_retry = cfs_time_shift(10);
+                ps->ps_next_retry = cfs_time_shift(IBLND_POOL_RETRY);
                 CERROR("Can't allocate new %s pool because out of memory\n",
                        ps->ps_name);
         }
@@ -2202,15 +2207,6 @@ kiblnd_hdev_get_attr(kib_hca_dev_t *hdev)
                 return rc;
         }
 
-#ifdef HAVE_OFED_TRANSPORT_IWARP
-        /* XXX We can't trust this value returned by Chelsio driver, it's wrong
-         * and we have reported the bug, remove these in the future when Chelsio
-         * bug got fixed. */
-        if (rdma_node_get_transport(hdev->ibh_ibdev->node_type) ==
-            RDMA_TRANSPORT_IWARP)
-                hdev->ibh_mr_size = (1ULL << 32) - 1;
-#endif
-
         if (hdev->ibh_mr_size == ~0ULL) {
                 hdev->ibh_mr_shift = 64;
                 return 0;
@@ -2342,9 +2338,10 @@ kiblnd_hdev_setup_mrs(kib_hca_dev_t *hdev)
         }
 
 out:
-        CDEBUG(D_CONSOLE, "Register global MR array, MR size: "
-                          LPX64", array size: %d\n",
-                          hdev->ibh_mr_size, hdev->ibh_nmrs);
+        if (hdev->ibh_mr_size != ~0ULL || hdev->ibh_nmrs != 1)
+                LCONSOLE_INFO("Register global MR array, MR size: "
+                              LPX64", array size: %d\n",
+                              hdev->ibh_mr_size, hdev->ibh_nmrs);
         return 0;
 }
 
@@ -2377,8 +2374,8 @@ kiblnd_dev_need_failover(kib_dev_t *dev)
          *
          * a. rdma_bind_addr(), it will conflict with listener cmid
          * b. rdma_resolve_addr() to zero addr */
-        cmid = rdma_create_id(kiblnd_dummy_callback,
-                              dev, RDMA_PS_TCP);
+        cmid = kiblnd_rdma_create_id(kiblnd_dummy_callback, dev, RDMA_PS_TCP,
+                                     IB_QPT_RC);
         if (IS_ERR(cmid)) {
                 rc = PTR_ERR(cmid);
                 CERROR("Failed to create cmid for failover: %d\n", rc);
@@ -2450,7 +2447,8 @@ kiblnd_dev_failover(kib_dev_t *dev)
                 rdma_destroy_id(cmid);
         }
 
-        cmid = rdma_create_id(kiblnd_cm_callback, dev, RDMA_PS_TCP);
+        cmid = kiblnd_rdma_create_id(kiblnd_cm_callback, dev, RDMA_PS_TCP,
+                                     IB_QPT_RC);
         if (IS_ERR(cmid)) {
                 rc = PTR_ERR(cmid);
                 CERROR("Failed to create cmid for failover: %d\n", rc);
@@ -2581,18 +2579,17 @@ kiblnd_create_dev(char *ifname)
 
         memset(dev, 0, sizeof(*dev));
 #ifdef HAVE_DEV_GET_BY_NAME_2ARG
-        if ((netdev = dev_get_by_name(&init_net, ifname)) == NULL) {
+        netdev = dev_get_by_name(&init_net, ifname);
 #else
-        if ((netdev = dev_get_by_name(ifname)) == NULL) {
+        netdev = dev_get_by_name(ifname);
 #endif
-                CERROR("Can't find netdev of IF: %s\n", ifname);
-                LIBCFS_FREE(dev, sizeof(*dev));
-                return NULL;
+        if (netdev == NULL) {
+                dev->ibd_can_failover = 0;
+        } else {
+                dev->ibd_can_failover = !!(netdev->flags & IFF_MASTER);
+                dev_put(netdev);
         }
 
-        dev->ibd_can_failover = !!(netdev->flags & IFF_MASTER);
-        dev_put(netdev);
-
         CFS_INIT_LIST_HEAD(&dev->ibd_nets);
         CFS_INIT_LIST_HEAD(&dev->ibd_list); /* not yet in kib_devs */
         CFS_INIT_LIST_HEAD(&dev->ibd_fail_list);