net: dsa: sja1105: fix static FDB writes for SJA1110
authorVladimir Oltean <vladimir.oltean@nxp.com>
Fri, 30 Jul 2021 17:18:10 +0000 (20:18 +0300)
committerDavid S. Miller <davem@davemloft.net>
Mon, 2 Aug 2021 13:28:28 +0000 (14:28 +0100)
commitcb81698fddbcc9a3ee75857e99dfc29caa96135b
tree1150ac8c358c39e01903840c35c0d4c788a36ea6
parent40e159403896f7d55c98f858d0b20fee1d941fa4
net: dsa: sja1105: fix static FDB writes for SJA1110

The blamed commit made FDB access on SJA1110 functional only as far as
dumping the existing entries goes, but anything having to do with an
entry's index (adding, deleting) is still broken.

There are in fact 2 problems, all caused by improperly inheriting the
code from SJA1105P/Q/R/S:
- An entry size is SJA1110_SIZE_L2_LOOKUP_ENTRY (24) bytes and not
  SJA1105PQRS_SIZE_L2_LOOKUP_ENTRY (20) bytes
- The "index" field within an FDB entry is at bits 10:1 for SJA1110 and
  not 15:6 as in SJA1105P/Q/R/S

This patch moves the packing function for the cmd->index outside of
sja1105pqrs_common_l2_lookup_cmd_packing() and into the device specific
functions sja1105pqrs_l2_lookup_cmd_packing and
sja1110_l2_lookup_cmd_packing.

Fixes: 74e7feff0e22 ("net: dsa: sja1105: fix dynamic access to L2 Address Lookup table for SJA1110")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/sja1105/sja1105_dynamic_config.c