Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F160958022
D28931.id88001.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
7 KB
Referenced Files
None
Subscribers
None
D28931.id88001.diff
View Options
Index: share/man/man4/tcp.4
===================================================================
--- share/man/man4/tcp.4
+++ share/man/man4/tcp.4
@@ -547,6 +547,13 @@
application limited and the network bandwidth is not utilized completely.
That prevents self-inflicted packet losses once the application starts to
transmit data at a higher speed.
+.It Va do_lrd
+Enable Lost Retransmission Detection for SACK-enabled sessions, disabled by
+default.
+Under severe congestion, a retransmission can be lost which then leads to a
+mandatory Retransmission Timeout (RTO), followed by slow-start.
+LRD will try to resend the repeatedly lost packet, preventing the time-consuming
+RTO and performance reducing slow-start.
.It Va do_prr
Perform SACK loss recovery using the Proportional Rate Reduction (PRR) algorithm
described in RFC6937.
Index: sys/netinet/tcp_input.c
===================================================================
--- sys/netinet/tcp_input.c
+++ sys/netinet/tcp_input.c
@@ -164,6 +164,11 @@
&VNET_NAME(tcp_do_prr), 1,
"Enable Proportional Rate Reduction per RFC 6937");
+VNET_DEFINE(int, tcp_do_lrd) = 0;
+SYSCTL_INT(_net_inet_tcp, OID_AUTO, do_lrd, CTLFLAG_VNET | CTLFLAG_RW,
+ &VNET_NAME(tcp_do_lrd), 1,
+ "Perform Lost Retransmission Detection");
+
VNET_DEFINE(int, tcp_do_newcwv) = 0;
SYSCTL_INT(_net_inet_tcp, OID_AUTO, newcwv, CTLFLAG_VNET | CTLFLAG_RW,
&VNET_NAME(tcp_do_newcwv), 0,
@@ -2516,9 +2521,12 @@
}
if ((tp->t_flags & TF_SACK_PERMIT) &&
((to.to_flags & TOF_SACK) ||
- !TAILQ_EMPTY(&tp->snd_holes)))
- sack_changed = tcp_sack_doack(tp, &to, th->th_ack);
- else
+ !TAILQ_EMPTY(&tp->snd_holes))) {
+ if (((sack_changed = tcp_sack_doack(tp, &to, th->th_ack)) != 0) &&
+ (V_tcp_do_lrd)) {
+ tcp_lost_retransmission(tp, th);
+ }
+ } else
/*
* Reset the value so that previous (valid) value
* from the last ack with SACK doesn't get used.
@@ -4070,3 +4078,56 @@
return (4 * maxseg);
}
}
+
+/*
+ * Lost Retransmission Detection
+ * Check is FACK is beyond the rexmit of the leftmost hole.
+ * If yes, we restart sending from still existing holes,
+ * and adjust cwnd via the congestion control module.
+ */
+void
+tcp_lost_retransmission(struct tcpcb *tp, struct tcphdr *th)
+{
+ struct sackhole *temp;
+ uint32_t prev_cwnd;
+ if (IN_RECOVERY(tp->t_flags) &&
+ SEQ_GT(tp->snd_fack, tp->snd_recover) &&
+ ((temp = TAILQ_FIRST(&tp->snd_holes)) != NULL) &&
+ SEQ_GEQ(temp->rxmit, temp->end) &&
+ SEQ_GEQ(tp->snd_fack, temp->rxmit)) {
+ /*
+ * Start retransmissions from the first hole, and
+ * subsequently all other remaining holes, including
+ * those, which had been sent completely before.
+ */
+ tp->sackhint.nexthole = temp;
+ TAILQ_FOREACH(temp, &tp->snd_holes, scblink) {
+ if (SEQ_GEQ(tp->snd_fack, temp->rxmit) &&
+ SEQ_GEQ(temp->rxmit, temp->end))
+ temp->rxmit = temp->start;
+ }
+ /*
+ * Remember the old ssthresh, to deduct the beta factor used
+ * by the CC module. Finally, set cwnd to ssthresh just
+ * prior to invoking another cwnd reduction by the CC
+ * module, to not shrink it excessively.
+ */
+ prev_cwnd = tp->snd_cwnd;
+ tp->snd_cwnd = tp->snd_ssthresh;
+ /*
+ * Formally exit recovery, and let the CC module adjust
+ * ssthresh as intended.
+ */
+ EXIT_RECOVERY(tp->t_flags);
+ cc_cong_signal(tp, th, CC_NDUPACK);
+ /*
+ * For PRR, adjust recover_fs as if this new reduction
+ * initialized this variable.
+ * cwnd will be adjusted by SACK or PRR processing
+ * subsequently, only set it to a safe value here.
+ */
+ tp->snd_cwnd = tcp_maxseg(tp);
+ tp->sackhint.recover_fs = (tp->snd_max - tp->snd_una) -
+ tp->sackhint.recover_fs;
+ }
+}
Index: sys/netinet/tcp_output.c
===================================================================
--- sys/netinet/tcp_output.c
+++ sys/netinet/tcp_output.c
@@ -1264,6 +1264,14 @@
} else {
th->th_seq = htonl(p->rxmit);
p->rxmit += len;
+ /*
+ * Lost Retransmission Detection
+ * trigger resending of a (then
+ * still existing) hole, when
+ * fack acks recoverypoint.
+ */
+ if (V_tcp_do_lrd && SEQ_GEQ(p->rxmit, p->end))
+ p->rxmit = tp->snd_recover;
tp->sackhint.sack_bytes_rexmit += len;
}
if (IN_RECOVERY(tp->t_flags)) {
Index: sys/netinet/tcp_sack.c
===================================================================
--- sys/netinet/tcp_sack.c
+++ sys/netinet/tcp_sack.c
@@ -719,7 +719,8 @@
cur = TAILQ_PREV(cur, sackhole_head, scblink);
continue;
}
- tp->sackhint.sack_bytes_rexmit -= (cur->rxmit - cur->start);
+ tp->sackhint.sack_bytes_rexmit -=
+ (SEQ_MIN(cur->rxmit, cur->end) - cur->start);
KASSERT(tp->sackhint.sack_bytes_rexmit >= 0,
("sackhint bytes rtx >= 0"));
sack_changed = 1;
@@ -750,6 +751,8 @@
delivered_data += (cur->end - sblkp->start);
cur->end = sblkp->start;
cur->rxmit = SEQ_MIN(cur->rxmit, cur->end);
+ if (V_tcp_do_lrd && SEQ_GEQ(cur->rxmit, cur->end))
+ cur->rxmit = tp->snd_recover;
} else {
/*
* ACKs some data in middle of a hole; need
@@ -761,17 +764,20 @@
if (SEQ_GT(cur->rxmit, temp->rxmit)) {
temp->rxmit = cur->rxmit;
tp->sackhint.sack_bytes_rexmit
- += (temp->rxmit
- - temp->start);
+ += (SEQ_MIN(temp->rxmit,
+ temp->end) - temp->start);
}
cur->end = sblkp->start;
cur->rxmit = SEQ_MIN(cur->rxmit,
cur->end);
+ if (V_tcp_do_lrd && SEQ_GEQ(cur->rxmit, cur->end))
+ cur->rxmit = tp->snd_recover;
delivered_data += (sblkp->end - sblkp->start);
}
}
}
- tp->sackhint.sack_bytes_rexmit += (cur->rxmit - cur->start);
+ tp->sackhint.sack_bytes_rexmit +=
+ (SEQ_MIN(cur->rxmit, cur->end) - cur->start);
/*
* Testing sblkp->start against cur->start tells us whether
* we're done with the sack block or the sack hole.
@@ -899,7 +905,7 @@
*sack_bytes_rexmt += (p->rxmit - p->start);
break;
}
- *sack_bytes_rexmt += (p->rxmit - p->start);
+ *sack_bytes_rexmt += (SEQ_MIN(p->rxmit, p->end) - p->start);
}
return (p);
}
Index: sys/netinet/tcp_var.h
===================================================================
--- sys/netinet/tcp_var.h
+++ sys/netinet/tcp_var.h
@@ -855,6 +855,7 @@
VNET_DECLARE(int, tcp_do_autorcvbuf);
VNET_DECLARE(int, tcp_do_autosndbuf);
VNET_DECLARE(int, tcp_do_ecn);
+VNET_DECLARE(int, tcp_do_lrd);
VNET_DECLARE(int, tcp_do_prr);
VNET_DECLARE(int, tcp_do_prr_conservative);
VNET_DECLARE(int, tcp_do_newcwv);
@@ -889,6 +890,7 @@
VNET_DECLARE(struct inpcbhead, tcb);
VNET_DECLARE(struct inpcbinfo, tcbinfo);
+#define V_tcp_do_lrd VNET(tcp_do_lrd)
#define V_tcp_do_prr VNET(tcp_do_prr)
#define V_tcp_do_prr_conservative VNET(tcp_do_prr_conservative)
#define V_tcp_do_newcwv VNET(tcp_do_newcwv)
@@ -1082,6 +1084,7 @@
void tcp_sack_adjust(struct tcpcb *tp);
struct sackhole *tcp_sack_output(struct tcpcb *tp, int *sack_bytes_rexmt);
void tcp_do_prr_ack(struct tcpcb *, struct tcphdr *, struct tcpopt *);
+void tcp_lost_retransmission(struct tcpcb *, struct tcphdr *);
void tcp_sack_partialack(struct tcpcb *, struct tcphdr *);
void tcp_free_sackholes(struct tcpcb *tp);
int tcp_newreno(struct tcpcb *, struct tcphdr *);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Jun 30, 10:19 AM (5 h, 16 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34496517
Default Alt Text
D28931.id88001.diff (7 KB)
Attached To
Mode
D28931: Basic Lost Retransmission Detection (LRD)
Attached
Detach File
Event Timeline
Log In to Comment