Skip to content

Commit c637bd0

Browse files
dhowellskuba-moo
authored andcommitted
rxrpc: Generate rtt_min
Generate rtt_min as this is required by RACK-TLP. Signed-off-by: David Howells <[email protected]> cc: Marc Dionne <[email protected]> cc: [email protected] Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 7903d44 commit c637bd0

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

lib/win_minmax.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,4 @@ u32 minmax_running_min(struct minmax *m, u32 win, u32 t, u32 meas)
9797

9898
return minmax_subwin_update(m, win, &val);
9999
}
100+
EXPORT_SYMBOL(minmax_running_min);

net/rxrpc/ar-internal.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,8 @@ struct rxrpc_peer {
371371
spinlock_t rtt_input_lock; /* RTT lock for input routine */
372372
ktime_t rtt_last_req; /* Time of last RTT request */
373373
unsigned int rtt_count; /* Number of samples we've got */
374+
unsigned int rtt_taken; /* Number of samples taken (wrapping) */
375+
struct minmax min_rtt; /* Estimated minimum RTT */
374376

375377
u32 srtt_us; /* smoothed round trip time << 3 in usecs */
376378
u32 mdev_us; /* medium deviation */

net/rxrpc/rtt.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,16 +127,27 @@ static void rxrpc_set_rto(struct rxrpc_peer *peer)
127127
peer->rto_us = rxrpc_bound_rto(rto);
128128
}
129129

130-
static void rxrpc_ack_update_rtt(struct rxrpc_peer *peer, long rtt_us)
130+
static void rxrpc_update_rtt_min(struct rxrpc_peer *peer, ktime_t resp_time, long rtt_us)
131+
{
132+
/* Window size 5mins in approx usec (ipv4.sysctl_tcp_min_rtt_wlen) */
133+
u32 wlen_us = 5ULL * NSEC_PER_SEC / 1024;
134+
135+
minmax_running_min(&peer->min_rtt, wlen_us, resp_time / 1024,
136+
(u32)rtt_us ? : jiffies_to_usecs(1));
137+
}
138+
139+
static void rxrpc_ack_update_rtt(struct rxrpc_peer *peer, ktime_t resp_time, long rtt_us)
131140
{
132141
if (rtt_us < 0)
133142
return;
134143

135-
//rxrpc_update_rtt_min(peer, rtt_us);
144+
/* Update RACK min RTT [RFC8985 6.1 Step 1]. */
145+
rxrpc_update_rtt_min(peer, resp_time, rtt_us);
146+
136147
rxrpc_rtt_estimator(peer, rtt_us);
137148
rxrpc_set_rto(peer);
138149

139-
/* RFC6298: only reset backoff on valid RTT measurement. */
150+
/* Only reset backoff on valid RTT measurement [RFC6298]. */
140151
peer->backoff = 0;
141152
}
142153

@@ -157,9 +168,10 @@ void rxrpc_peer_add_rtt(struct rxrpc_call *call, enum rxrpc_rtt_rx_trace why,
157168
return;
158169

159170
spin_lock(&peer->rtt_input_lock);
160-
rxrpc_ack_update_rtt(peer, rtt_us);
171+
rxrpc_ack_update_rtt(peer, resp_time, rtt_us);
161172
if (peer->rtt_count < 3)
162173
peer->rtt_count++;
174+
peer->rtt_taken++;
163175
spin_unlock(&peer->rtt_input_lock);
164176

165177
trace_rxrpc_rtt_rx(call, why, rtt_slot, send_serial, resp_serial,

0 commit comments

Comments
 (0)