Commit graph

40 commits

Author SHA1 Message Date
20b7c34c64 cmm: remove the unused cmm_neigh_invalidate() and cmm_neigh_flush_ifindex()
Neither had a caller; cmm_neigh_check() now marks neighbors whose MAC
changed or is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 04:27:43 -05:00
ae932c9c46 Offload: follow next-hop MAC changes; veto af-to
cmm put a next hop's MAC into CDX when it programmed the route and then
only watched the next hop's address and interface. A next hop that
changed its MAC (a new ISP modem, an IP reused by another LAN host) kept
receiving its flows at the old MAC, possibly another host's, and new
flows reused the stale route until cmm was restarted. Neighbors no route
used also stayed cached as resolved, so a later route to the same IP got
the old MAC without asking the kernel.

cmm_neigh_check() now re-reads the ARP and NDP tables (one dump per
family) and marks every cached neighbor whose MAC changed or is gone;
cmm_route_check_neighbors() deregisters the routes using it and their
offloaded flows, which re-offload once the next hop resolves again. It
runs every maintenance cycle (30 s) and after route-socket changes, and
cmm_route_handle_change() also treats a different MAC as a change. The
last reference to a neighbor frees it. The link-layer table parser is
shared by both lookups and bounds-checks each entry's length.

pf_notify vetoes af-to (NAT64) states: their two keys are in different
address families, which cmm cannot program.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 04:22:57 -05:00
0130ae74d8 Offload: route-to matching the routing table; the state's own interface
Two problems found while preparing the gateway test.

pf_notify reported s->kif as a state's interface. A floating state
(OPNsense's default) has kif "all", so cmm's check that the routes leave
by the states' interfaces failed for every flow and nothing would have
been offloaded. Events now carry orig_kif, the interface the state was
created on.

OPNsense's automatic rules put route-to on the force-gateway rule, which
matches every NATed flow leaving WAN, and reply-to on WAN rules (port
forwards). The blanket route veto kept all of it on the software path.
pf_notify now passes a route-to/reply-to target in the event (which grows
to 160 bytes, the ring to 20 MiB), and cmm offloads such a flow only
while the main routing table sends those packets out of the same
interface to the same next hop: route-to for the original direction,
reply-to for the reply. A route change already tears flows down and
re-runs that check. dup-to, a target without an interface, and one in
another address family still veto.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 01:44:38 -05:00
f1a16265a8 Remove the IPsec offload code (audit V2)
cdx no longer builds it, so it goes: cdx's dpa_ipsec_freebsd.c and
cdx_dpa_ipsec_freebsd.c, the vendor control_ipsec.c and query_ipsec.c,
and cmm's PF_KEY handling (cmm_ipsec.c). FreeBSD's IPsec stack handles
all IPsec; flows into a tunnel never match the hardware's routes, so
cmm keeps them on the software path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 23:47:12 -05:00
96a812fa5b Offload: keep flows pf must see on the software path (audit V1-V5)
pf_notify (kernel):
- V1: every event carries a veto mask: route-to/reply-to/dup-to, policy
  routing (rtable), dummynet and ALTQ (shaper, limiters), log all and
  pflow, scrub/set-tos/set-prio/max-mss. Hardware forwarding takes the
  main routing table and skips all of it.
- V3: states are no longer all made sloppy at insert. CMM reports the
  states it puts into hardware (PFN_IOC_OFFLOADED); only those are.
- V5: a DELETE that cannot be queued discards the ring and makes the
  next read a RESYNC; INSERT and READY leave room for DELETEs. Counter
  updates refresh a state's expiry only when packets moved, so an idle
  offloaded flow expires and is removed.

cmm:
- A flow keeps both of its pf states (in, out). It is offloaded only
  with both seen, neither vetoed, and pf's interfaces matching the
  routes the hardware will use, which also catches route-to and policy
  routing structurally. A DELETE of either state removes it (the NAT
  companion's DELETE was ignored when it arrived first). A third state
  for one flow keeps it on the software path.
- RESYNC wipes CDX and forgets every flow; READY rebuilds them.
- V4: bridge flows are refused while pf filters bridged traffic
  (net.link.bridge.pfil_member or pfil_bridge).
- V2: cdx is built without DPA_IPSEC_OFFLOAD and cmm opens no PF_KEY
  socket; a stub answers the SA lookups the conntrack code makes.

Builds clean against the 26.7.9 kernel; not yet tested on hardware.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 22:16:06 -05:00
98356a2663 Board drivers: audit fixes V6, V8, V9, V11; relabel ported drivers GPL-2.0
Security fixes from the audit:
- V8 caam: the HMAC raw key (up to 128 bytes) was copied into a buffer
  of the split key's size (32 bytes for MD5, 48 for SHA-1), reachable
  through /dev/crypto. The buffer now fits both. caam_dma_free() zeroes
  every buffer itself, which also fixes the QI path clearing twice the
  split key buffer's size at each session teardown.
- V6 mwifiex: the uap_passphrase sysctl, readable by every local user,
  is write-only; mwifiex_uap says to keep the passphrase in a 0600
  /etc/rc.conf.d/mwifiex_uap.
- V9 dpaa_wifi: hardware frame lengths were copied into a 4 KB cluster
  unchecked, and scatter/gather frames read as one buffer. One helper
  now takes only contiguous frames within the buffer, at any length.
- V11: cdx frees IPsec keys and shared descriptors with zfree(); fmc's
  state file moves from /tmp (symlink attack by any local user) to
  /var/run.
- The firmware object pcieuart9098_combo_v1.bin.fwo is a build output
  and no longer tracked.

caam, ina2xx and lp5812 were ported from Linux and relabelled BSD-2 by
the vendor (8f9b3bf, 84e318c, ac81eea). They are GPL-2.0-only again,
with the Linux sources' copyright holders; LICENSING.md lists them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-27 21:30:15 -05:00
87893ded3e Build 26.7 for FreeBSD 15 only; port caam and cdx to its kernel
- caam: the bus activate, deactivate and release resource methods take
  no type and rid in FreeBSD 15.
- cdx: sys/cdefs.h defines __maybe_unused now; define it only if missing.
- 26.1 is end of life and no longer built: remove patches/26.1 and
  make-26.1.conf, default to 26.7 and FreeBSD 15.1 throughout, and move
  the build examples in README.md and RELEASE.md to 26.7.9. The 26.1
  tree on the mirror stays, for gateways that still have to upgrade.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-23 19:26:41 -05:00
Tomaz Zaman
e8cb4efca3 fastpath: relicense to GPL-2.0+ with proper NXP copyright attribution
The fastpath stack (CDX, CMM, cmmctl, auto_bridge, FCI, dpa_app)
derives from NXP's ASK SDK which is GPL-2.0+ licensed. Several
components compile NXP vendor source directly, and others include
verbatim GPL headers (list.h, jhash.h, fpp.h).

Change all BSD-2-Clause files in the fastpath stack to GPL-2.0+ and
add original copyright holders (Mindspeed Technologies, Freescale
Semiconductor, NXP) alongside Mono's copyright. Also fix "Ported
from" comment in include/desc.h to "Inspired by".

Components unaffected: pf_notify (100% original BSD), fmlib
(BSD-3-Clause NXP), fmc (MIT NXP).
2026-03-29 17:02:02 +02:00
Tomaz Zaman
10b0dc8f10 cdx/cmm: fix IPR timer shutdown race, fix CMM native Makefile
cdx_reassm_freebsd.c: Add wakeup() before kthread_exit() in the IPR
timer thread so cdx_deinit_ip_reassembly() doesn't rely on a 2-second
tsleep timeout to detect thread exit.

cmm/Makefile: Add 4 missing source files (cmm_deny.c, cmm_socket.c,
cmm_bridge.c, cmm_l2tp.c) and include paths for auto_bridge and
pf_notify headers, matching Makefile.cross.

cmm/PORTING.md: Remove stale warning about auto_bridge.ko missing
d_kqfilter — already implemented (abm_dev_kqfilter).
2026-03-24 17:06:39 +01:00
Tomaz Zaman
1c9b97f3b5 pf_notify/cmm: remove polling fallback, fix one-shot ordering bug
Fix a bug in pf_notify where pfn_mark_notified() was called before
pfn_queue_event(). If the ring buffer was full, the READY event was
dropped but the state was already marked as notified — it would never
re-fire, leaving the connection permanently in the software path.

Move pfn_mark_notified() inside the lock, after successful ring_put().
On drop, the state is NOT marked, so the next packet re-triggers READY.

Enlarge the ring buffer from 4K to 128K entries and the notified hash
from 16K to 128K entries, both dynamically allocated (~17 MB total).
Add ring_hwm and ring_used diagnostic sysctls.

With the one-shot ordering fix and larger ring, the polling fallback
in CMM is no longer necessary. Remove cmm_conn_poll() and all
associated code (DIOCGETSTATESV2, epoch-based GC, -p flag, /dev/pf).
CMM now requires pf_notify.ko and uses push events exclusively.

Add cmm_conn_maintenance() as a 30-second timer that retries offload
for pending connections (e.g., after route changes) and runs route GC.

Delete cmm_offload.c/h (poll-path eligibility, now dead code) and
cmm_deny_check() (poll-path deny wrapper).

Add a kevent registration safety check that skips invalid fds to
prevent a single bad fd from killing the entire kqueue setup.
2026-03-24 16:34:41 +01:00
Tomaz Zaman
6837618376 Merge native_build: add libxml2 include paths for native aarch64 builds 2026-03-23 19:32:04 +01:00
Tomaz Zaman
911110e390 cdx/cmm: reject route offload for non-DPAA interfaces
When OPNsense interfaces are reassigned to non-DPAA devices (bridge,
VLAN, etc.), CDX would accept route registrations with unknown input
interface names, creating routes with NULL input_itf. Every subsequent
conntrack insertion then hit the NULL check in insert_entry_in_classif_table()
producing massive DPA_ERR spam.

Fix at two layers:

CDX: Return ERR_UNKNOWN_INTERFACE when input/underlying_input device
names are non-empty but not registered, matching the existing output
device validation. Downgrade ehash NULL checks from DPA_ERROR to
DPA_INFO as a defensive fallback.

CMM: Cache route rejection (fpp_rejected flag) to avoid retrying
known-bad routes on every poll cycle. Flag is cleared on full offload
reset (interface reassignment), allowing fresh attempts with new
interface names.
2026-03-23 14:12:43 +01:00
Maurice Walker
ba004209ab build: add libxml2 include paths for native aarch64 build systems
When installing libxml2 (pkg install), files are placed in /usr/local, not /usr/obj/usr/src/arm64.aarch64/tmp/usr/local.
2026-03-20 03:14:00 +01:00
Tomaz Zaman
38f2d7741c build: fix SRCDIR collision in sub-Makefiles
Same issue as a906b7a (fand): the top-level Makefile exports
SRCDIR=/usr/src which leaks into sub-Makefiles that use SRCDIR
for their own local source directory. Remove the ?= conditional
so the local value is always used.
2026-03-15 02:23:20 +01:00
Tomaz Zaman
a5258dd258 build: use standard OPNsense paths (/usr/src, /usr/tools, /usr/deps)
Replace custom /build/ layout with standard OPNsense /usr/ hierarchy.
Add DEPSDIR variable to GATEWAY.conf. Make git pull non-fatal for NFS
setups. Update all Makefile paths, symlinks, and README instructions.
2026-03-15 02:23:20 +01:00
Maurice Walker
7243900204
fastpath/fmlib: fix SRCDIR
This is not the same SRCDIR as in the top-level Makefile. The SRCDIR of the top-level Makefile must not flow through to here.
2026-03-15 02:19:25 +01:00
Tomaz Zaman
3481c87698 build: forward SYSROOT/KSRCDIR to sub-makes, fix parallel clean race
- Pass SYSROOT and KSRCDIR from top-level Makefile to all Makefile.cross
  invocations so SRCTOP override flows through to sub-makes
- Add .ORDER directives to prevent "make -j clean all" race where clean
  deletes .ko files while modules target tries to copy them
- Remove redundant dist target (modules/userspace already copy to dist/)
- Fix package target depending on clean (raced with its own dist dep)
- Make IMAGESDIR/SETSDIR overridable with ?=
- Update mk-kernel-img.sh defaults from legacy /mnt/vision paths
- Replace MONO-GATEWAY with GATEWAY in all Makefile comments
- Remove stale patches/ from README directory tree
- Document SRCTOP override and make image shortcut in README
2026-03-14 15:07:06 +01:00
Tomaz Zaman
88a442d941 fmlib: remove ioctl headers, use kernel tree copy
Delete the 5 ioctl ABI headers that now live in opnsense-src at
sys/contrib/ncsw/inc/ioctls/.  Update fmlib, fmc, and dpa_app
Makefiles to include them from the kernel source tree via KSRCDIR.
2026-03-14 14:14:45 +01:00
Tomaz Zaman
d5060f404d CDX: fix MC4/MC6 reset commands, build and doc improvements
Add mc4_reset()/mc6_reset() handlers in CDX multicast command processor.
CMD_MC4_RESET and CMD_MC6_RESET were unhandled — the size check rejected
them (length 0 < MC4_MIN_COMMAND_SIZE) returning ERR_WRONG_COMMAND_SIZE.
Handle reset before the size check since it carries no payload.

Also: bump libxml2 to 2.15.2, remove sudo from make image (assumes root),
add -isystem for kernel headers in CMM cross-build, add cmmctl command
reference (CMM.md).
2026-03-14 00:39:52 +01:00
Tomaz Zaman
824daa1634 CMM: add multicast group offload module
Port NXP ASK multicast control plane to FreeBSD. CMM maintains a
shadow table of multicast groups and forwards add/remove/update
commands to CDX via FCI for hardware multicast replication.

CDX kernel-side support (cdx_mc_freebsd.c) was already ported;
this adds the userspace CMM module and cmmctl mc4/mc6 commands.
2026-03-13 21:22:59 +01:00
Tomaz Zaman
ed28c8320d CMM: align neighbor hash with NXP ASK design (256→2×2048 split buckets)
Match NXP's original neighbor_resolution.h layout: 2048 buckets for
IPv4, 2048 for IPv6, with IPv6 offset into the second half.
2026-03-13 21:07:55 +01:00
Tomaz Zaman
d1516d1953 CMM: align route hash with NXP ASK design (256→2×2048 split buckets)
Match NXP's original route_cache.h layout: 2048 buckets for IPv4,
2048 for IPv6, with IPv6 offset into the second half. Reduces
average chain length under load and eliminates cross-family
collisions that degraded lookup performance at scale.
2026-03-13 21:02:11 +01:00
Tomaz Zaman
ed6054cd77 CDX: multicast cleanup, dist FQR overflow guard, race fix
- 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
2026-03-13 20:16:52 +01:00
Tomaz Zaman
ce956d82b2 CMM: safety and correctness fixes from code review
- 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
2026-03-13 20:16:30 +01:00
Tomaz Zaman
3118b3c75f CMM: use fe_reset for offload state reset, filter address events
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.
2026-03-13 17:33:20 +01:00
Tomaz Zaman
5cc32242f0 CMM: full offload state reset on interface reassignment
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.
2026-03-13 15:55:21 +01:00
Tomaz Zaman
4408aa0ab8 PPPoE termination offload: session detection, flow offload, soft parser fix
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.
2026-03-13 15:55:21 +01:00
Tomaz Zaman
162890791d PPPoE termination offload: session detection, flow offload, soft parser fix
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.
2026-03-13 11:34:47 +01:00
Tomaz Zaman
c08fcc125b vendor/cdx: remove 25 unused files replaced by FreeBSD ports
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.
2026-03-12 13:03:37 +01:00
Tomaz Zaman
82bb31fb7a CDX/CMM: LAGG loadbalance failover with multi-port hash entries
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.
2026-03-11 01:19:44 +01:00
Tomaz Zaman
eebe159e1c CDX/CMM: add LAGG (link aggregation) support for hardware flow offload
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.
2026-03-10 00:28:03 +01:00
Tomaz Zaman
85d5debe29 CDX: fix VLAN hardware flow offload (3 bugs)
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).
2026-03-09 22:31:23 +01:00
Tomaz Zaman
ef5b163670 WiFi UAP: WPA3-SAE PMF fix, rc.d service, CMM loopback fix
- 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.
2026-03-06 21:59:21 +01:00
Tomaz Zaman
96a1d5ade8 WiFi offload: per-VAP FQs, SG inject, backpressure, debug control
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.
2026-03-06 12:24:24 +01:00
Tomaz Zaman
1bc132cc48 CDX: PLCR/KG miss fixup, per-CPU dist FQs, clean kldunload
- 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.
2026-03-05 23:49:54 +01:00
Tomaz Zaman
2339ecc091 Fix CAAM detach stale children, update CEETM and kernel patches 2026-03-03 21:05:53 +01:00
Tomaz Zaman
0ac9dbe362 Fix CAAM JR double enumeration, stale NOP interrupt, add make image target 2026-03-03 17:32:47 +01:00
Tomaz Zaman
d0764a8f5c Force clean build for package target, add CDX route diagnostics
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.
2026-03-02 14:37:31 +01:00
Tomaz Zaman
811da14fb4 Sync CDX hardware flow counters into PF state table via pfnotify ioctl 2026-02-27 01:38:14 +01:00
Tomaz Zaman
5514d65ac5 Hello world. 2026-02-25 15:13:46 +01:00