Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_input.c
Show First 20 Lines • Show All 443 Lines • ▼ Show 20 Lines | |||||
#ifdef STATS | #ifdef STATS | ||||
stats_voi_update_abs_u32(tp->t_stats, VOI_TCP_CSIG, type); | stats_voi_update_abs_u32(tp->t_stats, VOI_TCP_CSIG, type); | ||||
#endif | #endif | ||||
switch(type) { | switch(type) { | ||||
case CC_NDUPACK: | case CC_NDUPACK: | ||||
if (!IN_FASTRECOVERY(tp->t_flags)) { | if (!IN_FASTRECOVERY(tp->t_flags)) { | ||||
tp->snd_recover = tp->snd_max; | tp->snd_recover = tp->snd_max; | ||||
if (__predict_false(tp->t_flags & TF_SENTFIN)) | |||||
tp->snd_recover--; | |||||
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_ECN: | case CC_ECN: | ||||
if (!IN_CONGRECOVERY(tp->t_flags) || | if (!IN_CONGRECOVERY(tp->t_flags) || | ||||
/* | /* | ||||
* Allow ECN reaction on ACK to CWR, if | * Allow ECN reaction on ACK to CWR, if | ||||
* that data segment was also CE marked. | * that data segment was also CE marked. | ||||
*/ | */ | ||||
SEQ_GEQ(th->th_ack, tp->snd_recover)) { | SEQ_GEQ(th->th_ack, tp->snd_recover)) { | ||||
EXIT_CONGRECOVERY(tp->t_flags); | EXIT_CONGRECOVERY(tp->t_flags); | ||||
TCPSTAT_INC(tcps_ecn_rcwnd); | TCPSTAT_INC(tcps_ecn_rcwnd); | ||||
tp->snd_recover = tp->snd_max + 1; | tp->snd_recover = tp->snd_max + 1; | ||||
if (__predict_false(tp->t_flags & TF_SENTFIN)) | |||||
tp->snd_recover -= 2; | |||||
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; | ||||
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; | ||||
tp->snd_recover = tp->snd_recover_prev; | tp->snd_recover = tp->snd_recover_prev; | ||||
if (tp->t_flags & TF_WASFRECOVERY) | if (tp->t_flags & TF_WASFRECOVERY) | ||||
ENTER_FASTRECOVERY(tp->t_flags); | ENTER_FASTRECOVERY(tp->t_flags); | ||||
if (tp->t_flags & TF_WASCRECOVERY) | if (tp->t_flags & TF_WASCRECOVERY) | ||||
ENTER_CONGRECOVERY(tp->t_flags); | ENTER_CONGRECOVERY(tp->t_flags); | ||||
tp->snd_nxt = tp->snd_max; | tp->snd_nxt = tp->snd_max; | ||||
rscheff: This should be save, actually... | |||||
if (__predict_false(tp->t_flags & TF_SENTFIN)) | |||||
tp->snd_nxt--; | |||||
tp->t_flags &= ~TF_PREVVALID; | tp->t_flags &= ~TF_PREVVALID; | ||||
tp->t_badrxtwin = 0; | tp->t_badrxtwin = 0; | ||||
break; | break; | ||||
} | } | ||||
if (CC_ALGO(tp)->cong_signal != NULL) { | if (CC_ALGO(tp)->cong_signal != NULL) { | ||||
if (th != NULL) | if (th != NULL) | ||||
tp->ccv->curack = th->th_ack; | tp->ccv->curack = th->th_ack; | ||||
▲ Show 20 Lines • Show All 3,513 Lines • ▼ Show 20 Lines | tcp_newreno_partial_ack(struct tcpcb *tp, struct tcphdr *th) | ||||
else | else | ||||
tp->snd_cwnd = 0; | tp->snd_cwnd = 0; | ||||
tp->snd_cwnd += maxseg; | tp->snd_cwnd += maxseg; | ||||
} | } | ||||
int | int | ||||
tcp_compute_pipe(struct tcpcb *tp) | tcp_compute_pipe(struct tcpcb *tp) | ||||
{ | { | ||||
return (tp->snd_max - tp->snd_una + | int highdata; | ||||
highdata = tp->snd_max; | |||||
if (__predict_false(tp->t_flags & TF_SENTFIN)) | |||||
highdata--; | |||||
return (highdata - tp->snd_una + | |||||
tp->sackhint.sack_bytes_rexmit - | tp->sackhint.sack_bytes_rexmit - | ||||
tp->sackhint.sacked_bytes); | tp->sackhint.sacked_bytes); | ||||
} | } | ||||
uint32_t | uint32_t | ||||
tcp_compute_initwnd(uint32_t maxseg) | tcp_compute_initwnd(uint32_t maxseg) | ||||
{ | { | ||||
/* | /* | ||||
Show All 22 Lines |
This should be save, actually...