• Vladimir Oltean's avatar
    net: mscc: ocelot: fix incorrect ndo_get_stats64 packet counters · 5152de7b
    Vladimir Oltean authored
    Reading stats using the SYS_COUNT_* register definitions is only used by
    ocelot_get_stats64() from the ocelot switchdev driver, however,
    currently the bucket definitions are incorrect.
    
    Separately, on both RX and TX, we have the following problems:
    - a 256-1023 bucket which actually tracks the 256-511 packets
    - the 1024-1526 bucket actually tracks the 512-1023 packets
    - the 1527-max bucket actually tracks the 1024-1526 packets
    
    => nobody tracks the packets from the real 1527-max bucket
    
    Additionally, the RX_PAUSE, RX_CONTROL, RX_LONGS and RX_CLASSIFIED_DROPS
    all track the wrong thing. However this doesn't seem to have any
    consequence, since ocelot_get_stats64() doesn't use these.
    
    Even though this problem only manifests itself for the switchdev driver,
    we cannot split the fix for ocelot and for DSA, since it requires fixing
    the bucket definitions from enum ocelot_reg, which makes us necessarily
    adapt the structures from felix and seville as well.
    
    Fixes: 84705fc1 ("net: dsa: felix: introduce support for Seville VSC9953 switch")
    Fixes: 56051948 ("net: dsa: ocelot: add driver for Felix switch family")
    Fixes: a556c76a ("net: mscc: Add initial Ocelot switch support")
    Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    5152de7b
felix_vsc9959.c 76.2 KB