Lines Matching refs:peer
18 static u32 rxrpc_rto_min_us(struct rxrpc_peer *peer) in rxrpc_rto_min_us() argument
23 static u32 __rxrpc_set_rto(const struct rxrpc_peer *peer) in __rxrpc_set_rto() argument
25 return (peer->srtt_us >> 3) + peer->rttvar_us; in __rxrpc_set_rto()
43 static void rxrpc_rtt_estimator(struct rxrpc_peer *peer, long sample_rtt_us) in rxrpc_rtt_estimator() argument
46 u32 srtt = peer->srtt_us; in rxrpc_rtt_estimator()
69 m -= (peer->mdev_us >> 2); /* similar update on mdev */ in rxrpc_rtt_estimator()
81 m -= (peer->mdev_us >> 2); /* similar update on mdev */ in rxrpc_rtt_estimator()
84 peer->mdev_us += m; /* mdev = 3/4 mdev + 1/4 new */ in rxrpc_rtt_estimator()
85 if (peer->mdev_us > peer->mdev_max_us) { in rxrpc_rtt_estimator()
86 peer->mdev_max_us = peer->mdev_us; in rxrpc_rtt_estimator()
87 if (peer->mdev_max_us > peer->rttvar_us) in rxrpc_rtt_estimator()
88 peer->rttvar_us = peer->mdev_max_us; in rxrpc_rtt_estimator()
93 peer->mdev_us = m << 1; /* make sure rto = 3*rtt */ in rxrpc_rtt_estimator()
94 peer->rttvar_us = max(peer->mdev_us, rxrpc_rto_min_us(peer)); in rxrpc_rtt_estimator()
95 peer->mdev_max_us = peer->rttvar_us; in rxrpc_rtt_estimator()
98 peer->srtt_us = max(1U, srtt); in rxrpc_rtt_estimator()
105 static void rxrpc_set_rto(struct rxrpc_peer *peer) in rxrpc_set_rto() argument
116 rto = __rxrpc_set_rto(peer); in rxrpc_set_rto()
127 peer->rto_us = rxrpc_bound_rto(rto); in rxrpc_set_rto()
130 static void rxrpc_ack_update_rtt(struct rxrpc_peer *peer, long rtt_us) in rxrpc_ack_update_rtt() argument
136 rxrpc_rtt_estimator(peer, rtt_us); in rxrpc_ack_update_rtt()
137 rxrpc_set_rto(peer); in rxrpc_ack_update_rtt()
140 peer->backoff = 0; in rxrpc_ack_update_rtt()
152 struct rxrpc_peer *peer = call->peer; in rxrpc_peer_add_rtt() local
159 spin_lock(&peer->rtt_input_lock); in rxrpc_peer_add_rtt()
160 rxrpc_ack_update_rtt(peer, rtt_us); in rxrpc_peer_add_rtt()
161 if (peer->rtt_count < 3) in rxrpc_peer_add_rtt()
162 peer->rtt_count++; in rxrpc_peer_add_rtt()
163 spin_unlock(&peer->rtt_input_lock); in rxrpc_peer_add_rtt()
166 peer->srtt_us >> 3, peer->rto_us); in rxrpc_peer_add_rtt()
173 ktime_t rxrpc_get_rto_backoff(struct rxrpc_peer *peer, bool retrans) in rxrpc_get_rto_backoff() argument
176 u32 backoff = READ_ONCE(peer->backoff); in rxrpc_get_rto_backoff()
178 timo_us = peer->rto_us; in rxrpc_get_rto_backoff()
181 WRITE_ONCE(peer->backoff, backoff + 1); in rxrpc_get_rto_backoff()
189 void rxrpc_peer_init_rtt(struct rxrpc_peer *peer) in rxrpc_peer_init_rtt() argument
191 peer->rto_us = RXRPC_TIMEOUT_INIT; in rxrpc_peer_init_rtt()
192 peer->mdev_us = RXRPC_TIMEOUT_INIT; in rxrpc_peer_init_rtt()
193 peer->backoff = 0; in rxrpc_peer_init_rtt()