Commit graph

42352 commits

Author SHA1 Message Date
Mark Johnston
dc2e20244c agp: Set the driver-specific field correctly
PR:		281035
Reviewed by:	mhorne
MFC after:	1 week
Fixes:		437ea82ce7 ("agp: Handle multiple devices more gracefully")

(cherry picked from commit 12500c14281dc62ddeac4c5e1e6eabd1e380f11c)
2024-09-05 16:33:47 +02:00
Franco Fichtner
9ed3372651 Revert "ixl: fix multicast filters handling"
This reverts commit 89e7335942.
2024-08-29 20:53:26 +02:00
Franco Fichtner
f8d2d48efc u3g: add SIERRA AC340U
PR: https://forum.opnsense.org/index.php?topic=42214.0
2024-08-27 13:17:35 +02:00
Gordon Bergling
4e368d66aa axgbe: Fix two typos in source code comments
- s/specfied/specified/

(cherry picked from commit 619c9488a31ce14c6570d2e31f70d416382ed7a6)
2024-08-14 12:51:37 +02:00
Stephan de Wit
9774ff2354 axgbe: Implement ifdi_i2c_req for diagnostics information
Fixes https://github.com/opnsense/src/issues/178
2024-08-14 07:07:21 +00:00
Mark Johnston
1f132ff145 xen/netfront: Decouple XENNET tags from mbuf lifetimes
netmap's generic mode tries to improve performance by minimizing mbuf
allocations.  In service of this goal, it maintains an extra reference
to the mbuf and polls the counter to see if the driver has released its
reference by calling m_freem().  As a result, the extref destructor is
not called when expected by the netfront driver, and mbufs tags are not
freed.

Modify the tx path to release its mbuf tags promptly when reclaiming tx
descriptors.  They are drawn from a fixed-size pool, so otherwise are
quickly exhausted when a netfront interface is in netmap generic mode.

Co-authored by:	royger
MFC after:	2 weeks
Fixes:	dabb3db7a8 ("xen/netfront: deal with mbuf data crossing a page boundary")
Sponsored by:	Cloud Software Group
Sponsored by:	Klara, Inc.
Sponsored by:	Zenarmor
2024-08-04 09:34:13 +02:00
Mark Johnston
2c061b74db axgbe: Remove a nonsensical use of kernel_sysctlbyname()
No functional change intended.

MFC after:	1 week

(cherry picked from commit d254651de392538fa7f5c0020093dde0ca06c614)
2024-07-29 08:14:18 +02:00
cihangir
753446511a wg: change dhost to something other than a broadcast address
Signed-off-by: cihangir <cihangir@sunnyvalley.io>
2024-07-29 08:09:37 +02:00
Roger Pau Monné
979bb7ac14 xen-netfront: attempt to make cleanup idempotent
Current cleanup code assumes that all the fields are allocated and/or setup by
the time cleanup is called, but this is not always true: a failure in mid-setup
of the device will cause the functions to be called with possibly uninitialized
fields.

Fix the functions to cope with such sate, while also attempting to make the
cleanup idempotent.

Finally fix an error path during setup that would not mark the device as
closed, and hence prevents the kernel from finishing booting.

Fixes: 96375eac94 ("xen-netfront: add multiqueue support")
Sponsored by: Citrix Systems R&D
2024-07-29 07:46:05 +02:00
Zhenlei Huang
c4da7b7e66 net: Remove unneeded NULL check for the allocated ifnet
Change 4787572d05 made if_alloc_domain() never fail, then also do the
wrappers if_alloc(), if_alloc_dev(), and if_gethandle().

No functional change intended.

Reviewed by:	kp, imp, glebius, stevek
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D45740

(cherry picked from commit aa3860851b9f6a6002d135b1cac7736e0995eedc)
2024-07-15 09:14:32 +02:00
Mark Johnston
f41d27d956 wg: Implement if_transmit unconditionally
Commit bf454ca88bdf made wg_transmit() defined only when "device netmap"
is configured, as if_wg's if_transmit implementation should never be
called otherwise, but this breaks a requirement that interfaces
implement both or neither of if_transmit and if_qflush.

Restore the old behaviour of unconditionally defining wg_transmit().  It
contains an assertion that the interface is in netmap mode.

Reported by:	peterj
MFC after:	2 weeks
Fixes:	bf454ca88bdf ("wg: Add netmap support")

(cherry picked from commit 5515e8874a8d85a8d961fca64c494dfc1bea4bd0)
2024-07-10 08:04:46 +02:00
Mark Johnston
f71f837df1 netmap: Use device_set_descf()
No functional change intended.

MFC after:	1 week

(cherry picked from commit 44d36c9731c172977ad8a95a09c0d6fbddcc9b2f)
2024-07-10 08:03:01 +02:00
Seth Hoffert
57618b20b2 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-06-03 11:06:56 +02:00
Mark Johnston
3b856fd43f wg: Add netmap support
When in netmap (emulated) mode, wireguard interfaces prepend or strip a
dummy ethernet header when interfacing with netmap.  The netmap
application thus sees unencrypted, de-encapsulated frames with a fixed
header.

In this mode, netmap hooks the if_input and if_transmit routines of the
ifnet.  Packets from the host TX ring are handled by wg_if_input(),
which simply hands them to the netisr layer; packets which would
otherwise be tunneled are intercepted in wg_output() and placed in the
host RX ring.

The "physical" TX ring is processed by wg_transmit(), which behaves
identically to wg_output() when netmap is not enabled, and packets
appear in the "physical" RX ring by hooking wg_deliver_in().

Reviewed by:	vmaffione
MFC after:	1 month
Sponsored by:	Klara, Inc.
Sponsored by:	Zenarmor
Differential Revision:	https://reviews.freebsd.org/D43460
2024-06-03 11:06:55 +02:00
Ad Schellevis
6ae3245a92 sys/dev/ixgbe - workaround to prevent an i2c bus read to keep trying to read an empty slot.
When executing `ifconfig -v` this will lead to stalls for a second per interface due to the timeout being set to a static 10 without a module placed, this patch makes sure this is only allowed once per insertion.
2024-06-03 11:06:55 +02:00
Franco Fichtner
1bce065038 axgbe: remove old annotations and a bit of whitespace cleanup 2024-06-03 11:06:55 +02:00
Stephan de Wit
3d5d6a0d0e axgbe: gracefully handle i2c bus failures
In (unknown) situations it seems the i2c bus can have trouble,
while nothing about the current link state has changed, the driver
would react by going into a link down state, and start busylooping
on up to 4 cores. Even if there was a valid link, such spinning
on a cpu by a kernel thread would wreak havoc to existing and
new connections.

This patch does the following:
1. If such a bus failure occurs, we keep the last known link state.
2. Prevent busy looping by implementing the lockmgr() facility to
be able to sleep while the i2c code waits on the i2c ISR. We cap
this with a timeout.
3. Pin the admin queues to the last CPU in the system, to prevent
other scenarios where busy looping might occur from landing on CPU
0, which especially seems to cause a lot of issues.

Given the design constraints both in hardware and in software,
the lockmgr() seems to be the only viable option, even though
FreeBSD explicitly forbids sleeping in callout context, but
fails to explain why this is or offer alternatives.

axgbe: revert allocating admin queues to last CPU

The issue was resolved in 52454a1e5b.
Scheduled threads such as CARP are now no longer pinned to CPU 0, making sure
they always get their time slice even if CPUs are blocked.
2024-06-03 11:06:55 +02:00
Stephan de Wit
7fc6a4cd9a axgbe: LED control for A30 platform
Since the I/O expander chip does not do a reset when soft power
cycling, the driver will first turn off all LEDs when initializing,
although no specific routine seems to be called when powering down.
This means that the LEDs will stay on until the driver has booted up,
after which the driver will be in a consistent state.
2024-06-03 11:06:54 +02:00
Stephan de Wit
c20e4295ea axgbe: account for 4 SFP ports during GPIO expander check 2024-06-03 11:06:54 +02:00
Stephan de Wit
01959f5fcf axgbe: enable RSF to prevent zero-length packets while in Netmap mode
Initially, RSF (Receive Queue Store and Forward) was disabled for
unknown reasons, but the cut-through mode that's enabled as a result
seems to send 0 length packets up to the DMA when the RX queue is
full.
2024-06-03 11:06:54 +02:00
Stephan de Wit
904883d55b axgbe: exclude 10G modules from miibus interface 2024-06-03 11:06:54 +02:00
Ad Schellevis
7ffe076525 axgbe: move phy_stop to axgbe_if_detach()
Since the iflib interface needs axgbe_pci_init() and its phy starting capabilities, no data was passed in its absence.

With the NULL check of the axgbe_miibus we also resort back to an MDIO read as a module might be capable of both
clause 22 and clause 45 methods of communication.

with the move of phy_stop() to if_detach() in d50d4e8cd4, it's better to prevent reconfiguring the phy should the pci_init() callout trigger more than once.
2024-06-03 11:06:54 +02:00
Stephan de Wit
d35993f92b axgbe: apply RRC to miibus attached PHYs and add support for variable bitrate 25G SFP+ DACs 2024-06-03 11:06:54 +02:00
Stephan de Wit
bf084b8bac axgbe: fix link issues for gigabit external SFP PHYs and 100/1000 fiber modules
Within the code path of autonegotiation for gigabit SFP modules was a bug, causing
a report of LINK_ERR for cases where an external SFP PHY was present. Fixing this issue
did not resolve to a link however, as it turned out that while autonegotiation interrupts
were happening, it's resulting status cannot be correctly determined in all cases. In these
specific cases we have no other option than to assume a module has negotiated to 1Gbit/s.

PHY-specific configuration has been delegated to the miibus driver, if an external PHY is present.
It's possible that the i2c bus does not recognize a PHY on the first pass, so in all cases we
retry up to a maximum of 5 times during each link poll pass to ensure we didn't miss the presence
of an external PHY.

This commit also addresses link issues on both 100 mbit and 1Gb fiber modules. Not all of these modules
have the correct data set according to SFF-8472, as such we first check for gigabit compliance and
the associated baudrate, otherwise we resort back to determining what type of fiber module is plugged
in by checking the baudrate, cable length and wavelength and setting the MAC speed accordingly.
2024-06-03 11:06:54 +02:00
Stephan de Wit
316a02fe19 axgbe: also validate configuration register in GPIO expander
It is possible for a machine to boot into a state in which the configuration register,
responsible for controlling wether an I/O signal is considered an input or output,
contains randomized values. It was assumed this was programmed by the BIOS.

If I/O is reversed, it's possible for the driver to think an SFPP module has been inserted
when there is none, leading to unrecoverable I2C errors.

The configuration register should contain a state which is determined and provided by the BIOS,
hence no hard-coded values are programmed here.
2024-06-03 11:06:54 +02:00
Stephan de Wit
d0428202e0 axgbe: several patches from 22.1 not yet present in FreeBSD 2024-06-03 11:06:54 +02:00
Franco Fichtner
36fb07bfef netmap: ring size limit not enough for multi-queue em(4)
Also mutes a spammy message.  Bravely going where no man
has gone before.  :)
2024-06-03 11:06:53 +02:00
Christos Margiolis
8d3f96bd85 sound: Correctly check nvlist_unpack() error
The current check is never false and if nvlist_unpack() fails, we might
panic later down the road.

PR:		266144
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	dev_submerge.ch, emaste
Differential Revision:	https://reviews.freebsd.org/D45237

(cherry picked from commit 64f4e2db6d19d8ab520903a197fcaa8cc7ab9f9a)
(cherry picked from commit 45feaa73c6)

Approved by:	re (cperciva)
2024-05-22 15:22:40 +02:00
Christos Margiolis
18f80d6d46 sound: Check user-supplied size passed to SNDSTIOC_ADD_USER_DEVS*
SNDSTIOC_ADD_USER_DEVS* expects a user-supplied sndstioc_nv_arg->nbytes,
however we currently do not check whether this size is actually valid,
which results in a panic when SNDSTIOC_ADD_USER_DEVS* is called with an
invalid size. sndstat_add_user_devs() calls
sndstat_unpack_user_nvlbuf(), which then calls malloc() with that size.

PR:		266142
Sponsored by:	The FreeBSD Foundation
MFC after:	1 day
Reviewed by:	brooks
Differential Revision:	https://reviews.freebsd.org/D45236

(cherry picked from commit 074d337ad618f9cc2a1d5ab18b484928e57bd72b)
(cherry picked from commit 5830a00c2c)

Approved by:	re (cperciva)
2024-05-22 15:22:26 +02:00
Christos Margiolis
5a9a2f5eed snd_hda: Rename LENOVO_I* to LENOVO_IDEAPAD*
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D45105

(cherry picked from commit 278953360e0e6187c3f7c688cb49254df1567f0b)
(cherry picked from commit 7814ed2bd3)

Approved by:	re (cperciva)
2024-05-22 15:22:10 +02:00
Christos Margiolis
cb23e0eebf snd_hda: Add patch for Lenovo Ideapad 3
Reported by:	bsd-lists@bsdforge.com
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D45100

(cherry picked from commit 54cc353f505dbc5f19168b6b1417b6736433d9ae)
(cherry picked from commit 9a620018af)

Approved by:	re (cperciva)
2024-05-22 15:21:56 +02:00
Christos Margiolis
a0ff4e0f3e sound: Fix oss_sysinfo->numcards
According to the OSS manual, oss_sysinfo->numcards holds the number of
detected audio devices in the system, while the current ncards variable,
whose value is assigned to oss_sysinfo->numcards, holds the number of
currently registered devices only.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	dev_submerge.ch, emaste
Differential Revision:	https://reviews.freebsd.org/D45136

(cherry picked from commit 59d98edae3e1a6fffd292e4393c49862d624f25f)
(cherry picked from commit 2b36982887)

Approved by:	re (cperciva)
2024-05-22 15:21:36 +02:00
Christos Margiolis
a4a473104e sound: Remove nmix variable from mixer_oss_mixerinfo()
nmix is used to compare against oss_mixerinfo->dev, which is a
user-supplied value to select the mixer device (if not -1, in which case
we'll select the default one) we want to fetch the information of. It is
also used to set oss_mixerinfo->dev in case it is -1.

However, nmix is at best redundant, since we have the loop counter
already (i), and confusing at worst.

For example, suppose a system with 3 mixer devices. We call
SNDCTL_MIXERINFO with oss_mixerinfo->dev=1, meaning we want to get
information for /dev/mixer1. Suppose /dev/mixer0 detaches while inside
the loop, so we'll hit the loop's "continue" case, and nmix won't get
incremented (i.e will stay 0 for now). At this point nmix counts 1
device less, so when it reaches 1, we'll be fetching /dev/mixer2's
information instead of /dev/mixer1's.

This is also true in case the mixer device disappears prior to the call
to mixer_oss_mixerinfo().

Simply remove nmix and use the loop counter to both set
oss_mixerinfo->dev and check against it in case a non -1 value is
supplied.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	dev_submerge.ch
Differential Revision:	https://reviews.freebsd.org/D45135

(cherry picked from commit 2f31a5eb75f1e47b5c49f574e8ce48d2c863e9d3)
(cherry picked from commit 8b4e2ba31d)

Approved by:	re (cperciva)
2024-05-22 15:20:42 +02:00
Lexi Winter
78ccc5af3d sys/dev/irdma/irdma_cm: fix compile without INET
irdma_get_vlan_ipv4() calls ip_ifp_find() even if INET isn't defined, in
which case this function isn't available.

Stub this out for the non-INET case to return an error (0xffff) instead.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1156

(cherry picked from commit 0478a0356272ab3907af9d97711f0bb8b14bf38b)
(cherry picked from commit 7aba922879)
Approved-by: re (cperciva)
2024-05-21 14:08:35 -06: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