1. 18 Mar, 2021 5 commits
    • David S. Miller's avatar
      Merge branch 'octeon-tc-offloads' · 31222162
      David S. Miller authored
      Naveen Mamindlapalli says:
      
      ====================
      Add tc hardware offloads
      
      This patch series adds support for tc hardware offloads.
      
      Patch #1 adds support for offloading flows that matches IP tos and IP
               protocol which will be used by tc hw offload support. Also
               added ethtool n-tuple filter to code to offload the flows
               matching the above fields.
      Patch #2 adds tc flower hardware offload support on ingress traffic.
      Patch #3 adds TC flower offload stats.
      Patch #4 adds tc TC_MATCHALL egress ratelimiting offload.
      
      * tc flower hardware offload in PF driver
      
      The driver parses the flow match fields and actions received from the tc
      subsystem and adds/delete MCAM rules for the same. Each flow contains set
      of match and action fields. If the action or fields are not supported,
      the rule cannot be offloaded to hardware. The tc uses same set of MCAM
      rules allocated for ethtool n-tuple filters. So, at a time only one entity
      can offload the flows to hardware, they're made mutually exclusive in the
      driver.
      
      Following match and actions are supported.
      
      Match: Eth dst_mac, EtherType, 802.1Q {vlan_id,vlan_prio}, vlan EtherType,
             IP proto {tcp,udp,sctp,icmp,icmp6}, IPv4 tos, IPv4{dst_ip,src_ip},
             L4 proto {dst_port|src_port number}.
      Actions: drop, accept, vlan pop, redirect to another port on the device.
      
      The Hardware stats are also supported. Currently only packet counter stats
      are updated.
      
      * tc egress rate limiting support
      Added TC-MATCHALL classifier offload with police action applied for all
      egress traffic on the specified interface.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      31222162
    • 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 35 commits