diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2012-09-05 20:08:43 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2012-09-05 20:08:43 +0000 |
commit | d4ae3a4ae2b7641cc61ae6c8a019cc63601e852f (patch) | |
tree | 696754cf6818f5b3cbedcd6fa80491170caf8c89 /target/linux/ramips | |
parent | 68eeafd44eb7274d53881160eacab4a2e662f64e (diff) | |
download | upstream-d4ae3a4ae2b7641cc61ae6c8a019cc63601e852f.tar.gz upstream-d4ae3a4ae2b7641cc61ae6c8a019cc63601e852f.tar.bz2 upstream-d4ae3a4ae2b7641cc61ae6c8a019cc63601e852f.zip |
ramips: Add missing andmask to ramips_esw register read for recv_good value.
Add missing andmask to ramips_esw register read for recv_good value.
Without the mask, recv_bad leaks into the recv_good packet count.
Didn't notice the bug before since you don't usually get bad
packets, so I only saw it when I was playing with overlength packets
earlier...
Signed-off-by: Tobias Diedrich <ranma+openwrt@tdiedrich.de>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@33322 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/ramips')
-rw-r--r-- | target/linux/ramips/files/drivers/net/ethernet/ramips/ramips_esw.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/target/linux/ramips/files/drivers/net/ethernet/ramips/ramips_esw.c b/target/linux/ramips/files/drivers/net/ethernet/ramips/ramips_esw.c index f01baa1709..798eb749bb 100644 --- a/target/linux/ramips/files/drivers/net/ethernet/ramips/ramips_esw.c +++ b/target/linux/ramips/files/drivers/net/ethernet/ramips/ramips_esw.c @@ -750,11 +750,13 @@ rt305x_esw_get_port_recv_badgood(struct switch_dev *dev, struct rt305x_esw *esw = container_of(dev, struct rt305x_esw, swdev); int idx = val->port_vlan; int shift = attr->id == RT305X_ESW_ATTR_PORT_RECV_GOOD ? 0 : 16; + u32 reg; if (idx < 0 || idx >= RT305X_ESW_NUM_LANWAN) return -EINVAL; - val->value.i = rt305x_esw_rr(esw, RT305X_ESW_REG_P0PC + 4*idx) >> shift; + reg = rt305x_esw_rr(esw, RT305X_ESW_REG_P0PC + 4*idx); + val->value.i = (reg >> shift) & 0xffff; return 0; } |