cc_newreno.c (b8d60729deefa0bd13e6a395fcab4928e6e10445) | cc_newreno.c (a9696510f5caef4a7c525fcf4359597798829350) |
---|---|
1/*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1994, 1995 5 * The Regents of the University of California. 6 * Copyright (c) 2007-2008,2010,2014 7 * Swinburne University of Technology, Melbourne, Australia. 8 * Copyright (c) 2009-2010 Lawrence Stewart <lstewart@freebsd.org> --- 102 unchanged lines hidden (view full) --- 111 .post_recovery = newreno_cc_post_recovery, 112 .ctl_output = newreno_ctl_output, 113 .newround = newreno_newround, 114 .rttsample = newreno_rttsample, 115 .cb_init = newreno_cb_init, 116 .cc_data_sz = newreno_data_sz, 117}; 118 | 1/*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (c) 1982, 1986, 1988, 1990, 1993, 1994, 1995 5 * The Regents of the University of California. 6 * Copyright (c) 2007-2008,2010,2014 7 * Swinburne University of Technology, Melbourne, Australia. 8 * Copyright (c) 2009-2010 Lawrence Stewart <lstewart@freebsd.org> --- 102 unchanged lines hidden (view full) --- 111 .post_recovery = newreno_cc_post_recovery, 112 .ctl_output = newreno_ctl_output, 113 .newround = newreno_newround, 114 .rttsample = newreno_rttsample, 115 .cb_init = newreno_cb_init, 116 .cc_data_sz = newreno_data_sz, 117}; 118 |
119static uint32_t hystart_lowcwnd = 16; 120static uint32_t hystart_minrtt_thresh = 4000; 121static uint32_t hystart_maxrtt_thresh = 16000; 122static uint32_t hystart_n_rttsamples = 8; 123static uint32_t hystart_css_growth_div = 4; 124static uint32_t hystart_css_rounds = 5; 125static uint32_t hystart_bblogs = 0; 126 | |
127static void 128newreno_log_hystart_event(struct cc_var *ccv, struct newreno *nreno, uint8_t mod, uint32_t flex1) 129{ 130 /* 131 * Types of logs (mod value) 132 * 1 - rtt_thresh in flex1, checking to see if RTT is to great. 133 * 2 - rtt is too great, rtt_thresh in flex1. 134 * 3 - CSS is active incr in flex1 135 * 4 - A new round is beginning flex1 is round count 136 * 5 - A new RTT measurement flex1 is the new measurement. 137 * 6 - We enter CA ssthresh is also in flex1. 138 * 7 - Socket option to change hystart executed opt.val in flex1. 139 * 8 - Back out of CSS into SS, flex1 is the css_baseline_minrtt | 119static void 120newreno_log_hystart_event(struct cc_var *ccv, struct newreno *nreno, uint8_t mod, uint32_t flex1) 121{ 122 /* 123 * Types of logs (mod value) 124 * 1 - rtt_thresh in flex1, checking to see if RTT is to great. 125 * 2 - rtt is too great, rtt_thresh in flex1. 126 * 3 - CSS is active incr in flex1 127 * 4 - A new round is beginning flex1 is round count 128 * 5 - A new RTT measurement flex1 is the new measurement. 129 * 6 - We enter CA ssthresh is also in flex1. 130 * 7 - Socket option to change hystart executed opt.val in flex1. 131 * 8 - Back out of CSS into SS, flex1 is the css_baseline_minrtt |
132 * 9 - We enter CA, via an ECN mark. 133 * 10 - We enter CA, via a loss. 134 * 11 - We have slipped out of SS into CA via cwnd growth. 135 * 12 - After idle has re-enabled hystart++ |
|
140 */ 141 struct tcpcb *tp; 142 143 if (hystart_bblogs == 0) 144 return; 145 tp = ccv->ccvc.tcp; 146 if (tp->t_logstate != TCP_LOG_STATE_OFF) { 147 union tcp_log_stackspecific log; --- 9 unchanged lines hidden (view full) --- 157 /* We only need bottom 16 bits of flags */ 158 log.u_bbr.flex7 = nreno->newreno_flags & 0x0000ffff; 159 log.u_bbr.flex8 = mod; 160 log.u_bbr.epoch = nreno->css_current_round; 161 log.u_bbr.timeStamp = tcp_get_usecs(&tv); 162 log.u_bbr.lt_epoch = nreno->css_fas_at_css_entry; 163 log.u_bbr.pkts_out = nreno->css_last_fas; 164 log.u_bbr.delivered = nreno->css_lowrtt_fas; | 136 */ 137 struct tcpcb *tp; 138 139 if (hystart_bblogs == 0) 140 return; 141 tp = ccv->ccvc.tcp; 142 if (tp->t_logstate != TCP_LOG_STATE_OFF) { 143 union tcp_log_stackspecific log; --- 9 unchanged lines hidden (view full) --- 153 /* We only need bottom 16 bits of flags */ 154 log.u_bbr.flex7 = nreno->newreno_flags & 0x0000ffff; 155 log.u_bbr.flex8 = mod; 156 log.u_bbr.epoch = nreno->css_current_round; 157 log.u_bbr.timeStamp = tcp_get_usecs(&tv); 158 log.u_bbr.lt_epoch = nreno->css_fas_at_css_entry; 159 log.u_bbr.pkts_out = nreno->css_last_fas; 160 log.u_bbr.delivered = nreno->css_lowrtt_fas; |
161 log.u_bbr.pkt_epoch = ccv->flags; |
|
165 TCP_LOG_EVENTP(tp, NULL, 166 &tp->t_inpcb->inp_socket->so_rcv, 167 &tp->t_inpcb->inp_socket->so_snd, 168 TCP_HYSTART, 0, 169 0, &log, false, &tv); 170 } 171} 172 --- 87 unchanged lines hidden (view full) --- 260 /* 261 * We have slipped into CA with 262 * CSS active. Deactivate all. 263 */ 264 /* Turn off the CSS flag */ 265 nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_IN_CSS; 266 /* Disable use of CSS in the future except long idle */ 267 nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_ENABLED; | 162 TCP_LOG_EVENTP(tp, NULL, 163 &tp->t_inpcb->inp_socket->so_rcv, 164 &tp->t_inpcb->inp_socket->so_snd, 165 TCP_HYSTART, 0, 166 0, &log, false, &tv); 167 } 168} 169 --- 87 unchanged lines hidden (view full) --- 257 /* 258 * We have slipped into CA with 259 * CSS active. Deactivate all. 260 */ 261 /* Turn off the CSS flag */ 262 nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_IN_CSS; 263 /* Disable use of CSS in the future except long idle */ 264 nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_ENABLED; |
265 newreno_log_hystart_event(ccv, nreno, 11, CCV(ccv, snd_ssthresh)); |
|
268 } 269 if (V_tcp_do_rfc3465) { 270 if (ccv->flags & CCF_ABC_SENTAWND) 271 ccv->flags &= ~CCF_ABC_SENTAWND; 272 else 273 incr = 0; 274 } else 275 incr = max((incr * incr / cw), 1); --- 9 unchanged lines hidden (view full) --- 285 * doesn't rely on tcpcb vars. 286 */ 287 uint16_t abc_val; 288 289 if (ccv->flags & CCF_USE_LOCAL_ABC) 290 abc_val = ccv->labc; 291 else 292 abc_val = V_tcp_abc_l_var; | 266 } 267 if (V_tcp_do_rfc3465) { 268 if (ccv->flags & CCF_ABC_SENTAWND) 269 ccv->flags &= ~CCF_ABC_SENTAWND; 270 else 271 incr = 0; 272 } else 273 incr = max((incr * incr / cw), 1); --- 9 unchanged lines hidden (view full) --- 283 * doesn't rely on tcpcb vars. 284 */ 285 uint16_t abc_val; 286 287 if (ccv->flags & CCF_USE_LOCAL_ABC) 288 abc_val = ccv->labc; 289 else 290 abc_val = V_tcp_abc_l_var; |
293 if ((nreno->newreno_flags & CC_NEWRENO_HYSTART_ALLOWED) && | 291 if ((ccv->flags & CCF_HYSTART_ALLOWED) && |
294 (nreno->newreno_flags & CC_NEWRENO_HYSTART_ENABLED) && 295 ((nreno->newreno_flags & CC_NEWRENO_HYSTART_IN_CSS) == 0)) { 296 /* 297 * Hystart is allowed and still enabled and we are not yet 298 * in CSS. Lets check to see if we can make a decision on 299 * if we need to go into CSS. 300 */ 301 if ((nreno->css_rttsample_count >= hystart_n_rttsamples) && | 292 (nreno->newreno_flags & CC_NEWRENO_HYSTART_ENABLED) && 293 ((nreno->newreno_flags & CC_NEWRENO_HYSTART_IN_CSS) == 0)) { 294 /* 295 * Hystart is allowed and still enabled and we are not yet 296 * in CSS. Lets check to see if we can make a decision on 297 * if we need to go into CSS. 298 */ 299 if ((nreno->css_rttsample_count >= hystart_n_rttsamples) && |
302 (CCV(ccv, snd_cwnd) > 303 (hystart_lowcwnd * tcp_fixed_maxseg(ccv->ccvc.tcp)))) { | 300 (nreno->css_current_round_minrtt != 0xffffffff) && 301 (nreno->css_lastround_minrtt != 0xffffffff)) { |
304 uint32_t rtt_thresh; 305 306 /* Clamp (minrtt_thresh, lastround/8, maxrtt_thresh) */ 307 rtt_thresh = (nreno->css_lastround_minrtt >> 3); 308 if (rtt_thresh < hystart_minrtt_thresh) 309 rtt_thresh = hystart_minrtt_thresh; 310 if (rtt_thresh > hystart_maxrtt_thresh) 311 rtt_thresh = hystart_maxrtt_thresh; 312 newreno_log_hystart_event(ccv, nreno, 1, rtt_thresh); 313 if (nreno->css_current_round_minrtt >= (nreno->css_lastround_minrtt + rtt_thresh)) { 314 /* Enter CSS */ 315 nreno->newreno_flags |= CC_NEWRENO_HYSTART_IN_CSS; 316 nreno->css_fas_at_css_entry = nreno->css_lowrtt_fas; | 302 uint32_t rtt_thresh; 303 304 /* Clamp (minrtt_thresh, lastround/8, maxrtt_thresh) */ 305 rtt_thresh = (nreno->css_lastround_minrtt >> 3); 306 if (rtt_thresh < hystart_minrtt_thresh) 307 rtt_thresh = hystart_minrtt_thresh; 308 if (rtt_thresh > hystart_maxrtt_thresh) 309 rtt_thresh = hystart_maxrtt_thresh; 310 newreno_log_hystart_event(ccv, nreno, 1, rtt_thresh); 311 if (nreno->css_current_round_minrtt >= (nreno->css_lastround_minrtt + rtt_thresh)) { 312 /* Enter CSS */ 313 nreno->newreno_flags |= CC_NEWRENO_HYSTART_IN_CSS; 314 nreno->css_fas_at_css_entry = nreno->css_lowrtt_fas; |
315 /* 316 * The draft (v4) calls for us to set baseline to css_current_round_min 317 * but that can cause an oscillation. We probably shoudl be using 318 * css_lastround_minrtt, but the authors insist that will cause 319 * issues on exiting early. We will leave the draft version for now 320 * but I suspect this is incorrect. 321 */ |
|
317 nreno->css_baseline_minrtt = nreno->css_current_round_minrtt; 318 nreno->css_entered_at_round = nreno->css_current_round; 319 newreno_log_hystart_event(ccv, nreno, 2, rtt_thresh); 320 } 321 } 322 } 323 if (CCV(ccv, snd_nxt) == CCV(ccv, snd_max)) 324 incr = min(ccv->bytes_this_ack, --- 18 unchanged lines hidden (view full) --- 343static void 344newreno_after_idle(struct cc_var *ccv) 345{ 346 struct newreno *nreno; 347 348 nreno = ccv->cc_data; 349 newreno_cc_after_idle(ccv); 350 if ((nreno->newreno_flags & CC_NEWRENO_HYSTART_ENABLED) == 0) { | 322 nreno->css_baseline_minrtt = nreno->css_current_round_minrtt; 323 nreno->css_entered_at_round = nreno->css_current_round; 324 newreno_log_hystart_event(ccv, nreno, 2, rtt_thresh); 325 } 326 } 327 } 328 if (CCV(ccv, snd_nxt) == CCV(ccv, snd_max)) 329 incr = min(ccv->bytes_this_ack, --- 18 unchanged lines hidden (view full) --- 348static void 349newreno_after_idle(struct cc_var *ccv) 350{ 351 struct newreno *nreno; 352 353 nreno = ccv->cc_data; 354 newreno_cc_after_idle(ccv); 355 if ((nreno->newreno_flags & CC_NEWRENO_HYSTART_ENABLED) == 0) { |
351 if (CCV(ccv, snd_cwnd) <= (hystart_lowcwnd * tcp_fixed_maxseg(ccv->ccvc.tcp))) { 352 /* 353 * Re-enable hystart if our cwnd has fallen below 354 * the hystart lowcwnd point. 355 */ 356 nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_IN_CSS; 357 nreno->newreno_flags |= CC_NEWRENO_HYSTART_ENABLED; 358 } | 356 /* 357 * Re-enable hystart if we have been idle. 358 */ 359 nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_IN_CSS; 360 nreno->newreno_flags |= CC_NEWRENO_HYSTART_ENABLED; 361 newreno_log_hystart_event(ccv, nreno, 12, CCV(ccv, snd_ssthresh)); |
359 } 360} 361 362/* 363 * Perform any necessary tasks before we enter congestion recovery. 364 */ 365static void 366newreno_cong_signal(struct cc_var *ccv, uint32_t type) --- 28 unchanged lines hidden (view full) --- 395 2) * mss; 396 397 switch (type) { 398 case CC_NDUPACK: 399 if (nreno->newreno_flags & CC_NEWRENO_HYSTART_ENABLED) { 400 /* Make sure the flags are all off we had a loss */ 401 nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_ENABLED; 402 nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_IN_CSS; | 362 } 363} 364 365/* 366 * Perform any necessary tasks before we enter congestion recovery. 367 */ 368static void 369newreno_cong_signal(struct cc_var *ccv, uint32_t type) --- 28 unchanged lines hidden (view full) --- 398 2) * mss; 399 400 switch (type) { 401 case CC_NDUPACK: 402 if (nreno->newreno_flags & CC_NEWRENO_HYSTART_ENABLED) { 403 /* Make sure the flags are all off we had a loss */ 404 nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_ENABLED; 405 nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_IN_CSS; |
406 newreno_log_hystart_event(ccv, nreno, 10, CCV(ccv, snd_ssthresh)); |
|
403 } 404 if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) { 405 if (IN_CONGRECOVERY(CCV(ccv, t_flags) && 406 V_cc_do_abe && V_cc_abe_frlossreduce)) { 407 CCV(ccv, snd_ssthresh) = 408 ((uint64_t)CCV(ccv, snd_ssthresh) * 409 (uint64_t)beta) / (uint64_t)beta_ecn; 410 } 411 if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) 412 CCV(ccv, snd_ssthresh) = cwin; 413 ENTER_RECOVERY(CCV(ccv, t_flags)); 414 } 415 break; 416 case CC_ECN: 417 if (nreno->newreno_flags & CC_NEWRENO_HYSTART_ENABLED) { 418 /* Make sure the flags are all off we had a loss */ 419 nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_ENABLED; 420 nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_IN_CSS; | 407 } 408 if (!IN_FASTRECOVERY(CCV(ccv, t_flags))) { 409 if (IN_CONGRECOVERY(CCV(ccv, t_flags) && 410 V_cc_do_abe && V_cc_abe_frlossreduce)) { 411 CCV(ccv, snd_ssthresh) = 412 ((uint64_t)CCV(ccv, snd_ssthresh) * 413 (uint64_t)beta) / (uint64_t)beta_ecn; 414 } 415 if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) 416 CCV(ccv, snd_ssthresh) = cwin; 417 ENTER_RECOVERY(CCV(ccv, t_flags)); 418 } 419 break; 420 case CC_ECN: 421 if (nreno->newreno_flags & CC_NEWRENO_HYSTART_ENABLED) { 422 /* Make sure the flags are all off we had a loss */ 423 nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_ENABLED; 424 nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_IN_CSS; |
425 newreno_log_hystart_event(ccv, nreno, 9, CCV(ccv, snd_ssthresh)); |
|
421 } 422 if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { 423 CCV(ccv, snd_ssthresh) = cwin; 424 CCV(ccv, snd_cwnd) = cwin; 425 ENTER_CONGRECOVERY(CCV(ccv, t_flags)); 426 } 427 break; 428 case CC_RTO: --- 26 unchanged lines hidden (view full) --- 455 nreno->beta = opt->val; 456 break; 457 case CC_NEWRENO_BETA_ECN: 458 if ((!V_cc_do_abe) && ((nreno->newreno_flags & CC_NEWRENO_BETA_ECN) == 0)) 459 return (EACCES); 460 nreno->beta_ecn = opt->val; 461 nreno->newreno_flags |= CC_NEWRENO_BETA_ECN_ENABLED; 462 break; | 426 } 427 if (!IN_CONGRECOVERY(CCV(ccv, t_flags))) { 428 CCV(ccv, snd_ssthresh) = cwin; 429 CCV(ccv, snd_cwnd) = cwin; 430 ENTER_CONGRECOVERY(CCV(ccv, t_flags)); 431 } 432 break; 433 case CC_RTO: --- 26 unchanged lines hidden (view full) --- 460 nreno->beta = opt->val; 461 break; 462 case CC_NEWRENO_BETA_ECN: 463 if ((!V_cc_do_abe) && ((nreno->newreno_flags & CC_NEWRENO_BETA_ECN) == 0)) 464 return (EACCES); 465 nreno->beta_ecn = opt->val; 466 nreno->newreno_flags |= CC_NEWRENO_BETA_ECN_ENABLED; 467 break; |
463 case CC_NEWRENO_ENABLE_HYSTART: 464 /* Allow hystart on this connection */ 465 if (opt->val != 0) { 466 nreno->newreno_flags |= CC_NEWRENO_HYSTART_ALLOWED; 467 if (opt->val > 1) 468 nreno->newreno_flags |= CC_NEWRENO_HYSTART_CAN_SH_CWND; 469 if (opt->val > 2) 470 nreno->newreno_flags |= CC_NEWRENO_HYSTART_CONS_SSTH; 471 } else 472 nreno->newreno_flags &= ~(CC_NEWRENO_HYSTART_ALLOWED|CC_NEWRENO_HYSTART_CAN_SH_CWND|CC_NEWRENO_HYSTART_CONS_SSTH); 473 newreno_log_hystart_event(ccv, nreno, 7, opt->val); 474 break; | |
475 default: 476 return (ENOPROTOOPT); 477 } 478 break; 479 case SOPT_GET: 480 switch (opt->name) { 481 case CC_NEWRENO_BETA: 482 opt->val = (nreno == NULL) ? 483 V_newreno_beta : nreno->beta; 484 break; 485 case CC_NEWRENO_BETA_ECN: 486 opt->val = (nreno == NULL) ? 487 V_newreno_beta_ecn : nreno->beta_ecn; 488 break; | 468 default: 469 return (ENOPROTOOPT); 470 } 471 break; 472 case SOPT_GET: 473 switch (opt->name) { 474 case CC_NEWRENO_BETA: 475 opt->val = (nreno == NULL) ? 476 V_newreno_beta : nreno->beta; 477 break; 478 case CC_NEWRENO_BETA_ECN: 479 opt->val = (nreno == NULL) ? 480 V_newreno_beta_ecn : nreno->beta_ecn; 481 break; |
489 case CC_NEWRENO_ENABLE_HYSTART: 490 if (nreno->newreno_flags & CC_NEWRENO_HYSTART_ALLOWED) { 491 if (nreno->newreno_flags & CC_NEWRENO_HYSTART_CONS_SSTH) 492 opt->val = 3; 493 else if (nreno->newreno_flags & CC_NEWRENO_HYSTART_CAN_SH_CWND) 494 opt->val = 2; 495 else 496 opt->val = 1; 497 } else 498 opt->val = 0; 499 break; | |
500 default: 501 return (ENOPROTOOPT); 502 } 503 break; 504 default: 505 return (EINVAL); 506 } 507 --- 29 unchanged lines hidden (view full) --- 537 /* We have entered a new round */ 538 nreno->css_lastround_minrtt = nreno->css_current_round_minrtt; 539 nreno->css_current_round_minrtt = 0xffffffff; 540 nreno->css_rttsample_count = 0; 541 nreno->css_current_round = round_cnt; 542 if ((nreno->newreno_flags & CC_NEWRENO_HYSTART_IN_CSS) && 543 ((round_cnt - nreno->css_entered_at_round) >= hystart_css_rounds)) { 544 /* Enter CA */ | 482 default: 483 return (ENOPROTOOPT); 484 } 485 break; 486 default: 487 return (EINVAL); 488 } 489 --- 29 unchanged lines hidden (view full) --- 519 /* We have entered a new round */ 520 nreno->css_lastround_minrtt = nreno->css_current_round_minrtt; 521 nreno->css_current_round_minrtt = 0xffffffff; 522 nreno->css_rttsample_count = 0; 523 nreno->css_current_round = round_cnt; 524 if ((nreno->newreno_flags & CC_NEWRENO_HYSTART_IN_CSS) && 525 ((round_cnt - nreno->css_entered_at_round) >= hystart_css_rounds)) { 526 /* Enter CA */ |
545 if (nreno->newreno_flags & CC_NEWRENO_HYSTART_CAN_SH_CWND) { | 527 if (ccv->flags & CCF_HYSTART_CAN_SH_CWND) { |
546 /* 547 * We engage more than snd_ssthresh, engage 548 * the brakes!! Though we will stay in SS to 549 * creep back up again, so lets leave CSS active 550 * and give us hystart_css_rounds more rounds. 551 */ | 528 /* 529 * We engage more than snd_ssthresh, engage 530 * the brakes!! Though we will stay in SS to 531 * creep back up again, so lets leave CSS active 532 * and give us hystart_css_rounds more rounds. 533 */ |
552 if (nreno->newreno_flags & CC_NEWRENO_HYSTART_CONS_SSTH) { | 534 if (ccv->flags & CCF_HYSTART_CONS_SSTH) { |
553 CCV(ccv, snd_ssthresh) = ((nreno->css_lowrtt_fas + nreno->css_fas_at_css_entry) / 2); 554 } else { 555 CCV(ccv, snd_ssthresh) = nreno->css_lowrtt_fas; 556 } 557 CCV(ccv, snd_cwnd) = nreno->css_fas_at_css_entry; 558 nreno->css_entered_at_round = round_cnt; 559 } else { 560 CCV(ccv, snd_ssthresh) = CCV(ccv, snd_cwnd); 561 /* Turn off the CSS flag */ 562 nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_IN_CSS; 563 /* Disable use of CSS in the future except long idle */ 564 nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_ENABLED; 565 } 566 newreno_log_hystart_event(ccv, nreno, 6, CCV(ccv, snd_ssthresh)); 567 } | 535 CCV(ccv, snd_ssthresh) = ((nreno->css_lowrtt_fas + nreno->css_fas_at_css_entry) / 2); 536 } else { 537 CCV(ccv, snd_ssthresh) = nreno->css_lowrtt_fas; 538 } 539 CCV(ccv, snd_cwnd) = nreno->css_fas_at_css_entry; 540 nreno->css_entered_at_round = round_cnt; 541 } else { 542 CCV(ccv, snd_ssthresh) = CCV(ccv, snd_cwnd); 543 /* Turn off the CSS flag */ 544 nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_IN_CSS; 545 /* Disable use of CSS in the future except long idle */ 546 nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_ENABLED; 547 } 548 newreno_log_hystart_event(ccv, nreno, 6, CCV(ccv, snd_ssthresh)); 549 } |
568 newreno_log_hystart_event(ccv, nreno, 4, round_cnt); | 550 if (nreno->newreno_flags & CC_NEWRENO_HYSTART_ENABLED) 551 newreno_log_hystart_event(ccv, nreno, 4, round_cnt); |
569} 570 571static void 572newreno_rttsample(struct cc_var *ccv, uint32_t usec_rtt, uint32_t rxtcnt, uint32_t fas) 573{ 574 struct newreno *nreno; 575 576 nreno = (struct newreno *)ccv->cc_data; --- 4 unchanged lines hidden (view full) --- 581 return; 582 } 583 nreno->css_rttsample_count++; 584 nreno->css_last_fas = fas; 585 if (nreno->css_current_round_minrtt > usec_rtt) { 586 nreno->css_current_round_minrtt = usec_rtt; 587 nreno->css_lowrtt_fas = nreno->css_last_fas; 588 } | 552} 553 554static void 555newreno_rttsample(struct cc_var *ccv, uint32_t usec_rtt, uint32_t rxtcnt, uint32_t fas) 556{ 557 struct newreno *nreno; 558 559 nreno = (struct newreno *)ccv->cc_data; --- 4 unchanged lines hidden (view full) --- 564 return; 565 } 566 nreno->css_rttsample_count++; 567 nreno->css_last_fas = fas; 568 if (nreno->css_current_round_minrtt > usec_rtt) { 569 nreno->css_current_round_minrtt = usec_rtt; 570 nreno->css_lowrtt_fas = nreno->css_last_fas; 571 } |
589 if ((nreno->newreno_flags & CC_NEWRENO_HYSTART_IN_CSS) && 590 (nreno->css_rttsample_count >= hystart_n_rttsamples) && 591 (nreno->css_baseline_minrtt > nreno->css_current_round_minrtt)) { | 572 if ((nreno->css_rttsample_count >= hystart_n_rttsamples) && 573 (nreno->css_current_round_minrtt != 0xffffffff) && 574 (nreno->css_lastround_minrtt != 0xffffffff)) { |
592 /* 593 * We were in CSS and the RTT is now less, we 594 * entered CSS erroneously. 595 */ 596 nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_IN_CSS; 597 newreno_log_hystart_event(ccv, nreno, 8, nreno->css_baseline_minrtt); 598 nreno->css_baseline_minrtt = 0xffffffff; 599 } | 575 /* 576 * We were in CSS and the RTT is now less, we 577 * entered CSS erroneously. 578 */ 579 nreno->newreno_flags &= ~CC_NEWRENO_HYSTART_IN_CSS; 580 newreno_log_hystart_event(ccv, nreno, 8, nreno->css_baseline_minrtt); 581 nreno->css_baseline_minrtt = 0xffffffff; 582 } |
600 newreno_log_hystart_event(ccv, nreno, 5, usec_rtt); | 583 if (nreno->newreno_flags & CC_NEWRENO_HYSTART_ENABLED) 584 newreno_log_hystart_event(ccv, nreno, 5, usec_rtt); |
601} 602 603SYSCTL_DECL(_net_inet_tcp_cc_newreno); 604SYSCTL_NODE(_net_inet_tcp_cc, OID_AUTO, newreno, 605 CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, 606 "New Reno related settings"); 607 608SYSCTL_PROC(_net_inet_tcp_cc_newreno, OID_AUTO, beta, 609 CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, 610 &VNET_NAME(newreno_beta), 3, &newreno_beta_handler, "IU", 611 "New Reno beta, specified as number between 1 and 100"); 612 613SYSCTL_PROC(_net_inet_tcp_cc_newreno, OID_AUTO, beta_ecn, 614 CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, 615 &VNET_NAME(newreno_beta_ecn), 3, &newreno_beta_handler, "IU", 616 "New Reno beta ecn, specified as number between 1 and 100"); 617 | 585} 586 587SYSCTL_DECL(_net_inet_tcp_cc_newreno); 588SYSCTL_NODE(_net_inet_tcp_cc, OID_AUTO, newreno, 589 CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, 590 "New Reno related settings"); 591 592SYSCTL_PROC(_net_inet_tcp_cc_newreno, OID_AUTO, beta, 593 CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, 594 &VNET_NAME(newreno_beta), 3, &newreno_beta_handler, "IU", 595 "New Reno beta, specified as number between 1 and 100"); 596 597SYSCTL_PROC(_net_inet_tcp_cc_newreno, OID_AUTO, beta_ecn, 598 CTLFLAG_VNET | CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_NEEDGIANT, 599 &VNET_NAME(newreno_beta_ecn), 3, &newreno_beta_handler, "IU", 600 "New Reno beta ecn, specified as number between 1 and 100"); 601 |
618SYSCTL_NODE(_net_inet_tcp_cc_newreno, OID_AUTO, hystartplusplus, 619 CTLFLAG_RW | CTLFLAG_MPSAFE, NULL, 620 "New Reno related HyStart++ settings"); 621 622SYSCTL_UINT(_net_inet_tcp_cc_newreno_hystartplusplus, OID_AUTO, lowcwnd, 623 CTLFLAG_RW, 624 &hystart_lowcwnd, 16, 625 "The number of MSS in the CWND before HyStart++ is active"); 626 627SYSCTL_UINT(_net_inet_tcp_cc_newreno_hystartplusplus, OID_AUTO, minrtt_thresh, 628 CTLFLAG_RW, 629 &hystart_minrtt_thresh, 4000, 630 "HyStarts++ minimum RTT thresh used in clamp (in microseconds)"); 631 632SYSCTL_UINT(_net_inet_tcp_cc_newreno_hystartplusplus, OID_AUTO, maxrtt_thresh, 633 CTLFLAG_RW, 634 &hystart_maxrtt_thresh, 16000, 635 "HyStarts++ maximum RTT thresh used in clamp (in microseconds)"); 636 637SYSCTL_UINT(_net_inet_tcp_cc_newreno_hystartplusplus, OID_AUTO, n_rttsamples, 638 CTLFLAG_RW, 639 &hystart_n_rttsamples, 8, 640 "The number of RTT samples that must be seen to consider HyStart++"); 641 642SYSCTL_UINT(_net_inet_tcp_cc_newreno_hystartplusplus, OID_AUTO, css_growth_div, 643 CTLFLAG_RW, 644 &hystart_css_growth_div, 4, 645 "The divisor to the growth when in Hystart++ CSS"); 646 647SYSCTL_UINT(_net_inet_tcp_cc_newreno_hystartplusplus, OID_AUTO, css_rounds, 648 CTLFLAG_RW, 649 &hystart_css_rounds, 5, 650 "The number of rounds HyStart++ lasts in CSS before falling to CA"); 651 652SYSCTL_UINT(_net_inet_tcp_cc_newreno_hystartplusplus, OID_AUTO, bblogs, 653 CTLFLAG_RW, 654 &hystart_bblogs, 0, 655 "Do we enable HyStart++ Black Box logs to be generated if BB logging is on"); 656 657 | |
658DECLARE_CC_MODULE(newreno, &newreno_cc_algo); 659MODULE_VERSION(newreno, 2); | 602DECLARE_CC_MODULE(newreno, &newreno_cc_algo); 603MODULE_VERSION(newreno, 2); |