75 lines
2.6 KiB
Diff
75 lines
2.6 KiB
Diff
|
From b32715fbe2ab96d1060ec37bb9c03feedf366494 Mon Sep 17 00:00:00 2001
|
||
|
From: Neal Cardwell <ncardwell@google.com>
|
||
|
Date: Sun, 24 Jun 2018 21:55:59 -0400
|
||
|
Subject: [PATCH 02/19] net-tcp_bbr: v2: shrink delivered_mstamp,
|
||
|
first_tx_mstamp to u32 to free up 8 bytes
|
||
|
|
||
|
Free up some space for tracking inflight and losses for each
|
||
|
bw sample, in upcoming commits.
|
||
|
|
||
|
These timestamps are in microseconds, and are now stored in 32
|
||
|
bits. So they can only hold time intervals up to roughly 2^12 = 4096
|
||
|
seconds. But Linux TCP RTT and RTO tracking has the same 32-bit
|
||
|
microsecond implementation approach and resulting deployment
|
||
|
limitations. So this is not introducing a new limit. And these should
|
||
|
not be a limitation for the foreseeable future.
|
||
|
|
||
|
Effort: net-tcp_bbr
|
||
|
Origin-9xx-SHA1: 238a7e6b5d51625fef1ce7769826a7b21b02ae55
|
||
|
Change-Id: I3b779603797263b52a61ad57c565eb91fe42680c
|
||
|
Signed-off-by: Alexandre Frade <kernel@xanmod.org>
|
||
|
---
|
||
|
include/net/tcp.h | 9 +++++++--
|
||
|
net/ipv4/tcp_rate.c | 7 ++++---
|
||
|
2 files changed, 11 insertions(+), 5 deletions(-)
|
||
|
|
||
|
--- a/include/net/tcp.h
|
||
|
+++ b/include/net/tcp.h
|
||
|
@@ -884,6 +884,11 @@ static inline u32 tcp_stamp_us_delta(u64
|
||
|
return max_t(s64, t1 - t0, 0);
|
||
|
}
|
||
|
|
||
|
+static inline u32 tcp_stamp32_us_delta(u32 t1, u32 t0)
|
||
|
+{
|
||
|
+ return max_t(s32, t1 - t0, 0);
|
||
|
+}
|
||
|
+
|
||
|
/* provide the departure time in us unit */
|
||
|
static inline u64 tcp_skb_timestamp_us(const struct sk_buff *skb)
|
||
|
{
|
||
|
@@ -973,9 +978,9 @@ struct tcp_skb_cb {
|
||
|
/* pkts S/ACKed so far upon tx of skb, incl retrans: */
|
||
|
__u32 delivered;
|
||
|
/* start of send pipeline phase */
|
||
|
- u64 first_tx_mstamp;
|
||
|
+ u32 first_tx_mstamp;
|
||
|
/* when we reached the "delivered" count */
|
||
|
- u64 delivered_mstamp;
|
||
|
+ u32 delivered_mstamp;
|
||
|
} tx; /* only used for outgoing skbs */
|
||
|
union {
|
||
|
struct inet_skb_parm h4;
|
||
|
--- a/net/ipv4/tcp_rate.c
|
||
|
+++ b/net/ipv4/tcp_rate.c
|
||
|
@@ -101,8 +101,9 @@ void tcp_rate_skb_delivered(struct sock
|
||
|
/* Record send time of most recently ACKed packet: */
|
||
|
tp->first_tx_mstamp = tx_tstamp;
|
||
|
/* Find the duration of the "send phase" of this window: */
|
||
|
- rs->interval_us = tcp_stamp_us_delta(tp->first_tx_mstamp,
|
||
|
- scb->tx.first_tx_mstamp);
|
||
|
+ rs->interval_us = tcp_stamp32_us_delta(
|
||
|
+ tp->first_tx_mstamp,
|
||
|
+ scb->tx.first_tx_mstamp);
|
||
|
|
||
|
}
|
||
|
/* Mark off the skb delivered once it's sacked to avoid being
|
||
|
@@ -155,7 +156,7 @@ void tcp_rate_gen(struct sock *sk, u32 d
|
||
|
* longer phase.
|
||
|
*/
|
||
|
snd_us = rs->interval_us; /* send phase */
|
||
|
- ack_us = tcp_stamp_us_delta(tp->tcp_mstamp,
|
||
|
+ ack_us = tcp_stamp32_us_delta(tp->tcp_mstamp,
|
||
|
rs->prior_mstamp); /* ack phase */
|
||
|
rs->interval_us = max(snd_us, ack_us);
|
||
|
|