1. 18 Mar, 2021 4 commits
    • Sunil Goutham's avatar
      octeontx2-pf: TC_MATCHALL egress ratelimiting offload · e638a83f
      Sunil Goutham authored
      Add TC_MATCHALL egress ratelimiting offload support with POLICE
      action for entire traffic going out of the interface.
      
      Eg: To ratelimit egress traffic to 100Mbps
      
      $ ethtool -K eth0 hw-tc-offload on
      $ tc qdisc add dev eth0 clsact
      $ tc filter add dev eth0 egress matchall skip_sw \
                      action police rate 100Mbit burst 16Kbit
      
      HW supports a max burst size of ~128KB.
      Only one ratelimiting filter can be installed at a time.
      Signed-off-by: default avatarSunil Goutham <sgoutham@marvell.com>
      Signed-off-by: default avatarNaveen Mamindlapalli <naveenm@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e638a83f
    • Naveen Mamindlapalli's avatar
      octeontx2-pf: add tc flower stats handler for hw offloads · d8ce30e0
      Naveen Mamindlapalli authored
      Add support to get the stats for tc flower flows that are
      offloaded to hardware. To support this feature, added a
      new AF mbox handler which returns the MCAM entry stats
      for a flow that has hardware stat counter enabled.
      Signed-off-by: default avatarNaveen Mamindlapalli <naveenm@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      d8ce30e0
    • Naveen Mamindlapalli's avatar
      octeontx2-pf: Add tc flower hardware offload on ingress traffic · 1d4d9e42
      Naveen Mamindlapalli authored
      This patch adds support for tc flower hardware offload on ingress
      traffic. Since the tc-flower filter rules use the same set of MCAM
      rules as the n-tuple filters, the n-tuple filters and tc flower
      rules are mutually exclusive. When one of the feature is enabled
      using ethtool, the other feature is disabled in the driver. By default
      the driver enables n-tuple filters during initialization.
      
      The following flow keys are supported.
          -> Ethernet: dst_mac
          -> L2 proto: all protocols
          -> VLAN (802.1q): vlan_id/vlan_prio
          -> IPv4: dst_ip/src_ip/ip_proto{tcp|udp|sctp|icmp}/ip_tos
          -> IPv6: ip_proto{icmpv6}
          -> L4(tcp/udp/sctp): dst_port/src_port
      
      The following flow actions are supported.
          -> drop
          -> accept
          -> redirect
          -> vlan pop
      
      The flow action supports multiple actions when vlan pop is specified
      as the first action. The redirect action supports redirecting to the
      PF/VF of same PCI device. Redirecting to other PCI NIX devices is not
      supported.
      
      Example #1: Add a tc filter rule to drop UDP traffic with dest port 80
          # ethtool -K eth0 hw-tc-offload on
          # tc qdisc add dev eth0 ingress
          # tc filter add dev eth0 protocol ip parent ffff: flower ip_proto \
                udp dst_port 80 action drop
      
      Example #2: Add a tc filter rule to redirect ingress traffic on eth0
      with vlan id 3 to eth6 (ex: eth0 vf0) after stripping the vlan hdr.
          # ethtool -K eth0 hw-tc-offload on
          # tc qdisc add dev eth0 ingress
          # tc filter add dev eth0 parent ffff: protocol 802.1Q flower \
                vlan_id 3 vlan_ethtype ipv4 action vlan pop action mirred \
                ingress redirect dev eth6
      
      Example #3: List the ingress filter rules
          # tc -s filter show dev eth4 ingress
      
      Example #4: Delete tc flower filter rule with handle 0x1
          # tc filter del dev eth0 ingress protocol ip pref 49152 \
            handle 1 flower
      Signed-off-by: default avatarNaveen Mamindlapalli <naveenm@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      1d4d9e42
    • Naveen Mamindlapalli's avatar
      octeontx2-pf: Add ip tos and ip proto icmp/icmpv6 flow offload support · 2b9cef66
      Naveen Mamindlapalli authored
      Add support for programming the HW MCAM match key with IP tos, IP(v6)
      proto icmp/icmpv6, allowing flow offload rules to be installed using
      those fields. The NPC HW extracts layer type, which will be used as a
      matching criteria for different IP protocols.
      
      The ethtool n-tuple filter logic has been updated to parse the IP tos
      and l4proto for HW offloading. l4proto tcp/udp/sctp/ah/esp/icmp are
      supported. See example usage below.
      
      Ex: Redirect l4proto icmp to vf 0 queue 0
      ethtool -U eth0 flow-type ip4 l4proto 1 action vf 0 queue 0
      
      Ex: Redirect flow with ip tos 8 to vf 0 queue 0
      ethtool -U eth0 flow-type ip4 tos 8 vf 0 queue 0
      Signed-off-by: default avatarNaveen Mamindlapalli <naveenm@marvell.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2b9cef66
  2. 17 Mar, 2021 36 commits