Lines Matching refs:res_table

165 	struct nh_res_table *res_table = rtnl_dereference(nhg->res_table);  in nh_notifier_res_table_info_init()  local
166 u16 num_nh_buckets = res_table->num_nh_buckets; in nh_notifier_res_table_info_init()
181 struct nh_res_bucket *bucket = &res_table->nh_buckets[i]; in nh_notifier_res_table_info_init()
270 struct nh_res_table *res_table; in nh_notifier_res_bucket_idle_timer_get() local
298 res_table = rcu_dereference(nhg->res_table); in nh_notifier_res_bucket_idle_timer_get()
299 *p_idle_timer_ms = jiffies_to_msecs(res_table->idle_timer); in nh_notifier_res_bucket_idle_timer_get()
499 vfree(rcu_dereference_raw(nhg->res_table)); in nexthop_free_group()
565 struct nh_res_table *res_table; in nexthop_res_table_alloc() local
568 size = struct_size(res_table, nh_buckets, num_nh_buckets); in nexthop_res_table_alloc()
569 res_table = __vmalloc(size, GFP_KERNEL | __GFP_ZERO | __GFP_NOWARN); in nexthop_res_table_alloc()
570 if (!res_table) in nexthop_res_table_alloc()
573 res_table->net = net; in nexthop_res_table_alloc()
574 res_table->nhg_id = nhg_id; in nexthop_res_table_alloc()
575 INIT_DELAYED_WORK(&res_table->upkeep_dw, &nh_res_table_upkeep_dw); in nexthop_res_table_alloc()
576 INIT_LIST_HEAD(&res_table->uw_nh_entries); in nexthop_res_table_alloc()
577 res_table->idle_timer = cfg->nh_grp_res_idle_timer; in nexthop_res_table_alloc()
578 res_table->unbalanced_timer = cfg->nh_grp_res_unbalanced_timer; in nexthop_res_table_alloc()
579 res_table->num_nh_buckets = num_nh_buckets; in nexthop_res_table_alloc()
580 return res_table; in nexthop_res_table_alloc()
638 static clock_t nh_res_table_unbalanced_time(struct nh_res_table *res_table) in nh_res_table_unbalanced_time() argument
640 if (list_empty(&res_table->uw_nh_entries)) in nh_res_table_unbalanced_time()
642 return jiffies_delta_to_clock_t(jiffies - res_table->unbalanced_since); in nh_res_table_unbalanced_time()
647 struct nh_res_table *res_table = rtnl_dereference(nhg->res_table); in nla_put_nh_group_res() local
655 res_table->num_nh_buckets) || in nla_put_nh_group_res()
657 jiffies_to_clock_t(res_table->idle_timer)) || in nla_put_nh_group_res()
659 jiffies_to_clock_t(res_table->unbalanced_timer)) || in nla_put_nh_group_res()
661 nh_res_table_unbalanced_time(res_table), in nla_put_nh_group_res()
1102 nh_res_bucket_idle_point(const struct nh_res_table *res_table, in nh_res_bucket_idle_point() argument
1112 return time + res_table->idle_timer; in nh_res_bucket_idle_point()
1116 nh_res_table_unb_point(const struct nh_res_table *res_table) in nh_res_table_unb_point() argument
1118 return res_table->unbalanced_since + res_table->unbalanced_timer; in nh_res_table_unb_point()
1121 static void nh_res_bucket_set_idle(const struct nh_res_table *res_table, in nh_res_bucket_set_idle() argument
1189 static void nexthop_bucket_notify(struct nh_res_table *res_table, in nexthop_bucket_notify() argument
1192 struct nh_res_bucket *bucket = &res_table->nh_buckets[bucket_index]; in nexthop_bucket_notify()
1453 struct nh_res_table *res_table = rcu_dereference(nhg->res_table); in nexthop_select_path_res() local
1454 u16 bucket_index = hash % res_table->num_nh_buckets; in nexthop_select_path_res()
1461 bucket = &res_table->nh_buckets[bucket_index]; in nexthop_select_path_res()
1677 static bool nh_res_table_is_balanced(const struct nh_res_table *res_table) in nh_res_table_is_balanced() argument
1679 return list_empty(&res_table->uw_nh_entries); in nh_res_table_is_balanced()
1703 static bool nh_res_bucket_should_migrate(struct nh_res_table *res_table, in nh_res_bucket_should_migrate() argument
1732 idle_point = nh_res_bucket_idle_point(res_table, bucket, now); in nh_res_bucket_should_migrate()
1740 if (res_table->unbalanced_timer) { in nh_res_bucket_should_migrate()
1743 unb_point = nh_res_table_unb_point(res_table); in nh_res_bucket_should_migrate()
1761 static bool nh_res_bucket_migrate(struct nh_res_table *res_table, in nh_res_bucket_migrate() argument
1765 struct nh_res_bucket *bucket = &res_table->nh_buckets[bucket_index]; in nh_res_bucket_migrate()
1770 new_nhge = list_first_entry_or_null(&res_table->uw_nh_entries, in nh_res_bucket_migrate()
1785 err = call_nexthop_res_bucket_notifiers(res_table->net, in nh_res_bucket_migrate()
1786 res_table->nhg_id, in nh_res_bucket_migrate()
1804 nh_res_bucket_set_idle(res_table, bucket); in nh_res_bucket_migrate()
1807 nexthop_bucket_notify(res_table, bucket_index); in nh_res_bucket_migrate()
1816 static void nh_res_table_upkeep(struct nh_res_table *res_table, in nh_res_table_upkeep() argument
1830 if (res_table->unbalanced_timer) in nh_res_table_upkeep()
1831 deadline = now + res_table->unbalanced_timer; in nh_res_table_upkeep()
1833 deadline = now + res_table->idle_timer; in nh_res_table_upkeep()
1835 for (i = 0; i < res_table->num_nh_buckets; i++) { in nh_res_table_upkeep()
1836 struct nh_res_bucket *bucket = &res_table->nh_buckets[i]; in nh_res_table_upkeep()
1839 if (nh_res_bucket_should_migrate(res_table, bucket, in nh_res_table_upkeep()
1841 if (!nh_res_bucket_migrate(res_table, i, notify, in nh_res_table_upkeep()
1852 idle_point = nh_res_bucket_idle_point(res_table, in nh_res_table_upkeep()
1864 if (!nh_res_table_is_balanced(res_table)) { in nh_res_table_upkeep()
1873 &res_table->upkeep_dw, deadline - now); in nh_res_table_upkeep()
1880 struct nh_res_table *res_table; in nh_res_table_upkeep_dw() local
1882 res_table = container_of(dw, struct nh_res_table, upkeep_dw); in nh_res_table_upkeep_dw()
1883 nh_res_table_upkeep(res_table, true, true); in nh_res_table_upkeep_dw()
1886 static void nh_res_table_cancel_upkeep(struct nh_res_table *res_table) in nh_res_table_cancel_upkeep() argument
1888 cancel_delayed_work_sync(&res_table->upkeep_dw); in nh_res_table_cancel_upkeep()
1892 struct nh_res_table *res_table) in nh_res_group_rebalance() argument
1899 INIT_LIST_HEAD(&res_table->uw_nh_entries); in nh_res_group_rebalance()
1910 btw = ((u64)res_table->num_nh_buckets) * w; in nh_res_group_rebalance()
1916 if (list_empty(&res_table->uw_nh_entries)) in nh_res_group_rebalance()
1917 res_table->unbalanced_since = jiffies; in nh_res_group_rebalance()
1919 &res_table->uw_nh_entries); in nh_res_group_rebalance()
1928 static void nh_res_table_migrate_buckets(struct nh_res_table *res_table, in nh_res_table_migrate_buckets() argument
1933 for (i = 0; i < res_table->num_nh_buckets; i++) { in nh_res_table_migrate_buckets()
1934 struct nh_res_bucket *bucket = &res_table->nh_buckets[i]; in nh_res_table_migrate_buckets()
1963 struct nh_res_table *old_res_table = rtnl_dereference(oldg->res_table); in replace_nexthop_grp_res()
2087 struct nh_res_table *res_table; in remove_nexthop_group() local
2100 res_table = rtnl_dereference(nhg->res_table); in remove_nexthop_group()
2101 nh_res_table_cancel_upkeep(res_table); in remove_nexthop_group()
2224 new_res_table = rtnl_dereference(newg->res_table); in replace_nexthop_grp()
2225 old_res_table = rtnl_dereference(oldg->res_table); in replace_nexthop_grp()
2256 rcu_assign_pointer(newg->res_table, old_res_table); in replace_nexthop_grp()
2257 rcu_assign_pointer(newg->spare->res_table, old_res_table); in replace_nexthop_grp()
2270 rcu_assign_pointer(oldg->res_table, tmp_table); in replace_nexthop_grp()
2271 rcu_assign_pointer(oldg->spare->res_table, tmp_table); in replace_nexthop_grp()
2300 struct nh_res_table *res_table, in replace_nexthop_single_notify_res() argument
2306 u32 nhg_id = res_table->nhg_id; in replace_nexthop_single_notify_res()
2310 for (i = 0; i < res_table->num_nh_buckets; i++) { in replace_nexthop_single_notify_res()
2311 struct nh_res_bucket *bucket = &res_table->nh_buckets[i]; in replace_nexthop_single_notify_res()
2329 struct nh_res_bucket *bucket = &res_table->nh_buckets[i]; in replace_nexthop_single_notify_res()
2349 struct nh_res_table *res_table; in replace_nexthop_single_notify() local
2355 res_table = rtnl_dereference(nhg->res_table); in replace_nexthop_single_notify()
2356 return replace_nexthop_single_notify_res(net, res_table, in replace_nexthop_single_notify()
2590 struct nh_res_table *res_table; in insert_nexthop() local
2593 res_table = rtnl_dereference(nhg->res_table); in insert_nexthop()
2604 nh_res_group_rebalance(nhg, res_table); in insert_nexthop()
2609 nh_res_table_upkeep(res_table, false, false); in insert_nexthop()
2738 struct nh_res_table *res_table; in nexthop_create_group() local
2740 res_table = nexthop_res_table_alloc(net, cfg->nh_id, cfg); in nexthop_create_group()
2741 if (!res_table) { in nexthop_create_group()
2746 rcu_assign_pointer(nhg->spare->res_table, res_table); in nexthop_create_group()
2747 rcu_assign_pointer(nhg->res_table, res_table); in nexthop_create_group()
3630 struct nh_res_table *res_table; in rtm_dump_nexthop_bucket_nh() local
3636 res_table = rtnl_dereference(nhg->res_table); in rtm_dump_nexthop_bucket_nh()
3638 bucket_index < res_table->num_nh_buckets; in rtm_dump_nexthop_bucket_nh()
3643 bucket = &res_table->nh_buckets[bucket_index]; in rtm_dump_nexthop_bucket_nh()
3771 struct nh_res_table *res_table; in rtm_get_nexthop_bucket() local
3788 res_table = rtnl_dereference(nhg->res_table); in rtm_get_nexthop_bucket()
3789 if (bucket_index >= res_table->num_nh_buckets) { in rtm_get_nexthop_bucket()
3798 err = nh_fill_res_bucket(skb, nh, &res_table->nh_buckets[bucket_index], in rtm_get_nexthop_bucket()
3944 struct nh_res_table *res_table; in nexthop_bucket_set_hw_flags() local
3959 if (bucket_index >= nhg->res_table->num_nh_buckets) in nexthop_bucket_set_hw_flags()
3962 res_table = rcu_dereference(nhg->res_table); in nexthop_bucket_set_hw_flags()
3963 bucket = &res_table->nh_buckets[bucket_index]; in nexthop_bucket_set_hw_flags()
3978 struct nh_res_table *res_table; in nexthop_res_grp_activity_update() local
3996 res_table = rcu_dereference(nhg->res_table); in nexthop_res_grp_activity_update()
3997 if (num_buckets != res_table->num_nh_buckets) in nexthop_res_grp_activity_update()
4002 nh_res_bucket_set_busy(&res_table->nh_buckets[i]); in nexthop_res_grp_activity_update()