Only use link-partner advertisement bits for 10GbE modes if they are
actually valid. Check LOCALOK and REMOTEOK bits and clear 10GbE modes
unless both of them are set.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Replace downstream hack for RealTek PHYs with a more clean solution
which could make it upstream.
As SGMII in-band AN is broken on some platforms, or simply expected to
be disabled by default in phy/sgmii mode (ie. on-board PHYs with MDIO
for out-of-band configuration and status), a hack for the RealTek PHY
driver was introduced to unconditionally disable SGMII in-band
autonegotiation.
Meanwhile the kernel has gained a proper interface for PHY and PCS to
report in-band AN capabilities and enable/disable in-band, matching
PHY and PCS capabilities.
Thanks to Bevan Weiss' knowledge about how RealTek PHY SerDes registers
are being handled in RealTek's SDK this can now be greatly improved:
- report in-band capabilties
- let phylink set in-band matching PCS and PHY capabilities
- properly abstracted indirect access of SerDes registers
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
RealTek's 2.5G PHYs suffer from an up to now inexplicable problem which
results in the SerDes mode not being properly setup and disabling
in-band AN leading to a timeout waiting for a busy-bit to clear. Up to
now there has been a crude work-around: resetting the PHY and trying
another time.
The cause has now been found as a wrong access to register PHYCR1 on
MDIO_MMD_VEND1 instead of MDIO_MMD_VEND2 when setting up ALDPS as well
as disabling the MDIO broadcast address 0.
In order to access MDIO_MMD_VEND2 on Clause-22-only busses a custom
.read_mmd and .write_mmd ops are implemented, mapping MDIO_MMD_VEND2 to
paged access as this is required.
Also, as ALDPS by design disables the SerDes PCS of the PHY in case the
link has been down for a while, move enabling ALDPS to the end of the
config_init function to not face problems when configuring the interface
mode and in-band AN.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This helps for setups where the wifi interfaces are added dynamically
via procd data by avoiding automatically bringing up interfaces with
the default config. Internally, they are treated pretty much the same
by netifd.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Bump to the latest version used by other OpenWrt platforms so
we don't bitrot.
Tested on the D-Link DIR-890L.
Link: https://github.com/openwrt/openwrt/pull/21377
Signed-off-by: Linus Walleij <linusw@kernel.org>
libubus only completes pending requests when the socket receives EOF.
When explicitly disconnecting, we need to call ubus_flush_requests().
Signed-off-by: Felix Fietkau <nbd@nbd.name>
channel.disconnect() already closes the fd via ubus_shutdown(),
so calling socket.close() afterwards is redundant and causes EBADF.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Add a 10-second timeout for outgoing auth requests to prevent
connections from getting stuck when the remote peer goes silent
after the hello handshake but before responding to auth.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
The network may be deleted before the disconnect callback fires.
Check for null to avoid crash when accessing net.tx_channels.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Let node unit address same as reg.
Signed-off-by: Ziyang Huang <hzyitc@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/20482
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Different boards use different port map. For example, some board may use
a GE port as WAN. So defining the led label in board-level is better.
Signed-off-by: Ziyang Huang <hzyitc@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/20482
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Different boards use different port map. Defining the port labels in
board-level is better.
Signed-off-by: Ziyang Huang <hzyitc@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/20482
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Some board only use some of them, so enable as necessary in
board-level dts.
Signed-off-by: Ziyang Huang <hzyitc@outlook.com>
Link: https://github.com/openwrt/openwrt/pull/20482
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Convert all ops structures to the new rteth prefix.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21345
Signed-off-by: Robert Marko <robimarko@gmail.com>
Simplify netdev_ops initialization by moving the data
into the configuration structure.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21345
Signed-off-by: Robert Marko <robimarko@gmail.com>
The configuration data needs to reference the netdev_ops
in the future. Reorder it in a separate commit to avoid
confusion later.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21345
Signed-off-by: Robert Marko <robimarko@gmail.com>
There is no need to set the cpu port depending on the
given family. Remove it from the private control structure
and add the fixed value to the configuration structure.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21345
Signed-off-by: Robert Marko <robimarko@gmail.com>
The name of the configuration structure suggests that it
contains a list of registers. As it contains functions too
change the name according to other realtek drivers.
- "Invent" a new driver prefix "rteth"
- Rename the structure and variables to config/cfg
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21345
Signed-off-by: Robert Marko <robimarko@gmail.com>
Bump to 2025-11-04 snapshot.
Added 100-gcc15-fix.patch which drops __DATE__/__TIME__ usage and provides
a stable fallback ("unknown"). This fixes build failures with GCC 15 and
-Werror=date-time in kernel builds.
% git log --oneline 04923c5..adb2f72
adb2f72e6fb8 get rid of spurious ubsan complaint for nat46_instance_t pairs field
d5f88686a4a8 Add a test harness which boots the kernel under kvm with a custom init which runs the tests
b983bab221f0 nat46-core: Fix FIXMEs about ICMPv6 parameter pointers
1aca482d6917 Add support for ignoring traffic class or TOS translation at the same time
Signed-off-by: John Audia <therealgraysky@proton.me>
Link: https://github.com/openwrt/openwrt/pull/21284
[Removed "Replace printk with pr_* macros" patch]
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Mesh mode interface creation fails when the freq parameter is empty or
undefined. Unlike adhoc mode which checks if freq exists before using it,
mesh mode blindly constructs the iw command with freq parameter, resulting
in invalid syntax like:
iw dev mesh0 mesh join ssid freq NOHT
This causes the mesh interface to be created without joining the mesh
network, leaving it in a DOWN state with no channel assigned.
Fix by adding freq validation check similar to adhoc mode.
Tested on two routers in parallel as mesh peers:
- Xiaomi AX3000T (MediaTek MT7981)
- OpenWrt One (MediaTek MT7981)
- OpenWrt 6.6.119, 802.11s mesh on 5GHz (Channel 36, HE80)
Signed-off-by: Valent Turkovic <valent@meshpointone.com>
Link: https://github.com/openwrt/openwrt/pull/21373
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
These patches fix bugs in a patch we backported.
These patch were cherry picked from upstream Linux because it references
a patch we backported in the fixes tag.
The patches were reordered to match the ordering in the upstream Linux kernel.
Fixes: 93173aee96 ("qualcommbe: ipq95xx: Add initial support for new target")
Link: https://github.com/openwrt/openwrt/pull/21366
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This patch fixes a bug in a patch we backported.
This patch was cherry picked from upstream Linux because it references a
patch we backported in the fixes tag.
The first two patches are providing function needed by the last patch.
Fixes: 813ecda1f3 ("generic: backport phylink patches for PCS/PHY caps OPs")
Link: https://github.com/openwrt/openwrt/pull/21366
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This patch fixes a bug in a patch we backported.
This patch was cherry picked from upstream Linux because it references a
patch we backported in the fixes tag.
Fixes: 48c9e55094 ("kernel: backport upstream Realtek PHY patches")
Link: https://github.com/openwrt/openwrt/pull/21366
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
These patches fix bugs in a patch we backported.
These patch were cherry picked from upstream Linux because it references
a patch we backported in the fixes tag.
Fixes: c990f6e156 ("linux: generic: net: dsa: mv88e6xxx LED support")
Link: https://github.com/openwrt/openwrt/pull/21366
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This patch fixes a bug in a patch we backported.
This patch was cherry picked from upstream Linux because it references a
patch we backported in the fixes tag.
Fixes: 9d3009f426 ("airoha: major backport of Airoha Ethernet driver feature support")
Link: https://github.com/openwrt/openwrt/pull/21366
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This patch fixes a bug in a patch we backported.
This patch was cherry picked from upstream Linux because it references a
patch we backported in the fixes tag.
The function phy_id_compare_vendor() is needed by the fix.
Refresh 782-05-v6.16-net-phy-Add-support-for-Aeonsemi-AS21xxx-PHYs.patch with the upstream code.
Fixes: 08a616b216 ("generic: backport support for Aeonsemi AS21xxx PHY")
Link: https://github.com/openwrt/openwrt/pull/21366
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This patch fixes a bug in a patch we backported.
This patch was cherry picked from upstream Linux because it references a
patch we backported in the fixes tag.
Fixes: 813ecda1f3 ("generic: backport phylink patches for PCS/PHY caps OPs")
Link: https://github.com/openwrt/openwrt/pull/21366
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This patch fixes a bug in some patches we backported.
This patch was cherry picked from upstream Linux because it references a
patch we backported in the fixes tag.
Link: https://github.com/openwrt/openwrt/pull/21366
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This fixes a bug introduced in a patch we backported.
This patch was cherry picked from upstream Linux because it references a
patch we backported in the fixes tag.
Fixes: 91ce7f606a ("generic: backport upstream v6.16 r8169 patches")
Link: https://github.com/openwrt/openwrt/pull/21366
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
These formally pending patches were merged into upstream Linux some time
ago. Move them to the backports folder and add the kernel version they
were added to the file name.
Link: https://github.com/openwrt/openwrt/pull/21366
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Replace pending patches which are already integrated in upstream Linux
with their upstream versions.
These patches were exported with:
git format-patch -1 -k
Link: https://github.com/openwrt/openwrt/pull/21366
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Fix the unit-address of the scuclk node.
Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
Link: https://github.com/openwrt/openwrt/pull/20985
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
No functional changes intended.
Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
Link: https://github.com/openwrt/openwrt/pull/20985
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Now that the PCS driver keeps track of how many links are registered per
SerDes, we can also decide which real hardware mode to use when USXGMII
is set. While there is still no proper setup for 10G-QXGMII or XSGMII,
the existing USXGMII 10G-SXGMII setup seems to work properly.
Soften the condition when to exit early so that single 10G port USXGMII
can be setup properly.
Fixes: c18476d0c5 ("realtek: RTL931x: disable USXGMII SerDes setup")
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21365
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Because the PCS driver keeps track of the number of registered links for
each SerDes now, we now know when there is no link on a SerDes. In this
case, determine to turn off the SerDes in the mode mapper.
Though the phylink subsystem shouldn't attempt to config something
different when no link/port references a Serdes, be on the safe side.
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21365
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
A SerDes may supply multiple ports and depending on that number,
different hardware modes need to be used. While there are corresponding
modes in the kernel in some cases (e.g. USXGMII with 4 2.5G ports aka
10G-QXGMII), this doesn't always map to Realtek hardware modes. Use the
previously added link number accounting for that.
An obvious example of this is the SerDes on XGS12xx-12 switches which
is connected to an octa-PHY. This runs Realtek proprietary XSGMII mode
(10G-pumped SGMII interface) for which there is no corresponding mode
in the kernel.
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21365
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Add a field to the rtpcs_serdes structure to keep track of how many
links (aka ports) are used on a single SerDes. This is needed to be
known to map kernel interface modes to SerDes hardware modes properly
(e.g. USXGMII --> USXGMII/10G-QXGMII/XSGMII).
While working in rtpcs_create, optimize referencing the SerDes instance
for cleaner code.
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21365
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
100Base-X mode was missing before in the enum rtpcs_sds_mode. So add it
to be able to support this mode too. Handle this mode in the
_determine_hw_mode mapper.
10G_QXGMII mode was missing in the mode mapper. Add it and map it to
USXGMII_10GQXGMII mode.
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21365
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>