Lines Matching refs:rif

109 	void (*setup)(struct mlxsw_sp_rif *rif,
111 int (*configure)(struct mlxsw_sp_rif *rif,
113 void (*deconfigure)(struct mlxsw_sp_rif *rif);
114 struct mlxsw_sp_fid * (*fid_get)(struct mlxsw_sp_rif *rif,
116 void (*fdb_del)(struct mlxsw_sp_rif *rif, const char *mac);
133 static void mlxsw_sp_rif_destroy(struct mlxsw_sp_rif *rif);
144 mlxsw_sp_rif_p_counter_get(struct mlxsw_sp_rif *rif, in mlxsw_sp_rif_p_counter_get() argument
149 return &rif->counter_egress; in mlxsw_sp_rif_p_counter_get()
151 return &rif->counter_ingress; in mlxsw_sp_rif_p_counter_get()
157 mlxsw_sp_rif_counter_valid_get(struct mlxsw_sp_rif *rif, in mlxsw_sp_rif_counter_valid_get() argument
162 return rif->counter_egress_valid; in mlxsw_sp_rif_counter_valid_get()
164 return rif->counter_ingress_valid; in mlxsw_sp_rif_counter_valid_get()
170 mlxsw_sp_rif_counter_valid_set(struct mlxsw_sp_rif *rif, in mlxsw_sp_rif_counter_valid_set() argument
176 rif->counter_egress_valid = valid; in mlxsw_sp_rif_counter_valid_set()
179 rif->counter_ingress_valid = valid; in mlxsw_sp_rif_counter_valid_set()
205 struct mlxsw_sp_rif *rif, in mlxsw_sp_rif_counter_value_get() argument
213 valid = mlxsw_sp_rif_counter_valid_get(rif, dir); in mlxsw_sp_rif_counter_value_get()
217 p_counter_index = mlxsw_sp_rif_p_counter_get(rif, dir); in mlxsw_sp_rif_counter_value_get()
243 mlxsw_sp_rif_counter_fetch_clear(struct mlxsw_sp_rif *rif, in mlxsw_sp_rif_counter_fetch_clear() argument
247 struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp; in mlxsw_sp_rif_counter_fetch_clear()
252 if (!mlxsw_sp_rif_counter_valid_get(rif, dir)) in mlxsw_sp_rif_counter_fetch_clear()
255 p_counter_index = mlxsw_sp_rif_p_counter_get(rif, dir); in mlxsw_sp_rif_counter_fetch_clear()
297 int mlxsw_sp_rif_counter_alloc(struct mlxsw_sp_rif *rif, in mlxsw_sp_rif_counter_alloc() argument
300 struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp; in mlxsw_sp_rif_counter_alloc()
304 if (mlxsw_sp_rif_counter_valid_get(rif, dir)) in mlxsw_sp_rif_counter_alloc()
307 p_counter_index = mlxsw_sp_rif_p_counter_get(rif, dir); in mlxsw_sp_rif_counter_alloc()
320 err = mlxsw_sp_rif_counter_edit(mlxsw_sp, rif->rif_index, in mlxsw_sp_rif_counter_alloc()
324 mlxsw_sp_rif_counter_valid_set(rif, dir, true); in mlxsw_sp_rif_counter_alloc()
334 void mlxsw_sp_rif_counter_free(struct mlxsw_sp_rif *rif, in mlxsw_sp_rif_counter_free() argument
337 struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp; in mlxsw_sp_rif_counter_free()
340 if (!mlxsw_sp_rif_counter_valid_get(rif, dir)) in mlxsw_sp_rif_counter_free()
343 p_counter_index = mlxsw_sp_rif_p_counter_get(rif, dir); in mlxsw_sp_rif_counter_free()
346 mlxsw_sp_rif_counter_edit(mlxsw_sp, rif->rif_index, in mlxsw_sp_rif_counter_free()
350 mlxsw_sp_rif_counter_valid_set(rif, dir, false); in mlxsw_sp_rif_counter_free()
353 static void mlxsw_sp_rif_counters_alloc(struct mlxsw_sp_rif *rif) in mlxsw_sp_rif_counters_alloc() argument
355 struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp; in mlxsw_sp_rif_counters_alloc()
362 mlxsw_sp_rif_counter_alloc(rif, MLXSW_SP_RIF_COUNTER_EGRESS); in mlxsw_sp_rif_counters_alloc()
365 static void mlxsw_sp_rif_counters_free(struct mlxsw_sp_rif *rif) in mlxsw_sp_rif_counters_free() argument
367 mlxsw_sp_rif_counter_free(rif, MLXSW_SP_RIF_COUNTER_EGRESS); in mlxsw_sp_rif_counters_free()
1065 struct mlxsw_sp_rif *rif; in mlxsw_sp_ipip_ol_ipip_lb_create() local
1074 rif = mlxsw_sp_rif_create(mlxsw_sp, &lb_params.common, extack); in mlxsw_sp_ipip_ol_ipip_lb_create()
1075 if (IS_ERR(rif)) in mlxsw_sp_ipip_ol_ipip_lb_create()
1076 return ERR_CAST(rif); in mlxsw_sp_ipip_ol_ipip_lb_create()
1077 return container_of(rif, struct mlxsw_sp_rif_ipip_lb, common); in mlxsw_sp_ipip_ol_ipip_lb_create()
1557 struct mlxsw_sp_rif *rif = &lb_rif->common; in mlxsw_sp_rif_ipip_lb_op() local
1558 struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp; in mlxsw_sp_rif_ipip_lb_op()
1568 rif->rif_index, rif->vr_id, rif->dev->mtu); in mlxsw_sp_rif_ipip_lb_op()
1578 rif->rif_index, rif->vr_id, rif->dev->mtu); in mlxsw_sp_rif_ipip_lb_op()
1668 struct mlxsw_sp_rif *rif);
2081 u16 rif; member
2099 mlxsw_sp_rif_neigh_next(struct mlxsw_sp_rif *rif, in mlxsw_sp_rif_neigh_next() argument
2103 if (list_empty(&rif->neigh_list)) in mlxsw_sp_rif_neigh_next()
2106 return list_first_entry(&rif->neigh_list, in mlxsw_sp_rif_neigh_next()
2110 if (list_is_last(&neigh_entry->rif_list_node, &rif->neigh_list)) in mlxsw_sp_rif_neigh_next()
2156 u16 rif) in mlxsw_sp_neigh_entry_alloc() argument
2165 neigh_entry->rif = rif; in mlxsw_sp_neigh_entry_alloc()
2245 struct mlxsw_sp_rif *rif; in mlxsw_sp_neigh_entry_create() local
2248 rif = mlxsw_sp_rif_find_by_dev(mlxsw_sp, n->dev); in mlxsw_sp_neigh_entry_create()
2249 if (!rif) in mlxsw_sp_neigh_entry_create()
2252 neigh_entry = mlxsw_sp_neigh_entry_alloc(mlxsw_sp, n, rif->rif_index); in mlxsw_sp_neigh_entry_create()
2262 list_add(&neigh_entry->rif_list_node, &rif->neigh_list); in mlxsw_sp_neigh_entry_create()
2316 u16 rif; in mlxsw_sp_router_neigh_ent_ipv4_process() local
2318 mlxsw_reg_rauhtd_ent_ipv4_unpack(rauhtd_pl, ent_index, &rif, &dip); in mlxsw_sp_router_neigh_ent_ipv4_process()
2320 if (WARN_ON_ONCE(rif >= max_rifs)) in mlxsw_sp_router_neigh_ent_ipv4_process()
2322 if (!mlxsw_sp->router->rifs[rif]) { in mlxsw_sp_router_neigh_ent_ipv4_process()
2328 dev = mlxsw_sp->router->rifs[rif]->dev; in mlxsw_sp_router_neigh_ent_ipv4_process()
2346 u16 rif; in mlxsw_sp_router_neigh_ent_ipv6_process() local
2348 mlxsw_reg_rauhtd_ent_ipv6_unpack(rauhtd_pl, rec_index, &rif, in mlxsw_sp_router_neigh_ent_ipv6_process()
2351 if (!mlxsw_sp->router->rifs[rif]) { in mlxsw_sp_router_neigh_ent_ipv6_process()
2356 dev = mlxsw_sp->router->rifs[rif]->dev; in mlxsw_sp_router_neigh_ent_ipv6_process()
2576 mlxsw_reg_rauht_pack4(rauht_pl, op, neigh_entry->rif, neigh_entry->ha, in mlxsw_sp_router_neigh_entry_op4()
2593 mlxsw_reg_rauht_pack6(rauht_pl, op, neigh_entry->rif, neigh_entry->ha, in mlxsw_sp_router_neigh_entry_op6()
2870 struct mlxsw_sp_rif *rif) in mlxsw_sp_neigh_rif_gone_sync() argument
2874 list_for_each_entry_safe(neigh_entry, tmp, &rif->neigh_list, in mlxsw_sp_neigh_rif_gone_sync()
2914 struct mlxsw_sp_rif *rif; member
2951 #define nh_rif nexthops[0].rif
3075 return nh->rif; in mlxsw_sp_nexthop_rif()
3463 rif_index = nh->rif ? nh->rif->rif_index : in __mlxsw_sp_nexthop_eth_update()
4014 n = neigh_lookup(nh->neigh_tbl, &nh->gw_addr, nh->rif->dev); in mlxsw_sp_nexthop_dead_neigh_replace()
4016 n = neigh_create(nh->neigh_tbl, &nh->gw_addr, nh->rif->dev); in mlxsw_sp_nexthop_dead_neigh_replace()
4081 struct mlxsw_sp_rif *rif) in mlxsw_sp_nexthop_rif_init() argument
4083 if (nh->rif) in mlxsw_sp_nexthop_rif_init()
4086 nh->rif = rif; in mlxsw_sp_nexthop_rif_init()
4087 list_add(&nh->rif_list_node, &rif->nexthop_list); in mlxsw_sp_nexthop_rif_init()
4092 if (!nh->rif) in mlxsw_sp_nexthop_rif_fini()
4096 nh->rif = NULL; in mlxsw_sp_nexthop_rif_fini()
4115 n = neigh_lookup(nh->neigh_tbl, &nh->gw_addr, nh->rif->dev); in mlxsw_sp_nexthop_neigh_init()
4117 n = neigh_create(nh->neigh_tbl, &nh->gw_addr, nh->rif->dev); in mlxsw_sp_nexthop_neigh_init()
4236 struct mlxsw_sp_rif *rif; in mlxsw_sp_nexthop_type_init() local
4250 rif = mlxsw_sp_rif_find_by_dev(mlxsw_sp, dev); in mlxsw_sp_nexthop_type_init()
4251 if (!rif) in mlxsw_sp_nexthop_type_init()
4254 mlxsw_sp_nexthop_rif_init(nh, rif); in mlxsw_sp_nexthop_type_init()
4365 struct mlxsw_sp_rif *rif) in mlxsw_sp_nexthop_rif_update() argument
4370 list_for_each_entry(nh, &rif->nexthop_list, rif_list_node) { in mlxsw_sp_nexthop_rif_update()
4376 removing = !mlxsw_sp_ipip_netdev_ul_up(rif->dev); in mlxsw_sp_nexthop_rif_update()
4396 nh->rif = new_rif; in mlxsw_sp_nexthop_rif_migrate()
4401 struct mlxsw_sp_rif *rif) in mlxsw_sp_nexthop_rif_gone_sync() argument
4405 list_for_each_entry_safe(nh, tmp, &rif->nexthop_list, rif_list_node) { in mlxsw_sp_nexthop_rif_gone_sync()
4750 nh->rif = mlxsw_sp->router->rifs[lb_rif_index]; in mlxsw_sp_nexthop_obj_blackhole_init()
4756 nh->rif = NULL; in mlxsw_sp_nexthop_obj_blackhole_fini()
5510 if (nh->rif && nh->rif->dev == rt->fib6_nh->fib_nh_dev && in mlxsw_sp_rt6_nexthop()
5770 struct mlxsw_sp_rif *rif = fib_entry->nh_group->nhgi->nh_rif; in mlxsw_sp_fib_entry_op_local() local
5778 rif_index = rif->rif_index; in mlxsw_sp_fib_entry_op_local()
7212 struct mlxsw_sp_rif *rif; in mlxsw_sp_router_fibmr_vif_add() local
7220 rif = mlxsw_sp_rif_find_by_dev(mlxsw_sp, ven_info->dev); in mlxsw_sp_router_fibmr_vif_add()
7223 ven_info->vif_flags, rif); in mlxsw_sp_router_fibmr_vif_add()
7711 struct mlxsw_sp_rif *rif; in mlxsw_sp_rif_exists() local
7714 rif = mlxsw_sp_rif_find_by_dev(mlxsw_sp, dev); in mlxsw_sp_rif_exists()
7717 return rif; in mlxsw_sp_rif_exists()
7722 struct mlxsw_sp_rif *rif; in mlxsw_sp_rif_vid() local
7726 rif = mlxsw_sp_rif_find_by_dev(mlxsw_sp, dev); in mlxsw_sp_rif_vid()
7727 if (!rif) in mlxsw_sp_rif_vid()
7733 if (rif->ops->type != MLXSW_SP_RIF_TYPE_VLAN) in mlxsw_sp_rif_vid()
7736 vid = mlxsw_sp_fid_8021q_vid(rif->fid); in mlxsw_sp_rif_vid()
7743 static int mlxsw_sp_router_rif_disable(struct mlxsw_sp *mlxsw_sp, u16 rif) in mlxsw_sp_router_rif_disable() argument
7748 mlxsw_reg_ritr_rif_pack(ritr_pl, rif); in mlxsw_sp_router_rif_disable()
7758 struct mlxsw_sp_rif *rif) in mlxsw_sp_router_rif_gone_sync() argument
7760 mlxsw_sp_router_rif_disable(mlxsw_sp, rif->rif_index); in mlxsw_sp_router_rif_gone_sync()
7761 mlxsw_sp_nexthop_rif_gone_sync(mlxsw_sp, rif); in mlxsw_sp_router_rif_gone_sync()
7762 mlxsw_sp_neigh_rif_gone_sync(mlxsw_sp, rif); in mlxsw_sp_router_rif_gone_sync()
7766 mlxsw_sp_rif_should_config(struct mlxsw_sp_rif *rif, struct net_device *dev, in mlxsw_sp_rif_should_config() argument
7775 return rif == NULL; in mlxsw_sp_rif_should_config()
7794 if (rif && addr_list_empty && in mlxsw_sp_rif_should_config()
7795 !netif_is_l3_slave(rif->dev)) in mlxsw_sp_rif_should_config()
7847 struct mlxsw_sp_rif *rif; in mlxsw_sp_rif_alloc() local
7849 rif = kzalloc(rif_size, GFP_KERNEL); in mlxsw_sp_rif_alloc()
7850 if (!rif) in mlxsw_sp_rif_alloc()
7853 INIT_LIST_HEAD(&rif->nexthop_list); in mlxsw_sp_rif_alloc()
7854 INIT_LIST_HEAD(&rif->neigh_list); in mlxsw_sp_rif_alloc()
7856 ether_addr_copy(rif->addr, l3_dev->dev_addr); in mlxsw_sp_rif_alloc()
7857 rif->mtu = l3_dev->mtu; in mlxsw_sp_rif_alloc()
7858 rif->dev = l3_dev; in mlxsw_sp_rif_alloc()
7860 rif->vr_id = vr_id; in mlxsw_sp_rif_alloc()
7861 rif->rif_index = rif_index; in mlxsw_sp_rif_alloc()
7863 return rif; in mlxsw_sp_rif_alloc()
7872 u16 mlxsw_sp_rif_index(const struct mlxsw_sp_rif *rif) in mlxsw_sp_rif_index() argument
7874 return rif->rif_index; in mlxsw_sp_rif_index()
7900 mlxsw_sp_router_port_l3_stats_enabled(struct mlxsw_sp_rif *rif) in mlxsw_sp_router_port_l3_stats_enabled() argument
7902 return mlxsw_sp_rif_counter_valid_get(rif, in mlxsw_sp_router_port_l3_stats_enabled()
7904 mlxsw_sp_rif_counter_valid_get(rif, in mlxsw_sp_router_port_l3_stats_enabled()
7909 mlxsw_sp_router_port_l3_stats_enable(struct mlxsw_sp_rif *rif) in mlxsw_sp_router_port_l3_stats_enable() argument
7913 err = mlxsw_sp_rif_counter_alloc(rif, MLXSW_SP_RIF_COUNTER_INGRESS); in mlxsw_sp_router_port_l3_stats_enable()
7918 err = mlxsw_sp_rif_counter_fetch_clear(rif, in mlxsw_sp_router_port_l3_stats_enable()
7924 err = mlxsw_sp_rif_counter_alloc(rif, MLXSW_SP_RIF_COUNTER_EGRESS); in mlxsw_sp_router_port_l3_stats_enable()
7929 err = mlxsw_sp_rif_counter_fetch_clear(rif, in mlxsw_sp_router_port_l3_stats_enable()
7938 mlxsw_sp_rif_counter_free(rif, MLXSW_SP_RIF_COUNTER_EGRESS); in mlxsw_sp_router_port_l3_stats_enable()
7941 mlxsw_sp_rif_counter_free(rif, MLXSW_SP_RIF_COUNTER_INGRESS); in mlxsw_sp_router_port_l3_stats_enable()
7946 mlxsw_sp_router_port_l3_stats_disable(struct mlxsw_sp_rif *rif) in mlxsw_sp_router_port_l3_stats_disable() argument
7948 mlxsw_sp_rif_counter_free(rif, MLXSW_SP_RIF_COUNTER_EGRESS); in mlxsw_sp_router_port_l3_stats_disable()
7949 mlxsw_sp_rif_counter_free(rif, MLXSW_SP_RIF_COUNTER_INGRESS); in mlxsw_sp_router_port_l3_stats_disable()
7953 mlxsw_sp_router_port_l3_stats_report_used(struct mlxsw_sp_rif *rif, in mlxsw_sp_router_port_l3_stats_report_used() argument
7956 if (!mlxsw_sp_router_port_l3_stats_enabled(rif)) in mlxsw_sp_router_port_l3_stats_report_used()
7962 mlxsw_sp_router_port_l3_stats_fetch(struct mlxsw_sp_rif *rif, in mlxsw_sp_router_port_l3_stats_fetch() argument
7969 err = mlxsw_sp_rif_counter_fetch_clear(rif, in mlxsw_sp_router_port_l3_stats_fetch()
7975 err = mlxsw_sp_rif_counter_fetch_clear(rif, in mlxsw_sp_router_port_l3_stats_fetch()
8003 mlxsw_sp_router_port_l3_stats_report_delta(struct mlxsw_sp_rif *rif, in mlxsw_sp_router_port_l3_stats_report_delta() argument
8009 if (!mlxsw_sp_router_port_l3_stats_enabled(rif)) in mlxsw_sp_router_port_l3_stats_report_delta()
8012 err = mlxsw_sp_router_port_l3_stats_fetch(rif, &stats); in mlxsw_sp_router_port_l3_stats_report_delta()
8059 int mlxsw_sp_rif_dev_ifindex(const struct mlxsw_sp_rif *rif) in mlxsw_sp_rif_dev_ifindex() argument
8061 return rif->dev->ifindex; in mlxsw_sp_rif_dev_ifindex()
8064 const struct net_device *mlxsw_sp_rif_dev(const struct mlxsw_sp_rif *rif) in mlxsw_sp_rif_dev() argument
8066 return rif->dev; in mlxsw_sp_rif_dev()
8069 static void mlxsw_sp_rif_push_l3_stats(struct mlxsw_sp_rif *rif) in mlxsw_sp_rif_push_l3_stats() argument
8073 if (!mlxsw_sp_router_port_l3_stats_fetch(rif, &stats)) in mlxsw_sp_rif_push_l3_stats()
8074 netdev_offload_xstats_push_delta(rif->dev, in mlxsw_sp_rif_push_l3_stats()
8088 struct mlxsw_sp_rif *rif; in mlxsw_sp_rif_create() local
8107 rif = mlxsw_sp_rif_alloc(ops->rif_size, rif_index, vr->id, params->dev); in mlxsw_sp_rif_create()
8108 if (!rif) { in mlxsw_sp_rif_create()
8112 dev_hold(rif->dev); in mlxsw_sp_rif_create()
8113 mlxsw_sp->router->rifs[rif_index] = rif; in mlxsw_sp_rif_create()
8114 rif->mlxsw_sp = mlxsw_sp; in mlxsw_sp_rif_create()
8115 rif->ops = ops; in mlxsw_sp_rif_create()
8118 fid = ops->fid_get(rif, extack); in mlxsw_sp_rif_create()
8123 rif->fid = fid; in mlxsw_sp_rif_create()
8127 ops->setup(rif, params); in mlxsw_sp_rif_create()
8129 err = ops->configure(rif, extack); in mlxsw_sp_rif_create()
8134 err = mlxsw_sp_mr_rif_add(vr->mr_table[i], rif); in mlxsw_sp_rif_create()
8139 if (netdev_offload_xstats_enabled(rif->dev, in mlxsw_sp_rif_create()
8141 err = mlxsw_sp_router_port_l3_stats_enable(rif); in mlxsw_sp_rif_create()
8144 mlxsw_sp_router_hwstats_notify_schedule(rif->dev); in mlxsw_sp_rif_create()
8146 mlxsw_sp_rif_counters_alloc(rif); in mlxsw_sp_rif_create()
8150 return rif; in mlxsw_sp_rif_create()
8155 mlxsw_sp_mr_rif_del(vr->mr_table[i], rif); in mlxsw_sp_rif_create()
8156 ops->deconfigure(rif); in mlxsw_sp_rif_create()
8162 dev_put(rif->dev); in mlxsw_sp_rif_create()
8163 kfree(rif); in mlxsw_sp_rif_create()
8171 static void mlxsw_sp_rif_destroy(struct mlxsw_sp_rif *rif) in mlxsw_sp_rif_destroy() argument
8173 const struct mlxsw_sp_rif_ops *ops = rif->ops; in mlxsw_sp_rif_destroy()
8174 struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp; in mlxsw_sp_rif_destroy()
8175 struct mlxsw_sp_fid *fid = rif->fid; in mlxsw_sp_rif_destroy()
8180 mlxsw_sp_router_rif_gone_sync(mlxsw_sp, rif); in mlxsw_sp_rif_destroy()
8181 vr = &mlxsw_sp->router->vrs[rif->vr_id]; in mlxsw_sp_rif_destroy()
8183 if (netdev_offload_xstats_enabled(rif->dev, in mlxsw_sp_rif_destroy()
8185 mlxsw_sp_rif_push_l3_stats(rif); in mlxsw_sp_rif_destroy()
8186 mlxsw_sp_router_port_l3_stats_disable(rif); in mlxsw_sp_rif_destroy()
8187 mlxsw_sp_router_hwstats_notify_schedule(rif->dev); in mlxsw_sp_rif_destroy()
8189 mlxsw_sp_rif_counters_free(rif); in mlxsw_sp_rif_destroy()
8193 mlxsw_sp_mr_rif_del(vr->mr_table[i], rif); in mlxsw_sp_rif_destroy()
8194 ops->deconfigure(rif); in mlxsw_sp_rif_destroy()
8198 mlxsw_sp->router->rifs[rif->rif_index] = NULL; in mlxsw_sp_rif_destroy()
8199 dev_put(rif->dev); in mlxsw_sp_rif_destroy()
8200 kfree(rif); in mlxsw_sp_rif_destroy()
8208 struct mlxsw_sp_rif *rif; in mlxsw_sp_rif_destroy_by_dev() local
8211 rif = mlxsw_sp_rif_find_by_dev(mlxsw_sp, dev); in mlxsw_sp_rif_destroy_by_dev()
8212 if (!rif) in mlxsw_sp_rif_destroy_by_dev()
8214 mlxsw_sp_rif_destroy(rif); in mlxsw_sp_rif_destroy_by_dev()
8234 mlxsw_sp_rif_subport_rif(const struct mlxsw_sp_rif *rif) in mlxsw_sp_rif_subport_rif() argument
8236 return container_of(rif, struct mlxsw_sp_rif_subport, common); in mlxsw_sp_rif_subport_rif()
8245 struct mlxsw_sp_rif *rif; in mlxsw_sp_rif_subport_get() local
8247 rif = mlxsw_sp_rif_find_by_dev(mlxsw_sp, params->dev); in mlxsw_sp_rif_subport_get()
8248 if (!rif) in mlxsw_sp_rif_subport_get()
8251 rif_subport = mlxsw_sp_rif_subport_rif(rif); in mlxsw_sp_rif_subport_get()
8253 return rif; in mlxsw_sp_rif_subport_get()
8256 static void mlxsw_sp_rif_subport_put(struct mlxsw_sp_rif *rif) in mlxsw_sp_rif_subport_put() argument
8260 rif_subport = mlxsw_sp_rif_subport_rif(rif); in mlxsw_sp_rif_subport_put()
8264 mlxsw_sp_rif_destroy(rif); in mlxsw_sp_rif_subport_put()
8415 static bool mlxsw_sp_rif_mac_profile_is_shared(const struct mlxsw_sp_rif *rif) in mlxsw_sp_rif_mac_profile_is_shared() argument
8417 struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp; in mlxsw_sp_rif_mac_profile_is_shared()
8421 rif->mac_profile_id); in mlxsw_sp_rif_mac_profile_is_shared()
8428 static int mlxsw_sp_rif_mac_profile_edit(struct mlxsw_sp_rif *rif, in mlxsw_sp_rif_mac_profile_edit() argument
8431 struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp; in mlxsw_sp_rif_mac_profile_edit()
8435 rif->mac_profile_id); in mlxsw_sp_rif_mac_profile_edit()
8445 struct mlxsw_sp_rif *rif, in mlxsw_sp_rif_mac_profile_replace() argument
8452 if (!mlxsw_sp_rif_mac_profile_is_shared(rif) && in mlxsw_sp_rif_mac_profile_replace()
8454 return mlxsw_sp_rif_mac_profile_edit(rif, new_mac); in mlxsw_sp_rif_mac_profile_replace()
8461 mlxsw_sp_rif_mac_profile_put(mlxsw_sp, rif->mac_profile_id); in mlxsw_sp_rif_mac_profile_replace()
8462 rif->mac_profile_id = mac_profile; in mlxsw_sp_rif_mac_profile_replace()
8477 struct mlxsw_sp_rif *rif; in __mlxsw_sp_port_vlan_router_join() local
8482 rif = mlxsw_sp_rif_subport_get(mlxsw_sp, &params, extack); in __mlxsw_sp_port_vlan_router_join()
8483 if (IS_ERR(rif)) in __mlxsw_sp_port_vlan_router_join()
8484 return PTR_ERR(rif); in __mlxsw_sp_port_vlan_router_join()
8487 fid = rif->ops->fid_get(rif, extack); in __mlxsw_sp_port_vlan_router_join()
8511 mlxsw_sp_rif_subport_put(rif); in __mlxsw_sp_port_vlan_router_join()
8520 struct mlxsw_sp_rif *rif = mlxsw_sp_fid_rif(fid); in __mlxsw_sp_port_vlan_router_leave() local
8531 mlxsw_sp_rif_subport_put(rif); in __mlxsw_sp_port_vlan_router_leave()
8540 struct mlxsw_sp_rif *rif; in mlxsw_sp_port_vlan_router_join() local
8544 rif = mlxsw_sp_rif_find_by_dev(mlxsw_sp, l3_dev); in mlxsw_sp_port_vlan_router_join()
8545 if (!rif) in mlxsw_sp_port_vlan_router_join()
8642 struct mlxsw_sp_rif *rif; in mlxsw_sp_inetaddr_bridge_event() local
8655 rif = mlxsw_sp_rif_create(mlxsw_sp, &params, extack); in mlxsw_sp_inetaddr_bridge_event()
8656 if (IS_ERR(rif)) in mlxsw_sp_inetaddr_bridge_event()
8657 return PTR_ERR(rif); in mlxsw_sp_inetaddr_bridge_event()
8660 rif = mlxsw_sp_rif_find_by_dev(mlxsw_sp, l3_dev); in mlxsw_sp_inetaddr_bridge_event()
8661 mlxsw_sp_rif_destroy(rif); in mlxsw_sp_inetaddr_bridge_event()
8737 struct mlxsw_sp_rif *rif; in mlxsw_sp_rif_macvlan_add() local
8740 rif = mlxsw_sp_rif_find_by_dev(mlxsw_sp, vlan->lowerdev); in mlxsw_sp_rif_macvlan_add()
8741 if (!rif) { in mlxsw_sp_rif_macvlan_add()
8747 mlxsw_sp_fid_index(rif->fid), true); in mlxsw_sp_rif_macvlan_add()
8751 err = mlxsw_sp_rif_vrrp_op(mlxsw_sp, rif->rif_index, in mlxsw_sp_rif_macvlan_add()
8759 if (rif->ops->fdb_del) in mlxsw_sp_rif_macvlan_add()
8760 rif->ops->fdb_del(rif, macvlan_dev->dev_addr); in mlxsw_sp_rif_macvlan_add()
8766 mlxsw_sp_fid_index(rif->fid), false); in mlxsw_sp_rif_macvlan_add()
8774 struct mlxsw_sp_rif *rif; in __mlxsw_sp_rif_macvlan_del() local
8776 rif = mlxsw_sp_rif_find_by_dev(mlxsw_sp, vlan->lowerdev); in __mlxsw_sp_rif_macvlan_del()
8780 if (!rif) in __mlxsw_sp_rif_macvlan_del()
8782 mlxsw_sp_rif_vrrp_op(mlxsw_sp, rif->rif_index, macvlan_dev->dev_addr, in __mlxsw_sp_rif_macvlan_del()
8785 mlxsw_sp_fid_index(rif->fid), false); in __mlxsw_sp_rif_macvlan_del()
8840 struct mlxsw_sp_rif *rif; in mlxsw_sp_inetaddr_event() local
8849 rif = mlxsw_sp_rif_find_by_dev(router->mlxsw_sp, dev); in mlxsw_sp_inetaddr_event()
8850 if (!mlxsw_sp_rif_should_config(rif, dev, event)) in mlxsw_sp_inetaddr_event()
8865 struct mlxsw_sp_rif *rif; in mlxsw_sp_inetaddr_valid_event() local
8873 rif = mlxsw_sp_rif_find_by_dev(mlxsw_sp, dev); in mlxsw_sp_inetaddr_valid_event()
8874 if (!mlxsw_sp_rif_should_config(rif, dev, event)) in mlxsw_sp_inetaddr_valid_event()
8897 struct mlxsw_sp_rif *rif; in mlxsw_sp_inet6addr_event_work() local
8902 rif = mlxsw_sp_rif_find_by_dev(mlxsw_sp, dev); in mlxsw_sp_inet6addr_event_work()
8903 if (!mlxsw_sp_rif_should_config(rif, dev, event)) in mlxsw_sp_inet6addr_event_work()
8948 struct mlxsw_sp_rif *rif; in mlxsw_sp_inet6addr_valid_event() local
8956 rif = mlxsw_sp_rif_find_by_dev(mlxsw_sp, dev); in mlxsw_sp_inet6addr_valid_event()
8957 if (!mlxsw_sp_rif_should_config(rif, dev, event)) in mlxsw_sp_inet6addr_valid_event()
8986 struct mlxsw_sp_rif *rif, in mlxsw_sp_router_port_change_event() argument
8989 struct net_device *dev = rif->dev; in mlxsw_sp_router_port_change_event()
8994 fid_index = mlxsw_sp_fid_index(rif->fid); in mlxsw_sp_router_port_change_event()
8996 err = mlxsw_sp_rif_fdb_op(mlxsw_sp, rif->addr, fid_index, false); in mlxsw_sp_router_port_change_event()
9000 old_mac_profile = rif->mac_profile_id; in mlxsw_sp_router_port_change_event()
9001 err = mlxsw_sp_rif_mac_profile_replace(mlxsw_sp, rif, dev->dev_addr, in mlxsw_sp_router_port_change_event()
9006 err = mlxsw_sp_rif_edit(mlxsw_sp, rif->rif_index, dev->dev_addr, in mlxsw_sp_router_port_change_event()
9007 dev->mtu, rif->mac_profile_id); in mlxsw_sp_router_port_change_event()
9015 if (rif->mtu != dev->mtu) { in mlxsw_sp_router_port_change_event()
9023 vr = &mlxsw_sp->router->vrs[rif->vr_id]; in mlxsw_sp_router_port_change_event()
9026 rif, dev->mtu); in mlxsw_sp_router_port_change_event()
9029 ether_addr_copy(rif->addr, dev->dev_addr); in mlxsw_sp_router_port_change_event()
9030 rif->mtu = dev->mtu; in mlxsw_sp_router_port_change_event()
9032 netdev_dbg(dev, "Updated RIF=%d\n", rif->rif_index); in mlxsw_sp_router_port_change_event()
9037 mlxsw_sp_rif_edit(mlxsw_sp, rif->rif_index, rif->addr, rif->mtu, in mlxsw_sp_router_port_change_event()
9040 mlxsw_sp_rif_mac_profile_replace(mlxsw_sp, rif, rif->addr, extack); in mlxsw_sp_router_port_change_event()
9042 mlxsw_sp_rif_fdb_op(mlxsw_sp, rif->addr, fid_index, true); in mlxsw_sp_router_port_change_event()
9046 static int mlxsw_sp_router_port_pre_changeaddr_event(struct mlxsw_sp_rif *rif, in mlxsw_sp_router_port_pre_changeaddr_event() argument
9049 struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp; in mlxsw_sp_router_port_pre_changeaddr_event()
9066 if (!mlxsw_sp_rif_mac_profile_is_shared(rif)) in mlxsw_sp_router_port_pre_changeaddr_event()
9087 mlxsw_sp_router_port_offload_xstats_cmd(struct mlxsw_sp_rif *rif, in mlxsw_sp_router_port_offload_xstats_cmd() argument
9100 return mlxsw_sp_router_port_l3_stats_enable(rif); in mlxsw_sp_router_port_offload_xstats_cmd()
9102 mlxsw_sp_router_port_l3_stats_disable(rif); in mlxsw_sp_router_port_offload_xstats_cmd()
9105 mlxsw_sp_router_port_l3_stats_report_used(rif, info); in mlxsw_sp_router_port_offload_xstats_cmd()
9108 return mlxsw_sp_router_port_l3_stats_report_delta(rif, info); in mlxsw_sp_router_port_offload_xstats_cmd()
9121 struct mlxsw_sp_rif *rif; in mlxsw_sp_netdevice_offload_xstats_cmd() local
9123 rif = mlxsw_sp_rif_find_by_dev(mlxsw_sp, dev); in mlxsw_sp_netdevice_offload_xstats_cmd()
9124 if (!rif) in mlxsw_sp_netdevice_offload_xstats_cmd()
9127 return mlxsw_sp_router_port_offload_xstats_cmd(rif, event, info); in mlxsw_sp_netdevice_offload_xstats_cmd()
9147 struct mlxsw_sp_rif *rif; in mlxsw_sp_netdevice_router_port_event() local
9153 rif = mlxsw_sp_rif_find_by_dev(mlxsw_sp, dev); in mlxsw_sp_netdevice_router_port_event()
9154 if (!rif) in mlxsw_sp_netdevice_router_port_event()
9160 return mlxsw_sp_router_port_change_event(mlxsw_sp, rif, extack); in mlxsw_sp_netdevice_router_port_event()
9162 return mlxsw_sp_router_port_pre_changeaddr_event(rif, ptr); in mlxsw_sp_netdevice_router_port_event()
9175 struct mlxsw_sp_rif *rif; in mlxsw_sp_port_vrf_join() local
9180 rif = mlxsw_sp_rif_find_by_dev(mlxsw_sp, l3_dev); in mlxsw_sp_port_vrf_join()
9181 if (rif) in mlxsw_sp_port_vrf_join()
9191 struct mlxsw_sp_rif *rif; in mlxsw_sp_port_vrf_leave() local
9193 rif = mlxsw_sp_rif_find_by_dev(mlxsw_sp, l3_dev); in mlxsw_sp_port_vrf_leave()
9194 if (!rif) in mlxsw_sp_port_vrf_leave()
9274 struct mlxsw_sp_rif *rif = (struct mlxsw_sp_rif *)priv->data; in __mlxsw_sp_rif_macvlan_flush() local
9279 return mlxsw_sp_rif_fdb_op(rif->mlxsw_sp, dev->dev_addr, in __mlxsw_sp_rif_macvlan_flush()
9280 mlxsw_sp_fid_index(rif->fid), false); in __mlxsw_sp_rif_macvlan_flush()
9283 static int mlxsw_sp_rif_macvlan_flush(struct mlxsw_sp_rif *rif) in mlxsw_sp_rif_macvlan_flush() argument
9286 .data = (void *)rif, in mlxsw_sp_rif_macvlan_flush()
9289 if (!netif_is_macvlan_port(rif->dev)) in mlxsw_sp_rif_macvlan_flush()
9292 netdev_warn(rif->dev, "Router interface is deleted. Upper macvlans will not work\n"); in mlxsw_sp_rif_macvlan_flush()
9293 return netdev_walk_all_upper_dev_rcu(rif->dev, in mlxsw_sp_rif_macvlan_flush()
9297 static void mlxsw_sp_rif_subport_setup(struct mlxsw_sp_rif *rif, in mlxsw_sp_rif_subport_setup() argument
9302 rif_subport = mlxsw_sp_rif_subport_rif(rif); in mlxsw_sp_rif_subport_setup()
9312 static int mlxsw_sp_rif_subport_op(struct mlxsw_sp_rif *rif, bool enable) in mlxsw_sp_rif_subport_op() argument
9314 struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp; in mlxsw_sp_rif_subport_op()
9319 rif_subport = mlxsw_sp_rif_subport_rif(rif); in mlxsw_sp_rif_subport_op()
9321 rif->rif_index, rif->vr_id, rif->dev->mtu); in mlxsw_sp_rif_subport_op()
9322 mlxsw_reg_ritr_mac_pack(ritr_pl, rif->dev->dev_addr); in mlxsw_sp_rif_subport_op()
9323 mlxsw_reg_ritr_if_mac_profile_id_set(ritr_pl, rif->mac_profile_id); in mlxsw_sp_rif_subport_op()
9324 efid = mlxsw_sp_fid_index(rif->fid); in mlxsw_sp_rif_subport_op()
9332 static int mlxsw_sp_rif_subport_configure(struct mlxsw_sp_rif *rif, in mlxsw_sp_rif_subport_configure() argument
9338 err = mlxsw_sp_rif_mac_profile_get(rif->mlxsw_sp, rif->addr, in mlxsw_sp_rif_subport_configure()
9342 rif->mac_profile_id = mac_profile; in mlxsw_sp_rif_subport_configure()
9344 err = mlxsw_sp_rif_subport_op(rif, true); in mlxsw_sp_rif_subport_configure()
9348 err = mlxsw_sp_rif_fdb_op(rif->mlxsw_sp, rif->dev->dev_addr, in mlxsw_sp_rif_subport_configure()
9349 mlxsw_sp_fid_index(rif->fid), true); in mlxsw_sp_rif_subport_configure()
9353 err = mlxsw_sp_fid_rif_set(rif->fid, rif); in mlxsw_sp_rif_subport_configure()
9360 mlxsw_sp_rif_fdb_op(rif->mlxsw_sp, rif->dev->dev_addr, in mlxsw_sp_rif_subport_configure()
9361 mlxsw_sp_fid_index(rif->fid), false); in mlxsw_sp_rif_subport_configure()
9363 mlxsw_sp_rif_subport_op(rif, false); in mlxsw_sp_rif_subport_configure()
9365 mlxsw_sp_rif_mac_profile_put(rif->mlxsw_sp, mac_profile); in mlxsw_sp_rif_subport_configure()
9369 static void mlxsw_sp_rif_subport_deconfigure(struct mlxsw_sp_rif *rif) in mlxsw_sp_rif_subport_deconfigure() argument
9371 struct mlxsw_sp_fid *fid = rif->fid; in mlxsw_sp_rif_subport_deconfigure()
9374 mlxsw_sp_rif_fdb_op(rif->mlxsw_sp, rif->dev->dev_addr, in mlxsw_sp_rif_subport_deconfigure()
9376 mlxsw_sp_rif_macvlan_flush(rif); in mlxsw_sp_rif_subport_deconfigure()
9377 mlxsw_sp_rif_subport_op(rif, false); in mlxsw_sp_rif_subport_deconfigure()
9378 mlxsw_sp_rif_mac_profile_put(rif->mlxsw_sp, rif->mac_profile_id); in mlxsw_sp_rif_subport_deconfigure()
9382 mlxsw_sp_rif_subport_fid_get(struct mlxsw_sp_rif *rif, in mlxsw_sp_rif_subport_fid_get() argument
9385 return mlxsw_sp_fid_rfid_get(rif->mlxsw_sp, rif->rif_index); in mlxsw_sp_rif_subport_fid_get()
9397 static int mlxsw_sp_rif_fid_op(struct mlxsw_sp_rif *rif, u16 fid, bool enable) in mlxsw_sp_rif_fid_op() argument
9400 struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp; in mlxsw_sp_rif_fid_op()
9403 mlxsw_reg_ritr_pack(ritr_pl, enable, type, rif->rif_index, rif->vr_id, in mlxsw_sp_rif_fid_op()
9404 rif->dev->mtu); in mlxsw_sp_rif_fid_op()
9405 mlxsw_reg_ritr_mac_pack(ritr_pl, rif->dev->dev_addr); in mlxsw_sp_rif_fid_op()
9406 mlxsw_reg_ritr_if_mac_profile_id_set(ritr_pl, rif->mac_profile_id); in mlxsw_sp_rif_fid_op()
9417 static int mlxsw_sp_rif_fid_configure(struct mlxsw_sp_rif *rif, in mlxsw_sp_rif_fid_configure() argument
9420 struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp; in mlxsw_sp_rif_fid_configure()
9421 u16 fid_index = mlxsw_sp_fid_index(rif->fid); in mlxsw_sp_rif_fid_configure()
9425 err = mlxsw_sp_rif_mac_profile_get(mlxsw_sp, rif->addr, in mlxsw_sp_rif_fid_configure()
9429 rif->mac_profile_id = mac_profile; in mlxsw_sp_rif_fid_configure()
9431 err = mlxsw_sp_rif_fid_op(rif, fid_index, true); in mlxsw_sp_rif_fid_configure()
9435 err = mlxsw_sp_fid_flood_set(rif->fid, MLXSW_SP_FLOOD_TYPE_MC, in mlxsw_sp_rif_fid_configure()
9440 err = mlxsw_sp_fid_flood_set(rif->fid, MLXSW_SP_FLOOD_TYPE_BC, in mlxsw_sp_rif_fid_configure()
9445 err = mlxsw_sp_rif_fdb_op(rif->mlxsw_sp, rif->dev->dev_addr, in mlxsw_sp_rif_fid_configure()
9446 mlxsw_sp_fid_index(rif->fid), true); in mlxsw_sp_rif_fid_configure()
9450 err = mlxsw_sp_fid_rif_set(rif->fid, rif); in mlxsw_sp_rif_fid_configure()
9457 mlxsw_sp_rif_fdb_op(rif->mlxsw_sp, rif->dev->dev_addr, in mlxsw_sp_rif_fid_configure()
9458 mlxsw_sp_fid_index(rif->fid), false); in mlxsw_sp_rif_fid_configure()
9460 mlxsw_sp_fid_flood_set(rif->fid, MLXSW_SP_FLOOD_TYPE_BC, in mlxsw_sp_rif_fid_configure()
9463 mlxsw_sp_fid_flood_set(rif->fid, MLXSW_SP_FLOOD_TYPE_MC, in mlxsw_sp_rif_fid_configure()
9466 mlxsw_sp_rif_fid_op(rif, fid_index, false); in mlxsw_sp_rif_fid_configure()
9472 static void mlxsw_sp_rif_fid_deconfigure(struct mlxsw_sp_rif *rif) in mlxsw_sp_rif_fid_deconfigure() argument
9474 u16 fid_index = mlxsw_sp_fid_index(rif->fid); in mlxsw_sp_rif_fid_deconfigure()
9475 struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp; in mlxsw_sp_rif_fid_deconfigure()
9476 struct mlxsw_sp_fid *fid = rif->fid; in mlxsw_sp_rif_fid_deconfigure()
9479 mlxsw_sp_rif_fdb_op(rif->mlxsw_sp, rif->dev->dev_addr, in mlxsw_sp_rif_fid_deconfigure()
9481 mlxsw_sp_rif_macvlan_flush(rif); in mlxsw_sp_rif_fid_deconfigure()
9482 mlxsw_sp_fid_flood_set(rif->fid, MLXSW_SP_FLOOD_TYPE_BC, in mlxsw_sp_rif_fid_deconfigure()
9484 mlxsw_sp_fid_flood_set(rif->fid, MLXSW_SP_FLOOD_TYPE_MC, in mlxsw_sp_rif_fid_deconfigure()
9486 mlxsw_sp_rif_fid_op(rif, fid_index, false); in mlxsw_sp_rif_fid_deconfigure()
9487 mlxsw_sp_rif_mac_profile_put(rif->mlxsw_sp, rif->mac_profile_id); in mlxsw_sp_rif_fid_deconfigure()
9491 mlxsw_sp_rif_fid_fid_get(struct mlxsw_sp_rif *rif, in mlxsw_sp_rif_fid_fid_get() argument
9494 return mlxsw_sp_fid_8021d_get(rif->mlxsw_sp, rif->dev->ifindex); in mlxsw_sp_rif_fid_fid_get()
9497 static void mlxsw_sp_rif_fid_fdb_del(struct mlxsw_sp_rif *rif, const char *mac) in mlxsw_sp_rif_fid_fdb_del() argument
9502 dev = br_fdb_find_port(rif->dev, mac, 0); in mlxsw_sp_rif_fid_fdb_del()
9522 mlxsw_sp_rif_vlan_fid_get(struct mlxsw_sp_rif *rif, in mlxsw_sp_rif_vlan_fid_get() argument
9529 if (is_vlan_dev(rif->dev)) { in mlxsw_sp_rif_vlan_fid_get()
9530 vid = vlan_dev_vlan_id(rif->dev); in mlxsw_sp_rif_vlan_fid_get()
9531 br_dev = vlan_dev_real_dev(rif->dev); in mlxsw_sp_rif_vlan_fid_get()
9535 err = br_vlan_get_pvid(rif->dev, &vid); in mlxsw_sp_rif_vlan_fid_get()
9542 return mlxsw_sp_fid_8021q_get(rif->mlxsw_sp, vid); in mlxsw_sp_rif_vlan_fid_get()
9545 static void mlxsw_sp_rif_vlan_fdb_del(struct mlxsw_sp_rif *rif, const char *mac) in mlxsw_sp_rif_vlan_fdb_del() argument
9548 u16 vid = mlxsw_sp_fid_8021q_vid(rif->fid); in mlxsw_sp_rif_vlan_fdb_del()
9552 br_dev = is_vlan_dev(rif->dev) ? vlan_dev_real_dev(rif->dev) : rif->dev; in mlxsw_sp_rif_vlan_fdb_del()
9563 static int mlxsw_sp_rif_vlan_op(struct mlxsw_sp_rif *rif, u16 vid, u16 efid, in mlxsw_sp_rif_vlan_op() argument
9566 struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp; in mlxsw_sp_rif_vlan_op()
9569 mlxsw_reg_ritr_vlan_if_pack(ritr_pl, enable, rif->rif_index, rif->vr_id, in mlxsw_sp_rif_vlan_op()
9570 rif->dev->mtu, rif->dev->dev_addr, in mlxsw_sp_rif_vlan_op()
9571 rif->mac_profile_id, vid, efid); in mlxsw_sp_rif_vlan_op()
9576 static int mlxsw_sp_rif_vlan_configure(struct mlxsw_sp_rif *rif, u16 efid, in mlxsw_sp_rif_vlan_configure() argument
9579 u16 vid = mlxsw_sp_fid_8021q_vid(rif->fid); in mlxsw_sp_rif_vlan_configure()
9580 struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp; in mlxsw_sp_rif_vlan_configure()
9584 err = mlxsw_sp_rif_mac_profile_get(mlxsw_sp, rif->addr, in mlxsw_sp_rif_vlan_configure()
9588 rif->mac_profile_id = mac_profile; in mlxsw_sp_rif_vlan_configure()
9590 err = mlxsw_sp_rif_vlan_op(rif, vid, efid, true); in mlxsw_sp_rif_vlan_configure()
9594 err = mlxsw_sp_fid_flood_set(rif->fid, MLXSW_SP_FLOOD_TYPE_MC, in mlxsw_sp_rif_vlan_configure()
9599 err = mlxsw_sp_fid_flood_set(rif->fid, MLXSW_SP_FLOOD_TYPE_BC, in mlxsw_sp_rif_vlan_configure()
9604 err = mlxsw_sp_rif_fdb_op(rif->mlxsw_sp, rif->dev->dev_addr, in mlxsw_sp_rif_vlan_configure()
9605 mlxsw_sp_fid_index(rif->fid), true); in mlxsw_sp_rif_vlan_configure()
9609 err = mlxsw_sp_fid_rif_set(rif->fid, rif); in mlxsw_sp_rif_vlan_configure()
9616 mlxsw_sp_rif_fdb_op(rif->mlxsw_sp, rif->dev->dev_addr, in mlxsw_sp_rif_vlan_configure()
9617 mlxsw_sp_fid_index(rif->fid), false); in mlxsw_sp_rif_vlan_configure()
9619 mlxsw_sp_fid_flood_set(rif->fid, MLXSW_SP_FLOOD_TYPE_BC, in mlxsw_sp_rif_vlan_configure()
9622 mlxsw_sp_fid_flood_set(rif->fid, MLXSW_SP_FLOOD_TYPE_MC, in mlxsw_sp_rif_vlan_configure()
9625 mlxsw_sp_rif_vlan_op(rif, vid, 0, false); in mlxsw_sp_rif_vlan_configure()
9631 static void mlxsw_sp_rif_vlan_deconfigure(struct mlxsw_sp_rif *rif) in mlxsw_sp_rif_vlan_deconfigure() argument
9633 u16 vid = mlxsw_sp_fid_8021q_vid(rif->fid); in mlxsw_sp_rif_vlan_deconfigure()
9634 struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp; in mlxsw_sp_rif_vlan_deconfigure()
9636 mlxsw_sp_fid_rif_unset(rif->fid); in mlxsw_sp_rif_vlan_deconfigure()
9637 mlxsw_sp_rif_fdb_op(rif->mlxsw_sp, rif->dev->dev_addr, in mlxsw_sp_rif_vlan_deconfigure()
9638 mlxsw_sp_fid_index(rif->fid), false); in mlxsw_sp_rif_vlan_deconfigure()
9639 mlxsw_sp_rif_macvlan_flush(rif); in mlxsw_sp_rif_vlan_deconfigure()
9640 mlxsw_sp_fid_flood_set(rif->fid, MLXSW_SP_FLOOD_TYPE_BC, in mlxsw_sp_rif_vlan_deconfigure()
9642 mlxsw_sp_fid_flood_set(rif->fid, MLXSW_SP_FLOOD_TYPE_MC, in mlxsw_sp_rif_vlan_deconfigure()
9644 mlxsw_sp_rif_vlan_op(rif, vid, 0, false); in mlxsw_sp_rif_vlan_deconfigure()
9645 mlxsw_sp_rif_mac_profile_put(rif->mlxsw_sp, rif->mac_profile_id); in mlxsw_sp_rif_vlan_deconfigure()
9648 static int mlxsw_sp1_rif_vlan_configure(struct mlxsw_sp_rif *rif, in mlxsw_sp1_rif_vlan_configure() argument
9651 return mlxsw_sp_rif_vlan_configure(rif, 0, extack); in mlxsw_sp1_rif_vlan_configure()
9663 static int mlxsw_sp2_rif_vlan_configure(struct mlxsw_sp_rif *rif, in mlxsw_sp2_rif_vlan_configure() argument
9666 u16 efid = mlxsw_sp_fid_index(rif->fid); in mlxsw_sp2_rif_vlan_configure()
9668 return mlxsw_sp_rif_vlan_configure(rif, efid, extack); in mlxsw_sp2_rif_vlan_configure()
9681 mlxsw_sp_rif_ipip_lb_rif(struct mlxsw_sp_rif *rif) in mlxsw_sp_rif_ipip_lb_rif() argument
9683 return container_of(rif, struct mlxsw_sp_rif_ipip_lb, common); in mlxsw_sp_rif_ipip_lb_rif()
9687 mlxsw_sp_rif_ipip_lb_setup(struct mlxsw_sp_rif *rif, in mlxsw_sp_rif_ipip_lb_setup() argument
9695 rif_lb = mlxsw_sp_rif_ipip_lb_rif(rif); in mlxsw_sp_rif_ipip_lb_setup()
9700 mlxsw_sp1_rif_ipip_lb_configure(struct mlxsw_sp_rif *rif, in mlxsw_sp1_rif_ipip_lb_configure() argument
9703 struct mlxsw_sp_rif_ipip_lb *lb_rif = mlxsw_sp_rif_ipip_lb_rif(rif); in mlxsw_sp1_rif_ipip_lb_configure()
9704 u32 ul_tb_id = mlxsw_sp_ipip_dev_ul_tb_id(rif->dev); in mlxsw_sp1_rif_ipip_lb_configure()
9705 struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp; in mlxsw_sp1_rif_ipip_lb_configure()
9727 static void mlxsw_sp1_rif_ipip_lb_deconfigure(struct mlxsw_sp_rif *rif) in mlxsw_sp1_rif_ipip_lb_deconfigure() argument
9729 struct mlxsw_sp_rif_ipip_lb *lb_rif = mlxsw_sp_rif_ipip_lb_rif(rif); in mlxsw_sp1_rif_ipip_lb_deconfigure()
9730 struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp; in mlxsw_sp1_rif_ipip_lb_deconfigure()
9890 mlxsw_sp2_rif_ipip_lb_configure(struct mlxsw_sp_rif *rif, in mlxsw_sp2_rif_ipip_lb_configure() argument
9893 struct mlxsw_sp_rif_ipip_lb *lb_rif = mlxsw_sp_rif_ipip_lb_rif(rif); in mlxsw_sp2_rif_ipip_lb_configure()
9894 u32 ul_tb_id = mlxsw_sp_ipip_dev_ul_tb_id(rif->dev); in mlxsw_sp2_rif_ipip_lb_configure()
9895 struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp; in mlxsw_sp2_rif_ipip_lb_configure()
9917 static void mlxsw_sp2_rif_ipip_lb_deconfigure(struct mlxsw_sp_rif *rif) in mlxsw_sp2_rif_ipip_lb_deconfigure() argument
9919 struct mlxsw_sp_rif_ipip_lb *lb_rif = mlxsw_sp_rif_ipip_lb_rif(rif); in mlxsw_sp2_rif_ipip_lb_deconfigure()
9920 struct mlxsw_sp *mlxsw_sp = rif->mlxsw_sp; in mlxsw_sp2_rif_ipip_lb_deconfigure()