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

Function populate_canned_table

freebsd/netinet/tcp_ratelimit.c:478–509  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

476}
477
478static void
479populate_canned_table(struct tcp_rate_set *rs, const uint64_t *rate_table_act)
480{
481 /*
482 * The internal table is "special", it
483 * is two seperate ordered tables that
484 * must be merged. We get here when the
485 * adapter specifies a number of rates that
486 * covers both ranges in the table in some
487 * form.
488 */
489 int i, at_low, at_high;
490 uint8_t low_disabled = 0, high_disabled = 0;
491
492 for(i = 0, at_low = 0, at_high = RS_NEXT_ORDER_GROUP; i < rs->rs_rate_cnt; i++) {
493 rs->rs_rlt[i].flags = 0;
494 rs->rs_rlt[i].time_between = 0;
495 if ((low_disabled == 0) &&
496 (high_disabled ||
497 (rate_table_act[at_low] < rate_table_act[at_high]))) {
498 rs->rs_rlt[i].rate = rate_table_act[at_low];
499 at_low++;
500 if (at_low == RS_NEXT_ORDER_GROUP)
501 low_disabled = 1;
502 } else if (high_disabled == 0) {
503 rs->rs_rlt[i].rate = rate_table_act[at_high];
504 at_high++;
505 if (at_high == MAX_HDWR_RATES)
506 high_disabled = 1;
507 }
508 }
509}
510
511static struct tcp_rate_set *
512rt_setup_new_rs(struct ifnet *ifp, int *error)

Callers 1

rt_setup_new_rsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected