• Vladimir Oltean's avatar
    selftests: forwarding: add Per-Stream Filtering and Policing test for Ocelot · 954f46d2
    Vladimir Oltean authored
    The Felix VSC9959 switch in NXP LS1028A supports the tc-gate action
    which enforced time-based access control per stream. A stream as seen by
    this switch is identified by {MAC DA, VID}.
    
    We use the standard forwarding selftest topology with 2 host interfaces
    and 2 switch interfaces. The host ports must require timestamping non-IP
    packets and supporting tc-etf offload, for isochron to work. The
    isochron program monitors network sync status (ptp4l, phc2sys) and
    deterministically transmits packets to the switch such that the tc-gate
    action either (a) always accepts them based on its schedule, or
    (b) always drops them.
    
    I tried to keep as much of the logic that isn't specific to the NXP
    LS1028A in a new tsn_lib.sh, for future reuse. This covers
    synchronization using ptp4l and phc2sys, and isochron.
    
    The cycle-time chosen for this selftest isn't particularly impressive
    (and the focus is the functionality of the switch), but I didn't really
    know what to do better, considering that it will mostly be run during
    debugging sessions, various kernel bloatware would be enabled, like
    lockdep, KASAN, etc, and we certainly can't run any races with those on.
    
    I tried to look through the kselftest framework for other real time
    applications and didn't really find any, so I'm not sure how better to
    prepare the environment in case we want to go for a lower cycle time.
    At the moment, the only thing the selftest is ensuring is that dynamic
    frequency scaling is disabled on the CPU that isochron runs on. It would
    probably be useful to have a blacklist of kernel config options (checked
    through zcat /proc/config.gz) and some cyclictest scripts to run
    beforehand, but I saw none of those.
    Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
    Reviewed-by: Kurt Kanzenbach's avatarKurt Kanzenbach <kurt@linutronix.de>
    Link: https://lore.kernel.org/r/20220501112953.3298973-1-vladimir.oltean@nxp.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
    954f46d2
psfp.sh 6.92 KB