Lines Matching refs:bridge_port
81 struct mlxsw_sp_bridge_port *bridge_port,
85 struct mlxsw_sp_bridge_port *bridge_port,
94 struct mlxsw_sp_bridge_port *bridge_port,
99 struct mlxsw_sp_bridge_port *bridge_port);
108 struct mlxsw_sp_bridge_port *bridge_port,
221 struct mlxsw_sp_bridge_port *bridge_port; in __mlxsw_sp_bridge_port_find() local
223 list_for_each_entry(bridge_port, &bridge_device->ports_list, list) { in __mlxsw_sp_bridge_port_find()
224 if (bridge_port->dev == brport_dev) in __mlxsw_sp_bridge_port_find()
225 return bridge_port; in __mlxsw_sp_bridge_port_find()
252 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_bridge_port_create() local
255 bridge_port = kzalloc(sizeof(*bridge_port), GFP_KERNEL); in mlxsw_sp_bridge_port_create()
256 if (!bridge_port) in mlxsw_sp_bridge_port_create()
260 bridge_port->lagged = mlxsw_sp_port->lagged; in mlxsw_sp_bridge_port_create()
261 if (bridge_port->lagged) in mlxsw_sp_bridge_port_create()
262 bridge_port->lag_id = mlxsw_sp_port->lag_id; in mlxsw_sp_bridge_port_create()
264 bridge_port->system_port = mlxsw_sp_port->local_port; in mlxsw_sp_bridge_port_create()
265 bridge_port->dev = brport_dev; in mlxsw_sp_bridge_port_create()
266 bridge_port->bridge_device = bridge_device; in mlxsw_sp_bridge_port_create()
267 bridge_port->stp_state = BR_STATE_DISABLED; in mlxsw_sp_bridge_port_create()
268 bridge_port->flags = BR_LEARNING | BR_FLOOD | BR_LEARNING_SYNC | in mlxsw_sp_bridge_port_create()
270 INIT_LIST_HEAD(&bridge_port->vlans_list); in mlxsw_sp_bridge_port_create()
271 list_add(&bridge_port->list, &bridge_device->ports_list); in mlxsw_sp_bridge_port_create()
272 bridge_port->ref_count = 1; in mlxsw_sp_bridge_port_create()
274 return bridge_port; in mlxsw_sp_bridge_port_create()
278 mlxsw_sp_bridge_port_destroy(struct mlxsw_sp_bridge_port *bridge_port) in mlxsw_sp_bridge_port_destroy() argument
280 list_del(&bridge_port->list); in mlxsw_sp_bridge_port_destroy()
281 WARN_ON(!list_empty(&bridge_port->vlans_list)); in mlxsw_sp_bridge_port_destroy()
282 kfree(bridge_port); in mlxsw_sp_bridge_port_destroy()
287 bridge_port) in mlxsw_sp_bridge_port_should_destroy()
289 struct mlxsw_sp *mlxsw_sp = mlxsw_sp_lower_get(bridge_port->dev); in mlxsw_sp_bridge_port_should_destroy()
295 if (!mlxsw_sp && list_empty(&bridge_port->vlans_list)) in mlxsw_sp_bridge_port_should_destroy()
297 else if (bridge_port->ref_count == 0) in mlxsw_sp_bridge_port_should_destroy()
309 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_bridge_port_get() local
312 bridge_port = mlxsw_sp_bridge_port_find(bridge, brport_dev); in mlxsw_sp_bridge_port_get()
313 if (bridge_port) { in mlxsw_sp_bridge_port_get()
314 bridge_port->ref_count++; in mlxsw_sp_bridge_port_get()
315 return bridge_port; in mlxsw_sp_bridge_port_get()
322 bridge_port = mlxsw_sp_bridge_port_create(bridge_device, brport_dev); in mlxsw_sp_bridge_port_get()
323 if (!bridge_port) { in mlxsw_sp_bridge_port_get()
328 return bridge_port; in mlxsw_sp_bridge_port_get()
336 struct mlxsw_sp_bridge_port *bridge_port) in mlxsw_sp_bridge_port_put() argument
340 bridge_port->ref_count--; in mlxsw_sp_bridge_port_put()
341 if (!mlxsw_sp_bridge_port_should_destroy(bridge_port)) in mlxsw_sp_bridge_port_put()
343 bridge_device = bridge_port->bridge_device; in mlxsw_sp_bridge_port_put()
344 mlxsw_sp_bridge_port_destroy(bridge_port); in mlxsw_sp_bridge_port_put()
358 if (!mlxsw_sp_port_vlan->bridge_port) in mlxsw_sp_port_vlan_find_by_bridge()
360 if (mlxsw_sp_port_vlan->bridge_port->bridge_device != in mlxsw_sp_port_vlan_find_by_bridge()
390 mlxsw_sp_bridge_vlan_find(const struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp_bridge_vlan_find() argument
395 list_for_each_entry(bridge_vlan, &bridge_port->vlans_list, list) { in mlxsw_sp_bridge_vlan_find()
404 mlxsw_sp_bridge_vlan_create(struct mlxsw_sp_bridge_port *bridge_port, u16 vid) in mlxsw_sp_bridge_vlan_create() argument
414 list_add(&bridge_vlan->list, &bridge_port->vlans_list); in mlxsw_sp_bridge_vlan_create()
428 mlxsw_sp_bridge_vlan_get(struct mlxsw_sp_bridge_port *bridge_port, u16 vid) in mlxsw_sp_bridge_vlan_get() argument
432 bridge_vlan = mlxsw_sp_bridge_vlan_find(bridge_port, vid); in mlxsw_sp_bridge_vlan_get()
436 return mlxsw_sp_bridge_vlan_create(bridge_port, vid); in mlxsw_sp_bridge_vlan_get()
449 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_port_bridge_flags_get() local
451 bridge_port = mlxsw_sp_bridge_port_find(bridge, dev); in mlxsw_sp_port_bridge_flags_get()
452 if (WARN_ON(!bridge_port)) in mlxsw_sp_port_bridge_flags_get()
455 memcpy(brport_flags, &bridge_port->flags, sizeof(*brport_flags)); in mlxsw_sp_port_bridge_flags_get()
508 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_port_attr_stp_state_set() local
518 bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp_port->mlxsw_sp->bridge, in mlxsw_sp_port_attr_stp_state_set()
520 if (!bridge_port) in mlxsw_sp_port_attr_stp_state_set()
523 list_for_each_entry(bridge_vlan, &bridge_port->vlans_list, list) { in mlxsw_sp_port_attr_stp_state_set()
530 bridge_port->stp_state = state; in mlxsw_sp_port_attr_stp_state_set()
536 &bridge_port->vlans_list, list) in mlxsw_sp_port_attr_stp_state_set()
538 bridge_port->stp_state); in mlxsw_sp_port_attr_stp_state_set()
565 struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp_bridge_port_flood_table_set() argument
572 list_for_each_entry(bridge_vlan, &bridge_port->vlans_list, list) { in mlxsw_sp_bridge_port_flood_table_set()
585 &bridge_port->vlans_list, list) in mlxsw_sp_bridge_port_flood_table_set()
611 struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp_bridge_port_learning_set() argument
617 list_for_each_entry(bridge_vlan, &bridge_port->vlans_list, list) { in mlxsw_sp_bridge_port_learning_set()
628 &bridge_port->vlans_list, list) in mlxsw_sp_bridge_port_learning_set()
639 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_port_attr_br_flags_set() local
645 bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp_port->mlxsw_sp->bridge, in mlxsw_sp_port_attr_br_flags_set()
647 if (!bridge_port) in mlxsw_sp_port_attr_br_flags_set()
650 err = mlxsw_sp_bridge_port_flood_table_set(mlxsw_sp_port, bridge_port, in mlxsw_sp_port_attr_br_flags_set()
656 err = mlxsw_sp_bridge_port_learning_set(mlxsw_sp_port, bridge_port, in mlxsw_sp_port_attr_br_flags_set()
661 if (bridge_port->bridge_device->multicast_enabled) in mlxsw_sp_port_attr_br_flags_set()
664 err = mlxsw_sp_bridge_port_flood_table_set(mlxsw_sp_port, bridge_port, in mlxsw_sp_port_attr_br_flags_set()
672 memcpy(&bridge_port->flags, &brport_flags, sizeof(brport_flags)); in mlxsw_sp_port_attr_br_flags_set()
735 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_port_attr_mrouter_set() local
741 bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp_port->mlxsw_sp->bridge, in mlxsw_sp_port_attr_mrouter_set()
743 if (!bridge_port) in mlxsw_sp_port_attr_mrouter_set()
746 if (!bridge_port->bridge_device->multicast_enabled) in mlxsw_sp_port_attr_mrouter_set()
749 err = mlxsw_sp_bridge_port_flood_table_set(mlxsw_sp_port, bridge_port, in mlxsw_sp_port_attr_mrouter_set()
755 mlxsw_sp_port_mrouter_update_mdb(mlxsw_sp_port, bridge_port, in mlxsw_sp_port_attr_mrouter_set()
758 bridge_port->mrouter = is_port_mrouter; in mlxsw_sp_port_attr_mrouter_set()
762 static bool mlxsw_sp_mc_flood(const struct mlxsw_sp_bridge_port *bridge_port) in mlxsw_sp_mc_flood() argument
766 bridge_device = bridge_port->bridge_device; in mlxsw_sp_mc_flood()
767 return bridge_device->multicast_enabled ? bridge_port->mrouter : in mlxsw_sp_mc_flood()
768 bridge_port->flags & BR_MCAST_FLOOD; in mlxsw_sp_mc_flood()
778 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_port_mc_disabled_set() local
797 list_for_each_entry(bridge_port, &bridge_device->ports_list, list) { in mlxsw_sp_port_mc_disabled_set()
799 bool member = mlxsw_sp_mc_flood(bridge_port); in mlxsw_sp_port_mc_disabled_set()
802 bridge_port, in mlxsw_sp_port_mc_disabled_set()
922 struct mlxsw_sp_bridge_port *bridge_port) in mlxsw_sp_port_vlan_fid_join() argument
931 bridge_device = bridge_port->bridge_device; in mlxsw_sp_port_vlan_fid_join()
937 bridge_port->flags & BR_FLOOD); in mlxsw_sp_port_vlan_fid_join()
942 mlxsw_sp_mc_flood(bridge_port)); in mlxsw_sp_port_vlan_fid_join()
1000 struct mlxsw_sp_bridge_port *bridge_port) in mlxsw_sp_port_vlan_bridge_join() argument
1008 if (mlxsw_sp_port_vlan->bridge_port) { in mlxsw_sp_port_vlan_bridge_join()
1013 err = mlxsw_sp_port_vlan_fid_join(mlxsw_sp_port_vlan, bridge_port); in mlxsw_sp_port_vlan_bridge_join()
1018 bridge_port->flags & BR_LEARNING); in mlxsw_sp_port_vlan_bridge_join()
1023 bridge_port->stp_state); in mlxsw_sp_port_vlan_bridge_join()
1027 bridge_vlan = mlxsw_sp_bridge_vlan_get(bridge_port, vid); in mlxsw_sp_port_vlan_bridge_join()
1037 bridge_port->dev); in mlxsw_sp_port_vlan_bridge_join()
1038 mlxsw_sp_port_vlan->bridge_port = bridge_port; in mlxsw_sp_port_vlan_bridge_join()
1057 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_port_vlan_bridge_leave() local
1065 bridge_port = mlxsw_sp_port_vlan->bridge_port; in mlxsw_sp_port_vlan_bridge_leave()
1066 last_vlan = list_is_singular(&bridge_port->vlans_list); in mlxsw_sp_port_vlan_bridge_leave()
1067 bridge_vlan = mlxsw_sp_bridge_vlan_find(bridge_port, vid); in mlxsw_sp_port_vlan_bridge_leave()
1076 bridge_port, in mlxsw_sp_port_vlan_bridge_leave()
1079 mlxsw_sp_bridge_port_mdb_flush(mlxsw_sp_port, bridge_port); in mlxsw_sp_port_vlan_bridge_leave()
1083 mlxsw_sp_bridge_port_put(mlxsw_sp_port->mlxsw_sp->bridge, bridge_port); in mlxsw_sp_port_vlan_bridge_leave()
1084 mlxsw_sp_port_vlan->bridge_port = NULL; in mlxsw_sp_port_vlan_bridge_leave()
1089 struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp_bridge_port_vlan_add() argument
1110 err = mlxsw_sp_port_vlan_bridge_join(mlxsw_sp_port_vlan, bridge_port); in mlxsw_sp_bridge_port_vlan_add()
1166 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_port_vlans_add() local
1185 bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp->bridge, orig_dev); in mlxsw_sp_port_vlans_add()
1186 if (WARN_ON(!bridge_port)) in mlxsw_sp_port_vlans_add()
1189 if (!bridge_port->bridge_device->vlan_enabled) in mlxsw_sp_port_vlans_add()
1195 err = mlxsw_sp_bridge_port_vlan_add(mlxsw_sp_port, bridge_port, in mlxsw_sp_port_vlans_add()
1213 struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp_bridge_port_fdb_flush() argument
1216 bool lagged = bridge_port->lagged; in mlxsw_sp_bridge_port_fdb_flush()
1220 system_port = lagged ? bridge_port->lag_id : bridge_port->system_port; in mlxsw_sp_bridge_port_fdb_flush()
1322 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_port_fdb_set() local
1325 bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp->bridge, orig_dev); in mlxsw_sp_port_fdb_set()
1326 if (!bridge_port) in mlxsw_sp_port_fdb_set()
1329 bridge_device = bridge_port->bridge_device; in mlxsw_sp_port_fdb_set()
1339 if (!bridge_port->lagged) in mlxsw_sp_port_fdb_set()
1341 bridge_port->system_port, in mlxsw_sp_port_fdb_set()
1346 bridge_port->lag_id, in mlxsw_sp_port_fdb_set()
1442 struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp_bridge_port_get_ports_bitmap() argument
1449 if (!bridge_port->lagged) { in mlxsw_sp_bridge_port_get_ports_bitmap()
1450 set_bit(bridge_port->system_port, ports_bitmap); in mlxsw_sp_bridge_port_get_ports_bitmap()
1454 lag_id = bridge_port->lag_id; in mlxsw_sp_bridge_port_get_ports_bitmap()
1470 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_mc_get_mrouters_bitmap() local
1472 list_for_each_entry(bridge_port, &bridge_device->ports_list, list) { in mlxsw_sp_mc_get_mrouters_bitmap()
1473 if (bridge_port->mrouter) { in mlxsw_sp_mc_get_mrouters_bitmap()
1475 bridge_port, in mlxsw_sp_mc_get_mrouters_bitmap()
1602 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_port_mdb_add() local
1610 bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp->bridge, orig_dev); in mlxsw_sp_port_mdb_add()
1611 if (!bridge_port) in mlxsw_sp_port_mdb_add()
1614 bridge_device = bridge_port->bridge_device; in mlxsw_sp_port_mdb_add()
1637 if (bridge_port->mrouter) in mlxsw_sp_port_mdb_add()
1675 struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp_port_mrouter_update_mdb() argument
1681 bridge_device = bridge_port->bridge_device; in mlxsw_sp_port_mrouter_update_mdb()
1756 struct mlxsw_sp_bridge_port *bridge_port, u16 vid) in mlxsw_sp_bridge_port_vlan_del() argument
1776 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_port_vlans_del() local
1782 bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp->bridge, orig_dev); in mlxsw_sp_port_vlans_del()
1783 if (WARN_ON(!bridge_port)) in mlxsw_sp_port_vlans_del()
1786 if (!bridge_port->bridge_device->vlan_enabled) in mlxsw_sp_port_vlans_del()
1790 mlxsw_sp_bridge_port_vlan_del(mlxsw_sp_port, bridge_port, vid); in mlxsw_sp_port_vlans_del()
1797 struct mlxsw_sp_bridge_port *bridge_port, in __mlxsw_sp_port_mdb_del() argument
1803 if (bridge_port->bridge_device->multicast_enabled && in __mlxsw_sp_port_mdb_del()
1804 !bridge_port->mrouter) { in __mlxsw_sp_port_mdb_del()
1825 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_port_mdb_del() local
1829 bridge_port = mlxsw_sp_bridge_port_find(mlxsw_sp->bridge, orig_dev); in mlxsw_sp_port_mdb_del()
1830 if (!bridge_port) in mlxsw_sp_port_mdb_del()
1833 bridge_device = bridge_port->bridge_device; in mlxsw_sp_port_mdb_del()
1848 return __mlxsw_sp_port_mdb_del(mlxsw_sp_port, bridge_port, mid); in mlxsw_sp_port_mdb_del()
1853 struct mlxsw_sp_bridge_port *bridge_port) in mlxsw_sp_bridge_port_mdb_flush() argument
1858 bridge_device = bridge_port->bridge_device; in mlxsw_sp_bridge_port_mdb_flush()
1862 __mlxsw_sp_port_mdb_del(mlxsw_sp_port, bridge_port, in mlxsw_sp_bridge_port_mdb_flush()
1865 bridge_port->mrouter) { in mlxsw_sp_bridge_port_mdb_flush()
1922 struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp_bridge_8021q_port_join() argument
1928 if (is_vlan_dev(bridge_port->dev)) { in mlxsw_sp_bridge_8021q_port_join()
1945 struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp_bridge_8021q_port_leave() argument
1976 if (mlxsw_sp_port_vlan->bridge_port && in mlxsw_sp_port_is_br_member()
1977 mlxsw_sp_port_vlan->bridge_port->bridge_device->dev == in mlxsw_sp_port_is_br_member()
1987 struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp_bridge_8021d_port_join() argument
1992 struct net_device *dev = bridge_port->dev; in mlxsw_sp_bridge_8021d_port_join()
2009 return mlxsw_sp_port_vlan_bridge_join(mlxsw_sp_port_vlan, bridge_port); in mlxsw_sp_bridge_8021d_port_join()
2014 struct mlxsw_sp_bridge_port *bridge_port, in mlxsw_sp_bridge_8021d_port_leave() argument
2018 struct net_device *dev = bridge_port->dev; in mlxsw_sp_bridge_8021d_port_leave()
2051 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_port_bridge_join() local
2054 bridge_port = mlxsw_sp_bridge_port_get(mlxsw_sp->bridge, brport_dev); in mlxsw_sp_port_bridge_join()
2055 if (IS_ERR(bridge_port)) in mlxsw_sp_port_bridge_join()
2056 return PTR_ERR(bridge_port); in mlxsw_sp_port_bridge_join()
2057 bridge_device = bridge_port->bridge_device; in mlxsw_sp_port_bridge_join()
2059 err = bridge_device->ops->port_join(bridge_device, bridge_port, in mlxsw_sp_port_bridge_join()
2067 mlxsw_sp_bridge_port_put(mlxsw_sp->bridge, bridge_port); in mlxsw_sp_port_bridge_join()
2077 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_port_bridge_leave() local
2082 bridge_port = __mlxsw_sp_bridge_port_find(bridge_device, brport_dev); in mlxsw_sp_port_bridge_leave()
2083 if (!bridge_port) in mlxsw_sp_port_bridge_leave()
2086 bridge_device->ops->port_leave(bridge_device, bridge_port, in mlxsw_sp_port_bridge_leave()
2088 mlxsw_sp_bridge_port_put(mlxsw_sp->bridge, bridge_port); in mlxsw_sp_port_bridge_leave()
2109 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_fdb_notify_mac_process() local
2131 bridge_port = mlxsw_sp_port_vlan->bridge_port; in mlxsw_sp_fdb_notify_mac_process()
2132 if (!bridge_port) { in mlxsw_sp_fdb_notify_mac_process()
2137 bridge_device = bridge_port->bridge_device; in mlxsw_sp_fdb_notify_mac_process()
2151 mlxsw_sp_fdb_call_notifiers(type, mac, vid, bridge_port->dev); in mlxsw_sp_fdb_notify_mac_process()
2167 struct mlxsw_sp_bridge_port *bridge_port; in mlxsw_sp_fdb_notify_mac_lag_process() local
2190 bridge_port = mlxsw_sp_port_vlan->bridge_port; in mlxsw_sp_fdb_notify_mac_lag_process()
2191 if (!bridge_port) { in mlxsw_sp_fdb_notify_mac_lag_process()
2196 bridge_device = bridge_port->bridge_device; in mlxsw_sp_fdb_notify_mac_lag_process()
2211 mlxsw_sp_fdb_call_notifiers(type, mac, vid, bridge_port->dev); in mlxsw_sp_fdb_notify_mac_lag_process()
2397 mlxsw_sp_bridge_port_stp_state(struct mlxsw_sp_bridge_port *bridge_port) in mlxsw_sp_bridge_port_stp_state() argument
2399 return bridge_port->stp_state; in mlxsw_sp_bridge_port_stp_state()