linux-stable/drivers/net/dsa/sja1105
Vladimir Oltean 96c85f51f1 net: dsa: sja1105: some table entries are always present when read dynamically
The SJA1105 has a static configuration comprised of a number of tables
with entries. Some of these can be read and modified at runtime as well,
through the dynamic configuration interface.

As a careful reader can notice from the comments in this file, the
software interface for accessing a table entry through the dynamic
reconfiguration is a bit of a no man's land, and varies wildly across
switch generations and even from one kind of table to another.

I have tried my best to come up with a software representation of a
'common denominator' SPI command to access a table entry through the
dynamic configuration interface:

struct sja1105_dyn_cmd {
	bool search;
	u64 valid; /* must be set to 1 */
	u64 rdwrset; /* 0 to read, 1 to write */
	u64 errors;
	u64 valident; /* 0 if entry is invalid, 1 if valid */
	u64 index;
};

Relevant to this patch is the VALIDENT bit, which for READ commands is
populated by the switch and lets us know if we're looking at junk or at
a real table entry.

In SJA1105, the dynamic reconfiguration interface for management routes
has notably not implemented the VALIDENT bit, leading to a workaround to
ignore this field in sja1105_dynamic_config_read(), as it will be set to
zero, but the data is valid nonetheless.

In SJA1110, this pattern has sadly been abused to death, and while there
are many more tables which can be read back over the dynamic config
interface compared to SJA1105, their handling isn't in any way more
uniform. Generally speaking, if there is a single possible entry in a
given table, and loading that table in the static config is mandatory as
per the documentation, then the VALIDENT bit is deemed as redundant and
more than likely not implemented.

So it is time to make the workaround more official, and add a bit to the
flags implemented by dynamic config tables. It will be used by more
tables when SJA1110 support arrives.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2021-05-31 22:40:26 -07:00
..
Kconfig net: dsa: sja1105: support flow-based redirection via virtual links 2020-05-07 17:31:57 -07:00
Makefile net: dsa: sja1105: move devlink param code to sja1105_devlink.c 2020-09-25 16:35:27 -07:00
sja1105.h net: dsa: sja1105: add a translation table for port speeds 2021-05-31 22:40:26 -07:00
sja1105_clocking.c net: dsa: sja1105: always keep RGMII ports in the MAC role 2021-05-31 22:40:26 -07:00
sja1105_devlink.c net: dsa: propagate extack to .port_vlan_filtering 2021-02-14 17:38:12 -08:00
sja1105_dynamic_config.c net: dsa: sja1105: some table entries are always present when read dynamically 2021-05-31 22:40:26 -07:00
sja1105_dynamic_config.h net: dsa: sja1105: make config table operation structures constant 2020-06-22 16:01:29 -07:00
sja1105_ethtool.c net: dsa: sja1105: don't use burst SPI reads for port statistics 2021-05-21 14:01:41 -07:00
sja1105_flower.c net: dsa: sja1105: dimension the data structures for a larger port count 2021-05-24 13:59:03 -07:00
sja1105_main.c net: dsa: sja1105: always keep RGMII ports in the MAC role 2021-05-31 22:40:26 -07:00
sja1105_ptp.c net: dsa: free skb->cb usage in core driver 2021-04-27 14:10:15 -07:00
sja1105_ptp.h net: dsa: no longer clone skb in core driver 2021-04-27 14:10:15 -07:00
sja1105_sgmii.h net: dsa: sja1105: Add support for the SGMII port 2020-03-20 08:55:21 -07:00
sja1105_spi.c net: dsa: sja1105: add a translation table for port speeds 2021-05-31 22:40:26 -07:00
sja1105_static_config.c net: dsa: sja1105: allow the frame buffer size to be customized 2021-05-24 13:59:04 -07:00
sja1105_static_config.h net: dsa: sja1105: allow the frame buffer size to be customized 2021-05-24 13:59:04 -07:00
sja1105_tas.c net: dsa: sja1105: parameterize the number of ports 2021-05-24 13:59:03 -07:00
sja1105_tas.h net: dsa: sja1105: dimension the data structures for a larger port count 2021-05-24 13:59:03 -07:00
sja1105_vl.c net: dsa: sja1105: dimension the data structures for a larger port count 2021-05-24 13:59:03 -07:00
sja1105_vl.h net: dsa: sja1105: suppress -Wmissing-prototypes in sja1105_vl.c 2020-06-01 12:13:47 -07:00