Whamcloud - gitweb
LU-5570 lnet: check router aliveness timestamp
[fs/lustre-release.git] / lnet / include / lnet / lib-lnet.h
index 36b1a63..73a4d68 100644 (file)
@@ -651,6 +651,31 @@ lnet_isrouter(lnet_peer_t *lp)
         return lp->lp_rtr_refcount != 0;
 }
 
+/* check if it's a router checker ping */
+static inline int
+lnet_msg_is_rc_ping(struct lnet_msg *msg)
+{
+       lnet_hdr_t      *hdr = &msg->msg_hdr;
+
+       return msg->msg_type == LNET_MSG_GET &&
+              hdr->msg.get.ptl_index == cpu_to_le32(LNET_RESERVED_PORTAL) &&
+              hdr->msg.get.match_bits ==
+                           cpu_to_le64(LNET_PROTO_PING_MATCHBITS);
+}
+
+/* peer aliveness is enabled in a network where lnet_ni_t::ni_peertimeout has
+ * been set to a positive value, it's only valid for router peers or peers on
+ * routers.
+ */
+static inline int
+lnet_peer_aliveness_enabled(struct lnet_peer *lp)
+{
+       if (lp->lp_ni->ni_peertimeout <= 0)
+               return 0;
+
+       return the_lnet.ln_routing || lnet_isrouter(lp);
+}
+
 static inline void
 lnet_ni_addref_locked(lnet_ni_t *ni, int cpt)
 {