MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rack_update_rtt

Function rack_update_rtt

freebsd/netinet/tcp_stacks/rack.c:6636–6798  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6634}
6635
6636static int
6637rack_update_rtt(struct tcpcb *tp, struct tcp_rack *rack,
6638 struct rack_sendmap *rsm, struct tcpopt *to, uint32_t cts, int32_t ack_type, tcp_seq th_ack)
6639{
6640 int32_t i;
6641 uint32_t t, len_acked;
6642
6643 if ((rsm->r_flags & RACK_ACKED) ||
6644 (rsm->r_flags & RACK_WAS_ACKED))
6645 /* Already done */
6646 return (0);
6647
6648 if (ack_type == CUM_ACKED) {
6649 if (SEQ_GT(th_ack, rsm->r_end))
6650 len_acked = rsm->r_end - rsm->r_start;
6651 else
6652 len_acked = th_ack - rsm->r_start;
6653 } else
6654 len_acked = rsm->r_end - rsm->r_start;
6655 if (rsm->r_rtr_cnt == 1) {
6656 uint32_t us_rtt;
6657
6658 t = cts - rsm->r_tim_lastsent[(rsm->r_rtr_cnt - 1)];
6659 if ((int)t <= 0)
6660 t = 1;
6661 if (!tp->t_rttlow || tp->t_rttlow > t)
6662 tp->t_rttlow = t;
6663 if (!rack->r_ctl.rc_rack_min_rtt ||
6664 SEQ_LT(t, rack->r_ctl.rc_rack_min_rtt)) {
6665 rack->r_ctl.rc_rack_min_rtt = t;
6666 if (rack->r_ctl.rc_rack_min_rtt == 0) {
6667 rack->r_ctl.rc_rack_min_rtt = 1;
6668 }
6669 }
6670 us_rtt = tcp_tv_to_usectick(&rack->r_ctl.act_rcv_time) - rsm->usec_orig_send;
6671 if (us_rtt == 0)
6672 us_rtt = 1;
6673 rack_apply_updated_usrtt(rack, us_rtt, tcp_tv_to_usectick(&rack->r_ctl.act_rcv_time));
6674 if (ack_type == SACKED)
6675 tcp_rack_xmit_timer(rack, t + 1, len_acked, us_rtt, 2 , rsm, rsm->r_rtr_cnt);
6676 else {
6677 /*
6678 * For cum-ack we are only confident if what
6679 * is being acked is included in a measurement.
6680 * Otherwise it could be an idle period that
6681 * includes Delayed-ack time.
6682 */
6683 tcp_rack_xmit_timer(rack, t + 1, len_acked, us_rtt,
6684 (rack->app_limited_needs_set ? 0 : 1), rsm, rsm->r_rtr_cnt);
6685 }
6686 if ((rsm->r_flags & RACK_TLP) &&
6687 (!IN_RECOVERY(tp->t_flags))) {
6688 /* Segment was a TLP and our retrans matched */
6689 if (rack->r_ctl.rc_tlp_cwnd_reduce) {
6690 rack->r_ctl.rc_rsm_start = tp->snd_max;
6691 rack->r_ctl.rc_cwnd_at = tp->snd_cwnd;
6692 rack->r_ctl.rc_ssthresh_at = tp->snd_ssthresh;
6693 rack_cong_signal(tp, NULL, CC_NDUPACK);

Callers 2

rack_proc_sack_blkFunction · 0.85
rack_log_ackFunction · 0.85

Calls 7

tcp_tv_to_usectickFunction · 0.85
rack_apply_updated_usrttFunction · 0.85
tcp_rack_xmit_timerFunction · 0.85
rack_cong_signalFunction · 0.85
ctf_fixed_maxsegFunction · 0.85
rack_log_to_prrFunction · 0.85
rack_earlier_retranFunction · 0.85

Tested by

no test coverage detected