• Andy Gospodarek's avatar
    bnxt_en: do not allow wildcard matches for L2 flows · e85a9be9
    Andy Gospodarek authored
    Before this patch the following commands would succeed as far as the
    user was concerned:
    
    $ tc qdisc add dev p1p1 ingress
    $ tc filter add dev p1p1 parent ffff: protocol all \
    	flower skip_sw action drop
    $ tc filter add dev p1p1 parent ffff: protocol ipv4 \
    	flower skip_sw src_mac 00:02:00:00:00:01/44 action drop
    
    The current flow offload infrastructure used does not support wildcard
    matching for ethernet headers, so do not allow the second or third
    commands to succeed.  If a user wants to drop traffic on that interface
    the protocol and MAC addresses need to be specified explicitly:
    
    $ tc qdisc add dev p1p1 ingress
    $ tc filter add dev p1p1 parent ffff: protocol arp \
    	flower skip_sw action drop
    $ tc filter add dev p1p1 parent ffff: protocol ipv4 \
    	flower skip_sw action drop
    ...
    $ tc filter add dev p1p1 parent ffff: protocol ipv4 \
    	flower skip_sw src_mac 00:02:00:00:00:01 action drop
    $ tc filter add dev p1p1 parent ffff: protocol ipv4 \
    	flower skip_sw src_mac 00:02:00:00:00:02 action drop
    ...
    
    There are also checks for VLAN parameters in this patch as other callers
    may wildcard those parameters even if tc does not.  Using different
    flow infrastructure could allow this to work in the future for L2 flows,
    but for now it does not.
    
    Fixes: 2ae7408f ("bnxt_en: bnxt: add TC flower filter offload support")
    Signed-off-by: default avatarAndy Gospodarek <gospo@broadcom.com>
    Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    e85a9be9
bnxt_tc.c 47.4 KB