* Update the ssthresh in the event of congestion. */
| 450 | * Update the ssthresh in the event of congestion. |
| 451 | */ |
| 452 | static void |
| 453 | cubic_ssthresh_update(struct cc_var *ccv, uint32_t maxseg) |
| 454 | { |
| 455 | struct cubic *cubic_data; |
| 456 | uint32_t ssthresh; |
| 457 | uint32_t cwnd; |
| 458 | |
| 459 | cubic_data = ccv->cc_data; |
| 460 | cwnd = CCV(ccv, snd_cwnd); |
| 461 | |
| 462 | /* Fast convergence heuristic. */ |
| 463 | if (cwnd < cubic_data->max_cwnd) { |
| 464 | cwnd = ((uint64_t)cwnd * CUBIC_FC_FACTOR) >> CUBIC_SHIFT; |
| 465 | } |
| 466 | cubic_data->prev_max_cwnd = cubic_data->max_cwnd; |
| 467 | cubic_data->max_cwnd = cwnd; |
| 468 | |
| 469 | /* |
| 470 | * On the first congestion event, set ssthresh to cwnd * 0.5 |
| 471 | * and reduce max_cwnd to cwnd * beta. This aligns the cubic concave |
| 472 | * region appropriately. On subsequent congestion events, set |
| 473 | * ssthresh to cwnd * beta. |
| 474 | */ |
| 475 | if ((cubic_data->flags & CUBICFLAG_CONG_EVENT) == 0) { |
| 476 | ssthresh = cwnd >> 1; |
| 477 | cubic_data->max_cwnd = ((uint64_t)cwnd * |
| 478 | CUBIC_BETA) >> CUBIC_SHIFT; |
| 479 | } else { |
| 480 | ssthresh = ((uint64_t)cwnd * |
| 481 | CUBIC_BETA) >> CUBIC_SHIFT; |
| 482 | } |
| 483 | CCV(ccv, snd_ssthresh) = max(ssthresh, 2 * maxseg); |
| 484 | } |
| 485 | |
| 486 | DECLARE_CC_MODULE(cubic, &cubic_cc_algo); |
| 487 | MODULE_VERSION(cubic, 1); |
no test coverage detected