Whamcloud - gitweb
LU-13026 lnet: MR selection of gateway ni 13/36913/6
authorAmir Shehata <ashehata@whamcloud.com>
Fri, 7 Feb 2020 19:16:23 +0000 (11:16 -0800)
committerOleg Drokin <green@whamcloud.com>
Sun, 1 Mar 2020 05:35:56 +0000 (05:35 +0000)
Multi-Rail gateways can only have 1 route pointing to them. Use
the MR selection algorithm to get the best lpni on the MR
gateway to use.

Using the selection algorithm to find the gateway NI, allows us
to use the standard MR criteria: health, preference and credits.

Test-parameters: trivial

Signed-off-by: Amir Shehata <ashehata@whamcloud.com>
Change-Id: I65526c6b64a5702734949c9a583a7558614ceae2
Reviewed-on: https://review.whamcloud.com/36913
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Serguei Smirnov <ssmirnov@whamcloud.com>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lnet/lnet/lib-move.c

index e78fe63..0742f2d 100644 (file)
@@ -1442,13 +1442,6 @@ lnet_find_best_lpni_on_net(struct lnet_ni *lni, lnet_nid_t dst_nid,
         */
        peer_net = lnet_peer_get_net_locked(peer, net_id);
 
-       if (!peer_net) {
-               CERROR("gateway peer %s has no NI on net %s\n",
-                      libcfs_nid2str(peer->lp_primary_nid),
-                      libcfs_net2str(net_id));
-               return NULL;
-       }
-
        return lnet_select_peer_ni(lni, dst_nid, peer, peer_net);
 }
 
@@ -1484,29 +1477,28 @@ lnet_find_route_locked(struct lnet_remotenet *rnet, __u32 src_net,
        struct lnet_route *last_route;
        struct lnet_route *route;
        int rc;
-       __u32 restrict_net;
-       __u32 any_net = LNET_NIDNET(LNET_NID_ANY);
 
        best_route = last_route = NULL;
        list_for_each_entry(route, &rnet->lrn_routes, lr_list) {
                if (!lnet_is_route_alive(route))
                        continue;
 
-               /* If the src_net is specified then we need to find an lpni
-                * on that network
+               /*
+                * Restrict the selection of the router NI on the src_net
+                * provided. If the src_net is LNET_NID_ANY, then select
+                * the best interface available.
                 */
-               restrict_net = src_net == any_net ? route->lr_lnet : src_net;
                if (!best_route) {
                        lpni = lnet_find_best_lpni_on_net(NULL, LNET_NID_ANY,
                                                          route->lr_gateway,
-                                                         restrict_net);
+                                                         src_net);
                        if (lpni) {
                                best_route = last_route = route;
                                best_gw_ni = lpni;
                        } else
                                CERROR("Gateway %s does not have a peer NI on net %s\n",
                                       libcfs_nid2str(route->lr_gateway->lp_primary_nid),
-                                      libcfs_net2str(restrict_net));
+                                      libcfs_net2str(src_net));
 
                        continue;
                }
@@ -1521,11 +1513,11 @@ lnet_find_route_locked(struct lnet_remotenet *rnet, __u32 src_net,
 
                lpni = lnet_find_best_lpni_on_net(NULL, LNET_NID_ANY,
                                                  route->lr_gateway,
-                                                 restrict_net);
+                                                 src_net);
                if (!lpni) {
                        CERROR("Gateway %s does not have a peer NI on net %s\n",
                               libcfs_nid2str(route->lr_gateway->lp_primary_nid),
-                              libcfs_net2str(restrict_net));
+                              libcfs_net2str(src_net));
                        continue;
                }