Lines Matching refs:v
38 const struct net_bridge_vlan *v) in __vlan_add_pvid() argument
40 if (vg->pvid == v->vid) in __vlan_add_pvid()
44 br_vlan_set_pvid_state(vg, v->state); in __vlan_add_pvid()
45 vg->pvid = v->vid; in __vlan_add_pvid()
61 static bool __vlan_flags_update(struct net_bridge_vlan *v, u16 flags, in __vlan_flags_update() argument
67 if (br_vlan_is_master(v)) in __vlan_flags_update()
68 vg = br_vlan_group(v->br); in __vlan_flags_update()
70 vg = nbp_vlan_group(v->port); in __vlan_flags_update()
73 change = !!(flags & BRIDGE_VLAN_INFO_PVID) == !!(vg->pvid != v->vid) || in __vlan_flags_update()
74 ((flags ^ v->flags) & BRIDGE_VLAN_INFO_UNTAGGED); in __vlan_flags_update()
80 __vlan_add_pvid(vg, v); in __vlan_flags_update()
82 __vlan_delete_pvid(vg, v->vid); in __vlan_flags_update()
85 v->flags |= BRIDGE_VLAN_INFO_UNTAGGED; in __vlan_flags_update()
87 v->flags &= ~BRIDGE_VLAN_INFO_UNTAGGED; in __vlan_flags_update()
93 static bool __vlan_flags_would_change(struct net_bridge_vlan *v, u16 flags) in __vlan_flags_would_change() argument
95 return __vlan_flags_update(v, flags, false); in __vlan_flags_would_change()
98 static void __vlan_flags_commit(struct net_bridge_vlan *v, u16 flags) in __vlan_flags_commit() argument
100 __vlan_flags_update(v, flags, true); in __vlan_flags_commit()
104 struct net_bridge_vlan *v, u16 flags, in __vlan_vid_add() argument
112 err = br_switchdev_port_vlan_add(dev, v->vid, flags, false, extack); in __vlan_vid_add()
114 return vlan_vid_add(dev, br->vlan_proto, v->vid); in __vlan_vid_add()
115 v->priv_flags |= BR_VLFLAG_ADDED_BY_SWITCHDEV; in __vlan_vid_add()
119 static void __vlan_add_list(struct net_bridge_vlan *v) in __vlan_add_list() argument
125 if (br_vlan_is_master(v)) in __vlan_add_list()
126 vg = br_vlan_group(v->br); in __vlan_add_list()
128 vg = nbp_vlan_group(v->port); in __vlan_add_list()
133 if (v->vid >= vent->vid) in __vlan_add_list()
136 list_add_rcu(&v->vlist, hpos); in __vlan_add_list()
139 static void __vlan_del_list(struct net_bridge_vlan *v) in __vlan_del_list() argument
141 list_del_rcu(&v->vlist); in __vlan_del_list()
145 const struct net_bridge_vlan *v) in __vlan_vid_del() argument
152 err = br_switchdev_port_vlan_del(dev, v->vid); in __vlan_vid_del()
153 if (!(v->priv_flags & BR_VLFLAG_ADDED_BY_SWITCHDEV)) in __vlan_vid_del()
154 vlan_vid_del(dev, br->vlan_proto, v->vid); in __vlan_vid_del()
189 struct net_bridge_vlan *v; in br_master_vlan_rcu_free() local
191 v = container_of(rcu, struct net_bridge_vlan, rcu); in br_master_vlan_rcu_free()
192 WARN_ON(!br_vlan_is_master(v)); in br_master_vlan_rcu_free()
193 free_percpu(v->stats); in br_master_vlan_rcu_free()
194 v->stats = NULL; in br_master_vlan_rcu_free()
195 kfree(v); in br_master_vlan_rcu_free()
218 struct net_bridge_vlan *v; in nbp_vlan_rcu_free() local
220 v = container_of(rcu, struct net_bridge_vlan, rcu); in nbp_vlan_rcu_free()
221 WARN_ON(br_vlan_is_master(v)); in nbp_vlan_rcu_free()
223 if (v->priv_flags & BR_VLFLAG_PER_PORT_STATS) in nbp_vlan_rcu_free()
224 free_percpu(v->stats); in nbp_vlan_rcu_free()
225 v->stats = NULL; in nbp_vlan_rcu_free()
226 kfree(v); in nbp_vlan_rcu_free()
229 static void br_vlan_init_state(struct net_bridge_vlan *v) in br_vlan_init_state() argument
233 if (br_vlan_is_master(v)) in br_vlan_init_state()
234 br = v->br; in br_vlan_init_state()
236 br = v->port->br; in br_vlan_init_state()
239 br_mst_vlan_init_state(v); in br_vlan_init_state()
243 v->state = BR_STATE_FORWARDING; in br_vlan_init_state()
244 v->msti = 0; in br_vlan_init_state()
258 static int __vlan_add(struct net_bridge_vlan *v, u16 flags, in __vlan_add() argument
268 if (br_vlan_is_master(v)) { in __vlan_add()
269 br = v->br; in __vlan_add()
273 p = v->port; in __vlan_add()
284 err = __vlan_vid_add(dev, br, v, flags, extack); in __vlan_add()
292 err = br_vlan_add(br, v->vid, in __vlan_add()
299 br_vlan_notify(br, NULL, v->vid, 0, in __vlan_add()
303 masterv = br_vlan_get_master(br, v->vid, extack); in __vlan_add()
308 v->brvlan = masterv; in __vlan_add()
310 v->stats = in __vlan_add()
312 if (!v->stats) { in __vlan_add()
316 v->priv_flags |= BR_VLFLAG_PER_PORT_STATS; in __vlan_add()
318 v->stats = masterv->stats; in __vlan_add()
320 br_multicast_port_ctx_init(p, v, &v->port_mcast_ctx); in __vlan_add()
322 if (br_vlan_should_use(v)) { in __vlan_add()
323 err = br_switchdev_port_vlan_add(dev, v->vid, flags, in __vlan_add()
328 br_multicast_ctx_init(br, v, &v->br_mcast_ctx); in __vlan_add()
329 v->priv_flags |= BR_VLFLAG_GLOBAL_MCAST_ENABLED; in __vlan_add()
333 if (br_vlan_should_use(v)) { in __vlan_add()
334 err = br_fdb_add_local(br, p, dev->dev_addr, v->vid); in __vlan_add()
343 br_vlan_init_state(v); in __vlan_add()
345 err = rhashtable_lookup_insert_fast(&vg->vlan_hash, &v->vnode, in __vlan_add()
350 __vlan_add_list(v); in __vlan_add()
351 __vlan_flags_commit(v, flags); in __vlan_add()
352 br_multicast_toggle_one_vlan(v, true); in __vlan_add()
355 nbp_vlan_set_vlan_dev_state(p, v->vid); in __vlan_add()
360 if (br_vlan_should_use(v)) { in __vlan_add()
361 br_fdb_find_delete_local(br, p, dev->dev_addr, v->vid); in __vlan_add()
367 __vlan_vid_del(dev, br, v); in __vlan_add()
369 if (v->stats && masterv->stats != v->stats) in __vlan_add()
370 free_percpu(v->stats); in __vlan_add()
371 v->stats = NULL; in __vlan_add()
374 v->brvlan = NULL; in __vlan_add()
377 br_switchdev_port_vlan_del(dev, v->vid); in __vlan_add()
383 static int __vlan_del(struct net_bridge_vlan *v) in __vlan_del() argument
385 struct net_bridge_vlan *masterv = v; in __vlan_del()
390 if (br_vlan_is_master(v)) { in __vlan_del()
391 vg = br_vlan_group(v->br); in __vlan_del()
393 p = v->port; in __vlan_del()
394 vg = nbp_vlan_group(v->port); in __vlan_del()
395 masterv = v->brvlan; in __vlan_del()
398 __vlan_delete_pvid(vg, v->vid); in __vlan_del()
400 err = __vlan_vid_del(p->dev, p->br, v); in __vlan_del()
404 err = br_switchdev_port_vlan_del(v->br->dev, v->vid); in __vlan_del()
410 if (br_vlan_should_use(v)) { in __vlan_del()
411 v->flags &= ~BRIDGE_VLAN_INFO_BRENTRY; in __vlan_del()
415 if (masterv != v) { in __vlan_del()
416 vlan_tunnel_info_del(vg, v); in __vlan_del()
417 rhashtable_remove_fast(&vg->vlan_hash, &v->vnode, in __vlan_del()
419 __vlan_del_list(v); in __vlan_del()
420 nbp_vlan_set_vlan_dev_state(p, v->vid); in __vlan_del()
421 br_multicast_toggle_one_vlan(v, false); in __vlan_del()
422 br_multicast_port_ctx_deinit(&v->port_mcast_ctx); in __vlan_del()
423 call_rcu(&v->rcu, nbp_vlan_rcu_free); in __vlan_del()
479 struct net_bridge_vlan *v; in br_handle_vlan() local
491 v = br_vlan_find(vg, vid); in br_handle_vlan()
497 if (!v || !br_vlan_should_use(v)) { in br_handle_vlan()
506 stats = this_cpu_ptr(v->stats); in br_handle_vlan()
520 if (v->flags & BRIDGE_VLAN_INFO_UNTAGGED && in br_handle_vlan()
525 br_handle_egress_vlan_tunnel(skb, v)) { in br_handle_vlan()
541 struct net_bridge_vlan *v; in __allowed_ingress() local
614 v = br_vlan_find(vg, *vid); in __allowed_ingress()
615 if (!v || !br_vlan_should_use(v)) in __allowed_ingress()
619 *state = br_vlan_get_state(v); in __allowed_ingress()
625 stats = this_cpu_ptr(v->stats); in __allowed_ingress()
632 *vlan = v; in __allowed_ingress()
662 const struct net_bridge_vlan *v; in br_allowed_egress() local
670 v = br_vlan_find(vg, vid); in br_allowed_egress()
671 if (v && br_vlan_should_use(v) && in br_allowed_egress()
672 br_vlan_state_allowed(br_vlan_get_state(v), false)) in br_allowed_egress()
683 struct net_bridge_vlan *v; in br_should_learn() local
705 v = br_vlan_find(vg, *vid); in br_should_learn()
706 if (v && br_vlan_state_allowed(br_vlan_get_state(v), true)) in br_should_learn()
818 struct net_bridge_vlan *v; in br_vlan_delete() local
823 v = br_vlan_find(vg, vid); in br_vlan_delete()
824 if (!v || !br_vlan_is_brentry(v)) in br_vlan_delete()
830 vlan_tunnel_info_del(vg, v); in br_vlan_delete()
832 return __vlan_del(v); in br_vlan_delete()
1058 struct net_bridge_vlan *v; in vlan_default_pvid() local
1063 v = br_vlan_lookup(&vg->vlan_hash, vid); in vlan_default_pvid()
1064 if (v && br_vlan_should_use(v) && in vlan_default_pvid()
1065 (v->flags & BRIDGE_VLAN_INFO_UNTAGGED)) in vlan_default_pvid()
1353 struct net_bridge_vlan *v; in nbp_vlan_delete() local
1357 v = br_vlan_find(nbp_vlan_group(port), vid); in nbp_vlan_delete()
1358 if (!v) in nbp_vlan_delete()
1363 return __vlan_del(v); in nbp_vlan_delete()
1379 void br_vlan_get_stats(const struct net_bridge_vlan *v, in br_vlan_get_stats() argument
1390 cpu_stats = per_cpu_ptr(v->stats, i); in br_vlan_get_stats()
1475 struct net_bridge_vlan *v; in br_vlan_fill_forward_path_mode() local
1481 v = br_vlan_find(vg, path->bridge.vlan_id); in br_vlan_fill_forward_path_mode()
1482 if (!v || !br_vlan_should_use(v)) in br_vlan_fill_forward_path_mode()
1485 if (!(v->flags & BRIDGE_VLAN_INFO_UNTAGGED)) in br_vlan_fill_forward_path_mode()
1490 else if (v->priv_flags & BR_VLFLAG_ADDED_BY_SWITCHDEV) in br_vlan_fill_forward_path_mode()
1502 struct net_bridge_vlan *v; in br_vlan_get_info() local
1514 v = br_vlan_find(vg, vid); in br_vlan_get_info()
1515 if (!v) in br_vlan_get_info()
1519 p_vinfo->flags = v->flags; in br_vlan_get_info()
1530 struct net_bridge_vlan *v; in br_vlan_get_info_rcu() local
1541 v = br_vlan_find(vg, vid); in br_vlan_get_info_rcu()
1542 if (!v) in br_vlan_get_info_rcu()
1546 p_vinfo->flags = v->flags; in br_vlan_get_info_rcu()
1783 const struct net_bridge_vlan *v) in br_vlan_stats_fill() argument
1792 br_vlan_get_stats(v, &stats); in br_vlan_stats_fill()
1877 struct net_bridge_vlan *v = NULL; in br_vlan_notify() local
1915 v = br_vlan_find(vg, vid); in br_vlan_notify()
1916 if (!v || !br_vlan_should_use(v)) in br_vlan_notify()
1919 flags = v->flags; in br_vlan_notify()
1920 if (br_get_pvid(vg) == v->vid) in br_vlan_notify()
1929 if (!br_vlan_fill_vids(skb, vid, vid_range, v, p, flags, false)) in br_vlan_notify()
1956 struct net_bridge_vlan *v, *range_start = NULL, *range_end = NULL; in br_vlan_dump_dev() local
2001 list_for_each_entry_rcu(v, &vg->vlan_list, vlist) { in br_vlan_dump_dev()
2002 if (!dump_global && !br_vlan_should_use(v)) in br_vlan_dump_dev()
2010 range_start = v; in br_vlan_dump_dev()
2011 range_end = v; in br_vlan_dump_dev()
2016 if (br_vlan_global_opts_can_enter_range(v, range_end)) in br_vlan_dump_dev()
2027 range_start = v; in br_vlan_dump_dev()
2028 } else if (dump_stats || v->vid == pvid || in br_vlan_dump_dev()
2029 !br_vlan_can_enter_range(v, range_end)) { in br_vlan_dump_dev()
2041 range_start = v; in br_vlan_dump_dev()
2044 range_end = v; in br_vlan_dump_dev()