2026-02-25 00:58:56 +01:00
|
|
|
|
# Architecture Overview
|
|
|
|
|
|
|
|
|
|
|
|
Hardware flow offload stack for the Mono Gateway (NXP LS1046A / DPAA1).
|
|
|
|
|
|
Packets matching offloaded flows are forwarded entirely in FMan hardware,
|
|
|
|
|
|
bypassing the FreeBSD networking stack.
|
|
|
|
|
|
|
|
|
|
|
|
## System Diagram
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
┌────────────────────────────────────────────────────────────────┐
|
|
|
|
|
|
│ USERSPACE │
|
|
|
|
|
|
│ │
|
|
|
|
|
|
│ ┌─────────┐ ┌─────────┐ ┌──────────┐ ┌────────────┐ │
|
|
|
|
|
|
│ │ cmm │ │ dpa_app │ │ fand │ │ cmmctl │ │
|
|
|
|
|
|
│ │ │ │ │ │ │ │ │ │
|
|
|
|
|
|
│ │ offload │ │ PCD │ │ fan │ │ query/ctrl │ │
|
|
|
|
|
|
│ │ manager │ │ setup │ │ control │ │ tool │ │
|
|
|
|
|
|
│ └────┬────┘ └────┬────┘ └──────────┘ └─────┬──────┘ │
|
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
|
|
|
|
│ │FCI /dev/│fman + /dev/cdx_ctrl │socket │
|
2026-02-25 00:58:56 +01:00
|
|
|
|
│ ══════╪══════════════╪═══════════════════════════════╪═══════ │
|
|
|
|
|
|
│ KERNEL │ │ │
|
|
|
|
|
|
│ │ ┌────┴────┐ │ │
|
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
|
|
|
|
│ ┌────┴────┐ │ fman │ ┌────┴────┐ │
|
2026-02-25 00:58:56 +01:00
|
|
|
|
│ │ fci.ko │ │ chardev │ │ cmm │ │
|
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
|
|
|
|
│ │ │ │ │ │ ctrl │ │
|
2026-02-25 00:58:56 +01:00
|
|
|
|
│ │ cmd/evt │ └────┬────┘ │ socket │ │
|
|
|
|
|
|
│ │ channel │ │FM ioctl └─────────┘ │
|
|
|
|
|
|
│ └────┬────┘ ┌────┴────────────────────────┐ │
|
|
|
|
|
|
│ │ │ FreeBSD DPAA1 kernel │ │
|
|
|
|
|
|
│ ┌────┴────┐ │ (dtsec, QMan, BMan, FMan) │ │
|
|
|
|
|
|
│ │ cdx.ko │ └────┬────────────────────────┘ │
|
|
|
|
|
|
│ │ │ │ │
|
|
|
|
|
|
│ │ flow │ ┌────┴────┐ ┌────────────┐ ┌─────────────┐ │
|
|
|
|
|
|
│ │ engine │ │pf_notify│ │auto_bridge │ │ caam.ko │ │
|
|
|
|
|
|
│ └────┬────┘ │ .ko │ │ .ko │ │ (crypto) │ │
|
|
|
|
|
|
│ │ └────┬────┘ └─────┬──────┘ └─────────────┘ │
|
|
|
|
|
|
│ │ │ │ │
|
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
|
|
|
|
│ ══════╪══════════════╪═════════════╪══════════════════════════ │
|
|
|
|
|
|
│ HARDWARE │ │ │
|
|
|
|
|
|
│ │ │ │ │
|
2026-02-25 00:58:56 +01:00
|
|
|
|
│ ┌────┴──────────────┴─────────────┴──────────────────────┐ │
|
|
|
|
|
|
│ │ FMan Hardware │ │
|
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
|
|
|
|
│ │ PCD: Parser -> Classifier (KeyGen/CC) -> Distributor │ │
|
2026-02-25 00:58:56 +01:00
|
|
|
|
│ └────────────────────────────────────────────────────────┘ │
|
|
|
|
|
|
└────────────────────────────────────────────────────────────────┘
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## Boot Sequence
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
kernel boot
|
|
|
|
|
|
└─► kldload cdx fci pf_notify auto_bridge
|
|
|
|
|
|
└─► dpa_app /etc/cdx_pcd.xml /etc/cdx_cfg.xml /etc/cdx_sp.xml
|
Docs: hardware flow offload is opt-in and keeps pf's decisions
RELEASE.md: the "offload: off" section becomes "opt-in": how to turn cmm
on (in /etc/rc.conf.local, which overrides rc.conf), which flows go into
hardware and which stay in pf, what offloaded packets still skip
(Suricata, Insight/NetFlow, tcpdump), the reboot after an update, and
what was wrong with the vendor's offload.
ARCHITECTURE.md: pf_notify's RESYNC event, vetoes, route-to target and
orig_kif, the DELETE reserve, sloppy only for offloaded states, and the
flow lifecycle with the offload conditions; the PF_KEY socket is gone
with the IPsec code; cmm only starts with cmm_enable="YES".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 02:08:48 -05:00
|
|
|
|
└─► service cmm start (only with cmm_enable="YES"; images
|
2026-11-28 04:16:25 -05:00
|
|
|
|
ship "NO", see README.md)
|
2026-02-25 00:58:56 +01:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## Fastpath Modules
|
|
|
|
|
|
|
|
|
|
|
|
### cdx.ko — Flow Offload Engine (kernel module)
|
|
|
|
|
|
|
|
|
|
|
|
The core datapath acceleration module. Receives conntrack and route
|
|
|
|
|
|
registrations from CMM via FCI, installs flow entries in FMan's
|
|
|
|
|
|
enhanced hash tables, and executes packet transformations (NAT,
|
|
|
|
|
|
TTL decrement, MAC rewrite) in hardware.
|
|
|
|
|
|
|
|
|
|
|
|
- **Timer wheel**: Ages out idle flows (TCP ~12h, UDP unidir ~5min)
|
|
|
|
|
|
- **Miss path**: Unmatched packets enqueue to dtsec default RX FQID (software path)
|
|
|
|
|
|
- **Notifications**: Sends `CONNTRACK_CHANGE` events back to CMM via FCI when flows expire
|
|
|
|
|
|
|
|
|
|
|
|
Source: `fastpath/cdx/` + `fastpath/vendor/cdx/`
|
|
|
|
|
|
|
|
|
|
|
|
### fci.ko — Fast Control Interface (kernel module)
|
|
|
|
|
|
|
|
|
|
|
|
IPC channel between userspace (CMM) and kernel (CDX). Provides:
|
|
|
|
|
|
|
|
|
|
|
|
- **Command path** (CMM → CDX): register/deregister routes, conntrack entries, L2 flows
|
|
|
|
|
|
- **Event path** (CDX → CMM): flow timeout notifications, TCP FIN events
|
|
|
|
|
|
- **Mechanism**: chardev with ioctl for commands, ring buffer + kqueue for async events
|
|
|
|
|
|
|
|
|
|
|
|
Source: `fastpath/fci/`
|
|
|
|
|
|
|
|
|
|
|
|
### pf_notify.ko — PF State Event Bridge (kernel module)
|
|
|
|
|
|
|
|
|
|
|
|
Hooks into the PF firewall to push state change events to userspace:
|
|
|
|
|
|
|
|
|
|
|
|
- `PFN_EVENT_INSERT` — new state created
|
|
|
|
|
|
- `PFN_EVENT_READY` — state became offload-eligible (TCP ESTABLISHED)
|
|
|
|
|
|
- `PFN_EVENT_DELETE` — state removed by PF
|
Docs: hardware flow offload is opt-in and keeps pf's decisions
RELEASE.md: the "offload: off" section becomes "opt-in": how to turn cmm
on (in /etc/rc.conf.local, which overrides rc.conf), which flows go into
hardware and which stay in pf, what offloaded packets still skip
(Suricata, Insight/NetFlow, tcpdump), the reboot after an update, and
what was wrong with the vendor's offload.
ARCHITECTURE.md: pf_notify's RESYNC event, vetoes, route-to target and
orig_kif, the DELETE reserve, sloppy only for offloaded states, and the
flow lifecycle with the offload conditions; the PF_KEY socket is gone
with the IPsec code; cmm only starts with cmm_enable="YES".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 02:08:48 -05:00
|
|
|
|
- `PFN_EVENT_RESYNC` — DELETE events were lost: CMM drops every hardware
|
|
|
|
|
|
flow and starts over (`net.pfnotify.resyncs`)
|
|
|
|
|
|
|
|
|
|
|
|
Each event carries the state's keys, the interface it was created on
|
|
|
|
|
|
(`orig_kif`; a floating state's own interface is `all`), its route-to or
|
|
|
|
|
|
reply-to target, and a veto mask (`PFN_VETO_*`) for rule actions only
|
|
|
|
|
|
pf_test() can carry out per packet: dup-to, another FIB, a dummynet pipe
|
|
|
|
|
|
or queue, ALTQ, `log (all)` or pflow, scrub options, set-tos, max-mss,
|
2026-11-28 04:22:57 -05:00
|
|
|
|
min-ttl, max-pkt-size, af-to. CMM never offloads a vetoed flow.
|
2026-02-25 00:58:56 +01:00
|
|
|
|
|
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
|
|
|
|
Exposes `/dev/pfnotify` (read-write, non-blocking). Required by CMM —
|
|
|
|
|
|
CMM will not start without this module loaded. Uses a 128K-entry ring
|
Docs: hardware flow offload is opt-in and keeps pf's decisions
RELEASE.md: the "offload: off" section becomes "opt-in": how to turn cmm
on (in /etc/rc.conf.local, which overrides rc.conf), which flows go into
hardware and which stay in pf, what offloaded packets still skip
(Suricata, Insight/NetFlow, tcpdump), the reboot after an update, and
what was wrong with the vendor's offload.
ARCHITECTURE.md: pf_notify's RESYNC event, vetoes, route-to target and
orig_kif, the DELETE reserve, sloppy only for offloaded states, and the
flow lifecycle with the offload conditions; the PF_KEY socket is gone
with the IPsec code; cmm only starts with cmm_enable="YES".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 02:08:48 -05:00
|
|
|
|
buffer, of which 4096 entries are kept for DELETEs, with one-shot READY
|
|
|
|
|
|
semantics: dropped events re-fire on the next packet, eliminating the
|
|
|
|
|
|
need for polling fallback. CMM reports the states it put into hardware
|
|
|
|
|
|
(`PFN_IOC_OFFLOADED`); only those are made sloppy, as their TCP windows
|
|
|
|
|
|
stop being tracked. `PFN_IOC_UPDATE_COUNTERS` adds the hardware's packet
|
|
|
|
|
|
counts to the states, which keeps them from expiring while FMan forwards.
|
|
|
|
|
|
|
|
|
|
|
|
The event layout is shared with CMM (`pf_notify.h`). A CMM and a
|
|
|
|
|
|
pf_notify.ko from different builds get only short reads and offload
|
|
|
|
|
|
nothing, so reboot after updating `mono-gateway`.
|
2026-02-25 00:58:56 +01:00
|
|
|
|
|
|
|
|
|
|
Source: `fastpath/pf_notify/`
|
|
|
|
|
|
|
|
|
|
|
|
### auto_bridge.ko — L2 Bridge Flow Offload (kernel module)
|
|
|
|
|
|
|
|
|
|
|
|
Captures L2 forwarding decisions from the FreeBSD bridge and
|
|
|
|
|
|
exposes them to CMM for hardware offload. Exposes `/dev/autobridge`.
|
|
|
|
|
|
|
|
|
|
|
|
Source: `fastpath/auto_bridge/`
|
|
|
|
|
|
|
|
|
|
|
|
### cmm — Connection Management Module (userspace daemon)
|
|
|
|
|
|
|
|
|
|
|
|
The orchestrator. Monitors PF state and routing tables, resolves
|
|
|
|
|
|
next-hop neighbors, and programs CDX with offload entries.
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
┌──────────────┐
|
|
|
|
|
|
/dev/pfnotify │ │ FCI commands
|
|
|
|
|
|
PF state poll │ CMM ├──────────────► cdx.ko
|
|
|
|
|
|
route socket │ │
|
Docs: hardware flow offload is opt-in and keeps pf's decisions
RELEASE.md: the "offload: off" section becomes "opt-in": how to turn cmm
on (in /etc/rc.conf.local, which overrides rc.conf), which flows go into
hardware and which stay in pf, what offloaded packets still skip
(Suricata, Insight/NetFlow, tcpdump), the reboot after an update, and
what was wrong with the vendor's offload.
ARCHITECTURE.md: pf_notify's RESYNC event, vetoes, route-to target and
orig_kif, the DELETE reserve, sloppy only for offloaded states, and the
flow lifecycle with the offload conditions; the PF_KEY socket is gone
with the IPsec code; cmm only starts with cmm_enable="YES".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 02:08:48 -05:00
|
|
|
|
│ event loop │◄────────────── FCI events
|
2026-02-25 00:58:56 +01:00
|
|
|
|
/dev/autobridge│ (kqueue) │ (flow timeout)
|
|
|
|
|
|
ctrl socket │ │
|
|
|
|
|
|
└──────────────┘
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
**Flow lifecycle**:
|
Docs: hardware flow offload is opt-in and keeps pf's decisions
RELEASE.md: the "offload: off" section becomes "opt-in": how to turn cmm
on (in /etc/rc.conf.local, which overrides rc.conf), which flows go into
hardware and which stay in pf, what offloaded packets still skip
(Suricata, Insight/NetFlow, tcpdump), the reboot after an update, and
what was wrong with the vendor's offload.
ARCHITECTURE.md: pf_notify's RESYNC event, vetoes, route-to target and
orig_kif, the DELETE reserve, sloppy only for offloaded states, and the
flow lifecycle with the offload conditions; the PF_KEY socket is gone
with the IPsec code; cmm only starts with cmm_enable="YES".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 02:08:48 -05:00
|
|
|
|
1. PF creates the flow's states (in on the ingress interface, out on the
|
|
|
|
|
|
egress one) → pfnotify READY for each → CMM pairs them and resolves
|
|
|
|
|
|
route + neighbor
|
|
|
|
|
|
2. CMM offloads only if neither state is vetoed, both were seen, each
|
|
|
|
|
|
direction's route leaves by the interface PF's state for it is on,
|
|
|
|
|
|
and a route-to (original direction) or reply-to (reply) names the
|
|
|
|
|
|
same interface and next hop as that route
|
|
|
|
|
|
3. CMM sends route + conntrack to CDX via FCI → flow in hardware, and
|
|
|
|
|
|
reports the two states to pf_notify (sloppy from then on)
|
|
|
|
|
|
4. Packets forwarded at line rate by FMan, bypassing stack; their
|
|
|
|
|
|
counters are synced back into PF's states
|
|
|
|
|
|
5. PF deletes a state (close, timeout, `pfctl -k`) → DELETE → CMM removes
|
|
|
|
|
|
the flow from hardware
|
|
|
|
|
|
6. CDX timer expires or TCP FIN → FCI event → CMM clears offload flag
|
2026-11-28 04:22:57 -05:00
|
|
|
|
7. A route change, or a next hop's MAC changing in the ARP/NDP table
|
|
|
|
|
|
(checked every 30s), tears down the flows using it; while PF's states
|
|
|
|
|
|
are alive, the maintenance timer (30s) re-runs step 2 and re-offloads
|
2026-02-25 00:58:56 +01:00
|
|
|
|
|
|
|
|
|
|
Source: `fastpath/cmm/`
|
|
|
|
|
|
|
|
|
|
|
|
### cmmctl — CMM Control Tool (userspace)
|
|
|
|
|
|
|
|
|
|
|
|
CLI tool to query CMM state (offloaded connections, routes, stats)
|
|
|
|
|
|
via a unix domain socket.
|
|
|
|
|
|
|
|
|
|
|
|
Source: `fastpath/cmmctl/`
|
|
|
|
|
|
|
|
|
|
|
|
### dpa_app — PCD Configuration Tool (userspace)
|
|
|
|
|
|
|
|
|
|
|
|
Loads FMan Parser/Classification/Distribution configuration from
|
|
|
|
|
|
XML files via the FMan chardev. Sets up the KeyGen hash schemes
|
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
|
|
|
|
and CC tree, then hands table handles to CDX via `/dev/cdx_ctrl` ioctl
|
|
|
|
|
|
so CDX knows where to insert per-flow entries at runtime.
|
2026-02-25 00:58:56 +01:00
|
|
|
|
|
|
|
|
|
|
Depends on: fmlib (FMan API), fmc (XML parser/compiler)
|
|
|
|
|
|
|
|
|
|
|
|
Source: `fastpath/dpa_app/`, `fastpath/fmc/`, `fastpath/fmlib/`
|
|
|
|
|
|
|
|
|
|
|
|
## Hardware Drivers
|
|
|
|
|
|
|
|
|
|
|
|
### emc2302.ko — Fan Controller
|
|
|
|
|
|
|
|
|
|
|
|
I2C driver for EMC2302 fan controller. Exposes sysctl interface
|
|
|
|
|
|
for fan RPM reading and PWM duty cycle control.
|
|
|
|
|
|
|
|
|
|
|
|
Source: `drivers/emc2302/`
|
|
|
|
|
|
|
|
|
|
|
|
### ina2xx.ko — Power Monitor
|
|
|
|
|
|
|
|
|
|
|
|
I2C driver for INA226/INA219 current/voltage/power monitors.
|
|
|
|
|
|
Exposes sysctl interface for voltage, current, and power readings.
|
|
|
|
|
|
|
|
|
|
|
|
Source: `drivers/ina2xx/`
|
|
|
|
|
|
|
|
|
|
|
|
### lp5812.ko — RGB LED Controller
|
|
|
|
|
|
|
|
|
|
|
|
I2C driver for TI LP5812 LED controller. Drives the board's
|
|
|
|
|
|
RGB status LEDs.
|
|
|
|
|
|
|
|
|
|
|
|
Source: `drivers/lp5812/`
|
|
|
|
|
|
|
|
|
|
|
|
### sfpled.ko — SFP+ Link LEDs
|
|
|
|
|
|
|
|
|
|
|
|
GPIO-based LED driver that reflects SFP+ link state on
|
|
|
|
|
|
front-panel LEDs by polling dtsec link status.
|
|
|
|
|
|
|
|
|
|
|
|
Source: `drivers/sfp-led/`
|
|
|
|
|
|
|
|
|
|
|
|
### fand — Fan Control Daemon (userspace)
|
|
|
|
|
|
|
|
|
|
|
|
Reads temperature sensors and adjusts fan speed via emc2302
|
|
|
|
|
|
sysctl interface. Runs as a daemon.
|
|
|
|
|
|
|
|
|
|
|
|
Source: `drivers/fand/`
|
|
|
|
|
|
|
|
|
|
|
|
## Data Flow: Packet Through Hardware Offload
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
Wire ──► FMan RX Port
|
|
|
|
|
|
│
|
|
|
|
|
|
▼
|
|
|
|
|
|
Parser (extract L3/L4 headers)
|
|
|
|
|
|
│
|
|
|
|
|
|
▼
|
|
|
|
|
|
KeyGen (hash IP src/dst + L4 ports)
|
|
|
|
|
|
│
|
|
|
|
|
|
▼
|
|
|
|
|
|
CC Hash Table lookup
|
|
|
|
|
|
╱ ╲
|
|
|
|
|
|
HIT MISS
|
|
|
|
|
|
│ │
|
|
|
|
|
|
▼ ▼
|
|
|
|
|
|
CDX opcodes Default RX FQID
|
|
|
|
|
|
(NAT rewrite, (FreeBSD stack)
|
|
|
|
|
|
TTL dec, │
|
|
|
|
|
|
MAC rewrite) ▼
|
|
|
|
|
|
│ PF firewall
|
|
|
|
|
|
▼ routing
|
|
|
|
|
|
FMan TX Port if_output
|
|
|
|
|
|
│ │
|
|
|
|
|
|
▼ ▼
|
|
|
|
|
|
Wire Wire
|
|
|
|
|
|
(line rate) (software path)
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
## IPC Summary
|
|
|
|
|
|
|
|
|
|
|
|
| Path | Mechanism | Purpose |
|
|
|
|
|
|
|------|-----------|---------|
|
|
|
|
|
|
| CMM → CDX | FCI ioctl | Register/deregister routes, conntrack, L2 flows |
|
|
|
|
|
|
| CDX → CMM | FCI ring + kqueue | Flow timeout, TCP FIN notifications |
|
|
|
|
|
|
| PF → CMM | /dev/pfnotify | State insert/ready/delete events |
|
|
|
|
|
|
| CMM ← PF | DIOCGETSTATESV2 ioctl | Periodic state table poll (fallback) |
|
|
|
|
|
|
| CMM ← routing | PF_ROUTE socket | Route/neighbor/interface changes |
|
|
|
|
|
|
| CMM ← bridge | /dev/autobridge | L2 flow learning events |
|
|
|
|
|
|
| cmmctl → CMM | Unix socket | Query/control commands |
|
|
|
|
|
|
| dpa_app → FMan | /dev/fman chardev | PCD configuration (XML → hardware) |
|
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
|
|
|
|
| dpa_app → CDX | /dev/cdx_ctrl ioctl | Hand over table handles after PCD setup |
|