]> git.itanic.dy.fi Git - linux-stable/commit
net: dsa: sja1105: complete tc-cbs offload support on SJA1110
authorVladimir Oltean <vladimir.oltean@nxp.com>
Tue, 5 Sep 2023 21:53:38 +0000 (00:53 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 6 Sep 2023 05:23:05 +0000 (06:23 +0100)
commit180a7419fe4adc8d9c8e0ef0fd17bcdd0cf78acd
treeebc5fffa20f4c6e22cd29a3367707aea5390dfe7
parent894cafc5c62ccced758077bd4e970dc714c42637
net: dsa: sja1105: complete tc-cbs offload support on SJA1110

The blamed commit left this delta behind:

  struct sja1105_cbs_entry {
 - u64 port;
 - u64 prio;
 + u64 port; /* Not used for SJA1110 */
 + u64 prio; /* Not used for SJA1110 */
   u64 credit_hi;
   u64 credit_lo;
   u64 send_slope;
   u64 idle_slope;
  };

but did not actually implement tc-cbs offload fully for the new switch.
The offload is accepted, but it doesn't work.

The difference compared to earlier switch generations is that now, the
table of CBS shapers is sparse, because there are many more shapers, so
the mapping between a {port, prio} and a table index is static, rather
than requiring us to store the port and prio into the sja1105_cbs_entry.

So, the problem is that the code programs the CBS shaper parameters at a
dynamic table index which is incorrect.

All that needs to be done for SJA1110 CBS shapers to work is to bypass
the logic which allocates shapers in a dense manner, as for SJA1105, and
use the fixed mapping instead.

Fixes: 3e77e59bf8cf ("net: dsa: sja1105: add support for the SJA1110 switch family")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/sja1105/sja1105.h
drivers/net/dsa/sja1105/sja1105_main.c
drivers/net/dsa/sja1105/sja1105_spi.c