Skip to content

Commit d579cc1

Browse files
grygoriySgregkh
authored andcommitted
net: ethernet: ti: am65-cpsw-nuss: restore vlan configuration while down/up
[ Upstream commit 7bcffde ] The vlan configuration is not restored after interface down/up sequence. Steps to check: # ip link add link eth0 name eth0.100 type vlan id 100 # ifconfig eth0 down # ifconfig eth0 up This patch fixes it, restoring vlan ALE entries on .ndo_open(). Fixes: 93a7653 ("net: ethernet: ti: introduce am65x/j721e gigabit eth subsystem driver") Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 33333c0 commit d579cc1

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

‎drivers/net/ethernet/ti/am65-cpsw-nuss.c‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@ static int am65_cpsw_nuss_ndo_slave_add_vid(struct net_device *ndev,
223223
u32 port_mask, unreg_mcast = 0;
224224
int ret;
225225

226+
if (!netif_running(ndev) || !vid)
227+
return 0;
228+
226229
ret = pm_runtime_get_sync(common->dev);
227230
if (ret < 0) {
228231
pm_runtime_put_noidle(common->dev);
@@ -246,6 +249,9 @@ static int am65_cpsw_nuss_ndo_slave_kill_vid(struct net_device *ndev,
246249
struct am65_cpsw_common *common = am65_ndev_to_common(ndev);
247250
int ret;
248251

252+
if (!netif_running(ndev) || !vid)
253+
return 0;
254+
249255
ret = pm_runtime_get_sync(common->dev);
250256
if (ret < 0) {
251257
pm_runtime_put_noidle(common->dev);
@@ -571,6 +577,16 @@ static int am65_cpsw_nuss_ndo_slave_stop(struct net_device *ndev)
571577
return 0;
572578
}
573579

580+
static int cpsw_restore_vlans(struct net_device *vdev, int vid, void *arg)
581+
{
582+
struct am65_cpsw_port *port = arg;
583+
584+
if (!vdev)
585+
return 0;
586+
587+
return am65_cpsw_nuss_ndo_slave_add_vid(port->ndev, 0, vid);
588+
}
589+
574590
static int am65_cpsw_nuss_ndo_slave_open(struct net_device *ndev)
575591
{
576592
struct am65_cpsw_common *common = am65_ndev_to_common(ndev);
@@ -644,6 +660,9 @@ static int am65_cpsw_nuss_ndo_slave_open(struct net_device *ndev)
644660
}
645661
}
646662

663+
/* restore vlan configurations */
664+
vlan_for_each(ndev, cpsw_restore_vlans, port);
665+
647666
phy_attached_info(port->slave.phy);
648667
phy_start(port->slave.phy);
649668

0 commit comments

Comments
 (0)