OSDN Git Service

net: dsa: tag_sja1105: split sja1105_tagger_data into private and public sections
authorVladimir Oltean <vladimir.oltean@nxp.com>
Thu, 9 Dec 2021 23:34:46 +0000 (01:34 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 12 Dec 2021 12:51:34 +0000 (12:51 +0000)
commit950a419d9de13668f86828394cb242a1f9dece74
tree8de0de65807dc6d8a189747dc1a85a62555ecccd
parentfcbf979a5b4b5784bfb5647ae6190cd5c2ae595d
net: dsa: tag_sja1105: split sja1105_tagger_data into private and public sections

The sja1105 driver messes with the tagging protocol's state when PTP RX
timestamping is enabled/disabled. This is fundamentally necessary
because the tagger needs to know what to do when it receives a PTP
packet. If RX timestamping is enabled, then a metadata follow-up frame
is expected, and this holds the (partial) timestamp. So the tagger plays
hide-and-seek with the network stack until it also gets the metadata
frame, and then presents a single packet, the timestamped PTP packet.
But when RX timestamping isn't enabled, there is no metadata frame
expected, so the hide-and-seek game must be turned off and the packet
must be delivered right away to the network stack.

Considering this, we create a pseudo isolation by devising two tagger
methods callable by the switch: one to get the RX timestamping state,
and one to set it. Since we can't export symbols between the tagger and
the switch driver, these methods are exposed through function pointers.

After this change, the public portion of the sja1105_tagger_data
contains only function pointers.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/sja1105/sja1105_ptp.c
include/linux/dsa/sja1105.h
net/dsa/tag_sja1105.c