From: Felipe Balbi <balbi@ti.com>
To: David Miller <davem@davemloft.net>
Cc: <netdev@vger.kernel.org>,
Linux OMAP Mailing List <linux-omap@vger.kernel.org>,
Felipe Balbi <balbi@ti.com>, <stable@vger.kernel.org>,
Mugunthan V N <mugunthanvnm@ti.com>
Subject: [PATCH] net: ethernet: cpsw: ignore VLAN ID 1
Date: Tue, 6 Jan 2015 11:43:32 -0600 [thread overview]
Message-ID: <1420566212-30081-1-git-send-email-balbi@ti.com> (raw)
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@vger.kernel.org> # v3.9+
Cc: Mugunthan V N <mugunthanvnm@ti.com>
Tested-by: Schuyler Patton <spatton@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.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
next reply other threads:[~2015-01-06 17:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-06 17:43 Felipe Balbi [this message]
2015-01-06 19:13 ` [PATCH] net: ethernet: cpsw: ignore VLAN ID 1 David Miller
2015-01-06 20:31 ` Felipe Balbi
2015-01-06 21:59 ` David Miller
2015-01-06 22:04 ` Felipe Balbi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1420566212-30081-1-git-send-email-balbi@ti.com \
--to=balbi@ti.com \
--cc=davem@davemloft.net \
--cc=linux-omap@vger.kernel.org \
--cc=mugunthanvnm@ti.com \
--cc=netdev@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).