summaryrefslogtreecommitdiff
path: root/target
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2010-08-18 16:00:39 +0000
committerGabor Juhos <juhosg@openwrt.org>2010-08-18 16:00:39 +0000
commit0826570bc45aef54c5bf002b9900617edb0c78b2 (patch)
tree9ce96dcdeb1c09a267af2e264d37d718d2dc0d9a /target
parent08c5588cd26b48b4c9dfb0978b6b73ce480ef70f (diff)
downloadmtk-20170518-0826570bc45aef54c5bf002b9900617edb0c78b2.zip
mtk-20170518-0826570bc45aef54c5bf002b9900617edb0c78b2.tar.gz
mtk-20170518-0826570bc45aef54c5bf002b9900617edb0c78b2.tar.bz2
generic: rtl8366: allow use of VIDs 16-4095 if vlan4k is enabled
SVN-Revision: 22704
Diffstat (limited to 'target')
-rw-r--r--target/linux/generic/files/drivers/net/phy/rtl8366rb.c9
-rw-r--r--target/linux/generic/files/drivers/net/phy/rtl8366s.c9
2 files changed, 14 insertions, 4 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366rb.c b/target/linux/generic/files/drivers/net/phy/rtl8366rb.c
index a0a7df7..ec196f9 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8366rb.c
+++ b/target/linux/generic/files/drivers/net/phy/rtl8366rb.c
@@ -554,7 +554,12 @@ static int rtl8366rb_set_mc_index(struct rtl8366_smi *smi, int port, int index)
static int rtl8366rb_is_vlan_valid(struct rtl8366_smi *smi, unsigned vlan)
{
- if (vlan == 0 || vlan >= RTL8366RB_NUM_VLANS)
+ unsigned max = RTL8366RB_NUM_VLANS;
+
+ if (smi->vlan4k_enabled)
+ max = RTL8366RB_NUM_VIDS - 1;
+
+ if (vlan == 0 || vlan >= max)
return 0;
return 1;
@@ -882,7 +887,7 @@ static int rtl8366rb_switch_init(struct rtl8366_smi *smi)
dev->name = "RTL8366RB";
dev->cpu_port = RTL8366RB_PORT_NUM_CPU;
dev->ports = RTL8366RB_NUM_PORTS;
- dev->vlans = RTL8366RB_NUM_VLANS;
+ dev->vlans = RTL8366RB_NUM_VIDS;
dev->ops = &rtl8366_ops;
dev->devname = dev_name(smi->parent);
diff --git a/target/linux/generic/files/drivers/net/phy/rtl8366s.c b/target/linux/generic/files/drivers/net/phy/rtl8366s.c
index 896333c..66dc2db 100644
--- a/target/linux/generic/files/drivers/net/phy/rtl8366s.c
+++ b/target/linux/generic/files/drivers/net/phy/rtl8366s.c
@@ -593,7 +593,12 @@ static int rtl8366s_enable_vlan4k(struct rtl8366_smi *smi, int enable)
static int rtl8366s_is_vlan_valid(struct rtl8366_smi *smi, unsigned vlan)
{
- if (vlan == 0 || vlan >= RTL8366S_NUM_VLANS)
+ unsigned max = RTL8366S_NUM_VLANS;
+
+ if (smi->vlan4k_enabled)
+ max = RTL8366S_NUM_VIDS - 1;
+
+ if (vlan == 0 || vlan >= max)
return 0;
return 1;
@@ -909,7 +914,7 @@ static int rtl8366s_switch_init(struct rtl8366_smi *smi)
dev->name = "RTL8366S";
dev->cpu_port = RTL8366S_PORT_NUM_CPU;
dev->ports = RTL8366S_NUM_PORTS;
- dev->vlans = RTL8366S_NUM_VLANS;
+ dev->vlans = RTL8366S_NUM_VIDS;
dev->ops = &rtl8366_ops;
dev->devname = dev_name(smi->parent);