All of lore.kernel.org
 help / color / mirror / Atom feed
* [net PATCH v2 1/1] drivers: net: cpsw: discard dual emac default vlan configuration
@ 2015-01-22  9:49 Mugunthan V N
  2015-01-27  0:06 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Mugunthan V N @ 2015-01-22  9:49 UTC (permalink / raw)
  To: netdev; +Cc: davem, Mugunthan V N, stable

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>
---

Changes from initial version:
* Fixed typo errors in comments and no code changes.

---
 drivers/net/ethernet/ti/cpsw.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index e068d48..a39131f 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,
 	if (vid == priv->data.default_vlan)
 		return 0;
 
+	if (priv->data.dual_emac) {
+		/* In dual EMAC, reserved VLAN id should not be used for
+		 * creating VLAN interfaces as this can break the dual
+		 * EMAC port separation
+		 */
+		int i;
+
+		for (i = 0; i < priv->data.slaves; i++) {
+			if (vid == priv->slaves[i].port_vlan)
+				return -EINVAL;
+		}
+	}
+
 	dev_info(priv->dev, "Adding vlanid %d to vlan filter\n", vid);
 	return cpsw_add_vlan_ale_entry(priv, vid);
 }
@@ -1696,6 +1709,15 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev,
 	if (vid == priv->data.default_vlan)
 		return 0;
 
+	if (priv->data.dual_emac) {
+		int i;
+
+		for (i = 0; i < priv->data.slaves; i++) {
+			if (vid == priv->slaves[i].port_vlan)
+				return -EINVAL;
+		}
+	}
+
 	dev_info(priv->dev, "removing vlanid %d from vlan filter\n", vid);
 	ret = cpsw_ale_del_vlan(priv->ale, vid, 0);
 	if (ret != 0)
-- 
2.2.1.62.g3f15098

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [net PATCH v2 1/1] drivers: net: cpsw: discard dual emac default vlan configuration
  2015-01-22  9:49 [net PATCH v2 1/1] drivers: net: cpsw: discard dual emac default vlan configuration Mugunthan V N
@ 2015-01-27  0:06 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-01-27  0:06 UTC (permalink / raw)
  To: mugunthanvnm; +Cc: netdev, stable

From: Mugunthan V N <mugunthanvnm@ti.com>
Date: Thu, 22 Jan 2015 15:19:22 +0530

> 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>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-27  0:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-22  9:49 [net PATCH v2 1/1] drivers: net: cpsw: discard dual emac default vlan configuration Mugunthan V N
2015-01-27  0:06 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.