Whamcloud - gitweb
LU-7734 lnet: handle N NIs to 1 LND peer
[fs/lustre-release.git] / lnet / klnds / o2iblnd / o2iblnd.h
index 23cc03c..feb8ef3 100644 (file)
  *
  * You should have received a copy of the GNU General Public License
  * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * GPL HEADER END
  */
@@ -27,7 +23,7 @@
  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2011, 2015, Intel Corporation.
+ * Copyright (c) 2011, 2016, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
@@ -310,12 +306,22 @@ typedef struct
        cfs_time_t              fps_next_retry;
 } kib_fmr_poolset_t;
 
+#ifndef HAVE_IB_RDMA_WR
+struct ib_rdma_wr {
+       struct ib_send_wr wr;
+};
+#endif
+
 struct kib_fast_reg_descriptor { /* For fast registration */
        struct list_head                 frd_list;
-       struct ib_send_wr                frd_inv_wr;
-       struct ib_send_wr                frd_fastreg_wr;
-       struct ib_mr                    *frd_mr;
+       struct ib_rdma_wr                frd_inv_wr;
+#ifdef HAVE_IB_MAP_MR_SG
+       struct ib_reg_wr                 frd_fastreg_wr;
+#else
+       struct ib_rdma_wr                frd_fastreg_wr;
        struct ib_fast_reg_page_list    *frd_frpl;
+#endif
+       struct ib_mr                    *frd_mr;
        bool                             frd_valid;
 };
 
@@ -412,7 +418,7 @@ typedef struct
         * The second that peers are pulled out from \a kib_reconn_wait
         * for reconnection.
         */
-       unsigned int            kib_reconn_sec;
+       time64_t                kib_reconn_sec;
        /* connection daemon sleeps here */
        wait_queue_head_t       kib_connd_waitq;
        spinlock_t              kib_connd_lock; /* serialise */
@@ -606,7 +612,7 @@ typedef struct kib_tx                           /* transmit message */
        /* # send work items */
        int                     tx_nwrq;
        /* send work items... */
-       struct ib_send_wr       *tx_wrq;
+       struct ib_rdma_wr       *tx_wrq;
        /* ...and their memory */
        struct ib_sge           *tx_sge;
        /* rdma descriptor */
@@ -738,6 +744,8 @@ typedef struct kib_peer
        unsigned short          ibp_connecting;
        /* reconnect this peer later */
        unsigned short          ibp_reconnecting:1;
+       /* counter of how many times we triggered a conn race */
+       unsigned char           ibp_races;
        /* # consecutive reconnection attempts to this peer */
        unsigned int            ibp_reconnected;
        /* errno on closing this peer */
@@ -774,7 +782,7 @@ kiblnd_cfg_rdma_frags(struct lnet_ni *ni)
        struct lnet_ioctl_config_o2iblnd_tunables *tunables;
        int mod;
 
-       tunables = &ni->ni_lnd_tunables->lt_tun_u.lt_o2ib;
+       tunables = &ni->ni_lnd_tunables.lnd_tun_u.lnd_o2ib;
        mod = tunables->lnd_map_on_demand;
        return mod != 0 ? mod : IBLND_MAX_RDMA_FRAGS;
 }
@@ -793,7 +801,7 @@ kiblnd_concurrent_sends(int version, struct lnet_ni *ni)
        struct lnet_ioctl_config_o2iblnd_tunables *tunables;
        int concurrent_sends;
 
-       tunables = &ni->ni_lnd_tunables->lt_tun_u.lt_o2ib;
+       tunables = &ni->ni_lnd_tunables.lnd_tun_u.lnd_o2ib;
        concurrent_sends = tunables->lnd_concurrent_sends;
 
        if (version == IBLND_MSG_VERSION_1) {
@@ -933,7 +941,7 @@ kiblnd_need_noop(kib_conn_t *conn)
        struct lnet_ioctl_config_o2iblnd_tunables *tunables;
 
        LASSERT(conn->ibc_state >= IBLND_CONN_ESTABLISHED);
-       tunables = &ni->ni_lnd_tunables->lt_tun_u.lt_o2ib;
+       tunables = &ni->ni_lnd_tunables.lnd_tun_u.lnd_o2ib;
 
         if (conn->ibc_outstanding_credits <
            IBLND_CREDITS_HIGHWATER(tunables, conn->ibc_version) &&
@@ -1151,8 +1159,9 @@ void kiblnd_unmap_rx_descs(kib_conn_t *conn);
 void kiblnd_pool_free_node(kib_pool_t *pool, struct list_head *node);
 struct list_head *kiblnd_pool_alloc_node(kib_poolset_t *ps);
 
-int  kiblnd_fmr_pool_map(kib_fmr_poolset_t *fps, __u64 *pages, int npages,
-                        __u32 nob, __u64 iov, bool is_rx, kib_fmr_t *fmr);
+int  kiblnd_fmr_pool_map(kib_fmr_poolset_t *fps, kib_tx_t *tx,
+                        kib_rdma_desc_t *rd, __u32 nob, __u64 iov,
+                        kib_fmr_t *fmr);
 void kiblnd_fmr_pool_unmap(kib_fmr_t *fmr, int status);
 
 int  kiblnd_tunables_setup(struct lnet_ni *ni);
@@ -1175,7 +1184,7 @@ void kiblnd_destroy_peer (kib_peer_t *peer);
 bool kiblnd_reconnect_peer(kib_peer_t *peer);
 void kiblnd_destroy_dev (kib_dev_t *dev);
 void kiblnd_unlink_peer_locked (kib_peer_t *peer);
-kib_peer_t *kiblnd_find_peer_locked (lnet_nid_t nid);
+kib_peer_t *kiblnd_find_peer_locked(struct lnet_ni *ni, lnet_nid_t nid);
 int  kiblnd_close_stale_conns_locked (kib_peer_t *peer,
                                       int version, __u64 incarnation);
 int  kiblnd_close_peer_conns_locked (kib_peer_t *peer, int why);