Changeset 33322


Ignore:
Timestamp:
2012-09-05T22:08:43+02:00 (5 years ago)
Author:
juhosg
Message:

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@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/target/linux/ramips/files/drivers/net/ethernet/ramips/ramips_esw.c

    r33321 r33322  
    751751        int idx = val->port_vlan; 
    752752        int shift = attr->id == RT305X_ESW_ATTR_PORT_RECV_GOOD ? 0 : 16; 
     753        u32 reg; 
    753754 
    754755        if (idx < 0 || idx >= RT305X_ESW_NUM_LANWAN) 
    755756                return -EINVAL; 
    756757 
    757         val->value.i = rt305x_esw_rr(esw, RT305X_ESW_REG_P0PC + 4*idx) >> shift; 
     758        reg = rt305x_esw_rr(esw, RT305X_ESW_REG_P0PC + 4*idx); 
     759        val->value.i = (reg >> shift) & 0xffff; 
    758760 
    759761        return 0; 
Note: See TracChangeset for help on using the changeset viewer.