Commit 556fdd85 authored by David S. Miller's avatar David S. Miller

Merge branch 'cpsw-runtime-pm-fix'

Grygorii Strashko says:

====================
net: ethernet: ti: cpsw: fix runtime pm while add/del reserved vid

Here 2 not critical fixes for:
- vlan ale table leak while error if deleting vlan (simplifies next fix)
- runtime pm while try to set reserved vlan
====================
Reviewed-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents e91e2189 803c4f64
...@@ -2086,14 +2086,16 @@ static int cpsw_ndo_vlan_rx_add_vid(struct net_device *ndev, ...@@ -2086,14 +2086,16 @@ static int cpsw_ndo_vlan_rx_add_vid(struct net_device *ndev,
int i; int i;
for (i = 0; i < cpsw->data.slaves; i++) { for (i = 0; i < cpsw->data.slaves; i++) {
if (vid == cpsw->slaves[i].port_vlan) if (vid == cpsw->slaves[i].port_vlan) {
return -EINVAL; ret = -EINVAL;
goto err;
}
} }
} }
dev_info(priv->dev, "Adding vlanid %d to vlan filter\n", vid); dev_info(priv->dev, "Adding vlanid %d to vlan filter\n", vid);
ret = cpsw_add_vlan_ale_entry(priv, vid); ret = cpsw_add_vlan_ale_entry(priv, vid);
err:
pm_runtime_put(cpsw->dev); pm_runtime_put(cpsw->dev);
return ret; return ret;
} }
...@@ -2119,22 +2121,17 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev, ...@@ -2119,22 +2121,17 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev,
for (i = 0; i < cpsw->data.slaves; i++) { for (i = 0; i < cpsw->data.slaves; i++) {
if (vid == cpsw->slaves[i].port_vlan) if (vid == cpsw->slaves[i].port_vlan)
return -EINVAL; goto err;
} }
} }
dev_info(priv->dev, "removing vlanid %d from vlan filter\n", vid); dev_info(priv->dev, "removing vlanid %d from vlan filter\n", vid);
ret = cpsw_ale_del_vlan(cpsw->ale, vid, 0); ret = cpsw_ale_del_vlan(cpsw->ale, vid, 0);
if (ret != 0) ret |= cpsw_ale_del_ucast(cpsw->ale, priv->mac_addr,
return ret; HOST_PORT_NUM, ALE_VLAN, vid);
ret |= cpsw_ale_del_mcast(cpsw->ale, priv->ndev->broadcast,
ret = cpsw_ale_del_ucast(cpsw->ale, priv->mac_addr, 0, ALE_VLAN, vid);
HOST_PORT_NUM, ALE_VLAN, vid); err:
if (ret != 0)
return ret;
ret = cpsw_ale_del_mcast(cpsw->ale, priv->ndev->broadcast,
0, ALE_VLAN, vid);
pm_runtime_put(cpsw->dev); pm_runtime_put(cpsw->dev);
return ret; return ret;
} }
......
...@@ -394,7 +394,7 @@ int cpsw_ale_del_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask, ...@@ -394,7 +394,7 @@ int cpsw_ale_del_mcast(struct cpsw_ale *ale, u8 *addr, int port_mask,
idx = cpsw_ale_match_addr(ale, addr, (flags & ALE_VLAN) ? vid : 0); idx = cpsw_ale_match_addr(ale, addr, (flags & ALE_VLAN) ? vid : 0);
if (idx < 0) if (idx < 0)
return -EINVAL; return -ENOENT;
cpsw_ale_read(ale, idx, ale_entry); cpsw_ale_read(ale, idx, ale_entry);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment