Lines Matching +full:lan966x +full:- +full:switch

1 // SPDX-License-Identifier: GPL-2.0+
13 struct lan966x *lan966x = port->lan966x; in lan966x_port_set_mcast_ip_flood() local
16 flood_mask_ip = lan_rd(lan966x, ANA_PGID(pgid_ip)); in lan966x_port_set_mcast_ip_flood()
22 if (!port->mcast_ena) { in lan966x_port_set_mcast_ip_flood()
25 flood_mask = lan_rd(lan966x, ANA_PGID(PGID_MC)); in lan966x_port_set_mcast_ip_flood()
28 if (flood_mask & BIT(port->chip_port)) in lan966x_port_set_mcast_ip_flood()
29 flood_mask_ip |= BIT(port->chip_port); in lan966x_port_set_mcast_ip_flood()
31 flood_mask_ip &= ~BIT(port->chip_port); in lan966x_port_set_mcast_ip_flood()
33 flood_mask_ip &= ~BIT(port->chip_port); in lan966x_port_set_mcast_ip_flood()
38 lan966x, ANA_PGID(pgid_ip)); in lan966x_port_set_mcast_ip_flood()
44 u32 val = lan_rd(port->lan966x, ANA_PGID(PGID_MC)); in lan966x_port_set_mcast_flood()
48 val |= BIT(port->chip_port); in lan966x_port_set_mcast_flood()
50 val &= ~BIT(port->chip_port); in lan966x_port_set_mcast_flood()
54 port->lan966x, ANA_PGID(PGID_MC)); in lan966x_port_set_mcast_flood()
56 if (!port->mcast_ena) { in lan966x_port_set_mcast_flood()
65 u32 val = lan_rd(port->lan966x, ANA_PGID(PGID_UC)); in lan966x_port_set_ucast_flood()
69 val |= BIT(port->chip_port); in lan966x_port_set_ucast_flood()
71 val &= ~BIT(port->chip_port); in lan966x_port_set_ucast_flood()
75 port->lan966x, ANA_PGID(PGID_UC)); in lan966x_port_set_ucast_flood()
81 u32 val = lan_rd(port->lan966x, ANA_PGID(PGID_BC)); in lan966x_port_set_bcast_flood()
85 val |= BIT(port->chip_port); in lan966x_port_set_bcast_flood()
87 val &= ~BIT(port->chip_port); in lan966x_port_set_bcast_flood()
91 port->lan966x, ANA_PGID(PGID_BC)); in lan966x_port_set_bcast_flood()
98 port->lan966x, ANA_PORT_CFG(port->chip_port)); in lan966x_port_set_learning()
100 port->learn_ena = enabled; in lan966x_port_set_learning()
128 return -EINVAL; in lan966x_port_pre_bridge_flags()
133 void lan966x_update_fwd_mask(struct lan966x *lan966x) in lan966x_update_fwd_mask() argument
137 for (i = 0; i < lan966x->num_phys_ports; i++) { in lan966x_update_fwd_mask()
138 struct lan966x_port *port = lan966x->ports[i]; in lan966x_update_fwd_mask()
141 if (port && lan966x->bridge_fwd_mask & BIT(i)) { in lan966x_update_fwd_mask()
142 mask = lan966x->bridge_fwd_mask & ~BIT(i); in lan966x_update_fwd_mask()
144 if (port->bond) in lan966x_update_fwd_mask()
145 mask &= ~lan966x_lag_get_mask(lan966x, in lan966x_update_fwd_mask()
146 port->bond); in lan966x_update_fwd_mask()
152 lan966x, ANA_PGID(PGID_SRC + i)); in lan966x_update_fwd_mask()
158 struct lan966x *lan966x = port->lan966x; in lan966x_port_stp_state_set() local
162 port->learn_ena) in lan966x_port_stp_state_set()
166 lan966x->bridge_fwd_mask |= BIT(port->chip_port); in lan966x_port_stp_state_set()
168 lan966x->bridge_fwd_mask &= ~BIT(port->chip_port); in lan966x_port_stp_state_set()
172 lan966x, ANA_PORT_CFG(port->chip_port)); in lan966x_port_stp_state_set()
174 lan966x_update_fwd_mask(lan966x); in lan966x_port_stp_state_set()
183 lan966x_mac_set_ageing(port->lan966x, ageing_time); in lan966x_port_ageing_set()
188 struct lan966x *lan966x = port->lan966x; in lan966x_port_mc_set() local
190 port->mcast_ena = mcast_ena; in lan966x_port_mc_set()
192 lan966x_mdb_restore_entries(lan966x); in lan966x_port_mc_set()
194 lan966x_mdb_clear_entries(lan966x); in lan966x_port_mc_set()
202 lan966x, ANA_CPU_FWD_CFG(port->chip_port)); in lan966x_port_mc_set()
218 switch (attr->id) { in lan966x_port_attr_set()
220 lan966x_port_bridge_flags(port, attr->u.brport_flags); in lan966x_port_attr_set()
223 err = lan966x_port_pre_bridge_flags(port, attr->u.brport_flags); in lan966x_port_attr_set()
226 lan966x_port_stp_state_set(port, attr->u.stp_state); in lan966x_port_attr_set()
229 lan966x_port_ageing_set(port, attr->u.ageing_time); in lan966x_port_attr_set()
232 lan966x_vlan_port_set_vlan_aware(port, attr->u.vlan_filtering); in lan966x_port_attr_set()
236 lan966x_port_mc_set(port, !attr->u.mc_disabled); in lan966x_port_attr_set()
239 err = -EOPNOTSUPP; in lan966x_port_attr_set()
252 struct lan966x *lan966x = port->lan966x; in lan966x_port_bridge_join() local
253 struct net_device *dev = port->dev; in lan966x_port_bridge_join()
256 if (!lan966x->bridge_mask) { in lan966x_port_bridge_join()
257 lan966x->bridge = bridge; in lan966x_port_bridge_join()
259 if (lan966x->bridge != bridge) { in lan966x_port_bridge_join()
261 return -ENODEV; in lan966x_port_bridge_join()
272 lan966x->bridge_mask |= BIT(port->chip_port); in lan966x_port_bridge_join()
285 struct lan966x *lan966x = port->lan966x; in lan966x_port_bridge_leave() local
291 lan966x->bridge_mask &= ~BIT(port->chip_port); in lan966x_port_bridge_leave()
293 if (!lan966x->bridge_mask) in lan966x_port_bridge_leave()
294 lan966x->bridge = NULL; in lan966x_port_bridge_leave()
310 extack = netdev_notifier_info_to_extack(&info->info); in lan966x_port_changeupper()
312 if (netif_is_bridge_master(info->upper_dev)) { in lan966x_port_changeupper()
313 if (info->linking) in lan966x_port_changeupper()
315 info->upper_dev, in lan966x_port_changeupper()
318 lan966x_port_bridge_leave(port, info->upper_dev); in lan966x_port_changeupper()
321 if (netif_is_lag_master(info->upper_dev)) { in lan966x_port_changeupper()
322 if (info->linking) in lan966x_port_changeupper()
323 err = lan966x_lag_port_join(port, info->upper_dev, in lan966x_port_changeupper()
324 info->upper_dev, in lan966x_port_changeupper()
327 lan966x_lag_port_leave(port, info->upper_dev); in lan966x_port_changeupper()
340 if (netif_is_bridge_master(info->upper_dev) && !info->linking) { in lan966x_port_prechangeupper()
341 switchdev_bridge_port_unoffload(port->dev, port, NULL, NULL); in lan966x_port_prechangeupper()
342 lan966x_fdb_flush_workqueue(port->lan966x); in lan966x_port_prechangeupper()
345 if (netif_is_lag_master(info->upper_dev)) { in lan966x_port_prechangeupper()
347 if (err || info->linking) in lan966x_port_prechangeupper()
351 lan966x_fdb_flush_workqueue(port->lan966x); in lan966x_port_prechangeupper()
362 struct lan966x *lan966x = NULL; in lan966x_foreign_bridging_check() local
374 if (lan966x) { in lan966x_foreign_bridging_check()
376 * lan966x switch inside it, check that it's in lan966x_foreign_bridging_check()
379 if (port->lan966x != lan966x) { in lan966x_foreign_bridging_check()
381 "Bridging between multiple lan966x switches disallowed"); in lan966x_foreign_bridging_check()
382 return -EINVAL; in lan966x_foreign_bridging_check()
385 /* This is the first lan966x port inside this in lan966x_foreign_bridging_check()
388 lan966x = port->lan966x; in lan966x_foreign_bridging_check()
392 /* Allow to have bond interfaces that have only lan966x in lan966x_foreign_bridging_check()
398 return -EINVAL; in lan966x_foreign_bridging_check()
405 "Bridging lan966x ports with foreign interfaces disallowed"); in lan966x_foreign_bridging_check()
406 return -EINVAL; in lan966x_foreign_bridging_check()
419 return lan966x_foreign_bridging_check(info->upper_dev, in lan966x_bridge_check()
422 info->info.extack); in lan966x_bridge_check()
432 switch (event) { in lan966x_netdevice_port_event()
457 switch (event) { in lan966x_netdevice_port_event()
491 struct lan966x *lan966x = port->lan966x; in lan966x_foreign_dev_check() local
495 if (lan966x->bridge == foreign_dev) in lan966x_foreign_dev_check()
499 for (i = 0; i < lan966x->num_phys_ports; ++i) in lan966x_foreign_dev_check()
500 if (lan966x->ports[i] && in lan966x_foreign_dev_check()
501 lan966x->ports[i]->bond == foreign_dev) in lan966x_foreign_dev_check()
513 switch (event) { in lan966x_switchdev_event()
535 struct lan966x *lan966x = port->lan966x; in lan966x_handle_port_vlan_add() local
537 if (!netif_is_bridge_master(obj->orig_dev)) in lan966x_handle_port_vlan_add()
538 lan966x_vlan_port_add_vlan(port, v->vid, in lan966x_handle_port_vlan_add()
539 v->flags & BRIDGE_VLAN_INFO_PVID, in lan966x_handle_port_vlan_add()
540 v->flags & BRIDGE_VLAN_INFO_UNTAGGED); in lan966x_handle_port_vlan_add()
542 lan966x_vlan_cpu_add_vlan(lan966x, v->vid); in lan966x_handle_port_vlan_add()
557 switch (obj->id) { in lan966x_handle_port_obj_add()
566 err = -EOPNOTSUPP; in lan966x_handle_port_obj_add()
577 struct lan966x *lan966x = port->lan966x; in lan966x_handle_port_vlan_del() local
579 if (!netif_is_bridge_master(obj->orig_dev)) in lan966x_handle_port_vlan_del()
580 lan966x_vlan_port_del_vlan(port, v->vid); in lan966x_handle_port_vlan_del()
582 lan966x_vlan_cpu_del_vlan(lan966x, v->vid); in lan966x_handle_port_vlan_del()
596 switch (obj->id) { in lan966x_handle_port_obj_del()
605 err = -EOPNOTSUPP; in lan966x_handle_port_obj_del()
619 switch (event) { in lan966x_switchdev_blocking_event()