linux-stable/net/dsa
Vladimir Oltean b79d7c14f4 net: dsa: introduce preferred_default_local_cpu_port and use on MT7530
Since the introduction of the OF bindings, DSA has always had a policy that
in case multiple CPU ports are present in the device tree, the numerically
smallest one is always chosen.

The MT7530 switch family, except the switch on the MT7988 SoC, has 2 CPU
ports, 5 and 6, where port 6 is preferable on the MT7531BE switch because
it has higher bandwidth.

The MT7530 driver developers had 3 options:
- to modify DSA when the MT7531 switch support was introduced, such as to
  prefer the better port
- to declare both CPU ports in device trees as CPU ports, and live with the
  sub-optimal performance resulting from not preferring the better port
- to declare just port 6 in the device tree as a CPU port

Of course they chose the path of least resistance (3rd option), kicking the
can down the road. The hardware description in the device tree is supposed
to be stable - developers are not supposed to adopt the strategy of
piecemeal hardware description, where the device tree is updated in
lockstep with the features that the kernel currently supports.

Now, as a result of the fact that they did that, any attempts to modify the
device tree and describe both CPU ports as CPU ports would make DSA change
its default selection from port 6 to 5, effectively resulting in a
performance degradation visible to users with the MT7531BE switch as can be
seen below.

Without preferring port 6:

[ ID][Role] Interval           Transfer     Bitrate         Retr
[  5][TX-C]   0.00-20.00  sec   374 MBytes   157 Mbits/sec  734    sender
[  5][TX-C]   0.00-20.00  sec   373 MBytes   156 Mbits/sec    receiver
[  7][RX-C]   0.00-20.00  sec  1.81 GBytes   778 Mbits/sec    0    sender
[  7][RX-C]   0.00-20.00  sec  1.81 GBytes   777 Mbits/sec    receiver

With preferring port 6:

[ ID][Role] Interval           Transfer     Bitrate         Retr
[  5][TX-C]   0.00-20.00  sec  1.99 GBytes   856 Mbits/sec  273    sender
[  5][TX-C]   0.00-20.00  sec  1.99 GBytes   855 Mbits/sec    receiver
[  7][RX-C]   0.00-20.00  sec  1.72 GBytes   737 Mbits/sec   15    sender
[  7][RX-C]   0.00-20.00  sec  1.71 GBytes   736 Mbits/sec    receiver

Using one port for WAN and the other ports for LAN is a very popular use
case which is what this test emulates.

As such, this change proposes that we retroactively modify stable kernels
(which don't support the modification of the CPU port assignments, so as to
let user space fix the problem and restore the throughput) to keep the
mt7530 driver preferring port 6 even with device trees where the hardware
is more fully described.

Fixes: c288575f78 ("net: dsa: mt7530: Add the support of MT7531 switch")
Signed-off-by: Vladimir Oltean <olteanv@gmail.com>
Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2023-06-20 09:40:26 +01:00
..
devlink.c net: dsa: move rest of devlink setup/teardown to devlink.c 2022-11-22 20:41:47 -08:00
devlink.h net: dsa: move rest of devlink setup/teardown to devlink.c 2022-11-22 20:41:47 -08:00
dsa.c net: dsa: introduce preferred_default_local_cpu_port and use on MT7530 2023-06-20 09:40:26 +01:00
dsa.h net: dsa: rename dsa2.c back into dsa.c and create its header 2022-11-22 20:41:53 -08:00
Kconfig net: dsa: modularize DSA_TAG_PROTO_NONE 2022-11-22 20:41:45 -08:00
Makefile net: dsa: add trace points for FDB/MDB operations 2023-04-12 08:36:07 +01:00
master.c net: dsa: replace NETDEV_PRE_CHANGE_HWTSTAMP notifier with a stub 2023-04-09 15:35:49 +01:00
master.h net: dsa: replace NETDEV_PRE_CHANGE_HWTSTAMP notifier with a stub 2023-04-09 15:35:49 +01:00
netlink.c net: dsa: kill off dsa_priv.h 2022-11-22 20:41:54 -08:00
netlink.h net: dsa: kill off dsa_priv.h 2022-11-22 20:41:54 -08:00
port.c net: dsa: make dsa_port_supports_hwtstamp() construct a fake ifreq 2023-04-03 10:04:27 +01:00
port.h net: dsa: make dsa_port_supports_hwtstamp() construct a fake ifreq 2023-04-03 10:04:27 +01:00
slave.c net: dsa: replace NETDEV_PRE_CHANGE_HWTSTAMP notifier with a stub 2023-04-09 15:35:49 +01:00
slave.h net: dsa: move headers exported by slave.c to slave.h 2022-11-22 20:41:49 -08:00
stubs.c net: dsa: replace NETDEV_PRE_CHANGE_HWTSTAMP notifier with a stub 2023-04-09 15:35:49 +01:00
switch.c net: dsa: add trace points for VLAN operations 2023-04-12 08:36:07 +01:00
switch.h net: dsa: move notifier definitions to switch.h 2022-11-22 20:41:52 -08:00
tag.c net: dsa: report rx_bytes unadjusted for ETH_HLEN 2023-03-20 09:09:53 +00:00
tag.h net: dsa: update TX path comments to not mention skb_mac_header() 2023-04-23 14:16:45 +01:00
tag_8021q.c net: dsa: update TX path comments to not mention skb_mac_header() 2023-04-23 14:16:45 +01:00
tag_8021q.h net: dsa: move tag_8021q headers to their proper place 2022-11-22 20:41:53 -08:00
tag_ar9331.c net: dsa: move tagging protocol code to tag.{c,h} 2022-11-22 20:41:50 -08:00
tag_brcm.c net: dsa: tag_brcm: legacy: fix daisy-chained switches 2023-03-21 17:29:13 -07:00
tag_dsa.c net: dsa: move tagging protocol code to tag.{c,h} 2022-11-22 20:41:50 -08:00
tag_gswip.c net: dsa: move tagging protocol code to tag.{c,h} 2022-11-22 20:41:50 -08:00
tag_hellcreek.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-12-08 18:19:59 -08:00
tag_ksz.c net: dsa: tag_ksz: do not rely on skb_mac_header() in TX paths 2023-04-23 14:16:44 +01:00
tag_lan9303.c net: dsa: move tagging protocol code to tag.{c,h} 2022-11-22 20:41:50 -08:00
tag_mtk.c net: dsa: move tagging protocol code to tag.{c,h} 2022-11-22 20:41:50 -08:00
tag_none.c net: dsa: move tagging protocol code to tag.{c,h} 2022-11-22 20:41:50 -08:00
tag_ocelot.c net: dsa: tag_ocelot: call only the relevant portion of __skb_vlan_pop() on TX 2023-04-23 14:16:45 +01:00
tag_ocelot_8021q.c net: dsa: move tag_8021q headers to their proper place 2022-11-22 20:41:53 -08:00
tag_qca.c net: dsa: move tagging protocol code to tag.{c,h} 2022-11-22 20:41:50 -08:00
tag_rtl4_a.c net: dsa: move tagging protocol code to tag.{c,h} 2022-11-22 20:41:50 -08:00
tag_rtl8_4.c net: dsa: move tagging protocol code to tag.{c,h} 2022-11-22 20:41:50 -08:00
tag_rzn1_a5psw.c net: dsa: move tagging protocol code to tag.{c,h} 2022-11-22 20:41:50 -08:00
tag_sja1105.c net: dsa: tag_sja1105: replace skb_mac_header() with vlan_eth_hdr() 2023-04-23 14:16:44 +01:00
tag_trailer.c net: dsa: move tagging protocol code to tag.{c,h} 2022-11-22 20:41:50 -08:00
tag_xrs700x.c net: dsa: move tagging protocol code to tag.{c,h} 2022-11-22 20:41:50 -08:00
trace.c net: dsa: add trace points for FDB/MDB operations 2023-04-12 08:36:07 +01:00
trace.h net: dsa: add trace points for VLAN operations 2023-04-12 08:36:07 +01:00