diff mbox series

[05/42] lnet: change lnet_find_best_lpni to handle large NIDs

Message ID 1674514855-15399-6-git-send-email-jsimmons@infradead.org (mailing list archive)
State New, archived
Headers show
Series lustre: sync to OpenSFS tree as of Jan 22 2023 | expand

Commit Message

James Simmons Jan. 23, 2023, 11 p.m. UTC
Currently lnet_find_best_lpni() only handles small NID addresses
for the dst_nid. Change this to large NID address to allow IPv6
and other large address protocols.

WC-bug-id: https://jira.whamcloud.com/browse/LU-10391
Lustre-commit: 4c0c01e29c891d100 ("LU-10391 lnet: change lnet_find_best_lpni to handle large NIDs")
Signed-off-by: James Simmons <jsimmons@infradead.org>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49181
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: Chris Horn <chris.horn@hpe.com>
Reviewed-by: Frank Sehr <fsehr@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
---
 net/lnet/lnet/lib-move.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/net/lnet/lnet/lib-move.c b/net/lnet/lnet/lib-move.c
index f602492ee75f..95abe4f15c48 100644
--- a/net/lnet/lnet/lib-move.c
+++ b/net/lnet/lnet/lib-move.c
@@ -1114,7 +1114,7 @@  lnet_return_rx_credits_locked(struct lnet_msg *msg)
 }
 
 static struct lnet_peer_ni *
-lnet_select_peer_ni(struct lnet_ni *best_ni, lnet_nid_t dst_nid,
+lnet_select_peer_ni(struct lnet_ni *best_ni, struct lnet_nid *dst_nid,
 		    struct lnet_peer *peer,
 		    struct lnet_peer_ni *best_lpni,
 		    struct lnet_peer_net *peer_net)
@@ -1220,7 +1220,7 @@  lnet_select_peer_ni(struct lnet_ni *best_ni, lnet_nid_t dst_nid,
 	/* if we still can't find a peer ni then we can't reach it */
 	if (!best_lpni) {
 		u32 net_id = (peer_net) ? peer_net->lpn_net_id :
-			     LNET_NIDNET(dst_nid);
+			     LNET_NID_NET(dst_nid);
 		CDEBUG(D_NET, "no peer_ni found on peer net %s\n",
 		       libcfs_net2str(net_id));
 		return NULL;
@@ -1242,7 +1242,7 @@  lnet_select_peer_ni(struct lnet_ni *best_ni, lnet_nid_t dst_nid,
  * ones.
  */
 static inline struct lnet_peer_ni *
-lnet_find_best_lpni(struct lnet_ni *lni, lnet_nid_t dst_nid,
+lnet_find_best_lpni(struct lnet_ni *lni, struct lnet_nid *dst_nid,
 		    struct lnet_peer *peer, u32 net_id)
 {
 	struct lnet_peer_net *peer_net;
@@ -1350,7 +1350,7 @@  lnet_find_route_locked(struct lnet_remotenet *rnet, u32 src_net,
 			 * src_net provided. If the src_net is LNET_NID_ANY,
 			 * then select the best interface available.
 			 */
-			lpni = lnet_find_best_lpni(NULL, LNET_NID_ANY,
+			lpni = lnet_find_best_lpni(NULL, NULL,
 						   route->lr_gateway,
 						   src_net);
 			if (!lpni) {
@@ -1395,8 +1395,7 @@  lnet_find_route_locked(struct lnet_remotenet *rnet, u32 src_net,
 		 * src_net provided. If the src_net is LNET_NID_ANY,
 		 * then select the best interface available.
 		 */
-		lpni = lnet_find_best_lpni(NULL, LNET_NID_ANY,
-					   route->lr_gateway,
+		lpni = lnet_find_best_lpni(NULL, NULL, route->lr_gateway,
 					   src_net);
 		if (!lpni) {
 			CDEBUG(D_NET,
@@ -2108,7 +2107,7 @@  lnet_handle_find_routed_path(struct lnet_send_data *sd,
 			       libcfs_net2str(best_lpn->lpn_net_id));
 
 			sd->sd_best_lpni = lnet_find_best_lpni(sd->sd_best_ni,
-							       lnet_nid_to_nid4(&sd->sd_dst_nid),
+							       &sd->sd_dst_nid,
 							       lp,
 							       best_lpn->lpn_net_id);
 			if (!sd->sd_best_lpni) {
@@ -2540,8 +2539,7 @@  lnet_handle_any_mr_dsta(struct lnet_send_data *sd)
 					lnet_msg_discovery(sd->sd_msg));
 	if (sd->sd_best_ni) {
 		sd->sd_best_lpni =
-		  lnet_find_best_lpni(sd->sd_best_ni,
-				      lnet_nid_to_nid4(&sd->sd_dst_nid),
+		  lnet_find_best_lpni(sd->sd_best_ni, &sd->sd_dst_nid,
 				      sd->sd_peer,
 				      sd->sd_best_ni->ni_net->net_id);