linux-stable/net/dsa
Vladimir Oltean d9c2f69cc1 net: dsa: introduce preferred_default_local_cpu_port and use on MT7530
commit b79d7c14f4 upstream.

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>
Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-04-27 17:07:17 +02:00
..
Kconfig net: dsa: tag_ksz: add tag handling for Microchip LAN937x 2022-07-02 16:34:05 +01:00
Makefile net: dsa: allow the DSA master to be seen and changed through rtnetlink 2022-09-20 10:32:35 +02:00
dsa.c net: dsa: allow the DSA master to be seen and changed through rtnetlink 2022-09-20 10:32:35 +02:00
dsa2.c net: dsa: introduce preferred_default_local_cpu_port and use on MT7530 2024-04-27 17:07:17 +02:00
dsa_priv.h net: dsa: make dsa_master_ioctl() see through port_hwtstamp_get() shims 2022-11-14 11:30:49 +00:00
master.c net: dsa: make dsa_master_ioctl() see through port_hwtstamp_get() shims 2022-11-14 11:30:49 +00:00
netlink.c net: dsa: make user ports return to init_net on netns deletion 2022-09-26 11:28:57 -07:00
port.c net: dsa: make dsa_master_ioctl() see through port_hwtstamp_get() shims 2022-11-14 11:30:49 +00:00
slave.c net: dsa: don't error out when drivers return ETH_DATA_LEN in .port_max_mtu() 2023-03-22 13:33:49 +01:00
switch.c net: dsa: allow masters to join a LAG 2022-09-20 10:32:36 +02:00
tag_8021q.c net: dsa: tag_8021q: avoid leaking ctx on dsa_tag_8021q_register() error path 2022-12-31 13:32:29 +01:00
tag_ar9331.c net: dsa: remove the struct packet_type argument from dsa_device_ops::rcv() 2021-08-02 15:13:15 +01:00
tag_brcm.c net: dsa: tag_brcm: legacy: fix daisy-chained switches 2023-03-30 12:49:09 +02:00
tag_dsa.c net: dsa: tag_dsa: Fix tx from VLAN uppers on non-filtering bridges 2022-03-08 11:12:28 +01:00
tag_gswip.c net: dsa: remove the struct packet_type argument from dsa_device_ops::rcv() 2021-08-02 15:13:15 +01:00
tag_hellcreek.c net: dsa: hellcreek: Check return value 2022-12-02 20:46:52 -08:00
tag_ksz.c net: dsa: ksz: Check return value 2022-12-02 20:46:51 -08:00
tag_lan9303.c net: dsa: lan9303: handle hwaccel VLAN tags 2022-02-17 09:32:06 -08:00
tag_mtk.c net: dsa: create a helper for locating EtherType DSA headers on TX 2021-08-11 14:44:58 +01:00
tag_ocelot.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-12-23 16:09:58 -08:00
tag_ocelot_8021q.c net: dsa: tag_8021q: merge RX and TX VLANs 2022-02-27 11:06:14 +00:00
tag_qca.c net: dsa: tag_qca: add support for handling mgmt and MIB Ethernet packet 2022-02-02 14:43:59 +00:00
tag_rtl4_a.c net: dsa: tag_rtl4_a: Drop bit 9 from egress frames 2021-09-14 19:34:03 -07:00
tag_rtl8_4.c net: dsa: tag_rtl8_4: fix typo in modalias name 2022-03-09 20:36:24 -08:00
tag_rzn1_a5psw.c net: dsa: add Renesas RZ/N1 switch tag driver 2022-06-27 11:37:55 +01:00
tag_sja1105.c net: dsa: sja1105: always enable the send_meta options 2023-07-19 16:22:06 +02:00
tag_trailer.c net: dsa: remove the struct packet_type argument from dsa_device_ops::rcv() 2021-08-02 15:13:15 +01:00
tag_xrs700x.c net: dsa: remove the struct packet_type argument from dsa_device_ops::rcv() 2021-08-02 15:13:15 +01:00