• Vladimir Oltean's avatar
    net: dsa: felix: disable cut-through forwarding for frames oversized for tc-taprio · 843794bb
    Vladimir Oltean authored
    Experimentally, it looks like when QSYS_QMAXSDU_CFG_7 is set to 605,
    frames even way larger than 601 octets are transmitted even though these
    should be considered as oversized, according to the documentation, and
    dropped.
    
    Since oversized frame dropping depends on frame size, which is only
    known at the EOF stage, and therefore not at SOF when cut-through
    forwarding begins, it means that the switch cannot take QSYS_QMAXSDU_CFG_*
    into consideration for traffic classes that are cut-through.
    
    Since cut-through forwarding has no UAPI to control it, and the driver
    enables it based on the mantra "if we can, then why not", the strategy
    is to alter vsc9959_cut_through_fwd() to take into consideration which
    tc's have oversize frame dropping enabled, and disable cut-through for
    them. Then, from vsc9959_tas_guard_bands_update(), we re-trigger the
    cut-through determination process.
    
    There are 2 strategies for vsc9959_cut_through_fwd() to determine
    whether a tc has oversized dropping enabled or not. One is to keep a bit
    mask of traffic classes per port, and the other is to read back from the
    hardware registers (a non-zero value of QSYS_QMAXSDU_CFG_* means the
    feature is enabled). We choose reading back from registers, because
    struct ocelot_port is shared with drivers (ocelot, seville) that don't
    support either cut-through nor tc-taprio, and we don't have a felix
    specific extension of struct ocelot_port. Furthermore, reading registers
    from the Felix hardware is quite cheap, since they are memory-mapped.
    
    Fixes: 55a515b1 ("net: dsa: felix: drop oversized frames with tc-taprio instead of hanging the port")
    Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    843794bb
felix_vsc9959.c 86.1 KB