Changeset View
Changeset View
Standalone View
Standalone View
head/sys/netinet/tcp_stacks/rack.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 7,047 Lines • ▼ Show 20 Lines | if (rack->r_ctl.rc_tlpsend) { | ||||
doing_tlp = 1; | doing_tlp = 1; | ||||
rsm = rack->r_ctl.rc_tlpsend; | rsm = rack->r_ctl.rc_tlpsend; | ||||
rack->r_ctl.rc_tlpsend = NULL; | rack->r_ctl.rc_tlpsend = NULL; | ||||
sack_rxmit = 1; | sack_rxmit = 1; | ||||
tlen = rsm->r_end - rsm->r_start; | tlen = rsm->r_end - rsm->r_start; | ||||
if (tlen > tp->t_maxseg) | if (tlen > tp->t_maxseg) | ||||
tlen = tp->t_maxseg; | tlen = tp->t_maxseg; | ||||
#ifdef INVARIANTS | KASSERT(SEQ_LEQ(tp->snd_una, rsm->r_start), | ||||
if (SEQ_GT(tp->snd_una, rsm->r_start)) { | ("%s:%d: r.start:%u < SND.UNA:%u; tp:%p, rack:%p, rsm:%p", | ||||
panic("tp:%p rack:%p snd_una:%u rsm:%p r_start:%u", | __func__, __LINE__, | ||||
tp, rack, tp->snd_una, rsm, rsm->r_start); | rsm->r_start, tp->snd_una, tp, rack, rsm)); | ||||
} | |||||
#endif | |||||
sb_offset = rsm->r_start - tp->snd_una; | sb_offset = rsm->r_start - tp->snd_una; | ||||
cwin = min(tp->snd_wnd, tlen); | cwin = min(tp->snd_wnd, tlen); | ||||
len = cwin; | len = cwin; | ||||
} else if (rack->r_ctl.rc_resend) { | } else if (rack->r_ctl.rc_resend) { | ||||
/* Retransmit timer */ | /* Retransmit timer */ | ||||
rsm = rack->r_ctl.rc_resend; | rsm = rack->r_ctl.rc_resend; | ||||
rack->r_ctl.rc_resend = NULL; | rack->r_ctl.rc_resend = NULL; | ||||
len = rsm->r_end - rsm->r_start; | len = rsm->r_end - rsm->r_start; | ||||
sack_rxmit = 1; | sack_rxmit = 1; | ||||
sendalot = 0; | sendalot = 0; | ||||
KASSERT(SEQ_LEQ(tp->snd_una, rsm->r_start), | |||||
("%s:%d: r.start:%u < SND.UNA:%u; tp:%p, rack:%p, rsm:%p", | |||||
__func__, __LINE__, | |||||
rsm->r_start, tp->snd_una, tp, rack, rsm)); | |||||
sb_offset = rsm->r_start - tp->snd_una; | sb_offset = rsm->r_start - tp->snd_una; | ||||
if (len >= tp->t_maxseg) { | if (len >= tp->t_maxseg) { | ||||
len = tp->t_maxseg; | len = tp->t_maxseg; | ||||
} | } | ||||
KASSERT(sb_offset >= 0, ("%s: sack block to the left of una : %d", | |||||
__func__, sb_offset)); | |||||
} else if ((rack->rc_in_persist == 0) && | } else if ((rack->rc_in_persist == 0) && | ||||
((rsm = tcp_rack_output(tp, rack, cts)) != NULL)) { | ((rsm = tcp_rack_output(tp, rack, cts)) != NULL)) { | ||||
long tlen; | long tlen; | ||||
if ((!IN_RECOVERY(tp->t_flags)) && | if ((!IN_RECOVERY(tp->t_flags)) && | ||||
((tp->t_flags & (TF_WASFRECOVERY | TF_WASCRECOVERY)) == 0)) { | ((tp->t_flags & (TF_WASFRECOVERY | TF_WASCRECOVERY)) == 0)) { | ||||
/* Enter recovery if not induced by a time-out */ | /* Enter recovery if not induced by a time-out */ | ||||
rack->r_ctl.rc_rsm_start = rsm->r_start; | rack->r_ctl.rc_rsm_start = rsm->r_start; | ||||
rack->r_ctl.rc_cwnd_at = tp->snd_cwnd; | rack->r_ctl.rc_cwnd_at = tp->snd_cwnd; | ||||
rack->r_ctl.rc_ssthresh_at = tp->snd_ssthresh; | rack->r_ctl.rc_ssthresh_at = tp->snd_ssthresh; | ||||
rack_cong_signal(tp, NULL, CC_NDUPACK); | rack_cong_signal(tp, NULL, CC_NDUPACK); | ||||
/* | /* | ||||
* When we enter recovery we need to assure we send | * When we enter recovery we need to assure we send | ||||
* one packet. | * one packet. | ||||
*/ | */ | ||||
rack->r_ctl.rc_prr_sndcnt = tp->t_maxseg; | rack->r_ctl.rc_prr_sndcnt = tp->t_maxseg; | ||||
} | } | ||||
#ifdef INVARIANTS | #ifdef INVARIANTS | ||||
if (SEQ_LT(rsm->r_start, tp->snd_una)) { | if (SEQ_LT(rsm->r_start, tp->snd_una)) { | ||||
panic("Huh, tp:%p rack:%p rsm:%p start:%u < snd_una:%u\n", | panic("Huh, tp:%p rack:%p rsm:%p start:%u < snd_una:%u\n", | ||||
tp, rack, rsm, rsm->r_start, tp->snd_una); | tp, rack, rsm, rsm->r_start, tp->snd_una); | ||||
} | } | ||||
#endif | #endif | ||||
tlen = rsm->r_end - rsm->r_start; | tlen = rsm->r_end - rsm->r_start; | ||||
KASSERT(SEQ_LEQ(tp->snd_una, rsm->r_start), | |||||
("%s:%d: r.start:%u < SND.UNA:%u; tp:%p, rack:%p, rsm:%p", | |||||
__func__, __LINE__, | |||||
rsm->r_start, tp->snd_una, tp, rack, rsm)); | |||||
sb_offset = rsm->r_start - tp->snd_una; | sb_offset = rsm->r_start - tp->snd_una; | ||||
if (tlen > rack->r_ctl.rc_prr_sndcnt) { | if (tlen > rack->r_ctl.rc_prr_sndcnt) { | ||||
len = rack->r_ctl.rc_prr_sndcnt; | len = rack->r_ctl.rc_prr_sndcnt; | ||||
} else { | } else { | ||||
len = tlen; | len = tlen; | ||||
} | } | ||||
if (len >= tp->t_maxseg) { | if (len >= tp->t_maxseg) { | ||||
sendalot = 1; | sendalot = 1; | ||||
len = tp->t_maxseg; | len = tp->t_maxseg; | ||||
} else { | } else { | ||||
sendalot = 0; | sendalot = 0; | ||||
if ((rack->rc_timer_up == 0) && | if ((rack->rc_timer_up == 0) && | ||||
(len < tlen)) { | (len < tlen)) { | ||||
/* | /* | ||||
* If its not a timer don't send a partial | * If its not a timer don't send a partial | ||||
* segment. | * segment. | ||||
*/ | */ | ||||
len = 0; | len = 0; | ||||
goto just_return_nolock; | goto just_return_nolock; | ||||
} | } | ||||
} | } | ||||
KASSERT(sb_offset >= 0, ("%s: sack block to the left of una : %d", | |||||
__func__, sb_offset)); | |||||
if (len > 0) { | if (len > 0) { | ||||
sub_from_prr = 1; | sub_from_prr = 1; | ||||
sack_rxmit = 1; | sack_rxmit = 1; | ||||
TCPSTAT_INC(tcps_sack_rexmits); | TCPSTAT_INC(tcps_sack_rexmits); | ||||
TCPSTAT_ADD(tcps_sack_rexmit_bytes, | TCPSTAT_ADD(tcps_sack_rexmit_bytes, | ||||
min(len, tp->t_maxseg)); | min(len, tp->t_maxseg)); | ||||
counter_u64_add(rack_rtm_prr_retran, 1); | counter_u64_add(rack_rtm_prr_retran, 1); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 2,008 Lines • Show Last 20 Lines |