Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_input.c
| Show First 20 Lines • Show All 438 Lines • ▼ Show 20 Lines | if (!IN_CONGRECOVERY(tp->t_flags) || | ||||
| tp->snd_recover = tp->snd_max + 1; | tp->snd_recover = tp->snd_max + 1; | ||||
| if (tp->t_flags2 & TF2_ECN_PERMIT) | if (tp->t_flags2 & TF2_ECN_PERMIT) | ||||
| tp->t_flags2 |= TF2_ECN_SND_CWR; | tp->t_flags2 |= TF2_ECN_SND_CWR; | ||||
| } | } | ||||
| break; | break; | ||||
| case CC_RTO: | case CC_RTO: | ||||
| tp->t_dupacks = 0; | tp->t_dupacks = 0; | ||||
| tp->t_bytes_acked = 0; | tp->t_bytes_acked = 0; | ||||
| if ((tp->t_rxtshift > 1) || | |||||
| !((tp->t_flags & TF_SACK_PERMIT) && | |||||
| (!TAILQ_EMPTY(&tp->snd_holes)))) | |||||
| EXIT_RECOVERY(tp->t_flags); | EXIT_RECOVERY(tp->t_flags); | ||||
| if (tp->t_flags2 & TF2_ECN_PERMIT) | if (tp->t_flags2 & TF2_ECN_PERMIT) | ||||
| tp->t_flags2 |= TF2_ECN_SND_CWR; | tp->t_flags2 |= TF2_ECN_SND_CWR; | ||||
| break; | break; | ||||
| case CC_RTO_ERR: | case CC_RTO_ERR: | ||||
| TCPSTAT_INC(tcps_sndrexmitbad); | TCPSTAT_INC(tcps_sndrexmitbad); | ||||
| /* RTO was unnecessary, so reset everything. */ | /* RTO was unnecessary, so reset everything. */ | ||||
| tp->snd_cwnd = tp->snd_cwnd_prev; | tp->snd_cwnd = tp->snd_cwnd_prev; | ||||
| tp->snd_ssthresh = tp->snd_ssthresh_prev; | tp->snd_ssthresh = tp->snd_ssthresh_prev; | ||||
| ▲ Show 20 Lines • Show All 2,283 Lines • ▼ Show 20 Lines | enter_recovery: | ||||
| imin(INT_MAX / 65536, | imin(INT_MAX / 65536, | ||||
| tp->t_dupacks) * maxseg); | tp->t_dupacks) * maxseg); | ||||
| } | } | ||||
| tp->sackhint.recover_fs = max(1, | tp->sackhint.recover_fs = max(1, | ||||
| tp->snd_nxt - tp->snd_una); | tp->snd_nxt - tp->snd_una); | ||||
| } | } | ||||
| if (tcp_is_sack_recovery(tp, &to)) { | if (tcp_is_sack_recovery(tp, &to)) { | ||||
| TCPSTAT_INC(tcps_sack_recovery_episode); | TCPSTAT_INC(tcps_sack_recovery_episode); | ||||
| tp->snd_recover = tp->snd_nxt; | |||||
| tp->snd_cwnd = maxseg; | tp->snd_cwnd = maxseg; | ||||
| (void) tcp_output(tp); | (void) tcp_output(tp); | ||||
| if (SEQ_GT(th->th_ack, tp->snd_una)) { | if (SEQ_GT(th->th_ack, tp->snd_una)) { | ||||
| goto resume_partialack; | goto resume_partialack; | ||||
| } | } | ||||
| goto drop; | goto drop; | ||||
| } | } | ||||
| tp->snd_nxt = th->th_ack; | tp->snd_nxt = th->th_ack; | ||||
| Show All 26 Lines | enter_recovery: | ||||
| int avail; | int avail; | ||||
| KASSERT(tp->t_dupacks == 1 || | KASSERT(tp->t_dupacks == 1 || | ||||
| tp->t_dupacks == 2, | tp->t_dupacks == 2, | ||||
| ("%s: dupacks not 1 or 2", | ("%s: dupacks not 1 or 2", | ||||
| __func__)); | __func__)); | ||||
| if (tp->t_dupacks == 1) | if (tp->t_dupacks == 1) | ||||
| tp->snd_limited = 0; | tp->snd_limited = 0; | ||||
| if ((tp->snd_nxt == tp->snd_max) && | |||||
| (tp->t_rxtshift == 0)) | |||||
| tp->snd_cwnd = | tp->snd_cwnd = | ||||
| (tp->snd_nxt - tp->snd_una) + | SEQ_SUB(tp->snd_nxt, | ||||
| tp->snd_una); | |||||
| tp->snd_cwnd += | |||||
| (tp->t_dupacks - tp->snd_limited) * | (tp->t_dupacks - tp->snd_limited) * | ||||
cc: For readability, it's better to remove () between relational operators:
```
if (tp… | |||||
| maxseg; | maxseg; | ||||
| /* | /* | ||||
| * Only call tcp_output when there | * Only call tcp_output when there | ||||
| * is new data available to be sent | * is new data available to be sent | ||||
| * or we need to send an ACK. | * or we need to send an ACK. | ||||
| */ | */ | ||||
| SOCKBUF_LOCK(&so->so_snd); | SOCKBUF_LOCK(&so->so_snd); | ||||
| avail = sbavail(&so->so_snd); | avail = sbavail(&so->so_snd); | ||||
| Show All 30 Lines | enter_recovery: | ||||
| * If this ack also has new SACK info, increment the | * If this ack also has new SACK info, increment the | ||||
| * counter as per rfc6675. The variable | * counter as per rfc6675. The variable | ||||
| * sack_changed tracks all changes to the SACK | * sack_changed tracks all changes to the SACK | ||||
| * scoreboard, including when partial ACKs without | * scoreboard, including when partial ACKs without | ||||
| * SACK options are received, and clear the scoreboard | * SACK options are received, and clear the scoreboard | ||||
| * from the left side. Such partial ACKs should not be | * from the left side. Such partial ACKs should not be | ||||
| * counted as dupacks here. | * counted as dupacks here. | ||||
| */ | */ | ||||
| if (tcp_is_sack_recovery(tp, &to) && | if (tcp_is_sack_recovery(tp, &to) && | ||||
| (sack_changed != SACK_NOCHANGE)) { | (((tp->t_rxtshift == 0) && (sack_changed != SACK_NOCHANGE)) || | ||||
| ((tp->t_rxtshift > 0) && (sack_changed == SACK_NEWLOSS))) && | |||||
| (tp->snd_nxt == tp->snd_max)) { | |||||
| tp->t_dupacks++; | tp->t_dupacks++; | ||||
Not Done Inline ActionsFor readability, it's better to remove () between relational operators and re-align: if (tcp_is_sack_recovery(tp, &to) && tp->snd_nxt == tp->snd_max &&
((tp->t_rxtshift == 0 && sack_changed != SACK_NOCHANGE) ||
(tp->t_rxtshift > 0 && sack_changed == SACK_NEWLOSS))) {
...
}cc: For readability, it's better to remove `()` between relational operators and re-align:
```… | |||||
| /* limit overhead by setting maxseg last */ | /* limit overhead by setting maxseg last */ | ||||
| if (!IN_FASTRECOVERY(tp->t_flags) && | if (!IN_FASTRECOVERY(tp->t_flags) && | ||||
| (tp->sackhint.sacked_bytes > | (tp->sackhint.sacked_bytes > | ||||
| ((tcprexmtthresh - 1) * | ((tcprexmtthresh - 1) * | ||||
| (maxseg = tcp_maxseg(tp))))) { | (maxseg = tcp_maxseg(tp))))) { | ||||
| goto enter_recovery; | goto enter_recovery; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 1,377 Lines • Show Last 20 Lines | |||||
For readability, it's better to remove () between relational operators: