Lines Matching full:lan966x
10 static int lan966x_vlan_get_status(struct lan966x *lan966x) in lan966x_vlan_get_status() argument
12 return lan_rd(lan966x, ANA_VLANACCESS); in lan966x_vlan_get_status()
15 static int lan966x_vlan_wait_for_completion(struct lan966x *lan966x) in lan966x_vlan_wait_for_completion() argument
20 lan966x, val, in lan966x_vlan_wait_for_completion()
26 static void lan966x_vlan_set_mask(struct lan966x *lan966x, u16 vid) in lan966x_vlan_set_mask() argument
28 u16 mask = lan966x->vlan_mask[vid]; in lan966x_vlan_set_mask()
38 lan966x, ANA_VLANTIDX); in lan966x_vlan_set_mask()
43 lan966x, ANA_VLAN_PORT_MASK); in lan966x_vlan_set_mask()
48 lan966x, ANA_VLANACCESS); in lan966x_vlan_set_mask()
50 if (lan966x_vlan_wait_for_completion(lan966x)) in lan966x_vlan_set_mask()
51 dev_err(lan966x->dev, "Vlan set mask failed\n"); in lan966x_vlan_set_mask()
56 struct lan966x *lan966x = port->lan966x; in lan966x_vlan_port_add_vlan_mask() local
59 lan966x->vlan_mask[vid] |= BIT(p); in lan966x_vlan_port_add_vlan_mask()
60 lan966x_vlan_set_mask(lan966x, vid); in lan966x_vlan_port_add_vlan_mask()
65 struct lan966x *lan966x = port->lan966x; in lan966x_vlan_port_del_vlan_mask() local
68 lan966x->vlan_mask[vid] &= ~BIT(p); in lan966x_vlan_port_del_vlan_mask()
69 lan966x_vlan_set_mask(lan966x, vid); in lan966x_vlan_port_del_vlan_mask()
72 static bool lan966x_vlan_port_any_vlan_mask(struct lan966x *lan966x, u16 vid) in lan966x_vlan_port_any_vlan_mask() argument
74 return !!(lan966x->vlan_mask[vid] & ~BIT(CPU_PORT)); in lan966x_vlan_port_any_vlan_mask()
77 static void lan966x_vlan_cpu_add_vlan_mask(struct lan966x *lan966x, u16 vid) in lan966x_vlan_cpu_add_vlan_mask() argument
79 lan966x->vlan_mask[vid] |= BIT(CPU_PORT); in lan966x_vlan_cpu_add_vlan_mask()
80 lan966x_vlan_set_mask(lan966x, vid); in lan966x_vlan_cpu_add_vlan_mask()
83 static void lan966x_vlan_cpu_del_vlan_mask(struct lan966x *lan966x, u16 vid) in lan966x_vlan_cpu_del_vlan_mask() argument
85 lan966x->vlan_mask[vid] &= ~BIT(CPU_PORT); in lan966x_vlan_cpu_del_vlan_mask()
86 lan966x_vlan_set_mask(lan966x, vid); in lan966x_vlan_cpu_del_vlan_mask()
89 static void lan966x_vlan_cpu_add_cpu_vlan_mask(struct lan966x *lan966x, u16 vid) in lan966x_vlan_cpu_add_cpu_vlan_mask() argument
91 __set_bit(vid, lan966x->cpu_vlan_mask); in lan966x_vlan_cpu_add_cpu_vlan_mask()
94 static void lan966x_vlan_cpu_del_cpu_vlan_mask(struct lan966x *lan966x, u16 vid) in lan966x_vlan_cpu_del_cpu_vlan_mask() argument
96 __clear_bit(vid, lan966x->cpu_vlan_mask); in lan966x_vlan_cpu_del_cpu_vlan_mask()
99 bool lan966x_vlan_cpu_member_cpu_vlan_mask(struct lan966x *lan966x, u16 vid) in lan966x_vlan_cpu_member_cpu_vlan_mask() argument
101 return test_bit(vid, lan966x->cpu_vlan_mask); in lan966x_vlan_cpu_member_cpu_vlan_mask()
106 struct lan966x *lan966x = port->lan966x; in lan966x_vlan_port_get_pvid() local
108 if (!(lan966x->bridge_mask & BIT(port->chip_port))) in lan966x_vlan_port_get_pvid()
117 struct lan966x *lan966x = port->lan966x; in lan966x_vlan_port_set_vid() local
122 dev_err(lan966x->dev, in lan966x_vlan_port_set_vid()
154 struct lan966x *lan966x = port->lan966x; in lan966x_vlan_port_apply() local
170 lan966x, ANA_VLAN_CFG(port->chip_port)); in lan966x_vlan_port_apply()
176 lan966x, DEV_MAC_TAGS_CFG(port->chip_port)); in lan966x_vlan_port_apply()
188 lan_wr(val, lan966x, ANA_DROP_CFG(port->chip_port)); in lan966x_vlan_port_apply()
203 lan966x, REW_TAG_CFG(port->chip_port)); in lan966x_vlan_port_apply()
210 lan966x, REW_PORT_VLAN_CFG(port->chip_port)); in lan966x_vlan_port_apply()
218 struct lan966x *lan966x = port->lan966x; in lan966x_vlan_port_add_vlan() local
225 if (lan966x_vlan_cpu_member_cpu_vlan_mask(lan966x, vid)) { in lan966x_vlan_port_add_vlan()
226 lan966x_vlan_cpu_add_vlan_mask(lan966x, vid); in lan966x_vlan_port_add_vlan()
227 lan966x_fdb_write_entries(lan966x, vid); in lan966x_vlan_port_add_vlan()
228 lan966x_mdb_write_entries(lan966x, vid); in lan966x_vlan_port_add_vlan()
238 struct lan966x *lan966x = port->lan966x; in lan966x_vlan_port_del_vlan() local
248 if (!lan966x_vlan_port_any_vlan_mask(lan966x, vid)) { in lan966x_vlan_port_del_vlan()
249 lan966x_vlan_cpu_del_vlan_mask(lan966x, vid); in lan966x_vlan_port_del_vlan()
250 lan966x_fdb_erase_entries(lan966x, vid); in lan966x_vlan_port_del_vlan()
251 lan966x_mdb_erase_entries(lan966x, vid); in lan966x_vlan_port_del_vlan()
255 void lan966x_vlan_cpu_add_vlan(struct lan966x *lan966x, u16 vid) in lan966x_vlan_cpu_add_vlan() argument
265 if (lan966x_vlan_port_any_vlan_mask(lan966x, vid)) { in lan966x_vlan_cpu_add_vlan()
266 lan966x_vlan_cpu_add_vlan_mask(lan966x, vid); in lan966x_vlan_cpu_add_vlan()
267 lan966x_mdb_write_entries(lan966x, vid); in lan966x_vlan_cpu_add_vlan()
270 lan966x_vlan_cpu_add_cpu_vlan_mask(lan966x, vid); in lan966x_vlan_cpu_add_vlan()
271 lan966x_fdb_write_entries(lan966x, vid); in lan966x_vlan_cpu_add_vlan()
274 void lan966x_vlan_cpu_del_vlan(struct lan966x *lan966x, u16 vid) in lan966x_vlan_cpu_del_vlan() argument
277 lan966x_vlan_cpu_del_cpu_vlan_mask(lan966x, vid); in lan966x_vlan_cpu_del_vlan()
278 lan966x_vlan_cpu_del_vlan_mask(lan966x, vid); in lan966x_vlan_cpu_del_vlan()
279 lan966x_fdb_erase_entries(lan966x, vid); in lan966x_vlan_cpu_del_vlan()
280 lan966x_mdb_erase_entries(lan966x, vid); in lan966x_vlan_cpu_del_vlan()
283 void lan966x_vlan_init(struct lan966x *lan966x) in lan966x_vlan_init() argument
290 lan966x, ANA_VLANACCESS); in lan966x_vlan_init()
291 lan966x_vlan_wait_for_completion(lan966x); in lan966x_vlan_init()
294 lan966x->vlan_mask[vid] = 0; in lan966x_vlan_init()
295 lan966x_vlan_set_mask(lan966x, vid); in lan966x_vlan_init()
299 lan966x->vlan_mask[HOST_PVID] = in lan966x_vlan_init()
300 GENMASK(lan966x->num_phys_ports - 1, 0) | BIT(CPU_PORT); in lan966x_vlan_init()
301 lan966x_vlan_set_mask(lan966x, HOST_PVID); in lan966x_vlan_init()
303 lan966x->vlan_mask[UNAWARE_PVID] = in lan966x_vlan_init()
304 GENMASK(lan966x->num_phys_ports - 1, 0) | BIT(CPU_PORT); in lan966x_vlan_init()
305 lan966x_vlan_set_mask(lan966x, UNAWARE_PVID); in lan966x_vlan_init()
307 lan966x_vlan_cpu_add_cpu_vlan_mask(lan966x, UNAWARE_PVID); in lan966x_vlan_init()
313 lan966x, ANA_VLAN_CFG(CPU_PORT)); in lan966x_vlan_init()
316 lan_wr(GENMASK(lan966x->num_phys_ports, 0), in lan966x_vlan_init()
317 lan966x, ANA_VLANMASK); in lan966x_vlan_init()
319 for (port = 0; port < lan966x->num_phys_ports; port++) { in lan966x_vlan_init()
320 lan_wr(0, lan966x, REW_PORT_VLAN_CFG(port)); in lan966x_vlan_init()
321 lan_wr(0, lan966x, REW_TAG_CFG(port)); in lan966x_vlan_init()