linux/net/dsa
Vladimir Oltean 5124197ce5 net: dsa: tag_ocelot: use a short prefix on both ingress and egress
There are 2 goals that we follow:

- Reduce the header size
- Make the header size equal between RX and TX

The issue that required long prefix on RX was the fact that the ocelot
DSA tag, being put before Ethernet as it is, would overlap with the area
that a DSA master uses for RX filtering (destination MAC address
mainly).

Now that we can ask DSA to put the master in promiscuous mode, in theory
we could remove the prefix altogether and call it a day, but it looks
like we can't. Using no prefix on ingress, some packets (such as ICMP)
would be received, while others (such as PTP) would not be received.
This is because the DSA master we use (enetc) triggers parse errors
("MAC rx frame errors") presumably because it sees Ethernet frames with
a bad length. And indeed, when using no prefix, the EtherType (bytes
12-13 of the frame, bits 96-111) falls over the REW_VAL field from the
extraction header, aka the PTP timestamp.

When turning the short (32-bit) prefix on, the EtherType overlaps with
bits 64-79 of the extraction header, which are a reserved area
transmitted as zero by the switch. The packets are not dropped by the
DSA master with a short prefix. Actually, the frames look like this in
tcpdump (below is a PTP frame, with an extra dsa_8021q tag - dadb 0482 -
added by a downstream sja1105).

89:0c:a9:f2:01:00 > 88:80:00:0a:00:1d, 802.3, length 0: LLC, \
	dsap Unknown (0x10) Individual, ssap ProWay NM (0x0e) Response, \
	ctrl 0x0004: Information, send seq 2, rcv seq 0, \
	Flags [Response], length 78

0x0000:  8880 000a 001d 890c a9f2 0100 0000 100f  ................
0x0010:  0400 0000 0180 c200 000e 001f 7b63 0248  ............{c.H
0x0020:  dadb 0482 88f7 1202 0036 0000 0000 0000  .........6......
0x0030:  0000 0000 0000 0000 0000 001f 7bff fe63  ............{..c
0x0040:  0248 0001 1f81 0500 0000 0000 0000 0000  .H..............
0x0050:  0000 0000 0000 0000 0000 0000            ............

So the short prefix is our new default: we've shortened our RX frames by
12 octets, increased TX by 4, and headers are now equal between RX and
TX. Note that we still need promiscuous mode for the DSA master to not
drop it.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-09-26 14:17:58 -07:00
..
dsa2.c net: dsa: wire up devlink info get 2020-09-18 18:18:30 -07:00
dsa_priv.h net: dsa: untag the bridge pvid from rx skbs 2020-09-23 18:13:45 -07:00
dsa.c net: dsa: Add devlink regions support to DSA 2020-09-18 18:17:45 -07:00
Kconfig net: dsa: tag_rtl4_a: Implement Realtek 4 byte A tag 2020-07-08 15:36:19 -07:00
Makefile net: dsa: tag_rtl4_a: Implement Realtek 4 byte A tag 2020-07-08 15:36:19 -07:00
master.c net: dsa: allow drivers to request promiscuous mode on master 2020-09-26 14:17:58 -07:00
port.c net: dsa: allow 8021q uppers while the bridge has vlan_filtering=0 2020-09-20 19:01:34 -07:00
slave.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-09-22 16:45:34 -07:00
switch.c net: dsa: convert denying bridge VLAN with existing 8021q upper to PRECHANGEUPPER 2020-09-20 19:01:33 -07:00
tag_8021q.c net: dsa: tag_8021q: add VLANs to the master interface too 2020-09-20 19:01:34 -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 net: dsa: b53: Configure VLANs while not filtering 2020-09-23 18:13:45 -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: Allow forwarding of redirected IGMP traffic 2020-06-24 14:39:43 -07: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: tag_ksz: Fix __be16 warnings 2020-07-05 15:31:58 -07:00
tag_lan9303.c net: dsa: tag_lan9303: Fix __be16 warnings 2020-07-05 15:31:58 -07:00
tag_mtk.c net: dsa: tag_mtk: Fix warnings for __be16 2020-07-05 15:31:58 -07:00
tag_ocelot.c net: dsa: tag_ocelot: use a short prefix on both ingress and egress 2020-09-26 14:17:58 -07:00
tag_qca.c net: dsa: tag_qca.c: Fix warning for __be16 vs u16 2020-07-05 15:31:58 -07:00
tag_rtl4_a.c net: dsa: tag_rtl4_a: Implement Realtek 4 byte A tag 2020-07-08 15:36:19 -07:00
tag_sja1105.c net: dsa: tag_sja1105: request promiscuous mode for master 2020-09-26 14:17:58 -07:00
tag_trailer.c dsa: Cleanup unneeded table and make tag structures static 2019-04-28 19:41:01 -04:00