linux-stable/drivers/net
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
..
appletalk net/appletalk: Supply missing net/Space.h include file 2020-09-18 14:53:40 -07:00
arcnet
bonding
caif
can can: flexcan: add lx2160ar1 support 2020-09-22 16:55:34 +02:00
dsa net: dsa: tag_ocelot: use a short prefix on both ingress and egress 2020-09-26 14:17:58 -07:00
ethernet net: mscc: ocelot: move NPI port configuration to DSA 2020-09-26 14:17:58 -07:00
fddi
fjes
hamradio
hippi hippi: switch from 'pci_' to 'dma_' API 2020-09-08 20:15:57 -07:00
hyperv hv_netvsc: Add validation for untrusted Hyper-V values 2020-09-17 16:21:26 -07:00
ieee802154
ipa Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-09-22 16:45:34 -07:00
ipvlan
mdio net: mdio-ipq4019: add Clause 45 support 2020-09-23 17:41:15 -07:00
netdevsim netdevsim: add support for flash_update overwrite mask 2020-09-25 17:20:57 -07:00
pcs net: pcs-lynx: add support for 10GBASER 2020-09-24 19:49:36 -07:00
phy net: phy: Document core PHY structures 2020-09-23 18:02:49 -07:00
plip
ppp
slip
team
usb Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-09-22 16:45:34 -07:00
vmxnet3
wan Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-09-22 16:45:34 -07:00
wimax net: wimax: i2400m: fix 'msg_skb' kernel-doc warning in i2400m_msg_to_dev() 2020-09-08 20:04:27 -07:00
wireguard Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-09-22 16:45:34 -07:00
wireless wireless-drivers-next patches for v5.10 2020-09-25 13:16:29 -07:00
xen-netback
bareudp.c
dummy.c
eql.c
geneve.c geneve: add transport ports in route lookup for geneve 2020-09-16 17:41:38 -07:00
gtp.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-09-04 21:28:59 -07:00
ifb.c
Kconfig net: mdio: Move MDIO drivers into a new subdirectory 2020-08-27 06:55:50 -07:00
LICENSE.SRC
loopback.c
macsec.c
macvlan.c
macvtap.c
Makefile net: mdio: Move MDIO drivers into a new subdirectory 2020-08-27 06:55:50 -07:00
mdio.c
mii.c
net_failover.c
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
Space.c
sungem_phy.c
tap.c
thunderbolt.c
tun.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2020-09-04 21:28:59 -07:00
veth.c net: remove napi_hash_del() from driver-facing API 2020-09-10 13:08:46 -07:00
virtio_net.c net: remove napi_hash_del() from driver-facing API 2020-09-10 13:08:46 -07:00
vrf.c
vsockmon.c
vxlan.c Revert "vxlan: move encapsulation warning" 2020-09-26 12:34:47 -07:00
xen-netfront.c