MIPS: SGI-IP27: Fix node_distance
authorThomas Bogendoerfer <tbogendoerfer@suse.de>
Thu, 9 Jan 2020 12:23:29 +0000 (13:23 +0100)
committerPaul Burton <paulburton@kernel.org>
Thu, 9 Jan 2020 17:54:27 +0000 (09:54 -0800)
node_distance must return values starting from 10 up to 255. 10 means
local, 255 unreachable.

Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
Signed-off-by: Paul Burton <paulburton@kernel.org>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: James Hogan <jhogan@kernel.org>
Cc: linux-mips@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
arch/mips/sgi-ip27/ip27-memory.c

index 563aad5..a0c7176 100644 (file)
@@ -148,25 +148,25 @@ static int __init compute_node_distance(nasid_t nasid_a, nasid_t nasid_b)
                } while ((brd = find_lboard_class(KLCF_NEXT(brd), KLTYPE_ROUTER)));
        }
 
+       if (nasid_a == nasid_b)
+               return LOCAL_DISTANCE;
+
+       if (router_a == router_b)
+               return LOCAL_DISTANCE + 1;
+
        if (router_a == NULL) {
                pr_info("node_distance: router_a NULL\n");
-               return -1;
+               return 255;
        }
        if (router_b == NULL) {
                pr_info("node_distance: router_b NULL\n");
-               return -1;
+               return 255;
        }
 
-       if (nasid_a == nasid_b)
-               return 0;
-
-       if (router_a == router_b)
-               return 1;
-
        router_distance = 100;
        router_recurse(router_a, router_b, 2);
 
-       return router_distance;
+       return LOCAL_DISTANCE + router_distance;
 }
 
 static void __init init_topology_matrix(void)