summaryrefslogtreecommitdiff
path: root/target/linux/generic-2.6/files
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2010-06-08 20:18:34 +0000
committerGabor Juhos <juhosg@openwrt.org>2010-06-08 20:18:34 +0000
commitd08093b8b3370b67b68420af2c68e0c298e10de3 (patch)
tree4eb96e7d6d53e95404ed12ca2e964d14e18c9dd8 /target/linux/generic-2.6/files
parente04dd645f2214f98e70e519bff19f02310f3ea23 (diff)
downloadmtk-20170518-d08093b8b3370b67b68420af2c68e0c298e10de3.zip
mtk-20170518-d08093b8b3370b67b68420af2c68e0c298e10de3.tar.gz
mtk-20170518-d08093b8b3370b67b68420af2c68e0c298e10de3.tar.bz2
ip17xx: Maintain state->remove_tag incrementally
So far, state->remove_tag was sometimes updated incrementally, sometimes left to correct_vlan_state() to recalculate. Since I want to avoid use of correct_vlan_state() for IP175D, this patch fixes the only two remaining places which leave state->remove_tag inconsistent with state->add_tag and it drops the recalculation. Signed-off-by: Martin Mares <mj@ucw.cz> Signed-off-by: Patrick Horn <patrick.horn@gmail.com> SVN-Revision: 21717
Diffstat (limited to 'target/linux/generic-2.6/files')
-rw-r--r--target/linux/generic-2.6/files/drivers/net/phy/ip175c.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/target/linux/generic-2.6/files/drivers/net/phy/ip175c.c b/target/linux/generic-2.6/files/drivers/net/phy/ip175c.c
index 5726591..187fcfe 100644
--- a/target/linux/generic-2.6/files/drivers/net/phy/ip175c.c
+++ b/target/linux/generic-2.6/files/drivers/net/phy/ip175c.c
@@ -696,7 +696,6 @@ static void ip175c_correct_vlan_state(struct ip175c_state *state)
state->ports[i].shareports |= state->vlans[j].ports;
}
}
- state->remove_tag = ((~state->add_tag) & ((1<<state->regs->NUM_PORTS)-1));
}
static int ip175c_update_state(struct ip175c_state *state)
@@ -742,7 +741,7 @@ static void ip175c_reset_vlan_config(struct ip175c_state *state)
{
int i;
- state->remove_tag = 0x0000;
+ state->remove_tag = (state->vlan_enabled ? ((1<<state->regs->NUM_PORTS)-1) : 0x0000);
state->add_tag = 0x0000;
for (i = 0; i < MAX_VLANS; i++)
state->vlans[i].ports = 0x0000;
@@ -821,12 +820,14 @@ static int ip175c_set_ports(struct switch_dev *dev, struct switch_val *val)
state->vlans[val->port_vlan].ports = 0;
for (i = 0; i < val->len; i++) {
- int bitmask = (1<<val->value.ports[i].id);
+ unsigned int bitmask = (1<<val->value.ports[i].id);
state->vlans[val->port_vlan].ports |= bitmask;
if (val->value.ports[i].flags & (1<<SWITCH_PORT_FLAG_TAGGED)) {
state->add_tag |= bitmask;
+ state->remove_tag &= (~bitmask);
} else {
state->add_tag &= (~bitmask);
+ state->remove_tag |= bitmask;
}
}