Changeset View
Changeset View
Standalone View
Standalone View
sys/netinet/tcp_input.c
Show First 20 Lines • Show All 147 Lines • ▼ Show 20 Lines | SYSCTL_INT(_net_inet_tcp, OID_AUTO, delayed_ack, CTLFLAG_VNET | CTLFLAG_RW, | ||||
&VNET_NAME(tcp_delack_enabled), 0, | &VNET_NAME(tcp_delack_enabled), 0, | ||||
"Delay ACK to try and piggyback it onto a data packet"); | "Delay ACK to try and piggyback it onto a data packet"); | ||||
VNET_DEFINE(int, drop_synfin) = 0; | VNET_DEFINE(int, drop_synfin) = 0; | ||||
SYSCTL_INT(_net_inet_tcp, OID_AUTO, drop_synfin, CTLFLAG_VNET | CTLFLAG_RW, | SYSCTL_INT(_net_inet_tcp, OID_AUTO, drop_synfin, CTLFLAG_VNET | CTLFLAG_RW, | ||||
&VNET_NAME(drop_synfin), 0, | &VNET_NAME(drop_synfin), 0, | ||||
"Drop TCP packets with SYN+FIN set"); | "Drop TCP packets with SYN+FIN set"); | ||||
VNET_DEFINE(int, tcp_do_prr_conservative) = 0; | |||||
SYSCTL_INT(_net_inet_tcp, OID_AUTO, do_prr_conservative, CTLFLAG_VNET | CTLFLAG_RW, | |||||
&VNET_NAME(tcp_do_prr_conservative), 0, | |||||
"Do conservative Proportional Rate Reduction"); | |||||
VNET_DEFINE(int, tcp_do_prr) = 1; | VNET_DEFINE(int, tcp_do_prr) = 1; | ||||
SYSCTL_INT(_net_inet_tcp, OID_AUTO, do_prr, CTLFLAG_VNET | CTLFLAG_RW, | SYSCTL_INT(_net_inet_tcp, OID_AUTO, do_prr, CTLFLAG_VNET | CTLFLAG_RW, | ||||
&VNET_NAME(tcp_do_prr), 1, | &VNET_NAME(tcp_do_prr), 1, | ||||
"Enable Proportional Rate Reduction per RFC 6937"); | "Enable Proportional Rate Reduction per RFC 6937"); | ||||
VNET_DEFINE(int, tcp_do_newcwv) = 0; | VNET_DEFINE(int, tcp_do_newcwv) = 0; | ||||
SYSCTL_INT(_net_inet_tcp, OID_AUTO, newcwv, CTLFLAG_VNET | CTLFLAG_RW, | SYSCTL_INT(_net_inet_tcp, OID_AUTO, newcwv, CTLFLAG_VNET | CTLFLAG_RW, | ||||
&VNET_NAME(tcp_do_newcwv), 0, | &VNET_NAME(tcp_do_newcwv), 0, | ||||
▲ Show 20 Lines • Show All 2,423 Lines • ▼ Show 20 Lines | if (SEQ_LEQ(th->th_ack, tp->snd_una)) { | ||||
if (pipe > tp->snd_ssthresh) { | if (pipe > tp->snd_ssthresh) { | ||||
if (tp->sackhint.recover_fs == 0) | if (tp->sackhint.recover_fs == 0) | ||||
tp->sackhint.recover_fs = | tp->sackhint.recover_fs = | ||||
imax(1, tp->snd_nxt - tp->snd_una); | imax(1, tp->snd_nxt - tp->snd_una); | ||||
snd_cnt = howmany((long)tp->sackhint.prr_delivered * | snd_cnt = howmany((long)tp->sackhint.prr_delivered * | ||||
tp->snd_ssthresh, tp->sackhint.recover_fs) - | tp->snd_ssthresh, tp->sackhint.recover_fs) - | ||||
tp->sackhint.sack_bytes_rexmit; | tp->sackhint.sack_bytes_rexmit; | ||||
} else { | } else { | ||||
if (V_tcp_do_prr_conservative) | /* | ||||
* PRR 6937bis heuristic: | |||||
* Up here we deal with duplicate ACKs, | |||||
* which by definition do not advance snd_una. | |||||
* Therefore be always conservative. | |||||
*/ | |||||
limit = tp->sackhint.prr_delivered - | limit = tp->sackhint.prr_delivered - | ||||
tp->sackhint.sack_bytes_rexmit; | tp->sackhint.sack_bytes_rexmit; | ||||
else | |||||
limit = imax(tp->sackhint.prr_delivered - | |||||
tp->sackhint.sack_bytes_rexmit, | |||||
del_data) + maxseg; | |||||
snd_cnt = imin(tp->snd_ssthresh - pipe, limit); | snd_cnt = imin(tp->snd_ssthresh - pipe, limit); | ||||
} | } | ||||
snd_cnt = imax(snd_cnt, 0) / maxseg; | snd_cnt = imax(snd_cnt, 0) / maxseg; | ||||
/* | /* | ||||
* Send snd_cnt new data into the network in | * Send snd_cnt new data into the network in | ||||
* response to this ACK. If there is a going | * response to this ACK. If there is a going | ||||
* to be a SACK retransmission, adjust snd_cwnd | * to be a SACK retransmission, adjust snd_cwnd | ||||
* accordingly. | * accordingly. | ||||
▲ Show 20 Lines • Show All 191 Lines • ▼ Show 20 Lines | resume_partialack: | ||||
/* | /* | ||||
* If the congestion window was inflated to account | * If the congestion window was inflated to account | ||||
* for the other side's cached packets, retract it. | * for the other side's cached packets, retract it. | ||||
*/ | */ | ||||
if (IN_FASTRECOVERY(tp->t_flags)) { | if (IN_FASTRECOVERY(tp->t_flags)) { | ||||
if (SEQ_LT(th->th_ack, tp->snd_recover)) { | if (SEQ_LT(th->th_ack, tp->snd_recover)) { | ||||
if (tp->t_flags & TF_SACK_PERMIT) | if (tp->t_flags & TF_SACK_PERMIT) | ||||
if (V_tcp_do_prr && to.to_flags & TOF_SACK) | if (V_tcp_do_prr && to.to_flags & TOF_SACK) | ||||
tcp_prr_partialack(tp, th); | tcp_prr_partialack(tp, th, sack_changed); | ||||
else | else | ||||
tcp_sack_partialack(tp, th); | tcp_sack_partialack(tp, th); | ||||
else | else | ||||
tcp_newreno_partial_ack(tp, th); | tcp_newreno_partial_ack(tp, th); | ||||
} else | } else | ||||
cc_post_recovery(tp, th); | cc_post_recovery(tp, th); | ||||
} | } | ||||
/* | /* | ||||
▲ Show 20 Lines • Show All 1,112 Lines • ▼ Show 20 Lines | if (maxmtu && thcmtu) | ||||
mss = min(maxmtu, thcmtu) - min_protoh; | mss = min(maxmtu, thcmtu) - min_protoh; | ||||
else if (maxmtu || thcmtu) | else if (maxmtu || thcmtu) | ||||
mss = max(maxmtu, thcmtu) - min_protoh; | mss = max(maxmtu, thcmtu) - min_protoh; | ||||
return (mss); | return (mss); | ||||
} | } | ||||
void | void | ||||
tcp_prr_partialack(struct tcpcb *tp, struct tcphdr *th) | tcp_prr_partialack(struct tcpcb *tp, struct tcphdr *th, int sack_changed) | ||||
{ | { | ||||
int snd_cnt = 0, limit = 0, del_data = 0, pipe = 0; | int snd_cnt = 0, limit = 0, del_data = 0, pipe = 0; | ||||
int maxseg = tcp_maxseg(tp); | int maxseg = tcp_maxseg(tp); | ||||
INP_WLOCK_ASSERT(tp->t_inpcb); | INP_WLOCK_ASSERT(tp->t_inpcb); | ||||
tcp_timer_activate(tp, TT_REXMT, 0); | tcp_timer_activate(tp, TT_REXMT, 0); | ||||
tp->t_rtttime = 0; | tp->t_rtttime = 0; | ||||
Show All 14 Lines | tcp_prr_partialack(struct tcpcb *tp, struct tcphdr *th, int sack_changed) | ||||
if (pipe > tp->snd_ssthresh) { | if (pipe > tp->snd_ssthresh) { | ||||
if (tp->sackhint.recover_fs == 0) | if (tp->sackhint.recover_fs == 0) | ||||
tp->sackhint.recover_fs = | tp->sackhint.recover_fs = | ||||
imax(1, tp->snd_nxt - tp->snd_una); | imax(1, tp->snd_nxt - tp->snd_una); | ||||
snd_cnt = howmany((long)tp->sackhint.prr_delivered * | snd_cnt = howmany((long)tp->sackhint.prr_delivered * | ||||
tp->snd_ssthresh, tp->sackhint.recover_fs) - | tp->snd_ssthresh, tp->sackhint.recover_fs) - | ||||
tp->sackhint.sack_bytes_rexmit; | tp->sackhint.sack_bytes_rexmit; | ||||
} else { | } else { | ||||
if (V_tcp_do_prr_conservative) | /* | ||||
* PRR 6937bis heuristic: | |||||
* - A partial ack without SACK block beneath snd_recover | |||||
* indicates further loss. This case is not handled here, | |||||
* but in tcp_sack_partialack, to send a rescue | |||||
* retransmissions. | |||||
* - An SACK scoreboard update adding a new hole indicates | |||||
* further loss, so be conservative and send at most one | |||||
* segment. | |||||
*/ | |||||
if (sack_changed == 2) | |||||
limit = tp->sackhint.prr_delivered - | limit = tp->sackhint.prr_delivered - | ||||
tp->sackhint.sack_bytes_rexmit; | tp->sackhint.sack_bytes_rexmit; | ||||
else | else | ||||
limit = imax(tp->sackhint.prr_delivered - | limit = imax(tp->sackhint.prr_delivered - | ||||
tp->sackhint.sack_bytes_rexmit, | tp->sackhint.sack_bytes_rexmit, | ||||
del_data) + maxseg; | del_data) + maxseg; | ||||
snd_cnt = imin((tp->snd_ssthresh - pipe), limit); | snd_cnt = imin((tp->snd_ssthresh - pipe), limit); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 85 Lines • Show Last 20 Lines |