• Grygorii Strashko's avatar
    net: ethernet: ti: cpsw_new: enable bc/mc storm prevention support · 127c9e97
    Grygorii Strashko authored
    This patch enables support for ingress broadcast(BC)/multicast(MC) packets
    rate limiting in TI CPSW switchdev driver (the corresponding ALE support
    was added in previous patch) by implementing HW offload for simple
    tc-flower with policer action with matches on dst_mac:
     - ff:ff:ff:ff:ff:ff/ff:ff:ff:ff:ff:ff has to be used for BC packets rate
    limiting (exact match)
     - 01:00:00:00:00:00/01:00:00:00:00:00 fixed value has to be used for MC
    packets rate limiting
    
    The CPSW supports MC/BC packets rate limiting in packets/sec and affects
    all ingress MC/BC packets and serves as BC/MC storm prevention feature.
    
    Examples:
    - BC rate limit to 1000pps:
      tc qdisc add dev eth0 clsact
      tc filter add dev eth0 ingress flower skip_sw dst_mac ff:ff:ff:ff:ff:ff \
      action police pkts_rate 1000 pkts_burst 1 drop
    
    - MC rate limit to 20000pps:
      tc qdisc add dev eth0 clsact
      tc filter add dev eth0 ingress flower skip_sw dst_mac 01:00:00:00:00:00/01:00:00:00:00:00 \
      action police rate pkts_rate 10000 pkts_burst 1 drop
    
      pkts_burst - not used.
    Signed-off-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    127c9e97
cpsw_priv.c 38.2 KB