Lines Matching refs:nh

3016 				    struct mlxsw_sp_nexthop *nh)  in mlxsw_sp_nexthop_counter_alloc()  argument
3025 if (mlxsw_sp_flow_counter_alloc(mlxsw_sp, &nh->counter_index)) in mlxsw_sp_nexthop_counter_alloc()
3028 nh->counter_valid = true; in mlxsw_sp_nexthop_counter_alloc()
3032 struct mlxsw_sp_nexthop *nh) in mlxsw_sp_nexthop_counter_free() argument
3034 if (!nh->counter_valid) in mlxsw_sp_nexthop_counter_free()
3036 mlxsw_sp_flow_counter_free(mlxsw_sp, nh->counter_index); in mlxsw_sp_nexthop_counter_free()
3037 nh->counter_valid = false; in mlxsw_sp_nexthop_counter_free()
3041 struct mlxsw_sp_nexthop *nh, u64 *p_counter) in mlxsw_sp_nexthop_counter_get() argument
3043 if (!nh->counter_valid) in mlxsw_sp_nexthop_counter_get()
3046 return mlxsw_sp_flow_counter_get(mlxsw_sp, nh->counter_index, in mlxsw_sp_nexthop_counter_get()
3051 struct mlxsw_sp_nexthop *nh) in mlxsw_sp_nexthop_next() argument
3053 if (!nh) { in mlxsw_sp_nexthop_next()
3058 typeof(*nh), router_list_node); in mlxsw_sp_nexthop_next()
3060 if (list_is_last(&nh->router_list_node, &router->nexthop_list)) in mlxsw_sp_nexthop_next()
3062 return list_next_entry(nh, router_list_node); in mlxsw_sp_nexthop_next()
3065 bool mlxsw_sp_nexthop_is_forward(const struct mlxsw_sp_nexthop *nh) in mlxsw_sp_nexthop_is_forward() argument
3067 return nh->offloaded && nh->action == MLXSW_SP_NEXTHOP_ACTION_FORWARD; in mlxsw_sp_nexthop_is_forward()
3070 unsigned char *mlxsw_sp_nexthop_ha(struct mlxsw_sp_nexthop *nh) in mlxsw_sp_nexthop_ha() argument
3072 if (nh->type != MLXSW_SP_NEXTHOP_TYPE_ETH || in mlxsw_sp_nexthop_ha()
3073 !mlxsw_sp_nexthop_is_forward(nh)) in mlxsw_sp_nexthop_ha()
3075 return nh->neigh_entry->ha; in mlxsw_sp_nexthop_ha()
3078 int mlxsw_sp_nexthop_indexes(struct mlxsw_sp_nexthop *nh, u32 *p_adj_index, in mlxsw_sp_nexthop_indexes() argument
3081 struct mlxsw_sp_nexthop_group_info *nhgi = nh->nhgi; in mlxsw_sp_nexthop_indexes()
3085 if (!nh->offloaded || !nhgi->adj_index_valid) in mlxsw_sp_nexthop_indexes()
3094 if (nh_iter == nh) in mlxsw_sp_nexthop_indexes()
3104 struct mlxsw_sp_rif *mlxsw_sp_nexthop_rif(struct mlxsw_sp_nexthop *nh) in mlxsw_sp_nexthop_rif() argument
3106 return nh->rif; in mlxsw_sp_nexthop_rif()
3109 bool mlxsw_sp_nexthop_group_has_ipip(struct mlxsw_sp_nexthop *nh) in mlxsw_sp_nexthop_group_has_ipip() argument
3111 struct mlxsw_sp_nexthop_group_info *nhgi = nh->nhgi; in mlxsw_sp_nexthop_group_has_ipip()
3230 const struct mlxsw_sp_nexthop *nh; in mlxsw_sp_nexthop6_group_has_nexthop() local
3232 nh = &nh_grp->nhgi->nexthops[i]; in mlxsw_sp_nexthop6_group_has_nexthop()
3233 if (nh->ifindex == ifindex && nh->nh_weight == weight && in mlxsw_sp_nexthop6_group_has_nexthop()
3234 ipv6_addr_equal(gw, (struct in6_addr *) nh->gw_addr)) in mlxsw_sp_nexthop6_group_has_nexthop()
3292 const struct mlxsw_sp_nexthop *nh; in mlxsw_sp_nexthop_group_hash_obj() local
3304 nh = &nh_grp->nhgi->nexthops[i]; in mlxsw_sp_nexthop_group_hash_obj()
3305 val ^= jhash(&nh->ifindex, sizeof(nh->ifindex), seed); in mlxsw_sp_nexthop_group_hash_obj()
3306 val ^= jhash(&nh->gw_addr, sizeof(nh->gw_addr), seed); in mlxsw_sp_nexthop_group_hash_obj()
3417 struct mlxsw_sp_nexthop *nh) in mlxsw_sp_nexthop_insert() argument
3420 &nh->ht_node, mlxsw_sp_nexthop_ht_params); in mlxsw_sp_nexthop_insert()
3424 struct mlxsw_sp_nexthop *nh) in mlxsw_sp_nexthop_remove() argument
3426 rhashtable_remove_fast(&mlxsw_sp->router->nexthop_ht, &nh->ht_node, in mlxsw_sp_nexthop_remove()
3487 struct mlxsw_sp_nexthop *nh, in __mlxsw_sp_nexthop_eth_update() argument
3490 struct mlxsw_sp_neigh_entry *neigh_entry = nh->neigh_entry; in __mlxsw_sp_nexthop_eth_update()
3494 rif_index = nh->rif ? nh->rif->rif_index : in __mlxsw_sp_nexthop_eth_update()
3500 switch (nh->action) { in __mlxsw_sp_nexthop_eth_update()
3517 if (nh->counter_valid) in __mlxsw_sp_nexthop_eth_update()
3518 mlxsw_reg_ratr_counter_pack(ratr_pl, nh->counter_index, true); in __mlxsw_sp_nexthop_eth_update()
3526 struct mlxsw_sp_nexthop *nh, bool force, in mlxsw_sp_nexthop_eth_update() argument
3531 for (i = 0; i < nh->num_adj_entries; i++) { in mlxsw_sp_nexthop_eth_update()
3535 nh, force, ratr_pl); in mlxsw_sp_nexthop_eth_update()
3545 struct mlxsw_sp_nexthop *nh, in __mlxsw_sp_nexthop_ipip_update() argument
3550 ipip_ops = mlxsw_sp->router->ipip_ops_arr[nh->ipip_entry->ipipt]; in __mlxsw_sp_nexthop_ipip_update()
3551 return ipip_ops->nexthop_update(mlxsw_sp, adj_index, nh->ipip_entry, in __mlxsw_sp_nexthop_ipip_update()
3557 struct mlxsw_sp_nexthop *nh, bool force, in mlxsw_sp_nexthop_ipip_update() argument
3562 for (i = 0; i < nh->num_adj_entries; i++) { in mlxsw_sp_nexthop_ipip_update()
3566 nh, force, ratr_pl); in mlxsw_sp_nexthop_ipip_update()
3575 struct mlxsw_sp_nexthop *nh, bool force, in mlxsw_sp_nexthop_update() argument
3581 if (nh->type == MLXSW_SP_NEXTHOP_TYPE_ETH || in mlxsw_sp_nexthop_update()
3582 nh->action == MLXSW_SP_NEXTHOP_ACTION_DISCARD || in mlxsw_sp_nexthop_update()
3583 nh->action == MLXSW_SP_NEXTHOP_ACTION_TRAP) in mlxsw_sp_nexthop_update()
3584 return mlxsw_sp_nexthop_eth_update(mlxsw_sp, adj_index, nh, in mlxsw_sp_nexthop_update()
3587 return mlxsw_sp_nexthop_ipip_update(mlxsw_sp, adj_index, nh, in mlxsw_sp_nexthop_update()
3598 struct mlxsw_sp_nexthop *nh; in mlxsw_sp_nexthop_group_update() local
3602 nh = &nhgi->nexthops[i]; in mlxsw_sp_nexthop_group_update()
3604 if (!nh->should_offload) { in mlxsw_sp_nexthop_group_update()
3605 nh->offloaded = 0; in mlxsw_sp_nexthop_group_update()
3609 if (nh->update || reallocate) { in mlxsw_sp_nexthop_group_update()
3612 err = mlxsw_sp_nexthop_update(mlxsw_sp, adj_index, nh, in mlxsw_sp_nexthop_group_update()
3616 nh->update = 0; in mlxsw_sp_nexthop_group_update()
3617 nh->offloaded = 1; in mlxsw_sp_nexthop_group_update()
3619 adj_index += nh->num_adj_entries; in mlxsw_sp_nexthop_group_update()
3732 struct mlxsw_sp_nexthop *nh; in mlxsw_sp_nexthop_group_normalize() local
3735 nh = &nhgi->nexthops[i]; in mlxsw_sp_nexthop_group_normalize()
3737 if (!nh->should_offload) in mlxsw_sp_nexthop_group_normalize()
3740 g = gcd(nh->nh_weight, g); in mlxsw_sp_nexthop_group_normalize()
3742 g = nh->nh_weight; in mlxsw_sp_nexthop_group_normalize()
3746 nh = &nhgi->nexthops[i]; in mlxsw_sp_nexthop_group_normalize()
3748 if (!nh->should_offload) in mlxsw_sp_nexthop_group_normalize()
3750 nh->norm_nh_weight = nh->nh_weight / g; in mlxsw_sp_nexthop_group_normalize()
3751 sum_norm_weight += nh->norm_nh_weight; in mlxsw_sp_nexthop_group_normalize()
3765 struct mlxsw_sp_nexthop *nh = &nhgi->nexthops[i]; in mlxsw_sp_nexthop_group_rebalance() local
3768 if (!nh->should_offload) in mlxsw_sp_nexthop_group_rebalance()
3770 weight += nh->norm_nh_weight; in mlxsw_sp_nexthop_group_rebalance()
3772 nh->num_adj_entries = upper_bound - lower_bound; in mlxsw_sp_nexthop_group_rebalance()
3788 struct mlxsw_sp_nexthop *nh = &nh_grp->nhgi->nexthops[i]; in mlxsw_sp_nexthop4_group_offload_refresh() local
3790 if (nh->offloaded) in mlxsw_sp_nexthop4_group_offload_refresh()
3791 nh->key.fib_nh->fib_nh_flags |= RTNH_F_OFFLOAD; in mlxsw_sp_nexthop4_group_offload_refresh()
3793 nh->key.fib_nh->fib_nh_flags &= ~RTNH_F_OFFLOAD; in mlxsw_sp_nexthop4_group_offload_refresh()
3805 struct mlxsw_sp_nexthop *nh; in __mlxsw_sp_nexthop6_group_offload_refresh() local
3807 nh = mlxsw_sp_rt6_nexthop(nh_grp, mlxsw_sp_rt6); in __mlxsw_sp_nexthop6_group_offload_refresh()
3808 if (nh && nh->offloaded) in __mlxsw_sp_nexthop6_group_offload_refresh()
3832 const struct mlxsw_sp_nexthop *nh, in mlxsw_sp_nexthop_bucket_offload_refresh() argument
3835 struct mlxsw_sp_nexthop_group *nh_grp = nh->nhgi->nh_grp; in mlxsw_sp_nexthop_bucket_offload_refresh()
3838 if (nh->offloaded) { in mlxsw_sp_nexthop_bucket_offload_refresh()
3839 if (nh->action == MLXSW_SP_NEXTHOP_ACTION_TRAP) in mlxsw_sp_nexthop_bucket_offload_refresh()
3875 struct mlxsw_sp_nexthop *nh = &nh_grp->nhgi->nexthops[i]; in mlxsw_sp_nexthop_obj_group_offload_refresh() local
3877 mlxsw_sp_nexthop_bucket_offload_refresh(mlxsw_sp, nh, i); in mlxsw_sp_nexthop_obj_group_offload_refresh()
3904 struct mlxsw_sp_nexthop *nh; in mlxsw_sp_nexthop_group_refresh() local
3915 nh = &nhgi->nexthops[i]; in mlxsw_sp_nexthop_group_refresh()
3917 if (nh->should_offload != nh->offloaded) { in mlxsw_sp_nexthop_group_refresh()
3919 if (nh->should_offload) in mlxsw_sp_nexthop_group_refresh()
3920 nh->update = 1; in mlxsw_sp_nexthop_group_refresh()
4004 nh = &nhgi->nexthops[i]; in mlxsw_sp_nexthop_group_refresh()
4005 nh->offloaded = 0; in mlxsw_sp_nexthop_group_refresh()
4017 static void __mlxsw_sp_nexthop_neigh_update(struct mlxsw_sp_nexthop *nh, in __mlxsw_sp_nexthop_neigh_update() argument
4021 nh->action = MLXSW_SP_NEXTHOP_ACTION_FORWARD; in __mlxsw_sp_nexthop_neigh_update()
4022 nh->should_offload = 1; in __mlxsw_sp_nexthop_neigh_update()
4023 } else if (nh->nhgi->is_resilient) { in __mlxsw_sp_nexthop_neigh_update()
4024 nh->action = MLXSW_SP_NEXTHOP_ACTION_TRAP; in __mlxsw_sp_nexthop_neigh_update()
4025 nh->should_offload = 1; in __mlxsw_sp_nexthop_neigh_update()
4027 nh->should_offload = 0; in __mlxsw_sp_nexthop_neigh_update()
4029 nh->update = 1; in __mlxsw_sp_nexthop_neigh_update()
4037 struct mlxsw_sp_nexthop *nh; in mlxsw_sp_nexthop_dead_neigh_replace() local
4042 nh = list_first_entry(&neigh_entry->nexthop_list, in mlxsw_sp_nexthop_dead_neigh_replace()
4045 n = neigh_lookup(nh->neigh_tbl, &nh->gw_addr, nh->rif->dev); in mlxsw_sp_nexthop_dead_neigh_replace()
4047 n = neigh_create(nh->neigh_tbl, &nh->gw_addr, nh->rif->dev); in mlxsw_sp_nexthop_dead_neigh_replace()
4065 list_for_each_entry(nh, &neigh_entry->nexthop_list, in mlxsw_sp_nexthop_dead_neigh_replace()
4069 __mlxsw_sp_nexthop_neigh_update(nh, !entry_connected); in mlxsw_sp_nexthop_dead_neigh_replace()
4070 mlxsw_sp_nexthop_group_refresh(mlxsw_sp, nh->nhgi->nh_grp); in mlxsw_sp_nexthop_dead_neigh_replace()
4089 struct mlxsw_sp_nexthop *nh; in mlxsw_sp_nexthop_neigh_update() local
4104 list_for_each_entry(nh, &neigh_entry->nexthop_list, in mlxsw_sp_nexthop_neigh_update()
4106 __mlxsw_sp_nexthop_neigh_update(nh, removing); in mlxsw_sp_nexthop_neigh_update()
4107 mlxsw_sp_nexthop_group_refresh(mlxsw_sp, nh->nhgi->nh_grp); in mlxsw_sp_nexthop_neigh_update()
4111 static void mlxsw_sp_nexthop_rif_init(struct mlxsw_sp_nexthop *nh, in mlxsw_sp_nexthop_rif_init() argument
4114 if (nh->rif) in mlxsw_sp_nexthop_rif_init()
4117 nh->rif = rif; in mlxsw_sp_nexthop_rif_init()
4118 list_add(&nh->rif_list_node, &rif->nexthop_list); in mlxsw_sp_nexthop_rif_init()
4121 static void mlxsw_sp_nexthop_rif_fini(struct mlxsw_sp_nexthop *nh) in mlxsw_sp_nexthop_rif_fini() argument
4123 if (!nh->rif) in mlxsw_sp_nexthop_rif_fini()
4126 list_del(&nh->rif_list_node); in mlxsw_sp_nexthop_rif_fini()
4127 nh->rif = NULL; in mlxsw_sp_nexthop_rif_fini()
4131 struct mlxsw_sp_nexthop *nh) in mlxsw_sp_nexthop_neigh_init() argument
4138 if (!nh->nhgi->gateway || nh->neigh_entry) in mlxsw_sp_nexthop_neigh_init()
4146 n = neigh_lookup(nh->neigh_tbl, &nh->gw_addr, nh->rif->dev); in mlxsw_sp_nexthop_neigh_init()
4148 n = neigh_create(nh->neigh_tbl, &nh->gw_addr, nh->rif->dev); in mlxsw_sp_nexthop_neigh_init()
4169 nh->neigh_entry = neigh_entry; in mlxsw_sp_nexthop_neigh_init()
4170 list_add_tail(&nh->neigh_list_node, &neigh_entry->nexthop_list); in mlxsw_sp_nexthop_neigh_init()
4175 __mlxsw_sp_nexthop_neigh_update(nh, !(nud_state & NUD_VALID && !dead)); in mlxsw_sp_nexthop_neigh_init()
4185 struct mlxsw_sp_nexthop *nh) in mlxsw_sp_nexthop_neigh_fini() argument
4187 struct mlxsw_sp_neigh_entry *neigh_entry = nh->neigh_entry; in mlxsw_sp_nexthop_neigh_fini()
4194 __mlxsw_sp_nexthop_neigh_update(nh, true); in mlxsw_sp_nexthop_neigh_fini()
4195 list_del(&nh->neigh_list_node); in mlxsw_sp_nexthop_neigh_fini()
4196 nh->neigh_entry = NULL; in mlxsw_sp_nexthop_neigh_fini()
4224 struct mlxsw_sp_nexthop *nh, in mlxsw_sp_nexthop_ipip_init() argument
4229 if (!nh->nhgi->gateway || nh->ipip_entry) in mlxsw_sp_nexthop_ipip_init()
4232 nh->ipip_entry = ipip_entry; in mlxsw_sp_nexthop_ipip_init()
4234 __mlxsw_sp_nexthop_neigh_update(nh, removing); in mlxsw_sp_nexthop_ipip_init()
4235 mlxsw_sp_nexthop_rif_init(nh, &ipip_entry->ol_lb->common); in mlxsw_sp_nexthop_ipip_init()
4239 struct mlxsw_sp_nexthop *nh) in mlxsw_sp_nexthop_ipip_fini() argument
4241 struct mlxsw_sp_ipip_entry *ipip_entry = nh->ipip_entry; in mlxsw_sp_nexthop_ipip_fini()
4246 __mlxsw_sp_nexthop_neigh_update(nh, true); in mlxsw_sp_nexthop_ipip_fini()
4247 nh->ipip_entry = NULL; in mlxsw_sp_nexthop_ipip_fini()
4262 struct mlxsw_sp_nexthop *nh, in mlxsw_sp_nexthop_type_init() argument
4274 nh->type = MLXSW_SP_NEXTHOP_TYPE_IPIP; in mlxsw_sp_nexthop_type_init()
4275 mlxsw_sp_nexthop_ipip_init(mlxsw_sp, nh, ipip_entry); in mlxsw_sp_nexthop_type_init()
4280 nh->type = MLXSW_SP_NEXTHOP_TYPE_ETH; in mlxsw_sp_nexthop_type_init()
4285 mlxsw_sp_nexthop_rif_init(nh, rif); in mlxsw_sp_nexthop_type_init()
4286 err = mlxsw_sp_nexthop_neigh_init(mlxsw_sp, nh); in mlxsw_sp_nexthop_type_init()
4293 mlxsw_sp_nexthop_rif_fini(nh); in mlxsw_sp_nexthop_type_init()
4298 struct mlxsw_sp_nexthop *nh) in mlxsw_sp_nexthop_type_fini() argument
4300 switch (nh->type) { in mlxsw_sp_nexthop_type_fini()
4302 mlxsw_sp_nexthop_neigh_fini(mlxsw_sp, nh); in mlxsw_sp_nexthop_type_fini()
4303 mlxsw_sp_nexthop_rif_fini(nh); in mlxsw_sp_nexthop_type_fini()
4306 mlxsw_sp_nexthop_rif_fini(nh); in mlxsw_sp_nexthop_type_fini()
4307 mlxsw_sp_nexthop_ipip_fini(mlxsw_sp, nh); in mlxsw_sp_nexthop_type_fini()
4314 struct mlxsw_sp_nexthop *nh, in mlxsw_sp_nexthop4_init() argument
4321 nh->nhgi = nh_grp->nhgi; in mlxsw_sp_nexthop4_init()
4322 nh->key.fib_nh = fib_nh; in mlxsw_sp_nexthop4_init()
4324 nh->nh_weight = fib_nh->fib_nh_weight; in mlxsw_sp_nexthop4_init()
4326 nh->nh_weight = 1; in mlxsw_sp_nexthop4_init()
4328 memcpy(&nh->gw_addr, &fib_nh->fib_nh_gw4, sizeof(fib_nh->fib_nh_gw4)); in mlxsw_sp_nexthop4_init()
4329 nh->neigh_tbl = &arp_tbl; in mlxsw_sp_nexthop4_init()
4330 err = mlxsw_sp_nexthop_insert(mlxsw_sp, nh); in mlxsw_sp_nexthop4_init()
4334 mlxsw_sp_nexthop_counter_alloc(mlxsw_sp, nh); in mlxsw_sp_nexthop4_init()
4335 list_add_tail(&nh->router_list_node, &mlxsw_sp->router->nexthop_list); in mlxsw_sp_nexthop4_init()
4339 nh->ifindex = dev->ifindex; in mlxsw_sp_nexthop4_init()
4350 err = mlxsw_sp_nexthop_type_init(mlxsw_sp, nh, dev); in mlxsw_sp_nexthop4_init()
4357 mlxsw_sp_nexthop_remove(mlxsw_sp, nh); in mlxsw_sp_nexthop4_init()
4362 struct mlxsw_sp_nexthop *nh) in mlxsw_sp_nexthop4_fini() argument
4364 mlxsw_sp_nexthop_type_fini(mlxsw_sp, nh); in mlxsw_sp_nexthop4_fini()
4365 list_del(&nh->router_list_node); in mlxsw_sp_nexthop4_fini()
4366 mlxsw_sp_nexthop_counter_free(mlxsw_sp, nh); in mlxsw_sp_nexthop4_fini()
4367 mlxsw_sp_nexthop_remove(mlxsw_sp, nh); in mlxsw_sp_nexthop4_fini()
4374 struct mlxsw_sp_nexthop *nh; in mlxsw_sp_nexthop4_event() local
4377 nh = mlxsw_sp_nexthop_lookup(mlxsw_sp, key); in mlxsw_sp_nexthop4_event()
4378 if (!nh) in mlxsw_sp_nexthop4_event()
4383 mlxsw_sp_nexthop_type_init(mlxsw_sp, nh, fib_nh->fib_nh_dev); in mlxsw_sp_nexthop4_event()
4386 mlxsw_sp_nexthop_type_fini(mlxsw_sp, nh); in mlxsw_sp_nexthop4_event()
4390 mlxsw_sp_nexthop_group_refresh(mlxsw_sp, nh->nhgi->nh_grp); in mlxsw_sp_nexthop4_event()
4396 struct mlxsw_sp_nexthop *nh; in mlxsw_sp_nexthop_rif_update() local
4399 list_for_each_entry(nh, &rif->nexthop_list, rif_list_node) { in mlxsw_sp_nexthop_rif_update()
4400 switch (nh->type) { in mlxsw_sp_nexthop_rif_update()
4412 __mlxsw_sp_nexthop_neigh_update(nh, removing); in mlxsw_sp_nexthop_rif_update()
4413 mlxsw_sp_nexthop_group_refresh(mlxsw_sp, nh->nhgi->nh_grp); in mlxsw_sp_nexthop_rif_update()
4421 struct mlxsw_sp_nexthop *nh; in mlxsw_sp_nexthop_rif_migrate() local
4424 list_for_each_entry(nh, &new_rif->nexthop_list, rif_list_node) in mlxsw_sp_nexthop_rif_migrate()
4425 nh->rif = new_rif; in mlxsw_sp_nexthop_rif_migrate()
4432 struct mlxsw_sp_nexthop *nh, *tmp; in mlxsw_sp_nexthop_rif_gone_sync() local
4434 list_for_each_entry_safe(nh, tmp, &rif->nexthop_list, rif_list_node) { in mlxsw_sp_nexthop_rif_gone_sync()
4435 mlxsw_sp_nexthop_type_fini(mlxsw_sp, nh); in mlxsw_sp_nexthop_rif_gone_sync()
4436 mlxsw_sp_nexthop_group_refresh(mlxsw_sp, nh->nhgi->nh_grp); in mlxsw_sp_nexthop_rif_gone_sync()
4581 const struct nh_notifier_single_info *nh, in mlxsw_sp_nexthop_obj_single_validate() argument
4586 if (nh->is_fdb) in mlxsw_sp_nexthop_obj_single_validate()
4588 else if (nh->has_encap) in mlxsw_sp_nexthop_obj_single_validate()
4598 const struct nh_notifier_single_info *nh, in mlxsw_sp_nexthop_obj_group_entry_validate() argument
4603 err = mlxsw_sp_nexthop_obj_single_validate(mlxsw_sp, nh, extack); in mlxsw_sp_nexthop_obj_group_entry_validate()
4610 if (!nh->gw_family && !nh->is_reject && in mlxsw_sp_nexthop_obj_group_entry_validate()
4611 !mlxsw_sp_netdev_ipip_type(mlxsw_sp, nh->dev, NULL)) { in mlxsw_sp_nexthop_obj_group_entry_validate()
4632 const struct nh_notifier_single_info *nh; in mlxsw_sp_nexthop_obj_group_validate() local
4635 nh = &nh_grp->nh_entries[i].nh; in mlxsw_sp_nexthop_obj_group_validate()
4636 err = mlxsw_sp_nexthop_obj_group_entry_validate(mlxsw_sp, nh, in mlxsw_sp_nexthop_obj_group_validate()
4703 const struct nh_notifier_single_info *nh; in mlxsw_sp_nexthop_obj_res_group_validate() local
4706 nh = &nh_res_table->nhs[i]; in mlxsw_sp_nexthop_obj_res_group_validate()
4707 err = mlxsw_sp_nexthop_obj_group_entry_validate(mlxsw_sp, nh, in mlxsw_sp_nexthop_obj_res_group_validate()
4720 struct nh_notifier_single_info *nh; in mlxsw_sp_nexthop_obj_validate() local
4729 return mlxsw_sp_nexthop_obj_single_validate(mlxsw_sp, info->nh, in mlxsw_sp_nexthop_obj_validate()
4740 nh = &info->nh_res_bucket->new_nh; in mlxsw_sp_nexthop_obj_validate()
4741 return mlxsw_sp_nexthop_obj_group_entry_validate(mlxsw_sp, nh, in mlxsw_sp_nexthop_obj_validate()
4756 dev = info->nh->dev; in mlxsw_sp_nexthop_obj_is_gateway()
4757 return info->nh->gw_family || info->nh->is_reject || in mlxsw_sp_nexthop_obj_is_gateway()
4769 struct mlxsw_sp_nexthop *nh) in mlxsw_sp_nexthop_obj_blackhole_init() argument
4773 nh->action = MLXSW_SP_NEXTHOP_ACTION_DISCARD; in mlxsw_sp_nexthop_obj_blackhole_init()
4774 nh->should_offload = 1; in mlxsw_sp_nexthop_obj_blackhole_init()
4779 nh->rif = mlxsw_sp->router->rifs[lb_rif_index]; in mlxsw_sp_nexthop_obj_blackhole_init()
4783 struct mlxsw_sp_nexthop *nh) in mlxsw_sp_nexthop_obj_blackhole_fini() argument
4785 nh->rif = NULL; in mlxsw_sp_nexthop_obj_blackhole_fini()
4786 nh->should_offload = 0; in mlxsw_sp_nexthop_obj_blackhole_fini()
4792 struct mlxsw_sp_nexthop *nh, in mlxsw_sp_nexthop_obj_init() argument
4798 nh->nhgi = nh_grp->nhgi; in mlxsw_sp_nexthop_obj_init()
4799 nh->nh_weight = weight; in mlxsw_sp_nexthop_obj_init()
4803 memcpy(&nh->gw_addr, &nh_obj->ipv4, sizeof(nh_obj->ipv4)); in mlxsw_sp_nexthop_obj_init()
4804 nh->neigh_tbl = &arp_tbl; in mlxsw_sp_nexthop_obj_init()
4807 memcpy(&nh->gw_addr, &nh_obj->ipv6, sizeof(nh_obj->ipv6)); in mlxsw_sp_nexthop_obj_init()
4809 nh->neigh_tbl = &nd_tbl; in mlxsw_sp_nexthop_obj_init()
4814 mlxsw_sp_nexthop_counter_alloc(mlxsw_sp, nh); in mlxsw_sp_nexthop_obj_init()
4815 list_add_tail(&nh->router_list_node, &mlxsw_sp->router->nexthop_list); in mlxsw_sp_nexthop_obj_init()
4816 nh->ifindex = dev->ifindex; in mlxsw_sp_nexthop_obj_init()
4818 err = mlxsw_sp_nexthop_type_init(mlxsw_sp, nh, dev); in mlxsw_sp_nexthop_obj_init()
4823 mlxsw_sp_nexthop_obj_blackhole_init(mlxsw_sp, nh); in mlxsw_sp_nexthop_obj_init()
4829 if (nh_grp->nhgi->is_resilient && !nh->should_offload) { in mlxsw_sp_nexthop_obj_init()
4830 nh->action = MLXSW_SP_NEXTHOP_ACTION_TRAP; in mlxsw_sp_nexthop_obj_init()
4831 nh->should_offload = 1; in mlxsw_sp_nexthop_obj_init()
4837 list_del(&nh->router_list_node); in mlxsw_sp_nexthop_obj_init()
4838 mlxsw_sp_nexthop_counter_free(mlxsw_sp, nh); in mlxsw_sp_nexthop_obj_init()
4843 struct mlxsw_sp_nexthop *nh) in mlxsw_sp_nexthop_obj_fini() argument
4845 if (nh->action == MLXSW_SP_NEXTHOP_ACTION_DISCARD) in mlxsw_sp_nexthop_obj_fini()
4846 mlxsw_sp_nexthop_obj_blackhole_fini(mlxsw_sp, nh); in mlxsw_sp_nexthop_obj_fini()
4847 mlxsw_sp_nexthop_type_fini(mlxsw_sp, nh); in mlxsw_sp_nexthop_obj_fini()
4848 list_del(&nh->router_list_node); in mlxsw_sp_nexthop_obj_fini()
4849 mlxsw_sp_nexthop_counter_free(mlxsw_sp, nh); in mlxsw_sp_nexthop_obj_fini()
4850 nh->should_offload = 0; in mlxsw_sp_nexthop_obj_fini()
4859 struct mlxsw_sp_nexthop *nh; in mlxsw_sp_nexthop_obj_group_info_init() local
4891 nh = &nhgi->nexthops[i]; in mlxsw_sp_nexthop_obj_group_info_init()
4894 nh_obj = info->nh; in mlxsw_sp_nexthop_obj_group_info_init()
4898 nh_obj = &info->nh_grp->nh_entries[i].nh; in mlxsw_sp_nexthop_obj_group_info_init()
4909 err = mlxsw_sp_nexthop_obj_init(mlxsw_sp, nh_grp, nh, nh_obj, in mlxsw_sp_nexthop_obj_group_info_init()
4940 nh = &nhgi->nexthops[i]; in mlxsw_sp_nexthop_obj_group_info_init()
4941 mlxsw_sp_nexthop_obj_fini(mlxsw_sp, nh); in mlxsw_sp_nexthop_obj_group_info_init()
4963 struct mlxsw_sp_nexthop *nh = &nhgi->nexthops[i]; in mlxsw_sp_nexthop_obj_group_info_fini() local
4965 mlxsw_sp_nexthop_obj_fini(mlxsw_sp, nh); in mlxsw_sp_nexthop_obj_group_info_fini()
5186 struct mlxsw_sp_nexthop *nh, in mlxsw_sp_nexthop_obj_bucket_adj_update() argument
5204 adj_index = nh->nhgi->adj_index + bucket_index; in mlxsw_sp_nexthop_obj_bucket_adj_update()
5205 err = mlxsw_sp_nexthop_update(mlxsw_sp, adj_index, nh, force, ratr_pl); in mlxsw_sp_nexthop_obj_bucket_adj_update()
5226 nh->update = 0; in mlxsw_sp_nexthop_obj_bucket_adj_update()
5227 nh->offloaded = 1; in mlxsw_sp_nexthop_obj_bucket_adj_update()
5228 mlxsw_sp_nexthop_bucket_offload_refresh(mlxsw_sp, nh, bucket_index); in mlxsw_sp_nexthop_obj_bucket_adj_update()
5241 struct mlxsw_sp_nexthop *nh; in mlxsw_sp_nexthop_obj_bucket_replace() local
5257 nh = &nhgi->nexthops[bucket_index]; in mlxsw_sp_nexthop_obj_bucket_replace()
5258 mlxsw_sp_nexthop_obj_fini(mlxsw_sp, nh); in mlxsw_sp_nexthop_obj_bucket_replace()
5261 err = mlxsw_sp_nexthop_obj_init(mlxsw_sp, nh_grp, nh, nh_obj, 1); in mlxsw_sp_nexthop_obj_bucket_replace()
5267 err = mlxsw_sp_nexthop_obj_bucket_adj_update(mlxsw_sp, nh, info); in mlxsw_sp_nexthop_obj_bucket_replace()
5274 mlxsw_sp_nexthop_obj_fini(mlxsw_sp, nh); in mlxsw_sp_nexthop_obj_bucket_replace()
5277 mlxsw_sp_nexthop_obj_init(mlxsw_sp, nh_grp, nh, nh_obj, 1); in mlxsw_sp_nexthop_obj_bucket_replace()
5279 nh->update = 0; in mlxsw_sp_nexthop_obj_bucket_replace()
5280 nh->offloaded = 1; in mlxsw_sp_nexthop_obj_bucket_replace()
5322 const struct fib_nh *nh = fib_info_nh(fi, 0); in mlxsw_sp_fi_is_gateway() local
5324 return nh->fib_nh_scope == RT_SCOPE_LINK || in mlxsw_sp_fi_is_gateway()
5325 mlxsw_sp_nexthop4_ipip_type(mlxsw_sp, nh, NULL); in mlxsw_sp_fi_is_gateway()
5334 struct mlxsw_sp_nexthop *nh; in mlxsw_sp_nexthop4_group_info_init() local
5347 nh = &nhgi->nexthops[i]; in mlxsw_sp_nexthop4_group_info_init()
5349 err = mlxsw_sp_nexthop4_init(mlxsw_sp, nh_grp, nh, fib_nh); in mlxsw_sp_nexthop4_group_info_init()
5368 nh = &nhgi->nexthops[i]; in mlxsw_sp_nexthop4_group_info_init()
5369 mlxsw_sp_nexthop4_fini(mlxsw_sp, nh); in mlxsw_sp_nexthop4_group_info_init()
5384 struct mlxsw_sp_nexthop *nh = &nhgi->nexthops[i]; in mlxsw_sp_nexthop4_group_info_fini() local
5386 mlxsw_sp_nexthop4_fini(mlxsw_sp, nh); in mlxsw_sp_nexthop4_group_info_fini()
5454 if (fi->nh) { in mlxsw_sp_nexthop4_group_get()
5456 fi->nh->id); in mlxsw_sp_nexthop4_group_get()
5536 struct mlxsw_sp_nexthop *nh = &nh_grp->nhgi->nexthops[i]; in mlxsw_sp_rt6_nexthop() local
5539 if (nh->rif && nh->rif->dev == rt->fib6_nh->fib_nh_dev && in mlxsw_sp_rt6_nexthop()
5540 ipv6_addr_equal((const struct in6_addr *) &nh->gw_addr, in mlxsw_sp_rt6_nexthop()
5542 return nh; in mlxsw_sp_rt6_nexthop()
6522 if (fen_info->fi->nh && in mlxsw_sp_router_fib4_replace()
6523 !mlxsw_sp_nexthop_obj_group_lookup(mlxsw_sp, fen_info->fi->nh->id)) in mlxsw_sp_router_fib4_replace()
6641 if (!mlxsw_sp_rt6->rt->nh) in mlxsw_sp_rt6_destroy()
6678 struct mlxsw_sp_nexthop *nh, in mlxsw_sp_nexthop6_init() argument
6683 nh->nhgi = nh_grp->nhgi; in mlxsw_sp_nexthop6_init()
6684 nh->nh_weight = rt->fib6_nh->fib_nh_weight; in mlxsw_sp_nexthop6_init()
6685 memcpy(&nh->gw_addr, &rt->fib6_nh->fib_nh_gw6, sizeof(nh->gw_addr)); in mlxsw_sp_nexthop6_init()
6687 nh->neigh_tbl = &nd_tbl; in mlxsw_sp_nexthop6_init()
6689 mlxsw_sp_nexthop_counter_alloc(mlxsw_sp, nh); in mlxsw_sp_nexthop6_init()
6691 list_add_tail(&nh->router_list_node, &mlxsw_sp->router->nexthop_list); in mlxsw_sp_nexthop6_init()
6695 nh->ifindex = dev->ifindex; in mlxsw_sp_nexthop6_init()
6697 return mlxsw_sp_nexthop_type_init(mlxsw_sp, nh, dev); in mlxsw_sp_nexthop6_init()
6701 struct mlxsw_sp_nexthop *nh) in mlxsw_sp_nexthop6_fini() argument
6703 mlxsw_sp_nexthop_type_fini(mlxsw_sp, nh); in mlxsw_sp_nexthop6_fini()
6704 list_del(&nh->router_list_node); in mlxsw_sp_nexthop6_fini()
6705 mlxsw_sp_nexthop_counter_free(mlxsw_sp, nh); in mlxsw_sp_nexthop6_fini()
6722 struct mlxsw_sp_nexthop *nh; in mlxsw_sp_nexthop6_group_info_init() local
6738 nh = &nhgi->nexthops[i]; in mlxsw_sp_nexthop6_group_info_init()
6739 err = mlxsw_sp_nexthop6_init(mlxsw_sp, nh_grp, nh, rt); in mlxsw_sp_nexthop6_group_info_init()
6760 nh = &nhgi->nexthops[i]; in mlxsw_sp_nexthop6_group_info_init()
6761 mlxsw_sp_nexthop6_fini(mlxsw_sp, nh); in mlxsw_sp_nexthop6_group_info_init()
6776 struct mlxsw_sp_nexthop *nh = &nhgi->nexthops[i]; in mlxsw_sp_nexthop6_group_info_fini() local
6778 mlxsw_sp_nexthop6_fini(mlxsw_sp, nh); in mlxsw_sp_nexthop6_group_info_fini()
6843 if (rt->nh) { in mlxsw_sp_nexthop6_group_get()
6845 rt->nh->id); in mlxsw_sp_nexthop6_group_get()
7217 if (rt->nh && !mlxsw_sp_nexthop_obj_group_lookup(mlxsw_sp, rt->nh->id)) in mlxsw_sp_router_fib6_replace()