Lines Matching refs:bridge_port

83 			 struct mlxsw_sp_bridge_port *bridge_port,
87 struct mlxsw_sp_bridge_port *bridge_port,
135 struct mlxsw_sp_bridge_port *bridge_port,
140 struct mlxsw_sp_bridge_port *bridge_port,
150 struct mlxsw_sp_bridge_port *bridge_port,
360 struct mlxsw_sp_bridge_port *bridge_port; in __mlxsw_sp_bridge_port_find() local
362 list_for_each_entry(bridge_port, &bridge_device->ports_list, list) { in __mlxsw_sp_bridge_port_find()
363 if (bridge_port->dev == brport_dev) in __mlxsw_sp_bridge_port_find()
364 return bridge_port; in __mlxsw_sp_bridge_port_find()
392 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_bridge_port_create() local
396 bridge_port = kzalloc(sizeof(*bridge_port), GFP_KERNEL); in mlxsw_sp_bridge_port_create()
397 if (!bridge_port) in mlxsw_sp_bridge_port_create()
401 bridge_port->lagged = mlxsw_sp_port->lagged; in mlxsw_sp_bridge_port_create()
402 if (bridge_port->lagged) in mlxsw_sp_bridge_port_create()
403 bridge_port->lag_id = mlxsw_sp_port->lag_id; in mlxsw_sp_bridge_port_create()
405 bridge_port->system_port = mlxsw_sp_port->local_port; in mlxsw_sp_bridge_port_create()
406 bridge_port->dev = brport_dev; in mlxsw_sp_bridge_port_create()
407 bridge_port->bridge_device = bridge_device; in mlxsw_sp_bridge_port_create()
408 bridge_port->stp_state = BR_STATE_DISABLED; in mlxsw_sp_bridge_port_create()
409 bridge_port->flags = BR_LEARNING | BR_FLOOD | BR_LEARNING_SYNC | in mlxsw_sp_bridge_port_create()
411 INIT_LIST_HEAD(&bridge_port->vlans_list); in mlxsw_sp_bridge_port_create()
412 list_add(&bridge_port->list, &bridge_device->ports_list); in mlxsw_sp_bridge_port_create()
413 bridge_port->ref_count = 1; in mlxsw_sp_bridge_port_create()
420 return bridge_port; in mlxsw_sp_bridge_port_create()
423 list_del(&bridge_port->list); in mlxsw_sp_bridge_port_create()
424 kfree(bridge_port); in mlxsw_sp_bridge_port_create()
429 mlxsw_sp_bridge_port_destroy(struct mlxsw_sp_bridge_port *bridge_port) in mlxsw_sp_bridge_port_destroy() argument
431 switchdev_bridge_port_unoffload(bridge_port->dev, NULL, NULL, NULL); in mlxsw_sp_bridge_port_destroy()
432 list_del(&bridge_port->list); in mlxsw_sp_bridge_port_destroy()
433 WARN_ON(!list_empty(&bridge_port->vlans_list)); in mlxsw_sp_bridge_port_destroy()
434 kfree(bridge_port); in mlxsw_sp_bridge_port_destroy()
444 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_bridge_port_get() local
447 bridge_port = mlxsw_sp_bridge_port_find(bridge, brport_dev); in mlxsw_sp_bridge_port_get()
448 if (bridge_port) { in mlxsw_sp_bridge_port_get()
449 bridge_port->ref_count++; in mlxsw_sp_bridge_port_get()
450 return bridge_port; in mlxsw_sp_bridge_port_get()
457 bridge_port = mlxsw_sp_bridge_port_create(bridge_device, brport_dev, in mlxsw_sp_bridge_port_get()
459 if (IS_ERR(bridge_port)) { in mlxsw_sp_bridge_port_get()
460 err = PTR_ERR(bridge_port); in mlxsw_sp_bridge_port_get()
464 return bridge_port; in mlxsw_sp_bridge_port_get()
472 struct mlxsw_sp_bridge_port *bridge_port) in mlxsw_sp_bridge_port_put() argument
476 if (--bridge_port->ref_count != 0) in mlxsw_sp_bridge_port_put()
478 bridge_device = bridge_port->bridge_device; in mlxsw_sp_bridge_port_put()
479 mlxsw_sp_bridge_port_destroy(bridge_port); in mlxsw_sp_bridge_port_put()
493 if (!mlxsw_sp_port_vlan->bridge_port) in mlxsw_sp_port_vlan_find_by_bridge()
495 if (mlxsw_sp_port_vlan->bridge_port->bridge_device != in mlxsw_sp_port_vlan_find_by_bridge()
525 mlxsw_sp_bridge_vlan_find(const struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp_bridge_vlan_find() argument
530 list_for_each_entry(bridge_vlan, &bridge_port->vlans_list, list) { in mlxsw_sp_bridge_vlan_find()
539 mlxsw_sp_bridge_vlan_create(struct mlxsw_sp_bridge_port *bridge_port, u16 vid) in mlxsw_sp_bridge_vlan_create() argument
549 list_add(&bridge_vlan->list, &bridge_port->vlans_list); in mlxsw_sp_bridge_vlan_create()
563 mlxsw_sp_bridge_vlan_get(struct mlxsw_sp_bridge_port *bridge_port, u16 vid) in mlxsw_sp_bridge_vlan_get() argument
567 bridge_vlan = mlxsw_sp_bridge_vlan_find(bridge_port, vid); in mlxsw_sp_bridge_vlan_get()
571 return mlxsw_sp_bridge_vlan_create(bridge_port, vid); in mlxsw_sp_bridge_vlan_get()
602 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_port_attr_stp_state_set() local
609 bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp_port->mlxsw_sp->bridge, in mlxsw_sp_port_attr_stp_state_set()
611 if (!bridge_port) in mlxsw_sp_port_attr_stp_state_set()
614 list_for_each_entry(bridge_vlan, &bridge_port->vlans_list, list) { in mlxsw_sp_port_attr_stp_state_set()
621 bridge_port->stp_state = state; in mlxsw_sp_port_attr_stp_state_set()
627 &bridge_port->vlans_list, list) in mlxsw_sp_port_attr_stp_state_set()
629 bridge_port->stp_state); in mlxsw_sp_port_attr_stp_state_set()
656 struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp_bridge_port_flood_table_set() argument
663 list_for_each_entry(bridge_vlan, &bridge_port->vlans_list, list) { in mlxsw_sp_bridge_port_flood_table_set()
676 &bridge_port->vlans_list, list) in mlxsw_sp_bridge_port_flood_table_set()
716 mlxsw_sp_bridge_ports_flood_table_set(struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp_bridge_ports_flood_table_set() argument
723 list_for_each_entry(bridge_vlan, &bridge_port->vlans_list, list) { in mlxsw_sp_bridge_ports_flood_table_set()
734 &bridge_port->vlans_list, list) in mlxsw_sp_bridge_ports_flood_table_set()
760 struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp_bridge_port_learning_set() argument
766 list_for_each_entry(bridge_vlan, &bridge_port->vlans_list, list) { in mlxsw_sp_bridge_port_learning_set()
777 &bridge_port->vlans_list, list) in mlxsw_sp_bridge_port_learning_set()
797 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_port_attr_br_flags_set() local
800 bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp_port->mlxsw_sp->bridge, in mlxsw_sp_port_attr_br_flags_set()
802 if (!bridge_port) in mlxsw_sp_port_attr_br_flags_set()
807 bridge_port, in mlxsw_sp_port_attr_br_flags_set()
816 bridge_port, in mlxsw_sp_port_attr_br_flags_set()
822 if (bridge_port->bridge_device->multicast_enabled) in mlxsw_sp_port_attr_br_flags_set()
827 bridge_port, in mlxsw_sp_port_attr_br_flags_set()
835 memcpy(&bridge_port->flags, &flags.val, sizeof(flags.val)); in mlxsw_sp_port_attr_br_flags_set()
903 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_port_attr_mrouter_set() local
906 bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp_port->mlxsw_sp->bridge, in mlxsw_sp_port_attr_mrouter_set()
908 if (!bridge_port) in mlxsw_sp_port_attr_mrouter_set()
911 mlxsw_sp_port_mrouter_update_mdb(mlxsw_sp_port, bridge_port, in mlxsw_sp_port_attr_mrouter_set()
914 if (!bridge_port->bridge_device->multicast_enabled) in mlxsw_sp_port_attr_mrouter_set()
917 err = mlxsw_sp_bridge_port_flood_table_set(mlxsw_sp_port, bridge_port, in mlxsw_sp_port_attr_mrouter_set()
924 bridge_port->mrouter = is_port_mrouter; in mlxsw_sp_port_attr_mrouter_set()
928 static bool mlxsw_sp_mc_flood(const struct mlxsw_sp_bridge_port *bridge_port) in mlxsw_sp_mc_flood() argument
932 bridge_device = bridge_port->bridge_device; in mlxsw_sp_mc_flood()
933 return bridge_device->multicast_enabled ? bridge_port->mrouter : in mlxsw_sp_mc_flood()
934 bridge_port->flags & BR_MCAST_FLOOD; in mlxsw_sp_mc_flood()
944 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_port_mc_disabled_set() local
963 list_for_each_entry(bridge_port, &bridge_device->ports_list, list) { in mlxsw_sp_port_mc_disabled_set()
964 bool member = mlxsw_sp_mc_flood(bridge_port); in mlxsw_sp_port_mc_disabled_set()
966 err = mlxsw_sp_bridge_ports_flood_table_set(bridge_port, in mlxsw_sp_port_mc_disabled_set()
976 list_for_each_entry_continue_reverse(bridge_port, in mlxsw_sp_port_mc_disabled_set()
978 bool member = mlxsw_sp_mc_flood(bridge_port); in mlxsw_sp_port_mc_disabled_set()
980 mlxsw_sp_bridge_ports_flood_table_set(bridge_port, packet_type, in mlxsw_sp_port_mc_disabled_set()
1237 struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp_port_vlan_fid_join() argument
1247 bridge_device = bridge_port->bridge_device; in mlxsw_sp_port_vlan_fid_join()
1253 bridge_port->flags & BR_FLOOD); in mlxsw_sp_port_vlan_fid_join()
1258 mlxsw_sp_mc_flood(bridge_port)); in mlxsw_sp_port_vlan_fid_join()
1316 struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp_port_vlan_bridge_join() argument
1325 if (mlxsw_sp_port_vlan->bridge_port) in mlxsw_sp_port_vlan_bridge_join()
1328 err = mlxsw_sp_port_vlan_fid_join(mlxsw_sp_port_vlan, bridge_port, in mlxsw_sp_port_vlan_bridge_join()
1334 bridge_port->flags & BR_LEARNING); in mlxsw_sp_port_vlan_bridge_join()
1339 bridge_port->stp_state); in mlxsw_sp_port_vlan_bridge_join()
1343 bridge_vlan = mlxsw_sp_bridge_vlan_get(bridge_port, vid); in mlxsw_sp_port_vlan_bridge_join()
1353 bridge_port->dev, extack); in mlxsw_sp_port_vlan_bridge_join()
1354 mlxsw_sp_port_vlan->bridge_port = bridge_port; in mlxsw_sp_port_vlan_bridge_join()
1373 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_port_vlan_bridge_leave() local
1381 bridge_port = mlxsw_sp_port_vlan->bridge_port; in mlxsw_sp_port_vlan_bridge_leave()
1382 bridge_vlan = mlxsw_sp_bridge_vlan_find(bridge_port, vid); in mlxsw_sp_port_vlan_bridge_leave()
1391 bridge_port, in mlxsw_sp_port_vlan_bridge_leave()
1394 mlxsw_sp_bridge_port_mdb_flush(mlxsw_sp_port, bridge_port, in mlxsw_sp_port_vlan_bridge_leave()
1399 mlxsw_sp_bridge_port_put(mlxsw_sp_port->mlxsw_sp->bridge, bridge_port); in mlxsw_sp_port_vlan_bridge_leave()
1400 mlxsw_sp_port_vlan->bridge_port = NULL; in mlxsw_sp_port_vlan_bridge_leave()
1405 struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp_bridge_port_vlan_add() argument
1421 mlxsw_sp_port_vlan->bridge_port != bridge_port) in mlxsw_sp_bridge_port_vlan_add()
1436 br_vlan_get_proto(bridge_port->bridge_device->dev, &proto); in mlxsw_sp_bridge_port_vlan_add()
1441 err = mlxsw_sp_port_vlan_bridge_join(mlxsw_sp_port_vlan, bridge_port, in mlxsw_sp_bridge_port_vlan_add()
1491 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_port_vlans_add() local
1504 bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp->bridge, orig_dev); in mlxsw_sp_port_vlans_add()
1505 if (WARN_ON(!bridge_port)) in mlxsw_sp_port_vlans_add()
1508 if (!bridge_port->bridge_device->vlan_enabled) in mlxsw_sp_port_vlans_add()
1511 return mlxsw_sp_bridge_port_vlan_add(mlxsw_sp_port, bridge_port, in mlxsw_sp_port_vlans_add()
1524 struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp_bridge_port_fdb_flush() argument
1527 bool lagged = bridge_port->lagged; in mlxsw_sp_bridge_port_fdb_flush()
1531 system_port = lagged ? bridge_port->lag_id : bridge_port->system_port; in mlxsw_sp_bridge_port_fdb_flush()
1767 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_port_fdb_set() local
1770 bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp->bridge, orig_dev); in mlxsw_sp_port_fdb_set()
1771 if (!bridge_port) in mlxsw_sp_port_fdb_set()
1774 bridge_device = bridge_port->bridge_device; in mlxsw_sp_port_fdb_set()
1784 if (!bridge_port->lagged) in mlxsw_sp_port_fdb_set()
1786 bridge_port->system_port, in mlxsw_sp_port_fdb_set()
1791 bridge_port->lag_id, in mlxsw_sp_port_fdb_set()
1827 struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp_bridge_port_get_ports_bitmap() argument
1834 if (!bridge_port->lagged) { in mlxsw_sp_bridge_port_get_ports_bitmap()
1835 set_bit(bridge_port->system_port, ports_bm->bitmap); in mlxsw_sp_bridge_port_get_ports_bitmap()
1839 lag_id = bridge_port->lag_id; in mlxsw_sp_bridge_port_get_ports_bitmap()
1855 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_mc_get_mrouters_bitmap() local
1857 list_for_each_entry(bridge_port, &bridge_device->ports_list, list) { in mlxsw_sp_mc_get_mrouters_bitmap()
1858 if (bridge_port->mrouter) { in mlxsw_sp_mc_get_mrouters_bitmap()
1860 bridge_port, in mlxsw_sp_mc_get_mrouters_bitmap()
2090 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_port_mdb_add() local
2094 bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp->bridge, orig_dev); in mlxsw_sp_port_mdb_add()
2095 if (!bridge_port) in mlxsw_sp_port_mdb_add()
2098 bridge_device = bridge_port->bridge_device; in mlxsw_sp_port_mdb_add()
2140 struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp_port_mrouter_update_mdb() argument
2148 bridge_device = bridge_port->bridge_device; in mlxsw_sp_port_mrouter_update_mdb()
2195 struct mlxsw_sp_bridge_port *bridge_port, u16 vid) in mlxsw_sp_bridge_port_vlan_del() argument
2206 br_vlan_get_proto(bridge_port->bridge_device->dev, &proto); in mlxsw_sp_bridge_port_vlan_del()
2217 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_port_vlans_del() local
2222 bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp->bridge, orig_dev); in mlxsw_sp_port_vlans_del()
2223 if (WARN_ON(!bridge_port)) in mlxsw_sp_port_vlans_del()
2226 if (!bridge_port->bridge_device->vlan_enabled) in mlxsw_sp_port_vlans_del()
2229 mlxsw_sp_bridge_port_vlan_del(mlxsw_sp_port, bridge_port, vlan->vid); in mlxsw_sp_port_vlans_del()
2242 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_port_mdb_del() local
2247 bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp->bridge, orig_dev); in mlxsw_sp_port_mdb_del()
2248 if (!bridge_port) in mlxsw_sp_port_mdb_del()
2251 bridge_device = bridge_port->bridge_device; in mlxsw_sp_port_mdb_del()
2276 struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp_bridge_port_mdb_flush() argument
2284 bridge_device = bridge_port->bridge_device; in mlxsw_sp_bridge_port_mdb_flush()
2291 if (bridge_port->mrouter) in mlxsw_sp_bridge_port_mdb_flush()
2344 mlxsw_sp_bridge_vlan_aware_port_join(struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp_bridge_vlan_aware_port_join() argument
2348 if (is_vlan_dev(bridge_port->dev)) { in mlxsw_sp_bridge_vlan_aware_port_join()
2362 struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp_bridge_8021q_port_join() argument
2366 return mlxsw_sp_bridge_vlan_aware_port_join(bridge_port, mlxsw_sp_port, in mlxsw_sp_bridge_8021q_port_join()
2380 struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp_bridge_8021q_port_leave() argument
2511 if (mlxsw_sp_port_vlan->bridge_port && in mlxsw_sp_port_is_br_member()
2512 mlxsw_sp_port_vlan->bridge_port->bridge_device->dev == in mlxsw_sp_port_is_br_member()
2522 struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp_bridge_8021d_port_join() argument
2527 struct net_device *dev = bridge_port->dev; in mlxsw_sp_bridge_8021d_port_join()
2544 return mlxsw_sp_port_vlan_bridge_join(mlxsw_sp_port_vlan, bridge_port, in mlxsw_sp_bridge_8021d_port_join()
2550 struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp_bridge_8021d_port_leave() argument
2554 struct net_device *dev = bridge_port->dev; in mlxsw_sp_bridge_8021d_port_leave()
2559 if (!mlxsw_sp_port_vlan || !mlxsw_sp_port_vlan->bridge_port) in mlxsw_sp_bridge_8021d_port_leave()
2645 struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp_bridge_8021ad_port_join() argument
2655 err = mlxsw_sp_bridge_vlan_aware_port_join(bridge_port, mlxsw_sp_port, in mlxsw_sp_bridge_8021ad_port_join()
2669 struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp_bridge_8021ad_port_leave() argument
2696 struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp2_bridge_8021ad_port_join() argument
2710 err = mlxsw_sp_bridge_8021ad_port_join(bridge_device, bridge_port, in mlxsw_sp2_bridge_8021ad_port_join()
2724 struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp2_bridge_8021ad_port_leave() argument
2727 mlxsw_sp_bridge_8021ad_port_leave(bridge_device, bridge_port, in mlxsw_sp2_bridge_8021ad_port_leave()
2748 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_port_bridge_join() local
2751 bridge_port = mlxsw_sp_bridge_port_get(mlxsw_sp->bridge, brport_dev, in mlxsw_sp_port_bridge_join()
2753 if (IS_ERR(bridge_port)) in mlxsw_sp_port_bridge_join()
2754 return PTR_ERR(bridge_port); in mlxsw_sp_port_bridge_join()
2755 bridge_device = bridge_port->bridge_device; in mlxsw_sp_port_bridge_join()
2757 err = bridge_device->ops->port_join(bridge_device, bridge_port, in mlxsw_sp_port_bridge_join()
2765 mlxsw_sp_bridge_port_put(mlxsw_sp->bridge, bridge_port); in mlxsw_sp_port_bridge_join()
2775 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_port_bridge_leave() local
2780 bridge_port = __mlxsw_sp_bridge_port_find(bridge_device, brport_dev); in mlxsw_sp_port_bridge_leave()
2781 if (!bridge_port) in mlxsw_sp_port_bridge_leave()
2784 bridge_device->ops->port_leave(bridge_device, bridge_port, in mlxsw_sp_port_bridge_leave()
2786 mlxsw_sp_bridge_port_put(mlxsw_sp->bridge, bridge_port); in mlxsw_sp_port_bridge_leave()
2907 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_fdb_notify_mac_process() local
2934 bridge_port = mlxsw_sp_port_vlan->bridge_port; in mlxsw_sp_fdb_notify_mac_process()
2935 if (!bridge_port) { in mlxsw_sp_fdb_notify_mac_process()
2940 bridge_device = bridge_port->bridge_device; in mlxsw_sp_fdb_notify_mac_process()
2955 mlxsw_sp_fdb_call_notifiers(type, mac, vid, bridge_port->dev, adding); in mlxsw_sp_fdb_notify_mac_process()
2971 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_fdb_notify_mac_lag_process() local
2997 bridge_port = mlxsw_sp_port_vlan->bridge_port; in mlxsw_sp_fdb_notify_mac_lag_process()
2998 if (!bridge_port) { in mlxsw_sp_fdb_notify_mac_lag_process()
3003 bridge_device = bridge_port->bridge_device; in mlxsw_sp_fdb_notify_mac_lag_process()
3018 mlxsw_sp_fdb_call_notifiers(type, mac, vid, bridge_port->dev, adding); in mlxsw_sp_fdb_notify_mac_lag_process()
3920 mlxsw_sp_bridge_port_stp_state(struct mlxsw_sp_bridge_port *bridge_port) in mlxsw_sp_bridge_port_stp_state() argument
3922 return bridge_port->stp_state; in mlxsw_sp_bridge_port_stp_state()