@@ -1577,7 +1577,8 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,
return false;
}
-/*
+/* Can the specified message trigger peer discovery?
+ *
* Traffic to the LNET_RESERVED_PORTAL may not trigger peer discovery,
* because such traffic is required to perform discovery. We therefore
* exclude all GET and PUT on that portal. We also exclude all ACK and
@@ -1591,6 +1592,18 @@ void lnet_usr_translate_stats(struct lnet_ioctl_element_msg_stats *msg_stats,
return !(lnet_reserved_msg(msg) || lnet_msg_is_response(msg));
}
+/* Is the specified message an LNet ping?
+ */
+static bool
+lnet_msg_is_ping(struct lnet_msg *msg)
+{
+ if (msg->msg_type == LNET_MSG_GET &&
+ msg->msg_hdr.msg.get.ptl_index == LNET_RESERVED_PORTAL)
+ return true;
+
+ return false;
+}
+
#define SRC_SPEC 0x0001
#define SRC_ANY 0x0002
#define LOCAL_DST 0x0004
@@ -2228,10 +2241,14 @@ struct lnet_ni *
u32 best_net_sel_prio = LNET_MAX_SELECTION_PRIORITY;
u32 net_sel_prio;
- /* if this is a discovery message and lp_disc_net_id is
- * specified then use that net to send the discovery on.
+ /* If lp_disc_net_id is set, this peer is a router undergoing
+ * discovery, and this message is an LNet ping, then this may be a
+ * discovery message and we need to select an NI on the peer net
+ * specified by lp_disc_net_id
*/
- if (discovery && peer->lp_disc_net_id) {
+ if (peer->lp_disc_net_id &&
+ (peer->lp_state & LNET_PEER_RTR_DISCOVERY) &&
+ lnet_msg_is_ping(msg)) {
best_lpn = lnet_peer_get_net_locked(peer, peer->lp_disc_net_id);
if (best_lpn && lnet_get_net_locked(best_lpn->lpn_net_id))
goto select_best_ni;