Commit graph

43280 commits

Author SHA1 Message Date
Tomaz Zaman
245855e7c5 zfs: switch root filesystem from UFS to ZFS, silence fmcd ioctl spam
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.
2026-07-13 01:50:37 +02:00
Tomaz Zaman
107d135ff0 sff: move SFP module management into sfp_fdt state machine
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.
2026-07-13 01:50:37 +02:00
Tomaz Zaman
cce1f2579d dpaa: add 10GBASE-T copper SFP+ PHY driver via I2C-MDIO bridge
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.
2026-07-13 01:50:36 +02:00
Tomaz Zaman
36f96ed5b6 dpaa: fix SFP link state semantics and copper module handling
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.
2026-07-13 01:50:36 +02:00
Tomaz Zaman
43eb531be0 dpaa: add SFP module detection and link management for 10GbE ports
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.
2026-07-13 01:50:35 +02:00
Tomaz Zaman
5065099c0d dpaa: move fmlib ioctl headers into kernel tree
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.
2026-07-13 01:50:34 +02:00
Tomaz Zaman
f1e91c63fa dpaa: start MII tick for LAGG member ports, reprogram MAC on enable
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.
2026-07-13 01:50:33 +02:00
Tomaz Zaman
24369ce0b4 dpaa: per-VAP FQ registry, dist fallback, OH enqueue EBUSY, refill API
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.
2026-07-13 01:50:32 +02:00
Tomaz Zaman
5391092ae5 dpaa: PLCR/KG miss fixup, portal quiesce, OH dist callbacks
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.
2026-07-13 01:50:31 +02:00
Tomaz Zaman
7e747b3417 dpaa: cross-module buffer free for WiFi offload
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.
2026-07-13 01:50:31 +02:00
Tomaz Zaman
1dd81a66be gpio: add FDT gpio-hog processing for boot-time pin configuration
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.
2026-07-13 01:50:30 +02:00
Tomaz Zaman
0d8077ab97 pci: DesignWare PCIe big-endian CCSR and lane configuration for LS1046A
- 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)
2026-07-13 01:50:30 +02:00
Tomaz Zaman
9ed1ec5e22 dpaa: add CEETM egress QoS traffic management
Class-based Enqueue/Dequeue Traffic Management for DPAA1 QMan.
Provides hardware traffic shaping and scheduling via QMan CEETM
channels.
2026-07-13 01:50:28 +02:00
Tomaz Zaman
05dd604514 iicbus: add INA2xx power monitor driver
TI INA219/INA226/INA234 I2C power monitor with sysctl interface for
voltage, current, and power readings. Used on Mono Gateway for rail
monitoring.
2026-07-13 01:50:27 +02:00
Tomaz Zaman
0bf8388a58 arm64: peripheral driver fixes for LS1046A
- qoriq_gpio: QorIQ GPIO controller support
- gpiopower: GPIO-based power control fix
- iicmux/pca954x: I2C mux devclass fix (use "iicbus" not "ofw_iicbus")
- ofw_iicbus: FDT child enumeration fix
- random_harvestq: allow CAAM hardware RNG as entropy source
2026-07-13 01:50:27 +02:00
Tomaz Zaman
6d697eab12 mii: add MaxLinear GPY115/GPY2xx PHY driver
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
2026-07-13 01:50:26 +02:00
Tomaz Zaman
20527baa85 dpaa: add offline/header manipulation (OH) port driver
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.
2026-07-13 01:50:26 +02:00
Tomaz Zaman
61805ff428 dpaa: dTSEC/mEMAC Ethernet driver with checksum offload and RSS
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.
2026-07-13 01:50:25 +02:00
Tomaz Zaman
89ce353b40 dpaa: BMan/QMan/FMan portal integration and bus drivers
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.
2026-07-13 01:50:24 +02:00
Tomaz Zaman
4b3943cf68 arm64: GATEWAY kernel config, device tree, and platform support
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).
2026-07-13 01:50:22 +02:00
Ed Maste
a1dbf5c27c vt: Avoid integer overflow in CONS_HISTORY ioctl
Approved by:	so
Security:	FreeBSD-SA-26:34.vt
Security:	CVE-2026-49416
Reviewed by:	markj, vexeduxr
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57250

(cherry picked from commit 0ae946e7223df5ef3f7980af1d774d7f593f6421)
(cherry picked from commit deaaddf1d3c4283649945553ad7e3208c8424308)
(cherry picked from commit b5a4f4bfbc95d5d5361da708728f7f4a6db2ee60)
2026-06-10 08:45:22 +02:00
Mark Johnston
564070c417 sound: Fix software buffer lifetime issues
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
2026-06-10 08:42:35 +02:00
Christos Margiolis
2845ed0a0e sound: Check for offset overflow in dsp_mmap_single()
Approved by:	so
Security:	FreeBSD-SA-26:27.sound
Security:	CVE-2026-45258
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
2026-06-10 08:42:33 +02:00
Alex Richardson
daedb8bb36 netmap: silence -Wdefault-const-init-field-unsafe warning
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)
2026-06-02 07:26:00 +02:00
Mark Johnston
06e5f25883 netmap: Drain selinfo sleepers in nm_os_selinfo_uninit()
Approved by:	so
Security:	FreeBSD-SA-26:19.file
Security:	CVE-2026-45251
2026-05-21 07:32:51 +02:00
Enji Cooper
6b41d9082e chore: replace {0, 0} with {DEV,KOBJ}METHOD_END
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)
2026-04-30 07:39:21 +02:00
Yuichiro NAITO
98e3a18a80 ixgbe: Fix MRQC register value.
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)
2026-04-30 07:39:21 +02:00
Gordon Bergling
91e9dca98e ixl(4): Fix a typo in a source code comment
- s/seperated/separated/

(cherry picked from commit ef3703a8cd9ade13d0c7a685577100e1fc18ee09)
2026-04-30 07:39:21 +02:00
Kevin Bowling
1f54b94dc1 e1000: Increase FC pause/refresh time on PCH2 and newer
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)
2026-03-09 09:15:10 +01:00
Michael Tuexen
ba5ad8b2b9 vtnet: improve consistency
Use sbuf_new_for_sysctl() instead of sbuf_new_auto() when exposing
the flags via sysctl.

(cherry picked from commit 8da838ac31692e381adfc63d83ea49f2adabbf23)
2026-02-18 13:02:17 +01:00
Michael Tuexen
eddf2a14c7 vtnet: expose features via sysctl tree
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)
2026-02-18 13:02:07 +01:00
Michael Tuexen
89de4d0ff7 vtnet: expose flags via sysctl tree
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)
2026-02-18 13:01:23 +01:00
Michael Tuexen
102341143d vtnet: define flags in a consistent way
This allows adding flags in the upper 32 bits in a consistent way.
No functional change intended.

(cherry picked from commit e0c6c4ecfc755b78ac9135033053d2f15c62bf04)
2026-02-18 13:01:16 +01:00
Yogesh Bhosale
2348f23f85 ice(4): Handle allmulti flag in ice_if_promisc_set function
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)
2026-02-18 13:00:12 +01:00
Zhenlei Huang
b7143cdd85 e1000: Fix setting the promiscuous mode
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)
2026-02-18 12:59:37 +01:00
Kevin Bowling
b535c315b7 Revert "e1000: Try auto-negotiation for fixed 100 or 10 configuration"
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)
2026-01-27 13:47:41 +01:00
Franco Fichtner
da4b2cd01b Revert "LinuxKPI: rename from_timer() to timer_container_of()"
This reverts commit 336be73ac1.

This breaks building rtw88.
2026-01-20 09:19:33 +01:00
Hareshx Sankar Raj
75c41156a5 qat: enable qat driver for 402xx device
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)
2026-01-20 09:05:29 +01:00
Mark Johnston
edb45d0639 qat: Revert changes to BAR indices
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)
2026-01-20 09:05:13 +01:00
Hareshx Sankar Raj
d9dabf712b qat: update API files to use SPDX identifier
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)
2026-01-20 09:04:59 +01:00
Hareshx Sankar Raj
4e2ec609ae qat: refactor error handling and add mutex locks
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)
2026-01-20 09:04:49 +01:00
Hareshx Sankar Raj
cfb6574431 qat: driver updates to improve code and fix bugs
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)
2026-01-20 09:04:40 +01:00
Hareshx Sankar Raj
b77125c7c7 qat: reimplement cpaCyGetXXXInstances as a wrapper
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)
2026-01-20 09:04:28 +01:00
Hareshx Sankar Raj
5b9a9ebe48 qat: restrict sysctl access to privileged users
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)
2026-01-20 09:04:17 +01:00
Hareshx Sankar Raj
1973581b16 qat: move debugfs handling to separate file
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)
2026-01-20 09:04:06 +01:00
Hareshx Sankar Raj
b3dd18f8d2 qat: update 4xxx capabilities handling
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)
2026-01-20 09:03:58 +01:00
Hareshx Sankar Raj
72d092010b qat: fix typos and formatting issues
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)
2026-01-20 09:03:30 +01:00
Bjoern A. Zeeb
93a9c0445c LinuxKPI: pci: implementation of [lkpi_]pci_get_slot()
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)
2026-01-20 08:43:36 +01:00
Bjoern A. Zeeb
336be73ac1 LinuxKPI: rename from_timer() to timer_container_of()
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)
2026-01-20 08:34:00 +01:00
Justin Hibbits
a34a18b5ab bnxt: Use IfAPI accessors where able
Summary:
Don't directly access ifnet members, it's a private structure.

Sponsored by:	Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D47353

(cherry picked from commit 84d7ec4c65)
2026-01-10 09:00:45 +01:00