- Bump CDX_MAX_DIST_FQRS from 64 to 512 and add overflow guard to
prevent silent array out-of-bounds in cdx_create_port_fqs
- Fix atomic_fetchadd_64 race in dist_fq_rx_callback: use return
value instead of re-reading the (now stale) global counter
- Add mc_free_group to properly free multicast group heap allocations
during module unload (pCtEntry, pRtEntry, group struct)
- Walk and free mc4/mc6 group lists in mc4_exit/mc6_exit to prevent
memory leaks on module unload
- Guard against phyaddr==0 in cdx_add_mcast_table_entry when no
valid member entry is found
- Add partial-update error logging in cdx_update_mcast_group
- Document locking model for multicast command serialization
(ctrl->mutex serializes all dispatch, per-bucket spinlocks are
for FMan packet path only)
- Document single-threaded safety of dpa_devlist walk in
cdx_ioc_set_dpa_params
- Fix P0 bug: remove O_NONBLOCK from control client sockets (breaks
read_exact/write_exact which loop without EAGAIN handling), add
SO_RCVTIMEO/SO_SNDTIMEO to bound misbehaving clients
- Add SO_RCVTIMEO on route query socket to prevent cmm_rtsock_get()
from blocking the event loop indefinitely on missing kernel reply
- Add fci_handle NULL guards to ct4/ct6 register/deregister functions,
consistent with existing guards in fe_reset and route_register
- Enforce deny rules in push path (handle_pf_ready): refactor
cmm_deny_check into cmm_deny_check_tuple taking individual fields,
callable from both poll and push paths
- Add bounds checking to cmm_rtsock_parse_addrs (takes msglen param)
to prevent out-of-bounds reads on malformed routing messages
- Remove dead code cmm_route_send_fpp (trivial wrapper, tunnel code
now calls cmm_fe_route_register directly)
- Add cross-reference comments between cmm_offload_eligible and
pfn_event_eligible to prevent drift
- Enhanced debug logging for reply neighbor resolution failures
Fix two bugs in cmm_reset_offload_state():
1. Per-connection CDX deregister fails when reply tuples have diverged
(e.g. after NAT address change), leaving stale CDX entries that
intercept traffic incorrectly. Replace with cmm_fe_reset() which
does a guaranteed bulk wipe of all CDX conntracks and routes.
2. Reset fired on every RTM_NEWADDR/RTM_DELADDR including DHCP
renewals with the same IP, link-local IPv6, and loopback — causing
unnecessary offload interruptions. Filter address events: only
reset when an address is genuinely new (itf_add_addr returns
duplicate status), skip loopback and link-local IPv6.
When OPNsense reassigns the WAN interface (e.g. switching between
dtsec3 DHCP and pppoe0), cached routes become stale and RTM_GET
returns ESRCH. Rather than surgical per-route invalidation which
breaks in edge cases, flush all offload state on RTM_NEWADDR and
RTM_DELADDR: deregister all connections from CDX, flush route cache,
mark all neighbors stale. Connections stay in the hash table and
re-offload cleanly on the next poll cycle.
CMM: detect PPPoE sessions via netgraph (NGM_PPPOE_GET_SESSION_INFO),
register with CDX (FPP_CMD_PPPOE_ENTRY), resolve point-to-point neighbor
MAC from session info instead of ARP. Prevent duplicate CMM instances
via pidfile(3) locking.
CDX: fix egress PPPoE flags in dpa_get_tx_info_by_itf() — set
add_pppoe_hdr/ac_mac_addr instead of pppoe_present. Add
pppoe_stats_offset for IPsec path. Remove CDX_TODO_PPPOE ifdefs
in control_pppoe.c (timer always marks active, PF handles timeouts).
Soft parser (cdx_sp.xml): PPPoE data frames now return to HXS instead
of short-circuiting to relay CC table. HXS chains PPPoE→IPv4→TCP/UDP
naturally, enabling PCD KeyGen to build 5-tuple hash keys for IPv4 CC
table matching. LCP control packets still go directly to host.
Verified: 1.6 Gbps through PPPoE with hardware offload (all cores idle,
zero FMan drops). Bottleneck is test infrastructure PPPoE server, not GDK.
CMM: detect PPPoE sessions via netgraph (NGM_PPPOE_GET_SESSION_INFO),
register with CDX (FPP_CMD_PPPOE_ENTRY), resolve point-to-point neighbor
MAC from session info instead of ARP. Prevent duplicate CMM instances
via pidfile(3) locking.
CDX: fix egress PPPoE flags in dpa_get_tx_info_by_itf() — set
add_pppoe_hdr/ac_mac_addr instead of pppoe_present. Add
pppoe_stats_offset for IPsec path. Remove CDX_TODO_PPPOE ifdefs
in control_pppoe.c (timer always marks active, PF handles timeouts).
Soft parser (cdx_sp.xml): PPPoE data frames now return to HXS instead
of short-circuiting to relay CC table. HXS chains PPPoE→IPv4→TCP/UDP
naturally, enabling PCD KeyGen to build 5-tuple hash keys for IPv4 CC
table matching. LCP control packets still go directly to host.
Verified: 1.6 Gbps through PPPoE with hardware offload (all cores idle,
zero FMan drops). Bottleneck is test infrastructure PPPoE server, not GDK.
Delete 23 .c files that have FreeBSD-specific replacements in cdx/
(e.g. cdx_main.c → cdx_main_freebsd.c) or are Linux-only (procfs.c,
dpa_test.c, vsp_cfg.c). Delete 2 .h files (procfs.h, cdx_ceetm_gdef.h)
only included by the removed sources. Build verified clean.
Three problems solved for laggproto loadbalance with CDX flow offload:
1. Multi-port hash entries: CDX uses (portid + 5-tuple) as the FMan
enhanced hash table key. With loadbalance LAGG, the remote host's
bond can send traffic on either member port. Previously only one
port's portid was in the hash key — packets on the other port missed
CDX and fell to PF, causing split-path TCP corruption.
Now install sibling hash entries for all LAGG member ports. Each
sibling has identical forwarding actions but a different portid in
byte 0 of the key. Statistics are aggregated across siblings.
2. Member-set-change detection: CMM now tracks all LAGG member ports
(not just the active parent). When a port is replugged, CMM detects
the member set change, deregisters/re-registers the LAGG, invalidates
routes, and re-offloads flows with hash entries covering all ports.
3. PF sloppy state: When CDX offloads a flow, PF's TCP sequence tracking
goes stale. During failover, returning packets were dropped by PF as
"BAD state" (out-of-window sequence), causing ~20s TCP recovery due
to exponential retransmit backoff. Now pf_notify marks all states as
PFSTATE_SLOPPY at creation, so PF uses lenient sequence validation.
LAGG is transparent to header manipulation — no CDX microcode opcodes
needed, only route/port resolution through the interface hierarchy.
CDX kernel module:
- New control_lagg.c/h: LAGG command handler (register/deregister/reset)
- cdx_devman_freebsd.c: dpa_add_lagg_if() registers LAGG in DPA iface
list, all 6 hierarchy walkers updated with LAGG skip-through clauses
(devman_find_eth_parent, dpa_get_tx_info_by_itf,
dpa_get_iface_stats_entries, dpa_get_num_vlan_iface_stats_entries,
dpa_check_for_logical_iface_types, dpa_get_l2l3_info)
- cdx_cmdhandler_freebsd.c: FC_LAGG dispatch to EVENT_LAGG
- layer2.h: IF_TYPE_LAGG (1<<9), tracked in if_flags only (U8 overflow)
- portdefs.h: lagg_iface_info in dpa_iface_info union
CMM userspace:
- New cmm_lagg.c/h: LAGG detection via SIOCGLAGG ioctl, FPP registration
- cmm_itf.c: itf_detect_lagg() in both init and RTM_IFINFO paths
- cmm.c: LAGG init before VLAN (VLAN parent may be LAGG)
- fpp.h: FPP_CMD_LAGG_ENTRY/RESET commands and fpp_lagg_cmd_t struct
Tested: flows through lagg0 (loadbalance, dtsec1+dtsec2) offload
successfully with 0% CPU utilization.
1. control_vlan.c: wrap Linux dev_get_by_name()/dev_put() in
#ifndef NCSW_FREEBSD — the FreeBSD stub always returns NULL,
preventing VLAN interfaces from registering in gOnif_DB[].
2. cdx_devman_freebsd.c: add htons() to vlan_id storage in
dpa_add_vlan_if() to match Linux double-swap convention — without
this, the VLAN ID was stored in network order instead of host order,
causing the microcode to insert/validate the wrong VID.
3. cdx_devman_freebsd.c: add missing dpa_check_for_logical_iface_types()
call in dpa_get_tx_info_by_itf() for ingress interface discovery —
without this, ingress VLAN stripping was never configured, so the
STRIP_L2_HDR opcode left the 4-byte VLAN tag in the frame, corrupting
the IP packet. Also remove incorrect vlan_present=1 from the egress
walk (Linux only sets this flag from the ingress check).
- Fix WPA3-SAE authentication failure by injecting custom RSN IE with
PMF capability bits (MFPC/MFPR) via MLAN_OID_MISC_CUSTOM_IE. Without
PMF advertised in beacons, WPA3 clients reject the connection.
- Use PROTOCOL_WPA2 + KEY_MGMT_SAE instead of PROTOCOL_WPA3_SAE so
mlan TLV builder emits AKMP/cipher/passphrase TLVs correctly.
- Add SAE password field population for WPA3 and WPA2+WPA3 modes.
- Add UAP sysctls: country code, beacon interval, DTIM period.
- Add mwifiex_uap rc.d service script for rc.conf-based AP config.
- Load dpaa_wifi module before mwifiex in early syshook script.
- Fix CMM route offload logging thousands of errors for loopback input
device — skip lo0 in cmm_fe_route_register() since CDX can't use it.
- Remove uninformative debug printk from CDX control_wifi.c.
dpaa_wifi: Add per-VAP distribution FQs (64 per VAP, hash across CPUs)
for CDX→WiFi download, with fallback to OH default FQ. Add SG inject
path for oversized frames. Add TX backpressure via BMan pool threshold.
Add sysctl tree (dev.dpaa_wifi.*) for runtime stats and tuning. Switch
RX paths to copy-then-free model to prevent dtsec BMan pool drain.
Add enqueue retry loop and per-VAP/global counters.
mwifiex: Route debug prints through log() instead of printf() so they
go to syslog, not console. MFATAL still goes to console, MERROR to
syslog, everything else suppressed unless dev.mwifiex.0.debug=1.
Add TX backpressure (IFF_DRV_OACTIVE) with configurable watermark.
Fix UAP 5 GHz rate table, HT capabilities, and MLAN_STATUS_PENDING
reschedule in main_task.
cdx: Use per-VAP distribution FQs for WiFi TX routing with OH fallback.
Add dist fallback callback for dtsec-BPID frames on OH port dist FQs.
pf_notify: Keep PF state alive while CDX offloads the flow by updating
expire on counter sync, preventing premature state purge.
- Miss action fixup: Ethernet/PPPoE tables → PLCR policer (rate-limits
exception traffic), all other tables → KG scheme with CC_EN (re-enters
CC tree). Replaces previous ENQ_FRAME-to-default-FQID approach.
- Distribution FQRs now use per-CPU SW portal channels instead of pool
channel, preventing TCP reordering on miss path.
- BMan buffer refill: cdx_dist_fq_rx_callback now calls
dtsec_rm_pool_rx_refill_bpid() and frees buffers via
dtsec_rm_buf_free_external() (per-port UMA zone) instead of direct
bman_put_buffer().
- Clean kldunload: cdx_destroy_port_fqs() retires all dist FQRs,
qman_portal_quiesce() drains in-flight portal polls.
FM_PORT_DeletePCD() called on all dtsec RX + OH ports before hash
table deletion, preventing FMan PCD exceptions after unload.
Make 'package' depend on 'clean' so stale .ko files from incremental
builds can't end up in the image. Iterative development targets (all,
build-cdx, etc.) still use incremental builds.
Add diagnostic prints to CDX route registration and classification
table insert paths to show interface names and route IDs when lookups
fail, making NULL underlying_input_itf errors actionable.
Replace the single OPNsense-26.1-aarch64-GATEWAY.patch with per-subsystem
format-patches in patches/. These are generated from the opnsense-src
mono-gateway branch via git format-patch and can be applied with git am.
Also fix package build: add pcf2131.ko and caam.ko to plist, clean stale
packages before creating new ones, and update README with build instructions
and the git am workflow.