+ LASSERT (!cfs_list_empty(restarts));
+
+ if (kptllnd_find_target(net, target, &peer) != 0)
+ peer = NULL;
+
+ cfs_list_for_each_entry_safe (tx, tmp, restarts, tx_list) {
+ LASSERT (tx->tx_peer != NULL);
+ LASSERT (tx->tx_type == TX_TYPE_GET_REQUEST ||
+ tx->tx_type == TX_TYPE_PUT_REQUEST ||
+ tx->tx_type == TX_TYPE_SMALL_MESSAGE);
+
+ cfs_list_del_init(&tx->tx_list);
+
+ if (peer == NULL ||
+ tx->tx_msg->ptlm_type == PTLLND_MSG_TYPE_HELLO) {
+ kptllnd_tx_decref(tx);
+ continue;
+ }
+
+ LASSERT (tx->tx_msg->ptlm_type != PTLLND_MSG_TYPE_NOOP);
+ tx->tx_status = 0;
+ tx->tx_active = 1;
+ kptllnd_peer_decref(tx->tx_peer);
+ tx->tx_peer = NULL;
+ kptllnd_set_tx_peer(tx, peer);
+ kptllnd_queue_tx(peer, tx); /* takes over my ref on tx */
+ }
+
+ if (peer == NULL)
+ return;
+
+ kptllnd_peer_check_sends(peer);
+ kptllnd_peer_decref(peer);
+}
+
+static inline int
+kptllnd_peer_send_noop (kptl_peer_t *peer)
+{
+ if (!peer->peer_sent_hello ||
+ peer->peer_credits == 0 ||
+ !cfs_list_empty(&peer->peer_noops) ||
+ peer->peer_outstanding_credits < PTLLND_CREDIT_HIGHWATER)
+ return 0;
+
+ /* No tx to piggyback NOOP onto or no credit to send a tx */
+ return (cfs_list_empty(&peer->peer_sendq) || peer->peer_credits == 1);