summaryrefslogtreecommitdiff
path: root/target/linux/generic
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2010-07-02 09:55:57 +0000
committerGabor Juhos <juhosg@openwrt.org>2010-07-02 09:55:57 +0000
commit86b4b5e1e95cc3eeec86d127d7413c62d8c00ff4 (patch)
tree54226cb6d6850efa973596629ecd419738d20d4b /target/linux/generic
parentb917b09b91753920eefdfb7c4a59b6c70a84ea59 (diff)
downloadmtk-20170518-86b4b5e1e95cc3eeec86d127d7413c62d8c00ff4.zip
mtk-20170518-86b4b5e1e95cc3eeec86d127d7413c62d8c00ff4.tar.gz
mtk-20170518-86b4b5e1e95cc3eeec86d127d7413c62d8c00ff4.tar.bz2
generic: rtl8366: enable VLAN ingress filtering
SVN-Revision: 22044
Diffstat (limited to 'target/linux/generic')
-rw-r--r--target/linux/generic/files/drivers/net/phy/rtl8366rb.c8
-rw-r--r--target/linux/generic/files/drivers/net/phy/rtl8366s.c7
2 files changed, 15 insertions, 0 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366rb.c b/target/linux/generic/files/drivers/net/phy/rtl8366rb.c
index c006f73..420a552 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8366rb.c
+++ b/target/linux/generic/files/drivers/net/phy/rtl8366rb.c
@@ -70,6 +70,8 @@
#define RTL8366RB_PHY_NO_OFFSET 9
#define RTL8366RB_PHY_NO_MASK (0x1f << 9)
+#define RTL8366RB_VLAN_INGRESS_CTRL2_REG 0x037f
+
/* LED control registers */
#define RTL8366RB_LED_BLINKRATE_REG 0x0430
#define RTL8366RB_LED_BLINKRATE_BIT 0
@@ -288,6 +290,12 @@ static int rtl8366rb_hw_init(struct rtl8366_smi *smi)
/* disable auto ageing for all ports */
REG_WR(smi, RTL8366RB_SSCR1, RTL8366RB_PORT_ALL);
+ /*
+ * discard VLAN tagged packets if the port is not a member of
+ * the VLAN with which the packets is associated.
+ */
+ REG_WR(smi, RTL8366RB_VLAN_INGRESS_CTRL2_REG, RTL8366RB_PORT_ALL);
+
/* don't drop packets whose DA has not been learned */
REG_RMW(smi, RTL8366RB_SSCR2, RTL8366RB_SSCR2_DROP_UNKNOWN_DA, 0);
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366s.c b/target/linux/generic/files/drivers/net/phy/rtl8366s.c
index 91030ac..45da8fd 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8366s.c
+++ b/target/linux/generic/files/drivers/net/phy/rtl8366s.c
@@ -112,6 +112,7 @@
#define RTL8366S_VLAN_MEMCONF_BASE 0x0016
+#define RTL8366S_VLAN_MEMBERINGRESS_REG 0x0379
#define RTL8366S_PORT_LINK_STATUS_BASE 0x0060
#define RTL8366S_PORT_STATUS_SPEED_MASK 0x0003
@@ -299,6 +300,12 @@ static int rtl8366s_hw_init(struct rtl8366_smi *smi)
/* disable auto ageing for all ports */
REG_WR(smi, RTL8366S_SSCR1, RTL8366S_PORT_ALL);
+ /*
+ * discard VLAN tagged packets if the port is not a member of
+ * the VLAN with which the packets is associated.
+ */
+ REG_WR(smi, RTL8366S_VLAN_MEMBERINGRESS_REG, RTL8366S_PORT_ALL);
+
/* don't drop packets whose DA has not been learned */
REG_RMW(smi, RTL8366S_SSCR2, RTL8366S_SSCR2_DROP_UNKNOWN_DA, 0);