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

Function dctcp_cong_signal

freebsd/netinet/cc/cc_dctcp.c:229–296  ·  view source on GitHub ↗

* Perform any necessary tasks before we enter congestion recovery. */

Source from the content-addressed store, hash-verified

227 * Perform any necessary tasks before we enter congestion recovery.
228 */
229static void
230dctcp_cong_signal(struct cc_var *ccv, uint32_t type)
231{
232 struct dctcp *dctcp_data;
233 u_int cwin, mss;
234
235 if (CCV(ccv, t_flags2) & TF2_ECN_PERMIT) {
236 dctcp_data = ccv->cc_data;
237 cwin = CCV(ccv, snd_cwnd);
238 mss = tcp_maxseg(ccv->ccvc.tcp);
239
240 switch (type) {
241 case CC_NDUPACK:
242 if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) {
243 if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) {
244 CCV(ccv, snd_ssthresh) =
245 max(cwin / 2, 2 * mss);
246 dctcp_data->num_cong_events++;
247 } else {
248 /* cwnd has already updated as congestion
249 * recovery. Reverse cwnd value using
250 * snd_cwnd_prev and recalculate snd_ssthresh
251 */
252 cwin = CCV(ccv, snd_cwnd_prev);
253 CCV(ccv, snd_ssthresh) =
254 max(cwin / 2, 2 * mss);
255 }
256 ENTER_RECOVERY(CCV(ccv, t_flags));
257 }
258 break;
259 case CC_ECN:
260 /*
261 * Save current snd_cwnd when the host encounters both
262 * congestion recovery and fast recovery.
263 */
264 CCV(ccv, snd_cwnd_prev) = cwin;
265 if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) {
266 if (V_dctcp_slowstart &&
267 dctcp_data->num_cong_events++ == 0) {
268 CCV(ccv, snd_ssthresh) =
269 max(cwin / 2, 2 * mss);
270 dctcp_data->alpha = MAX_ALPHA_VALUE;
271 dctcp_data->bytes_ecn = 0;
272 dctcp_data->bytes_total = 0;
273 dctcp_data->save_sndnxt = CCV(ccv, snd_nxt);
274 } else
275 CCV(ccv, snd_ssthresh) =
276 max((cwin - (((uint64_t)cwin *
277 dctcp_data->alpha) >> (DCTCP_SHIFT+1))),
278 2 * mss);
279 CCV(ccv, snd_cwnd) = CCV(ccv, snd_ssthresh);
280 ENTER_CONGRECOVERY(CCV(ccv, t_flags));
281 }
282 dctcp_data->ece_curr = 1;
283 break;
284 case CC_RTO:
285 CCV(ccv, snd_ssthresh) = max(min(CCV(ccv, snd_wnd),
286 CCV(ccv, snd_cwnd)) / 2 / mss,

Callers

nothing calls this directly

Calls 4

tcp_maxsegFunction · 0.85
maxFunction · 0.85
minFunction · 0.85
dctcp_update_alphaFunction · 0.85

Tested by

no test coverage detected