linux/drivers/net
Vladimir Oltean 566b18c8b7 net: dsa: sja1105: implement TX timestamping for SJA1110
The TX timestamping procedure for SJA1105 is a bit unconventional
because the transmit procedure itself is unconventional.

Control packets (and therefore PTP as well) are transmitted to a
specific port in SJA1105 using "management routes" which must be written
over SPI to the switch. These are one-shot rules that match by
destination MAC address on traffic coming from the CPU port, and select
the precise destination port for that packet. So to transmit a packet
from NET_TX softirq context, we actually need to defer to a process
context so that we can perform that SPI write before we send the packet.
The DSA master dev_queue_xmit() runs in process context, and we poll
until the switch confirms it took the TX timestamp, then we annotate the
skb clone with that TX timestamp. This is why the sja1105 driver does
not need an skb queue for TX timestamping.

But the SJA1110 is a bit (not much!) more conventional, and you can
request 2-step TX timestamping through the DSA header, as well as give
the switch a cookie (timestamp ID) which it will give back to you when
it has the timestamp. So now we do need a queue for keeping the skb
clones until their TX timestamps become available.

The interesting part is that the metadata frames from SJA1105 haven't
disappeared completely. On SJA1105 they were used as follow-ups which
contained RX timestamps, but on SJA1110 they are actually TX completion
packets, which contain a variable (up to 32) array of timestamps.
Why an array? Because:
- not only is the TX timestamp on the egress port being communicated,
  but also the RX timestamp on the CPU port. Nice, but we don't care
  about that, so we ignore it.
- because a packet could be multicast to multiple egress ports, each
  port takes its own timestamp, and the TX completion packet contains
  the individual timestamps on each port.

This is unconventional because switches typically have a timestamping
FIFO and raise an interrupt, but this one doesn't. So the tagger needs
to detect and parse meta frames, and call into the main switch driver,
which pairs the timestamps with the skbs in the TX timestamping queue
which are waiting for one.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2021-06-11 12:45:38 -07:00
..
appletalk Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-05-27 09:55:10 -07:00
arcnet
bonding bonding: remove redundant initialization of variable ret 2021-06-03 15:25:29 -07:00
caif Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-05-27 09:55:10 -07:00
can can: m_can: fix whitespace in a few comments 2021-05-27 09:42:24 +02:00
dsa net: dsa: sja1105: implement TX timestamping for SJA1110 2021-06-11 12:45:38 -07:00
ethernet net: hns3: add debugfs support for ptp info 2021-06-11 12:43:16 -07:00
fddi net: fddi: skfp: remove leading spaces before tabs 2021-05-20 15:10:57 -07:00
fjes fjes: check return value after calling platform_get_resource() 2021-06-10 13:53:13 -07:00
hamradio hamradio: bpqether: Fix -Wunused-const-variable warning 2021-06-01 17:00:51 -07:00
hippi
hyperv
ieee802154 Merge tag 'ieee802154-for-davem-2021-06-03' of git://git.kernel.org/pub/scm/linux/kernel/git/sschmidt/wpan 2021-06-03 15:21:58 -07:00
ipa net: ipa: don't index mem data array by ID 2021-06-10 14:50:08 -07:00
ipvlan
mdio net: mido: mdio-mux-bcm-iproc: Use devm_platform_get_and_ioremap_resource() 2021-06-10 13:59:37 -07:00
mhi
netdevsim netdevsim: delete unnecessary debugfs checking 2021-06-09 14:16:39 -07:00
pcs net: pcs: add 2500BASEX support for Intel mGbE controller 2021-06-08 14:31:43 -07:00
phy net: phy: probe for C45 PHYs that return PHY ID of zero in C22 space 2021-06-10 12:52:16 -07:00
plip
ppp net: ppp: remove leading spaces before tabs 2021-05-20 15:10:57 -07:00
slip net: slip: remove leading spaces before tabs 2021-05-20 15:10:57 -07:00
team
usb net: usb: asix: ax88772: Fix less than zero comparison of a u16 2021-06-09 14:54:03 -07:00
vmxnet3
wan net: ixp4xx_hss: add braces {} to all arms of the statement 2021-06-10 13:50:43 -07:00
wireguard wireguard: allowedips: free empty intermediate nodes when removing single node 2021-06-04 14:25:14 -07:00
wireless mt76: mt7615: Use devm_platform_get_and_ioremap_resource() 2021-06-10 14:00:49 -07:00
wwan net: wwan: core: purge rx queue on port close 2021-06-08 14:33:43 -07:00
xen-netback
bareudp.c
dummy.c
eql.c
geneve.c
gtp.c gtp: Fix a typo 2021-06-01 17:05:04 -07:00
ifb.c ifb: remove leading spaces before tabs 2021-05-20 15:10:57 -07:00
Kconfig net: Kconfig: indent with tabs instead of spaces 2021-06-08 11:34:37 -07:00
LICENSE.SRC
loopback.c
macsec.c
macvlan.c macvlan: Fix a typo 2021-06-01 17:05:04 -07:00
macvtap.c
Makefile
mdio.c
mii.c mii: remove leading spaces before tabs 2021-05-20 15:10:57 -07:00
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 tun: use DEVICE_ATTR_RO macro 2021-05-19 12:01:44 -07:00
veth.c
virtio_net.c virtio_net: Remove BUG() to avoid machine dead 2021-06-07 13:06:46 -07:00
vrf.c vrf: Fix a typo 2021-06-01 17:05:04 -07:00
vsockmon.c
vxlan.c
xen-netfront.c