Re: [PATCH net-next v8 13/16] net: dsa: vsc73xx: Implement the tag_8021q VLAN operations

From: Vladimir Oltean
Date: Fri Apr 05 2024 - 11:14:16 EST


On Wed, Apr 03, 2024 at 12:37:29PM +0200, Pawel Dembicki wrote:
> @@ -756,6 +756,12 @@ static int vsc73xx_setup(struct dsa_switch *ds)
>
> mdelay(50);
>
> + rtnl_lock();
> + ret = dsa_tag_8021q_register(ds, htons(ETH_P_8021Q));
> + rtnl_unlock();
> + if (ret)
> + return ret;
> +

No dsa_tag_8021q_unregister() in vsc73xx_teardown()?

Also, a bit odd placement, while the resets haven't all finished (this
falls in between the IP multicast flood mask and the PHY resets. It
makes future refactoring of the other code harder.

Additionally (and much worse), even later in vsc73xx_setup(), you clear
the VLAN table with portmaps of 0. Doesn't this wipe out the
configuration made by
dsa_tag_8021q_register()
-> dsa_tag_8021q_setup()
-> dsa_tag_8021q_port_setup()
-> dsa_port_tag_8021q_vlan_add()
-> dsa_switch_tag_8021q_vlan_add()
-> dsa_port_do_tag_8021q_vlan_add()
-> vsc73xx_tag_8021q_vlan_add()
-> vsc73xx_tag_8021q_vlan_add()
?