forked from mirrors/linux
		
	rxrpc: Make rxrpc_kernel_get_srtt() indicate validity
Fix rxrpc_kernel_get_srtt() to indicate the validity of the returned
smoothed RTT.  If we haven't had any valid samples yet, the SRTT isn't
useful.
Fixes: c410bf0193 ("rxrpc: Fix the excessive initial retransmission timeout")
Signed-off-by: David Howells <dhowells@redhat.com>
			
			
This commit is contained in:
		
							parent
							
								
									4700c4d80b
								
							
						
					
					
						commit
						1d4adfaf65
					
				
					 4 changed files with 18 additions and 8 deletions
				
			
		| 
						 | 
					@ -161,8 +161,8 @@ void afs_fileserver_probe_result(struct afs_call *call)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rtt_us = rxrpc_kernel_get_srtt(call->net->socket, call->rxcall);
 | 
						if (rxrpc_kernel_get_srtt(call->net->socket, call->rxcall, &rtt_us) &&
 | 
				
			||||||
	if (rtt_us < server->probe.rtt) {
 | 
						    rtt_us < server->probe.rtt) {
 | 
				
			||||||
		server->probe.rtt = rtt_us;
 | 
							server->probe.rtt = rtt_us;
 | 
				
			||||||
		server->rtt = rtt_us;
 | 
							server->rtt = rtt_us;
 | 
				
			||||||
		alist->preferred = index;
 | 
							alist->preferred = index;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -92,8 +92,8 @@ void afs_vlserver_probe_result(struct afs_call *call)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rtt_us = rxrpc_kernel_get_srtt(call->net->socket, call->rxcall);
 | 
						if (rxrpc_kernel_get_srtt(call->net->socket, call->rxcall, &rtt_us) &&
 | 
				
			||||||
	if (rtt_us < server->probe.rtt) {
 | 
						    rtt_us < server->probe.rtt) {
 | 
				
			||||||
		server->probe.rtt = rtt_us;
 | 
							server->probe.rtt = rtt_us;
 | 
				
			||||||
		alist->preferred = index;
 | 
							alist->preferred = index;
 | 
				
			||||||
		have_result = true;
 | 
							have_result = true;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -59,7 +59,7 @@ bool rxrpc_kernel_abort_call(struct socket *, struct rxrpc_call *,
 | 
				
			||||||
void rxrpc_kernel_end_call(struct socket *, struct rxrpc_call *);
 | 
					void rxrpc_kernel_end_call(struct socket *, struct rxrpc_call *);
 | 
				
			||||||
void rxrpc_kernel_get_peer(struct socket *, struct rxrpc_call *,
 | 
					void rxrpc_kernel_get_peer(struct socket *, struct rxrpc_call *,
 | 
				
			||||||
			   struct sockaddr_rxrpc *);
 | 
								   struct sockaddr_rxrpc *);
 | 
				
			||||||
u32 rxrpc_kernel_get_srtt(struct socket *, struct rxrpc_call *);
 | 
					bool rxrpc_kernel_get_srtt(struct socket *, struct rxrpc_call *, u32 *);
 | 
				
			||||||
int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t,
 | 
					int rxrpc_kernel_charge_accept(struct socket *, rxrpc_notify_rx_t,
 | 
				
			||||||
			       rxrpc_user_attach_call_t, unsigned long, gfp_t,
 | 
								       rxrpc_user_attach_call_t, unsigned long, gfp_t,
 | 
				
			||||||
			       unsigned int);
 | 
								       unsigned int);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -502,11 +502,21 @@ EXPORT_SYMBOL(rxrpc_kernel_get_peer);
 | 
				
			||||||
 * rxrpc_kernel_get_srtt - Get a call's peer smoothed RTT
 | 
					 * rxrpc_kernel_get_srtt - Get a call's peer smoothed RTT
 | 
				
			||||||
 * @sock: The socket on which the call is in progress.
 | 
					 * @sock: The socket on which the call is in progress.
 | 
				
			||||||
 * @call: The call to query
 | 
					 * @call: The call to query
 | 
				
			||||||
 | 
					 * @_srtt: Where to store the SRTT value.
 | 
				
			||||||
 *
 | 
					 *
 | 
				
			||||||
 * Get the call's peer smoothed RTT.
 | 
					 * Get the call's peer smoothed RTT in uS.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
u32 rxrpc_kernel_get_srtt(struct socket *sock, struct rxrpc_call *call)
 | 
					bool rxrpc_kernel_get_srtt(struct socket *sock, struct rxrpc_call *call,
 | 
				
			||||||
 | 
								   u32 *_srtt)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	return call->peer->srtt_us >> 3;
 | 
						struct rxrpc_peer *peer = call->peer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if (peer->rtt_count == 0) {
 | 
				
			||||||
 | 
							*_srtt = 1000000; /* 1S */
 | 
				
			||||||
 | 
							return false;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						*_srtt = call->peer->srtt_us >> 3;
 | 
				
			||||||
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
EXPORT_SYMBOL(rxrpc_kernel_get_srtt);
 | 
					EXPORT_SYMBOL(rxrpc_kernel_get_srtt);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue