[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1420566212-30081-1-git-send-email-balbi@ti.com>
Date: Tue, 6 Jan 2015 11:43:32 -0600
From: Felipe Balbi <balbi@...com>
To: David Miller <davem@...emloft.net>
CC: <netdev@...r.kernel.org>,
Linux OMAP Mailing List <linux-omap@...r.kernel.org>,
Felipe Balbi <balbi@...com>, <stable@...r.kernel.org>,
Mugunthan V N <mugunthanvnm@...com>
Subject: [PATCH] net: ethernet: cpsw: ignore VLAN ID 1
CPSW completely hangs if we add, and later remove,
VLAN ID #1. What happens is that after removing
VLAN ID #1, no packets will be received by CPSW
rendering network unusable.
In order to "fix" the issue, we're returning -EINVAL
if anybody tries to add VLAN ID #1. While at that,
also filter out any ID > 4095 because we only have
12 bits for VLAN IDs.
Fixes: 3b72c2f (drivers: net:ethernet: cpsw: add support for VLAN)
Cc: <stable@...r.kernel.org> # v3.9+
Cc: Mugunthan V N <mugunthanvnm@...com>
Tested-by: Schuyler Patton <spatton@...com>
Signed-off-by: Felipe Balbi <balbi@...com>
---
drivers/net/ethernet/ti/cpsw.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index e61ee8351272..028bb7f3de65 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1669,6 +1669,13 @@ static int cpsw_ndo_vlan_rx_add_vid(struct net_device *ndev,
if (vid == priv->data.default_vlan)
return 0;
+ /* NOTICE: CPSW does not support VID 1. We should
+ * also filter out VID > 4095 as we only have 12
+ * bits for VID entries
+ */
+ if (vid == 1 || vid >= VLAN_N_VID)
+ return -EINVAL;
+
dev_info(priv->dev, "Adding vlanid %d to vlan filter\n", vid);
return cpsw_add_vlan_ale_entry(priv, vid);
}
@@ -1682,6 +1689,13 @@ static int cpsw_ndo_vlan_rx_kill_vid(struct net_device *ndev,
if (vid == priv->data.default_vlan)
return 0;
+ /* NOTICE: CPSW does not support VID 1. We should
+ * also filter out VID > 4095 as we only have 12
+ * bits for VID entries
+ */
+ if (vid == 1 || vid >= VLAN_N_VID)
+ 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.0
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists