Commit graph

43401 commits

Author SHA1 Message Date
Adrian Chadd
6749f059a5 rtwn: use ieee80211_ht_check_tx_shortgi_20() and ieee80211_ht_check_tx_shortgi_40()
Use the new net80211 routines rather than rolling our own.

(The first version of this diff landed a previous version of what was
reviewed, so this brings it up to what was finally accepted in the
review.)

Differential Revision: https://reviews.freebsd.org/D47751

Reviewed by:	bz
2024-12-03 14:46:46 -08:00
Florian Walpen
49a7f2b313 snd_hdspe(4): Add sysctls to select analog signal levels.
RME HDSPE AIO sound cards support different sensitivity levels at the
analog input, and different gain levels for the analog line and phones
outputs. Expose these settings as sysctl tunables.

Test Plan:
The following tests on hardware should be performed if possible:
  - Phones output volume changes according to sysctl setting
    (caution, still extremely loud).
  - Create loop to feedback the line output to line input, recording the
    sound played.
  - Iterate through input signal levels and observe volume changes in
    recorded audio.
  - Iterate through output signal levels and observe volume changes in
    recorded audio.

Reviewed by: br, christos
Differential Revision: https://reviews.freebsd.org/D47412
2024-12-03 22:31:50 +00:00
Adrian Chadd
e1eff81ea9 rtwn: use ieee80211_ht_check_tx_shortgi_20() and ieee80211_ht_check_tx_shortgi_40()
Use the new net80211 routines rather than rolling our own.

Differential Revision: https://reviews.freebsd.org/D47751

Reviewed by: bz
2024-12-03 14:10:49 -08:00
Adrian Chadd
057db5b227 iwn: use ieee80211_ht_check_tx_ht()
ieee80211_ht_check_tx_ht() now implements the "is this a HT node
with actual HT rates I can transmit to."

Differential Revision:  https://reviews.freebsd.org/D47755

Reviewed by:	bz
2024-12-02 21:32:26 -08:00
Adrian Chadd
3f62f8ef5e iwn: use ieee80211_ht_check_tx_shortgi_20() and ieee80211_ht_check_tx_shortgi_40()
Use the new net80211 routines to check the node width and the
local / node flags.

This should be "more" correct than the previous code.

Differential Revision: https://reviews.freebsd.org/D47750

Reviewed by:	bz
2024-12-02 21:31:39 -08:00
Adrian Chadd
3d54d9e364 ath: use the new net80211 methods for AMPDU density/limit, short-GI
Now that net80211 has this code, just leverage it instead of rolling
our own.

Differential Revision: https://reviews.freebsd.org/D47748

Reviewed by:	bz
2024-12-02 21:31:05 -08:00
Kevin Bowling
850f78d5a1 igc.4: Add I226 and other additions to supported list
MFC after:	3 days
2024-12-02 17:43:17 -07:00
Christos Margiolis
46a97b9cd6 sound: Do not access cv_waiters
Remove uses of cv_waiters in PCM_RELEASE and CHN_BROADCAST, and also use
a counter around cv_timedwait_sig() in chn_sleep(), which is checked in
pcm_killchans(), as opposed to reading cv_waiters directly, which is a
layering violation.

While here, move CHN_BROADCAST below the channel lock operations.

Reported by:	avg, jhb, markj
Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, avg
Differential Revision:	https://reviews.freebsd.org/D47780
2024-12-02 17:26:58 +01:00
Christos Margiolis
29ba0cc4d9 sound: Fix mis-sorted CHN_F_BITS line
Fixes:		5317480967 ("sound: Remove CHN_F_SLEEPING")
Reported by:	jhb
Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	jhb, emaste
Differential Revision:	https://reviews.freebsd.org/D47781
2024-12-02 17:26:50 +01:00
Christos Margiolis
5a217a8d7d sound: Merge pcm/matrix_map.h with pcm/matrix.h
No functional change intended.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D47737
2024-12-02 17:26:43 +01:00
Christos Margiolis
88eaa1504d sound: Dissolve pcm/intpcm.h
Part of a series of patches to cleanup/simplify pcm/.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D47736
2024-12-02 17:26:38 +01:00
Christos Margiolis
b882251204 sound: Remove unused code from pcm/g711.h
These routines are already implemented in pcm/intpcm.h.

No functional change intended.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D47734
2024-12-02 17:26:32 +01:00
Christos Margiolis
00731aaaed sound: Remove dead code from pcm/
No functional change intended.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D47733
2024-12-02 17:26:27 +01:00
Christos Margiolis
0b4e329125 sound: Merge ac97 and ac97_patch
No functional change intended.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D47732
2024-12-02 17:26:20 +01:00
Franco Fichtner
0482974b2c sfxge: defer ether_ifattach to when ifmedia_init is done
Otherwise the ifmedia subsystem may call unguarded NULL function
pointers.  Same issue that was fixed for cxgb(4) in f2daf8995.

Also see:	https://github.com/opnsense/src/issues/228
MFC after:	1 week
2024-12-02 02:09:24 -07:00
Navdeep Parhar
878413d559 cxgbe(4): Fix the name of the 2 x 10/25 OCP card.
Reported by:	Sony Arpita Das @ Chelsio
Fixes:	5c15094916 cxgbe(4): Update the board names of the T6 OCP cards.
MFC after:	1 week
Sponsored by:	Chelsio Communications
2024-11-29 10:21:43 -08:00
Richard Scheffenegger
0fc7bdc978 tcp: extend the use of the th_flags accessor function
Formally, there are 12 bits for TCP header flags.
Use the accessor functions in more (kernel) places.

No functional change.

Reviewed By: cc, #transport, cy, glebius, #iflib, kbowling
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D47063
2024-11-29 09:48:23 +01:00
Kevin Bowling
4020351325 e1000: Remove old itr sysctl handler
This implementation had various bugs.  bde@ reported that the unit
conversion/scaling is wrong, and it also does not handle 82574L or
igb(4) devices correctly.

With the new AIM code, it is expected most users will not need to
manually tune this.

If you do need static control:
hw.em.enable_aim=0 for all interfaces at boot or dev.em.X.enable_aim=0
for individual interfaces at runtime and they will track the
hw.em.max_interrupt_rate tunable.  That codepath has been bugfixed for
all supported chipsets.

You may view the current rate with dev.em.X.queue_rx_0.interrupt_rate
which has been bugfixed for all supported chipsets.

If you need to set different rates per interface for some reason let me
know and I will rethink how to add this back.  Otherwise you can leave
AIM on for general purpose interfaces and disable it at runtime on
special purpose low or high latency interfaces that would track
hw.em.max_interrupt_rate if you have a mix of concerns.

PR:		235031
Reported by:	Bruce Evans <bde@FreeBSD.org>
MFC after:	3 days
Relnotes:	yes
Sponsored by:	BBOX.io
2024-11-29 00:15:54 -07:00
Alexander Motin
de852d78ff hwpmc: Restore line lost in previous commit
MFC after:	3 days
2024-11-28 11:53:24 -05:00
Navdeep Parhar
5c15094916 cxgbe(4): Update the board names of the T6 OCP cards.
MFC after:	1 week
Sponsored by:	Chelsio Communications
2024-11-27 22:43:37 -08:00
Justin Hibbits
09ef538713 uart: Add primitive noise filtering on RX
A long cable attached to the UART can act as an antenna if disconnected
from the other end.  This can cause noise on the receive side, possibly
as reflections from the transmit side, leading to an interrupt storm.
Filter this by adding a threshold of received characters without TX
ready, above which characters are dropped.  This is disabled by default,
but has been tested with a threshold of 1000+.  A high threshold is
recommended to avoid dropping characters during, for instance, a large
copy/paste from the other end.

Sponsored by:	Juniper Networks, Inc.
2024-11-27 09:17:09 -05:00
Konstantin Belousov
7dd1f0dcd1 acpica: add domain ivar
Specialize acpi bus_get_domain method to read ivar.
Execute and cache the _PXM result in the ivar at namespace enumeration
time.

If there is no _PXM, driver for the child can set the ivar to the value
obtained by other means.

Move acpi_get_domain() to acpi_pci.c, it now serves pci buses and
devices on them.

Suggested and reviewed by:	jhb
Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D47291
2024-11-26 23:56:25 +02:00
Konstantin Belousov
6f423295f1 acpica: rename acpi_parse_pxm() to acpi_pxm_parse() and make it non-static
Reviewed by:	jhb
Sponsored by:	Advanced Micro Devices (AMD)
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D47291
2024-11-26 23:56:19 +02:00
Mark Johnston
ef9ffb8594 kern: Make fileops and filterops tables const where possible
No functional change intended.

MFC after:	1 week
2024-11-26 21:04:21 +00:00
Zhenlei Huang
f2233ac33a ena: Remove \n from sysctl description
sysctl(8) prints a newline after the description, no need for this extra
newline.

MFC after:	1 week
2024-11-26 23:52:54 +08:00
Christos Margiolis
6d77827b96 sound: Remove unused CHN_F_SILENCE
No functional change intended.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, markj, emaste
Differential Revision:	https://reviews.freebsd.org/D47664
2024-11-26 15:48:42 +01:00
Christos Margiolis
5317480967 sound: Remove CHN_F_SLEEPING
The KASSERT in chn_sleep() can be triggered if more than one thread
wants to sleep on a given channel at the same time. While this is not
really a common scenario, tools such as stress2, which use fork() and
the child process(es) inherit the parent's FDs as a result, we can end
up triggering such scenarios.

Fix this by removing CHN_F_SLEEPING altogether, which is not very useful
in the first place:
- CHN_BROADCAST() checks cv_waiters already, so there is no need to
  check CHN_F_SLEEPING as well.
- We can check whether cv_waiters is 0 in pcm_killchans(), instead of
  whether CHN_F_SLEEPING is not set.

Reported by:	dougm, pho (stress2)
Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D47559
2024-11-26 15:48:36 +01:00
Christos Margiolis
6d4c59e261 sound: Remove PCM_DETACHING(), SD_F_DETACHING and SD_F_DYING
Since SD_F_REGISTERED is cleared at the same time SD_F_DETACHING and
SD_F_DYING are set, and since PCM_DETACHING() is always used in
conjuction with PCM_REGISTERED()/DSP_REGISTERED(), it is enough to just
check SD_F_REGISTERED.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D47463
2024-11-26 15:48:30 +01:00
Christos Margiolis
2839ad58dd sound: Fix hot-unload panics
This patch fixes multiple different panic scenarios occuring during
hot-unload:

1. The channel is unlocked in chn_read()/chn_write() for uiomove(9) and
   in the meantime we enter pcm_killchans() and free it. By the time we
   have returned from userland and try to lock it back, the channel will
   have been freed.
2. The parent channel has been freed in pcm_killchans(), but at the same
   time, some yet-unstopped vchan's chn_read()/chn_write() calls
   chn_start(), which eventually calls vchan_trigger(), which references
   the freed parent.
3. PCM_WAIT() panics because it references a freed PCM lock.

For scenarios 1 and 2, refactor pcm_killchans() to first make sure all
channels have been stopped, and then proceed to free them one by one, as
opposed to freeing the first free channel until all channels have been
freed. This change makes the code more robust, but might introduce some
performance overhead when many channels are allocated, since we
continuously loop through the channel list until all of them are
stopped, and then we loop one last time to free them.

For scenario 3, restructure the code so that we can use destroy_dev(9)
instead of destroy_dev_sched(9) in dsp_destroy_dev(). Because
destroy_dev(9) blocks until all references to the device have went away,
we ensure that the PCM cv and lock will be freed safely.

While here, move the delete_unrhdr(9) calls to pcm_killchans() and
re-order some lines.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D47462
2024-11-26 15:48:24 +01:00
Christos Margiolis
5ac39263d8 sound: Fix chn_trigger() and vchan_trigger() races
Consider the following scenario:

1. CHN currently has its trigger set to PCMTRIG_STOP.
2. Thread A locks CHN, calls CHANNEL_TRIGGER(PCMTRIG_START), sets the
   trigger to PCMTRIG_START and unlocks.
3. Thread B picks up the lock, calls CHANNEL_TRIGGER(PCMTRIG_ABORT) and
   returns a non-zero value, so it returns from chn_trigger() as well.
4. Thread A picks up the lock and adds CHN to the list, which is
   _wrong_, because the last call to CHANNEL_TRIGGER() was with
   PCMTRIG_ABORT, meaning the channel is stopped, yet we are adding it
   to the list and marking it as started.

Another problematic scenario:

1. Thread A locks CHN, sets the trigger to PCMTRIG_ABORT, and unlocks
   CHN. It then locks PCM and _removes_ CHN from the list.
2. In the meantime, since thread A unlocked CHN, thread B has locked it,
   set the trigger to PCMTRIG_START, unlocked it, and is now blocking on
   PCM held by thread A.
3. At the same time, thread C locks CHN, sets the trigger back to
   PCMTRIG_ABORT, unlocks CHN, and is also blocking on PCM. However,
   once thread A unlocks PCM, because thread C is higher-priority than
   thread B, it picks up the PCM lock instead of thread B, and because
   CHN is already removed from the list, and thread B hasn't added it
   back yet, we take a page fault in CHN_REMOVE() by trying to remove a
   non-existent element.

To fix the former scenario, set the channel trigger before the call to
CHANNEL_TRIGGER() (could also come after, doesn't really matter) and
check if anything changed one we lock CHN back.

To fix the latter scenario, use the SAFE variants of CHN_INSERT_HEAD()
and CHN_REMOVE(). A similar scenario can occur in vchan_trigger(), so do
the trigger setting after we've locked the parent channel.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D47461
2024-11-26 15:48:18 +01:00
Christos Margiolis
5bd08172b4 snd_dummy: Fix callout(9) races
Use callout_init_mtx(9) to associate the callback with the driver's
lock. Also make sure the callout is stopped properly during detach.

While here, introduce a dummy_active() function to know when it's
appropriate to stop or not reschedule the callout.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 days
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D47459
2024-11-26 15:48:02 +01:00
Konstantin Belousov
4cc5d081d8 mlx5en: only enable to toggle offload caps if they are supported
Reviewed by:	Ariel Ehrenberg <aehrenberg@nvidia.com>
Sponsored by:	NVidia networking
MFC after:	1 week
2024-11-26 14:34:34 +02:00
Konstantin Belousov
cca0dc49e0 mlx5en: move runtime capabilities checks into helper functions
For TLS TX/RX, ratelimit, and IPSEC offload caps.

Reviewed by:	Ariel Ehrenberg <aehrenberg@nvidia.com>
Sponsored by:	NVidia networking
MFC after:	1 week
2024-11-26 14:34:34 +02:00
Edward Tomasz Napierala
c0a5ee953f hms(4): improve scroll with IICHID_SAMPLING
The current quirk is designed to discard duplicated data read from
the chip.  Problem is, it also discards real events when they happen
to be identical, which is the case with scroll wheel events;
differently from X/Y they always move by fixed offset.  This results
in two-finger scroll that would stop mid-way that could be fixed by
manually setting dev.hms.0.drift_thresh to 0.

To fix that, don't discard duplicates when there's wheel movement.
For users with actual duplicates problem this will result in scroll
suddenly becoming quite inertial, but it will stop moving at any touch,
so shouldn't be terrible.

PR:		kern/276709
Reviewed By:	wulf
Differential Revision:	https://reviews.freebsd.org/D47640
2024-11-26 10:28:51 +00:00
Gleb Smirnoff
67f9307907 mlx5e tls: use non-sleeping malloc flag is it was intended
Reviewed by:	gallatin
Fixes:		81b38bce07
2024-11-25 10:46:13 -08:00
Kevin Bowling
e80419da6c igc: disable hw.igc.sbp
Similar to 548d8a131d in e1000, disable this by default.

MFC after:	3 days
Sponsored by:	BBOX.io
2024-11-24 14:08:54 -07:00
Kevin Bowling
7390daf87c e1000: Style txrx
Fix up indentation and reflow long lines.

MFC after:	3 days
Sponsored by:	BBOX.io
2024-11-24 00:39:43 -07:00
Kevin Bowling
c7fb7b5d9f igc: Style pass igc_txrx
Fix up indentation and reflow long lines.

MFC after:	3 days
Sponsored by:	BBOX.io
2024-11-24 00:27:12 -07:00
Kevin Bowling
c58d34dd67 ixgbe: Style pass on FreeBSD part of driver
Fix up some indentation and reflow long lines

MFC after:	3 days
Sponsored by:	BBOX.io
2024-11-24 00:21:37 -07:00
Kevin Bowling
9efc7325f1 igc: Reflow long lines
MFC after:	3 days
Sponsored by:	BBOX.io
2024-11-23 22:58:13 -07:00
Kevin Bowling
6f14883066 e1000: Style pass on if_em
Fix up some indentation and reflow long lines

MFC after:	3 days
Sponsored by:	BBOX.io
2024-11-23 22:45:52 -07:00
Kevin Bowling
d1bb1a5011 igc: Normalize indentation a bit
MFC after:	3 days
Sponsored by:	BBOX.io
2024-11-23 20:17:27 -07:00
Kevin Bowling
bceec3d80a e1000: Try auto-negotiation for fixed 100 or 10 configuration
This is a retread of https://reviews.freebsd.org/D34449 which I think
will fix the issue for the remote side not supporting autoneg.  We now
attempt an autoneg, and if that fails fall back to the current code
that forces the link speed/duplex.

The original intent of this patch is to inform the remote switch of
duplex settings when we (the client) are specifying a fixed 10 or 100
speed.  Otherwise it may get the duplex setting wrong.

The tricky case is when the remote (switch) side is fixing its
speed AND duplex while disabling autoneg and we (client) need to do
the same, which still seems to be common enough at some ISPs.

Original commit message follows:
Currently if an e1000 interface is set to a fixed media configuration,
for gigabit, it will participate in auto-negotiation as required by
IEEE 802.3-2018 Clause 37. However, if set to fixed media configuration
for 100 or 10, it does NOT participate in auto-negotiation.

By my reading of Clauses 28 and 37, while auto-negotiation is optional
for 100 and 10, it is not prohibited and is, in fact, "highly
recommended".

This patch enables auto-negotiation for fixed 100 and 10 media
configuration, in a similar manner to that already performed for 1000.
I.e., the patch enables advertising of just the manually configured
settings with the goal of allowing the remote end to match the manually
configured settings if it has them available.

To be clear, this patch does NOT allow an em(4) interface that has been
manually configured with specific media settings to respond to
auto-negotiation by then configuring different parameters to those that
were manually configured. The intent of this patch is to fully comply
with the requirements of Clause 37, but for 100 and 10.

The need for this has arisen on an em(4) link where the other end is
under a different administrative control and is set to full
auto-negotiation. Due to the cable length GigE is not working well. It
is desired to set the em(4) end to "media 100baseTX mediatype
full-duplex" which does work when both ends are configured that way.
Currently, because em(4) does not participate in autoneg for this
setting, the remote defaults to half-duplex - i.e., there's a duplex
mismatch and things don't work. With this patch, em(4) would inform the
remote that it has only 100baseTX full, the remote would match that and
it will work.

Tested by:	Natalino Picone <natalino.picone@nozominetworks.com>
Tested by:	Franco Fichtner <franco@opnsense.org>
Tested by:	J.R. Oldroyd <fbsd@opal.com> (previous version)
Sponsored by:	Nozomi Networks
Sponsored by:	BBOX.io
Differential Revision:	https://reviews.freebsd.org/D47336
2024-11-23 17:18:37 -07:00
Poul-Henning Kamp
7749de2440 Add new kern.vt.slow_down tunable.
On a laptop with no other console devices than the screen, things
scroll of the screen faster than eye or camera can capture it.

This tunable slows the console down and makes it update synchronously,
so console output continues when timers or interrupts do not.

Differential Revision:  https://reviews.freebsd.org/D47710
2024-11-23 15:01:09 +00:00
Ariel Ehrenberg
253a1fa16b mlx5: Fix handling of port_module_event
Remove the array of port module status and instead save module status
and module number.

At boot, for each PCI function driver get event from fw about module
status. The event contains module number and module status. Driver
stores module number and module status..  When user (ifconfig) ask for
modules information, for each pci function driver first queries fw to
get module number of current pci function, then driver compares the
module number to the module number it stored before and if it matches
and module status is "plugged and enabled" then driver queries fw for
the eprom information of that module number and return it to the
caller.

In fact fw could have concluded that required module number of the
current pci function, but fw is not implemented this way. current
design of PRM/FW is that MCIA register handling is only aware of
modules, not the pci function->module connections.  FW is designed to
take the module number written to MCIA and write/read the content
to/from the associated module's EPROM.

So, based on current FW design, we must supply the module num so fw
can find the corresponding I2C interface of the module to write/read.

Sponsored by:	NVidia networking
MFC after:	1 week
2024-11-23 12:59:26 +02:00
Konstantin Belousov
0d38b0bc8f mlx5en: fix the sign of mlx5e_tls_st_init() error, convert from Linux to BSD
Sponsored by:	NVidia networking
MFC after:	1 week
2024-11-23 12:09:50 +02:00
Konstantin Belousov
64bf5a431c mlx5_en: style function prototype
Sponsored by:	NVidia networking
MFC after:	2 weeks
2024-11-23 12:01:50 +02:00
Andrew Gallatin
81b38bce07 mlx5e tls: Ensure all allocated tags have a hw context associated
Ensure all allocated tags have a hardware context associated.
The hardware context allocation is moved into the zone import
routine, as suggested by kib.  This is safe because these zone
allocations are always done in a sleepable context.

I have removed the now pointless num_resources tracking,
and added sysctls / tunables to control UMA zone limits
for these tls tags, as well as a tunable to let the
driver pre-allocate tags at boot.

MFC after:	2 weeks
2024-11-23 12:01:50 +02:00
Mark Johnston
07593d13fa efirt: Fix the TDP_EFIRT assertion
Fixes:	a03957a706 ("efirt: mark dynamic region executing the RT code with the TDP_EFIRT flag")
2024-11-22 14:19:37 +00:00
Konstantin Belousov
a03957a706 efirt: mark dynamic region executing the RT code with the TDP_EFIRT flag
Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D47694
2024-11-22 00:05:28 +02:00