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

Function bbr_calc_thresh_rack

freebsd/netinet/tcp_stacks/bbr.c:4087–4162  ·  view source on GitHub ↗

* Returns to the caller the number of microseconds that * the packet can be outstanding before we think we * should have had an ack returned. */

Source from the content-addressed store, hash-verified

4085 * should have had an ack returned.
4086 */
4087static uint32_t
4088bbr_calc_thresh_rack(struct tcp_bbr *bbr, uint32_t srtt, uint32_t cts, struct bbr_sendmap *rsm)
4089{
4090 /*
4091 * lro is the flag we use to determine if we have seen reordering.
4092 * If it gets set we have seen reordering. The reorder logic either
4093 * works in one of two ways:
4094 *
4095 * If reorder-fade is configured, then we track the last time we saw
4096 * re-ordering occur. If we reach the point where enough time as
4097 * passed we no longer consider reordering has occuring.
4098 *
4099 * Or if reorder-face is 0, then once we see reordering we consider
4100 * the connection to alway be subject to reordering and just set lro
4101 * to 1.
4102 *
4103 * In the end if lro is non-zero we add the extra time for
4104 * reordering in.
4105 */
4106 int32_t lro;
4107 uint32_t thresh, t_rxtcur;
4108
4109 if (srtt == 0)
4110 srtt = 1;
4111 if (bbr->r_ctl.rc_reorder_ts) {
4112 if (bbr->r_ctl.rc_reorder_fade) {
4113 if (SEQ_GEQ(cts, bbr->r_ctl.rc_reorder_ts)) {
4114 lro = cts - bbr->r_ctl.rc_reorder_ts;
4115 if (lro == 0) {
4116 /*
4117 * No time as passed since the last
4118 * reorder, mark it as reordering.
4119 */
4120 lro = 1;
4121 }
4122 } else {
4123 /* Negative time? */
4124 lro = 0;
4125 }
4126 if (lro > bbr->r_ctl.rc_reorder_fade) {
4127 /* Turn off reordering seen too */
4128 bbr->r_ctl.rc_reorder_ts = 0;
4129 lro = 0;
4130 }
4131 } else {
4132 /* Reodering does not fade */
4133 lro = 1;
4134 }
4135 } else {
4136 lro = 0;
4137 }
4138 thresh = srtt + bbr->r_ctl.rc_pkt_delay;
4139 if (lro) {
4140 /* It must be set, if not you get 1/4 rtt */
4141 if (bbr->r_ctl.rc_reorder_shift)
4142 thresh += (srtt >> bbr->r_ctl.rc_reorder_shift);
4143 else
4144 thresh += (srtt >> 2);

Callers 2

bbr_timer_startFunction · 0.85
bbr_is_lostFunction · 0.85

Calls 1

bbr_log_thresh_choiceFunction · 0.85

Tested by

no test coverage detected