Lines Matching refs: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()
234 port_count = prestera_bridge_vlan_port_count(br_port->bridge, vid); in prestera_port_vlan_bridge_leave()
270 struct prestera_bridge *bridge; in prestera_bridge_create() local
279 bridge = kzalloc(sizeof(*bridge), GFP_KERNEL); in prestera_bridge_create()
280 if (!bridge) in prestera_bridge_create()
288 kfree(bridge); in prestera_bridge_create()
292 bridge->bridge_id = bridge_id; in prestera_bridge_create()
295 bridge->vlan_enabled = vlan_enabled; in prestera_bridge_create()
296 bridge->swdev = swdev; in prestera_bridge_create()
297 bridge->dev = dev; in prestera_bridge_create()
299 INIT_LIST_HEAD(&bridge->port_list); in prestera_bridge_create()
301 list_add(&bridge->head, &swdev->bridge_list); in prestera_bridge_create()
303 return bridge; in prestera_bridge_create()
306 static void prestera_bridge_destroy(struct prestera_bridge *bridge) in prestera_bridge_destroy() argument
308 struct prestera_switchdev *swdev = bridge->swdev; in prestera_bridge_destroy()
310 list_del(&bridge->head); in prestera_bridge_destroy()
312 if (bridge->vlan_enabled) in prestera_bridge_destroy()
315 prestera_hw_bridge_delete(swdev->sw, bridge->bridge_id); in prestera_bridge_destroy()
317 WARN_ON(!list_empty(&bridge->port_list)); in prestera_bridge_destroy()
318 kfree(bridge); in prestera_bridge_destroy()
321 static void prestera_bridge_put(struct prestera_bridge *bridge) in prestera_bridge_put() argument
323 if (list_empty(&bridge->port_list)) in prestera_bridge_put()
324 prestera_bridge_destroy(bridge); in prestera_bridge_put()
331 struct prestera_bridge *bridge; in prestera_bridge_by_dev() local
333 list_for_each_entry(bridge, &swdev->bridge_list, head) in prestera_bridge_by_dev()
334 if (bridge->dev == dev) in prestera_bridge_by_dev()
335 return bridge; in prestera_bridge_by_dev()
341 __prestera_bridge_port_by_dev(struct prestera_bridge *bridge, in __prestera_bridge_port_by_dev() argument
346 list_for_each_entry(br_port, &bridge->port_list, head) { in __prestera_bridge_port_by_dev()
377 struct prestera_bridge *bridge; in prestera_bridge_port_by_dev() local
382 bridge = prestera_bridge_by_dev(swdev, br_dev); in prestera_bridge_port_by_dev()
383 if (!bridge) in prestera_bridge_port_by_dev()
386 return __prestera_bridge_port_by_dev(bridge, dev); in prestera_bridge_port_by_dev()
390 prestera_bridge_port_create(struct prestera_bridge *bridge, in prestera_bridge_port_create() argument
403 br_port->bridge = bridge; in prestera_bridge_port_create()
407 list_add(&br_port->head, &bridge->port_list); in prestera_bridge_port_create()
427 struct prestera_bridge *bridge = br_port->bridge; in prestera_bridge_port_put() local
431 prestera_bridge_put(bridge); in prestera_bridge_port_put()
436 prestera_bridge_port_add(struct prestera_bridge *bridge, struct net_device *dev) in prestera_bridge_port_add() argument
440 br_port = __prestera_bridge_port_by_dev(bridge, dev); in prestera_bridge_port_add()
446 br_port = prestera_bridge_port_create(bridge, dev); in prestera_bridge_port_add()
457 struct prestera_bridge *bridge = br_port->bridge; in prestera_bridge_1d_port_join() local
460 err = prestera_hw_bridge_port_add(port, bridge->bridge_id); in prestera_bridge_1d_port_join()
477 prestera_hw_bridge_port_delete(port, bridge->bridge_id); in prestera_bridge_1d_port_join()
488 struct prestera_bridge *bridge; in prestera_bridge_port_join() local
491 bridge = prestera_bridge_by_dev(swdev, br_dev); in prestera_bridge_port_join()
492 if (!bridge) { in prestera_bridge_port_join()
493 bridge = prestera_bridge_create(swdev, br_dev); in prestera_bridge_port_join()
494 if (IS_ERR(bridge)) in prestera_bridge_port_join()
495 return PTR_ERR(bridge); in prestera_bridge_port_join()
498 br_port = prestera_bridge_port_add(bridge, port->dev); in prestera_bridge_port_join()
500 prestera_bridge_put(bridge); in prestera_bridge_port_join()
509 if (bridge->vlan_enabled) in prestera_bridge_port_join()
538 prestera_hw_bridge_port_delete(port, br_port->bridge->bridge_id); in prestera_bridge_1d_port_leave()
576 struct prestera_bridge *bridge; in prestera_bridge_port_leave() local
578 bridge = prestera_bridge_by_dev(swdev, br_dev); in prestera_bridge_port_leave()
579 if (!bridge) in prestera_bridge_port_leave()
582 br_port = __prestera_bridge_port_by_dev(bridge, port->dev); in prestera_bridge_port_leave()
586 bridge = br_port->bridge; in prestera_bridge_port_leave()
588 if (bridge->vlan_enabled) in prestera_bridge_port_leave()
647 struct prestera_bridge *bridge; in prestera_port_attr_br_vlan_set() local
649 bridge = prestera_bridge_by_dev(sw->swdev, dev); in prestera_port_attr_br_vlan_set()
650 if (WARN_ON(!bridge)) in prestera_port_attr_br_vlan_set()
653 if (bridge->vlan_enabled == vlan_enabled) in prestera_port_attr_br_vlan_set()
656 netdev_err(bridge->dev, "VLAN filtering can't be changed for existing bridge\n"); in prestera_port_attr_br_vlan_set()
690 if (!br_port->bridge->vlan_enabled) { in prestera_port_attr_stp_state_set()
691 vid = br_port->bridge->bridge_id; in prestera_port_attr_stp_state_set()
775 struct prestera_bridge *bridge; in prestera_port_fdb_set() local
783 bridge = br_port->bridge; in prestera_port_fdb_set()
785 if (bridge->vlan_enabled) in prestera_port_fdb_set()
788 vid = bridge->bridge_id; in prestera_port_fdb_set()
1033 struct prestera_bridge *bridge; in prestera_port_vlans_add() local
1042 bridge = br_port->bridge; in prestera_port_vlans_add()
1043 if (!bridge->vlan_enabled) in prestera_port_vlans_add()
1081 if (!br_port->bridge->vlan_enabled) in prestera_port_vlans_del()