Lines Matching refs:fib6_entry
2841 struct mlxsw_sp_fib6_entry *fib6_entry; member
2866 const struct mlxsw_sp_fib6_entry *fib6_entry) in mlxsw_sp_nexthop6_group_cmp() argument
2870 if (nh_grp->count != fib6_entry->nrt6) in mlxsw_sp_nexthop6_group_cmp()
2873 list_for_each_entry(mlxsw_sp_rt6, &fib6_entry->rt6_list, list) { in mlxsw_sp_nexthop6_group_cmp()
2900 cmp_arg->fib6_entry); in mlxsw_sp_nexthop_group_cmp()
2939 mlxsw_sp_nexthop6_group_hash(struct mlxsw_sp_fib6_entry *fib6_entry, u32 seed) in mlxsw_sp_nexthop6_group_hash() argument
2941 unsigned int val = fib6_entry->nrt6; in mlxsw_sp_nexthop6_group_hash()
2945 list_for_each_entry(mlxsw_sp_rt6, &fib6_entry->rt6_list, list) { in mlxsw_sp_nexthop6_group_hash()
2962 return mlxsw_sp_nexthop6_group_hash(cmp_arg->fib6_entry, seed); in mlxsw_sp_nexthop_group_hash()
3015 struct mlxsw_sp_fib6_entry *fib6_entry) in mlxsw_sp_nexthop6_group_lookup() argument
3020 cmp_arg.fib6_entry = fib6_entry; in mlxsw_sp_nexthop6_group_lookup()
4069 struct mlxsw_sp_fib6_entry *fib6_entry; in mlxsw_sp_fib6_entry_offload_set() local
4072 fib6_entry = container_of(fib_entry, struct mlxsw_sp_fib6_entry, in mlxsw_sp_fib6_entry_offload_set()
4077 list_first_entry(&fib6_entry->rt6_list, struct mlxsw_sp_rt6, in mlxsw_sp_fib6_entry_offload_set()
4082 list_for_each_entry(mlxsw_sp_rt6, &fib6_entry->rt6_list, list) { in mlxsw_sp_fib6_entry_offload_set()
4098 struct mlxsw_sp_fib6_entry *fib6_entry; in mlxsw_sp_fib6_entry_offload_unset() local
4101 fib6_entry = container_of(fib_entry, struct mlxsw_sp_fib6_entry, in mlxsw_sp_fib6_entry_offload_unset()
4103 list_for_each_entry(mlxsw_sp_rt6, &fib6_entry->rt6_list, list) { in mlxsw_sp_fib6_entry_offload_unset()
4989 mlxsw_sp_fib6_entry_rt(const struct mlxsw_sp_fib6_entry *fib6_entry) in mlxsw_sp_fib6_entry_rt() argument
4991 return list_first_entry(&fib6_entry->rt6_list, struct mlxsw_sp_rt6, in mlxsw_sp_fib6_entry_rt()
4999 struct mlxsw_sp_fib6_entry *fib6_entry; in mlxsw_sp_fib6_node_mp_entry_find() local
5004 list_for_each_entry(fib6_entry, &fib_node->entry_list, common.list) { in mlxsw_sp_fib6_node_mp_entry_find()
5005 struct fib6_info *rt = mlxsw_sp_fib6_entry_rt(fib6_entry); in mlxsw_sp_fib6_node_mp_entry_find()
5018 return fib6_entry; in mlxsw_sp_fib6_node_mp_entry_find()
5027 mlxsw_sp_fib6_entry_rt_find(const struct mlxsw_sp_fib6_entry *fib6_entry, in mlxsw_sp_fib6_entry_rt_find() argument
5032 list_for_each_entry(mlxsw_sp_rt6, &fib6_entry->rt6_list, list) { in mlxsw_sp_fib6_entry_rt_find()
5131 struct mlxsw_sp_fib6_entry *fib6_entry) in mlxsw_sp_nexthop6_group_create() argument
5139 nh_grp = kzalloc(struct_size(nh_grp, nexthops, fib6_entry->nrt6), in mlxsw_sp_nexthop6_group_create()
5147 mlxsw_sp_rt6 = list_first_entry(&fib6_entry->rt6_list, in mlxsw_sp_nexthop6_group_create()
5150 nh_grp->count = fib6_entry->nrt6; in mlxsw_sp_nexthop6_group_create()
5196 struct mlxsw_sp_fib6_entry *fib6_entry) in mlxsw_sp_nexthop6_group_get() argument
5200 nh_grp = mlxsw_sp_nexthop6_group_lookup(mlxsw_sp, fib6_entry); in mlxsw_sp_nexthop6_group_get()
5202 nh_grp = mlxsw_sp_nexthop6_group_create(mlxsw_sp, fib6_entry); in mlxsw_sp_nexthop6_group_get()
5207 list_add_tail(&fib6_entry->common.nexthop_group_node, in mlxsw_sp_nexthop6_group_get()
5209 fib6_entry->common.nh_group = nh_grp; in mlxsw_sp_nexthop6_group_get()
5227 struct mlxsw_sp_fib6_entry *fib6_entry) in mlxsw_sp_nexthop6_group_update() argument
5229 struct mlxsw_sp_nexthop_group *old_nh_grp = fib6_entry->common.nh_group; in mlxsw_sp_nexthop6_group_update()
5232 fib6_entry->common.nh_group = NULL; in mlxsw_sp_nexthop6_group_update()
5233 list_del(&fib6_entry->common.nexthop_group_node); in mlxsw_sp_nexthop6_group_update()
5235 err = mlxsw_sp_nexthop6_group_get(mlxsw_sp, fib6_entry); in mlxsw_sp_nexthop6_group_update()
5243 err = mlxsw_sp_fib_node_entry_add(mlxsw_sp, &fib6_entry->common); in mlxsw_sp_nexthop6_group_update()
5253 mlxsw_sp_nexthop6_group_put(mlxsw_sp, &fib6_entry->common); in mlxsw_sp_nexthop6_group_update()
5255 list_add_tail(&fib6_entry->common.nexthop_group_node, in mlxsw_sp_nexthop6_group_update()
5257 fib6_entry->common.nh_group = old_nh_grp; in mlxsw_sp_nexthop6_group_update()
5263 struct mlxsw_sp_fib6_entry *fib6_entry, in mlxsw_sp_fib6_entry_nexthop_add() argument
5276 list_add_tail(&mlxsw_sp_rt6->list, &fib6_entry->rt6_list); in mlxsw_sp_fib6_entry_nexthop_add()
5277 fib6_entry->nrt6++; in mlxsw_sp_fib6_entry_nexthop_add()
5280 err = mlxsw_sp_nexthop6_group_update(mlxsw_sp, fib6_entry); in mlxsw_sp_fib6_entry_nexthop_add()
5290 fib6_entry->nrt6--; in mlxsw_sp_fib6_entry_nexthop_add()
5291 mlxsw_sp_rt6 = list_last_entry(&fib6_entry->rt6_list, in mlxsw_sp_fib6_entry_nexthop_add()
5301 struct mlxsw_sp_fib6_entry *fib6_entry, in mlxsw_sp_fib6_entry_nexthop_del() argument
5308 mlxsw_sp_rt6 = mlxsw_sp_fib6_entry_rt_find(fib6_entry, in mlxsw_sp_fib6_entry_nexthop_del()
5313 fib6_entry->nrt6--; in mlxsw_sp_fib6_entry_nexthop_del()
5318 mlxsw_sp_nexthop6_group_update(mlxsw_sp, fib6_entry); in mlxsw_sp_fib6_entry_nexthop_del()
5344 mlxsw_sp_fib6_entry_rt_destroy_all(struct mlxsw_sp_fib6_entry *fib6_entry) in mlxsw_sp_fib6_entry_rt_destroy_all() argument
5348 list_for_each_entry_safe(mlxsw_sp_rt6, tmp, &fib6_entry->rt6_list, in mlxsw_sp_fib6_entry_rt_destroy_all()
5350 fib6_entry->nrt6--; in mlxsw_sp_fib6_entry_rt_destroy_all()
5361 struct mlxsw_sp_fib6_entry *fib6_entry; in mlxsw_sp_fib6_entry_create() local
5366 fib6_entry = kzalloc(sizeof(*fib6_entry), GFP_KERNEL); in mlxsw_sp_fib6_entry_create()
5367 if (!fib6_entry) in mlxsw_sp_fib6_entry_create()
5369 fib_entry = &fib6_entry->common; in mlxsw_sp_fib6_entry_create()
5371 INIT_LIST_HEAD(&fib6_entry->rt6_list); in mlxsw_sp_fib6_entry_create()
5379 list_add_tail(&mlxsw_sp_rt6->list, &fib6_entry->rt6_list); in mlxsw_sp_fib6_entry_create()
5380 fib6_entry->nrt6++; in mlxsw_sp_fib6_entry_create()
5385 err = mlxsw_sp_nexthop6_group_get(mlxsw_sp, fib6_entry); in mlxsw_sp_fib6_entry_create()
5391 return fib6_entry; in mlxsw_sp_fib6_entry_create()
5397 fib6_entry->nrt6--; in mlxsw_sp_fib6_entry_create()
5398 mlxsw_sp_rt6 = list_last_entry(&fib6_entry->rt6_list, in mlxsw_sp_fib6_entry_create()
5403 kfree(fib6_entry); in mlxsw_sp_fib6_entry_create()
5408 struct mlxsw_sp_fib6_entry *fib6_entry) in mlxsw_sp_fib6_entry_destroy() argument
5410 mlxsw_sp_nexthop6_group_put(mlxsw_sp, &fib6_entry->common); in mlxsw_sp_fib6_entry_destroy()
5411 mlxsw_sp_fib6_entry_rt_destroy_all(fib6_entry); in mlxsw_sp_fib6_entry_destroy()
5412 WARN_ON(fib6_entry->nrt6); in mlxsw_sp_fib6_entry_destroy()
5413 kfree(fib6_entry); in mlxsw_sp_fib6_entry_destroy()
5420 struct mlxsw_sp_fib6_entry *fib6_entry, *fallback = NULL; in mlxsw_sp_fib6_node_entry_find() local
5422 list_for_each_entry(fib6_entry, &fib_node->entry_list, common.list) { in mlxsw_sp_fib6_node_entry_find()
5423 struct fib6_info *rt = mlxsw_sp_fib6_entry_rt(fib6_entry); in mlxsw_sp_fib6_node_entry_find()
5432 return fib6_entry; in mlxsw_sp_fib6_node_entry_find()
5434 fallback = fallback ?: fib6_entry; in mlxsw_sp_fib6_node_entry_find()
5437 return fallback ?: fib6_entry; in mlxsw_sp_fib6_node_entry_find()
5449 struct mlxsw_sp_fib6_entry *fib6_entry; in mlxsw_sp_fib6_node_list_insert() local
5451 fib6_entry = mlxsw_sp_fib6_node_entry_find(fib_node, nrt, *p_replace); in mlxsw_sp_fib6_node_list_insert()
5453 if (*p_replace && !fib6_entry) in mlxsw_sp_fib6_node_list_insert()
5456 if (fib6_entry) { in mlxsw_sp_fib6_node_list_insert()
5458 &fib6_entry->common.list); in mlxsw_sp_fib6_node_list_insert()
5467 fib6_entry = last; in mlxsw_sp_fib6_node_list_insert()
5470 if (fib6_entry) in mlxsw_sp_fib6_node_list_insert()
5472 &fib6_entry->common.list); in mlxsw_sp_fib6_node_list_insert()
5482 mlxsw_sp_fib6_node_list_remove(struct mlxsw_sp_fib6_entry *fib6_entry) in mlxsw_sp_fib6_node_list_remove() argument
5484 list_del(&fib6_entry->common.list); in mlxsw_sp_fib6_node_list_remove()
5488 struct mlxsw_sp_fib6_entry *fib6_entry, in mlxsw_sp_fib6_node_entry_link() argument
5493 err = mlxsw_sp_fib6_node_list_insert(fib6_entry, p_replace); in mlxsw_sp_fib6_node_entry_link()
5497 err = mlxsw_sp_fib_node_entry_add(mlxsw_sp, &fib6_entry->common); in mlxsw_sp_fib6_node_entry_link()
5504 mlxsw_sp_fib6_node_list_remove(fib6_entry); in mlxsw_sp_fib6_node_entry_link()
5510 struct mlxsw_sp_fib6_entry *fib6_entry) in mlxsw_sp_fib6_node_entry_unlink() argument
5512 mlxsw_sp_fib_node_entry_del(mlxsw_sp, &fib6_entry->common); in mlxsw_sp_fib6_node_entry_unlink()
5513 mlxsw_sp_fib6_node_list_remove(fib6_entry); in mlxsw_sp_fib6_node_entry_unlink()
5520 struct mlxsw_sp_fib6_entry *fib6_entry; in mlxsw_sp_fib6_entry_lookup() local
5536 list_for_each_entry(fib6_entry, &fib_node->entry_list, common.list) { in mlxsw_sp_fib6_entry_lookup()
5537 struct fib6_info *iter_rt = mlxsw_sp_fib6_entry_rt(fib6_entry); in mlxsw_sp_fib6_entry_lookup()
5541 mlxsw_sp_fib6_entry_rt_find(fib6_entry, rt)) in mlxsw_sp_fib6_entry_lookup()
5542 return fib6_entry; in mlxsw_sp_fib6_entry_lookup()
5549 struct mlxsw_sp_fib6_entry *fib6_entry, in mlxsw_sp_fib6_entry_replace() argument
5552 struct mlxsw_sp_fib_node *fib_node = fib6_entry->common.fib_node; in mlxsw_sp_fib6_entry_replace()
5558 replaced = list_next_entry(fib6_entry, common.list); in mlxsw_sp_fib6_entry_replace()
5569 struct mlxsw_sp_fib6_entry *fib6_entry; in mlxsw_sp_router_fib6_add() local
5594 fib6_entry = mlxsw_sp_fib6_node_mp_entry_find(fib_node, rt, replace); in mlxsw_sp_router_fib6_add()
5595 if (fib6_entry) { in mlxsw_sp_router_fib6_add()
5596 err = mlxsw_sp_fib6_entry_nexthop_add(mlxsw_sp, fib6_entry, in mlxsw_sp_router_fib6_add()
5603 fib6_entry = mlxsw_sp_fib6_entry_create(mlxsw_sp, fib_node, rt_arr, in mlxsw_sp_router_fib6_add()
5605 if (IS_ERR(fib6_entry)) { in mlxsw_sp_router_fib6_add()
5606 err = PTR_ERR(fib6_entry); in mlxsw_sp_router_fib6_add()
5610 err = mlxsw_sp_fib6_node_entry_link(mlxsw_sp, fib6_entry, &replace); in mlxsw_sp_router_fib6_add()
5614 mlxsw_sp_fib6_entry_replace(mlxsw_sp, fib6_entry, replace); in mlxsw_sp_router_fib6_add()
5619 mlxsw_sp_fib6_entry_destroy(mlxsw_sp, fib6_entry); in mlxsw_sp_router_fib6_add()
5630 struct mlxsw_sp_fib6_entry *fib6_entry; in mlxsw_sp_router_fib6_del() local
5640 fib6_entry = mlxsw_sp_fib6_entry_lookup(mlxsw_sp, rt); in mlxsw_sp_router_fib6_del()
5641 if (WARN_ON(!fib6_entry)) in mlxsw_sp_router_fib6_del()
5647 if (nrt6 != fib6_entry->nrt6) { in mlxsw_sp_router_fib6_del()
5648 mlxsw_sp_fib6_entry_nexthop_del(mlxsw_sp, fib6_entry, rt_arr, in mlxsw_sp_router_fib6_del()
5653 fib_node = fib6_entry->common.fib_node; in mlxsw_sp_router_fib6_del()
5655 mlxsw_sp_fib6_node_entry_unlink(mlxsw_sp, fib6_entry); in mlxsw_sp_router_fib6_del()
5656 mlxsw_sp_fib6_entry_destroy(mlxsw_sp, fib6_entry); in mlxsw_sp_router_fib6_del()
5830 struct mlxsw_sp_fib6_entry *fib6_entry, *tmp; in mlxsw_sp_fib6_node_flush() local
5832 list_for_each_entry_safe(fib6_entry, tmp, &fib_node->entry_list, in mlxsw_sp_fib6_node_flush()
5836 mlxsw_sp_fib6_node_entry_unlink(mlxsw_sp, fib6_entry); in mlxsw_sp_fib6_node_flush()
5837 mlxsw_sp_fib6_entry_destroy(mlxsw_sp, fib6_entry); in mlxsw_sp_fib6_node_flush()