Lines Matching +full:3 +full:br
26 .nelem_hint = 3,
68 vg = br_vlan_group(v->br); in __vlan_flags_update()
103 static int __vlan_vid_add(struct net_device *dev, struct net_bridge *br, in __vlan_vid_add() argument
114 return vlan_vid_add(dev, br->vlan_proto, v->vid); in __vlan_vid_add()
126 vg = br_vlan_group(v->br); in __vlan_add_list()
144 static int __vlan_vid_del(struct net_device *dev, struct net_bridge *br, in __vlan_vid_del() argument
154 vlan_vid_del(dev, br->vlan_proto, v->vid); in __vlan_vid_del()
162 br_vlan_get_master(struct net_bridge *br, u16 vid, in br_vlan_get_master() argument
168 vg = br_vlan_group(br); in br_vlan_get_master()
174 if (br_vlan_add(br, vid, 0, &changed, extack)) in br_vlan_get_master()
205 vg = br_vlan_group(masterv->br); in br_vlan_put_master()
231 struct net_bridge *br; in br_vlan_init_state() local
234 br = v->br; in br_vlan_init_state()
236 br = v->port->br; in br_vlan_init_state()
238 if (br_opt_get(br, BROPT_MST_ENABLED)) { in br_vlan_init_state()
252 * 3. vlan is being added on a port, but a global entry didn't exist which
255 * 4. same as 3 but with both master and brentry flags set so the entry
265 struct net_bridge *br; in __vlan_add() local
269 br = v->br; in __vlan_add()
270 dev = br->dev; in __vlan_add()
271 vg = br_vlan_group(br); in __vlan_add()
274 br = p->br; 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()
309 if (br_opt_get(br, BROPT_VLAN_STATS_PER_PORT)) { in __vlan_add()
328 br_multicast_ctx_init(br, v, &v->br_mcast_ctx); in __vlan_add()
334 err = br_fdb_add_local(br, p, dev->dev_addr, v->vid); in __vlan_add()
336 br_err(br, "failed insert local address into bridge forwarding table\n"); 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()
391 vg = br_vlan_group(v->br); 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()
439 static void __vlan_flush(const struct net_bridge *br, in __vlan_flush() argument
454 br_vlan_notify(br, p, v_start, v_end, RTM_DELVLAN); in __vlan_flush()
461 br_err(br, in __vlan_flush()
470 br_vlan_notify(br, p, v_start, v_end, RTM_DELVLAN); in __vlan_flush()
473 struct sk_buff *br_handle_vlan(struct net_bridge *br, in br_handle_vlan() argument
498 if ((br->dev->flags & IFF_PROMISC) && skb->dev == br->dev) { in br_handle_vlan()
505 if (br_opt_get(br, BROPT_VLAN_STATS_ENABLED)) { in br_handle_vlan()
534 static bool __allowed_ingress(const struct net_bridge *br, in __allowed_ingress() argument
550 skb->protocol == br->vlan_proto)) { in __allowed_ingress()
558 if (skb->vlan_proto != br->vlan_proto) { in __allowed_ingress()
594 __vlan_hwaccel_put_tag(skb, br->vlan_proto, pvid); in __allowed_ingress()
604 if (!br_opt_get(br, BROPT_MCAST_VLAN_SNOOPING_ENABLED) && in __allowed_ingress()
605 !br_opt_get(br, BROPT_VLAN_STATS_ENABLED)) { in __allowed_ingress()
624 if (br_opt_get(br, BROPT_VLAN_STATS_ENABLED)) { in __allowed_ingress()
641 bool br_allowed_ingress(const struct net_bridge *br, in br_allowed_ingress() argument
650 if (!br_opt_get(br, BROPT_VLAN_ENABLED)) { in br_allowed_ingress()
655 return __allowed_ingress(br, vg, skb, vid, state, vlan); in br_allowed_ingress()
682 struct net_bridge *br = p->br; in br_should_learn() local
686 if (!br_opt_get(br, BROPT_VLAN_ENABLED)) in br_should_learn()
693 if (!br_vlan_get_tag(skb, vid) && skb->vlan_proto != br->vlan_proto) in br_should_learn()
712 static int br_vlan_add_existing(struct net_bridge *br, in br_vlan_add_existing() argument
734 err = br_switchdev_port_vlan_add(br->dev, vlan->vid, flags, in br_vlan_add_existing()
742 err = br_fdb_add_local(br, NULL, br->dev->dev_addr, vlan->vid); in br_vlan_add_existing()
744 br_err(br, "failed to insert local address into bridge forwarding table\n"); in br_vlan_add_existing()
762 br_switchdev_port_vlan_del(br->dev, vlan->vid); in br_vlan_add_existing()
770 int br_vlan_add(struct net_bridge *br, u16 vid, u16 flags, bool *changed, in br_vlan_add() argument
780 vg = br_vlan_group(br); in br_vlan_add()
783 return br_vlan_add_existing(br, vg, vlan, flags, changed, in br_vlan_add()
798 vlan->br = br; in br_vlan_add()
815 int br_vlan_delete(struct net_bridge *br, u16 vid) in br_vlan_delete() argument
822 vg = br_vlan_group(br); in br_vlan_delete()
827 br_fdb_find_delete_local(br, NULL, br->dev->dev_addr, vid); in br_vlan_delete()
828 br_fdb_delete_by_port(br, NULL, vid, 0); in br_vlan_delete()
835 void br_vlan_flush(struct net_bridge *br) in br_vlan_flush() argument
841 vg = br_vlan_group(br); in br_vlan_flush()
842 __vlan_flush(br, NULL, vg); in br_vlan_flush()
843 RCU_INIT_POINTER(br->vlgrp, NULL); in br_vlan_flush()
857 static void recalculate_group_addr(struct net_bridge *br) in recalculate_group_addr() argument
859 if (br_opt_get(br, BROPT_GROUP_ADDR_SET)) in recalculate_group_addr()
862 spin_lock_bh(&br->lock); in recalculate_group_addr()
863 if (!br_opt_get(br, BROPT_VLAN_ENABLED) || in recalculate_group_addr()
864 br->vlan_proto == htons(ETH_P_8021Q)) { in recalculate_group_addr()
866 br->group_addr[5] = 0x00; in recalculate_group_addr()
869 br->group_addr[5] = 0x08; in recalculate_group_addr()
871 spin_unlock_bh(&br->lock); in recalculate_group_addr()
875 void br_recalculate_fwd_mask(struct net_bridge *br) in br_recalculate_fwd_mask() argument
877 if (!br_opt_get(br, BROPT_VLAN_ENABLED) || in br_recalculate_fwd_mask()
878 br->vlan_proto == htons(ETH_P_8021Q)) in br_recalculate_fwd_mask()
879 br->group_fwd_mask_required = BR_GROUPFWD_DEFAULT; in br_recalculate_fwd_mask()
881 br->group_fwd_mask_required = BR_GROUPFWD_8021AD & in br_recalculate_fwd_mask()
882 ~(1u << br->group_addr[5]); in br_recalculate_fwd_mask()
885 int br_vlan_filter_toggle(struct net_bridge *br, unsigned long val, in br_vlan_filter_toggle() argument
889 .orig_dev = br->dev, in br_vlan_filter_toggle()
896 if (br_opt_get(br, BROPT_VLAN_ENABLED) == !!val) in br_vlan_filter_toggle()
899 br_opt_toggle(br, BROPT_VLAN_ENABLED, !!val); in br_vlan_filter_toggle()
901 err = switchdev_port_attr_set(br->dev, &attr, extack); in br_vlan_filter_toggle()
903 br_opt_toggle(br, BROPT_VLAN_ENABLED, !val); in br_vlan_filter_toggle()
907 br_manage_promisc(br); in br_vlan_filter_toggle()
908 recalculate_group_addr(br); in br_vlan_filter_toggle()
909 br_recalculate_fwd_mask(br); in br_vlan_filter_toggle()
910 if (!val && br_opt_get(br, BROPT_MCAST_VLAN_SNOOPING_ENABLED)) { in br_vlan_filter_toggle()
911 br_info(br, "vlan filtering disabled, automatically disabling multicast vlan snooping\n"); in br_vlan_filter_toggle()
912 br_multicast_toggle_vlan_snooping(br, false, NULL); in br_vlan_filter_toggle()
920 struct net_bridge *br = netdev_priv(dev); in br_vlan_enabled() local
922 return br_opt_get(br, BROPT_VLAN_ENABLED); in br_vlan_enabled()
928 struct net_bridge *br = netdev_priv(dev); in br_vlan_get_proto() local
930 *p_proto = ntohs(br->vlan_proto); in br_vlan_get_proto()
936 int __br_vlan_set_proto(struct net_bridge *br, __be16 proto, in __br_vlan_set_proto() argument
940 .orig_dev = br->dev, in __br_vlan_set_proto()
949 __be16 oldproto = br->vlan_proto; in __br_vlan_set_proto()
951 if (br->vlan_proto == proto) in __br_vlan_set_proto()
954 err = switchdev_port_attr_set(br->dev, &attr, extack); in __br_vlan_set_proto()
959 list_for_each_entry(p, &br->port_list, list) { in __br_vlan_set_proto()
970 br->vlan_proto = proto; in __br_vlan_set_proto()
972 recalculate_group_addr(br); in __br_vlan_set_proto()
973 br_recalculate_fwd_mask(br); in __br_vlan_set_proto()
976 list_for_each_entry(p, &br->port_list, list) { in __br_vlan_set_proto()
989 switchdev_port_attr_set(br->dev, &attr, NULL); in __br_vlan_set_proto()
997 list_for_each_entry_continue_reverse(p, &br->port_list, list) { in __br_vlan_set_proto()
1009 int br_vlan_set_proto(struct net_bridge *br, unsigned long val, in br_vlan_set_proto() argument
1015 return __br_vlan_set_proto(br, htons(val), extack); in br_vlan_set_proto()
1018 int br_vlan_set_stats(struct net_bridge *br, unsigned long val) in br_vlan_set_stats() argument
1023 br_opt_toggle(br, BROPT_VLAN_STATS_ENABLED, !!val); in br_vlan_set_stats()
1032 int br_vlan_set_stats_per_port(struct net_bridge *br, unsigned long val) in br_vlan_set_stats_per_port() argument
1037 list_for_each_entry(p, &br->port_list, list) { in br_vlan_set_stats_per_port()
1047 br_opt_toggle(br, BROPT_VLAN_STATS_PER_PORT, !!val); in br_vlan_set_stats_per_port()
1071 static void br_vlan_disable_default_pvid(struct net_bridge *br) in br_vlan_disable_default_pvid() argument
1074 u16 pvid = br->default_pvid; in br_vlan_disable_default_pvid()
1079 if (vlan_default_pvid(br_vlan_group(br), pvid)) { in br_vlan_disable_default_pvid()
1080 if (!br_vlan_delete(br, pvid)) in br_vlan_disable_default_pvid()
1081 br_vlan_notify(br, NULL, pvid, 0, RTM_DELVLAN); in br_vlan_disable_default_pvid()
1084 list_for_each_entry(p, &br->port_list, list) { in br_vlan_disable_default_pvid()
1087 br_vlan_notify(br, p, pvid, 0, RTM_DELVLAN); in br_vlan_disable_default_pvid()
1090 br->default_pvid = 0; in br_vlan_disable_default_pvid()
1093 int __br_vlan_set_default_pvid(struct net_bridge *br, u16 pvid, in __br_vlan_set_default_pvid() argument
1105 br_vlan_disable_default_pvid(br); in __br_vlan_set_default_pvid()
1113 old_pvid = br->default_pvid; in __br_vlan_set_default_pvid()
1118 vg = br_vlan_group(br); in __br_vlan_set_default_pvid()
1122 err = br_vlan_add(br, pvid, in __br_vlan_set_default_pvid()
1130 if (br_vlan_delete(br, old_pvid)) in __br_vlan_set_default_pvid()
1131 br_vlan_notify(br, NULL, old_pvid, 0, RTM_DELVLAN); in __br_vlan_set_default_pvid()
1132 br_vlan_notify(br, NULL, pvid, 0, RTM_NEWVLAN); in __br_vlan_set_default_pvid()
1136 list_for_each_entry(p, &br->port_list, list) { in __br_vlan_set_default_pvid()
1153 br_vlan_notify(br, p, old_pvid, 0, RTM_DELVLAN); in __br_vlan_set_default_pvid()
1154 br_vlan_notify(p->br, p, pvid, 0, RTM_NEWVLAN); in __br_vlan_set_default_pvid()
1158 br->default_pvid = pvid; in __br_vlan_set_default_pvid()
1165 list_for_each_entry_continue_reverse(p, &br->port_list, list) { in __br_vlan_set_default_pvid()
1174 br_vlan_notify(p->br, p, old_pvid, 0, RTM_NEWVLAN); in __br_vlan_set_default_pvid()
1177 br_vlan_notify(br, p, pvid, 0, RTM_DELVLAN); in __br_vlan_set_default_pvid()
1182 br_vlan_add(br, old_pvid, in __br_vlan_set_default_pvid()
1187 br_vlan_notify(br, NULL, old_pvid, 0, RTM_NEWVLAN); in __br_vlan_set_default_pvid()
1189 br_vlan_delete(br, pvid); in __br_vlan_set_default_pvid()
1190 br_vlan_notify(br, NULL, pvid, 0, RTM_DELVLAN); in __br_vlan_set_default_pvid()
1195 int br_vlan_set_default_pvid(struct net_bridge *br, unsigned long val, in br_vlan_set_default_pvid() argument
1204 if (pvid == br->default_pvid) in br_vlan_set_default_pvid()
1208 if (br_opt_get(br, BROPT_VLAN_ENABLED)) { in br_vlan_set_default_pvid()
1213 err = __br_vlan_set_default_pvid(br, pvid, extack); in br_vlan_set_default_pvid()
1218 int br_vlan_init(struct net_bridge *br) in br_vlan_init() argument
1233 br->vlan_proto = htons(ETH_P_8021Q); in br_vlan_init()
1234 br->default_pvid = 1; in br_vlan_init()
1235 rcu_assign_pointer(br->vlgrp, vg); in br_vlan_init()
1251 .orig_dev = p->br->dev, in nbp_vlan_init()
1254 .u.vlan_filtering = br_opt_get(p->br, BROPT_VLAN_ENABLED), in nbp_vlan_init()
1275 if (p->br->default_pvid) { in nbp_vlan_init()
1278 ret = nbp_vlan_add(p, p->br->default_pvid, in nbp_vlan_init()
1284 br_vlan_notify(p->br, p, p->br->default_pvid, 0, RTM_NEWVLAN); in nbp_vlan_init()
1360 br_fdb_find_delete_local(port->br, port, port->dev->dev_addr, vid); in nbp_vlan_delete()
1361 br_fdb_delete_by_port(port->br, port, vid, 0); in nbp_vlan_delete()
1373 __vlan_flush(port->br, port, vg); in nbp_vlan_flush()
1443 void br_vlan_fill_forward_path_pvid(struct net_bridge *br, in br_vlan_fill_forward_path_pvid() argument
1453 if (!br_opt_get(br, BROPT_VLAN_ENABLED)) in br_vlan_fill_forward_path_pvid()
1456 vg = br_vlan_group(br); in br_vlan_fill_forward_path_pvid()
1459 ctx->vlan[idx].proto == br->vlan_proto) { in br_vlan_fill_forward_path_pvid()
1467 path->bridge.vlan_proto = br->vlan_proto; in br_vlan_fill_forward_path_pvid()
1470 int br_vlan_fill_forward_path_mode(struct net_bridge *br, in br_vlan_fill_forward_path_mode() argument
1477 if (!br_opt_get(br, BROPT_VLAN_ENABLED)) in br_vlan_fill_forward_path_mode()
1620 static void br_vlan_set_vlan_dev_state(const struct net_bridge *br, in br_vlan_set_vlan_dev_state() argument
1628 if (!netif_carrier_ok(br->dev)) { in br_vlan_set_vlan_dev_state()
1633 list_for_each_entry(p, &br->port_list, list) { in br_vlan_set_vlan_dev_state()
1654 vlan_dev = br_vlan_get_upper_bind_vlan_dev(p->br->dev, in br_vlan_set_all_vlan_dev_state()
1658 if (netif_carrier_ok(p->br->dev)) in br_vlan_set_all_vlan_dev_state()
1661 br_vlan_set_vlan_dev_state(p->br, vlan_dev); in br_vlan_set_all_vlan_dev_state()
1671 struct net_bridge *br = netdev_priv(dev); in br_vlan_upper_change() local
1677 br_vlan_set_vlan_dev_state(br, upper_dev); in br_vlan_upper_change()
1678 br_opt_toggle(br, BROPT_VLAN_BRIDGE_BINDING, true); in br_vlan_upper_change()
1680 br_opt_toggle(br, BROPT_VLAN_BRIDGE_BINDING, in br_vlan_upper_change()
1686 struct net_bridge *br; member
1695 br_vlan_set_vlan_dev_state(data->br, vlan_dev); in br_vlan_link_state_change_fn()
1701 struct net_bridge *br) in br_vlan_link_state_change() argument
1704 .br = br in br_vlan_link_state_change()
1721 if (!br_opt_get(p->br, BROPT_VLAN_BRIDGE_BINDING)) in nbp_vlan_set_vlan_dev_state()
1724 vlan_dev = br_vlan_get_upper_bind_vlan_dev(p->br->dev, vid); in nbp_vlan_set_vlan_dev_state()
1726 br_vlan_set_vlan_dev_state(p->br, vlan_dev); in nbp_vlan_set_vlan_dev_state()
1733 struct net_bridge *br = netdev_priv(dev); in br_vlan_bridge_event() local
1739 ret = br_vlan_add(br, br->default_pvid, in br_vlan_bridge_event()
1746 changed = !br_vlan_delete(br, br->default_pvid); in br_vlan_bridge_event()
1756 if (!br_opt_get(br, BROPT_VLAN_BRIDGE_BINDING)) in br_vlan_bridge_event()
1758 br_vlan_link_state_change(dev, br); in br_vlan_bridge_event()
1762 br_vlan_notify(br, NULL, br->default_pvid, 0, vlcmd); in br_vlan_bridge_event()
1770 if (!br_opt_get(p->br, BROPT_VLAN_BRIDGE_BINDING)) in br_vlan_port_event()
1871 void br_vlan_notify(const struct net_bridge *br, in br_vlan_notify() argument
1894 ifindex = br->dev->ifindex; in br_vlan_notify()
1895 vg = br_vlan_group(br); in br_vlan_notify()
1896 net = dev_net(br->dev); in br_vlan_notify()
1964 struct net_bridge *br; in br_vlan_dump_dev() local
1972 br = netdev_priv(dev); in br_vlan_dump_dev()
1973 vg = br_vlan_group_rcu(br); in br_vlan_dump_dev()
1984 br = p->br; in br_vlan_dump_dev()
2047 /* err will be 0 and range_start will be set in 3 cases here: in br_vlan_dump_dev()
2150 struct net_bridge *br; in br_vlan_rtm_process_one() local
2153 br = netdev_priv(dev); in br_vlan_rtm_process_one()
2154 vg = br_vlan_group(br); in br_vlan_rtm_process_one()
2159 br = p->br; in br_vlan_rtm_process_one()
2215 err = br_process_vlan_info(br, p, cmdmap, vinfo, &tmp_last, in br_vlan_rtm_process_one()
2220 br_ifinfo_notify(cmdmap, br, p); in br_vlan_rtm_process_one()
2238 err = br_vlan_process_options(br, p, range_start, range_end, in br_vlan_rtm_process_one()