openwrt/package
Christian Marangi 8cce00bc9d
qca-ssdk: fix unsupported scenario with PORT1 not declared in switch bmp
Commit 947b44d9ae ("ipq807x: fix wrong define for LAN and WAN ess mask")
started fixing wrong switch_lan_bmp that defined lan there weren't
actually present. This displayed a fragility in the malibu phy init code
in qca-ssdk.

Add patch to fix this.

Quoting the patch detailed description:

I'm very confused by this and to me it's not clear the real usage of
this logic.

From what I can see the usage of this is EXTREMELY FRAGILE and results
in dangerous results if the OEM (or anyone that by chance try to
implement things in a logical manner) deviates from the default values
from the "magical template".

To be in more details. With QSDK 12.4, some tweaks were done to improve
autoneg and now on every call of port status, the phydev is tried to
add. This resulted in the call and log spam of an error with ports that
are actually not present on the system with qsdk reporting phydev is
NULL. This itself is not an error and printing the error is correct.

What is actually an error from ages is setting generic bitmap reporting
presence of port that are actually not present. This is very common on
OEM where the switch_lan_bmp is always a variant of 0x1e (that on bitmap
results in PORT1 PORT2 PORT3 PORT4 present) or 0x3e (PORT1 PORT2 PORT3
PORT4 PORT5). Reality is that many device are used as AP with one LAN
port or one WAN port. (or even exotic configuration with PORT1 not
present and PORT2 PORT3 PORT4 present (Xiaomi 3600)

With this finding one can say... ok nice, then lets update the DT and
set the correct bitmap...

Again world is a bad place and reality is that this cause wonderful
regression in some case of by extreme luck the first ever connected
port working and the rest of the switch dead.

The problem has been bisected to all the device that doesn't have the
PORT1 declared in any of the bitmap.

With this perfection in mind, on to the REAL problem.

malibu_phy_hw_init FOR SOME REASON, set a global variable first_phy_addr
to the first detected PHY addr that coincidentally is always PORT1.
PORT1 addr is 0x0. The entire code in malibu_phy use this variable to
derive the phy addrs in some function.

Declaring a bitmap where the PORT1 is missing (or worse PORT4 the only
one connected) result in first_phy_addr set to 1 or whatever phy addr is
detected first setting wrong value all over the init stage.

To fix this, just drop this variable and hardcode everything to assume
the first phy adrr is ALWAYS 0 and remove calculation and use define for
special case.

With the following change normal switch traffic is restored and ports
function is recovered.

Fixes: #13945
Fixes: 947b44d9ae ("ipq807x: fix wrong define for LAN and WAN ess mask")
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2023-11-11 23:39:32 +01:00
..
base-files base-files: add additional uci-defaults function for GRO and conduit 2023-11-10 12:30:34 +01:00
boot arm-trusted-firmware-mediatek: update to release 2023-10-13 2023-11-09 00:34:38 +00:00
devel gdb: Update to 13.2 2023-11-10 08:39:38 +01:00
firmware ipq-wifi: update to Git HEAD (2023-11-10) 2023-11-10 13:20:31 +01:00
kernel qca-ssdk: fix unsupported scenario with PORT1 not declared in switch bmp 2023-11-11 23:39:32 +01:00
libs wolfssl: update to 5.6.4 2023-11-10 19:28:27 +01:00
network netifd: update to Git HEAD (2023-11-11) 2023-11-11 23:38:30 +01:00
system fstools: bump to git HEAD 2023-11-09 11:15:42 +00:00
utils debugcc: add licensing information 2023-11-11 06:11:25 +00:00
Makefile build: add CycloneDX SBOM JSON support 2023-11-01 11:14:41 +00:00