net: dsa: tag_ocelot: single out PTP-related transmit tag processing
authorVladimir Oltean <vladimir.oltean@nxp.com>
Sat, 13 Feb 2021 22:37:57 +0000 (00:37 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 15 Feb 2021 01:31:44 +0000 (17:31 -0800)
commit62bf5fde5e14640a2a732be9f6a661a488025eae
treec6182e6ed4d4d0f105574c0bcdde2c4ec3803eb4
parent40d3f295b5feda409784e569550057b5fbc2a295
net: dsa: tag_ocelot: single out PTP-related transmit tag processing

There is one place where we cannot avoid accessing driver data, and that
is 2-step PTP TX timestamping, since the switch wants us to provide a
timestamp request ID through the injection header, which naturally must
come from a sequence number kept by the driver (it is generated by the
.port_txtstamp method prior to the tagger's xmit).

However, since other drivers like dsa_loop do not claim PTP support
anyway, the DSA_SKB_CB(skb)->clone will always be NULL anyway, so if we
move all PTP-related dereferences of struct ocelot and struct ocelot_port
into a separate function, we can effectively ensure that this is dead
code when the ocelot tagger is attached to non-ocelot switches, and the
stateful portion of the tagger is more self-contained.

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>
net/dsa/tag_ocelot.c