[OpenWrt-Devel] [PATCH] b53: reset vlans data when setting 'enable_vlan'

Alexandru Ardelean ardeleanalex at gmail.com
Thu Feb 25 10:05:49 EST 2016


From: Alexandru Ardelean <ardeleanalex at gmail.com>

In our case we don't call reset (to reset the chip and the driver)
on each reconfigure.
So, we can re-use the 'enable_vlan' call, because this gets called
once on each switch re-configure and we can reset all previously
set VLANs.

Signed-off-by: Alexandru Ardelean <ardeleanalex at gmail.com>
---
 target/linux/generic/files/drivers/net/phy/b53/b53_common.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
index 676e301..a6bde8f 100644
--- a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
+++ b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
@@ -590,6 +590,8 @@ static int b53_global_set_vlan_enable(struct switch_dev *dev,
 	struct b53_device *priv = sw_to_b53(dev);
 
 	priv->enable_vlan = val->value.i;
+	/* Reset VLANs whenever calling this ; this would set the system to a deterministic state */
+	memset(priv->vlans, 0, sizeof(*priv->vlans) * dev->vlans);
 
 	return 0;
 }
-- 
2.7.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list