Change GATEWAY kernel config from UFS root to ZFS root (pool0/ROOT/default).
ZFS is compiled into the kernel since booti direct boot has no FreeBSD loader
to load modules. Disable kern.geom.label.disk_ident.enable so GPT labels
work cleanly with ZFS.
Remove printf from fman chardev ioctl default cases. ZFS GEOM probes all
character devices with DIOCGMEDIASIZE (0x40086481) at boot, generating ~32
spurious "unknown ioctl" messages. ENOTTY is the correct response and the
printf serves no diagnostic purpose.
Move ~900 lines of SFP management code (GPIO polling, EEPROM reading,
RollBall I2C-MDIO PHY probing, auto-negotiation, link monitoring) from
the dtsec MAC driver into the sfp_fdt framework driver.
sfp_fdt now implements a full state machine (EMPTY → PROBE → PRESENT →
PHY_PROBE/WAIT_LOS → PHY_AN/DDM_POLL → LINK_UP) that handles module
detection, identification, and link management for any MAC driver with
SFP+ cages. MAC drivers register a callback table (sfp_upstream_ops)
via SFF_REGISTER_UPSTREAM() and receive module_insert, module_remove,
link_up, and link_down events.
dtsec is reduced to ~50 lines of callback implementations that update
interface link state and store module info for sysctl reporting.
Tested on hardware with both fiber (FLEXOPTIX DAC) and copper (FS.com
10GBASE-T with AQR113C PHY via RollBall) modules at 10 Gbps.
Add support for copper (RJ45) SFP+ modules with embedded PHYs.
These modules use Clause 45 MDIO registers accessed via an I2C-to-MDIO
bridge for PHY management, auto-negotiation, and link status polling.
Two bridge protocols are supported with automatic detection:
- RollBall (I2C addr 0x51, page 3, command-based)
- Standard I2C-MDIO (I2C addr 0x56, SFF-8472)
PHY probe runs on module insertion for RJ45 connectors, configures
auto-negotiation (10G/5G/2.5G/1G advertisement with Extended Next Page),
and polls PMA/PMD link status at 1Hz via taskqueue. Speed detection
uses AN 10GBT_STAT for multi-gig and PMA/PMD CTRL1 as fallback.
For copper modules without accessible PHY (autonomous operation),
falls back to DDM RX_LOS polling for link state detection.
Also fixes three GPIO issues that prevented copper modules from working:
- TX_DISABLE pin direction must be set to OUTPUT explicitly
- TX_DISABLE polarity inverted due to board hardware inverter
- Module PHY stays inactive until TX_DISABLE is properly deasserted
Verified at 10 Gbps (9.4 Gbps iperf3) with FS.com SFP-10G-T (AQR113C)
and Intel X550 link partner over Cat6e cable.
Use LINK_STATE_UNKNOWN for no-module state (instead of DOWN) so the
sfpled driver can distinguish "no module" from "module present, no
link". For copper PHY modules (RJ45 connector type 0x22), ignore
LOS GPIO — these modules deassert LOS when powered up regardless
of copper link negotiation status. Always report LINK_STATE_DOWN
for RJ45 modules until a PHY driver can negotiate.
Wire SFP infrastructure into dtsec so 10GbE ports detect module
insertion/removal via mod-def0 GPIO polling, read the SFP EEPROM
for identification, control TX enable/disable, and report accurate
link status via LOS GPIO instead of hardcoding link as always up.
Module presence is polled at 1Hz in the existing tick callout.
EEPROM reads are deferred to taskqueue_thread since I2C can sleep.
Insert task re-checks module presence under DTSEC_LOCK to handle
races with hot-removal during EEPROM read.
Adds dev.dtsec.N.sfp_info sysctl for module vendor and part number.
No DTS changes needed — sfp phandle, GPIOs, and i2c-bus are already
defined in mono-gateway-dk.dts.
Move the 5 fmlib ioctl ABI headers (fm_pcd_ioctls.h, fm_ioctls.h,
net_ioctls.h, ioctls.h, integration_ioctls.h) from the external
opnsense-deps repo into sys/contrib/ncsw/inc/ioctls/. This makes the
kernel buildable without depending on a sibling repository.
Merge FMCD_COMPILE_CMD into DPAA_COMPILE_CMD since it only added a
single -I path; fman_chardev.c now compiles with the same flags as all
other DPAA source files.
LAGG member ports are enabled via SIOCSIFFLAGS -> dtsec_if_enable_locked(),
not dtsec_if_init_locked(). The MII tick callout was only started in the
init path, so LAGG member ports never got periodic PHY polling. Without
the tick, link state changes (cable unplug/replug) were never detected
and RTM_IFINFO was never generated.
Start callout_reset in dtsec_if_enable_locked() so member ports get the
same periodic PHY polling as standalone ports. Also reprogram the hardware
MAC address via FM_MAC_ModifyMacAddr() since LAGG changes the stack MAC
via if_setlladdr() then cycles SIOCSIFFLAGS.
dpaa_oh: Add per-VAP distribution FQ registry so CDX can route WiFi
download frames to hash-distributed FQIDs. Add dist fallback callback
for frames with unrecognized BPIDs on OH dist FQs. Return EBUSY from
dpaa_oh_enqueue when EQCR ring is full so callers can retry. Free
dtsec buffers in error callback to prevent BMan pool drain.
if_dtsec: Export dtsec_rm_pool_rx_refill_bpid for external callers
(dpaa_wifi, dpaa_oh, CDX) that consume dtsec BMan pool buffers.
fm_ehash: Rewrite ModifyMissNextEngine to match Linux SDK two-phase
pattern (DROP→update→real action). Support KG (with CC_EN), PLCR
(shared profile), and DONE engines. Remove verify-retry loop and CC
tree copy propagation — single WRITE_UINT32 per word suffices with
the two-phase approach.
qman_portals: Add qman_portal_quiesce() to drain all per-CPU portal
poll taskqueues. Called after FQR retire to ensure no in-flight
QM_PORTAL_Poll references a stale callback from an unloading module.
if_dtsec_rm: Add dtsec_rm_pool_rx_refill_bpid() for external callers
(CDX dist FQ callback) to trigger BMan pool refill by BPID.
dpaa_oh: Add distribution FQ callback registry (register/unregister/
lookup by BPID) for OH port consumers (WiFi, IPsec) to receive
frames from CDX distribution FQs. Add MODULE_VERSION.
Add dtsec_rm_buf_free_external() for dpaa_wifi.ko to release BMan
buffers from dtsec RX pools back to the correct UMA zone. Route
M_PROTO1-tagged mbufs to if_transmit in QMan portal drain path.
Process gpio-hog child nodes during gpiobus attach to configure pins
at boot. Used on Mono Gateway for WiFi module enable (2R-enable),
3R-disable, and UART mux routing.
- qoriq_dw_pci: byte-swap CCSR register access for big-endian controller
- pci_dw: lane configuration support for proper link training
- DTS: enable PCIe3 for WiFi module (88W9098)
Firmware-based SGMII PHY used on the Mono Gateway (3x 1GbE ports).
Key differences from standard PHY drivers:
- No BMCR reset (kills firmware, darkens LEDs)
- SGMII auto-negotiation via MMD VEND1 register
- Status read from MIISTAT instead of BMSR
OH ports provide hardware packet processing pipelines for IPsec and
WiFi offload via CDX. Port assignment matches Linux SDK: cell-index 3
(IPsec), cell-index 4 (WiFi). Cell-index 2 reserved for Host Command.
Add the main DPAA1 Ethernet driver using the NCSW FM_MAC API for
mEMAC (LS1046A FManv3). Implements TX/RX via QMan frame queues and
BMan buffer pools with scatter-gather support.
Features: TX checksum offload (RPD+DTC), RX checksum validation with
PCD parser, 128-FQID RSS via FMan KeyGen, deferred RX delivery via
mbufq to prevent SMP hard lockups from nested NCSW_PLOCK, per-port
BMan buffer pool with consumption model and in-flight cap.
Includes mEMAC external MDIO controller for PHY management.
Add the FreeBSD bus driver wrappers that bridge NCSW to the kernel
device tree. BMan and QMan portal drivers handle multi-CPU
initialization with explicit CPU binding (sched_bind unavailable
during attach). FMan driver configures the frame manager hardware,
reserved-memory regions (PFDR/FQD/FBPR via no-map DT nodes), and
MURAM allocation.
Portal common infrastructure provides shared init and cache-inhibited
mapping for both BMan and QMan portals.
Add the MONO-GATEWAY kernel configuration for the NXP LS1046A-based
Mono Gateway Development Kit. Based on GENERIC with OPNsense standard
features, DPAA1 build infrastructure (empty file list for now), and
early printf via QorIQ ns16550.
Add the mono-gateway-dk.dts device tree covering the full SoC and board
peripherals (DPAA1 FMan/QMan/BMan, I2C mux tree, GPIO, UART, eMMC, QSPI,
SFP+ cages, and reserved memory regions).
Add ARM64 I/O stubs (pio.h) for NCSW compatibility, EARLY_PRINTF qoriq
type registration, CAAM RNG entropy source enum, and qoriq_therm build
fix (remove spurious pci dependency).
The channel buffer mapped by dsp_mmap_single() may be freed when the
device handle is closed, but the mapping persists beyond that, allowing
userspace to read or write memory owned by a different consumer.
Fix the problem by adding a reference counter to the sound buffer.
Define pager ops for the VM object returned by dsp_mmap_single() and use
them to manage the extra reference.
Add a regression test.
Approved by: so
Security: FreeBSD-SA-26:27.sound
Security: CVE-2026-49417
Reported by: Lexpl0it, 75Acol, Liyw979, Rob1n
Reviewed by kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57393
The netmap_ring struct starts with various const members and rencent
clang warns about leaving them uninitialized. Having them const in the
first place is highly suspicious since they are updated with various
macros but using hand-coded __DECONST(). But fixing that is a more
invasive change that I am unable to test.
```
.../freebsd/sys/dev/netmap/netmap_kloop.c:320:21: error: default initialization of an object of type 'struct netmap_ring' with const member leaves the object uninitialized [-Werror,-Wdefault-const-init-field-unsafe]
320 | struct netmap_ring shadow_ring; /* shadow copy of the netmap_ring */
| ^
.../freebsd/sys/net/netmap.h:290:16: note: member 'buf_ofs' declared 'const' here
290 | const int64_t buf_ofs;
| ^
```
Test Plan: Compiles
Reviewed by: vmaffione, jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D52568
(cherry picked from commit 2ed21f90906b230476d3f12ff9dce0e2c4642af2)
Both of the aforementioned macros have been present in FreeBSD
for well over a decade: 2009 for `KOBJMETHOD_END`; 2011 for
`DEVMETHOD_END`.
Adapt all hardcoded references of `{0, 0}` with `DEVMETHOD_END`
and `KOBJMETHOD_END` as appropriate. This helps ensure that
future adaptations to drivers following patterns documented
in driver(9) can be made more easily/without issue.
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D55414
MFC notes:
All conflicts were dropped as they didn't apply to code in branch.
Conflicts:
sys/dev/flash/w25n.c
sys/dev/nvd/nvd.c
sys/dev/nvme/nvme_sim.c
sys/dev/sound/pci/hdsp-pcm.c
sys/dev/sound/pci/hdsp.c
sys/dev/ufshci/ufshci_pci.c
(cherry picked from commit 0fc6c3f731a2cca3120798806c330a3081c9424b)
Focus on the MRQE field of the MRQC register, which is 4 bits wide,
and we use these 3 types of values.
- IXGBE_MRQC_RSSEN 0x1 (non VF mode)
- IXGBE_MRQC_VMDQRSS32EN 0xA (less than 33 VFs)
- IXGBE_MRQC_VMDQRSS64EN 0xB (less than 65 VFs)
If we always take a bitwise OR with IXGBE_MRQC_RSSEN,
IXGBE_MRQC_VMDQRSS32EN will never be chosen.
Select these 3 types of values for the proper case.
Signed-off-by: Yuichiro NAITO <naito.yuichiro@gmail.com>
Pull Request: https://github.com/freebsd/freebsd-src/pull/2132
(cherry picked from commit 938c076b9b0bc458a3877b52535527d37199fc09)
This corresponds to Linux f74dc880098b4a29f76d756b888fb31d81ad9a0c
That commit does not provide any public background detail, but it's been
in use for over 5 years and corresponds to previous chip bugs w.r.t.
automatic generation of PAUSE frames.
Reviewed by: kgalazka
Differential Revision: https://reviews.freebsd.org/D54555
(cherry picked from commit 2bdec2ee73be7dbafce9982b0dc5c273918a5443)
Use sbuf_new_for_sysctl() instead of sbuf_new_auto() when exposing
the flags via sysctl.
(cherry picked from commit 8da838ac31692e381adfc63d83ea49f2adabbf23)
Right now the 64-bit flags field needs to be casted to a 32-bit field,
because clang warns if more than 32-bits are used.
Once clang is fixed, this restriction will be removed and more bits
will be added.
Reviewed by: markj, Timo Völker
Differential Revision: https://reviews.freebsd.org/D54288
(cherry picked from commit 634d9c0d111b630c3d63a1cf25d15c32a37afab8)
Provide the flags used for a vtnet interface via the sysctl tree.
This is mostly used for debugging purposes.
Reviewed by: Timo Völker
Differential Revision: https://reviews.freebsd.org/D54283
(cherry picked from commit e3a0571ad74d8429a95fcae9efc1d91cc109a337)
This allows adding flags in the upper 32 bits in a consistent way.
No functional change intended.
(cherry picked from commit e0c6c4ecfc755b78ac9135033053d2f15c62bf04)
In the ice_if_promisc_set function, the driver currently disables the
IFF_ALLMULTI flag, thereby preventing the activation of multicast mode.
To address this issue, implement appropriate handling to ensure the
flag is managed correctly.
Signed-off-by: Yogesh Bhosale <yogesh.bhosale@intel.com>
Tested by: Gowthamkumar K S <gowtham.kumar.ks@intel.com>
Differential Revision: https://reviews.freebsd.org/D54186
(cherry picked from commit 98bdf63f6e94be42a1787de73608de15bcb3419a)
The variable reg_rctl stores the value read from reg E1000_RCTL. It
may contain bits E1000_RCTL_VFE and E1000_RCTL_CFIEN which control
VLAN hardware filter feature. The promiscuous mode implies all tagged
or untagged packets should be accepted, so the VLAN hardware filter
feature should be disabled when enabling the promiscuous mode.
Calling em_if_vlan_filter_disable() did the task, but later writing
the value of reg_rctl back to the reg E1000_RCTL may restore the
feature.
Move the calling of em_if_vlan_filter_disable() after writing the reg
to fix that.
PR: 292759
Reviewed by: kbowling
Tested by: vova@zote.me
Fixes: 2796f7cab1 e1000: Fix up HW vlan ops
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D54973
(cherry picked from commit e63ee5fedb8dab51f1bd6d24cc650b68d9663db5)
(cherry picked from commit 8880678b7a)
We've gotten a report of this breaking a fixed no autoneg setup.
Since no link is worse than what this intends to fix (negotiating full
duplex at forced speed), revert for the undeway 15.0 release cycle
until this can be further reviewed.
PR: 288827
Differential Revision: https://reviews.freebsd.org/D47336
This reverts commit 645c45e297.
(cherry picked from commit 3ff0231c87)
Enabled qat driver support for 402xx device with
ID 0x4944/0x4945. This is an additional device supported
under the existing qat_4xxx driver. Firmwares specific to
the 402xx device are added.
Signed-off-by: Hareshx Sankar Raj <hareshx.sankar.raj@intel.com>
Relnotes: yes
Sponsored by: Intel Corporation
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D52488
(cherry picked from commit 7fbd362c091b2b384d14c3ed5af9234bb2eff9c2)
It is not clear how commit ded037e65e could reasonably change BAR
indices, and doing so broke at least the C3000 driver. Revert that part
of the change.
Reported by: kp
Reviewed by: kp, Haresh Sankar Raj <hareshx.sankar.raj@intel.com>
MFC after: 3 days
Fixes: ded037e65e ("qat: driver updates to improve code and fix bugs")
Differential Revision: https://reviews.freebsd.org/D51664
(cherry picked from commit 4a8e62a120)
API files are updated to have SPDX identifier and remove
longer form of license to ensure consistency with the
license format across all files.
Reviewed by: markj, ziaee
MFC after: 2 weeks
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D50379
(cherry picked from commit 2542189532)
Error handling in qat driver code has been refactored.
Mutex lock handling has also been added during driver
attach and detach. Also pci_disable_busmaster() is called in
adf_detach() to ensure proper cleanup during device detachment.
Reviewed by: markj, ziaee
MFC after: 2 weeks
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D50379
(cherry picked from commit ae1dc27639)
Bug fixes and improvements are done for the qat code base
to improve code quality.
Reviewed by: markj, ziaee
MFC after: 2 weeks
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D50379
(cherry picked from commit ded037e65e)
Currently code from sal_instances.c and sal_crypto.c
for getting cy instances or number of instances is duplicated.
This commit replaces cpaCyGetXXXInstances implementation with
Lac_GetCyXXXInstancesByType invocation.
Reviewed by: markj, ziaee
MFC after: 2 weeks
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D50379
(cherry picked from commit e745eee59c)
Access to crucial QAT driver internals, such as
firmware counters and transport debug via
sysctl, has been limited to privileged users only.
Reviewed by: markj, ziaee
MFC after: 2 weeks
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D50379
(cherry picked from commit 8aa51e6d7d)
Moved handling of debugfs entries to a separate file.
In addition, it will allow to consolidate the addition of
debugfs entries to a single location in the code.
This implementation adds infrastructure to create (and remove)
debugfs entries at two different stages.
- Done when a device is probed, allows to keep debugfs entries
persistent between a transition in device state (up to down or
vice versa).
- Done after the initialization phase, allows to have debugfs
entries that are accessible only when the device is up.
In addition, moved the creation of debugfs entries for configuration
of the newly created function adf_dbgfs_init() and replace symbolic
permissions with octal permissions when creating the debugfs files.
Added sysctl oids storage for proper cleanup on device down.
Reviewed by: markj, ziaee
MFC after: 2 weeks
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D50379
(cherry picked from commit c38bafee7e)
Some capabilities were not properly fused out based on
the hardware slices. Hence updated the function accordingly.
Both PF and VF are changed.
This change also streamlines capability handling for SYM service:
- Lack of UCS slice does not mean that CIPHER capabilities are not
available.
- SYM capabilities should be considered disabled only if both
AUTH and CIPHER capabilities are not present.
- AUTH capability shouldn't disable CIPHER.
SMX slice mask for qat_4xxx is also corrected to check for
both SM3 and SM4 support.
Reviewed by: markj, ziaee
MFC after: 2 weeks
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D50379
(cherry picked from commit 4da5c15e5c)
Multiple typos are corrected across the source code.
Formatting corrections are done to improve code quality
and maintainability. Some files which did not have proper
Copyright license are updated.
Reviewed by: markj, ziaee
MFC after: 2 weeks
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D50379
(cherry picked from commit 25f09d4a9c)
Like lkpi_pci_get_domain_bus_and_slot() implement lkpi_pci_get_slot()
using pci_find_bsf() instead of pci_find_dbsf() (no domain).
This is needed for a wireless driver.
Unfortunately the name [pci_get_slot()] collides with the native PCI
function. Add a guard around it and disable the use when the native
version is required (in lkpifill_pci_dev() and in bnxt/bnxt_en; if the
latter gets fixed we can probably also fix work around it in the former;
further conflicts in drm-kmod 6.1-lts, 6.6-lts, and master were resolved).
Sponsored by: The FreeBSD Foundation (initially)
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D52065
(cherry picked from commit 4179e6b78297369f0cf0eae1076e01e5151c5cbe)
(cherry picked from commit 62c3b77d1d)
With Linux 6.16 from_timer() got renamed to timer_container_of(); add
the LINUXKPI_VERSION check with a default to the current version.
Update all in-tree consumers (apart from wireless drivers managed
otherwise).
Sponsored by: The FreeBSD Foundation (initially)
Reviewed by: dumbbell
Differential Revision: https://reviews.freebsd.org/D52073
(cherry picked from commit 81cb7c4c8e7bc4951c77fe64a63a847ed6abee38)
(cherry picked from commit 352be5b48b)