Similar to "wifi-scripts: iface should be optional in wifi-vlan definition"
(98435a3), wifi-station iface should also be optional. By default, it is
supposed to match all interfaces if omitted.
Fixes: https://github.com/openwrt/openwrt/issues/20705
Signed-off-by: Rany Hany <rany_hany@riseup.net>
Link: https://github.com/openwrt/openwrt/pull/20694
Signed-off-by: Robert Marko <robimarko@gmail.com>
This device has one USB2.0 port, plus ethernet, 2x wifi, ethernet, xPON
and VoIP.
Installation instructions: (Assuming root shell via SSH or serial)
1. Place OpenWrt TRX file on a USB stick formatted VFAT
2. Plug in the stick to the modem
3. Type: mtd write -f -e tclinux /mnt/usb2_sda1/<name of file>.trx tclinux
At this point, both OpenWrt and the vendor OS will be installed
because the device has space for two operating systems. Switch the OS
to boot to OpenWrt:
1. mtd readflash tmpdata 999999999 0 reservearea
2. echo -n '0' | dd of=./tmpdata bs=1 count=1 seek=397311 conv=notrunc
3. mtd write -f -e reservearea ./tmpdata reservearea
4. reboot
WARNING: While you can install with SSH alone, you need serial to use
OpenWrt on EcoNet devices because the Ethernet driver has not yet been
developed.
Signed-off-by: Caleb James DeLisle <cjd@cjdns.fr>
Link: https://github.com/openwrt/openwrt/pull/20580
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Dump and verify commands can be used on read-only devices.
Signed-off-by: Paweł Owoc <frut3k7@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/20725
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
The parameters must be aligned based on the last opened parenthesis
(+1). If this not a multiple of the tab size (8) then the rest
alignment must be done using spaces.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
It is written "multi" and not "mutli"
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
It is written "initialization" and not "intialization"
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
The Linux kernel coding style recommends not to add a space after
casts.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
It is recommended in the Linux kernel coding style not to add multiple
newlines after another.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Instead of manually writing shift operations, it is preferred to
use BIT(b) or GENMASK(e, s).
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
uint(8|16|32|64)_t and int(8|16|32|64)_t types should not be used in
kernel code. The shorter s(8|16|32|64) and u(8|16|32|64) or the
endianness specific versions (le*, be*) must be used instead.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Static variables (and global variables) are initialized to 0 by
default. It is not needed and discouraged to reinitialize them
to 0.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
It is preferred in the Linux kernel to use the short type name
"unsigned long" instead of "unsigned long int". The same is true
for short and the signed version of the types.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
It is not allowed in the Linux kernel to have the condition and
the actual statement(s) on the same line. This is required to
make it easier to identify the body of an if/do/while/for/..
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
The repeated words don't make any sense in these comments/sentences and can
just be dropped.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
In contrast to array initializations, function scopes must start
on a newline and not at the a line which defines the function
parameters.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Global array initialization must have the open brace on the first
line and the next lines must be intended by one level. The closing
brace must be one a separate line.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
The Linux coding style requires to have a newline between the vaariables
definition block and the beginning of a scope and the code.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
In the Linux kernel, it is preferred not to use compiler specific
attributes but instead utilize the kernel specific helpers.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
It can happen that the calculation `start + (HZ / 1000) * timeout`
overflows `unsigned long`. This must be handled correctly to avoid too long
waits. Luckily, the `time_before()` helper already does this.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
It is preferred in the kernel to have less nesting of scopes. More common
is to perform pre-condition checks (like error handlers) and then react to
them.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
strcpy doesn't check the length of the destination buffer. And strlcpy
would not make sure to null-terminate the destination buffer.
Even when it is clear that this string will fit in the currrent buffer, it
is just best practice to avoid strcpy.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
The case statements should be at the same indentation level as the switch.
Having different levels makes it harder to spot where the next case starts.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
In the Linux kernel, it is preferred not to use compiler specific
attributes but instead utilize the kernel specific helpers.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
There is nothing to return from a void function. And it doesn't change the
execution flow. The return at the end of a void function is therefore just
a NOP.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
The white space is not visibible when it is printed. It might have been
added by accident to the format string.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
It is preferred to have the whole quoted string on a single line to make it
easier to find these lines in the source code (while grep'ing). And since
these quotes are inside a string, they will also add unwanted whitespaces.
At the same time, add the missing newine at the end of the `pr_debug`
lines.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
There is no external component using these functions and these functions
are local to the current translation unit. These functions can therefore be
declared static.
The currently unused *_field functions were kept because they might be used
in the future.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
The common declarations should not be spread around in different source
files but kept inside the header files. This is unfortunately currently not
the best place to store them because soc_info is actually from non-DSA
code. But it is at least better than having them in diffent source files.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
In net code, it is preferred to have block comments which
* either are one line: `/* ... */`
* multiple lines with:
- starting with the first comment line directly: `/* ...`
- each line is intended with the first asterisk: ` * ...`
- the last line is just the end of the comment: ` */`
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
The Linux kernel coding style prefers not to use braces around blocks which
are only one statement long.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
THe correct order (which the rest of the code is using) is "static inline".
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
The kernel already complains loud enough to inform about an out-of-memory
situation. It is recommended not to add extra logging for *alloc errors.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Headers must use block-style comments to avoid problems with non-C
programming languages which try to use this header file.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
In contrast to variables, functions don't need extern declarations. It is
also preferred in the kernel not to use extern in front of function
declarations.
The extern+static parts in clk-rtl83xx.c were skipped because they are a
little bit unexpected ("extern *_dram_set_rate" are never used, "static
_sram_set_rate" are used but should from the C code perspective always be
NULL). This is left for an interested reader with the correct test HW and
some interests to dig in the code from commit 4850bd887c ("realtek: add
RTL83XX clock driver") for the *_dram_set_rate -> *_sram_set_rate
relocation and how these SRAM function pointers are set in this translation
unit.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
The macros will be inserted as is by the pre-compiler into places which
uses them. This can cause weird effects because this can break the syntax
or the ordering of operations. Just adding parentheses can avoid a lot of
these unexpected effects.
(for even more complex, multi-expression macros, `do {...} while (0)` is
required).
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
It is preferred in the Linux kernel to include the "normal" linux/*
include files instead of the asm includes files when available.
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20906
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
The commit 1cfd45ae0b ("realtek: Add debugfs support for RTL9300") caused
previously an out of bounds access on the array holding the names of drop
counters (and incorrect names in the output) fur RTL839x because of a
missing comma. To avoid such situation in the future, calculate the size of
the array during compilation. And to ensure that this count matches the
actual number of counters in HW, compare this number during compile time
with the expected value.
Suggested-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20905
Signed-off-by: Robert Marko <robimarko@gmail.com>
The counter names "CFM" and "VLAN_IGR_FLTR" were not separated by a comma
in the `rtl839x_drop_cntr` array. As result, these two headers were merged
to a single header "CFMVLAN_IGR_FLTR" and everything after that was shifted
by one. The last name (for the 45th counter) was also not defined and was
therefore accessing data outside the array.
Fixes: 1cfd45ae0b ("realtek: Add debugfs support for RTL9300")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Link: https://github.com/openwrt/openwrt/pull/20905
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit increases the SPI bus frequency from 20 to 52 MHz. Reduces boot
time by 2s. Below is a performance comparison.
Before:
root@OpenWrt:~# dd if=/dev/mtd1 of=/dev/null bs=10M count=1 status=progress
10485760 bytes (10 MB, 10 MiB) copied, 1.68404 s, 6.2 MB/s
After:
root@OpenWrt:~# dd if=/dev/mtd1 of=/dev/null bs=10M count=1 status=progress
10485760 bytes (10 MB, 10 MiB) copied, 0.819222 s, 12.8 MB/s
Taken from PR #18752 as each device should be tested individually, so I have
created a separate PR for this.
Signed-off-by: Sky Huang <SkyLake.Huang@mediatek.com>
Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
Link: https://github.com/openwrt/openwrt/pull/20853
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
The initramfs.trx image can be flashed from the web interface of factory
firmware.
Unfortunately, the default boot command of the bootloader does not load
the ramdisk in the FIT image. This means that the image can only be
built when the option TARGET_ROOTFS_INITRAMFS_SEPARATE is disabled.
Tested with firmware 3.0.0.4.388_33965 (U-Boot 2022.10 / 2.0.0.5).
Signed-off-by: Jan Hoffmann <jan@3e8.eu>
Link: https://github.com/openwrt/openwrt/pull/20841
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>