Whamcloud - gitweb
LU-4751 hsm: Fix sanity-hsm tests for non-mrsh $PDSH
[fs/lustre-release.git] / lnet / lnet / router.c
index dd5e9e3..4da9573 100644 (file)
@@ -266,10 +266,10 @@ static void lnet_shuffle_seed(void)
                         seed[0] ^= (LNET_NIDADDR(ni->ni_nid) | lnd_type);
         }
 
-        cfs_gettimeofday(&tv);
-        cfs_srand(tv.tv_sec ^ seed[0], tv.tv_usec ^ seed[1]);
-        seeded = 1;
-        return;
+       do_gettimeofday(&tv);
+       cfs_srand(tv.tv_sec ^ seed[0], tv.tv_usec ^ seed[1]);
+       seeded = 1;
+       return;
 }
 
 /* NB expects LNET_LOCK held */
@@ -301,7 +301,8 @@ lnet_add_route_to_rnet (lnet_remotenet_t *rnet, lnet_route_t *route)
 }
 
 int
-lnet_add_route (__u32 net, unsigned int hops, lnet_nid_t gateway)
+lnet_add_route(__u32 net, unsigned int hops, lnet_nid_t gateway,
+              unsigned int priority)
 {
         cfs_list_t          *e;
         lnet_remotenet_t    *rnet;
@@ -311,8 +312,8 @@ lnet_add_route (__u32 net, unsigned int hops, lnet_nid_t gateway)
         int                  add_route;
         int                  rc;
 
-        CDEBUG(D_NET, "Add route: net %s hops %u gw %s\n",
-               libcfs_net2str(net), hops, libcfs_nid2str(gateway));
+       CDEBUG(D_NET, "Add route: net %s hops %u priority %u gw %s\n",
+              libcfs_net2str(net), hops, priority, libcfs_nid2str(gateway));
 
         if (gateway == LNET_NID_ANY ||
             LNET_NETTYP(LNET_NIDNET(gateway)) == LOLND ||
@@ -342,6 +343,7 @@ lnet_add_route (__u32 net, unsigned int hops, lnet_nid_t gateway)
         rnet->lrn_net = net;
         route->lr_hops = hops;
        route->lr_net = net;
+       route->lr_priority = priority;
 
        lnet_net_lock(LNET_LOCK_EX);
 
@@ -552,7 +554,7 @@ lnet_destroy_routes (void)
 
 int
 lnet_get_route(int idx, __u32 *net, __u32 *hops,
-              lnet_nid_t *gateway, __u32 *alive)
+              lnet_nid_t *gateway, __u32 *alive, __u32 *priority)
 {
        cfs_list_t              *e1;
        cfs_list_t              *e2;
@@ -574,10 +576,11 @@ lnet_get_route(int idx, __u32 *net, __u32 *hops,
                                                       lr_list);
 
                                if (idx-- == 0) {
-                                       *net     = rnet->lrn_net;
-                                       *hops    = route->lr_hops;
-                                       *gateway = route->lr_gateway->lp_nid;
-                                       *alive   = route->lr_gateway->lp_alive;
+                                       *net      = rnet->lrn_net;
+                                       *hops     = route->lr_hops;
+                                       *priority = route->lr_priority;
+                                       *gateway  = route->lr_gateway->lp_nid;
+                                       *alive    = route->lr_gateway->lp_alive;
                                        lnet_net_unlock(cpt);
                                        return 0;
                                }
@@ -643,7 +646,6 @@ lnet_parse_rc_info(lnet_rc_data_t *rcd)
                return; /* can't carry NI status info */
 
        cfs_list_for_each_entry(rtr, &gw->lp_routes, lr_gwlist) {
-               int     ptl_status = LNET_NI_STATUS_INVALID;
                int     down = 0;
                int     up = 0;
                int     i;
@@ -663,10 +665,7 @@ lnet_parse_rc_info(lnet_rc_data_t *rcd)
                                continue;
 
                        if (stat->ns_status == LNET_NI_STATUS_DOWN) {
-                               if (LNET_NETTYP(LNET_NIDNET(nid)) != PTLLND)
-                                       down++;
-                               else if (ptl_status != LNET_NI_STATUS_UP)
-                                       ptl_status = LNET_NI_STATUS_DOWN;
+                               down++;
                                continue;
                        }
 
@@ -675,10 +674,6 @@ lnet_parse_rc_info(lnet_rc_data_t *rcd)
                                        up = 1;
                                        break;
                                }
-                               /* ptl NIs are considered down only when
-                                * they're all down */
-                               if (LNET_NETTYP(LNET_NIDNET(nid)) == PTLLND)
-                                       ptl_status = LNET_NI_STATUS_UP;
                                continue;
                        }
 
@@ -692,7 +687,7 @@ lnet_parse_rc_info(lnet_rc_data_t *rcd)
                        rtr->lr_downis = 0;
                        continue;
                }
-               rtr->lr_downis = down + (ptl_status == LNET_NI_STATUS_DOWN);
+               rtr->lr_downis = down;
        }
 }
 
@@ -1273,12 +1268,12 @@ rescan:
 
                lnet_prune_rc_data(0); /* don't wait for UNLINK */
 
-                /* Call cfs_pause() here always adds 1 to load average 
-                 * because kernel counts # active tasks as nr_running 
-                 * + nr_uninterruptible. */
-                cfs_schedule_timeout_and_set_state(CFS_TASK_INTERRUPTIBLE,
-                                                   cfs_time_seconds(1));
-        }
+               /* Call cfs_pause() here always adds 1 to load average
+                * because kernel counts # active tasks as nr_running
+                * + nr_uninterruptible. */
+               schedule_timeout_and_set_state(TASK_INTERRUPTIBLE,
+                                                  cfs_time_seconds(1));
+       }
 
        LASSERT(the_lnet.ln_rc_state == LNET_RC_STATE_STOPPING);
 
@@ -1568,12 +1563,12 @@ lnet_notify(lnet_ni_t *ni, lnet_nid_t nid, int alive, cfs_time_t when)
        cfs_time_t              now = cfs_time_current();
        int                     cpt = lnet_cpt_of_nid(nid);
 
-        LASSERT (!cfs_in_interrupt ());
+       LASSERT (!in_interrupt ());
 
-        CDEBUG (D_NET, "%s notifying %s: %s\n",
-                (ni == NULL) ? "userspace" : libcfs_nid2str(ni->ni_nid),
-                libcfs_nid2str(nid),
-                alive ? "up" : "down");
+       CDEBUG (D_NET, "%s notifying %s: %s\n",
+               (ni == NULL) ? "userspace" : libcfs_nid2str(ni->ni_nid),
+               libcfs_nid2str(nid),
+               alive ? "up" : "down");
 
         if (ni != NULL &&
             LNET_NIDNET(ni->ni_nid) != LNET_NIDNET(nid)) {