• MD Danish Anwar's avatar
    net: ti: icssg-prueth: Add ICSSG Stats · c1e10d5d
    MD Danish Anwar authored
    Add icssg_stats.c to help dump, icssg related driver statistics.
    
    ICSSG has hardware registers for providing statistics like total rx bytes,
    total tx bytes, etc. These registers are of 32 bits and hence in case of 1G
    link, they overflows in around 32 seconds. The behaviour of these registers
    is such that they don't roll back to 0 after overflow but rather stay at
    UINT_MAX.
    
    These registers support a feature where the value written to them is
    subtracted from the register. This feature can be utilized to fix the
    overflowing of stats.
    
    This solution uses a Workqueues based solution where a function gets
    called before the registers overflow (every 25 seconds in 1G link, 25000
    seconds in 100M link), this function saves the register
    values in local variables and writes the last read value to the
    register. So any update during the read will be taken care of.
    Signed-off-by: default avatarMD Danish Anwar <danishanwar@ti.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    c1e10d5d
icssg_stats.h 4.29 KB