Repository navigation
Conversation
3d56e41 to
55d4db3
Compare
|
Could you apply your changes after #25101 (patch number the next one as well)? I’d like to avoid a race to apply fixes. |
55d4db3 to
6622899
Compare
|
Sure, no race intended. I've rebased it on top of #25101 as The change itself is the same: the only differences from the 797 version are context, plus dropping the |
| + rtl8365mb_pcs_link_up(&mb->pcs, mb->serdes_reinit_neg_mode, | ||
| + mb->serdes_reinit_interface, mb->serdes_reinit_speed, | ||
| + mb->serdes_reinit_duplex); |
There was a problem hiding this comment.
rtl8365mb_pcs_link_up() is the one RTL8365MB_SDS_MISC_REG writer that 930-08 left outside sds_lock — its regmap_update_bits() is unlocked, while the read-modify-write on the same register in mac_link_up()`` now takes it. Calling it from this work is what first makes the two concurrent, so a pause-bit update can be lost. Wrap that update_bits in `sds_lock` as well (the PR comment only covers `rtl8365mb_pcs_config()`).
Generated by Claude Code
There was a problem hiding this comment.
| + if (!mb->serdes_reinit_armed) { | ||
| + mb->serdes_reinit_armed = true; | ||
| + mb->serdes_reinit_neg_mode = neg_mode; | ||
| + mb->serdes_reinit_interface = interface; | ||
| + mb->serdes_reinit_speed = speed; | ||
| + mb->serdes_reinit_duplex = duplex; | ||
| + mb->serdes_reinit_waited = 0; | ||
| + mb->serdes_reinit_settling = false; | ||
| + schedule_delayed_work(&mb->serdes_reinit_work, 0); | ||
| + } |
There was a problem hiding this comment.
The link parameters are stashed only on the arming call, but the work fires at least 1.2 s later; any pcs_link_up() in between (link flap, renegotiated speed) leaves the replay forcing stale speed/duplex. Stash on every call and keep the one-shot guard only around the scheduling.
| + if (!mb->serdes_reinit_armed) { | |
| + mb->serdes_reinit_armed = true; | |
| + mb->serdes_reinit_neg_mode = neg_mode; | |
| + mb->serdes_reinit_interface = interface; | |
| + mb->serdes_reinit_speed = speed; | |
| + mb->serdes_reinit_duplex = duplex; | |
| + mb->serdes_reinit_waited = 0; | |
| + mb->serdes_reinit_settling = false; | |
| + schedule_delayed_work(&mb->serdes_reinit_work, 0); | |
| + } | |
| + mb->serdes_reinit_neg_mode = neg_mode; | |
| + mb->serdes_reinit_interface = interface; | |
| + mb->serdes_reinit_speed = speed; | |
| + mb->serdes_reinit_duplex = duplex; | |
| + if (!mb->serdes_reinit_armed) { | |
| + mb->serdes_reinit_armed = true; | |
| + mb->serdes_reinit_waited = 0; | |
| + mb->serdes_reinit_settling = false; | |
| + schedule_delayed_work(&mb->serdes_reinit_work, 0); | |
| + } |
Generated by Claude Code
There was a problem hiding this comment.
| +/* The switch side of a SerDes CPU port is configured when phylink brings the | ||
| + * CPU port up, which on some boards happens well before the conduit MAC has | ||
| + * configured its own end of the link. On an IPQ5018 the UNIPHY resets and | ||
| + * recalibrates its PLL at that point, about two seconds after the switch | ||
| + * SerDes was set up, and the switch receiver sometimes comes out of it | ||
| + * counting nothing or FCS errors only. A second bring-up clears that. The | ||
| + * vendor bootloader avoids it by configuring the SoC end first and the | ||
| + * switch afterwards. Wait for the conduit link, let it settle and run the | ||
| + * bring-up once more. | ||
| + */ |
There was a problem hiding this comment.
This arms for every family-C SerDes CPU port, not only IPQ5018: mt7622-buffalo-wsr-2533dhp2.dts:93, mt7622-elecom-wrc-2533gent.dts, mt7622-totolink-a8000ru.dts and mt7981b-mercusys-mr85x-common.dtsi all drive rtl8365mb over a 2500base-x CPU port and mediatek is on the same 6.18 kernel, so they get an extra SerDes reset and link bounce ~1.2 s after the conduit comes up. The PR comment says qualcommax is the only user — is the unconditional arming intended, or should it be gated (DT property, or the conduit/SoC that actually needs it)?
Generated by Claude Code
There was a problem hiding this comment.
| +#define RTL8365MB_SERDES_REINIT_POLL_MS 200 | ||
| +#define RTL8365MB_SERDES_REINIT_SETTLE_MS 1000 | ||
| +#define RTL8365MB_SERDES_REINIT_TIMEOUT_MS 30000 |
There was a problem hiding this comment.
nit: 930-08 keeps its work constants in the register/constant block near the top of the file (RTL8365MB_D_SDS_RELATCH_TRIES/_INTERVAL_MS) and names the struct fields sds_relatch*; this adds defines mid-file and a second serdes_reinit_* prefix (lines 47-54) for the same SerDes machinery. Move these up with the other defines and settle on one prefix.
Generated by Claude Code
There was a problem hiding this comment.
| + mb->serdes_reinit_duplex = duplex; | ||
| + mb->serdes_reinit_waited = 0; | ||
| + mb->serdes_reinit_settling = false; | ||
| + schedule_delayed_work(&mb->serdes_reinit_work, 0); |
There was a problem hiding this comment.
nit: the sibling relatch work in 930-08 queues on system_power_efficient_wq; this polls every 200 ms for up to 30 s on the default system_wq. Use queue_delayed_work(system_power_efficient_wq, ...) here and at the two reschedules on lines 117 and 123.
Generated by Claude Code
There was a problem hiding this comment.
The TP-Link Archer AX55 v1 carries an RTL8367S-VB, a family D chip the upstream rtl8365mb driver does not know: it detects the chip, sets speed and RGMII mode, reads and writes the VLAN 4K table and the PVID the family D way, and brings up the SDS13 SerDes as a PCS with the re-latch the chip needs. 930-01..08 are Mieczyslaw Nalewaj's series from openwrt/openwrt PR openwrt#25101. 930-09 repeats the switch-side SerDes bring-up once the conduit link is up: the switch end of the 2.5G trunk is configured about two seconds before the IPQ5018 UNIPHY resets and recalibrates its own end, and the trunk intermittently came up broken (bad FCS on every frame at the CPU port, or no octets counted). Sent as openwrt/openwrt PR openwrt#25153; 17 boots without a broken trunk on an AX55. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
6622899 to
09f4c3a
Compare
|
Thanks, all five points were valid. Updated
Retested on the AX55 v1: the v2 build boots clean. The repeated bring-up runs 1.0 s after the conduit link comes up, so the IPQ5018 check matches, and the CPU port shows no FCS errors while WAN is up. The previous version of the same logic had 17 clean boots out of 17, 8 of them cold starts. The branch now sits on the current head of #25101 ( |
The TP-Link Archer AX55 v1 carries an RTL8367S-VB, a family D chip the upstream rtl8365mb driver does not know: it detects the chip, sets speed and RGMII mode, reads and writes the VLAN 4K table and the PVID the family D way, and brings up the SDS13 SerDes as a PCS with the re-latch the chip needs. 930-01..08 are Mieczyslaw Nalewaj's series from openwrt/openwrt PR openwrt#25101. 930-09 repeats the switch-side SerDes bring-up once the conduit link is up: the switch end of the 2.5G trunk is configured about two seconds before the IPQ5018 UNIPHY resets and recalibrates its own end, and the trunk intermittently came up broken (bad FCS on every frame at the CPU port, or no octets counted). Sent as openwrt/openwrt PR openwrt#25153; 17 boots without a broken trunk on an AX55. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
| + dsa_switch_for_each_cpu_port(dp, &priv->ds) { | ||
| + if (dp->conduit && dp->conduit->dev.parent && | ||
| + of_device_is_compatible(dp->conduit->dev.parent->of_node, | ||
| + "qcom,ipq5018-gmac")) | ||
| + return true; | ||
| + } |
There was a problem hiding this comment.
qcom,ipq5018-gmac only exists in OpenWrt's own ipq5018-ess.dtsi:3;`` a grep of v6.18.52 finds it in no upstream DT, binding or driver match table, so a pending-* patch keyed on it is not submittable as-is. Would a property on the switch/CPU-port node express this better than matching the conduit's SoC compatible?
Generated by Claude Code
| + ret = rtl8365mb_pcs_config(&mb->pcs, mb->sds_reinit_neg_mode, | ||
| + mb->sds_reinit_interface, NULL, false); | ||
| + if (ret) { | ||
| + dev_err(priv->dev, "failed to repeat SerDes bring-up: %pe\n", | ||
| + ERR_PTR(ret)); | ||
| + return; | ||
| + } | ||
| + | ||
| + rtl8365mb_pcs_link_up(&mb->pcs, mb->sds_reinit_neg_mode, | ||
| + mb->sds_reinit_interface, mb->sds_reinit_speed, | ||
| + mb->sds_reinit_duplex); |
There was a problem hiding this comment.
sds_lock is acquired and released inside each rtl8365mb_sds_write()`` / rtl8365mb_sds_read(), so it serializes single register accesses, not a whole bring-up sequence. phylink runs `pcs_config()`/`pcs_link_up()` under its own state mutex, which this work does not hold, so a CPU-port link event arriving while the replay runs interleaves two bring-up sequences on the same SerDes. Is that ruled out in practice, or should the replay be serialized against phylink (e.g. under `rtnl_lock()`)?
Generated by Claude Code
There was a problem hiding this comment.
solved by dropping the work entirely — the bring-up now runs under sds_defer_lock, thanks
Generated by Claude Code
09f4c3a to
c9c5ae8
Compare
|
Rewritten, and both open questions from the last review are answered by the rewrite rather than argued with. Serialization. There is no work any more. The bring-up now runs either from
What else changed. The failure is an ordering problem: phylink configures the switch end when the switch is set up, seconds before the conduit MAC configures its own end and the IPQ5018 resets and recalibrates the UNIPHY PLL. So instead of repeating the bring-up afterwards, the patch holds it back until DSA reports the conduit operational, which is the order the vendor bootloader uses. The mux is parked at DISABLE before the mode is written, so a bring-up on a mux already in the mode still produces the edge the receiver latches on. Testing. 4 boots on this version with no broken trunk: one after a sysupgrade and three cold starts, the last two after ten hours and overnight without power. The bring-up ran 43-44 ms after the conduit link came up in every one of them, with no FCS errors on the CPU port. Restarting the interfaces left the trunk clean too. The earlier version of the same logic had 17 clean boots, 8 of them cold; without the change 2 of 9 boots were broken. The branch now sits on the current head of #25101 ( |
c9c5ae8 to
d68ebf4
Compare
d68ebf4 to
ff362b2
Compare
|
Synchronize |
openwrt-ai
left a comment
There was a problem hiding this comment.
Commit checks
ff362b2b"generic: rtl8365mb: bring the SerDes up once the conduit is up" — the message says the change is done "only when the conduit is an IPQ5018 GMAC ... other boards keep the current order", but the DISABLE park plus 20 ms settle added to the family C branch ofpcs_config()runs on every family C board, IPQ5018 or not. State that the park is unconditional on family C.
Generated by Claude Code
| + | ||
| + ret = rtl8365mb_sds_config(mb, mb->sds_neg_mode, mb->sds_interface); | ||
| + if (!ret && mb->sds_link_deferred) | ||
| + rtl8365mb_sds_link_up(mb, mb->sds_speed, mb->sds_duplex); |
There was a problem hiding this comment.
rtl8365mb_sds_link_up() still does its regmap_update_bits() on RTL8365MB_SDS_MISC_REG without sds_lock, and calling it from here — netdev notifier, under rtnl — makes it concurrent with the locked read-modify-write of the pause bits in rtl8365mb_phylink_mac_link_up(),`` which runs from phylink's resolve work. Until now both were on the phylink path and serialized by it, so either update can now be lost. Wrap that update_bits in `sds_lock` as well.
Generated by Claude Code
There was a problem hiding this comment.
solved by splitting off #25101 — there is no sds_lock on plain main, so the competing writer is gone, thanks
Generated by Claude Code
| + bool sds_defer_needed; | ||
| + bool sds_deferred; | ||
| + bool sds_link_deferred; | ||
| + unsigned int sds_neg_mode; |
There was a problem hiding this comment.
nit: neg_mode is not read anywhere in the old rtl8365mb_pcs_config() body that became rtl8365mb_sds_config(), so this field only stores a value nothing consumes. Drop the field and the neg_mode parameter of rtl8365mb_sds_config().
Generated by Claude Code
There was a problem hiding this comment.
|
Tested patch 930-09-net-dsa-realtek-rtl8365mb-bring-the-SerDes-up-once-the-conduit-is-up.patch using a Mercusys MR80X v2 (RTL8367S). Noticed 1 of 8 boots failed while using HSGMII, and your patch fixed it. (16/16 booted correctly) What about isolating the patch as a separate series? It works for the whole driver rather than only family D, since it gates on the conduit being an IPQ5018 GMAC and not on the chip family. |
|
@c127dev That is the first independent reproduction of this on another board, and the first confirmation of the fix outside my own unit - thank you for running it. 1 of 8 against 16 of 16 is a much better case than anything I could make on my own. Two things. May I carry a And yes to your suggestion: I am splitting it out. It only ever sat on top of #25101 because that series touches the same lines and @namiltd asked me to stack it to avoid a race. But the change itself is family-agnostic - it gates on the conduit being an IPQ5018 GMAC, as you noticed - and the dependency has become the main cost here: that series is still in draft and has been rewritten several times, while this failure is in today's snapshots. So the patch goes to main on its own and whoever lands second rebases. |
|
Tested-by: Johan Alvarado [email protected] Board: Mercusys MR80X v2 (IPQ5018 + RTL8367S, non-VB), CPU port at 2500base-x on both gmac1 and the switch port, kernel 6.18.52. Two runs, both of this PR's current 930-09 (ff362b2):
Without the patch, at 2500base-x: 2 of 12 boots came up with the trunk dead - eth0 transmitting while s00_p06_ifInOctets stayed at 0, no FCS errors, link reporting 2.5 Gbps. (My earlier "1/8" was the first run only, a second run of 4 added one more failure) At sgmii on the same board the failure did not reproduce in 38 sampled boots. The deferred bring-up fired on every boot, 43-45 ms after the conduit: [ 6.623124] eth0: Link is Up - 2.5Gbps/Full One caveat for the split: my standalone rebase drops mb->sds_lock, since that mutex comes from 930-08 and with no family D relatch work there is no competing writer in my tree. If your standalone version keeps a lock around the SDS_MISC updates - pcs_link_up() and mac_link_up() both read-modify-write that register, then it is not quite what I ran. Post the split and I will rerun it as posted and confirm the tag against that version. |
Hardware: SoC: Qualcomm IPQ5018 (2x Cortex-A53) RAM: 256 MiB DDR3 Flash: 128 MiB SPI-NAND (ESMT) Switch: Realtek RTL8367S, 4x GbE (3x LAN + 1x WAN), SGMII CPU port WiFi: IPQ5018 2.4 GHz, QCN6122 5 GHz, both 802.11ax LEDs: system (green/amber), WAN, LAN1-3 Button: reset UART: 115200 8N1, 3.3V, on-board header Wi-Fi is left disabled: 256 MiB is too few for ath11k, same as on the ELECOM WRC-X3000GS2. Notes: - The label reads "Ver 2.20", but the vendor firmware only ever calls the board V2: the GPL tree is GPL_MR80Xv2, PRODUCT_NAME is MR80Xv2, the running system reports "MR80X V2" and the fwup support list carries product_ver 2.0.0. The trailing digits are a production sub-revision, so the port is named v2. - MAC1 runs sgmii through the UNIPHY PCS to RTL8367S port 6. The link is wired for HSGMII and 2500base-x does come up, but only when gmac1 and the CPU port carry the same phy-mode: the UNIPHY PCS belongs to the conduit (pcs-handle = <&uniphy0> in ipq5018-ess.dtsi), so setting the CPU port alone leaves the switch running HSGMII into a SerDes still clocked for SGMII. With both ends at 2500base-x the trunk still dies on some boots: over 12 reboots, 2 came up with the CPU port passing no traffic at all - eth0 transmitting while s00_p06_ifInOctets stayed at 0, no FCS errors, the link reporting 2.5 Gbps. That matches the bring-up ordering race described in openwrt#25153, where the switch end of the trunk is configured before the IPQ5018 UNIPHY resets and recalibrates its PLL. sgmii has not reproduced it, so the port ships at sgmii until that fix lands. - MAC addresses come from default-mac in the vendor tp_data UBI volume, 6 raw bytes at offset 0, mounted read-only during preinit: label default-mac LAN default-mac WAN default-mac + 1 2.4 GHz default-mac - 1 5 GHz default-mac - 2 - Sysupgrade A/B ping-pongs rootfs/rootfs_1 via tp_boot_idx. primaryboot stays 0, the stock loader and the button recovery rely on it. - factory.bin is wrapped in the Mercusys fwup container the stock web UI accepts (scripts/mercusys-fwup.py). The generic tplink-image-2022 container is rejected: the loader picks its verification algorithm from the fw-type string, which that container does not write. - The board needs the backported spi-qpic-snand ECC context fix, otherwise about half of the boots end in "Waiting for root device /dev/ubiblock0_1". Installation: In the stock web UI go to Advanced -> System -> Firmware Update -> Local Update, browse for openwrt-qualcommax-ipq50xx-mercusys_mr80x-v2-squashfs-factory.bin and press UPDATE. Tested on stock firmware MR80X(EU)_V2.20_1.1.7 Build 20250415 (Multi-language). The U-Boot web recovery does not accept this image: it verifies an RSA1024 signature and has no keyless path. Use the stock web UI. Signed-off-by: Johan Alvarado <[email protected]>
ff362b2 to
b7c29d8
Compare
|
@c127dev Thank you - that is exactly the run I needed, and 2 of 12 against 16/16 and 17/17 settles it far better than my single board could. On the caveat: the split is what you ran. It has no The standalone version is up as I have not put your tag on the commit yet - I will add it once you confirm against this version, as you offered. Your numbers are in the commit message already, attributed to you. |
|
@namiltd Heads-up on the ordering: this PR no longer sits on top of #25101. The SerDes bring-up change does not depend on the family D series - it gates on the conduit SoC, not on the chip family - and with @c127dev's confirmation on a second board and the failure shipping in current snapshots, it now stands on plain main as The two still touch the same spots in |
|
I will also follow the order chosen by the developers merging the PRs. |
| #include <linux/regmap.h> | ||
| #include <linux/if_bridge.h> | ||
| #include <linux/if_vlan.h> | ||
| +#include <linux/netdevice.h> |
There was a problem hiding this comment.
All three added includes are most likely unnecessary.
openwrt-ai
left a comment
There was a problem hiding this comment.
Commit checks
b7c29d8a"generic: rtl8365mb: bring the SerDes up once the conduit is up" — the commit message reports "5 boots ... three of them cold starts" plus the MR80X v2 runs, while the patch header it adds reports "4 boots - one after a sysupgrade and three cold starts" and no MR80X v2 at all. Make the upstream-facing header carry the same numbers.
Generated by Claude Code
| + /* Park the mux first: the receiver latches on the DISABLE -> mode edge, | ||
| + * so a bring-up run on a mux that already holds the mode - a second | ||
| + * pcs_config(), or the deferred one after a first - would otherwise be | ||
| + * a write that update_bits skips, and produce no edge at all. | ||
| + */ | ||
| + ret = regmap_update_bits_check(priv->map, RTL8365MB_SDS_MISC_REG, | ||
| + RTL8365MB_SDS_MISC_MAC8_SEL_SGMII_MASK | | ||
| + RTL8365MB_SDS_MISC_MAC8_SEL_HSGMII_MASK, | ||
| + 0, &parked); | ||
| + if (ret) | ||
| + return ret; | ||
| + | ||
| + if (parked) | ||
| + msleep(20); |
There was a problem hiding this comment.
The park sits on the common path of rtl8365mb_sds_config(), so it also runs on the four MediaTek boards that drive rtl8365mb over a 2500base-x CPU port (mt7622-buffalo-wsr-2533dhp2.dts:93, plus mt7622-elecom-wrc-2533gent.dts, mt7622-totolink-a8000ru.dts, mt7981b-mercusys-mr85x-common.dtsi), all on 6.18 too. There a second pcs_config() on an already-muxed SerDes used to skip the write entirely and now drops the mux to DISABLE for 20 ms, which is not "other boards keep the current order". Gate it on mb->sds_defer_needed.
Generated by Claude Code
There was a problem hiding this comment.
| +static bool rtl8365mb_conduit_is_up(const struct net_device *conduit) | ||
| +{ | ||
| + return netif_running(conduit) && netif_oper_up(conduit); | ||
| +} |
There was a problem hiding this comment.
This is not the predicate DSA uses for the operational flag that later drives conduit_state_change(): dsa_port_conduit_is_operational() also needs conduit_admin_up, which DSA only sets once the conduit has a non-noop qdisc (user.c:3575-3576). A conduit that is already running with carrier but not yet dev_activated reads as up here, so pcs_config() skips the deferral and silently falls back to the ordering this patch exists to avoid. Use dsa_port_conduit_is_operational(dsa_to_port(ds, extint->port)) instead, which also removes the need for the netdevice.h include.
Generated by Claude Code
There was a problem hiding this comment.
| + mutex_unlock(&mb->sds_defer_lock); | ||
| + return; | ||
| + } | ||
| + mutex_unlock(&mb->sds_defer_lock); |
There was a problem hiding this comment.
The proposed change avoids causing an unnecessary lock when one is not needed:
@@ -254,15 +262,17 @@
+{
+ struct rtl8365mb *mb = pcs_to_rtl8365mb(pcs);
+
-+ mutex_lock(&mb->sds_defer_lock);
-+ if (mb->sds_deferred) {
-+ mb->sds_speed = speed;
-+ mb->sds_duplex = duplex;
-+ mb->sds_link_deferred = true;
++ if (mb->sds_defer_needed) {
++ mutex_lock(&mb->sds_defer_lock);
++ if (mb->sds_deferred) {
++ mb->sds_speed = speed;
++ mb->sds_duplex = duplex;
++ mb->sds_link_deferred = true;
++ mutex_unlock(&mb->sds_defer_lock);
++ return;
++ }
+ mutex_unlock(&mb->sds_defer_lock);
-+ return;
+ }
-+ mutex_unlock(&mb->sds_defer_lock);
+
+ rtl8365mb_sds_link_up(mb, speed, duplex);
+}There was a problem hiding this comment.
Good point, applied: boards that never defer no longer take sds_defer_lock in pcs_link_up(). sds_defer_needed is set in setup() before phylink can call into the PCS, so reading it without the lock is safe.
| + struct dsa_port *dp; | ||
| + int ret; | ||
| + | ||
| + if (!operational) |
There was a problem hiding this comment.
Exit when sds_defer_needed is not set, as there is no point in proceeding further:
-+ if (!operational)
++ if (!operational || !mb->sds_defer_needed)There was a problem hiding this comment.
Applied as well, same reasoning: without the deferral there is nothing to look up.
a71811e to
28f2683
Compare
| + return ret; | ||
| + | ||
| + if (parked) | ||
| + msleep(20); |
There was a problem hiding this comment.
Nit: please use usleep_range(20000, 21000) instead of msleep(20) here, since msleep() can overshoot due to jiffy rounding.
|
Look at this: #19644 (review) Change to: + ret = rtl8365mb_sds_config(mb, mb->sds_interface);
+ if (!ret) {
+ if (mb->sds_link_deferred)
+ rtl8365mb_sds_link_up(mb, mb->sds_speed, mb->sds_duplex);
+ mb->sds_deferred = false;
+ mb->sds_link_deferred = false;
+ }
+ mutex_unlock(&mb->sds_defer_lock);
+
+ if (ret)
+ dev_err(priv->dev, "SerDes bring-up after %s link up failed: %pe\n",
+ conduit->name, ERR_PTR(ret));
+ else
+ dev_info(priv->dev, "SerDes brought up after %s link up\n",
+ conduit->name);
+} if (ret)
return ret;
+ ret = devm_mutex_init(priv->dev, &mb->sds_defer_lock);
+ if (ret)
+ return ret;
+
mb->priv = priv;
mb->cpu.trap_port = RTL8365MB_MAX_NUM_PORTS;
mb->cpu.insert = RTL8365MB_CPU_INSERT_TO_ALL; |
28f2683 to
ac038c0
Compare
|
@namiltd Both applied, thanks. The bot was right about the error path: on a fixed link nothing calls |
930-01..09 were a copy of namiltd's RTL8367S-VB series from 2026-09-16 plus our openwrt#25153. Both moved on since. Take the current series under its own numbers, so the next sync is a copy: - 777-01..08 from openwrt#19644 (= openwrt#25101, f12e62e): the family D CVLAN entry is two words, not three (the old 930-05 read and wrote a third word that family D does not have); the SerDes re-latch keeps checking the link every 10 s after its 15 fast attempts instead of giving up; family D has 8 ports; sds_lock also covers the SDS_MISC access in pcs_get_state() and the link force on family C; the PVID rollback restores the frame filter too. - 778 is openwrt#25153 as it is now, with family D kept out of the deferred bring-up, as agreed with namiltd. Only the dsa_switch_ops hunk is rebased onto our 762, which adds .port_enable next to it. Tested on a TP-Link Archer AX55 v1 (RTL8367S, family C): 5 of 5 cold boots, up to 10 minutes without power, each with the SerDes brought up after eth0 came up, no FCS errors on the CPU port and traffic through the trunk; 3 network restarts with the firmware nodes back each time; routed Wi-Fi to the WAN at the usual rates, offloaded. Family D is not tested here. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Hardware: SoC: Qualcomm IPQ5018 (2x Cortex-A53) RAM: 256 MiB DDR3 Flash: 128 MiB SPI-NAND (ESMT) Switch: Realtek RTL8367S, 4x GbE (3x LAN + 1x WAN), SGMII CPU port WiFi: IPQ5018 2.4 GHz, QCN6122 5 GHz, both 802.11ax LEDs: system (green/amber), WAN, LAN1-3 Button: reset UART: 115200 8N1, 3.3V, on-board header Wi-Fi is left disabled: 256 MiB is too few for ath11k, same as on the ELECOM WRC-X3000GS2. Notes: - The label reads "Ver 2.20", but the vendor firmware only ever calls the board V2: the GPL tree is GPL_MR80Xv2, PRODUCT_NAME is MR80Xv2, the running system reports "MR80X V2" and the fwup support list carries product_ver 2.0.0. The trailing digits are a production sub-revision, so the port is named v2. - MAC1 runs sgmii through the UNIPHY PCS to RTL8367S port 6. The link is wired for HSGMII and 2500base-x does come up, but only when gmac1 and the CPU port carry the same phy-mode: the UNIPHY PCS belongs to the conduit (pcs-handle = <&uniphy0> in ipq5018-ess.dtsi), so setting the CPU port alone leaves the switch running HSGMII into a SerDes still clocked for SGMII. With both ends at 2500base-x the trunk still dies on some boots: over 12 reboots, 2 came up with the CPU port passing no traffic at all - eth0 transmitting while s00_p06_ifInOctets stayed at 0, no FCS errors, the link reporting 2.5 Gbps. That matches the bring-up ordering race described in openwrt#25153, where the switch end of the trunk is configured before the IPQ5018 UNIPHY resets and recalibrates its PLL. sgmii has not reproduced it, so the port ships at sgmii until that fix lands. - MAC addresses come from default-mac in the vendor tp_data UBI volume, 6 raw bytes at offset 0, mounted read-only during preinit: label default-mac LAN default-mac WAN default-mac + 1 2.4 GHz default-mac - 1 5 GHz default-mac - 2 - Sysupgrade A/B ping-pongs rootfs/rootfs_1 via tp_boot_idx, switched only after the new slot is fully written. primaryboot stays 0, the stock loader and the button recovery rely on it. - factory.bin is wrapped in the Mercusys fwup container the stock web UI accepts (scripts/mercusys-fwup.py). The generic tplink-image-2022 container is rejected: the loader picks its verification algorithm from the fw-type string, which that container does not write. - The board needs the backported spi-qpic-snand ECC context fix, otherwise about half of the boots end in "Waiting for root device /dev/ubiblock0_1". Installation: In the stock web UI go to Advanced -> System -> Firmware Update -> Local Update, browse for openwrt-qualcommax-ipq50xx-mercusys_mr80x-v2-squashfs-factory.bin and press UPDATE. Tested on stock firmware MR80X(EU)_V2.20_1.1.7 Build 20250415 (Multi-language). The U-Boot web recovery does not accept this image: it verifies an RSA1024 signature and has no keyless path. Use the stock web UI. Signed-off-by: Johan Alvarado <[email protected]>
Hardware: SoC: Qualcomm IPQ5018 (2x Cortex-A53) RAM: 256 MiB DDR3 Flash: 128 MiB SPI-NAND (ESMT) Switch: Realtek RTL8367S, 4x GbE (3x LAN + 1x WAN), SGMII CPU port WiFi: IPQ5018 2.4 GHz, QCN6122 5 GHz, both 802.11ax LEDs: system (green/amber), WAN, LAN1-3 Button: reset UART: 115200 8N1, 3.3V, on-board header Wi-Fi is left disabled: 256 MiB is too few for ath11k, same as on the ELECOM WRC-X3000GS2. Notes: - The label reads "Ver 2.20", but the vendor firmware only ever calls the board V2: the GPL tree is GPL_MR80Xv2, PRODUCT_NAME is MR80Xv2, the running system reports "MR80X V2" and the fwup support list carries product_ver 2.0.0. The trailing digits are a production sub-revision, so the port is named v2. - MAC1 runs sgmii through the UNIPHY PCS to RTL8367S port 6. The link is wired for HSGMII and 2500base-x does come up, but only when gmac1 and the CPU port carry the same phy-mode: the UNIPHY PCS belongs to the conduit (pcs-handle = <&uniphy0> in ipq5018-ess.dtsi), so setting the CPU port alone leaves the switch running HSGMII into a SerDes still clocked for SGMII. With both ends at 2500base-x the trunk still dies on some boots: over 12 reboots, 2 came up with the CPU port passing no traffic at all - eth0 transmitting while s00_p06_ifInOctets stayed at 0, no FCS errors, the link reporting 2.5 Gbps. That matches the bring-up ordering race described in openwrt#25153, where the switch end of the trunk is configured before the IPQ5018 UNIPHY resets and recalibrates its PLL. sgmii has not reproduced it, so the port ships at sgmii until that fix lands. - MAC addresses come from default-mac in the vendor tp_data UBI volume, 6 raw bytes at offset 0, mounted read-only during preinit: label default-mac LAN default-mac WAN default-mac + 1 2.4 GHz default-mac - 1 5 GHz default-mac - 2 - Sysupgrade A/B ping-pongs rootfs/rootfs_1 via tp_boot_idx, switched only after the new slot is fully written. primaryboot stays 0, the stock loader and the button recovery rely on it. - factory.bin is wrapped in the Mercusys fwup container the stock web UI accepts (scripts/mercusys-fwup.py). The generic tplink-image-2022 container is rejected: the loader picks its verification algorithm from the fw-type string, which that container does not write. - The board needs the backported spi-qpic-snand ECC context fix, otherwise about half of the boots end in "Waiting for root device /dev/ubiblock0_1". Installation: In the stock web UI go to Advanced -> System -> Firmware Update -> Local Update, browse for openwrt-qualcommax-ipq50xx-mercusys_mr80x-v2-squashfs-factory.bin and press UPDATE. Tested on stock firmware MR80X(EU)_V2.20_1.1.7 Build 20250415 (Multi-language). The U-Boot web recovery does not accept this image: it verifies an RSA1024 signature and has no keyless path. Use the stock web UI. Signed-off-by: Johan Alvarado <[email protected]> Link: openwrt#24919 Signed-off-by: Robert Marko <[email protected]>
|
The Mercusys MR80X v2 has just been added to the list of supported devices, so this PR should be the next step. My PR #25101 (tested in #19644) regarding Family D "slots in" alongside it, so there are no conflicts. All that is required is adapting "generic: rtl8365mb: bring the SerDes up once the conduit is up" to the new code, which I have already done in #19644. |
|
@namiltd Agreed, and thank you for saying so. That order works for both of us. I checked how the two fit together at your current heads. With #25101 ( Two requests for when #25101 picks it up, since that commit will have to replace
For the family D owner you answered in kuncy7/openwrt-ax55-v1#3: he has no build setup, so I published a test image built from your branch at |
|
If the operation of patches 777-01 through 777-08 is successfully verified on hardware, please post this information in PR #25101. Please include details regarding the specific router used. This will facilitate the approval of the PR. |
|
@namiltd No trouble at all. It is on a branch on top of your current The patch body is untouched: I applied both versions on top of With the bracketed note the On hardware verification of |
Hardware: SoC: Qualcomm IPQ5018 (2x Cortex-A53) RAM: 256 MiB DDR3 Flash: 128 MiB SPI-NAND (ESMT) Switch: Realtek RTL8367S, 4x GbE (3x LAN + 1x WAN), SGMII CPU port WiFi: IPQ5018 2.4 GHz, QCN6122 5 GHz, both 802.11ax LEDs: system (green/amber), WAN, LAN1-3 Button: reset UART: 115200 8N1, 3.3V, on-board header Wi-Fi is left disabled: 256 MiB is too few for ath11k, same as on the ELECOM WRC-X3000GS2. Notes: - The label reads "Ver 2.20", but the vendor firmware only ever calls the board V2: the GPL tree is GPL_MR80Xv2, PRODUCT_NAME is MR80Xv2, the running system reports "MR80X V2" and the fwup support list carries product_ver 2.0.0. The trailing digits are a production sub-revision, so the port is named v2. - MAC1 runs sgmii through the UNIPHY PCS to RTL8367S port 6. The link is wired for HSGMII and 2500base-x does come up, but only when gmac1 and the CPU port carry the same phy-mode: the UNIPHY PCS belongs to the conduit (pcs-handle = <&uniphy0> in ipq5018-ess.dtsi), so setting the CPU port alone leaves the switch running HSGMII into a SerDes still clocked for SGMII. With both ends at 2500base-x the trunk still dies on some boots: over 12 reboots, 2 came up with the CPU port passing no traffic at all - eth0 transmitting while s00_p06_ifInOctets stayed at 0, no FCS errors, the link reporting 2.5 Gbps. That matches the bring-up ordering race described in openwrt#25153, where the switch end of the trunk is configured before the IPQ5018 UNIPHY resets and recalibrates its PLL. sgmii has not reproduced it, so the port ships at sgmii until that fix lands. - MAC addresses come from default-mac in the vendor tp_data UBI volume, 6 raw bytes at offset 0, mounted read-only during preinit: label default-mac LAN default-mac WAN default-mac + 1 2.4 GHz default-mac - 1 5 GHz default-mac - 2 - Sysupgrade A/B ping-pongs rootfs/rootfs_1 via tp_boot_idx, switched only after the new slot is fully written. primaryboot stays 0, the stock loader and the button recovery rely on it. - factory.bin is wrapped in the Mercusys fwup container the stock web UI accepts (scripts/mercusys-fwup.py). The generic tplink-image-2022 container is rejected: the loader picks its verification algorithm from the fw-type string, which that container does not write. - The board needs the backported spi-qpic-snand ECC context fix, otherwise about half of the boots end in "Waiting for root device /dev/ubiblock0_1". Installation: In the stock web UI go to Advanced -> System -> Firmware Update -> Local Update, browse for openwrt-qualcommax-ipq50xx-mercusys_mr80x-v2-squashfs-factory.bin and press UPDATE. Tested on stock firmware MR80X(EU)_V2.20_1.1.7 Build 20250415 (Multi-language). The U-Boot web recovery does not accept this image: it verifies an RSA1024 signature and has no keyless path. Use the stock web UI. Signed-off-by: Johan Alvarado <[email protected]> Link: openwrt#24919 Signed-off-by: Robert Marko <[email protected]>
The TP-Link Archer AX55 v1 carries an RTL8367S-VB, a family D chip the upstream rtl8365mb driver does not know: it detects the chip, sets speed and RGMII mode, reads and writes the VLAN 4K table and the PVID the family D way, and brings up the SDS13 SerDes as a PCS with the re-latch the chip needs. 930-01..08 are Mieczyslaw Nalewaj's series from openwrt/openwrt PR openwrt#25101. 930-09 repeats the switch-side SerDes bring-up once the conduit link is up: the switch end of the 2.5G trunk is configured about two seconds before the IPQ5018 UNIPHY resets and recalibrates its own end, and the trunk intermittently came up broken (bad FCS on every frame at the CPU port, or no octets counted). Sent as openwrt/openwrt PR openwrt#25153; 17 boots without a broken trunk on an AX55. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
930-01..09 were a copy of namiltd's RTL8367S-VB series from 2026-09-16 plus our openwrt#25153. Both moved on since. Take the current series under its own numbers, so the next sync is a copy: - 777-01..08 from openwrt#19644 (= openwrt#25101, f12e62e): the family D CVLAN entry is two words, not three (the old 930-05 read and wrote a third word that family D does not have); the SerDes re-latch keeps checking the link every 10 s after its 15 fast attempts instead of giving up; family D has 8 ports; sds_lock also covers the SDS_MISC access in pcs_get_state() and the link force on family C; the PVID rollback restores the frame filter too. - 778 is openwrt#25153 as it is now, with family D kept out of the deferred bring-up, as agreed with namiltd. Only the dsa_switch_ops hunk is rebased onto our 762, which adds .port_enable next to it. Tested on a TP-Link Archer AX55 v1 (RTL8367S, family C): 5 of 5 cold boots, up to 10 minutes without power, each with the SerDes brought up after eth0 came up, no FCS errors on the CPU port and traffic through the trunk; 3 network restarts with the firmware nodes back each time; routed Wi-Fi to the WAN at the usual rates, offloaded. Family D is not tested here. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Hardware: SoC: Qualcomm IPQ5018 (2x Cortex-A53) RAM: 256 MiB DDR3 Flash: 128 MiB SPI-NAND (ESMT) Switch: Realtek RTL8367S, 4x GbE (3x LAN + 1x WAN), SGMII CPU port WiFi: IPQ5018 2.4 GHz, QCN6122 5 GHz, both 802.11ax LEDs: system (green/amber), WAN, LAN1-3 Button: reset UART: 115200 8N1, 3.3V, on-board header Wi-Fi is left disabled: 256 MiB is too few for ath11k, same as on the ELECOM WRC-X3000GS2. Notes: - The label reads "Ver 2.20", but the vendor firmware only ever calls the board V2: the GPL tree is GPL_MR80Xv2, PRODUCT_NAME is MR80Xv2, the running system reports "MR80X V2" and the fwup support list carries product_ver 2.0.0. The trailing digits are a production sub-revision, so the port is named v2. - MAC1 runs sgmii through the UNIPHY PCS to RTL8367S port 6. The link is wired for HSGMII and 2500base-x does come up, but only when gmac1 and the CPU port carry the same phy-mode: the UNIPHY PCS belongs to the conduit (pcs-handle = <&uniphy0> in ipq5018-ess.dtsi), so setting the CPU port alone leaves the switch running HSGMII into a SerDes still clocked for SGMII. With both ends at 2500base-x the trunk still dies on some boots: over 12 reboots, 2 came up with the CPU port passing no traffic at all - eth0 transmitting while s00_p06_ifInOctets stayed at 0, no FCS errors, the link reporting 2.5 Gbps. That matches the bring-up ordering race described in openwrt#25153, where the switch end of the trunk is configured before the IPQ5018 UNIPHY resets and recalibrates its PLL. sgmii has not reproduced it, so the port ships at sgmii until that fix lands. - MAC addresses come from default-mac in the vendor tp_data UBI volume, 6 raw bytes at offset 0, mounted read-only during preinit: label default-mac LAN default-mac WAN default-mac + 1 2.4 GHz default-mac - 1 5 GHz default-mac - 2 - Sysupgrade A/B ping-pongs rootfs/rootfs_1 via tp_boot_idx, switched only after the new slot is fully written. primaryboot stays 0, the stock loader and the button recovery rely on it. - factory.bin is wrapped in the Mercusys fwup container the stock web UI accepts (scripts/mercusys-fwup.py). The generic tplink-image-2022 container is rejected: the loader picks its verification algorithm from the fw-type string, which that container does not write. - The board needs the backported spi-qpic-snand ECC context fix, otherwise about half of the boots end in "Waiting for root device /dev/ubiblock0_1". Installation: In the stock web UI go to Advanced -> System -> Firmware Update -> Local Update, browse for openwrt-qualcommax-ipq50xx-mercusys_mr80x-v2-squashfs-factory.bin and press UPDATE. Tested on stock firmware MR80X(EU)_V2.20_1.1.7 Build 20250415 (Multi-language). The U-Boot web recovery does not accept this image: it verifies an RSA1024 signature and has no keyless path. Use the stock web UI. Signed-off-by: Johan Alvarado <[email protected]> Link: openwrt#24919 Signed-off-by: Robert Marko <[email protected]>
|
A note on how this and #25101 fit together now. Since its v6, #25101 adds |
|
Patch number 797 is already taken; I suggest renaming it to 779. |
On the TP-Link Archer AX55 v1 (IPQ5018 + RTL8367S, CPU port on a 2500base-x fixed link) the trunk sometimes comes up broken after a cold start: every frame the CPU sends reaches the switch CPU port with a bad FCS, or the port counts no octets while the conduit keeps transmitting. A reboot may or may not clear it. The same failure reproduces on the Mercusys MR80X v2 (same SoC and switch): 2 of 12 boots at 2500base-x came up with the CPU port counting nothing while eth0 transmitted. The two ends of the trunk are configured in the wrong order: phylink configures the switch end when the switch is set up, seconds before the conduit MAC configures its own end, and on the IPQ5018 that step resets and recalibrates the UNIPHY PLL. The vendor bootloader brings the SoC end up first and the switch end afterwards. Add a pending patch that does the same: when the conduit behind the SerDes CPU port is not up at pcs_config() time, hold the bring-up back and run it from conduit_state_change() once DSA reports the conduit operational. It is armed only when the conduit is an IPQ5018 GMAC, the only SoC this was seen on, so other boards keep the current order. The bring-up is held back once per boot. The UNIPHY resets and recalibrates its PLL only when its interface mode changes, which on a fixed link happens once, so a later conduit down/up does not repeat it. Tested on TP-Link Archer AX55 v1: 5 boots without a single broken trunk, three of them cold starts, the last two after ten hours and overnight without power; an earlier version of the same logic ran 17 boots, 8 of them cold, with none broken, against 2 of 9 broken without the change. On the Mercusys MR80X v2 (Johan Alvarado) this version gave 16 of 16 clean boots, against 2 of 12 broken without it; two earlier revisions, one stacked on another pending rtl8365mb series and one on its own, gave 16 of 16 and 17 of 17. Tested-by: Johan Alvarado <[email protected]> Signed-off-by: Stanislaw Pal <[email protected]>
ac038c0 to
bb6ca03
Compare
|
@namiltd Thanks. Renamed to |
Problem
The merged TP-Link Archer AX55 v1 support (8ac63a1) lists a known issue: the wired network is sometimes
dead after boot. Two forms were measured on the switch CPU port (
ethtool -S eth0 | grep s00_p06_):dot3StatsFCSErrorsclimbs), orA reboot may or may not clear it: two soft reboots in a row have left the trunk dead, needing a power cycle,
while on another occasion the second soft reboot was enough. The failure is in current snapshots.
It is not specific to one unit: @c127dev reproduced it on a Mercusys MR80X v2 (same IPQ5018 + RTL8367S,
2500base-x trunk) in 2 of 12 boots, and not at all in 38 boots at sgmii.
Cause
The switch end of the trunk is configured when phylink brings up the DSA CPU port, seconds before the
conduit MAC configures its own end and the IPQ5018 UNIPHY resets and recalibrates the PLL. The vendor
bootloader sets up the UNIPHY first and only then resets and configures the switch.
Change
One pending patch for 6.18,
797, on plain main. When the conduit behind the SerDes CPU port is not up atpcs_config()time, the switch-side bring-up is recorded and run fromconduit_state_change()once DSAreports the conduit operational, which is after its MAC and PCS are configured;
pcs_link_up()parametersare held back the same way. The SerDes mux is parked at DISABLE before the mode is written, so a bring-up
on a mux already in the mode still produces the edge the receiver latches on. This is done only when the
conduit is an IPQ5018 GMAC (
qcom,ipq5018-gmac), the only SoC this was seen on; the MediaTek boards thatalso run rtl8365mb over a 2500base-x CPU port keep their current order. No timer, no polling.
Testing
Bad boot = CPU port counts FCS errors or no octets while the conduit transmits.
70b248530b; later pushes only add non-functional cleanups)On both boards the deferred bring-up runs 43-46 ms after the conduit link comes up, on every boot.
Upstream status
This is not sent to netdev yet. The deferral is enabled only for a
qcom,ipq5018-gmacconduit, and that gluedriver (
dwmac-ipq5018.c) and the UNIPHY PCS driver it uses are themselves OpenWrt-only(
target/linux/qualcommax/files/). Upstream the condition would never be true and the failure cannot bereproduced there. The patch will be submitted together with, or right after, those drivers.
History
This PR first sat on top of #25101 as
930-09, at @namiltd's request, to avoid a textual conflict in the samefile. The change itself does not depend on the family D series - it gates on the conduit SoC, not on the
chip family - and that series is still being reworked while this failure ships in snapshots, so the patch
now stands on plain main. Whichever lands second needs a small rebase; I am happy to do it on this side.
An earlier version repeated the bring-up from a delayed work a second after the conduit reported carrier;
this one moves it to the point where DSA reports the conduit operational instead.
🤖 Generated with Claude Code