Skip to content

Why does slow_start() ignore delayed acknowledgments? #1

@Allium-altaicum

Description

@Allium-altaicum

Line 1051 adds 1MSS, but an ACK segment may acknowledge more or less than 1MSS.

tsk->snd_cwnd = tsk->snd_cwnd + 1;

My patch:

diff --git a/tcp_frcc.c b/tcp_frcc.c
index ba4e4e9..7b9eca6 100644
--- a/tcp_frcc.c
+++ b/tcp_frcc.c
@@ -188,6 +188,9 @@ struct frcc_data {
 	u32 s_slot_min_rtt_us; // for logging only
 	u32 s_slot_max_rtt_us; // for logging only
 
+	u32 store_snd_una;//for slow start
+	bool snd_una_init;
+
 	struct probe_data *s_probe;
 	struct rprobe_data *s_rprobe;
 	struct round_data *s_round;
@@ -481,6 +484,9 @@ static void frcc_init(struct sock *sk)
 	reset_rprobe_state(frcc, now_us);
 
 	cmpxchg(&sk->sk_pacing_status, SK_PACING_NONE, SK_PACING_NEEDED);
+
+	frcc->store_snd_una = 0;
+	frcc->snd_una_init=false;
 }
 
 static u32 frcc_get_mss(struct tcp_sock *tsk)
@@ -1048,7 +1054,20 @@ static void slow_start(struct sock *sk, struct tcp_sock *tsk,
 
 	if (!frcc->s_ss_end_initiated) {
 		if (!should_init_ss_end) {
-			tsk->snd_cwnd = tsk->snd_cwnd + 1;
+			if (frcc->snd_una_init) {
+				u32 acked_bytes = tsk->snd_una - frcc->store_snd_una;
+				u32 r1 = acked_bytes % tsk->mss_cache;
+				u32 acked_pkts = acked_bytes / tsk->mss_cache;
+				if(r1 > 0){
+					acked_pkts+=1;
+				}
+				tsk->snd_cwnd += acked_pkts;
+			} else {
+				frcc->snd_una_init = true;
+				tsk->snd_cwnd += 1;
+			}
+			frcc->store_snd_una = tsk->snd_una;
+
 			update_pacing_rate(sk, frcc, tsk, rtt_us, false);
 			log_cwnd(SLOW_START, sk, frcc, tsk, rtt_us, now_us);
 		} else {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions