From e5614b45793219e9b0eed4e22e9afecb042795f3 Mon Sep 17 00:00:00 2001 From: Amir Shehata Date: Fri, 7 Feb 2020 11:16:23 -0800 Subject: [PATCH] LU-13026 lnet: MR selection of gateway ni 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 Change-Id: I65526c6b64a5702734949c9a583a7558614ceae2 Reviewed-on: https://review.whamcloud.com/36913 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Serguei Smirnov Reviewed-by: Chris Horn Reviewed-by: Oleg Drokin --- lnet/lnet/lib-move.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/lnet/lnet/lib-move.c b/lnet/lnet/lib-move.c index e78fe63..0742f2d 100644 --- a/lnet/lnet/lib-move.c +++ b/lnet/lnet/lib-move.c @@ -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; } -- 1.8.3.1