Commit graph

44053 commits

Author SHA1 Message Date
Krzysztof Galazka
69bb592fa3 ice(4): Fix set RSS hena virtchnl op handler
Remove existing RSS HENA configuration to make sure that
only config requested by VF is applied and allow VFs to
disable RSS completely.

Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1573
2025-07-18 13:16:17 -06:00
Krzysztof Galazka
d6958f3fae ice(4): Fix re-enabling VF queues
On receiving a virtual channel request from VF driver tried
to configure and enable Tx and Rx queues without making
sure that they were disabled. It caused issue with reloading
a VF driver without a reset e.g. in case it crashed.
Fix that by always disabling all Rx and Tx queues.

While at that make sure that only queues requested by VF
driver are enabled. VF driver may use less queues than
assigned to the function when it was created.

Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1573
2025-07-18 13:16:16 -06:00
Krzysztof Galazka
925a15b969 ice(4): Add basic VFLR handler
PF driver needs to tear down and setup VF configuration after
a reset event, e.g. due to reloading a VF driver. Re-use
ice_reset_vf function for that by adding new parameter,
which decides if new reset has to be triggered.
This most likely does not cover all necessary steps
and will be extended in future commits.

Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1573
2025-07-18 13:16:16 -06:00
Krzysztof Galazka
21f3395713 ice(4): Fix panic when VF uses less queues then available
VF driver may request to configure MSI-X vectors for less
queues than assigned by PF. Don't try to configure
unassigned vectors to avoid panic.

While at that make the loop process whole array of vectors
received in a VIRTCHNL_OP_CFG_IRQ_MAP message from a VF.
It's not guarantied that vector '0', which is used for other
interrupt causes and is not mapped to a queue, will be always
on the last position. Condition inside the loop already
handles that vector correctly.

Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1573
2025-07-18 13:16:16 -06:00
Krzysztof Galazka
160becc7dc ice: Add broadcast filter while creating VF
Filter for unicast MAC address is configured
with a virtual channel message, but filter for
a broadcast traffic was missing. It caused
issues with e.g. ARP.

Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1573
2025-07-18 13:16:16 -06:00
Krzysztof Galazka
bc761988b7 ice: Add host SR-IOV support
Enable basic SR-IOV support for E800 adapters.

Authored-by: Eric Joyner <erj@FreeBSD.org>
Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1573
2025-07-18 13:16:16 -06:00
Konstantin Belousov
72c9ad9331 mlx5en ipsec offload: copy xform_history to the ipsec_accel_in_tag
Reviewed by:	Ariel Ehrenberg <aehrenberg@nvidia.com>, slavash
Sponsored by:	Nvidia networking
2025-07-17 12:36:26 +03:00
Zhenlei Huang
12fea46407 qlnxe: Fix error handling of SIOCGI2C ioctl
The error -1 is actually ERESTART in the context of syscall. It is for
kernel mode only and will not be passed to user mode. When the kernel
sees this error it will restart the syscall.

When the the SFP module data is not available, e.g. the SFP module is
not present, the ioctl handler returns ERESTART and kernel will retry
infinitely, hence the userland `ifconfig -v ql0` will hang forever until
get interrupted. That is apparently wrong.

Fix that by returning error ENODEV to indicate the SFP module data is
not available.

As for the case that ecore_ptt_acquire() fails, it appears to be quite
safe to restart, so keep returning ERESTART.

Reported by:	Steve Wheeler
See also:	https://redmine.pfsense.org/issues/16248
Reviewed by:	kbowling
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D51351
2025-07-17 12:01:16 +08:00
Zhenlei Huang
10d9ec31bf qlnxe: Fix build with INET
opt_inet.h is missing from 5684c8783b, thus actually `#ifdef INET`
does not work.

PR:		287445
See also:	https://redmine.pfsense.org/issues/16248
Reviewed by:	kbowling
Tested by:	leper <leper4@protonmail.com>
Fixes:		5684c8783b qlnxe: Add missing #ifdef INET to fix amd64 LINT-NOINET/NOIP builds
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D51295
2025-07-17 12:01:16 +08:00
Ahmad Khalifa
cc86794b03 gpiobus: plug IRQ leaks
Unmap the IRQ instead of just freeing the map data in the case of an
error. Also don't overwrite the resource's virtual address since the
copy of the map data made by intr_activate_irq is stored there.

Implement gpiobus_release_resource so it can unmap IRQs mapped by
gpio_alloc_intr_resource.

Reviewed by:	imp
Approved by:	imp (mentor)
Differential Revision:	https://reviews.freebsd.org/D51325
2025-07-17 03:33:52 +03:00
Ariel Ehrenberg
d6d66936c4 mlx5en: fix TLS Rx hardware offload initialization
The TLS RX context had the tcp sequence number of next TLS record set
in resync_tcp_sn parameter instead of in next_record_tcp_sn parameter
during hardware initialization.  This prevent the hardware from
synchronizing with the TLS stream, and caused TLS offload to remain
inactive.  Set next_record_tcp_sn to the next TCP sequence number and
resync_tcp_sn to zero to enable proper TLS record boundary detection
and activate hardware offload.

Reviewed by:	kib, slavash
Sponsored by:	NVidia networking
MFC after:	1 week
2025-07-17 02:32:27 +03:00
Jaeyoon Choi
0d5fdcb63c ufshci: enable the ufshci module to load at boot time
The ufshci driver tried to allocate a single 256KB segment for the UTP
command descriptor during boot, but failed due to memory fragmentation.
I fixed it to allocate the buffer in 8KB segments instead.

Sponsored by:		Samsung Electronics
Reviewed by:		imp
Differential Revision:	https://reviews.freebsd.org/D50933
2025-07-16 17:20:59 -06:00
jefby
5f9a73c22f mgb: Fix mac tx disable bug in teardown
Signed-off-by: jefby <jef199006@gmail.com>
Reviewed-by: emaste
Pull-request: https://github.com/freebsd/freebsd-src/pull/1755
2025-07-16 17:30:06 -04:00
Mateusz Piotrowski
56eb7566c4 md(4): Stop symlinking vn.4 to md.4
We've done the same in the past to the vnconfig.8->mdconfig.8 link in:
    eb5f456981 Remove ancient vnconfig symlink

Reviewed by:	bcr, markj, ziaee
Approved by:	markj (mentor)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D27122
2025-07-16 16:23:41 +02:00
Tom Jones
4d718f57c5 xhci pci: Add some amd xhci controller device ids
Reviewed by: aokblast
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D51259
2025-07-14 09:03:45 +01:00
Ahmad Khalifa
3d5ef29825 acpi_gpiobus: don't print error message if _AEI object doesn't exist
GPIO controllers aren't required to have an _AEI object.

Reviewed by:	wulf
Approved by:	imp (mentor)
Differential Revision:	https://reviews.freebsd.org/D51236
2025-07-11 15:10:00 +03:00
Jessica Clarke
cb75bb5126 vmbus: Avoid gratuitous ifdef and use more generic implementation instead
Checking for __LP64__ is non-portable as it assumes that ILP32 and LP64
are the only two ABIs that exist, but CheriBSD supports an additional
ABI where long is still 64-bit but pointers are 128-bit capabilities,
and thus __LP64__ is not defined. We could change this to check the
value of __SIZEOF_LONG__, since the code here only cares about that
aspect of the ABI, however in this instance, the only real reason an
ifdef is used at all is to be able to get log2(sizeof(u_long)), but if
we instead multiply and divide rather than shift, and let the compiler
optimise that to a shift, we can just use sizeof(u_long) instead. Note
also that VMBUS_EVTFLAGS_MAX could always just have been defined as
VMBUS_EVTFLAGS_SIZE / sizeof(u_long).

Reviewed by:	jhb
Differential Revision:	https://reviews.freebsd.org/D50630
2025-07-10 20:33:33 +01:00
Ariel Ehrenberg
b6b3743fa2 mlx5en: add driver tls status string method for rx sessions
Upon collecting tls information, kernel calls driver to get driver/hw
tls state. Driver calls hw to get its tracking and authentication
states, and dump them into the driver state buffer. This requires a
sleep to wait for the hw response.

Reviewed by:	kib
Sponsored by:	NVidia networking
2025-07-10 17:42:27 +03:00
Konstantin Belousov
cdd8129216 mlx5_en: wait_for_completion_timeout() takes jiffies
Sponsored by:	Nvidia networking
2025-07-10 17:42:27 +03:00
John Baldwin
5c59cec2d5 nvmf: Auto-reconnect periodically after a disconnect
Use a timer in the nvmf(4) driver to periodically trigger a devctl
"RECONNECT" notification.  A trigger in the /etc/devd/nvmf.conf file
invokes "nvmecontrol reconnect nvmeX" upon each notification.  This
differs from iSCSI which uses a dedicated daemon (iscsid(8)) to wait
inside a custom ioctl for an iSCSI initiator event to occur, but I
think this design might be simpler.

Similar to nvme-cli, the interval between reconnection attempts is
specified in seconds by the --reconnect-delay argument to the connect
and reconnect commands.  Note that nvme-cli uses -c for short letter
of this command, but that was already taken so nvmecontrol uses -r.
The default is 10 seconds to match Linux.

In addition, a second timeout can be used to force a full detach of a
disconnected the nvmeX device after the controller loss timeout
expires.  The timeout for this is specified in seconds by the
--ctrl-loss-tmo/-l options (identical to nvme-cli).  The default is
600 seconds.

Either of these timers can be disabled by setting the timer to 0.  In
that case, the associated action (devctl notifications or full detach)
will not occur after a disconnect.

Note that this adds a dedicated taskqueue for nvmf tasks instead of
using taskqueue_thread as the controller loss task could deadlock
waiting for the completion of other tasks queued to taskqueue_thread.
(Specifically, tearing down the CAM SIM can trigger
destroy_dev_sched_cb() and waits for the callback to run, but the
callback is scheduled to run in a task on taskqueue_thread.  Possibly,
destroy_dev_sched should be using a dedicated taskqueue.)

Reviewed by:	imp (earlier version)
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D50222
2025-07-09 10:19:45 -04:00
Takanori Watanabe
8799446796 ichiic: Add PCI id for Arrow Lake.
Add PCI id for Arrow Lake to attach iic driver

Reviewed by: wulf, mav
Differential Revision: https://reviews.freebsd.org/D51107
2025-07-08 23:21:03 +09:00
Mark Johnston
9940c97402 random: Change the entropy harvest event queuing scheme
The entropy queue stores entropy gathered from environmental sources.
Periodically (every 100ms currently), the random kthread will drain this
queue and mix it into the CSPRNG's entropy pool(s).

The old scheme uses a ring buffer with a mutex to serialize producers,
while the sole consumer, the random kthread, avoids using a mutex on the
basis that no serialization is needed since nothing else is updating the
consumer index.  On platforms without total store ordering, however,
this isn't sufficient: when a producer inserts a queue entry and updates
`ring.in`, there is no guarantee that the consumer will see the updated
queue entry upon observing the updated producer index.  That is, the
update to `ring.in` may be visible before the updated queue entry is
visible.  As a result, we could end up mixing in zero'ed queue entries,
though this race is fairly unlikely in practice given how infrequently
the kthread runs.

The easiest way to fix this is to make the kthread acquire the mutex as
well, and hold it while processing queue entries.  However, this might
result in a long hold time if there are many queue entries, and we
really want the hold times to be short, e.g., to avoid delaying
interrupt processing.

We could introduce a proper MPSC queue, but this is probably
overcomplicated for a consumer which runs at 10Hz.

Instead, define two buffers, always with one designated as the "active"
buffer.  Producers queue entries in the active buffer, and the kthread
uses the mutex to atomically flip the two buffers, so it can process
entries from the inactive buffer without holding the mutex.  This
requires more memory, but keeps mutex hold times short and lets us keep
the queue implementation very simple.

Reviewed by:	cem
MFC after:	1 month
Sponsored by:	Stormshield
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D51112
2025-07-07 15:41:57 +00:00
Christos Margiolis
3ba480f418 sound: Retire SND_DEV_*
Specifying unit numbers is not needed anymore, and half of those weren't
used anymore in the first place.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	adrian, markj, emaste
Differential Revision:	https://reviews.freebsd.org/D50690
2025-07-06 16:08:50 +03:00
Christos Margiolis
92336491cc sound: Remove dead printfs from midi/mpu401.c
Sponsored by:	The FreeBSD Foundation
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D50617
2025-07-06 16:08:46 +03:00
Christos Margiolis
9a138abb21 sound: Remove unused midi_cmdname()
Sponsored by:	The FreeBSD Foundation
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D50616
2025-07-06 16:08:42 +03:00
Christos Margiolis
c566edbceb sound: Remove unnecessary comments from midi/midi.c
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D50615
2025-07-06 16:08:37 +03:00
Christos Margiolis
17b38023ea sound: Remove duplicate mpu_if.h include
Sponsored by:	The FreeBSD Foundation
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D50613
2025-07-06 16:08:34 +03:00
Christos Margiolis
fa20737ed1 sound: Remove unused mpu_if methods
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D50612
2025-07-06 16:08:30 +03:00
Christos Margiolis
0ca9410eab sound: Retire unused MIDI sysctls
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D50611
2025-07-06 16:08:26 +03:00
Christos Margiolis
7f1426971e sound: Retire /dev/midistat
This doesn't register all MIDI devices, for example USB ones, and is not
widely used in the first place. In the future all MIDI devices will
register to sndstat, where we already have defined a MIDI device type,
but we haven't made use of it yet.

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D50610
2025-07-06 16:08:22 +03:00
Christos Margiolis
6cdd3226c7 sound: Retire midisynth
Unused code since we retired the sequencer.

Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D50609
2025-07-06 16:08:18 +03:00
Christos Margiolis
79b9680639 sound: Retire the MIDI sequencer
The in-kernel MIDI sequencer is not used anymore, since this is done by
userland applications nowadays. It also contains bugs, and we are not
exactly sure how it works, or if it worked properly in the first place.

Sponsored by:	The FreeBSD Foundation
Reviewed by:	vishwin, markj
Differential Revision:	https://reviews.freebsd.org/D50605
2025-07-06 16:08:10 +03:00
Konstantin Belousov
ca554a7dea dev/mem: use sx instead of rw lock
Some ops require sleepable context to success, like DMAP demotion.

Reviewed by:	alc, markj
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D50970
2025-07-05 11:35:53 +03:00
Ahmad Khalifa
9c2509f831 gpio: hide internal gpiobus symbols
Move functions and variables internal to gpiobus to their own header to
avoid namespace pollution and misuse.

Reviewed by:	wulf, imp
Approved by:	imp (mentor)
Differential Revision:	https://reviews.freebsd.org/D50872
2025-07-04 23:24:31 +03:00
Ahmad Khalifa
ff826f8ed4 gpiopps: don't use internal gpiobus function
gpiobus_release_pin is only meant to be used internally by gpiobus. Use
gpio_pin_release instead.

This also fixes a memory leak since gpio_pin_get_by_ofw_idx returns a
malloc'd pointer, which gpio_pin_release now frees.

Reviewed by:	wulf, imp
Approved by:	imp (mentor)
Differential Revision:	https://reviews.freebsd.org/D50871
2025-07-04 23:24:31 +03:00
Ahmad Khalifa
7f297cdae3 regulator: don't use internal gpiobus function
gpiobus_acquire_pin is only meant to be used internally by gpiobus. Use
gpio_pin_acquire instead.

Reviewed by:	manu, mmel
Approved by:	imp (mentor)
Differential Revision:	https://reviews.freebsd.org/D50870
2025-07-04 23:24:31 +03:00
Ahmad Khalifa
4a21713278 gpiobus: add gpio_pin_acquire
In some cases, drivers may need to acquire an existing gpio_pin_t. With
the functions gpiobus currently exposes, this isn't possible as they
allocate a new pin then acquire that. Add a new gpio_pin_acquire
function which accepts an existing gpiobus_pin structure.

Reviewed by:	mmel, imp
Approved by:	imp (mentor)
Differential Revision:	https://reviews.freebsd.org/D50869
2025-07-04 23:24:31 +03:00
Ahmad Khalifa
92b352f694 gpiobus: gpio_pin_release: convert checks to KASSERTs
Reviewed by:	mmel, imp
Approved by:	imp (mentor)
Differential Revision:	https://reviews.freebsd.org/D50868
2025-07-04 23:24:31 +03:00
Ahmad Khalifa
a2bfb7cff2 gpiobus: gpiobus_release_pin: convert errors to panic
These are programming errors.

Suggested by:	mmel
Reviewed by:	imp
Approved by:	imp (mentor)
Differential Revision:	https://reviews.freebsd.org/D50939
2025-07-04 23:24:31 +03:00
Ahmad Khalifa
ed50879c4a gpiobus: gpiobus_acquire_pin: panic on invalid pin
It is a programming error to call this function with an invalid pin.
Also return proper error value on failure.

Suggested by:	mmel
Reviewed by:	imp, mmel
Approved by:	imp (mentor)
Differential Revision:	https://reviews.freebsd.org/D50940
2025-07-04 23:24:31 +03:00
Ahmad Khalifa
4695e3aa7c gpio: attach gpiobus when the controller is ready
Only attach gpiobus when the controller is fully initialized. Children
of gpiobus expect this to be the case.

Reviewed by:	mmel, imp, andrew
Approved by:	imp (mentor)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D51088
2025-07-04 16:56:00 +03:00
Ahmad Khalifa
2c356c8b8f gpiobus: add a gpiobus_add_bus function
Some drivers need to postpone the attachment of gpiobus until hardware
init is done. Add a new gpiobus_add_bus function to accommodate this
case.

Suggested by:	mmel, andrew
Reviewed by:	mmel, imp, andrew
Approved by:	imp (mentor)
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D51133
2025-07-04 16:55:55 +03:00
Bjoern A. Zeeb
2f5666c172 LinuxKPI: MODULE_DEVICE_TABLE() factor out the bus specific MODULE_PNP_INFO()
In order to be able to use MODULE_DEVICE_TABLE() with multiple bus
attachments, factor out the bus-specfic MODULE_PNP_INFO() and place
it next to the structure defining the table.

As it turns out bnxt(4) has been using the MODULE_DEVICE_TABLE() with
PCI attachments for the "auxillary" bus so far.  That makes little sense.
Define the MODULE_PNP_INFO() to nothing for that.  We may consider
pulling these LinucKPI bits in semi-native drivers into LinuxKPI
one day as that route is not really sustainabke.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	imp, dumbbell
Differential Revision: https://reviews.freebsd.org/D51049
2025-07-04 03:22:22 +00:00
Ruslan Bukin
906d7a4b52 hwt: fix !SMP build.
Sponsored by:	UKRI
2025-07-03 21:43:01 +01:00
Ruslan Bukin
070d185b2f hwt: fix build.
Include sys/lock.h header for spinlock_enter() prototype.

Sponsored by:	UKRI
2025-07-03 21:36:18 +01:00
Mark Johnston
5e213d8a74 random: Remove ARGSUSED annotations from random_harvestq.c
Such annotations are obsolete, the compiler tells us when parameters are
unused.  No functional change intended.

Reviewed by:	cem
MFC after:	1 week
Sponsored by:	Stormshield
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D51114
2025-07-03 17:31:42 +00:00
Mark Johnston
e2a96b8340 random: Define a macro for getting the CPU cycle count
Entropy queue entries always include the low 32 bits of a CPU cycle
count reading.  Introduce a macro for this instead of hard-coding
get_cyclecount() calls everywhere; this is handy for testing purposes
since this way, random(4)'s use of the cycle counter (e.g., the number
of bits we use) can be changed in one place.

No functional change intended.

Reviewed by:	cem, delphij
MFC after:	1 week
Sponsored by:	Stormshield
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D51113
2025-07-03 17:31:42 +00:00
Mark Johnston
4b8b872a9c random: Move entropy harvest queue lock macros to random_harvestq.c
They can't be used externally, so it makes no sense to have them in a
header.  No functional change intended.

Reviewed by:	cem
MFC after:	1 week
Sponsored by:	Stormshield
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D51111
2025-07-03 17:21:37 +00:00
Mark Johnston
6ccf1801f2 random: Replace a comment with a static assertion
No functional change intended.

Reviewed by:	cem
MFC after:	1 week
Sponsored by:	Stormshield
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D51110
2025-07-03 17:21:18 +00:00
Mark Johnston
027beb002b vmm: Add a missing entry to the ioctl table
Reported by:	acm
Fixes:		b9ef152bec ("vmm: Merge vmm_dev.c")
2025-07-03 17:02:43 +00:00