diff options
author | Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org> | 2018-08-10 08:47:09 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-08-11 12:38:53 -0400 |
commit | 803c4f64d79d2fced37a0650b94e6c84296dffd6 (patch) | |
tree | ffe8720640aabf7712f1093710db624fd800582c | |
parent | be35b982e83a3f2c2cfbb27320066fb8a27168c2 (diff) |
net: ethernet: ti: cpsw: fix runtime_pm while add/kill vlan
It's exclusive with normal behaviour but if try to set vlan to one of
the reserved values is made, the cpsw runtime pm is broken.
Fixes: a6c5d14f5136 ("drivers: net: cpsw: ndev: fix accessing to suspended device")
Signed-off-by: Ivan Khoronzhuk <ivan.khoronzhuk@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/ti/cpsw.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index 9edac671f276..3e34cb8ac1d3 100644 --- a/drivers/net/ethernet/ti/cpsw.c +++ b/drivers/net/ethernet/ti/cpsw.c | |||
@@ -2086,14 +2086,16 @@ static int cpsw_ndo_vlan_rx_add_vid(struct net_device *ndev, | |||
2086 | int i; | 2086 | int i; |
2087 | 2087 | ||
2088 | for (i = 0; i < cpsw->data.slaves; i++) { | 2088 | for (i = 0; i < cpsw->data.slaves; i++) { |
2089 | if (vid == cpsw->slaves[i].port_vlan) | 2089 | if (vid == cpsw->slaves[i].port_vlan) { |
2090 | return -EINVAL; | 2090 | ret = -EINVAL; |
2091 | goto err; | ||
2092 | } | ||
2091 | } | 2093 | } |
2092 | } | 2094 | } |
2093 | 2095 | ||
2094 | dev_info(priv->dev, "Adding vlanid %d to vlan filter\n", vid); | 2096 | dev_info(priv->dev, "Adding vlanid %d to vlan filter\n", vid); |
2095 | ret = cpsw_add_vlan_ale_entry(priv, vid); | 2097 | ret = cpsw_add_vlan_ale_entry(priv, vid); |
2096 | 2098 | err: | |
2097 | pm_runtime_put(cpsw->dev); | 2099 | pm_runtime_put(cpsw->dev); |
2098 | return ret; | 2100 | return ret; |
2099 | } | 2101 | } |
@@ -2119,7 +2121,7 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev, | |||
2119 | 2121 | ||
2120 | for (i = 0; i < cpsw->data.slaves; i++) { | 2122 | for (i = 0; i < cpsw->data.slaves; i++) { |
2121 | if (vid == cpsw->slaves[i].port_vlan) | 2123 | if (vid == cpsw->slaves[i].port_vlan) |
2122 | return -EINVAL; | 2124 | goto err; |
2123 | } | 2125 | } |
2124 | } | 2126 | } |
2125 | 2127 | ||
@@ -2129,6 +2131,7 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev, | |||
2129 | HOST_PORT_NUM, ALE_VLAN, vid); | 2131 | HOST_PORT_NUM, ALE_VLAN, vid); |
2130 | ret |= cpsw_ale_del_mcast(cpsw->ale, priv->ndev->broadcast, | 2132 | ret |= cpsw_ale_del_mcast(cpsw->ale, priv->ndev->broadcast, |
2131 | 0, ALE_VLAN, vid); | 2133 | 0, ALE_VLAN, vid); |
2134 | err: | ||
2132 | pm_runtime_put(cpsw->dev); | 2135 | pm_runtime_put(cpsw->dev); |
2133 | return ret; | 2136 | return ret; |
2134 | } | 2137 | } |