[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1584524289-24187-23-git-send-email-ilpo.jarvinen@helsinki.fi>
Date: Wed, 18 Mar 2020 11:38:04 +0200
From: Ilpo Järvinen <ilpo.jarvinen@...sinki.fi>
To: netdev@...r.kernel.org
Cc: Yuchung Cheng <ycheng@...gle.com>,
Neal Cardwell <ncardwell@...gle.com>,
Eric Dumazet <eric.dumazet@...il.com>,
Olivier Tilmans <olivier.tilmans@...ia-bell-labs.com>
Subject: [RFC PATCH 23/28] tcp: AccECN option ceb/cep heuristic
From: Ilpo Järvinen <ilpo.jarvinen@...helsinki.fi>
The heuristic algorithm from draft-09 Appendix A.2.2.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@...helsinki.fi>
---
include/net/tcp.h | 1 +
net/ipv4/tcp_input.c | 16 ++++++++++++++--
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/include/net/tcp.h b/include/net/tcp.h
index a29109fa2ce2..54a640fed673 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -225,6 +225,7 @@ void tcp_time_wait(struct sock *sk, int state, int timeo);
TCPOLEN_ACCECN_PERCOUNTER * \
TCP_ACCECN_NUMCOUNTERS)
#define TCP_ACCECN_BEACON_FREQ_SHIFT 2 /* Send option at least 2^2 times per RTT */
+#define TCP_ACCECN_SAFETY_SHIFT 1 /* SAFETY_FACTOR in accecn draft */
/* tp->saw_accecn_opt states, empty seen & orderbit are overloaded */
#define TCP_ACCECN_OPT_EMPTY_SEEN 0x1
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 826dfd5bf114..6bc9995202c8 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -518,14 +518,16 @@ static bool tcp_accecn_process_option(struct tcp_sock *tp,
static u32 tcp_accecn_process(struct tcp_sock *tp, const struct sk_buff *skb,
u32 delivered_pkts, u32 delivered_bytes, int flag)
{
- u32 delta, safe_delta;
+ u32 delta, safe_delta, d_ceb;
u32 corrected_ace;
+ u32 old_ceb = tp->delivered_ecn_bytes[INET_ECN_CE - 1];
+ bool opt_deltas_valid;
/* Reordered ACK? (...or uncertain due to lack of data to send and ts) */
if (!(flag & (FLAG_FORWARD_PROGRESS|FLAG_TS_PROGRESS)))
return 0;
- tcp_accecn_process_option(tp, skb, delivered_bytes);
+ opt_deltas_valid = tcp_accecn_process_option(tp, skb, delivered_bytes);
if (!(flag & FLAG_SLOWPATH)) {
/* AccECN counter might overflow on large ACKs */
@@ -545,6 +547,16 @@ static u32 tcp_accecn_process(struct tcp_sock *tp, const struct sk_buff *skb,
safe_delta = delivered_pkts -
((delivered_pkts - delta) & TCP_ACCECN_CEP_ACE_MASK);
+ if (opt_deltas_valid) {
+ d_ceb = tp->delivered_ecn_bytes[INET_ECN_CE - 1] - old_ceb;
+ if (!d_ceb)
+ return delta;
+ if (d_ceb > delta * tp->mss_cache)
+ return safe_delta;
+ if (d_ceb < safe_delta * tp->mss_cache >> TCP_ACCECN_SAFETY_SHIFT)
+ return delta;
+ }
+
return safe_delta;
}
--
2.20.1
Powered by blists - more mailing lists