aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* tools/libressl: update to version 3.4.3Josef Schlehofer2022-07-151-2/+2
| | | | | | | | | | | | | | | | Release notes: https://ftp.openbsd.org/pub/OpenBSD/LibreSSL/libressl-3.4.3-relnotes.txt ``` It includes the following security fix: * A malicious certificate can cause an infinite loop. Reported by and fix from Tavis Ormandy and David Benjamin, Google. (CVE-2022–0778) ``` Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com> (cherry picked from commit 25534d5cc20a807ff776fdb18847344167ce081d)
* openssl: bump to 1.1.1pAndre Heider2022-07-151-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Changes between 1.1.1o and 1.1.1p [21 Jun 2022] *) In addition to the c_rehash shell command injection identified in CVE-2022-1292, further bugs where the c_rehash script does not properly sanitise shell metacharacters to prevent command injection have been fixed. When the CVE-2022-1292 was fixed it was not discovered that there are other places in the script where the file names of certificates being hashed were possibly passed to a command executed through the shell. This script is distributed by some operating systems in a manner where it is automatically executed. On such operating systems, an attacker could execute arbitrary commands with the privileges of the script. Use of the c_rehash script is considered obsolete and should be replaced by the OpenSSL rehash command line tool. (CVE-2022-2068) [Daniel Fiala, Tomáš Mráz] *) When OpenSSL TLS client is connecting without any supported elliptic curves and TLS-1.3 protocol is disabled the connection will no longer fail if a ciphersuite that does not use a key exchange based on elliptic curves can be negotiated. [Tomáš Mráz] Signed-off-by: Andre Heider <a.heider@gmail.com> (cherry picked from commit eb7d2abbf06f0a3fe700df5dc6b57ee90016f1f1)
* bcm53xx: use -falign-functions=32 for kernel compilationRafał Miłecki2022-07-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Northstar SoCs have pretty small CPU caches and their performance is heavily affected by cache hits & misses. It means that all kind of random code changes can affect performance as they often reorganize (change alignment & possibly reorder) kernel symbols. It was discussed in ARM / net mailinglists: 1. ARM router NAT performance affected by random/unrelated commits [1] [2] 2. Optimizing kernel compilation / alignments for network performance [3] [4] It seems that -falign-functions can be used as a partial workaround. It doesn't solve all cases (e.g. documented watchdog one [5]) but it surely helps with many of them. A complete long term solution may be PGO (profile-guided optimization) but it isn't available at this point. [1] https://lkml.org/lkml/2019/5/21/349 [2] https://www.spinics.net/lists/linux-block/msg40624.html [3] https://lore.kernel.org/linux-arm-kernel/066fc320-dc04-11a4-476e-b0d11f3b17e6@gmail.com/T/ [4] https://www.spinics.net/lists/netdev/msg816103.html [5] http://lists.openwrt.org/pipermail/openwrt-devel/2022-July/038989.html Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit abc5b28db164dc2d807750cb2baae91e288c84a9)
* bcm53xx: enable & setup packet steeringRafał Miłecki2022-07-082-0/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Packet steering can improve NAT masquarade performance on Northstar by 40-50%. It makes reaching 940-942 Mb/s possible on BCM4708 (and obviously BCM47094 too). Add scripts setting up the most optimal Northstar setup. Below are testing results for running iperf TCP traffic from LAN to WAN. They were used to pick up golden values. ┌──────────┬──────────┬────────────────────┬────────────────────┐ │ eth0 │ br-lan │ flow_offloading=0 │ flow_offloading=1 │ │ │ ├─────────┬──────────┼─────────┬──────────┤ │ rps_cpus │ rps_cpus │ BCM4708 │ BCM47094 │ BCM4708 │ BCM47094 │ ├──────────┼──────────┼─────────┼──────────┼─────────┼──────────┤ │ 0 │ 0 │ 387 │ 671 │ 707 │ 941 │ │ 0 │ 1 │ 343 │ 576 │ 705 │ 941 │ │ 0 │ 2 │ ✓ 574 │ ✓ 941 │ 704 │ 940 │ │ 1 │ 0 │ 320 │ 549 │ 561 │ 941 │ │ 1 │ 1 │ 327 │ 551 │ 553 │ 941 │ │ 1 │ 2 │ 523 │ ✓ 940 │ 559 │ 940 │ │ 2 │ 0 │ 383 │ 652 │ ✓ 940 │ 941 │ │ 2 │ 1 │ 448 │ 754 │ ✓ 942 │ 941 │ │ 2 │ 2 │ 404 │ 655 │ ✓ 941 │ 941 │ └──────────┴──────────┴─────────┴──────────┴─────────┴──────────┘ Above tests were performed with all eth0 interrupts handled by CPU0. Setting "echo 2 > /proc/irq/38/smp_affinity" was tested on BCM4708 but it didn't increased speeds (just required different steering): ┌──────────┬──────────┬───────────┐ │ eth0 │ br-lan │ flow_offl │ │ rx-0 │ rx-0 │ oading=0 │ │ rps_cpus │ rps_cpus │ BCM4708 │ ├──────────┼──────────┼───────────┤ │ 0 │ 0 │ 384 │ │ 0 │ 1 │ ✓ 574 │ │ 0 │ 2 │ 348 │ │ 1 │ 0 │ 383 │ │ 1 │ 1 │ 412 │ │ 1 │ 2 │ 448 │ │ 2 │ 0 │ 321 │ │ 2 │ 1 │ 520 │ │ 2 │ 2 │ 327 │ └──────────┴──────────┴───────────┘ Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit fcbd39689ebfef20c62fe3882d51f3af765e8028)
* bcm53xx: disable GRO by default at kernel levelRafał Miłecki2022-07-081-0/+32
| | | | | | | | | | | This improves NAT masquarade network performance. An alternative to kernel change would be runtime setup but that requires ethtool and identifying relevant network interface and all related switch ports interfaces. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit 82d0dd8f8aa11249944fe39cd0d75a1524ec22ec)
* kernel: drop patch adding hardcoded kernel compilation flagsRafał Miłecki2022-07-081-25/+0
| | | | | | | | | | | | | | | | | | | | 1. KCFLAGS should be used for custom flags 2. Optimization flags are arch / SoC specific 3. -fno-reorder-blocks may *worsen* network performace on some SoCs 4. Usage of flags was *reversed* since 5.4 and noone reported that If we really need custom flags then CONFIG_KERNEL_CFLAGS should get default value adjusted properly (per target). Ref: 4e0c54bc5bc8 ("kernel: add support for kernel 5.4") Link: http://lists.openwrt.org/pipermail/openwrt-devel/2022-June/038853.html Link: https://patchwork.ozlabs.org/project/openwrt/patch/20190409093046.13401-1-zajec5@gmail.com/ Cc: Felix Fietkau <nbd@nbd.name> Cc: Hauke Mehrtens <hauke@hauke-m.de> Cc: Rui Salvaterra <rsalvaterra@gmail.com> Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Acked-by: Hauke Mehrtens <hauke@hauke-m.de> (cherry picked from commit 22168ae68101b95d03741b0e9e8ad20b8a5ae5b7)
* kernel: support setting extra CFLAGS for kernel compilationRafał Miłecki2022-07-082-1/+5
| | | | | | | They may be used e.g. to optimize kernel size or performance. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit 907d7d747243044f86588f0d82993e8c106cb02c)
* kernel: use KCFLAGS for passing EXTRA_OPTIMIZATION flagsRafał Miłecki2022-07-083-11/+4
| | | | | | | | | | This uses kernel's generic variable and doesn't require patching it with a custom Makefile change. It's expected *not* to change any behaviour. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> (cherry picked from commit 1d42af720c6b6dcfcdd0b89bce386fca1607dcb3) Signed-off-by: Kevin Darbyshire-Bryant <ldir@darbyshire-bryant.me.uk> (cherry picked from commit 24e27bec9a6df1511a504cf04cd9578a23e74657)
* build: fix ldconfig executable error in pythonDamien Mascord2022-07-041-2/+1
| | | | | | | | | | | | | | | | | | | | The empty executable is causing problems with meson builds, due to the error: OSError: [Errno 8] Exec format error: 'ldconfig' This patch changes the empty ldconfig stub to symlink to /bin/true to work around this issue. Fixes: FS#4117 Fixes: 3bd31cc4d2ff ("tools/meson: update to 0.60.0") Signed-off-by: Damien Mascord <tusker@tusker.org> Tested-by: Aleksander Jan Bajkowski <olek2@wp.pl> # Tested on Debian 11 Tested-By: Lucian Cristian <lucian.cristian@gmail.com> Tested-By: Baptiste Jonglez <git@bitsofnetworks.org> Cc: Rosen Penev <rosenp@gmail.com> (cherry picked from commit 6a5b4228e30244b44a49f523dea66caf3fbe3307) Signed-off-by: Baptiste Jonglez <git@bitsofnetworks.org> [backport to fix prereq check when moving from 22.03 branch to 21.02]
* kernel: Remove kmod-crypto-lib-blake2sHauke Mehrtens2022-07-044-24/+1
| | | | | | | Delete the crypto-lib-blake2s kmod package, as BLAKE2s is now built-in. Fixes: be0639063a70 ("kernel: bump 5.4 to 5.4.203") Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* kernel: backport wireguard blake2s patchHauke Mehrtens2022-07-031-0/+108
| | | | | | | | | This patch was backported to kernel 5.4.200, but without the wireguard change, because wireguard is not available in upstream kernel 5.4. This adds the missing changes for wireguard too. Fixes: be0639063a70 ("kernel: bump 5.4 to 5.4.203") Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* mvebu: move upstreamed DTS files (ESPRESSObin) to files-5.4Adrian Schmutzler2022-07-033-0/+0
| | | | | | | | | | | | | | | | | | | | | Since kernel 5.5-rc1 [1], there are upstreamed DTS files related to ESPRESSObin variants. Move these to files-5.4. This helps if you want to use a newer kernel version than used in OpenWrt 21.02 (= LTS kernel 5.4), you would end up with duplicate files (one outdated, one up to date from newer Linux versions). Fixes: Error: arch/arm64/boot/dts/marvell/armada-3720-espressobin-v7.dts:19.1-7: Label or path ports not found FATAL ERROR: Syntax error parsing input tree [1] https://github.com/torvalds/linux/commit/447b8789359f9a5e6567c4044d18abaa7de68930 Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de> (cherry picked from commit 7be8ab4f7b582924bca6594103735d888989d804) Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com> [reword commit subject and commit description]
* cryptodev-linux: update to 1.12Rosen Penev2022-07-032-35/+3
| | | | | | | | | Remove upstream backport. Use AUTORELEASE for simplicity. Signed-off-by: Rosen Penev <rosenp@gmail.com> (cherry picked from commit 585cef5f1a9c1c3aecd7d231364618e96d03ab65)
* kernel: check dst of flow offloading tableRitaro Takenaka2022-07-038-22/+119
| | | | | | | Flow offload dst can become invalid after the route cache is created. dst_check() in packet path is necessary to prevent packet drop. Signed-off-by: Ritaro Takenaka <ritarot634@gmail.com>
* openssl: bump to 1.1.1oEneas U de Queiroz2022-07-032-6/+6
| | | | | | | | | | | This release comes with a security fix related to c_rehash. OpenWrt does not ship or use it, so it was not affected by the bug. There is a fix for a possible crash in ERR_load_strings() when configured with no-err, which OpenWrt does by default. Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com> (cherry picked from commit 7a5ddc0d06895bde7538d78c8dad2c863d70f946)
* kernel: bump 5.4 to 5.4.203Hauke Mehrtens2022-07-03109-1414/+262
| | | | | | | | | | | | | | | Merged upstream: bcm27xx/patches-5.4/950-1014-Revert-mailbox-avoid-timer-start-from-callback.patch generic/backport-5.4/080-wireguard-0021-crypto-blake2s-generic-C-library-implementation-and-.patch Manually adapted: layerscape/patches-5.4/801-audio-0005-Revert-ASoC-fsl_sai-Add-support-for-SAI-new-version.patch oxnas/patches-5.4/100-oxnas-clk-plla-pllb.patch Compile-tested: lantiq/xrx200 Run-tested: lantiq/xrx200 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* exfat: update to 5.19.1Chukun Pan2022-07-011-2/+2
| | | | | | | | | | | | | | | | | | | Major changes are: 4 cleanups & typos fixes. Add keep_last_dots mount option to allow access to paths with trailing dots. Avoid repetitive volume dirty bit set/clear to improve storage life time. Fix ->i_blocks truncation issue caused by wrong 32bit mask. Fix ->i_blocks truncation issue that still exists elsewhere. Fix missing REQ_SYNC in exfat_update_bhs(). Fix referencing wrong parent directory information during rename. Fix slab-out-bounds in exat_clear_bitmap() reported from syzbot. Improve performance while zeroing a cluster with dirsync mount option. Introduce a sys_tz mount option to use system timezone. Move super block magic number to magic.h Signed-off-by: Chukun Pan <amadeus@jmu.edu.cn>
* ramips: fix booting on ZyXEL NBG-419N v2Piotr Dymacz2022-06-201-0/+1
| | | | | | | | | | | | | | This fixes a well known "LZMA ERROR 1" error, reported previously on numerous of other devices from 'ramips' target. Fixes: #9842 Fixes: #8964 Reported-by: Juergen Hench <jurgen.hench@gmail.com> Tested-by: Juergen Hench <jurgen.hench@gmail.com> Signed-off-by: Demetris Ierokipides <ierokipides.dem@gmail.com> Signed-off-by: Piotr Dymacz <pepe2k@gmail.com> (cherry picked from commit fd72e595c2b2a46bab8cbc7e9415fbfeae7b5b0d)
* ramips: fix RT-AC57U button levelDavid Bauer2022-06-181-1/+1
| | | | | | | | Both buttons on the RT-AC57U are active-low. Fix the GPIO flag for the WPS cutton to fix button behavior. Signed-off-by: David Bauer <mail@david-bauer.net> (cherry picked from commit 535b0c70b1c466733b009144f81f5207f1ecd311)
* kernel: bump 5.4 to 5.4.194Hauke Mehrtens2022-05-189-13/+13
| | | | | | | Compile-tested: lantiq/xrx200, armvirt/64 Run-tested: lantiq/xrx200, armvirt/64 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* kernel: bump 5.4 to 5.4.192Hauke Mehrtens2022-05-1811-21/+21
| | | | | | | Compile-tested: armvirt/64 Run-tested: armvirt/64 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* kernel: bump 5.4 to 5.4.191Hauke Mehrtens2022-05-1860-219/+113
| | | | | | | | | | | | | | | | Merged upstream: apm821xx/patches-5.4/150-ata-sata_dwc_460ex-Fix-crash-due-to-OOB-write.patch Similar patch merged upstream: bcm27xx/patches-5.4/950-0210-usb-xhci-Disable-the-XHCI-5-second-timeout.patch Manually adapted: layerscape/patches-5.4/801-audio-0008-Revert-ASoC-Remove-dev_err-usage-after-platform_get_.patch Compile-tested: armvirt/64 Run-tested: armvirt/64 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* firewall: config: remove restictions on DHCPv6 allow ruleTiago Gaspar2022-05-042-4/+2
| | | | | | | | | | | | | | | Remove restrictions on source and destination addresses, which aren't specified on RFC8415, and for some reason in openwrt are configured to allow both link-local and ULA addresses. As cleared out in issue #5066 there are some ISPs that use Gloabal Unicast addresses, so fix this rule to allow them. Fixes: #5066 Signed-off-by: Tiago Gaspar <tiagogaspar8@gmail.com> [rebase onto firewall3, clarify subject, bump PKG_RELEASE] Signed-off-by: Jo-Philipp Wich <jo@mein.io> (backported from commit 65258f5d6093809c541050256646795bc0a460a9)
* ramips: zbt-wg2626: Add the reset gpio for PCIe port 1Alban Bedel2022-05-011-0/+3
| | | | | | | | | | | | | | The 2.4GHz interface doesn't come up properly with the log showing: mt7621-pci 1e140000.pcie: pcie1 no card, disable it (RST & CLK) As seen on other MT7621 boards this is caused by a missing reset GPIO. The MT7621 dtsi set GPIO 19 as PCIe reset GPIO, which on this board reset the 5GHz interface on port 0. Add GPIO 8 to the PCIe reset GPIO list to also reset the 2.4GHz interface on port 1. Signed-off-by: Alban Bedel <albeu@free.fr> (cherry picked from commit f953a1a4bfba2fa70c12bb80938aa66481a673b6)
* ipq40xx: fix ar40xx driverNick Hainke2022-04-301-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | This commit is completely based on the work of adron-s: https://github.com/openwrt/openwrt/pull/4721#issuecomment-1101108651 The commit fixes the data corruption on TX packets. Packets are transmitted, but their contents are replaced with zeros. This error is caused by the lack of guard (50 ms) intervals between calibration phases. This error is treated by adding mdelay(50) to the calibration function code. In the original qca-ssda code [0], these mdelays were existing, but in the ar41xx.c they are gone. Tested on: - Fritz!Box 4040 - Fritz!Box 7530 - Mikrotik SXTsq 5AC - ZyXEL NBG6617 - [0] https://git.codelinaro.org/clo/qsdk/oss/lklm/qca-ssdk/-/blob/NHSS.QSDK.11.4/src/init/ssdk_init.c#L2072 Suggested-by: Serhii Serhieiev <adron@mstnt.com> Reviewed-by: Robert Marko <robimarko@gmail.com> Signed-off-by: Nick Hainke <vincent@systemli.org> (cherry picked from commit ab7e53e5cce703c7a62efbe1d41fb94c2228a178) [Deleted 5.10 from commit title] Signed-off-by: Nick Hainke <vincent@systemli.org>
* iwinfo: drop obsolete patchJo-Philipp Wich2022-04-271-26/+0
| | | | | Fixes: 01cc5e195d ("iwinfo: update to latest Git HEAD") Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* iwinfo: update to latest HEADDavid Bauer2022-04-271-3/+3
| | | | | | | dc6847e iwinfo: nl80211: omit A-hwmode on non-5GHz hardware Signed-off-by: David Bauer <mail@david-bauer.net> (cherry picked from commit f757a8a09885e3c8bb76371e037b8c0731111980)
* hostapd: refresh patchesDavid Bauer2022-04-271-4/+4
| | | | Signed-off-by: David Bauer <mail@david-bauer.net>
* hostapd: add ubus link-measurements notificationsDavid Bauer2022-04-273-0/+43
| | | | | | | Notify external ubus subscribers of received link-measurement reports. Signed-off-by: David Bauer <mail@david-bauer.net> (cherry picked from commit f6445cfa1acb32676723c49da3e3158b64a4b3d2)
* hostapd: add ubus method for requesting link measurementsDavid Bauer2022-04-271-0/+65
| | | | | | | | | | | Add a ubus method to request link-measurements from connected STAs. In addition to the STAs address, the used and maximum transmit power can be provided by the external process for the link-measurement. If they are not provided, 0 is used as the default value. Signed-off-by: David Bauer <mail@david-bauer.net> (cherry picked from commit 965aa33a18c76bb2d5a1eeb0cfa01501b08e784a)
* hostapd: add support for enabling link measurementsDavid Bauer2022-04-271-0/+10
| | | | | | | | Allow external processes to enable advertisement of link-measurement RRM capability. Signed-off-by: David Bauer <mail@david-bauer.net> (cherry picked from commit 2ca5c3da04c3f05a7477ae484768e03d4ca30711)
* iwinfo: update to latest HEADDavid Bauer2022-04-271-3/+3
| | | | | | | | a479b9b devices: remove whitespace 562d015 iwinfo: nl80211: fix hwmode parsing for multi-band NICs Signed-off-by: David Bauer <mail@david-bauer.net> (cherry picked from commit 46980294f66ab07b79f9037758a7ea94072340df)
* iwinfo: update to latest Git headJosef Schlehofer2022-04-271-3/+3
| | | | | | | | | | Changelog: 90bfbb9 devices: Add Cypress CYW43455 234075b devices: fix AMD RZ608 format 0e2a318 devices: add AMD RZ608 device-id Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com> (cherry picked from commit 013b0435641ab12d9a896c29c213d90da64bc623)
* iwinfo: update to latest Git HEADJo-Philipp Wich2022-04-271-4/+4
| | | | | | | a0a0e02 iwinfo: rename hardware.txt to devices.txt Signed-off-by: Jo-Philipp Wich <jo@mein.io> (backported from commit c13d7c82aa4cd2cbf1f61bad857cd01b795318e3)
* iwinfo: update to the latest versionFelix Fietkau2022-04-271-3/+3
| | | | | | | c9b1672f5a83 nl80211: fix path compatibility issue Signed-off-by: Felix Fietkau <nbd@nbd.name> (cherry picked from commit 019eca154557e2e2fefa67b4430cab622035c382)
* iwinfo: update to the latest versionFelix Fietkau2022-04-271-4/+4
| | | | | | | | | | aa0e3c4bbe12 iwinfo: nl80211: add support for printing the device path for a phy dd6d6d2dec35 iwinfo: nl80211: use new path lookup function for nl80211_phy_idx_from_uci_path 268bb26d2e2a iwinfo: nl80211: support looking up phy by path=.. and macaddr=... c0414642fead iwinfo: nl80211: fix typo Signed-off-by: Felix Fietkau <nbd@nbd.name> (backported from commit 6e8475bbd0c841043c1187fb5a42d835071ad502)
* wolfssl: fix compilation with /dev/cryptoEneas U de Queiroz2022-04-201-0/+19
| | | | | | | This is trivial fix of a duplicate definition of 'int ret'. Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com> (cherry picked from commit df622768da10f36ceeb20346b4c4ee4eb9a8a9ad)
* kernel: add missing config symbolsFelix Fietkau2022-04-201-0/+2
| | | | | | | | | MPLS feature symbols are normally only set when kmod-mpls is enabled, but the CONFIG_MPLS symbol they depend on could also have been selected by openvswitch instead Signed-off-by: Felix Fietkau <nbd@nbd.name> (cherry-picked from commit 92add80414c2f39ba8fd0d221d0f37e75fb19951)
* mac80211: fix QCA9561 PA biasThibaut VARÈNE2022-04-191-0/+47
| | | | | | | | | | | | | | | This patch fixes an invalid TX PA DC bias level on QCA9561, which results in a very low output power and very low throughput as devices are further away from the AP (compared to other 2.4GHz APs), following a suggestion from nbd[1]. This patch has been submitted upstream[2]. [1] https://lore.kernel.org/all/91c58969-c60e-2f41-00ac-737786d435ae@nbd.name [2] https://lore.kernel.org/linux-wireless/20220417145145.1847-1-hacks+kernel@slashdirt.org/ Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org> (cherry-picked from 7dc52a78ae2c2f748a0c0c4adcb13979260b3498)
* ramips: mt7620: disable SOC VLANs for external switchesMichael Pratt2022-04-191-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | These boards have AR8327 or QCA8337 external ethernet switch. The SOC also has it's own internal switch where VLAN is now enabled by default. Changes to preinit caused all switches to have VLANs enabled by default even if they are not configured with a topology in uci_defaults (see commit f017f617aecbd47debd4d3a734dc0e471342db96) When both internal and external switches have VLANs, and the external switch has both LAN and WAN, the TX traffic from the SOC cannot flow to the tagged port on the external switch because the VLAN IDs are not matching. So disable the internal switch VLANs by default on these boards. Also, add a topology for the internal switch, so that on LuCI there is not an "unknown topology" warning. In theory, it may be possible to have LAN ports on both switches through internal and external PHYs, but there are no known boards that have this. Signed-off-by: Michael Pratt <mcpratt@pm.me> (cherry picked from commit 2adeada04558848058105cdad8195848d10d1486)
* ramips: mt7620: ethernet: use more macros and bump versionMichael Pratt2022-04-194-7/+11
| | | | | | | | | | | | | | | | Define and use some missing macros, and use them instead of BIT() or numbers for more readable code. Add comment for a bit change that seems unrelated to ethernet but is actually needed (PCIe Root Complex mode). Remove unknown and unused macro RST_CTRL_MCM (probably from MT7621 / MT7622) This is the last of a series of fixes, so bump version. Signed-off-by: Michael Pratt <mcpratt@pm.me> (cherry picked from commit 88a0cebadfecb6ebb9f5f535e74f7f7574f513f3)
* ramips: mt7620: fix RGMII TXID PHY modeMichael Pratt2022-04-191-1/+1
| | | | | | | | | | | | | | | the register bits for TX delay and RX delay are opposites: when TX delay bit is set, delay is enabled when RX delay bit is set, delay is disabled So, when both bits are unset, it is RX delay and when both bits are set, it is TX delay Note: TXID is the default RGMII mode of the SOC Fixes: 5410a8e2959a ("ramips: mt7620: add rgmii delays support") Signed-off-by: Michael Pratt <mcpratt@pm.me> (cherry picked from commit 26c84b2e46caba1ae17bc82a533c99eee65e7004)
* ramips: mt7620: add ephy-disable option to switch driverMichael Pratt2022-04-192-2/+13
| | | | | | | | | | | | | | | Add back the register write to disable internal PHYs as a separate option in the code that can be set using a DTS property. Set the option to true by default when an external mt7530 switch is identified. This makes the driver more in sync with original SDK code while keeping the lines separated into different options to accommodate any board with any PHY layout. Signed-off-by: Michael Pratt <mcpratt@pm.me> (cherry picked from commit cc6fd6fbb505071e08011f7998afaffefcf08fd3)
* ramips: mt7620: move mt7620_mdio_mode() to ethernet driverMichael Pratt2022-04-195-74/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The function mt7620_mdio_mode is only called once and both the function and mdio_mode block have been named incorrectly, leading to confusion and useless commits. These lines in the mdio_mode block of mt7620_hw_init are only intended for boards with an external mt7530 switch. (see commit 194ca6127ee18cd3a95da4d03f02e43b5428c0bb) Therefore, move lines from mdio_mode to the place in soc_mt7620.c where the type of mt7530 switch is identified, and move lines from mt7620_mdio_mode to a main function. mt7620_mdio_mode was called from mt7620_gsw_init where the priv struct is available, so the lines must stay in mt7620_gsw_init function. In order to keep things as simple as possible, keep the DTS property related function calls together, by moving them from mt7620_gsw_probe to init. Remove the now useless DTS properties and extra phy nodes. Fixes: 5a6229a93df8 ("ramips: remove superfluous & confusing DT binding") Fixes: b85fe43ec8c4 ("ramips: mt7620: add force use of mdio-mode") Signed-off-by: Michael Pratt <mcpratt@pm.me> (cherry picked from commit 6972e498d33ec896c676b7af91e3bfb00aa846a1)
* ramips: mt7620: use DTS to set PHY base address for external PHYsMichael Pratt2022-04-1924-7/+60
| | | | | | | | | | | | | | | | | | | | | | | | Set the PHY base address to 12 for mt7530 and 8 for others, which is based on the default setting for some devices from printing the register with the following command after it is written to by uboot during the boot cycle. `md 0x10117014 1` PHY_BASE option only uses 5 bits of the register, bits 16 to 20, so use 8-bit integer type. Set the option using the DTS property mediatek,ephy-base and create the gsw node if missing. Also, added a kernel message to display the EPHY base address. Note: If anything is written to a PHY address that is greater than 1 hex char (greater than 0xf) then there is adverse effects with Atheros switches. Signed-off-by: Michael Pratt <mcpratt@pm.me> (cherry picked from commit 0976b6c4262a11a8d0dab9aeb64f5cdee266c44a)
* ramips: mt7620: allow both internal and external PHYsMichael Pratt2022-04-191-62/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the new variable ephy_base was introduced, it was not applied to the if block for mdio_mode. The first line in the mdio_mode if block sets the EPHY base address to 12 in the SOC by writing a register, but the corresponding variable in the driver was still set to the default of 0. This causes subsequent lines that write registers with the function _mt7620_mii_write to write to PHY addresses 0 through 4 while internal PHYs have been moved to addresses 12 through 16. All of these lines are intended only for PHYs on the SOC internal switch, however, they are being written to external ethernet switches if they exist at those PHY addresses 0 through 4. This causes some ethernet ports to be broken on boards with AR8327 or QCA8337 switch. Other suggested fixes move those lines to the else block of mdio_mode, but removing the else block completely also fixes it. Therefore, move the lines to the mt7620_hw_init function main block, and have only one instance of the function mtk_switch_w32 for writing the register with the EPHY base address. In theory, this also allows for boards that have both external switches and internal PHYs that lead to ethernet ports to be supported. Fixes: 391df3782914 ("ramips: mt7620: add EPHY base mdio address changing possibility") Signed-off-by: Michael Pratt <mcpratt@pm.me> (cherry picked from commit de5394a29dae9356a830d043e76591698411e97a)
* ramips: mt7620: fix ethernet driver GMAC port initMichael Pratt2022-04-192-15/+9
| | | | | | | | | | | | | | | | | | | | | | | | A workaround was added to the switch driver to set SOC port 4 as an RGMII GMAC interface based on the DTS property mediatek,port4-gmac. (previously mediatek,port4) However, the ethernet driver already does this, but is being blocked by a return statement whenever the phy-handle and fixed-link properties are both missing from nodes that define the port properties. Revert the workaround, so that both the switch driver and ethernet driver are not doing the same thing and move the phy-handle related lines down so nothing is ending the function prematurely. While at it, clean up kernel messages and delete useless return statements. Fixes: f6d81e2fa1f1 ("mt7620: gsw: make IntPHY and ExtPHY share mdio addr 4 possible") Signed-off-by: Michael Pratt <mcpratt@pm.me> (cherry picked from commit afd60d650e769e9578eac5bb3647807f683aaf7c)
* ramips: mt7620: remove useless GMAC nodesMichael Pratt2022-04-194-27/+4
| | | | | | | | | | | | | | | | | | | | These nodes are used for configuring a GMAC interface and for defining external PHYs to be accessed with MDIO. None of this is possible on MT7620N, only MT7620A, so remove them from all MT7620N DTS. When the mdio-bus node is missing, the driver returns -NODEV which causes the internal switch to not initialize. Replace that return so that everything works without the DTS node. Also, an extra kernel message to indicate for all error conditions that mdio-bus is disabled. Fixes: d482356322c9 ("ramips: mt7620n: add mdio node and disable port4 by default") Fixes: aa5014dd1a58 ("ramips: mt7620n: enable port 4 as EPHY by default") Signed-off-by: Michael Pratt <mcpratt@pm.me> (cherry picked from commit a2acdf9607045e5669c305c57dd7c77be8351ba0)
* ramips: mt7620: simplify DTS properties for GMACMichael Pratt2022-04-1941-125/+23
| | | | | | | | | | | | | | | | | | | | There are only 2 options in the driver for the function of mt7620 internal switch port 4: EPHY mode (RJ-45, internal PHY) GMAC mode (RGMII, external PHY) Let the DTS property be boolean instead of string where EPHY mode is the default. Fix how the properties are written for all DTS that use them, and add missing nodes where applicable, and remove useless nodes, and minor DTS formatting. Signed-off-by: Michael Pratt <mcpratt@pm.me> (cherry picked from commit 953bfe2eb3b7236a72fa41ab2204fdaa9fd09f65)
* ramips: mt7620: enable autonegotiation for all portsGaspare Bruno2022-04-191-0/+1
| | | | | | | | | | This enables autonegotiation for all ephy ports on probe. Some devices do not configure the ports, particularly port 4. Signed-off-by: Gaspare Bruno <gaspare@anlix.io> [replace magic values ; reword commit message] Signed-off-by: David Bauer <mail@david-bauer.net> (cherry picked from commit 0056ffb468f40f34bea006eb889b70c9a4f562e0)