]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
net: dsa: sja1105: support flow-based redirection via virtual links
authorVladimir Oltean <vladimir.oltean@nxp.com>
Tue, 5 May 2020 19:20:55 +0000 (22:20 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 8 May 2020 00:31:57 +0000 (17:31 -0700)
commitdfacc5a23e227cabdff41b6202f510398e90d36b
tree97a90de67d292ec4e70f166b7771de7b8fac3800
parentb70bb8d4ab2c0a4992e4692f07e9b91056b30c88
net: dsa: sja1105: support flow-based redirection via virtual links

Implement tc-flower offloads for redirect, trap and drop using
non-critical virtual links.

Commands which were tested to work are:

  # Send frames received on swp2 with a DA of 42:be:24:9b:76:20 to the
  # CPU and to swp3. This type of key (DA only) when the port's VLAN
  # awareness state is off.
  tc qdisc add dev swp2 clsact
  tc filter add dev swp2 ingress flower skip_sw dst_mac 42:be:24:9b:76:20 \
          action mirred egress redirect dev swp3 \
          action trap

  # Drop frames received on swp2 with a DA of 42:be:24:9b:76:20, a VID
  # of 100 and a PCP of 0.
  tc filter add dev swp2 ingress protocol 802.1Q flower skip_sw \
          dst_mac 42:be:24:9b:76:20 vlan_id 100 vlan_prio 0 action drop

Under the hood, all rules match on DMAC, VID and PCP, but when VLAN
filtering is disabled, those are set internally by the driver to the
port-based defaults. Because we would be put in an awkward situation if
the user were to change the VLAN filtering state while there are active
rules (packets would no longer match on the specified keys), we simply
deny changing vlan_filtering unless the list of flows offloaded via
virtual links is empty. Then the user can re-add new rules.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/sja1105/Kconfig
drivers/net/dsa/sja1105/Makefile
drivers/net/dsa/sja1105/sja1105.h
drivers/net/dsa/sja1105/sja1105_flower.c
drivers/net/dsa/sja1105/sja1105_main.c
drivers/net/dsa/sja1105/sja1105_vl.c [new file with mode: 0644]
drivers/net/dsa/sja1105/sja1105_vl.h [new file with mode: 0644]