f8c2d64f546c uloop: allow reusing the existing environment for a new process
1294001ec6cb uloop: fix array reference
dd91bd8396a5 tests: add test cases for use-after-free gc bugs
d96db3ea5ef2 json: fix use-after-free of read method across iterations
8a74d68a34ab lib: anchor working values in filter/map/callfunc across user code
2225a502e805 socket: anchor poll() result across user fileno() callbacks
6a061cf4ef34 zlib: fix use-after-free of read method across iterations
dbe92bca180b types: free uvcount=0 resources on retain=true sweep
b0574723d27d zlib: zero-fill the output reserve window
cc0698b723ed serial: add module skeleton, build wiring and fd helpers
114ffb8962e2 serial: add raw termios access and termios constants
3bdeeb0b1ef7 serial: add setspeed, setraw and setblocking helpers
2b22a1ac41b0 serial: add modem control line access (out-of-band signals)
bed2a12895ce serial: add break, drain, flush and queue inspection
697fe07b14db serial: add setserial-style serial_struct access (Linux)
504530a290ad serial: add termios round-trip test
d6544940e762 ubus: fix reply leak in deferred data callback
dfca6438bc55 fs: reimplement popen() with fork/exec and true shell-free array support
9a87ce92207a debug: rework memdump to invoke fileno() on resource values
bed321219636 types: expose exception_type_strings array
67b13e97a643 lib: allow die() to re-throw exception objects
f2d62f82a522 lib: deduplicate source files by resolved path in vm->sources cache
255f69081304 socket: add CAN socket support
6adff7054893 rtnl: add CAN link type support
b79e20e1eee5 rtnl: add vxcan link type support
5870b9995ff4 rtnl: zero reserved struct headers in nested attributes
abb80c69ed2d include: add `unused` macro
ff509e0698dc include: register resource type prototypes with VM
c404fe2d6556 types: add per-instance prototype support for extended resources
7fb34544e945 ci: install libffi on test runners
23d5561b04b2 ffi: add LibFFI-based foreign function interface module
f26fabfe3ecb ffi: Add .cast(), .copy(), .string() as ctype instance methods
19ffa8aa3218 vm: release resource type prototypes before the final GC
48e38fc6376f tests: move ffi ctype instance method tests to proper place
4d687afdc216 compiler, vm: implement tail call optimization
7074129727d9 vm: indicate tail call optimized frames in stack traces
c3dc162f0abc lib: reject circular prototype chains in proto()
fe9e2947d351 compiler: reject adjacent template literals
e9972df30d14 linux/types.h: add 128-bit integer types
76baa6fc264a types: fix instance-proto lookup offset in ucv_key_get()
fbdd169efd17 ubus: store per-call request proto in the instance proto slot
0aab97337e21 ubus: drop per-instance proto when releasing resources
4eff16514b57 uloop: report signal termination in process callbacks
9ba6ea147dee headers: split public and private API headers
4c6e64425d14 ffi: reject function values passed as variadic arguments
af69c8d226a9 types, vm, lib: add metamethod support for prototyped values
1fd07aa2ba34 ffi: represent wrapped C functions as "ffi.cfn" resources
c966006d635f ffi, vm: support property syntax for cdata via __get__ / __set__
672439e7c530 vm: add debugger infrastructure (breakpoints, offsets, nested-exit fix)
a5b5925b53ab debug: add interactive command line debugger with -x/-X CLI switches
c2476472eb23 debug: add remote debug protocol with a client/server split
d968d33f455e debug: move the debugger onto a line-based protocol, split server/client
1a771e3c1ffd debug: add line editing, EVAL, Ctrl-C interrupt and tail-call annotations
26bfd5851bcc debug: synthesize PAUSED when a resuming command cannot resume
00a8fa9dea6c ffi: add ffi.closure() for explicit C function pointer creation
f061ee2e4369 ffi: fix Clang static analyzer false positives in closure code
8c017f171f0a types: Fix warning unused variable
0273114f13a6 types: raise type error for non-index array property sets in strict mode
d2c7b24e366e struct: rename ucv_as_double to ucv_as_float64
4dd080fe47ab headers: privatize uc_program_entry/ucv_closure_new/ucv_compare, add uc_program_main()
fda0498102bd lib, vm: replace ad-hoc value casts with ucv_as_* macros
ad88dfb621d6 metamethods: object-valued __get__/__set__/__delete__ delegate instead of mis-delegating return values
ea4c65b3c255 lib/fs.c: set errno on failed open()
10e44a53f808 lib.c: add optional offset argument to index() and rindex()
37d10ce70189 lib/io.c: fix io.pipe() jsdoc example
100f354f5d75 lib/math.c: export math constants (PI, E, ...)
ca70f18e31b3 lib/resolv.c: validate retries/timeout and guard retry-interval division
22f64a32f784 treewide: adjust references after jow-/ucode => ucode-lang/ucode move
6373faeac549 docs: fix deep merge example
1561320a00b4 lib,main,types: include json-c compat shim where needed
83ed2a8ba815 tutorials: fix claims that disagree with the interpreter
cef095d846bd Update CNAME
0c39aaa3d277 lib/log.c: accept arrays of channel and option names
ad3a5d580983 lib/log.c: use the documented defaults for omitted arguments
9e1d747640fe devcontainer: add development container configuration
d2c81218773b vm: clear a pending exception when entering uc_vm_execute
deb063dba30d build: add minimal emscripten/wasm32 build guards
75489e3ca2d5 source: initialize runpath in uc_source_new_buffer
4e65efb46854 build: add emscripten/wasm32 CMake support
24b0a2ad2e05 lib: underline the statement an error occurred in
926a2bf7e219 lib: name the offending expression when a call fails
068e7b222b4f ucode: fix socket bind() ignoring port argument
a4da50de2430 io: read the current termios before applying attributes
38f21be1bcbb uloop: redirect the task child's standard descriptors to /dev/null
af8a3830661a uloop: close the task output pipe even without an input callback
e6e03000000f uloop: release the handle when uloop_fd_add() fails
1e6b56558617 uloop: read task messages without losing them to EAGAIN
6e1592a2862f fs: report a write that only fails when the file is closed
d075095287c8 fs: keep the bytes a short read already delivered
8c01857cadd0 resolv: file each NS, CNAME and PTR record under its own type
4fec71ddd26d struct: decode any non-zero byte as true in native mode
edf5b32c5d4c zlib: inflate every member of a concatenated stream
b844c63b2381 resolv: release the TXT buffer when the record is malformed
664b70791957 compiler: unwind the nested function compiler on a bad argument list
ab988ea3159a struct: accumulate signed integers in an unsigned type
d996fade5f36 compiler: do not overflow int building the wildcard import operand
24df8d20bde2 vm: give division by zero the right sign, and NaN for zero over zero
a5c102ea2cfd tests: expect statement underline in forward declaration error
ccbe4228913d types: clear resource value slots after releasing them
c7e550d05ec4 socket: reject recv() lengths that overflow the printbuf offset
b1c7693fc5c6 socket: do not free caller-owned control data in sendmsg()
0630355f1ce6 socket: size msg_controllen from the payload, not the cmsg length
b51836754a9e types: do not dereference tagged values in ucv_string_length()
8fac388410d4 struct: bound the base64 pack field to the space reserved for it
b8a8646cbb2c struct: bounds-check the field offset when unpacking
5544af285082 struct: allocate the string header when packing zero bytes
8bd004a1a423 lib: free the string match() allocated, not the one it advanced
e98574152fcb io: return ENOMEM rather than aborting on an oversized read
9b45eef92402 io: give ioctl() a heap buffer the kernel cannot overrun
531c09289a4f resolv: check the SOA rdata bound after the two names
4d12bc9af856 ubus: detect cycles when converting values to blobmsg
5bcb94aec84d vallist: reject an inline string constant longer than its buffer
cd73805bcb0f program: validate the export name length when loading bytecode
fe546444f289 program: terminate the strings the bytecode loader reads
ba4b639597e6 compiler: do not return a bytecode program that was just freed
19247f51e22a compiler: unwind the patchlist when an expression fails to parse
58774dd67277 rtnl, nl80211: check every netlink reserve return
8fff82c22a7c fs: stop readfile() losing data when the buffer cannot grow
39454f8830a9 zlib: act on the output reserve failing
a90a1d2c9ebe lib: size the b64dec output buffer from the ceiling
ad3be9a33322 ubus: bound the nesting depth when decoding a message
953cd5a9ea23 ubus: do not close a descriptor the script still owns
5a2c5d93ce53 lexer: discard the partial string when an escape is rejected
428232cfce1c vm: range-check local slots, upvalue indices and stack depth
e170905c143b program: bound the counts and lengths the bytecode loader reads
6065b2ce63cc program: bound an export name by the bytes left in the file
e1a8b8cf5d21 compiler: do not call a missing infix handler inside parentheses
2cd8d1b9726b compiler: do not read the last instruction of an empty chunk
468994d345ff compiler: compare local names without assuming they are strings
04d59c6395de compiler: guard the remaining local name comparisons
19656543aac0 types: dispatch __delete__ for keys arrays and resources cannot store
dd57d12404ec compiler: do not drop the loop condition at chunk offset 0
dc9386a190fb jsdoc: accept a doc comment at the very start of a file
04d3ae59abd4 serial: add JSDoc documentation for module functions and constants
959206e27878 netaddr: add new netaddr module ported from LuCI's luci-lib-ip
904358422b3b docs: restructure tutorials around the new manual
af9324c9e7c5 readme: point at the new project sites
212dd12150b6 lib: optimize trim(), ltrim(), rtrim()
2c8c36be454d struct: fix infinite loop in grow_buffer() for small sizes
131c041a61d5 platform: export the macOS pipe2() replacement to modules
e6a1f945db65 fs: find the PATH separator without strchrnul()
4711d3c2c5dc lib: reject mutations of the container being sorted
f0a4664b97b0 rtnl: recover the event listener from receive buffer overruns
eaa09ca64305 rtnl: free the partial reply of a request that fails
5c655c357c53 rtnl: return true for an acknowledgement without data
0bfb7b97bf2f nl80211: recover the event listener from receive buffer overruns
30dfbb218fa1 nl80211: return true for an acknowledgement without data
395cfeead63f nl80211: fail a request whose reply the event socket lost
f8f8fc55126f nl80211: run listener callbacks outside of a request
f60d9b01b59c nl80211: free the partial reply of a request that fails
234e524f7ae0 nl80211.h: update to mainline d24e8ac715de
80be3ab390ee nl80211: request and decode the per-link statistics of a station
c51e15921dc6 lib: fix module namespace export mapping for linked imports
b5ce44358354 compiler: report strict redeclarations at the redeclaring name
e22e4362e6d5 tests: allow restricting a testcase to platforms
ef5b35ea145e tests: do not check forked children with valgrind
a6b8bfe1b582 tests: allow a testcase to skip itself
7fe06b46f3c5 uloop: expose ULOOP_ERROR_CB
115d308a8514 uloop: release timers and handles once they are finished
0c1b005cd0d3 uloop: disarm a timer on set() without a timeout
986390458007 uloop: disarm an interval on set() without a value
503a9bfcffd2 uloop: test that a finished task closes its pipes
f4fa308dc4f2 uloop: keep a task alive while its output callback runs
fa81c11ff2a7 uloop: release a finished task after a callback exception
21a2140f2324 uloop: reject a handle without an IO event
0ea69b1e736a uloop: do not unregister a reused descriptor number on handle delete
ddb06a197ef5 compiler: make strict mode function names constant bindings
620eff6a772d uloop: keep a handle alive while epoll may still report it
1942e5fce058 uloop: disable a handle whose removal fails
9a3acc008531 uloop: expose ULOOP_PRIORITY
1f54bd285339 uloop: read task messages without blocking the event loop
c2319e9b26bb uloop: close the task pipes when fork() fails
db2191ab014e devcontainer: remove formatting options managed by editorconfig
486104700227 compiler: account for nested imports in the importer's export offset
be870dd61b95 types: give the collector a dedicated mark bit
2e0b25a23c09 socket: fall back to SO_TIMESTAMPNS for the OLD alias
4141cb38f398 ubus: pass an exception of a deferred completion callback to the guard
0fcd31713fee ubus: do not pass exit() in a callback to the guard
c80855059801 socket: fix the file descriptor on 64-bit big-endian
a18924e53045 tests: move the socket poll test to the lib_socket directory
f4ce7eb00d22 source: allocate and release a source in one place
8d25f029d96b compiler: give dynamic loads the position of the import
08f3be072dd0 vm: read the callee type before uc_vm_call() runs it
3c9f214a2d56 serial: add RS485 mode access (Linux)
100d19ac369f vm: keep the exception of a module that failed to load
3c0a3c7c1023 vm: read the importing frame after the module load
2cf103aded34 tests: skip the RS485 serial test under valgrind
5c8d6d544730 lib: fix stack use after scope in compile config parsing
0dc042eefa5b source: rework the text access API
1dd1f88c81bb source: close the file of a source after its compilation
69db946e7c39 lib: remove the source cache of loadfile()
4436a931dc38 compiler: start each compilation from a clean source
4503599e49f1 source: read a file that cannot seek into a buffer
330cdab782be compiler: release the name list of an import() statement
153c627fd445 lib: do not store a failed module in the module table
3bf604919140 vm: keep the exception of a failed dynamic module load
71b4a144b438 lib: compile a file loaded from a module body as a program
080cbd79727f lib: release the main function of a required file
6c30ef7fd30c vm: release the previous binding of an import
6e404de5c0b1 vm: let the main closure of a program own its module exports
0adb7ba6b4d1 vm: do not interrupt the exports of a module
8cfcffe5abcd lib: find the exports of a precompiled module by their count
53ebdff102e6 vm: size object literals from the compiler's key count
f8a757295dc9 types: start array entry vectors at 2 slots
00091f829801 types: avoid accessing values after converter exit
78f83f8d6b59 lib: take one reference on the prototype in proto()
96cdb4549b59 compiler: fix endless loop on syntax errors in template placeholders
fb54dfe1733c types: release the old instance prototype of a resource
struct uc_vm grows at its end, and programs such as hostapd embed it, so
bump PKG_ABI_VERSION.
Add packages for the new ffi, netaddr and serial modules. Turn them off
for the host build, since ffi is otherwise built whenever libffi happens
to be in the staging directory.
The project moved to ucode-lang/ucode, so update PKG_SOURCE_URL.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
The ucode ffi module needs libffi. Move the package from the packages
feed (commit 3b7cdf03a6f2) without changes, so that the core tree
provides it.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
A large number of generic procd, ujail and container related fixes and
improvements. See https://git.openwrt.org/project/procd/log/ for the
detailed history since commit 6a22d39648.
uxc keeps the per-run files of a container, the last exit record, the
generated environment file and the resources override, in
/tmp/run/uxc/<name>/. The pre-remove hook only stops a package
container and deletes it from procd, so that directory stays behind
until the next reboot. Remove it in the post-remove hook together with
the state and settings of the container.
When a container package is upgraded to a new image, the pre-install
hook only signals the old container and leaves its instance in procd.
The bring-up after the install then adds the container with once, which
procd refuses for a container it already has, so the new image starts
only after the next reboot.
Delete the old container in the pre-install hook, as the pre-remove hook
does. uxc kill without a signal returns once the container has stopped,
procd forgets a deleted container, and the bring-up starts the new
image.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Add debug-level tracing for calibration requests, readiness polling,
attempts and results, retries, coefficient refinement and mode-change
invalidation. Record symbol-error samples, attempt duration and mutex
wait time to diagnose acquisition and scheduling issues.
Demote per-attempt link and error-count failures to debug level since
later attempts can recover. Include measured counts, thresholds, mode
and attempt context, sharing named XSGMII limits between checks and
messages. Retain warnings for exhausted attempts and errors for failed
register accesses.
Assisted-By: ChatGPT (OpenAI GPT-6.1 Sol)
Link: https://github.com/openwrt/openwrt/pull/25882
Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>
The clock-ready debug readback is used by the SDK's 10G SerDes setup
sequence. Restrict polling to 10G-type SerDes while retaining the
existing exclusion for OFF mode.
This avoids applying the check to the 5G QSGMII SerDes 0 and 1, which can
report clock synchronization failures despite working links.
Assisted-By: ChatGPT (OpenAI GPT-6.1 Sol)
Link: https://github.com/openwrt/openwrt/pull/25882
Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>
Store the calibration attempt count per SerDes and execute one full
attempt per worker invocation. Requeue failed attempts after one second,
up to a total of three attempts, checking RX readiness on each run.
Reset the count when arming a new configuration. Readiness polling does
not consume attempts, and success or exhaustion finishes the request.
Assisted-By: ChatGPT (OpenAI GPT-6.1 Sol)
Link: https://github.com/openwrt/openwrt/pull/25882
Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>
Zero symbol errors can also be observed without an established receive
link. Require physical RX link-up after the error measurement window
before accepting a calibration attempt.
Reuse the 10G receive-link indication for 10GBase-R and USXGMII. For
XSGMII, require the full link-status bitmap on both backing digital
SerDes, accounting for the logical-to-physical mapping.
Assisted-By: ChatGPT (OpenAI GPT-6.1 Sol)
Link: https://github.com/openwrt/openwrt/pull/25882
Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>
Apply the RX baseline in post-config and arm delayed work per SerDes.
Wait for RX_IDLE to deassert before running the full calibration
sequence, retaining initialization on each of up to three attempts.
Serialize the worker with PCS configuration, invalidate pending requests
on mode changes, and drain the work through a managed cleanup action on
probe failure or device removal.
Assisted-By: ChatGPT (OpenAI GPT-6.1 Sol)
Link: https://github.com/openwrt/openwrt/pull/25882
Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>
The monitor rx length fix (949-wifi-ath11k-fix-monitor-rx-pktlen.patch)
logs every frame it trims with ath11k_warn. A monitor interface on
ipq807x/ipq60xx trims nearly every frame, so this fills dmesg and logread
with "DELIVER trim8" warnings: on an Arista C-360 with a monitor-mode
scan radio they were 960 of 1043 logread lines, pushed everything else
out of the log, and flooded the serial console.
Log it with ath11k_dbg (ATH11K_DBG_DATA) instead, as the rest of the
monitor path does. The trim itself is unchanged.
Tested on an Arista C-360 (ipq807x) with a monitor interface in use (a
scan radio's monitor survey): no trim messages in dmesg.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Christopher Griffin <christophergriffin05@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/25988
Signed-off-by: Robert Marko <robimarko@gmail.com>
The XikeStor SKS8300-12x V2 is a managed switch based
on RTL9313 with 12 SFP+ ports.
Device specification:
- SoC: Realtek RTL9313
- RAM: 256MiB
- Flash: 32MiB Macronix SPI NOR
- Ethernet: 12x SFP+ cages
- Button: hard reset
- System LED: GPIO 0
- Bootloader: U-Boot 2011.12.(3.6_CURRENT)
- Vendor board model: RTL9313_12XGE
- UART: Cisco style RJ45 port on the front.
- Settings: 115200n8
- Power: 100-240 VAC 50/60 Hz C13/C14
- Monitoring: LM75
- Fan controller: Maxim 6651
Notes:
The MAC address can be extracted from the jffs2
partition in the file factoryData at offset 0x80.
As the jffs and jffs2 partitions are formatted
with 4K erase sectors this requires the kernel to be
configured with CONFIG_MTD_SPI_NOR_USE_4K_SECTORS or
dumping it with jefferson.
The switch has a RTL8231 connected to it via SMI
which seem to control the port LEDs.
"rtk network on" initializes the RTL8231 so the LED
works but can't be controlled via OpenWrt.
Booting the initramfs image:
1. Connect to the serial port, power on the device and press Esc
before autoboot starts to get to the u-boot CLI.
2. Run "rtk network on".
3. Boot the initramfs image.
Via YMODEM:
Run "loady 0x82000000".
And then "bootm 0x82000000".
Via TFTP:
Connect a SFP module or a DAC to port 1.
Run "rtk 10g 0 fiber1g".
If using a DAC replace fiber1g with the correct type.
The default TFTP server IP is 192.168.1.111.
Run "tftpboot 0x82000000 <image name>".
Where "<image name>" is the name of the initramfs image.
And then run "bootm 0x82000000".
Installation:
After booting the initramfs image transfer the sysupgrade
to the device and run sysupgrade <path to sysupgrade image>.
Set the bootcmd u-boot variable to "rtk network on ; boota"
and save the variable and reset the switch.
Signed-off-by: Erik Larsson <who+github@cnackers.org>
Link: https://github.com/openwrt/openwrt/pull/25782
Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>
This enables the two SFP cages for the Netgear GS310TP switch. The
GPIO numbers used have been harvested from the stock firmware's
"show tech-support" command.
Tested on real hardware with various optical and RJ45 transceivers.
Signed-off-by: Shine- GH <4c.fce2@proton.me>
Link: https://github.com/openwrt/openwrt/pull/25987
Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>
Linux 6.18 made migrate_disable()/migrate_enable() inline in
linux/sched.h. They use RQ_nr_pinned from include/generated/rq-offsets.h,
which the kernel only generates during 'make prepare'. bpf-headers only
runs archprepare, so the header is missing and BPF programs including
linux/sched.h fail to build.
Running 'prepare' instead is not an option: it compiles kernel objects
(scripts/mod, bounds.c, asm-offsets.c, rq-offsets.c) with the BPF clang
using the MIPS kernel flags, which fails right away.
Generate a placeholder header, as is already done for timeconst.h. The
offset value is irrelevant for BPF programs, which cannot call these
functions.
Signed-off-by: Sander van Deijck <sander@vandeijck.com>
Link: https://github.com/openwrt/openwrt/pull/25964
Signed-off-by: Robert Marko <robimarko@gmail.com>
Rename ppe-qos to qca-ppe-qos so the package name clearly identifies
it as specific to the Qualcomm PPE. Rename the UCI config, service and
hotplug hook to match.
Signed-off-by: Robert Marko <robimarko@gmail.com>
Add support for AVM FRITZ!Box 4050, an IPQ5018 based WiFi 6 router.
Hardware
--------
SOC : Qualcomm IPQ5018 2x A53
RAM : 512MiB DDR3L Winbond W634GU6QB-11
Flash : 128MiB Winbond W25N01GWZEIG
ETH : 4x GbE
Switch : Qualcomm QCA8337
WiFi : IPQ5018, QCN6102
USB : 1x USB 2.0
Buttons : WLAN, DECT, WPS
LEDs : Power, WLAN, DECT, WPS, Info green, Info red
DECT : DCX81AC0CFAE3FNC
Power : DC 12V 1.5A
UART
----
4 holes, vcc is square
gnd - rx - tx - vcc
3.3v
Installation
------------
1. Download scripts/flashing/eva_ramboot.py, initramfs image and sysupgrade.bin
2. Connect to lan1 and set host ip to 192.168.178.2
3. Power the device and run
`./eva_ramboot.py --ramsize 0x20000000 --ramstart 0x40000000 192.168.178.1 <initramfs image>`
when only the 'Power' led blinks
4. Set host ip to 192.168.1.2 and connect to LuCi on 192.168.1.1
5. Sysupgrade in LuCi
Revert to OEM firmware
----------------------
Follow the OEM guide: https://fritz.com/en/pages/recover
The recovery process also works on Linux using Wine.
MAC Addresses
-------------
WAN : D4:24:DD:XX:XX:FF
LAN : D4:24:DD:XX:XX:02 (label mac)
2.4GHz : D4:24:DD:XX:XX:04
5GHz : D4:24:DD:XX:XX:05
Not Supported
-------------
DECT
analog phone port
Signed-off-by: Leonard Anderweit <leonard.anderweit@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/25056
Signed-off-by: Robert Marko <robimarko@gmail.com>
The ingress VLAN rule of a filtering bridge VLAN keyed the CPU port as
well, so every frame the host sent with that VID was classified into the
VLAN's VSI, also when it was addressed to a port outside the bridge. A
standalone port, or the conduit of a QCA8337 behind the PPE, then dropped
it. On the RT-AX89X a VLAN-aware bridge of lan3 and 10g-copper with PVID
10 passed no traffic towards lan3.
The host sends each frame already formatted for the port it names, so
leave the CPU port out of the rule and keep it in the VSI's members.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>
The EDMA block has a reset line of its own, but the driver asserts it
only at probe and when it rebuilds the rings. qca_edma is built in and
the switch sits on the conduit, so a reboot is the only other way back
to the engine's power-on state. Implement the ethtool reset op for
ETH_RESET_DMA with the rebuild ring resizing already uses.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>
qca_ppe_setup() discards what ppe_fdb_flush() returns, so a flush that
never completes leaves the entries left behind by the boot loader in
place without a trace. Warn when it times out.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>
edma_misc_irq_handle() reads MISC_INT_STAT and returns without clearing
the condition, so a condition that persists keeps the interrupt asserted
and the handler runs back to back. Mask the misc interrupt on the first
report, as qca-nss-dp does in edma_handle_misc_irq(). edma_hw_init()
unmasks it again.
Fixes: bdb0b722b7 ("qualcommax: add EDMA driver")
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>
edma_irq_disable_all() clears a TX interrupt mask for every TX
descriptor ring, but the TX interrupt registers come one per completion
ring. IPQ807x has eight completion rings, so indices 8 to 23 land in the
RXFILL block and zero the producer index and the interrupt mask of fill
rings 0 to 7. Bound the loop by the completion ring.
Fixes: bdb0b722b7 ("qualcommax: add EDMA driver")
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>
The CPU port reports the MAC counters of a MAC it does not have, all
zero, and none of its queue counters. Report its unicast and multicast
queue counters instead, as for the user ports.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>
The queue manager has a WRED threshold pair per colour on every unicast
queue, but only a colour-blind red is offloaded. Offload gred in WRED
mode on the same queues a red takes: DP 0 sets the queue limit and the
green thresholds, DP 1 and 2 the yellow and red ones below it, and the
queue turns colour aware; ECN and per-VQ averaging are refused. On
IPQ8074, two uploads under the 165 Mbit/s WAN shaper, one marked yellow,
ran at 14/47/6 and 140/71/146 Mbit/s with only yellow dropped
(572/343/162), against 110/135/80 and 43/25/82 under a colour-blind red.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>
sch_gred is only available inside kmod-sched. Package it on its own, 9K
compressed on ipq807x. kmod-sched depends on it, so what it installs is
unchanged.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>
An ingress flower classid sets skb->tc_index, which gred reads as the
drop precedence, but the driver ignores the classid and offloads the
rule without it. Map classid :0 to :2 to the ACL action's internal drop
precedence, green, yellow or red, and refuse any other classid.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>
A port's egress queues drop frames that tx_dropped never shows: the
counter it folds sits ahead of the queues. Add the drops of the port's
unicast and multicast queues to tx_dropped, folded like the others. On
IPQ8074 a port shaped to 20 Mbit/s under a download reports the same
drops in tx_dropped as its queues do in ethtool -S (618, 539 and 503).
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>
VSI_TAG_EN in PORT_EG_VLAN is set out of reset, so every port takes its
egress tag mode from the per-VSI table instead of its own. On the CPU
port this strips the C-tag of a frame that enters a VLAN-unaware bridge
port tagged, and a VLAN upper of the bridge never receives it. Clear the
bit on every port at setup; a VLAN-filtering port sets it again.
Fixes: 142104bb90 ("qualcommax: add PPE driver")
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>
The TX preheader can carry a C-tag or S-tag for the switch to insert,
but the driver makes the stack push every tag into the frame. Add
NETIF_F_HW_VLAN_CTAG_TX and NETIF_F_HW_VLAN_STAG_TX: the tag is flagged
in pre2, its TCI written to pre3 and the insertion commanded in pre4.
They are in vlan_features, so the DSA user ports and their VLAN uppers
hand their tag to the conduit out of band. The switch inserts a C-tag
behind an S-tag already in the frame and drops a tag of the type the
frame starts with, so for those frames the stack still pushes the tag.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>
The receive ring can strip the C-tag of a frame and report it in the
preheader, but the driver leaves every tag for the stack to pull. Add
NETIF_F_HW_VLAN_CTAG_RX: the ring strips the outer C-tag and the driver
hands it up out of band. A C-tag below an S-tag is not stripped and
stays in the frame.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>
A GRO aggregate that outgrows MAX_SKB_FRAGS keeps its further segments
on a frag_list, and without NETIF_F_FRAGLIST the stack segments it
before it reaches the conduit. Write the heads and fragments of the
frag_list skbs to descriptors like any other fragment. An aggregate
that needs more than 32 descriptors is segmented in software by
ndo_features_check rather than linearised.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>
port_bridge_leave() marks the port's VSI invalid, and a port without a
valid VSI drops every frame it receives, so a port taken out of a bridge
stops receiving until the next probe. Program VSI 0, which carries the
standalone ports, as probe does.
Fixes: 142104bb90 ("qualcommax: add PPE driver")
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>
devlink shows the shared buffer's pools but no port's share of them. A
switch port's ingress is one buffer manager port, port + 7 as qca-ssdk's
PHY_PORT_TO_BM_PORT() has it, so its single ingress class binds to that
port's buffer group and its threshold is the dynamic weight. The egress
classes are the port's unicast queues and report their admission group and
weight, and moving them is refused because the driver assigns the queue
groups. Occupancy is read from the buffer and queue counters at each
snapshot; they report only the current value, so the maximum is the
largest value a snapshot has seen.
On IPQ8074 a port threshold changes only the weight of that BM port's
entry, the neighbouring port's entry stays intact, an egress bind is
refused, and a port shaped to 50 Mbit/s with a 200000-byte limit reports
87040 bytes occupied in its egress pool under load.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>
An ets with DRR bands is either refused or, with equal quanta, run as
strict bands while it reports offloaded. With a strict top band, DRR lower
bands now move the middle band's queues to a spare L1 node of the port at
the bottom band's priority, and the two nodes share the port's DRR list
with weights scaled from the quanta. Weighting the queues instead would
split a band's share by how many of its hash queues are busy, and a DRR top
band is refused, because its node also carries multicast.
Measured on IPQ8074, n=3: quanta 3000:1000 give 69 and 18-21 Mbit/s, and
1500:1500 about 1:1.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>
mqprio's min_rate is refused, although every scheduler node has a committed
and an excess token bucket. A class's min_rate now goes in the committed
bucket and the difference up to max_rate in the excess one, a floor without
a max_rate leaves the excess unmetered, and both buckets share one token
unit chosen for the faster of the two. The port serves committed traffic
ahead of excess, so when any class has a floor, a class without one sends
only as excess: its committed bucket is armed empty and its max_rate goes
in the excess one.
Measured on IPQ8074 on a 100 Mbit/s port, n=3: a class with a 60 Mbit/s
floor against a strict top class carries 52-53 Mbit/s of TCP goodput, and 0
without the floor.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>
The queue manager has WRED on every unicast queue, and nothing programs it.
A red at the root or under a root tbf now covers the port's unicast queues,
one under a band of an offloaded ets or prio covers that band's queues, and
its stats and xstats come from those queues' counters, which also give a
tbf under the top band its stats. Its max becomes a static queue limit and
its min the gap below it where early drop starts, in 256-byte buffers and
colour blind, and ECN marking is refused because the queue manager only
drops. The drop probability is fixed in hardware, so the probability is
ignored with a one-time notice: measured on IPQ8074 with a 50 Mbit/s tbf
and red min 30000 max 90000, under UDP at 1.6, 2.4 and 4 times the rate
(n=3 each), the early-drop probability reaches about 0.66 at max.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>
Only a root tbf is offloaded, and TC_ETS_GRAFT and TC_PRIO_GRAFT are
refused, so a rate on one band of an offloaded ets or prio stays in
software. A tbf on the top band now programs that band's L1 node shaper,
which also carries the port's multicast queues and sparse list. The lower
two bands share one L1 node and are four L0 queues each, so no single
bucket meters one of them, and a tbf there is refused.
Measured on IPQ8074 on a 100 Mbit/s port, n=3: a 20 Mbit/s tbf on the top
band holds it to 18 Mbit/s, against 94 Mbit/s without the tbf.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>
ethtool -S reports only the MAC MIB, while the per-queue transmit counters,
the per-colour queue drop counters, the buffer manager drop counters and
the port meter colour counters are read only by debugfs. Each user port now
lists its own unicast and multicast queues, its buffer manager port and its
meter. The packet counts are 32 bits and the byte counts 40, so they are
folded with the MIB to survive a wrap.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>
The port receiver's drop counter and the port's egress drop counter are
read only by debugfs, so `ip -s link` shows no drops for a port. Both are
32-bit packet counters outside the MAC, so they are folded with the MIB
counters to survive a wrap, and unlike the MAC MIB a port reset does not
clear them.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>
tc reaches the classifier's queue action only through ethtool n-tuple.
Accept skbedit queue_mapping with skip_sw, as ice does, by redirecting the
frame to the CPU port and selecting that queue among the CPU port's twelve
unicast queues.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>
The IPv4 address rule types carry an L3 packet type, one value of which is
ARP, but FLOW_DISSECTOR_KEY_ARP is refused. Match flower's arp_sip and
arp_tip in the source and destination address of those rule types with the
packet type set to ARP. Opcode and hardware addresses stay refused.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>
The parser extracts four 16-bit user-defined fields per packet class at a
configurable offset from the L2, L3 or L4 header, and two ACL rule types
compare them, but nothing programs them. Match the ethtool n-tuple user-def
field there. It is laid out as i40e does, the word in bits 15:0 and the
byte offset in bits 31:16, with the header in bits 33:32. The windows are
shared by all rules of a class and refcounted.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>
A flower filter with ppp_proto is refused, so no rule can match the
addresses or ports of traffic inside a PPPoE session. For ppp_proto ip or
ipv6, flower sets n_proto to the IP ethertype, which the classifier matches
with the IPv6 bit of the IP misc rule type and not with the ethertype field
the session match uses. Accept those two and keep refusing every other
ppp_proto.
On IPQ8074 a filter on an address inside a session matches its packets and
none of the control.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>
ethtool's vlan_tci mask hands the DEI bit to the driver, which ignores it,
so an n-tuple rule naming DEI matches either value. The VLAN rule type
compares the C-tag DEI in bit 19 of its first word; match it there.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>
The IP misc rule type encodes the IPv4 TTL and IPv6 hop limit in two bits
as 0, 1, 255 or any other value. Offload a flower ip_ttl match on one of
those three values with a full mask and keep refusing every other TTL
match.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>
Both the ACL meter and the port meter have a meter unit bit that makes them
count frames instead of bytes, but the driver refuses rate_pkt_ps. Program
a packet rate in that mode. In packet mode a frame costs 128 times the
tokens a byte costs in byte mode at every token unit, as in the rate tables
of qca-ssdk adpt_hppe_policer.c, so the existing byte rate helper serves
both.
Measured on IPQ8074 at 4100 packets/s, n=3 at each of two frame sizes: an
ACL police passes 4100-4110 packets/s, and a packet-rate port police holds
its rate in the same test.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>
A pedit of the IPv4 DSCP needs "action csum iph" to be correct in software,
and the classifier refuses the csum action, so the rewrite cannot be
offloaded as tc users write it. Accept csum when it updates only the IPv4
header checksum and the rule also rewrites the DSCP, which the egress
editor does with the checksum fixed up.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>
An offloaded flower filter reports no packets, because the ACL hit counters
are read only by debugfs. Add .cls_flower_stats: sum the hit counters of
every entry the rule occupies and report the red count of its meter as
drops. Both are cleared when the entry or meter is freed, so the next rule
starts at zero, and filters that ask for a hw_stats type other than
immediate are refused.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Julius Bairaktaris <julius@bairaktaris.de>
Link: https://github.com/openwrt/openwrt/pull/25700
Signed-off-by: Robert Marko <robimarko@gmail.com>