Commit graph

42326 commits

Author SHA1 Message Date
Christos Margiolis
d27972ec91 sound: Get rid of snddev_info->devcount
snddev_info->devcount keeps track of the total number of channels for a
given device. However, it is redundant to have it, since it is only used
in sound_oss_sysinfo() to populate the "numaudios" field, and we also
keep track of the channel counts in the playcount, pvchancount, reccount
and rvchancount fields anyway. We can simply sum those fields together
instead of updating a separate variable upon every channel
addition/deletion.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D44852

(cherry picked from commit 4d2be7be3837d66ba242a0a7fd51632c3f89285d)
2024-05-17 21:30:01 +02:00
Christos Margiolis
69707d9f50 sound: Call device_get_name() and device_get_unit() only once in mixer_init()
No functional change intended.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	markj, emaste
Differential Revision:	https://reviews.freebsd.org/D44840

(cherry picked from commit 41ab202ff74ea6af7e9125c9dfb430c729380f41)
2024-05-17 21:30:01 +02:00
Christos Margiolis
8771127d75 sound: Be more verbose with virtual channel descriptions
Non-virtual channel description denote "play" or "record", so do the
same for virtual ones as well.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	markj, emaste
Differential Revision:	https://reviews.freebsd.org/D44839

(cherry picked from commit d0032e6a9e6596302bf129d7f68a627a02c6cd0a)
2024-05-17 21:30:01 +02:00
Ed Maste
7309d72e14 ukswitch: fix non-debug build
PR:		278847
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 2e0c027e69de66afc1157c76bd42ecd3737d54e1)
2024-05-14 10:47:00 -04:00
Ed Maste
e9a7be7def ip17x: fix non-debug build
PR:		278847
Reviewed by:	jhibbits
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45133

(cherry picked from commit 82f43db382cc4aea2a3f34f08da9a97ab023d5fb)
2024-05-14 10:47:00 -04:00
Konstantin Belousov
ddabe1d3c5 mlx5en: add diagnostic in one more case of failed eeprom read preparation
(cherry picked from commit c097967b9af946cf46246cce5adde53f7e955ecc)
2024-05-13 12:51:29 +03:00
Ed Maste
5e7de5daa9 smsc(4): update to mention Microchip
Microchip Technology acquired SMSC in 2012, and all current products
and datasheets refer to the devices supported by this driver as
Microchip parts.  Mention SMSC in a parenthetical comment to explain
the driver's name.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45115

(cherry picked from commit 7ef6ce51742d44a7375ccbaeda4cc64e034c4816)
2024-05-10 09:01:52 -04:00
Seth Hoffert
3f6515c20f bpf: Make BPF interop consistent with if_loop
The pseudo_AF_HDRCMPLT check is already being done in if_loop and
just needed to be ported over to if_ic, if_wg, if_disc, if_gif,
if_gre, if_me, if_tuntap and ng_iface.  This is needed in order to
allow these interfaces to work properly with e.g., tcpreplay.

PR:		256587
Reviewed by:	markj
MFC after:	2 weeks
Pull Request:	https://github.com/freebsd/freebsd-src/pull/876

(cherry picked from commit 2cb0fce24d64039090dc9243cdf0715ee80c91b1)
2024-05-08 09:06:15 -04:00
Mark Johnston
bff26fe7aa wg: uma_zcreate() does not fail
No functional change intended.

MFC after:	1 week

(cherry picked from commit b6a0ed7c78dd45937e404706620467bef61c308d)
2024-05-02 09:25:08 -04:00
Mark Johnston
4ee7b8e1ef dpaa: uma_zcreate() does not fail
No functional change intended.

MFC after:	1 week

(cherry picked from commit 964064937ea04519bd400668dc1ce38848d50901)
2024-05-02 09:25:08 -04:00
Christos Margiolis
a2b09fc4b8 sound: Add missing space in dev.pcm.X.mode description
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	markj, emaste
Differential Revision:	https://reviews.freebsd.org/D44990

(cherry picked from commit e56c8996fc437488686e7cdef18258f16c5ea74e)
2024-04-29 12:43:31 +02:00
Christos Margiolis
33e0f0cd6b sound: Assert that we do not enter chn_sleep() with CHN_F_SLEEPING
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	markj, emaste
Differential Revision:	https://reviews.freebsd.org/D44959

(cherry picked from commit fa284525499d75955525839074bf5968d0923e6b)
2024-04-29 12:43:31 +02:00
Christos Margiolis
d8d7907826 sound: Fix panic caused by sleeping-channel destruction during asynchronous detach
Currently we are force-destroying all channels unconditionally in
pcm_killchan(). However, since asynchronous audio device detach is
possible as of 44e128fe9d92, if we do not check whether the channel is
sleeping or not and forcefully kill it, we will get a panic from
cv_timedwait_sig() (called from chn_sleep()), because it will try to use
a freed lock/cv.

Modify pcm_killchan() (renamed to pcm_killchans() since that's a more
appropriate name now) to loop through the channel list and destroy only
the channels that are awake, otherwise wake up the sleeping thread and
try again. This loop is repeated until all channels are awakened and
destroyed.

To reduce code duplication, implement chn_shutdown() which wakes up the
channel and sets CHN_F_DEAD, and use it in pcm_unregister() and
pcm_killchans().

Reported by:	KASAN
Fixes:		44e128fe9d92 ("sound: Implement asynchronous device detach")
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D44923

(cherry picked from commit 03614fcba25b9de99e69819bc4690f66a3d24438)
2024-04-29 12:43:30 +02:00
Christos Margiolis
9847c2497d sound: Wrap dsp_clone() and mixer_clone() with bus_topo_lock()
Make sure that the softc isn't freed in between the checks.

Sponsored by:	The FreeBSD Foundation
MFC after;	1 day
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D44991

(cherry picked from commit b18b990d8e7b15d25243d85ea22374dfdde8a18b)
2024-04-29 12:43:30 +02:00
Christos Margiolis
cc72812c49 sound: Fix NULL dereference in dsp_clone() and mixer_clone()
If we only have a single soundcard attached and we detach it right
before entering [dsp|mixer]_clone(), there is a chance pcm_unregister()
will have returned already, meaning it will have set snd_unit to -1, and
thus devclass_get_softc() will return NULL here.

While here, 1) move the calls to dsp_destroy_dev() and mixer_uninit()
below the point where we unset SD_F_REGISTERED, and 2) follow what
mixer_clone() does and make sure we don't use a NULL d->dsp_dev in
dsp_clone().

Reported by:	KASAN
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D44924

(cherry picked from commit 074d6fbebc160222cde6b726adcc7350881d7824)
2024-04-29 12:43:30 +02:00
Christos Margiolis
ac316062a7 sound: Remove obsolete chn_setvolume()
It is marked as obsolete and there are no consumers of it anymore.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	markj, emaste
Differential Revision:	https://reviews.freebsd.org/D44853

(cherry picked from commit 17969e696325273e250a1dc73f43de76c0836aae)
2024-04-29 12:43:30 +02:00
Gordon Bergling
770e03ac39 wtap: Fix typos in kernel messages
- s/cant/can't/

(cherry picked from commit 026520a5f2d2ec01e19494c37b87448df86ef21a)
2024-04-28 07:20:25 +02:00
Gordon Bergling
4f8ee76d2a ds1307(4): Fix a typo in a source code comment
- s/slighly/slightly/

(cherry picked from commit fa3b320668ba6068014337bbbb05dbd39ac8dfb6)
2024-04-27 07:49:47 +02:00
Kyle Evans
60a4a8532b ahc(4): resolve some minor nits
In ahc_init(), qoutfifo is already assigned to effectively the same
value a couple lines up, except in the first assignment it uses the
proper definition; keep the more descriptive assignment.

ahc_targetcmd_offset() gets the offset wrong entirely; as per the
area of ahc_init() this diff also touches, targetcmds is laid out first
in the shared map and it's followed by the qoutfifo.  As a result, we'd
generally be getting negative offsets here.  We can't actually do a
partial sync anyways, so there was no consequence to getting this wrong.

Reviewed by:	imp, mav

(cherry picked from commit b5e0cc2fa44f52f16fc0b9c3f1709bc0f43fe2d0)
2024-04-24 22:59:03 -05:00
Kyle Evans
7c3092e343 ahc(4)/ahd(4): fix target mode on ARM
One of the comments in ahc_execute_scb() notes that the CAM direction is
actually w.r.t. the initiator.  As a consequence, all of our sync ops
end up being wrong because the direction is flipped from that of the
transfer.  Fix it to do proper invalidation and avoid spewing random
garbage out on the SCSI bus.

Reported and tested by:	HP van Braam <hp@tmm.cx>
Reviewed by:	imp, mav

(cherry picked from commit 9dcf39575efb2ff32f955d9e04e04af28d45d798)
2024-04-24 22:58:58 -05:00
Henrich Hartzer
c7a5881d7a Add support for Intel Atom S1200 UART
PR: 278316

Signed-off-by: Henrich Hartzer <henrichhartzer@tuta.io>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1164
(cherry picked from commit 1f2776e123603042944aad9f41ceb46b5b28d8ae)
2024-04-24 17:57:55 -06:00
Eric Joyner
f6de0a7c94
ice(4): Update to 1.39.13-k
- Adds mirror interface functionality
- Remove unused virtchnl headers

Signed-off-by: Eric Joyner <erj@FreeBSD.org>

Sponsored by:	Intel Corporation
Tested by:	jeffrey.e.pieper@intel.com
Differential Revision:	https://reviews.freebsd.org/D44004

(cherry picked from commit 9e54973fc33aa44b77d1c851cb36fcd82dc44cda)
2024-04-24 15:14:48 -07:00
Eric Joyner
988dd5a1f3
ice(4): Update copyright year to 2024
Signed-off-by: Eric Joyner <erj@FreeBSD.org>

Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D44003

(cherry picked from commit 015f8cc5b0c10336a048f37a7071ea03516de242)
2024-04-24 15:14:48 -07:00
Gordon Bergling
0b396f0185 bhnd(4): Remove a double word in a source code comment
- s/of of/of/

(cherry picked from commit d2747968c068b8cfc890901f4955037bad7adb9a)
2024-04-23 07:23:21 +02:00
Gordon Bergling
1e17c11779 safe(4): Remove a double word in a source code comment
- s/of of/of/

(cherry picked from commit 1bbdcf62d3ac8fbea2d4c5b37ccd9ac2032d37d7)
2024-04-23 07:23:04 +02:00
Gordon Bergling
4a393999f3 usb(4): Remove a double word in a source code comment
- s/of of/of/

(cherry picked from commit 604511f84ae6378db25ae3080e9db2e3bc9e0811)
2024-04-23 07:21:45 +02:00
Gordon Bergling
2b343cd2d5 oce(4): Fix a typo in a source code comment
- s/addres/address/

(cherry picked from commit e991acd5d0f60fe3c57acb452003c551194a758b)
2024-04-21 09:33:52 +02:00
Gordon Bergling
04ab41437a muge(4): Fix a typo in a source code comment
- s/addres/address/

(cherry picked from commit 046fe202e76623988ac612b20047940b86dd373f)
2024-04-21 09:33:29 +02:00
Xin LI
e4d8fe76c5 amdsmn(4), amdtemp(4): add support for AMD Family 19h Models 10h-1Fh.
Tested on AMD Threadripper 7960X.

PR:		kern/278311
Tested by:	jbo

(cherry picked from commit 51c69c8682e8ab0e5d82ab3d6f2d16419d40bad4)
2024-04-20 20:15:52 -07:00
Michael Zhilin
2a66844f60 snd_hda: fix "duplicated free" on module unloading
This is trivial fix of hdacc_detach to avoid duplicated free on snd_hda
unloading.

The first try of detaching (kldunload) may results into "device busy" error,
but codec->fgs is freed by detach. Second try attempts to free codec->fgs again
and system panicks.

Here is example:

pcm0: unregister: channel pcm0:virtual:dsp0.vp0 busy (pid 3428)
pulseaudio[3428] [oss] module-oss.c: DSP shutdown.
pcm0: detached
hdaa0: detached
panic: Duplicate free of 0xfffff80412ee7d20 from zone 0xfffffe006bc0ba00
(malloc-32) slab 0xfffff80412ee7fc8(105)
cpuid = 6
time = 1712999565
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe0202f859e0
vpanic() at vpanic+0x135/frame 0xfffffe0202f85b10
panic() at panic+0x43/frame 0xfffffe0202f85b70
uma_dbg_free() at uma_dbg_free+0x105/frame 0xfffffe0202f85b90
uma_zfree_arg() at uma_zfree_arg+0x95/frame 0xfffffe0202f85be0
free() at free+0xa1/frame 0xfffffe0202f85c20
hdacc_detach() at hdacc_detach+0x2f/frame 0xfffffe0202f85c40
device_detach() at device_detach+0x197/frame 0xfffffe0202f85c80
devclass_driver_deleted() at devclass_driver_deleted+0x66/frame 0xfffffe0202f85c
devclass_delete_driver() at devclass_delete_driver+0x81/frame 0xfffffe0202f85d00
driver_module_handler() at driver_module_handler+0xff/frame 0xfffffe0202f85d50
module_unload() at module_unload+0x32/frame 0xfffffe0202f85d70
linker_file_unload() at linker_file_unload+0x1eb/frame 0xfffffe0202f85db0
kern_kldunload() at kern_kldunload+0x18e/frame 0xfffffe0202f85e00
amd64_syscall() at amd64_syscall+0x153/frame 0xfffffe0202f85f30
fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe0202f85f30

MFC after:              3 days
Reviewed by:            markj, christos
Differential Revision:  https://reviews.freebsd.org/D44778
Sponsored by:           Postgres Professional

(cherry picked from commit bed0b2146faa2e9a445d9f9196c7b46f50034631)
2024-04-19 09:37:08 +03:00
Michael Zhilin
0a902d7561 snd_hda: Add the full Intel Meteor/Arrow/Lunar Lake HD Audio PCI IDs
This is based off the Linux file sound/hda/intel-dsp-config.c.

Tested on:              Lenovo Thinkbook 16 G6+ IMH
MFC after:              3 days
Reviewed by:            markj, christos
Differential Revision:  https://reviews.freebsd.org/D44777
Sponsored by:           Postgres Professional

(cherry picked from commit 1dd1a696c58fb275aa0e01666d57861eeb51878d)
2024-04-19 09:37:07 +03:00
Josef 'Jeff' Sipek
788987e034 acpi_battery: avoid divide-by-zero when no devices have capacity info
On laptops with builtin batteries, disconnecting the battery may show up
as a battery without any capacity information. (The theory is that one
is disconnecting the cells but the electronics identifying the battery
are still connected.) As a result, the loop over all batteries in
acpi_battery_get_battinfo results in total_lfcap == 0.

So, just check that total_lfcap is non-zero to avoid a division by zero
(triggerable by sysctl hw.acpi.battery).

Reported by:	Stefano Marinelli
Tested by:	Stefano Marinelli
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D44818

(cherry picked from commit 2e850b832f5d2adb9b230d191277d67c00caaab9)
2024-04-19 03:16:52 +00:00
Mitchell Horne
9319a8a11a simple_mfd: don't attach children twice
Trying to probe+attach the child device at the point it is added comes
before the syscon handle is set up (if relevant). It will therefore be
unavailable to the attach method which is expecting it, and the first
attempt to attach the device will fail.

Just rely on the call to bus_generic_attach() at the end of the function
to perform probe+attach of dev's children.

Reviewed by:	manu
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D44268

(cherry picked from commit accda781531788a814bc438e1e96ef544c12aeaf)
2024-04-18 15:11:31 -03:00
Mitchell Horne
29701960b3 clk_fixed: call clkdom_dump() for verbose boot
This is standard practice for clock drivers that register clocks
dynamically. Nothing else uses the CLK_DEBUG macro.

The result is that the name and frequency of the fixed clock is printed
for a verbose boot, which may aid in debugging.

Reviewed by:	manu
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D44265

(cherry picked from commit 6e66bb9fc3d026765113fa1258cd12292da9309a)
2024-04-18 15:11:31 -03:00
Mitchell Horne
5eb27a0d68 clk_fixed: quiet by default
We may attach several of these devices, but there is no meaningful
information added to dmesg. For example:

  ofwbus0: <Open Firmware Device Tree>
  clk_fixed0: <Fixed clock> on ofwbus0
  clk_fixed1: <Fixed clock> on ofwbus0
  clk_fixed2: <Fixed clock> on ofwbus0
  clk_fixed3: <Fixed clock> on ofwbus0
  clk_fixed4: <Fixed clock> on ofwbus0
  clk_fixed5: <Fixed clock> on ofwbus0
  clk_fixed6: <Fixed clock> on ofwbus0
  clk_fixed7: <Fixed clock> on ofwbus0
  clk_fixed8: <Fixed clock> on ofwbus0
  clk_fixed9: <Fixed clock> on ofwbus0
  clk_fixed10: <Fixed clock> on ofwbus0
  clk_fixed11: <Fixed clock> on ofwbus0

To reduce this noise, quiet the devices for by default. For verbose
boot, the message will be emitted.

Reviewed by:	manu
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D44266

(cherry picked from commit 1cb9f6f6413e9d242de47e730ec7d4ce3e5688fe)
2024-04-18 15:11:31 -03:00
Mitchell Horne
327987597b clkdom_dump(): improve output text
If the call to clknode_get_freq() returns an error (unlikely), report
this, rather than printing the error code as the clock frequency.

If the clock has no parent (e.g. a fixed reference clock), print "none"
rather than "(NULL)(-1)". This is a more human-legible presentation of the
same information.

Reviewed by:	manu
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D44267

(cherry picked from commit 08635c51d1e34f8a3e42c7cf35dc7264a5b68118)
2024-04-18 15:11:31 -03:00
Christos Margiolis
5abbbb7c64 sound: Remove leftover references to snd_clone
The snd_clone framework does not exist as of
e8c0d15a64fadb4a330f2da7244becaac161bb70 ("sound: Get rid of snd_clone
and use DEVFS_CDEVPRIV(9)"), so remove leftover references to it from
unit.c.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 months
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D44758

(cherry picked from commit 068c675ca7aec11d3546c3f908e842a7eca2ccae)
2024-04-18 14:39:41 +02:00
Christos Margiolis
51abcd0c47 sound: Update some LICENSE headers
The following commits introduced substantial changes to pcm/dsp.c,
pcm/sndstat.c and pcm/sound.c.

9da3b645dbaaad724d524727d003fed7be05ff7c ("sound: Move
sndstat_prepare_pcm() to pcm/sndstat.c and remove
sndstat_entry->handler")
e8c0d15a64fadb4a330f2da7244becaac161bb70 ("sound: Get rid of snd_clone
and use DEVFS_CDEVPRIV(9)")

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D44757

(cherry picked from commit 4f854658c5d6ca98c822491991052574d948617d)
2024-04-18 14:39:36 +02:00
Christos Margiolis
d692c314d2 sound: Implement asynchronous device detach
Hot-unplugging a sound device, such as a USB sound card, whilst being
consumed by an application, results in an infinite loop until either the
application closes the device's file descriptor, or the channel
automatically times out after hw.snd.timeout seconds. In the case of a
detach however, the timeout approach is still not ideal, since we want
all resources to be released immediatelly, without waiting for N seconds
until we can use the bus again.

The timeout mechanism works by calling chn_sleep() in chn_read() and
chn_write() (see pcm/channel.c) in order to send the thread to sleep,
using cv_timedwait_sig(). Since chn_sleep() sets the CHN_F_SLEEPING flag
while waiting for cv_timedwait_sig() to return, we can test this flag in
pcm_unregister() (called during detach) and wakeup the sleeping
thread(s) to immediately kill the channel(s) being consumed.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 months
PR:		194727
Reviewed by:	dev_submerge.ch, bapt, markj
Differential Revision:	https://reviews.freebsd.org/D43545

(cherry picked from commit 44e128fe9d92c1a544b801cb56e907a66ef34691)
2024-04-18 14:39:31 +02:00
Christos Margiolis
e6c51f6db8 sound: Get rid of snd_clone and use DEVFS_CDEVPRIV(9)
Currently the snd_clone framework creates device nodes on-demand for
every channel, through the dsp_clone() callback, and is responsible for
routing audio to the appropriate channel(s). This patch gets rid of the
whole snd_clone framework (including any related sysctls) and instead
uses DEVFS_CDEVPRIV(9) to handle device opening, channel allocation and
audio routing. This results in a significant reduction in code size as
well as complexity.

Behavior that is preserved:

- hw.snd.basename_clone.
- Exclusive access of an audio device (i.e VCHANs disabled).
- Multiple processes can read from/write to the device.
- A device can only be opened as many times as the maximum allowed
  channel number (see SND_MAXHWCHAN in pcm/sound.h).
- OSSv4 compatibility aliases are preserved.

Behavior changes:

Only one /dev/dspX device node is created (on attach) for each audio
device, as opposed to the current /dev/dspX.Y devices created by
snd_clone. According to the sound(4) man page, devices are not meant to
be opened through /dev/dspX.Y anyway, so it is best if we do not create
device nodes for them in the first place. As a result of this, modify
dsp_oss_audioinfo() to print /dev/dspX in the "ai->devnode", instead of
/dev/dspX.Y.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 months
Reviewed by:	dev_submerge.ch, bapt, markj
Differential Revision:	https://reviews.freebsd.org/D44411

(cherry picked from commit e8c0d15a64fadb4a330f2da7244becaac161bb70)
2024-04-18 14:39:26 +02:00
Michael Tuexen
307daa4f17 vnic: fix compilation of an IPv6 only kernel
Sponsored by:	Netflix, Inc.

(cherry picked from commit 1d3d30c8d2e41052796c5bdd9220d7e3daabccad)
2024-04-17 15:43:08 +02:00
Alexander Motin
e48f7ff6a1 ahc/ahd: Fix target mode operation
After 5e63cdb457 the drivers didn't clear CAM_DIS_DISCONNECT in
ah*_handle_target_cmd() when needed, only set it.

Reported/tested by:	HP van Braam <hp@tmm.cx>
MFC after:	1 week

(cherry picked from commit f1e4c095777db088645008848b3bfb87146c13ec)
2024-04-17 09:39:37 -04:00
Gleb Smirnoff
8062f37d1c vtnet: set VNET context in RX handler
The context is required for NIC-level pfil(9) filtering.

(cherry picked from commit 3f2b9607756d0f92ca29c844db0718b313a06634)
2024-04-16 08:56:32 -07:00
Christos Margiolis
72eb6d65ed sound: Move sndstat_prepare_pcm() to pcm/sndstat.c and remove sndstat_entry->handler
Since all sndstat_entry->handler fields point to sndstat_prepare_pcm(),
we can just call the function directly, without assigning it to a
function pointer and calling it indirectly.

While here, move sndstat_prepare_pcm() to pcm/sndstat.c, as it is more
suitable there.

No functional change intended.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	dev_submerge.ch, markj
Differential Revision:	https://reviews.freebsd.org/D44571

(cherry picked from commit 9da3b645dbaaad724d524727d003fed7be05ff7c)
2024-04-16 03:47:57 +02:00
Mark Johnston
14148b5c5c wg: Use ENETUNREACH when transmitting to a non-existent peer
The old errno value used is specifically for Capsicum and shouldn't be
co-opted in this way.  It has special handling in the generic syscall
layer (see syscallret()).  OpenBSD returns ENETUNREACH in this case;
let's do the same thing.

Reviewed by:	kevans, imp
MFC after:	2 weeks
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D44582

(cherry picked from commit 63613e3ba1e188e9fece43e1613bd697f04b345e)
2024-04-15 10:05:13 -04:00
John Baldwin
bf5956c185 cxgbe: Support TCP_USE_DDP on offloaded TOE connections
When this socket option is enabled, relatively large contiguous
buffers are allocated and used to receive data from the remote
connection.  When data is received a wrapper M_EXT mbuf is queued to
the socket's receive buffer.  This reduces the length of the linked
list of received mbufs and allows consumers to consume receive data in
larger chunks.

To minimize reprogramming the page pods in the adapter, receive
buffers for a given connection are recycled.  When a buffer has been
fully consumed by the receiver and freed, the buffer is placed on a
per-connection free buffers list.

The size of the receive buffers defaults to 256k and can be set via
the hw.cxgbe.toe.ddp_rcvbuf_len sysctl.  The
hw.cxgbe.toe.ddp_rcvbuf_cache sysctl (defaults to 4) determines the
maximum number of free buffers cached per connection.  Note that this
limit does not apply to "in-flight" receive buffers that are
associated with mbufs in the socket's receive buffer.

Co-authored-by:	Navdeep Parhar <np@FreeBSD.org>
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D44001

(cherry picked from commit eba13bbc37ab4f45a8a3502d59c37d56d9a04ca5)
2024-04-12 12:25:17 -07:00
Konstantin Belousov
fd02cfeb9a pcireg.h: Add AMD IOMMU Base Cap definitions
(cherry picked from commit 33adb388c78ee48efbdc9b497fe2224397fdee84)
2024-04-12 04:18:32 +03:00
Konstantin Belousov
83fe75d6c1 pcireg.h: add include guard
(cherry picked from commit 1cd9868f04c3e91929974dca3444a79047f4e602)
2024-04-12 04:18:32 +03:00
Christos Margiolis
7e0c6e00b3 sound: Remove unused SND_DEV_LAST and SND_DEV_MAX constants
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D44554

(cherry picked from commit b5e55dbf357472ffa39345b30b8b781e988a440f)
2024-04-12 03:09:51 +02:00
Christos Margiolis
578a8fb50c sound: Fix SND_DIAGNOSTIC ifdef comment
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Reviewed by:	markj
Differential Revision:	https://reviews.freebsd.org/D44555

(cherry picked from commit c136e6180e4762c1180d89cd2291fd9a935a721d)
2024-04-12 03:09:51 +02:00