• 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
Makefile 395 Bytes