* Update the fraction of marked bytes represented as 'alpha'. * Also initialize several internal parameters at the end of this function. */
| 363 | * Also initialize several internal parameters at the end of this function. |
| 364 | */ |
| 365 | static void |
| 366 | dctcp_update_alpha(struct cc_var *ccv) |
| 367 | { |
| 368 | struct dctcp *dctcp_data; |
| 369 | int alpha_prev; |
| 370 | |
| 371 | dctcp_data = ccv->cc_data; |
| 372 | alpha_prev = dctcp_data->alpha; |
| 373 | dctcp_data->bytes_total = max(dctcp_data->bytes_total, 1); |
| 374 | |
| 375 | /* |
| 376 | * Update alpha: alpha = (1 - g) * alpha + g * M. |
| 377 | * Here: |
| 378 | * g is weight factor |
| 379 | * recommaded to be set to 1/16 |
| 380 | * small g = slow convergence between competitive DCTCP flows |
| 381 | * large g = impacts low utilization of bandwidth at switches |
| 382 | * M is fraction of marked segments in last RTT |
| 383 | * updated every RTT |
| 384 | * Alpha must be round to 0 - MAX_ALPHA_VALUE. |
| 385 | */ |
| 386 | dctcp_data->alpha = ulmin(alpha_prev - (alpha_prev >> V_dctcp_shift_g) + |
| 387 | ((uint64_t)dctcp_data->bytes_ecn << (DCTCP_SHIFT - V_dctcp_shift_g)) / |
| 388 | dctcp_data->bytes_total, MAX_ALPHA_VALUE); |
| 389 | |
| 390 | /* Initialize internal parameters for next alpha calculation */ |
| 391 | dctcp_data->bytes_ecn = 0; |
| 392 | dctcp_data->bytes_total = 0; |
| 393 | dctcp_data->save_sndnxt = CCV(ccv, snd_nxt); |
| 394 | } |
| 395 | |
| 396 | static int |
| 397 | dctcp_alpha_handler(SYSCTL_HANDLER_ARGS) |
no test coverage detected