Lines Matching full:bridge
49 struct prestera_bridge *bridge; member
113 static int prestera_bridge_vlan_port_count(struct prestera_bridge *bridge, in prestera_bridge_vlan_port_count() argument
120 list_for_each_entry(br_port, &bridge->port_list, head) { in prestera_bridge_vlan_port_count()
195 port_count = prestera_bridge_vlan_port_count(br_port->bridge, vid); in prestera_port_vlan_bridge_leave()
231 struct prestera_bridge *bridge; in prestera_bridge_create() local
236 netdev_err(dev, "Only one VLAN-aware bridge is supported\n"); in prestera_bridge_create()
240 bridge = kzalloc(sizeof(*bridge), GFP_KERNEL); in prestera_bridge_create()
241 if (!bridge) in prestera_bridge_create()
249 kfree(bridge); in prestera_bridge_create()
253 bridge->bridge_id = bridge_id; in prestera_bridge_create()
256 bridge->vlan_enabled = vlan_enabled; in prestera_bridge_create()
257 bridge->swdev = swdev; in prestera_bridge_create()
258 bridge->dev = dev; in prestera_bridge_create()
260 INIT_LIST_HEAD(&bridge->port_list); in prestera_bridge_create()
262 list_add(&bridge->head, &swdev->bridge_list); in prestera_bridge_create()
264 return bridge; in prestera_bridge_create()
267 static void prestera_bridge_destroy(struct prestera_bridge *bridge) in prestera_bridge_destroy() argument
269 struct prestera_switchdev *swdev = bridge->swdev; in prestera_bridge_destroy()
271 list_del(&bridge->head); in prestera_bridge_destroy()
273 if (bridge->vlan_enabled) in prestera_bridge_destroy()
276 prestera_hw_bridge_delete(swdev->sw, bridge->bridge_id); in prestera_bridge_destroy()
278 WARN_ON(!list_empty(&bridge->port_list)); in prestera_bridge_destroy()
279 kfree(bridge); in prestera_bridge_destroy()
282 static void prestera_bridge_put(struct prestera_bridge *bridge) in prestera_bridge_put() argument
284 if (list_empty(&bridge->port_list)) in prestera_bridge_put()
285 prestera_bridge_destroy(bridge); in prestera_bridge_put()
292 struct prestera_bridge *bridge; in prestera_bridge_by_dev() local
294 list_for_each_entry(bridge, &swdev->bridge_list, head) in prestera_bridge_by_dev()
295 if (bridge->dev == dev) in prestera_bridge_by_dev()
296 return bridge; in prestera_bridge_by_dev()
302 __prestera_bridge_port_by_dev(struct prestera_bridge *bridge, in __prestera_bridge_port_by_dev() argument
307 list_for_each_entry(br_port, &bridge->port_list, head) { in __prestera_bridge_port_by_dev()
320 struct prestera_bridge *bridge; in prestera_bridge_port_by_dev() local
325 bridge = prestera_bridge_by_dev(swdev, br_dev); in prestera_bridge_port_by_dev()
326 if (!bridge) in prestera_bridge_port_by_dev()
329 return __prestera_bridge_port_by_dev(bridge, dev); in prestera_bridge_port_by_dev()
333 prestera_bridge_port_create(struct prestera_bridge *bridge, in prestera_bridge_port_create() argument
346 br_port->bridge = bridge; in prestera_bridge_port_create()
350 list_add(&br_port->head, &bridge->port_list); in prestera_bridge_port_create()
370 struct prestera_bridge *bridge = br_port->bridge; in prestera_bridge_port_put() local
374 prestera_bridge_put(bridge); in prestera_bridge_port_put()
379 prestera_bridge_port_add(struct prestera_bridge *bridge, struct net_device *dev) in prestera_bridge_port_add() argument
383 br_port = __prestera_bridge_port_by_dev(bridge, dev); in prestera_bridge_port_add()
389 br_port = prestera_bridge_port_create(bridge, dev); in prestera_bridge_port_add()
400 struct prestera_bridge *bridge = br_port->bridge; in prestera_bridge_1d_port_join() local
403 err = prestera_hw_bridge_port_add(port, bridge->bridge_id); in prestera_bridge_1d_port_join()
420 prestera_hw_bridge_port_delete(port, bridge->bridge_id); in prestera_bridge_1d_port_join()
430 struct prestera_bridge *bridge; in prestera_port_bridge_join() local
433 bridge = prestera_bridge_by_dev(swdev, upper); in prestera_port_bridge_join()
434 if (!bridge) { in prestera_port_bridge_join()
435 bridge = prestera_bridge_create(swdev, upper); in prestera_port_bridge_join()
436 if (IS_ERR(bridge)) in prestera_port_bridge_join()
437 return PTR_ERR(bridge); in prestera_port_bridge_join()
440 br_port = prestera_bridge_port_add(bridge, port->dev); in prestera_port_bridge_join()
446 if (bridge->vlan_enabled) in prestera_port_bridge_join()
458 prestera_bridge_put(bridge); in prestera_port_bridge_join()
475 prestera_hw_bridge_port_delete(port, br_port->bridge->bridge_id); in prestera_bridge_1d_port_leave()
513 struct prestera_bridge *bridge; in prestera_port_bridge_leave() local
515 bridge = prestera_bridge_by_dev(swdev, upper); in prestera_port_bridge_leave()
516 if (!bridge) in prestera_port_bridge_leave()
519 br_port = __prestera_bridge_port_by_dev(bridge, port->dev); in prestera_port_bridge_leave()
523 bridge = br_port->bridge; in prestera_port_bridge_leave()
525 if (bridge->vlan_enabled) in prestera_port_bridge_leave()
635 struct prestera_bridge *bridge; in prestera_port_attr_br_vlan_set() local
640 bridge = prestera_bridge_by_dev(sw->swdev, dev); in prestera_port_attr_br_vlan_set()
641 if (WARN_ON(!bridge)) in prestera_port_attr_br_vlan_set()
644 if (bridge->vlan_enabled == vlan_enabled) in prestera_port_attr_br_vlan_set()
647 netdev_err(bridge->dev, "VLAN filtering can't be changed for existing bridge\n"); in prestera_port_attr_br_vlan_set()
685 if (!br_port->bridge->vlan_enabled) { in presterar_port_attr_stp_state_set()
686 vid = br_port->bridge->bridge_id; in presterar_port_attr_stp_state_set()
773 struct prestera_bridge *bridge; in prestera_port_fdb_set() local
781 bridge = br_port->bridge; in prestera_port_fdb_set()
783 if (bridge->vlan_enabled) in prestera_port_fdb_set()
786 vid = bridge->bridge_id; in prestera_port_fdb_set()
1031 struct prestera_bridge *bridge; in prestera_port_vlans_add() local
1044 bridge = br_port->bridge; in prestera_port_vlans_add()
1045 if (!bridge->vlan_enabled) in prestera_port_vlans_add()
1093 if (!br_port->bridge->vlan_enabled) in prestera_port_vlans_del()