+/* must hold net_lock/0 */
+void
+lnet_ni_add_to_recoveryq_locked(struct lnet_ni *ni,
+ struct list_head *recovery_queue, time64_t now)
+{
+ if (!list_empty(&ni->ni_recovery))
+ return;
+
+ if (atomic_read(&ni->ni_healthv) == LNET_MAX_HEALTH_VALUE)
+ return;
+
+ /* This NI is going on the recovery queue, so take a ref on it */
+ lnet_ni_addref_locked(ni, 0);
+
+ lnet_ni_set_next_ping(ni, now);
+
+ CDEBUG(D_NET, "%s added to recovery queue. ping count: %u next ping: %lld health :%d\n",
+ libcfs_nid2str(ni->ni_nid),
+ ni->ni_ping_count,
+ ni->ni_next_ping,
+ atomic_read(&ni->ni_healthv));
+
+ list_add_tail(&ni->ni_recovery, recovery_queue);
+}
+