Lines Matching refs:res_table

152 	struct nh_res_table *res_table = rtnl_dereference(nhg->res_table);  in nh_notifier_res_table_info_init()  local
153 u16 num_nh_buckets = res_table->num_nh_buckets; in nh_notifier_res_table_info_init()
167 struct nh_res_bucket *bucket = &res_table->nh_buckets[i]; in nh_notifier_res_table_info_init()
256 struct nh_res_table *res_table; in nh_notifier_res_bucket_idle_timer_get() local
284 res_table = rcu_dereference(nhg->res_table); in nh_notifier_res_bucket_idle_timer_get()
285 *p_idle_timer_ms = jiffies_to_msecs(res_table->idle_timer); in nh_notifier_res_bucket_idle_timer_get()
483 vfree(rcu_dereference_raw(nhg->res_table)); in nexthop_free_group()
549 struct nh_res_table *res_table; in nexthop_res_table_alloc() local
552 size = struct_size(res_table, nh_buckets, num_nh_buckets); in nexthop_res_table_alloc()
553 res_table = __vmalloc(size, GFP_KERNEL | __GFP_ZERO | __GFP_NOWARN); in nexthop_res_table_alloc()
554 if (!res_table) in nexthop_res_table_alloc()
557 res_table->net = net; in nexthop_res_table_alloc()
558 res_table->nhg_id = nhg_id; in nexthop_res_table_alloc()
559 INIT_DELAYED_WORK(&res_table->upkeep_dw, &nh_res_table_upkeep_dw); in nexthop_res_table_alloc()
560 INIT_LIST_HEAD(&res_table->uw_nh_entries); in nexthop_res_table_alloc()
561 res_table->idle_timer = cfg->nh_grp_res_idle_timer; in nexthop_res_table_alloc()
562 res_table->unbalanced_timer = cfg->nh_grp_res_unbalanced_timer; in nexthop_res_table_alloc()
563 res_table->num_nh_buckets = num_nh_buckets; in nexthop_res_table_alloc()
564 return res_table; in nexthop_res_table_alloc()
622 static clock_t nh_res_table_unbalanced_time(struct nh_res_table *res_table) in nh_res_table_unbalanced_time() argument
624 if (list_empty(&res_table->uw_nh_entries)) in nh_res_table_unbalanced_time()
626 return jiffies_delta_to_clock_t(jiffies - res_table->unbalanced_since); in nh_res_table_unbalanced_time()
631 struct nh_res_table *res_table = rtnl_dereference(nhg->res_table); in nla_put_nh_group_res() local
639 res_table->num_nh_buckets) || in nla_put_nh_group_res()
641 jiffies_to_clock_t(res_table->idle_timer)) || in nla_put_nh_group_res()
643 jiffies_to_clock_t(res_table->unbalanced_timer)) || in nla_put_nh_group_res()
645 nh_res_table_unbalanced_time(res_table), in nla_put_nh_group_res()
874 nh_res_bucket_idle_point(const struct nh_res_table *res_table, in nh_res_bucket_idle_point() argument
884 return time + res_table->idle_timer; in nh_res_bucket_idle_point()
888 nh_res_table_unb_point(const struct nh_res_table *res_table) in nh_res_table_unb_point() argument
890 return res_table->unbalanced_since + res_table->unbalanced_timer; in nh_res_table_unb_point()
893 static void nh_res_bucket_set_idle(const struct nh_res_table *res_table, in nh_res_bucket_set_idle() argument
961 static void nexthop_bucket_notify(struct nh_res_table *res_table, in nexthop_bucket_notify() argument
964 struct nh_res_bucket *bucket = &res_table->nh_buckets[bucket_index]; in nexthop_bucket_notify()
1217 struct nh_res_table *res_table = rcu_dereference(nhg->res_table); in nexthop_select_path_res() local
1218 u16 bucket_index = hash % res_table->num_nh_buckets; in nexthop_select_path_res()
1225 bucket = &res_table->nh_buckets[bucket_index]; in nexthop_select_path_res()
1440 static bool nh_res_table_is_balanced(const struct nh_res_table *res_table) in nh_res_table_is_balanced() argument
1442 return list_empty(&res_table->uw_nh_entries); in nh_res_table_is_balanced()
1466 static bool nh_res_bucket_should_migrate(struct nh_res_table *res_table, in nh_res_bucket_should_migrate() argument
1495 idle_point = nh_res_bucket_idle_point(res_table, bucket, now); in nh_res_bucket_should_migrate()
1503 if (res_table->unbalanced_timer) { in nh_res_bucket_should_migrate()
1506 unb_point = nh_res_table_unb_point(res_table); in nh_res_bucket_should_migrate()
1524 static bool nh_res_bucket_migrate(struct nh_res_table *res_table, in nh_res_bucket_migrate() argument
1528 struct nh_res_bucket *bucket = &res_table->nh_buckets[bucket_index]; in nh_res_bucket_migrate()
1533 new_nhge = list_first_entry_or_null(&res_table->uw_nh_entries, in nh_res_bucket_migrate()
1548 err = call_nexthop_res_bucket_notifiers(res_table->net, in nh_res_bucket_migrate()
1549 res_table->nhg_id, in nh_res_bucket_migrate()
1567 nh_res_bucket_set_idle(res_table, bucket); in nh_res_bucket_migrate()
1570 nexthop_bucket_notify(res_table, bucket_index); in nh_res_bucket_migrate()
1579 static void nh_res_table_upkeep(struct nh_res_table *res_table, in nh_res_table_upkeep() argument
1593 if (res_table->unbalanced_timer) in nh_res_table_upkeep()
1594 deadline = now + res_table->unbalanced_timer; in nh_res_table_upkeep()
1596 deadline = now + res_table->idle_timer; in nh_res_table_upkeep()
1598 for (i = 0; i < res_table->num_nh_buckets; i++) { in nh_res_table_upkeep()
1599 struct nh_res_bucket *bucket = &res_table->nh_buckets[i]; in nh_res_table_upkeep()
1602 if (nh_res_bucket_should_migrate(res_table, bucket, in nh_res_table_upkeep()
1604 if (!nh_res_bucket_migrate(res_table, i, notify, in nh_res_table_upkeep()
1615 idle_point = nh_res_bucket_idle_point(res_table, in nh_res_table_upkeep()
1627 if (!nh_res_table_is_balanced(res_table)) { in nh_res_table_upkeep()
1636 &res_table->upkeep_dw, deadline - now); in nh_res_table_upkeep()
1643 struct nh_res_table *res_table; in nh_res_table_upkeep_dw() local
1645 res_table = container_of(dw, struct nh_res_table, upkeep_dw); in nh_res_table_upkeep_dw()
1646 nh_res_table_upkeep(res_table, true, true); in nh_res_table_upkeep_dw()
1649 static void nh_res_table_cancel_upkeep(struct nh_res_table *res_table) in nh_res_table_cancel_upkeep() argument
1651 cancel_delayed_work_sync(&res_table->upkeep_dw); in nh_res_table_cancel_upkeep()
1655 struct nh_res_table *res_table) in nh_res_group_rebalance() argument
1662 INIT_LIST_HEAD(&res_table->uw_nh_entries); in nh_res_group_rebalance()
1672 upper_bound = DIV_ROUND_CLOSEST(res_table->num_nh_buckets * w, in nh_res_group_rebalance()
1678 if (list_empty(&res_table->uw_nh_entries)) in nh_res_group_rebalance()
1679 res_table->unbalanced_since = jiffies; in nh_res_group_rebalance()
1681 &res_table->uw_nh_entries); in nh_res_group_rebalance()
1690 static void nh_res_table_migrate_buckets(struct nh_res_table *res_table, in nh_res_table_migrate_buckets() argument
1695 for (i = 0; i < res_table->num_nh_buckets; i++) { in nh_res_table_migrate_buckets()
1696 struct nh_res_bucket *bucket = &res_table->nh_buckets[i]; in nh_res_table_migrate_buckets()
1725 struct nh_res_table *old_res_table = rtnl_dereference(oldg->res_table); in replace_nexthop_grp_res()
1847 struct nh_res_table *res_table; in remove_nexthop_group() local
1860 res_table = rtnl_dereference(nhg->res_table); in remove_nexthop_group()
1861 nh_res_table_cancel_upkeep(res_table); in remove_nexthop_group()
1984 new_res_table = rtnl_dereference(newg->res_table); in replace_nexthop_grp()
1985 old_res_table = rtnl_dereference(oldg->res_table); in replace_nexthop_grp()
2016 rcu_assign_pointer(newg->res_table, old_res_table); in replace_nexthop_grp()
2017 rcu_assign_pointer(newg->spare->res_table, old_res_table); in replace_nexthop_grp()
2030 rcu_assign_pointer(oldg->res_table, tmp_table); in replace_nexthop_grp()
2031 rcu_assign_pointer(oldg->spare->res_table, tmp_table); in replace_nexthop_grp()
2060 struct nh_res_table *res_table, in replace_nexthop_single_notify_res() argument
2066 u32 nhg_id = res_table->nhg_id; in replace_nexthop_single_notify_res()
2070 for (i = 0; i < res_table->num_nh_buckets; i++) { in replace_nexthop_single_notify_res()
2071 struct nh_res_bucket *bucket = &res_table->nh_buckets[i]; in replace_nexthop_single_notify_res()
2089 struct nh_res_bucket *bucket = &res_table->nh_buckets[i]; in replace_nexthop_single_notify_res()
2109 struct nh_res_table *res_table; in replace_nexthop_single_notify() local
2115 res_table = rtnl_dereference(nhg->res_table); in replace_nexthop_single_notify()
2116 return replace_nexthop_single_notify_res(net, res_table, in replace_nexthop_single_notify()
2350 struct nh_res_table *res_table; in insert_nexthop() local
2353 res_table = rtnl_dereference(nhg->res_table); in insert_nexthop()
2364 nh_res_group_rebalance(nhg, res_table); in insert_nexthop()
2369 nh_res_table_upkeep(res_table, false, false); in insert_nexthop()
2490 struct nh_res_table *res_table; in nexthop_create_group() local
2492 res_table = nexthop_res_table_alloc(net, cfg->nh_id, cfg); in nexthop_create_group()
2493 if (!res_table) { in nexthop_create_group()
2498 rcu_assign_pointer(nhg->spare->res_table, res_table); in nexthop_create_group()
2499 rcu_assign_pointer(nhg->res_table, res_table); in nexthop_create_group()
3362 struct nh_res_table *res_table; in rtm_dump_nexthop_bucket_nh() local
3368 res_table = rtnl_dereference(nhg->res_table); in rtm_dump_nexthop_bucket_nh()
3370 bucket_index < res_table->num_nh_buckets; in rtm_dump_nexthop_bucket_nh()
3375 bucket = &res_table->nh_buckets[bucket_index]; in rtm_dump_nexthop_bucket_nh()
3508 struct nh_res_table *res_table; in rtm_get_nexthop_bucket() local
3525 res_table = rtnl_dereference(nhg->res_table); in rtm_get_nexthop_bucket()
3526 if (bucket_index >= res_table->num_nh_buckets) { in rtm_get_nexthop_bucket()
3535 err = nh_fill_res_bucket(skb, nh, &res_table->nh_buckets[bucket_index], in rtm_get_nexthop_bucket()
3674 struct nh_res_table *res_table; in nexthop_bucket_set_hw_flags() local
3689 if (bucket_index >= nhg->res_table->num_nh_buckets) in nexthop_bucket_set_hw_flags()
3692 res_table = rcu_dereference(nhg->res_table); in nexthop_bucket_set_hw_flags()
3693 bucket = &res_table->nh_buckets[bucket_index]; in nexthop_bucket_set_hw_flags()
3708 struct nh_res_table *res_table; in nexthop_res_grp_activity_update() local
3726 res_table = rcu_dereference(nhg->res_table); in nexthop_res_grp_activity_update()
3727 if (num_buckets != res_table->num_nh_buckets) in nexthop_res_grp_activity_update()
3732 nh_res_bucket_set_busy(&res_table->nh_buckets[i]); in nexthop_res_grp_activity_update()