• Ong Boon Leong's avatar
    net: stmmac: add tc flower filter for EtherType matching · e48cb313
    Ong Boon Leong authored
    This patch adds basic support for EtherType RX frame steering for
    LLDP and PTP using the hardware offload capabilities.
    
    Example steps for setting up RX frame steering for LLDP and PTP:
    $ IFDEVNAME=eth0
    $ tc qdisc add dev $IFDEVNAME ingress
    $ tc qdisc add dev $IFDEVNAME root mqprio num_tc 8 \
         map 0 1 2 3 4 5 6 7 0 0 0 0 0 0 0 0 \
         queues 1@0 1@1 1@2 1@3 1@4 1@5 1@6 1@7 hw 0
    
    For LLDP
    $ tc filter add dev $IFDEVNAME parent ffff: protocol 0x88cc \
         flower hw_tc 5
    OR
    $ tc filter add dev $IFDEVNAME parent ffff: protocol LLDP \
         flower hw_tc 5
    
    For PTP
    $ tc filter add dev $IFDEVNAME parent ffff: protocol 0x88f7 \
         flower hw_tc 6
    
    Show tc ingress filter
    $ tc filter show dev $IFDEVNAME ingress
    
    v1->v2:
     Thanks to Kurt's and Sebastian's suggestion.
     - change from __be16 to u16 etype
     - change ETHER_TYPE_FULL_MASK to use cpu_to_be16() macro
    Signed-off-by: default avatarOng Boon Leong <boon.leong.ong@intel.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    e48cb313
stmmac_tc.c 24.5 KB