Whamcloud - gitweb
LU-10391 lnet: change tp_nid to 16byte in lnet_test_peer.
[fs/lustre-release.git] / lnet / lnet / lib-move.c
index 53d204e..cdd84d6 100644 (file)
@@ -190,13 +190,15 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,
 }
 
 int
-lnet_fail_nid(lnet_nid_t nid, unsigned int threshold)
+lnet_fail_nid(lnet_nid_t nid4, unsigned int threshold)
 {
        struct lnet_test_peer *tp;
        struct list_head *el;
        struct list_head *next;
+       struct lnet_nid nid;
        LIST_HEAD(cull);
 
+       lnet_nid4_to_nid(nid4, &nid);
        /* NB: use lnet_net_lock(0) to serialize operations on test peers */
        if (threshold != 0) {
                /* Adding a new entry */
@@ -219,8 +221,8 @@ lnet_fail_nid(lnet_nid_t nid, unsigned int threshold)
                tp = list_entry(el, struct lnet_test_peer, tp_list);
 
                if (tp->tp_threshold == 0 ||    /* needs culling anyway */
-                   nid == LNET_NID_ANY ||      /* removing all entries */
-                   tp->tp_nid == nid) {        /* matched this one */
+                   LNET_NID_IS_ANY(&nid) ||    /* removing all entries */
+                   nid_same(&tp->tp_nid, &nid)) {      /* matched this one */
                        list_move(&tp->tp_list, &cull);
                }
        }
@@ -237,14 +239,16 @@ lnet_fail_nid(lnet_nid_t nid, unsigned int threshold)
 }
 
 static int
-fail_peer (lnet_nid_t nid, int outgoing)
+fail_peer(lnet_nid_t nid4, int outgoing)
 {
        struct lnet_test_peer *tp;
        struct list_head *el;
        struct list_head *next;
+       struct lnet_nid nid;
        LIST_HEAD(cull);
        int fail = 0;
 
+       lnet_nid4_to_nid(nid4, &nid);
        /* NB: use lnet_net_lock(0) to serialize operations on test peers */
        lnet_net_lock(0);
 
@@ -262,8 +266,8 @@ fail_peer (lnet_nid_t nid, int outgoing)
                        continue;
                }
 
-               if (tp->tp_nid == LNET_NID_ANY ||       /* fail every peer */
-                   nid == tp->tp_nid) {                /* fail this peer */
+               if (LNET_NID_IS_ANY(&tp->tp_nid) ||     /* fail every peer */
+                   nid_same(&nid, &tp->tp_nid)) {      /* fail this peer */
                        fail = 1;
 
                        if (tp->tp_threshold != LNET_MD_THRESH_INF) {
@@ -1837,8 +1841,8 @@ lnet_handle_send(struct lnet_send_data *sd)
         * local ni and local net so that we pick the next ones
         * in Round Robin.
         */
-       best_lpni->lpni_seq++;
        best_lpni->lpni_peer_net->lpn_seq++;
+       best_lpni->lpni_seq = best_lpni->lpni_peer_net->lpn_seq;
        best_ni->ni_net->net_seq++;
        best_ni->ni_seq = best_ni->ni_net->net_seq;
 
@@ -4703,6 +4707,8 @@ lnet_parse(struct lnet_ni *ni, struct lnet_hdr *hdr, lnet_nid_t from_nid,
                        }
                }
                if (lnet_drop_asym_route && for_me && !found) {
+                       /* Drop ref taken by lnet_nid2peerni_locked() */
+                       lnet_peer_ni_decref_locked(lpni);
                        lnet_net_unlock(cpt);
                        /* we would not use from_nid to route a message to
                         * src_nid