This is patch is identical in form and purpose as the IB-4220-B
patch. We switch over to a single "firmware" partition.
All reference design-based machines are now converted and we can
drop the legacy set-up code.
It turns out that the reference design also uses the flash layout
with a 3072KB kernel so augment the sysupgrade to do the right
thing also here.
Link: https://github.com/openwrt/openwrt/pull/21820
Signed-off-by: Linus Walleij <linusw@kernel.org>
To optimize the flash usage and to make firmware upgrades
simpler, catenate the three firmware partitions "Kern",
"Ramdisk" and "Application" into one, and use all of this
for the combined MTD-splitted kernel+rootfs.
This works fine as long as the kernel is placed in the
beginning of this firmware partition and we leave the
RedBoot partition as is, so the boot loader still can load
the kernel from the first two RedBoot partitions.
Using the RedBoot partitions "as is" can be considered
harmful, because when you flash to a RedBoot partition the
file size is used for downsizing of the partition and make
firmware upgrades fail if they are larger than the RedBoot
partition size after flashing, despite there is actually
flash there. So overriding with fixed partitions is just
generally a good idea.
Link: https://github.com/openwrt/openwrt/pull/21820
Signed-off-by: Linus Walleij <linusw@kernel.org>
The problem is the following: we have three fixed partitions
in a RedBoot partition for kernel, initrd and rootfs. On the
surface this looks good.
But we have little flash and want to use it efficiently. We want
to use the OpenWrt "firmware" partition scheme where the kernel,
initramfs and sqashfs+jffs2 rootfs is appended, leaving maximum
space for a writeable rootfs.
To do this we will override the existing RedBoot partition table
with one that merges the three separate partitions into one
"firmware" partition.
RedBoot is still booting the system. It still needs to read the
first two parts "as if" these were the kernel and initrd. This
works fine, because the kernel still comes first.
We already have hacks in place to merge the two kernel and initrd
into one binary image and execute it. This is done by prepending
a "prolog" to the kernel that does the necessary copying in
memory and then jumps to execute the kernel.
Since this "prolog" copying routine is just 92 bytes but has 512
bytes allocated, we can trivially create a firmware format that
can be used for splitting the image into kernel and rootfs
using a tagging scheme that can be done directly by scripting
so we don't need any special binary programs.
This splitter implements that idea.
This will be used on the Gemini platform and was tested on the
Raidsonic IB-4220-B.
Link: https://github.com/openwrt/openwrt/pull/21820
Signed-off-by: Linus Walleij <linusw@kernel.org>
This commit fixes non-working USB port:
---
[ 5.294036] xhci-mtk 11200000.usb: error -EPERM: Failed to get supply 'vbus'
[ 5.301163] xhci-mtk 11200000.usb: error -EPERM: Failed to get regulators
[ 5.307938] xhci-mtk 11200000.usb: probe with driver xhci-mtk failed with error -1
---
While testing the USB power on/off functionality during the previous
commit, I didn't sufficiently test the actual operation of the USB
devices.
Fixes: ff5e66a920 ("mediatek: add support for Routerich BE7200")
Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21795
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
For packets trapped to the CPU for a special reason (not normal
forward), the RTL931x tag decoding always print a log message with level
INFO. This is not needed and just spams the log, e.g. when LLDP packets
are running through the network, each of them causes a log message.
Make that a debug message instead of an info message. We can keep it,
just change when it's printed.
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21844
Signed-off-by: Robert Marko <robimarko@gmail.com>
Add a status method to both hostapd and wpa_supplicant ubus objects
that lists all configured interfaces with their wiphy, MAC address,
and running/pending state. For MLO interfaces, links are grouped
under a single entry with per-link status.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
Commit 168d5af added the possibility to configure netifd logging level.
The option is read from /etc/config/network and validated.
Supposedly the validation sets 2 as default.
But in case of a syntax error in /etc/config/network, the validation
result can be empty. Then the always passed option to netifd is
just '-l' instead of '-l 2'. That crashes netifd and prevents network
from launching.
Add a fallback value to the variable, so that there will always be
a proper value after the '-l' option.
Improves: 168d5af "netifd: add loglevel config option (fixes#18001)"
Fixes: #21816
Signed-off-by: Hannu Nyman <hannu.nyman@iki.fi>
Link: https://github.com/openwrt/openwrt/pull/21819
Signed-off-by: Robert Marko <robimarko@gmail.com>
The D-Link DIR-1360 A1 is an AC1300 router based on the MT7621AT SoC.
Specifications :-
* SoC: MediaTek MT7621AT
* RAM: 256 MB DDR3
* Flash: 128 MB SPI NAND (Winbond W29N01HV)
* WiFi: MT7615D (2.4 GHz + 5 GHz DBDC)
* Ethernet: 5x 10/100/1000 Mbps (1x WAN, 4x LAN)
* USB: 1x USB 3.0
* Buttons: Reset, WPS
* LEDs: Power (White/Orange), Internet (White/Orange), USB, 2.4G/5G WLAN
MAC addresses are retrieved from the 'factory' partition via NVMEM.
LAN: 0xe000 (gmac0)
WAN: 0xe006 (gmac1)
WLAN: 0xe00c (pcie0)
Flash Instruction :-
1-Set a static IP on your PC (e.g., 192.168.0.10, Gateway 192.168.0.1).
2- Power off the router and connect your PC to a LAN port.
3- Hold the Reset button and power on the router; continue holding for 5 seconds.
4- Access the Recovery UI at http://192.168.0.1 in your browser.
5- Upload the OpenWrt factory.bin image and wait for the reboot.
With these definitions in place, the DIR-1360 A1 boots reliably, exposes all hardware features correctly, and can be flashed via both the OEM recovery interface and standard OpenWrt upgrade paths.
Signed-off-by: Aryaman Srivastava <aryamansrivastava895@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21616
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Bc-bocun Chen of MediaTek has discovered a memory leak in the error path
in our downstream patch for mtk_eth_soc which adds support for the 10G
PCS and PHY paths of the MT7988 SoC.
Fix this by freeing the at this point already allocated netdev resources
before returning the error.
Fixes: 4cb6bd9a6d ("mediatek: switch to pending XFI 10G Ethernet drivers")
Reported-by: Bc-bocun Chen <bc-bocun.chen@mediatek.com>
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
So far the function prefix rtl83xx_ is used for functions which are
exclusive to RTL8390_FAMILY_ID but also for ones shared between
RTL8390_FAMILY_ID/RTL9300_FAMILY_ID/RTL9310_FAMILY_ID.
For a more fitting, precise use of rtl83xx_ rename the ones in dsa.c
which are also used by RTL9300_FAMILY_ID and RTL9310_FAMILY_ID
to rtldsa_.
Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
Link: https://github.com/openwrt/openwrt/pull/21786
Signed-off-by: Robert Marko <robimarko@gmail.com>
For the IPv4 unknown multicast flood portmask the first byte should be
for the higher port numbers and the following byte for the lower port
numbers, just like for the L2 unknown multicast flood portmask or the
IPv6 unknown multicast flood portmasks, too. Not the other way around.
Fix the debug output here by adjusting the offsets accordingly.
Fixes: 27029277f9 ("realtek: add switch driver support for the RTL93XX based switches")
Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
Link: https://github.com/openwrt/openwrt/pull/21786
Signed-off-by: Robert Marko <robimarko@gmail.com>
Avoid to reconfigure a SerDes when it has been configured for a mode
before. This usually applies to switches which drive multiple ports on a
single SerDes. For those, the phylink subsystem triggers PCS
configuration everytime although it's a single SerDes. For example, on
switches with XSGMII-connected RTL8218D the particular SerDes is
configured eight times but only a single run is needed.
Add a proper check to pcs_config which checks the mode stored in the
SerDes instance against the requested mode. Other 'settings' should be
executed though, e.g. setting autoneg. While at it, drop the check if
there is a 'setup_serdes' implementation. It's just a driver-internal
interface and all variants implement this now.
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21763
Signed-off-by: Robert Marko <robimarko@gmail.com>
All variant-specific setup_serdes functions currently make equal use of
the mapping from the interface mode to the hardware mode. To reduce
redundancy, move this mapping to the generic pcs_config, from where the
setup_serdes implementations are called.
This includes slightly changing the setup_serdes signature and some
debug messages.
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21763
Signed-off-by: Robert Marko <robimarko@gmail.com>
The linux kernel printk has a MAC address specifier `%pM` that can be
used to pretty-print MAC addresses. We should use this specifier when
printing MAC addresses for humans since that ensure the appearance that
people are used to.
Fixes#21796
Signed-off-by: Bevan Weiss <bevan.weiss@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21812
Signed-off-by: Robert Marko <robimarko@gmail.com>
Provide a new transmit function. It is cleaner and closer to
upstream than what we have now. The basic features are:
- Avoid memory moving and keep data in the SKBs
- Only protect really critcal parts by a lock as transmit
queues will be only called once by the kernel
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21778
Signed-off-by: Robert Marko <robimarko@gmail.com>
The operating system has enough features to control the transmit
queues. There is no need to provide a hard coded distribution
function. Especially differentiating between a round robin for
RTL83xx and high/low priority for RTL93xx makes no sense. All
devices have the same low/high priority queues.
Simply present two "generic" queues to the kernel.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21778
Signed-off-by: Robert Marko <robimarko@gmail.com>
The ethernet driver will get a new transmit function. As a first
step add the required structures and initialize them.
To get an idea: In the future the transmit buffer will hold only
the needed packet header information. The real data is kept in the
SKBs. So only pointers will be changed and memory moving can be
avoided. The SoC will transfer packet data directly from the SKBs.
Additionally a new transmit lock will be established that is
separated from the current driver lock. This is only needed
to guard the "kick-the-engine" command. So contention of the old
global lock can be reduced.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21778
Signed-off-by: Robert Marko <robimarko@gmail.com>
Ethernet transmit handling processes data synchronously via a
packet buffer. As soon as it kicks the SoC to send the packet
no more post processing is needed. Especially there is no need
for transmit completion interrupts. Disable them to reduce the
CPU load.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21778
Signed-off-by: Robert Marko <robimarko@gmail.com>
Removing tmp/ after having built base-files or toolchain currently
breaks rootfs generation:
$ rm -rf tmp
$ make V=w
...
make[2] package/install
cat: .../openwrt/tmp/base-files.version: No such file or directory
cat: .../openwrt/openwrt/tmp/libc.version: No such file or directory
ERROR: 'base-files=' is not a valid world dependency, format is name(@tag)([<>~=]version)
make[2]: *** [package/Makefile💯 package/install] Error 99
The only way to recover from here is to clean toolchain and base-files via
$ make package/{base-files,toolchain}/clean
tmp is supposed to be ephemeral, so clearing it is an expected action,
which normally just triggers a regeneration of all files there.
Fix this by moving the version files to $(STAGING_DIR).
Fixes: 63e178f067 ("build: lock versions for special APK packages")
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21803
Signed-off-by: Robert Marko <robimarko@gmail.com>
The ucode wifi-scripts unconditionally set ieee80211w=1 for psk-sae
and eap-eap2 auth types, ignoring any user-configured value. This
caused ieee80211w=2 (MFP required) to be silently downgraded to 1
(MFP optional) when using sae-mixed encryption.
Change the logic to only set the default of 1 when ieee80211w is not
already configured by the user.
Fixes: https://github.com/openwrt/openwrt/issues/21751
Signed-off-by: Felix Fietkau <nbd@nbd.name>
b3ee1209a3d0 uclient-http: reset fd to -1 after close in disconnect
9c2ad269c42b uclient-http: fix seq field check to use correct field
80c9bd29c233 uclient-http: fix hang on HTTP to HTTPS redirect
931bbfeb2c92 ucode: fix memory leak when using ssl context
Fixes: https://github.com/openwrt/uclient/issues/11
Fixes: https://github.com/openwrt/uclient/issues/13
Signed-off-by: Felix Fietkau <nbd@nbd.name>
The u-boot-env partition on the Zyxel P-2812HNU-F1 is 128 KiB but
the actual environment data is only 8 KiB (0x2000 bytes). Without
the env-size property, the u-boot,env nvmem layout driver assumes
env-size equals the full partition size and computes an incorrect
CRC32 over the entire 128 KiB, causing all nvmem cell reads to fail
silently.
Add env-size = <0x2000> so the CRC32 is computed over the correct
8 KiB region, allowing nvmem-cells (such as ethaddr) to be read
properly by the kernel.
Signed-off-by: Burak Aydos <byhexadecimal@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/21780
Signed-off-by: Robert Marko <robimarko@gmail.com>
As a first step convert the central run command over to regmap.
Additional info: The command masks where changed because
sw_xxx() dont care about the to be set or to be cleared bits
(aka mask). In regmap the mask must always be a superset of the
to be set bits.
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/21741
Signed-off-by: Robert Marko <robimarko@gmail.com>