linux-stable/drivers/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
..
b53 net: dsa: b53: Configure VLANs while not filtering 2020-09-23 18:13:45 -07:00
microchip Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-09-22 16:45:34 -07:00
mv88e6xxx net: dsa: mv88e6xxx: Implement devlink info get callback 2020-09-18 18:18:30 -07:00
ocelot net: dsa: tag_ocelot: use a short prefix on both ingress and egress 2020-09-26 14:17:58 -07:00
qca net: dsa/ar9331: convert to mac_link_up() 2020-06-25 16:01:15 -07:00
sja1105 net: dsa: sja1105: implement .devlink_info_get 2020-09-25 16:35:27 -07:00
bcm_sf2.c net: dsa: bcm_sf2: Include address 0 for MDIO diversion 2020-09-23 17:51:16 -07:00
bcm_sf2.h net: dsa: bcm_sf2: recalculate switch clock rate based on ports 2020-09-03 15:08:03 -07:00
bcm_sf2_cfp.c net: dsa: bcm_sf2: Pass GENMASK() signed bits 2020-07-05 15:45:38 -07:00
bcm_sf2_regs.h Revert "net: dsa: bcm_sf2: Also configure Port 5 for 2Gb/sec on 7278" 2020-02-26 16:33:35 -08:00
dsa_loop.c net: dsa: loop: Return VLAN table size through devlink 2020-08-19 12:01:42 -07:00
dsa_loop.h
dsa_loop_bdinfo.c
Kconfig net: dsa: mt7530: Add the support of MT7531 switch 2020-09-14 16:30:39 -07:00
lan9303-core.c net: dsa: lan9303: fix variable 'res' set but not used 2020-07-05 15:48:19 -07:00
lan9303.h
lan9303_i2c.c
lan9303_mdio.c
lantiq_gswip.c net: dsa: lantiq_gswip: fix and improve the unsupported interface error 2020-06-07 17:09:46 -07:00
lantiq_pce.h
Makefile net: dsa: add support for Atheros AR9331 built-in switch 2019-12-20 17:05:47 -08:00
mt7530.c net: dsa: mt7530: Add some return-value checks 2020-09-21 14:43:07 -07:00
mt7530.h net: dsa: mt7530: Add the support of MT7531 switch 2020-09-14 16:30:39 -07:00
mv88e6060.c net: dsa: Get information about stacked DSA protocol 2020-01-08 16:01:13 -08:00
mv88e6060.h
qca8k.c net: dsa: qca8k: Add 802.1q VLAN support 2020-08-03 15:45:39 -07:00
qca8k.h net: dsa: qca8k: Add 802.1q VLAN support 2020-08-03 15:45:39 -07:00
realtek-smi-core.c
realtek-smi-core.h net: dsa: rtl8366: Refactor VLAN/PVID init 2020-09-02 14:13:35 -07:00
rtl8366.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-09-22 16:45:34 -07:00
rtl8366rb.c net: dsa: rtl8366rb: Support all 4096 VLANs 2020-09-21 14:49:14 -07:00
vitesse-vsc73xx-core.c net: dsa: vsc73xx: make the MTU configurable 2020-03-27 16:07:25 -07:00
vitesse-vsc73xx-platform.c net: dsa: vitesse-vsc73xx: Convert to plain comments to avoid kerneldoc warnings 2020-07-05 15:49:03 -07:00
vitesse-vsc73xx-spi.c net: dsa: vitesse-vsc73xx: Convert to plain comments to avoid kerneldoc warnings 2020-07-05 15:49:03 -07:00
vitesse-vsc73xx.h