linux/net/dsa
Vladimir Oltean 38b5beeae7 net: dsa: sja1105: prepare tagger for handling DSA tags and VLAN simultaneously
In VLAN-unaware mode, sja1105 uses VLAN tags with a custom TPID of
0xdadb. While in the yet-to-be introduced best_effort_vlan_filtering
mode, it needs to work with normal VLAN TPID values.

A complication arises when we must transmit a VLAN-tagged packet to the
switch when it's in VLAN-aware mode. We need to construct a packet with
2 VLAN tags, and the switch will use the outer header for routing and
pop it on egress. But sadly, here the 2 hardware generations don't
behave the same:

- E/T switches won't pop an ETH_P_8021AD tag on egress, it seems
  (packets will remain double-tagged).
- P/Q/R/S switches will drop a packet with 2 ETH_P_8021Q tags (it looks
  like it tries to prevent VLAN hopping).

But looks like the reverse is also true:

- E/T switches have no problem popping the outer tag from packets with
  2 ETH_P_8021Q tags.
- P/Q/R/S will have no problem popping a single tag even if that is
  ETH_P_8021AD.

So it is clear that if we want the hardware to work with dsa_8021q
tagging in VLAN-aware mode, we need to send different TPIDs depending on
revision. Keep that information in priv->info->qinq_tpid.

The per-port tagger structure will hold an xmit_tpid value that depends
not only upon the qinq_tpid, but also upon the VLAN awareness state
itself (in case we must transmit using 0xdadb).

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-12 13:08:08 -07:00
..
dsa2.c net: dsa: introduce a dsa_switch_find function 2020-05-10 19:52:33 -07:00
dsa_priv.h net: dsa: provide an option for drivers to always receive bridge VLANs 2020-05-12 13:08:07 -07:00
dsa.c net: dsa: introduce a dsa_port_from_netdev public helper 2020-05-07 17:31:57 -07:00
Kconfig net: dsa: add GRO support via gro_cells 2020-04-23 12:32:13 -07:00
Makefile net: dsa: add support for Atheros AR9331 TAG format 2019-12-20 17:05:47 -08:00
master.c net: dsa: Do not leave DSA master with NULL netdev_ops 2020-05-06 17:31:54 -07:00
port.c net: dsa: provide an option for drivers to always receive bridge VLANs 2020-05-12 13:08:07 -07:00
slave.c net: dsa: provide an option for drivers to always receive bridge VLANs 2020-05-12 13:08:07 -07:00
switch.c net: dsa: permit cross-chip bridging between all trees in the system 2020-05-10 19:52:33 -07:00
tag_8021q.c net: dsa: sja1105: save/restore VLANs using a delta commit method 2020-05-12 13:08:08 -07:00
tag_ar9331.c net: dsa: tag_ar9331: Make sure there is headroom for tag 2020-02-14 07:34:51 -08:00
tag_brcm.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-03-25 18:58:11 -07:00
tag_dsa.c dsa: Cleanup unneeded table and make tag structures static 2019-04-28 19:41:01 -04:00
tag_edsa.c dsa: Cleanup unneeded table and make tag structures static 2019-04-28 19:41:01 -04:00
tag_gswip.c net: dsa: tag_gswip: fix typo in tagger name 2020-01-16 13:58:26 +01:00
tag_ksz.c net: dsa: ksz: use common define for tag len 2019-12-20 21:06:49 -08:00
tag_lan9303.c dsa: Cleanup unneeded table and make tag structures static 2019-04-28 19:41:01 -04:00
tag_mtk.c dsa: Cleanup unneeded table and make tag structures static 2019-04-28 19:41:01 -04:00
tag_ocelot.c net: dsa: ocelot: Constify dsa_device_ops 2020-05-11 16:50:45 -07:00
tag_qca.c net: dsa: tag_qca: Make sure there is headroom for tag 2020-02-14 07:34:51 -08:00
tag_sja1105.c net: dsa: sja1105: prepare tagger for handling DSA tags and VLAN simultaneously 2020-05-12 13:08:08 -07:00
tag_trailer.c dsa: Cleanup unneeded table and make tag structures static 2019-04-28 19:41:01 -04:00