Whamcloud - gitweb
LU-7734 lnet: Multi-Rail local NI split
[fs/lustre-release.git] / lnet / lnet / peer.c
index 523d5b3..236f63b 100644 (file)
@@ -110,7 +110,7 @@ lnet_peer_table_cleanup_locked(lnet_ni_t *ni, struct lnet_peer_table *ptable)
        for (i = 0; i < LNET_PEER_HASH_SIZE; i++) {
                list_for_each_entry_safe(lp, tmp, &ptable->pt_hash[i],
                                         lp_hashlist) {
-                       if (ni != NULL && ni != lp->lp_ni)
+                       if (ni != NULL && ni->ni_net != lp->lp_net)
                                continue;
                        list_del_init(&lp->lp_hashlist);
                        /* Lose hash table's ref */
@@ -152,7 +152,7 @@ lnet_peer_table_del_rtrs_locked(lnet_ni_t *ni, struct lnet_peer_table *ptable,
        for (i = 0; i < LNET_PEER_HASH_SIZE; i++) {
                list_for_each_entry_safe(lp, tmp, &ptable->pt_hash[i],
                                         lp_hashlist) {
-                       if (ni != lp->lp_ni)
+                       if (ni->ni_net != lp->lp_net)
                                continue;
 
                        if (lp->lp_rtr_refcount == 0)
@@ -224,8 +224,7 @@ lnet_destroy_peer_locked(lnet_peer_t *lp)
        LASSERT(ptable->pt_number > 0);
        ptable->pt_number--;
 
-       lnet_ni_decref_locked(lp->lp_ni, lp->lp_cpt);
-       lp->lp_ni = NULL;
+       lp->lp_net = NULL;
 
        list_add(&lp->lp_hashlist, &ptable->pt_deathrow);
        LASSERT(ptable->pt_zombies > 0);
@@ -265,7 +264,7 @@ lnet_nid2peer_locked(lnet_peer_t **lpp, lnet_nid_t nid, int cpt)
                return -ESHUTDOWN;
 
        /* cpt can be LNET_LOCK_EX if it's called from router functions */
-       cpt2 = cpt != LNET_LOCK_EX ? cpt : lnet_cpt_of_nid_locked(nid);
+       cpt2 = cpt != LNET_LOCK_EX ? cpt : lnet_cpt_of_nid_locked(nid, NULL);
 
        ptable = the_lnet.ln_peer_tables[cpt2];
        lp = lnet_find_peer_locked(ptable, nid);
@@ -330,16 +329,11 @@ lnet_nid2peer_locked(lnet_peer_t **lpp, lnet_nid_t nid, int cpt)
                goto out;
        }
 
-       lp->lp_ni = lnet_net2ni_locked(LNET_NIDNET(nid), cpt2);
-       if (lp->lp_ni == NULL) {
-               rc = -EHOSTUNREACH;
-               goto out;
-       }
-
+       lp->lp_net = lnet_get_net_locked(LNET_NIDNET(lp->lp_nid));
        lp->lp_txcredits    =
-       lp->lp_mintxcredits = lp->lp_ni->ni_peertxcredits;
+       lp->lp_mintxcredits = lp->lp_net->net_tunables.lct_peer_tx_credits;
        lp->lp_rtrcredits    =
-       lp->lp_minrtrcredits = lnet_peer_buffer_credits(lp->lp_ni);
+       lp->lp_minrtrcredits = lnet_peer_buffer_credits(lp->lp_net);
 
        list_add_tail(&lp->lp_hashlist,
                      &ptable->pt_hash[lnet_nid2peerhash(nid)]);
@@ -362,7 +356,7 @@ lnet_debug_peer(lnet_nid_t nid)
        int             rc;
        int             cpt;
 
-       cpt = lnet_cpt_of_nid(nid);
+       cpt = lnet_cpt_of_nid(nid, NULL);
        lnet_net_lock(cpt);
 
        rc = lnet_nid2peer_locked(&lp, nid, cpt);
@@ -377,7 +371,7 @@ lnet_debug_peer(lnet_nid_t nid)
 
        CDEBUG(D_WARNING, "%-24s %4d %5s %5d %5d %5d %5d %5d %ld\n",
               libcfs_nid2str(lp->lp_nid), lp->lp_refcount,
-              aliveness, lp->lp_ni->ni_peertxcredits,
+              aliveness, lp->lp_net->net_tunables.lct_peer_tx_credits,
               lp->lp_rtrcredits, lp->lp_minrtrcredits,
               lp->lp_txcredits, lp->lp_mintxcredits, lp->lp_txqnob);
 
@@ -431,7 +425,8 @@ int lnet_get_peer_info(__u32 peer_index, __u64 *nid,
 
                        *nid = lp->lp_nid;
                        *refcount = lp->lp_refcount;
-                       *ni_peer_tx_credits = lp->lp_ni->ni_peertxcredits;
+                       *ni_peer_tx_credits =
+                               lp->lp_net->net_tunables.lct_peer_tx_credits;
                        *peer_tx_credits = lp->lp_txcredits;
                        *peer_rtr_credits = lp->lp_rtrcredits;
                        *peer_min_rtr_credits = lp->lp_mintxcredits;