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

Function cubic_ack_received

freebsd/netinet/cc/cc_cubic.c:132–229  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

130};
131
132static void
133cubic_ack_received(struct cc_var *ccv, uint16_t type)
134{
135 struct cubic *cubic_data;
136 unsigned long w_tf, w_cubic_next;
137 int ticks_since_cong;
138
139 cubic_data = ccv->cc_data;
140 cubic_record_rtt(ccv);
141
142 /*
143 * For a regular ACK and we're not in cong/fast recovery and
144 * we're cwnd limited, always recalculate cwnd.
145 */
146 if (type == CC_ACK && !IN_RECOVERY(CCV(ccv, t_flags)) &&
147 (ccv->flags & CCF_CWND_LIMITED)) {
148 /* Use the logic in NewReno ack_received() for slow start. */
149 if (CCV(ccv, snd_cwnd) <= CCV(ccv, snd_ssthresh) ||
150 cubic_data->min_rtt_ticks == TCPTV_SRTTBASE) {
151 cubic_data->flags |= CUBICFLAG_IN_SLOWSTART;
152 newreno_cc_algo.ack_received(ccv, type);
153 } else {
154 if ((cubic_data->flags & CUBICFLAG_RTO_EVENT) &&
155 (cubic_data->flags & CUBICFLAG_IN_SLOWSTART)) {
156 /* RFC8312 Section 4.7 */
157 cubic_data->flags &= ~(CUBICFLAG_RTO_EVENT |
158 CUBICFLAG_IN_SLOWSTART);
159 cubic_data->max_cwnd = CCV(ccv, snd_cwnd);
160 cubic_data->K = 0;
161 } else if (cubic_data->flags & (CUBICFLAG_IN_SLOWSTART |
162 CUBICFLAG_IN_APPLIMIT)) {
163 cubic_data->flags &= ~(CUBICFLAG_IN_SLOWSTART |
164 CUBICFLAG_IN_APPLIMIT);
165 cubic_data->t_last_cong = ticks;
166 cubic_data->K = cubic_k(cubic_data->max_cwnd /
167 CCV(ccv, t_maxseg));
168 }
169 if ((ticks_since_cong =
170 ticks - cubic_data->t_last_cong) < 0) {
171 /*
172 * dragging t_last_cong along
173 */
174 ticks_since_cong = INT_MAX;
175 cubic_data->t_last_cong = ticks - INT_MAX;
176 }
177 /*
178 * The mean RTT is used to best reflect the equations in
179 * the I-D. Using min_rtt in the tf_cwnd calculation
180 * causes w_tf to grow much faster than it should if the
181 * RTT is dominated by network buffering rather than
182 * propagation delay.
183 */
184 w_tf = tf_cwnd(ticks_since_cong,
185 cubic_data->mean_rtt_ticks, cubic_data->max_cwnd,
186 CCV(ccv, t_maxseg));
187
188 w_cubic_next = cubic_cwnd(ticks_since_cong +
189 cubic_data->mean_rtt_ticks, cubic_data->max_cwnd,

Callers

nothing calls this directly

Calls 5

cubic_record_rttFunction · 0.85
cubic_kFunction · 0.85
tf_cwndFunction · 0.85
cubic_cwndFunction · 0.85
ulminFunction · 0.85

Tested by

no test coverage detected