Lines Matching refs:res_table

151 	struct nh_res_table *res_table = rtnl_dereference(nhg->res_table);  in nh_notifier_res_table_info_init()  local
152 u16 num_nh_buckets = res_table->num_nh_buckets; in nh_notifier_res_table_info_init()
166 struct nh_res_bucket *bucket = &res_table->nh_buckets[i]; in nh_notifier_res_table_info_init()
255 struct nh_res_table *res_table; in nh_notifier_res_bucket_idle_timer_get() local
283 res_table = rcu_dereference(nhg->res_table); in nh_notifier_res_bucket_idle_timer_get()
284 *p_idle_timer_ms = jiffies_to_msecs(res_table->idle_timer); in nh_notifier_res_bucket_idle_timer_get()
482 vfree(rcu_dereference_raw(nhg->res_table)); in nexthop_free_group()
548 struct nh_res_table *res_table; in nexthop_res_table_alloc() local
551 size = struct_size(res_table, nh_buckets, num_nh_buckets); in nexthop_res_table_alloc()
552 res_table = __vmalloc(size, GFP_KERNEL | __GFP_ZERO | __GFP_NOWARN); in nexthop_res_table_alloc()
553 if (!res_table) in nexthop_res_table_alloc()
556 res_table->net = net; in nexthop_res_table_alloc()
557 res_table->nhg_id = nhg_id; in nexthop_res_table_alloc()
558 INIT_DELAYED_WORK(&res_table->upkeep_dw, &nh_res_table_upkeep_dw); in nexthop_res_table_alloc()
559 INIT_LIST_HEAD(&res_table->uw_nh_entries); in nexthop_res_table_alloc()
560 res_table->idle_timer = cfg->nh_grp_res_idle_timer; in nexthop_res_table_alloc()
561 res_table->unbalanced_timer = cfg->nh_grp_res_unbalanced_timer; in nexthop_res_table_alloc()
562 res_table->num_nh_buckets = num_nh_buckets; in nexthop_res_table_alloc()
563 return res_table; in nexthop_res_table_alloc()
621 static clock_t nh_res_table_unbalanced_time(struct nh_res_table *res_table) in nh_res_table_unbalanced_time() argument
623 if (list_empty(&res_table->uw_nh_entries)) in nh_res_table_unbalanced_time()
625 return jiffies_delta_to_clock_t(jiffies - res_table->unbalanced_since); in nh_res_table_unbalanced_time()
630 struct nh_res_table *res_table = rtnl_dereference(nhg->res_table); in nla_put_nh_group_res() local
638 res_table->num_nh_buckets) || in nla_put_nh_group_res()
640 jiffies_to_clock_t(res_table->idle_timer)) || in nla_put_nh_group_res()
642 jiffies_to_clock_t(res_table->unbalanced_timer)) || in nla_put_nh_group_res()
644 nh_res_table_unbalanced_time(res_table), in nla_put_nh_group_res()
873 nh_res_bucket_idle_point(const struct nh_res_table *res_table, in nh_res_bucket_idle_point() argument
883 return time + res_table->idle_timer; in nh_res_bucket_idle_point()
887 nh_res_table_unb_point(const struct nh_res_table *res_table) in nh_res_table_unb_point() argument
889 return res_table->unbalanced_since + res_table->unbalanced_timer; in nh_res_table_unb_point()
892 static void nh_res_bucket_set_idle(const struct nh_res_table *res_table, in nh_res_bucket_set_idle() argument
960 static void nexthop_bucket_notify(struct nh_res_table *res_table, in nexthop_bucket_notify() argument
963 struct nh_res_bucket *bucket = &res_table->nh_buckets[bucket_index]; in nexthop_bucket_notify()
1193 struct nh_res_table *res_table = rcu_dereference(nhg->res_table); in nexthop_select_path_res() local
1194 u16 bucket_index = hash % res_table->num_nh_buckets; in nexthop_select_path_res()
1201 bucket = &res_table->nh_buckets[bucket_index]; in nexthop_select_path_res()
1416 static bool nh_res_table_is_balanced(const struct nh_res_table *res_table) in nh_res_table_is_balanced() argument
1418 return list_empty(&res_table->uw_nh_entries); in nh_res_table_is_balanced()
1442 static bool nh_res_bucket_should_migrate(struct nh_res_table *res_table, in nh_res_bucket_should_migrate() argument
1471 idle_point = nh_res_bucket_idle_point(res_table, bucket, now); in nh_res_bucket_should_migrate()
1479 if (res_table->unbalanced_timer) { in nh_res_bucket_should_migrate()
1482 unb_point = nh_res_table_unb_point(res_table); in nh_res_bucket_should_migrate()
1500 static bool nh_res_bucket_migrate(struct nh_res_table *res_table, in nh_res_bucket_migrate() argument
1504 struct nh_res_bucket *bucket = &res_table->nh_buckets[bucket_index]; in nh_res_bucket_migrate()
1509 new_nhge = list_first_entry_or_null(&res_table->uw_nh_entries, in nh_res_bucket_migrate()
1524 err = call_nexthop_res_bucket_notifiers(res_table->net, in nh_res_bucket_migrate()
1525 res_table->nhg_id, in nh_res_bucket_migrate()
1543 nh_res_bucket_set_idle(res_table, bucket); in nh_res_bucket_migrate()
1546 nexthop_bucket_notify(res_table, bucket_index); in nh_res_bucket_migrate()
1555 static void nh_res_table_upkeep(struct nh_res_table *res_table, in nh_res_table_upkeep() argument
1569 if (res_table->unbalanced_timer) in nh_res_table_upkeep()
1570 deadline = now + res_table->unbalanced_timer; in nh_res_table_upkeep()
1572 deadline = now + res_table->idle_timer; in nh_res_table_upkeep()
1574 for (i = 0; i < res_table->num_nh_buckets; i++) { in nh_res_table_upkeep()
1575 struct nh_res_bucket *bucket = &res_table->nh_buckets[i]; in nh_res_table_upkeep()
1578 if (nh_res_bucket_should_migrate(res_table, bucket, in nh_res_table_upkeep()
1580 if (!nh_res_bucket_migrate(res_table, i, notify, in nh_res_table_upkeep()
1591 idle_point = nh_res_bucket_idle_point(res_table, in nh_res_table_upkeep()
1603 if (!nh_res_table_is_balanced(res_table)) { in nh_res_table_upkeep()
1612 &res_table->upkeep_dw, deadline - now); in nh_res_table_upkeep()
1619 struct nh_res_table *res_table; in nh_res_table_upkeep_dw() local
1621 res_table = container_of(dw, struct nh_res_table, upkeep_dw); in nh_res_table_upkeep_dw()
1622 nh_res_table_upkeep(res_table, true, true); in nh_res_table_upkeep_dw()
1625 static void nh_res_table_cancel_upkeep(struct nh_res_table *res_table) in nh_res_table_cancel_upkeep() argument
1627 cancel_delayed_work_sync(&res_table->upkeep_dw); in nh_res_table_cancel_upkeep()
1631 struct nh_res_table *res_table) in nh_res_group_rebalance() argument
1638 INIT_LIST_HEAD(&res_table->uw_nh_entries); in nh_res_group_rebalance()
1648 upper_bound = DIV_ROUND_CLOSEST(res_table->num_nh_buckets * w, in nh_res_group_rebalance()
1654 if (list_empty(&res_table->uw_nh_entries)) in nh_res_group_rebalance()
1655 res_table->unbalanced_since = jiffies; in nh_res_group_rebalance()
1657 &res_table->uw_nh_entries); in nh_res_group_rebalance()
1666 static void nh_res_table_migrate_buckets(struct nh_res_table *res_table, in nh_res_table_migrate_buckets() argument
1671 for (i = 0; i < res_table->num_nh_buckets; i++) { in nh_res_table_migrate_buckets()
1672 struct nh_res_bucket *bucket = &res_table->nh_buckets[i]; in nh_res_table_migrate_buckets()
1701 struct nh_res_table *old_res_table = rtnl_dereference(oldg->res_table); in replace_nexthop_grp_res()
1823 struct nh_res_table *res_table; in remove_nexthop_group() local
1836 res_table = rtnl_dereference(nhg->res_table); in remove_nexthop_group()
1837 nh_res_table_cancel_upkeep(res_table); in remove_nexthop_group()
1942 new_res_table = rtnl_dereference(newg->res_table); in replace_nexthop_grp()
1943 old_res_table = rtnl_dereference(oldg->res_table); in replace_nexthop_grp()
1974 rcu_assign_pointer(newg->res_table, old_res_table); in replace_nexthop_grp()
1975 rcu_assign_pointer(newg->spare->res_table, old_res_table); in replace_nexthop_grp()
1987 rcu_assign_pointer(oldg->res_table, tmp_table); in replace_nexthop_grp()
1988 rcu_assign_pointer(oldg->spare->res_table, tmp_table); in replace_nexthop_grp()
2017 struct nh_res_table *res_table, in replace_nexthop_single_notify_res() argument
2023 u32 nhg_id = res_table->nhg_id; in replace_nexthop_single_notify_res()
2027 for (i = 0; i < res_table->num_nh_buckets; i++) { in replace_nexthop_single_notify_res()
2028 struct nh_res_bucket *bucket = &res_table->nh_buckets[i]; in replace_nexthop_single_notify_res()
2046 struct nh_res_bucket *bucket = &res_table->nh_buckets[i]; in replace_nexthop_single_notify_res()
2066 struct nh_res_table *res_table; in replace_nexthop_single_notify() local
2072 res_table = rtnl_dereference(nhg->res_table); in replace_nexthop_single_notify()
2073 return replace_nexthop_single_notify_res(net, res_table, in replace_nexthop_single_notify()
2307 struct nh_res_table *res_table; in insert_nexthop() local
2310 res_table = rtnl_dereference(nhg->res_table); in insert_nexthop()
2321 nh_res_group_rebalance(nhg, res_table); in insert_nexthop()
2326 nh_res_table_upkeep(res_table, false, false); in insert_nexthop()
2446 struct nh_res_table *res_table; in nexthop_create_group() local
2448 res_table = nexthop_res_table_alloc(net, cfg->nh_id, cfg); in nexthop_create_group()
2449 if (!res_table) { in nexthop_create_group()
2454 rcu_assign_pointer(nhg->spare->res_table, res_table); in nexthop_create_group()
2455 rcu_assign_pointer(nhg->res_table, res_table); in nexthop_create_group()
3320 struct nh_res_table *res_table; in rtm_dump_nexthop_bucket_nh() local
3329 res_table = rtnl_dereference(nhg->res_table); in rtm_dump_nexthop_bucket_nh()
3331 bucket_index < res_table->num_nh_buckets; in rtm_dump_nexthop_bucket_nh()
3336 bucket = &res_table->nh_buckets[bucket_index]; in rtm_dump_nexthop_bucket_nh()
3480 struct nh_res_table *res_table; in rtm_get_nexthop_bucket() local
3497 res_table = rtnl_dereference(nhg->res_table); in rtm_get_nexthop_bucket()
3498 if (bucket_index >= res_table->num_nh_buckets) { in rtm_get_nexthop_bucket()
3507 err = nh_fill_res_bucket(skb, nh, &res_table->nh_buckets[bucket_index], in rtm_get_nexthop_bucket()
3646 struct nh_res_table *res_table; in nexthop_bucket_set_hw_flags() local
3661 if (bucket_index >= nhg->res_table->num_nh_buckets) in nexthop_bucket_set_hw_flags()
3664 res_table = rcu_dereference(nhg->res_table); in nexthop_bucket_set_hw_flags()
3665 bucket = &res_table->nh_buckets[bucket_index]; in nexthop_bucket_set_hw_flags()
3680 struct nh_res_table *res_table; in nexthop_res_grp_activity_update() local
3698 res_table = rcu_dereference(nhg->res_table); in nexthop_res_grp_activity_update()
3699 if (num_buckets != res_table->num_nh_buckets) in nexthop_res_grp_activity_update()
3704 nh_res_bucket_set_busy(&res_table->nh_buckets[i]); in nexthop_res_grp_activity_update()