Lines Matching refs:nh_grp

2941 	struct mlxsw_sp_nexthop_group *nh_grp;  member
3100 mlxsw_sp_nexthop_group_vr_entry_lookup(struct mlxsw_sp_nexthop_group *nh_grp, in mlxsw_sp_nexthop_group_vr_entry_lookup() argument
3108 return rhashtable_lookup_fast(&nh_grp->vr_ht, &key, in mlxsw_sp_nexthop_group_vr_entry_lookup()
3113 mlxsw_sp_nexthop_group_vr_entry_create(struct mlxsw_sp_nexthop_group *nh_grp, in mlxsw_sp_nexthop_group_vr_entry_create() argument
3127 err = rhashtable_insert_fast(&nh_grp->vr_ht, &vr_entry->ht_node, in mlxsw_sp_nexthop_group_vr_entry_create()
3132 list_add(&vr_entry->list, &nh_grp->vr_list); in mlxsw_sp_nexthop_group_vr_entry_create()
3142 mlxsw_sp_nexthop_group_vr_entry_destroy(struct mlxsw_sp_nexthop_group *nh_grp, in mlxsw_sp_nexthop_group_vr_entry_destroy() argument
3146 rhashtable_remove_fast(&nh_grp->vr_ht, &vr_entry->ht_node, in mlxsw_sp_nexthop_group_vr_entry_destroy()
3152 mlxsw_sp_nexthop_group_vr_link(struct mlxsw_sp_nexthop_group *nh_grp, in mlxsw_sp_nexthop_group_vr_link() argument
3157 vr_entry = mlxsw_sp_nexthop_group_vr_entry_lookup(nh_grp, fib); in mlxsw_sp_nexthop_group_vr_link()
3163 return mlxsw_sp_nexthop_group_vr_entry_create(nh_grp, fib); in mlxsw_sp_nexthop_group_vr_link()
3167 mlxsw_sp_nexthop_group_vr_unlink(struct mlxsw_sp_nexthop_group *nh_grp, in mlxsw_sp_nexthop_group_vr_unlink() argument
3172 vr_entry = mlxsw_sp_nexthop_group_vr_entry_lookup(nh_grp, fib); in mlxsw_sp_nexthop_group_vr_unlink()
3179 mlxsw_sp_nexthop_group_vr_entry_destroy(nh_grp, vr_entry); in mlxsw_sp_nexthop_group_vr_unlink()
3192 mlxsw_sp_nexthop6_group_has_nexthop(const struct mlxsw_sp_nexthop_group *nh_grp, in mlxsw_sp_nexthop6_group_has_nexthop() argument
3198 for (i = 0; i < nh_grp->nhgi->count; i++) { in mlxsw_sp_nexthop6_group_has_nexthop()
3201 nh = &nh_grp->nhgi->nexthops[i]; in mlxsw_sp_nexthop6_group_has_nexthop()
3211 mlxsw_sp_nexthop6_group_cmp(const struct mlxsw_sp_nexthop_group *nh_grp, in mlxsw_sp_nexthop6_group_cmp() argument
3216 if (nh_grp->nhgi->count != fib6_entry->nrt6) in mlxsw_sp_nexthop6_group_cmp()
3227 if (!mlxsw_sp_nexthop6_group_has_nexthop(nh_grp, gw, ifindex, in mlxsw_sp_nexthop6_group_cmp()
3239 const struct mlxsw_sp_nexthop_group *nh_grp = ptr; in mlxsw_sp_nexthop_group_cmp() local
3241 if (nh_grp->type != cmp_arg->type) in mlxsw_sp_nexthop_group_cmp()
3246 return cmp_arg->fi != nh_grp->ipv4.fi; in mlxsw_sp_nexthop_group_cmp()
3248 return !mlxsw_sp_nexthop6_group_cmp(nh_grp, in mlxsw_sp_nexthop_group_cmp()
3251 return cmp_arg->id != nh_grp->obj.id; in mlxsw_sp_nexthop_group_cmp()
3260 const struct mlxsw_sp_nexthop_group *nh_grp = data; in mlxsw_sp_nexthop_group_hash_obj() local
3266 switch (nh_grp->type) { in mlxsw_sp_nexthop_group_hash_obj()
3268 fi = nh_grp->ipv4.fi; in mlxsw_sp_nexthop_group_hash_obj()
3271 val = nh_grp->nhgi->count; in mlxsw_sp_nexthop_group_hash_obj()
3272 for (i = 0; i < nh_grp->nhgi->count; i++) { in mlxsw_sp_nexthop_group_hash_obj()
3273 nh = &nh_grp->nhgi->nexthops[i]; in mlxsw_sp_nexthop_group_hash_obj()
3279 return jhash(&nh_grp->obj.id, sizeof(nh_grp->obj.id), seed); in mlxsw_sp_nexthop_group_hash_obj()
3330 struct mlxsw_sp_nexthop_group *nh_grp) in mlxsw_sp_nexthop_group_insert() argument
3332 if (nh_grp->type == MLXSW_SP_NEXTHOP_GROUP_TYPE_IPV6 && in mlxsw_sp_nexthop_group_insert()
3333 !nh_grp->nhgi->gateway) in mlxsw_sp_nexthop_group_insert()
3337 &nh_grp->ht_node, in mlxsw_sp_nexthop_group_insert()
3342 struct mlxsw_sp_nexthop_group *nh_grp) in mlxsw_sp_nexthop_group_remove() argument
3344 if (nh_grp->type == MLXSW_SP_NEXTHOP_GROUP_TYPE_IPV6 && in mlxsw_sp_nexthop_group_remove()
3345 !nh_grp->nhgi->gateway) in mlxsw_sp_nexthop_group_remove()
3349 &nh_grp->ht_node, in mlxsw_sp_nexthop_group_remove()
3424 struct mlxsw_sp_nexthop_group *nh_grp, in mlxsw_sp_adj_index_mass_update() argument
3427 struct mlxsw_sp_nexthop_group_info *nhgi = nh_grp->nhgi; in mlxsw_sp_adj_index_mass_update()
3431 list_for_each_entry(vr_entry, &nh_grp->vr_list, list) { in mlxsw_sp_adj_index_mass_update()
3445 list_for_each_entry_continue_reverse(vr_entry, &nh_grp->vr_list, list) in mlxsw_sp_adj_index_mass_update()
3595 struct mlxsw_sp_nexthop_group *nh_grp) in mlxsw_sp_nexthop_fib_entries_update() argument
3600 list_for_each_entry(fib_entry, &nh_grp->fib_list, nexthop_group_node) { in mlxsw_sp_nexthop_fib_entries_update()
3747 mlxsw_sp_rt6_nexthop(struct mlxsw_sp_nexthop_group *nh_grp,
3752 struct mlxsw_sp_nexthop_group *nh_grp) in mlxsw_sp_nexthop4_group_offload_refresh() argument
3756 for (i = 0; i < nh_grp->nhgi->count; i++) { in mlxsw_sp_nexthop4_group_offload_refresh()
3757 struct mlxsw_sp_nexthop *nh = &nh_grp->nhgi->nexthops[i]; in mlxsw_sp_nexthop4_group_offload_refresh()
3767 __mlxsw_sp_nexthop6_group_offload_refresh(struct mlxsw_sp_nexthop_group *nh_grp, in __mlxsw_sp_nexthop6_group_offload_refresh() argument
3776 nh = mlxsw_sp_rt6_nexthop(nh_grp, mlxsw_sp_rt6); in __mlxsw_sp_nexthop6_group_offload_refresh()
3786 struct mlxsw_sp_nexthop_group *nh_grp) in mlxsw_sp_nexthop6_group_offload_refresh() argument
3794 list_for_each_entry(fib6_entry, &nh_grp->fib_list, in mlxsw_sp_nexthop6_group_offload_refresh()
3796 __mlxsw_sp_nexthop6_group_offload_refresh(nh_grp, fib6_entry); in mlxsw_sp_nexthop6_group_offload_refresh()
3804 struct mlxsw_sp_nexthop_group *nh_grp = nh->nhgi->nh_grp; in mlxsw_sp_nexthop_bucket_offload_refresh() local
3813 nexthop_bucket_set_hw_flags(mlxsw_sp_net(mlxsw_sp), nh_grp->obj.id, in mlxsw_sp_nexthop_bucket_offload_refresh()
3819 struct mlxsw_sp_nexthop_group *nh_grp) in mlxsw_sp_nexthop_obj_group_offload_refresh() argument
3831 if (nh_grp->can_destroy) in mlxsw_sp_nexthop_obj_group_offload_refresh()
3834 nexthop_set_hw_flags(mlxsw_sp_net(mlxsw_sp), nh_grp->obj.id, in mlxsw_sp_nexthop_obj_group_offload_refresh()
3835 nh_grp->nhgi->adj_index_valid, false); in mlxsw_sp_nexthop_obj_group_offload_refresh()
3840 if (!nh_grp->nhgi->is_resilient) in mlxsw_sp_nexthop_obj_group_offload_refresh()
3843 for (i = 0; i < nh_grp->nhgi->count; i++) { in mlxsw_sp_nexthop_obj_group_offload_refresh()
3844 struct mlxsw_sp_nexthop *nh = &nh_grp->nhgi->nexthops[i]; in mlxsw_sp_nexthop_obj_group_offload_refresh()
3852 struct mlxsw_sp_nexthop_group *nh_grp) in mlxsw_sp_nexthop_group_offload_refresh() argument
3854 switch (nh_grp->type) { in mlxsw_sp_nexthop_group_offload_refresh()
3856 mlxsw_sp_nexthop4_group_offload_refresh(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop_group_offload_refresh()
3859 mlxsw_sp_nexthop6_group_offload_refresh(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop_group_offload_refresh()
3862 mlxsw_sp_nexthop_obj_group_offload_refresh(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop_group_offload_refresh()
3869 struct mlxsw_sp_nexthop_group *nh_grp) in mlxsw_sp_nexthop_group_refresh() argument
3871 struct mlxsw_sp_nexthop_group_info *nhgi = nh_grp->nhgi; in mlxsw_sp_nexthop_group_refresh()
3881 return mlxsw_sp_nexthop_fib_entries_update(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop_group_refresh()
3904 mlxsw_sp_nexthop_group_offload_refresh(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop_group_refresh()
3944 mlxsw_sp_nexthop_group_offload_refresh(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop_group_refresh()
3950 err = mlxsw_sp_nexthop_fib_entries_update(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop_group_refresh()
3958 err = mlxsw_sp_adj_index_mass_update(mlxsw_sp, nh_grp, in mlxsw_sp_nexthop_group_refresh()
3976 err2 = mlxsw_sp_nexthop_fib_entries_update(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop_group_refresh()
3979 mlxsw_sp_nexthop_group_offload_refresh(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop_group_refresh()
4039 mlxsw_sp_nexthop_group_refresh(mlxsw_sp, nh->nhgi->nh_grp); in mlxsw_sp_nexthop_dead_neigh_replace()
4076 mlxsw_sp_nexthop_group_refresh(mlxsw_sp, nh->nhgi->nh_grp); in mlxsw_sp_nexthop_neigh_update()
4282 struct mlxsw_sp_nexthop_group *nh_grp, in mlxsw_sp_nexthop4_init() argument
4290 nh->nhgi = nh_grp->nhgi; in mlxsw_sp_nexthop4_init()
4361 mlxsw_sp_nexthop_group_refresh(mlxsw_sp, nh->nhgi->nh_grp); in mlxsw_sp_nexthop4_event()
4384 mlxsw_sp_nexthop_group_refresh(mlxsw_sp, nh->nhgi->nh_grp); in mlxsw_sp_nexthop_rif_update()
4407 mlxsw_sp_nexthop_group_refresh(mlxsw_sp, nh->nhgi->nh_grp); in mlxsw_sp_nexthop_rif_gone_sync()
4473 const struct mlxsw_sp_nexthop_group *nh_grp, in mlxsw_sp_nh_grp_activity_get() argument
4483 mlxsw_reg_ratrad_pack(ratrad_pl, nh_grp->nhgi->adj_index, in mlxsw_sp_nh_grp_activity_get()
4484 nh_grp->nhgi->count); in mlxsw_sp_nh_grp_activity_get()
4489 for (i = 0; i < nh_grp->nhgi->count; i++) { in mlxsw_sp_nh_grp_activity_get()
4503 const struct mlxsw_sp_nexthop_group *nh_grp) in mlxsw_sp_nh_grp_activity_update() argument
4507 activity = bitmap_zalloc(nh_grp->nhgi->count, GFP_KERNEL); in mlxsw_sp_nh_grp_activity_update()
4511 mlxsw_sp_nh_grp_activity_get(mlxsw_sp, nh_grp, activity); in mlxsw_sp_nh_grp_activity_update()
4512 nexthop_res_grp_activity_update(mlxsw_sp_net(mlxsw_sp), nh_grp->obj.id, in mlxsw_sp_nh_grp_activity_update()
4513 nh_grp->nhgi->count, activity); in mlxsw_sp_nh_grp_activity_update()
4539 mlxsw_sp_nh_grp_activity_update(router->mlxsw_sp, nhgi->nh_grp); in mlxsw_sp_nh_grp_activity_work()
4592 const struct nh_notifier_grp_info *nh_grp, in mlxsw_sp_nexthop_obj_group_validate() argument
4597 if (nh_grp->is_fdb) { in mlxsw_sp_nexthop_obj_group_validate()
4602 for (i = 0; i < nh_grp->num_nh; i++) { in mlxsw_sp_nexthop_obj_group_validate()
4606 nh = &nh_grp->nh_entries[i].nh; in mlxsw_sp_nexthop_obj_group_validate()
4704 info->nh_grp, in mlxsw_sp_nexthop_obj_validate()
4762 struct mlxsw_sp_nexthop_group *nh_grp, in mlxsw_sp_nexthop_obj_init() argument
4769 nh->nhgi = nh_grp->nhgi; in mlxsw_sp_nexthop_obj_init()
4800 if (nh_grp->nhgi->is_resilient && !nh->should_offload) { in mlxsw_sp_nexthop_obj_init()
4826 struct mlxsw_sp_nexthop_group *nh_grp, in mlxsw_sp_nexthop_obj_group_info_init() argument
4840 nhs = info->nh_grp->num_nh; in mlxsw_sp_nexthop_obj_group_info_init()
4853 nh_grp->nhgi = nhgi; in mlxsw_sp_nexthop_obj_group_info_init()
4854 nhgi->nh_grp = nh_grp; in mlxsw_sp_nexthop_obj_group_info_init()
4869 nh_obj = &info->nh_grp->nh_entries[i].nh; in mlxsw_sp_nexthop_obj_group_info_init()
4870 weight = info->nh_grp->nh_entries[i].weight; in mlxsw_sp_nexthop_obj_group_info_init()
4880 err = mlxsw_sp_nexthop_obj_init(mlxsw_sp, nh_grp, nh, nh_obj, in mlxsw_sp_nexthop_obj_group_info_init()
4888 err = mlxsw_sp_nexthop_group_refresh(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop_obj_group_info_init()
4920 struct mlxsw_sp_nexthop_group *nh_grp) in mlxsw_sp_nexthop_obj_group_info_fini() argument
4922 struct mlxsw_sp_nexthop_group_info *nhgi = nh_grp->nhgi; in mlxsw_sp_nexthop_obj_group_info_fini()
4938 mlxsw_sp_nexthop_group_refresh(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop_obj_group_info_fini()
4947 struct mlxsw_sp_nexthop_group *nh_grp; in mlxsw_sp_nexthop_obj_group_create() local
4950 nh_grp = kzalloc(sizeof(*nh_grp), GFP_KERNEL); in mlxsw_sp_nexthop_obj_group_create()
4951 if (!nh_grp) in mlxsw_sp_nexthop_obj_group_create()
4953 INIT_LIST_HEAD(&nh_grp->vr_list); in mlxsw_sp_nexthop_obj_group_create()
4954 err = rhashtable_init(&nh_grp->vr_ht, in mlxsw_sp_nexthop_obj_group_create()
4958 INIT_LIST_HEAD(&nh_grp->fib_list); in mlxsw_sp_nexthop_obj_group_create()
4959 nh_grp->type = MLXSW_SP_NEXTHOP_GROUP_TYPE_OBJ; in mlxsw_sp_nexthop_obj_group_create()
4960 nh_grp->obj.id = info->id; in mlxsw_sp_nexthop_obj_group_create()
4962 err = mlxsw_sp_nexthop_obj_group_info_init(mlxsw_sp, nh_grp, info); in mlxsw_sp_nexthop_obj_group_create()
4966 nh_grp->can_destroy = false; in mlxsw_sp_nexthop_obj_group_create()
4968 return nh_grp; in mlxsw_sp_nexthop_obj_group_create()
4971 rhashtable_destroy(&nh_grp->vr_ht); in mlxsw_sp_nexthop_obj_group_create()
4973 kfree(nh_grp); in mlxsw_sp_nexthop_obj_group_create()
4979 struct mlxsw_sp_nexthop_group *nh_grp) in mlxsw_sp_nexthop_obj_group_destroy() argument
4981 if (!nh_grp->can_destroy) in mlxsw_sp_nexthop_obj_group_destroy()
4983 mlxsw_sp_nexthop_obj_group_info_fini(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop_obj_group_destroy()
4984 WARN_ON_ONCE(!list_empty(&nh_grp->fib_list)); in mlxsw_sp_nexthop_obj_group_destroy()
4985 WARN_ON_ONCE(!list_empty(&nh_grp->vr_list)); in mlxsw_sp_nexthop_obj_group_destroy()
4986 rhashtable_destroy(&nh_grp->vr_ht); in mlxsw_sp_nexthop_obj_group_destroy()
4987 kfree(nh_grp); in mlxsw_sp_nexthop_obj_group_destroy()
5003 struct mlxsw_sp_nexthop_group *nh_grp) in mlxsw_sp_nexthop_obj_group_add() argument
5005 return mlxsw_sp_nexthop_group_insert(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop_obj_group_add()
5010 struct mlxsw_sp_nexthop_group *nh_grp, in mlxsw_sp_nexthop_obj_group_replace() argument
5015 struct mlxsw_sp_nexthop_group_info *new_nhgi = nh_grp->nhgi; in mlxsw_sp_nexthop_obj_group_replace()
5019 new_nhgi->nh_grp = old_nh_grp; in mlxsw_sp_nexthop_obj_group_replace()
5020 nh_grp->nhgi = old_nhgi; in mlxsw_sp_nexthop_obj_group_replace()
5021 old_nhgi->nh_grp = nh_grp; in mlxsw_sp_nexthop_obj_group_replace()
5066 nh_grp->can_destroy = true; in mlxsw_sp_nexthop_obj_group_replace()
5067 mlxsw_sp_nexthop_obj_group_destroy(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop_obj_group_replace()
5072 old_nhgi->nh_grp = old_nh_grp; in mlxsw_sp_nexthop_obj_group_replace()
5073 nh_grp->nhgi = new_nhgi; in mlxsw_sp_nexthop_obj_group_replace()
5074 new_nhgi->nh_grp = nh_grp; in mlxsw_sp_nexthop_obj_group_replace()
5082 struct mlxsw_sp_nexthop_group *nh_grp, *old_nh_grp; in mlxsw_sp_nexthop_obj_new() local
5086 nh_grp = mlxsw_sp_nexthop_obj_group_create(mlxsw_sp, info); in mlxsw_sp_nexthop_obj_new()
5087 if (IS_ERR(nh_grp)) in mlxsw_sp_nexthop_obj_new()
5088 return PTR_ERR(nh_grp); in mlxsw_sp_nexthop_obj_new()
5092 err = mlxsw_sp_nexthop_obj_group_add(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop_obj_new()
5094 err = mlxsw_sp_nexthop_obj_group_replace(mlxsw_sp, nh_grp, in mlxsw_sp_nexthop_obj_new()
5098 nh_grp->can_destroy = true; in mlxsw_sp_nexthop_obj_new()
5099 mlxsw_sp_nexthop_obj_group_destroy(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop_obj_new()
5108 struct mlxsw_sp_nexthop_group *nh_grp; in mlxsw_sp_nexthop_obj_del() local
5110 nh_grp = mlxsw_sp_nexthop_obj_group_lookup(mlxsw_sp, info->id); in mlxsw_sp_nexthop_obj_del()
5111 if (!nh_grp) in mlxsw_sp_nexthop_obj_del()
5114 nh_grp->can_destroy = true; in mlxsw_sp_nexthop_obj_del()
5115 mlxsw_sp_nexthop_group_remove(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop_obj_del()
5120 if (!list_empty(&nh_grp->fib_list)) in mlxsw_sp_nexthop_obj_del()
5122 mlxsw_sp_nexthop_obj_group_destroy(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop_obj_del()
5211 struct mlxsw_sp_nexthop_group *nh_grp; in mlxsw_sp_nexthop_obj_bucket_replace() local
5215 nh_grp = mlxsw_sp_nexthop_obj_group_lookup(mlxsw_sp, info->id); in mlxsw_sp_nexthop_obj_bucket_replace()
5216 if (!nh_grp) { in mlxsw_sp_nexthop_obj_bucket_replace()
5221 nhgi = nh_grp->nhgi; in mlxsw_sp_nexthop_obj_bucket_replace()
5232 err = mlxsw_sp_nexthop_obj_init(mlxsw_sp, nh_grp, nh, nh_obj, 1); in mlxsw_sp_nexthop_obj_bucket_replace()
5248 mlxsw_sp_nexthop_obj_init(mlxsw_sp, nh_grp, nh, nh_obj, 1); in mlxsw_sp_nexthop_obj_bucket_replace()
5301 struct mlxsw_sp_nexthop_group *nh_grp) in mlxsw_sp_nexthop4_group_info_init() argument
5303 unsigned int nhs = fib_info_num_path(nh_grp->ipv4.fi); in mlxsw_sp_nexthop4_group_info_init()
5311 nh_grp->nhgi = nhgi; in mlxsw_sp_nexthop4_group_info_init()
5312 nhgi->nh_grp = nh_grp; in mlxsw_sp_nexthop4_group_info_init()
5313 nhgi->gateway = mlxsw_sp_fi_is_gateway(mlxsw_sp, nh_grp->ipv4.fi); in mlxsw_sp_nexthop4_group_info_init()
5319 fib_nh = fib_info_nh(nh_grp->ipv4.fi, i); in mlxsw_sp_nexthop4_group_info_init()
5320 err = mlxsw_sp_nexthop4_init(mlxsw_sp, nh_grp, nh, fib_nh); in mlxsw_sp_nexthop4_group_info_init()
5327 err = mlxsw_sp_nexthop_group_refresh(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop4_group_info_init()
5348 struct mlxsw_sp_nexthop_group *nh_grp) in mlxsw_sp_nexthop4_group_info_fini() argument
5350 struct mlxsw_sp_nexthop_group_info *nhgi = nh_grp->nhgi; in mlxsw_sp_nexthop4_group_info_fini()
5359 mlxsw_sp_nexthop_group_refresh(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop4_group_info_fini()
5367 struct mlxsw_sp_nexthop_group *nh_grp; in mlxsw_sp_nexthop4_group_create() local
5370 nh_grp = kzalloc(sizeof(*nh_grp), GFP_KERNEL); in mlxsw_sp_nexthop4_group_create()
5371 if (!nh_grp) in mlxsw_sp_nexthop4_group_create()
5373 INIT_LIST_HEAD(&nh_grp->vr_list); in mlxsw_sp_nexthop4_group_create()
5374 err = rhashtable_init(&nh_grp->vr_ht, in mlxsw_sp_nexthop4_group_create()
5378 INIT_LIST_HEAD(&nh_grp->fib_list); in mlxsw_sp_nexthop4_group_create()
5379 nh_grp->type = MLXSW_SP_NEXTHOP_GROUP_TYPE_IPV4; in mlxsw_sp_nexthop4_group_create()
5380 nh_grp->ipv4.fi = fi; in mlxsw_sp_nexthop4_group_create()
5383 err = mlxsw_sp_nexthop4_group_info_init(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop4_group_create()
5387 err = mlxsw_sp_nexthop_group_insert(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop4_group_create()
5391 nh_grp->can_destroy = true; in mlxsw_sp_nexthop4_group_create()
5393 return nh_grp; in mlxsw_sp_nexthop4_group_create()
5396 mlxsw_sp_nexthop4_group_info_fini(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop4_group_create()
5399 rhashtable_destroy(&nh_grp->vr_ht); in mlxsw_sp_nexthop4_group_create()
5401 kfree(nh_grp); in mlxsw_sp_nexthop4_group_create()
5407 struct mlxsw_sp_nexthop_group *nh_grp) in mlxsw_sp_nexthop4_group_destroy() argument
5409 if (!nh_grp->can_destroy) in mlxsw_sp_nexthop4_group_destroy()
5411 mlxsw_sp_nexthop_group_remove(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop4_group_destroy()
5412 mlxsw_sp_nexthop4_group_info_fini(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop4_group_destroy()
5413 fib_info_put(nh_grp->ipv4.fi); in mlxsw_sp_nexthop4_group_destroy()
5414 WARN_ON_ONCE(!list_empty(&nh_grp->vr_list)); in mlxsw_sp_nexthop4_group_destroy()
5415 rhashtable_destroy(&nh_grp->vr_ht); in mlxsw_sp_nexthop4_group_destroy()
5416 kfree(nh_grp); in mlxsw_sp_nexthop4_group_destroy()
5423 struct mlxsw_sp_nexthop_group *nh_grp; in mlxsw_sp_nexthop4_group_get() local
5426 nh_grp = mlxsw_sp_nexthop_obj_group_lookup(mlxsw_sp, in mlxsw_sp_nexthop4_group_get()
5428 if (WARN_ON_ONCE(!nh_grp)) in mlxsw_sp_nexthop4_group_get()
5433 nh_grp = mlxsw_sp_nexthop4_group_lookup(mlxsw_sp, fi); in mlxsw_sp_nexthop4_group_get()
5434 if (!nh_grp) { in mlxsw_sp_nexthop4_group_get()
5435 nh_grp = mlxsw_sp_nexthop4_group_create(mlxsw_sp, fi); in mlxsw_sp_nexthop4_group_get()
5436 if (IS_ERR(nh_grp)) in mlxsw_sp_nexthop4_group_get()
5437 return PTR_ERR(nh_grp); in mlxsw_sp_nexthop4_group_get()
5440 list_add_tail(&fib_entry->nexthop_group_node, &nh_grp->fib_list); in mlxsw_sp_nexthop4_group_get()
5441 fib_entry->nh_group = nh_grp; in mlxsw_sp_nexthop4_group_get()
5448 struct mlxsw_sp_nexthop_group *nh_grp = fib_entry->nh_group; in mlxsw_sp_nexthop4_group_put() local
5451 if (!list_empty(&nh_grp->fib_list)) in mlxsw_sp_nexthop4_group_put()
5454 if (nh_grp->type == MLXSW_SP_NEXTHOP_GROUP_TYPE_OBJ) { in mlxsw_sp_nexthop4_group_put()
5455 mlxsw_sp_nexthop_obj_group_destroy(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop4_group_put()
5459 mlxsw_sp_nexthop4_group_destroy(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop4_group_put()
5501 mlxsw_sp_rt6_nexthop(struct mlxsw_sp_nexthop_group *nh_grp, in mlxsw_sp_rt6_nexthop() argument
5506 for (i = 0; i < nh_grp->nhgi->count; i++) { in mlxsw_sp_rt6_nexthop()
5507 struct mlxsw_sp_nexthop *nh = &nh_grp->nhgi->nexthops[i]; in mlxsw_sp_rt6_nexthop()
6498 struct mlxsw_sp_nexthop_group *nh_grp, in mlxsw_sp_nexthop6_init() argument
6505 nh->nhgi = nh_grp->nhgi; in mlxsw_sp_nexthop6_init()
6548 struct mlxsw_sp_nexthop_group *nh_grp, in mlxsw_sp_nexthop6_group_info_init() argument
6560 nh_grp->nhgi = nhgi; in mlxsw_sp_nexthop6_group_info_init()
6561 nhgi->nh_grp = nh_grp; in mlxsw_sp_nexthop6_group_info_init()
6570 err = mlxsw_sp_nexthop6_init(mlxsw_sp, nh_grp, nh, rt); in mlxsw_sp_nexthop6_group_info_init()
6575 nh_grp->nhgi = nhgi; in mlxsw_sp_nexthop6_group_info_init()
6579 err = mlxsw_sp_nexthop_group_refresh(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop6_group_info_init()
6600 struct mlxsw_sp_nexthop_group *nh_grp) in mlxsw_sp_nexthop6_group_info_fini() argument
6602 struct mlxsw_sp_nexthop_group_info *nhgi = nh_grp->nhgi; in mlxsw_sp_nexthop6_group_info_fini()
6611 mlxsw_sp_nexthop_group_refresh(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop6_group_info_fini()
6620 struct mlxsw_sp_nexthop_group *nh_grp; in mlxsw_sp_nexthop6_group_create() local
6623 nh_grp = kzalloc(sizeof(*nh_grp), GFP_KERNEL); in mlxsw_sp_nexthop6_group_create()
6624 if (!nh_grp) in mlxsw_sp_nexthop6_group_create()
6626 INIT_LIST_HEAD(&nh_grp->vr_list); in mlxsw_sp_nexthop6_group_create()
6627 err = rhashtable_init(&nh_grp->vr_ht, in mlxsw_sp_nexthop6_group_create()
6631 INIT_LIST_HEAD(&nh_grp->fib_list); in mlxsw_sp_nexthop6_group_create()
6632 nh_grp->type = MLXSW_SP_NEXTHOP_GROUP_TYPE_IPV6; in mlxsw_sp_nexthop6_group_create()
6634 err = mlxsw_sp_nexthop6_group_info_init(mlxsw_sp, nh_grp, fib6_entry); in mlxsw_sp_nexthop6_group_create()
6638 err = mlxsw_sp_nexthop_group_insert(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop6_group_create()
6642 nh_grp->can_destroy = true; in mlxsw_sp_nexthop6_group_create()
6644 return nh_grp; in mlxsw_sp_nexthop6_group_create()
6647 mlxsw_sp_nexthop6_group_info_fini(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop6_group_create()
6649 rhashtable_destroy(&nh_grp->vr_ht); in mlxsw_sp_nexthop6_group_create()
6651 kfree(nh_grp); in mlxsw_sp_nexthop6_group_create()
6657 struct mlxsw_sp_nexthop_group *nh_grp) in mlxsw_sp_nexthop6_group_destroy() argument
6659 if (!nh_grp->can_destroy) in mlxsw_sp_nexthop6_group_destroy()
6661 mlxsw_sp_nexthop_group_remove(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop6_group_destroy()
6662 mlxsw_sp_nexthop6_group_info_fini(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop6_group_destroy()
6663 WARN_ON_ONCE(!list_empty(&nh_grp->vr_list)); in mlxsw_sp_nexthop6_group_destroy()
6664 rhashtable_destroy(&nh_grp->vr_ht); in mlxsw_sp_nexthop6_group_destroy()
6665 kfree(nh_grp); in mlxsw_sp_nexthop6_group_destroy()
6672 struct mlxsw_sp_nexthop_group *nh_grp; in mlxsw_sp_nexthop6_group_get() local
6675 nh_grp = mlxsw_sp_nexthop_obj_group_lookup(mlxsw_sp, in mlxsw_sp_nexthop6_group_get()
6677 if (WARN_ON_ONCE(!nh_grp)) in mlxsw_sp_nexthop6_group_get()
6682 nh_grp = mlxsw_sp_nexthop6_group_lookup(mlxsw_sp, fib6_entry); in mlxsw_sp_nexthop6_group_get()
6683 if (!nh_grp) { in mlxsw_sp_nexthop6_group_get()
6684 nh_grp = mlxsw_sp_nexthop6_group_create(mlxsw_sp, fib6_entry); in mlxsw_sp_nexthop6_group_get()
6685 if (IS_ERR(nh_grp)) in mlxsw_sp_nexthop6_group_get()
6686 return PTR_ERR(nh_grp); in mlxsw_sp_nexthop6_group_get()
6692 __mlxsw_sp_nexthop6_group_offload_refresh(nh_grp, fib6_entry); in mlxsw_sp_nexthop6_group_get()
6696 &nh_grp->fib_list); in mlxsw_sp_nexthop6_group_get()
6697 fib6_entry->common.nh_group = nh_grp; in mlxsw_sp_nexthop6_group_get()
6705 struct mlxsw_sp_nexthop_group *nh_grp = fib_entry->nh_group; in mlxsw_sp_nexthop6_group_put() local
6708 if (!list_empty(&nh_grp->fib_list)) in mlxsw_sp_nexthop6_group_put()
6711 if (nh_grp->type == MLXSW_SP_NEXTHOP_GROUP_TYPE_OBJ) { in mlxsw_sp_nexthop6_group_put()
6712 mlxsw_sp_nexthop_obj_group_destroy(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop6_group_put()
6716 mlxsw_sp_nexthop6_group_destroy(mlxsw_sp, nh_grp); in mlxsw_sp_nexthop6_group_put()