aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMugunthan V N <mugunthanvnm@ti.com>2015-01-22 04:49:22 -0500
committerDavid S. Miller <davem@davemloft.net>2015-01-26 19:05:50 -0500
commit02a54164c52ed6eca3089a0d402170fbf34d6cf5 (patch)
tree447620b70273e9a79168963b4fb778b1dfcb607d
parentb6663ad702d63f44ec7af01f34fbfb34abdd13a6 (diff)
drivers: net: cpsw: discard dual emac default vlan configuration
In Dual EMAC, the default VLANs are used to segregate Rx packets between the ports, so adding the same default VLAN to the switch will affect the normal packet transfers. So returning error on addition of dual EMAC default VLANs. Even if EMAC 0 default port VLAN is added to EMAC 1, it will lead to break dual EMAC port separations. Fixes: d9ba8f9e6298 (driver: net: ethernet: cpsw: dual emac interface implementation) Cc: <stable@vger.kernel.org> # v3.9+ Reported-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/ti/cpsw.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index e068d48b0f21..a39131f494ec 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1683,6 +1683,19 @@ static int cpsw_ndo_vlan_rx_add_vid(struct net_device *ndev,
1683 if (vid == priv->data.default_vlan) 1683 if (vid == priv->data.default_vlan)
1684 return 0; 1684 return 0;
1685 1685
1686 if (priv->data.dual_emac) {
1687 /* In dual EMAC, reserved VLAN id should not be used for
1688 * creating VLAN interfaces as this can break the dual
1689 * EMAC port separation
1690 */
1691 int i;
1692
1693 for (i = 0; i < priv->data.slaves; i++) {
1694 if (vid == priv->slaves[i].port_vlan)
1695 return -EINVAL;
1696 }
1697 }
1698
1686 dev_info(priv->dev, "Adding vlanid %d to vlan filter\n", vid); 1699 dev_info(priv->dev, "Adding vlanid %d to vlan filter\n", vid);
1687 return cpsw_add_vlan_ale_entry(priv, vid); 1700 return cpsw_add_vlan_ale_entry(priv, vid);
1688} 1701}
@@ -1696,6 +1709,15 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev,
1696 if (vid == priv->data.default_vlan) 1709 if (vid == priv->data.default_vlan)
1697 return 0; 1710 return 0;
1698 1711
1712 if (priv->data.dual_emac) {
1713 int i;
1714
1715 for (i = 0; i < priv->data.slaves; i++) {
1716 if (vid == priv->slaves[i].port_vlan)
1717 return -EINVAL;
1718 }
1719 }
1720
1699 dev_info(priv->dev, "removing vlanid %d from vlan filter\n", vid); 1721 dev_info(priv->dev, "removing vlanid %d from vlan filter\n", vid);
1700 ret = cpsw_ale_del_vlan(priv->ale, vid, 0); 1722 ret = cpsw_ale_del_vlan(priv->ale, vid, 0);
1701 if (ret != 0) 1723 if (ret != 0)