Whamcloud - gitweb
LU-6851 lnet: Ignore hops if not explicitly set
[fs/lustre-release.git] / lnet / lnet / router.c
index 072adcc..4b47269 100644 (file)
@@ -293,7 +293,7 @@ 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, __u32 hops, lnet_nid_t gateway,
               unsigned int priority)
 {
        struct list_head        *e;
@@ -304,7 +304,7 @@ 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 priority %u gw %s\n",
+       CDEBUG(D_NET, "Add route: net %s hops %d priority %u gw %s\n",
               libcfs_net2str(net), hops, priority, libcfs_nid2str(gateway));
 
        if (gateway == LNET_NID_ANY ||
@@ -312,7 +312,7 @@ lnet_add_route(__u32 net, unsigned int hops, lnet_nid_t gateway,
            net == LNET_NIDNET(LNET_NID_ANY) ||
            LNET_NETTYP(net) == LOLND ||
            LNET_NIDNET(gateway) == net ||
-           hops < 1 || hops > 255)
+           (hops != LNET_UNDEFINED_HOPS && (hops < 1 || hops > 255)))
                return -EINVAL;
 
        if (lnet_islocalnet(net))       /* it's a local network */