Commit graph

43036 commits

Author SHA1 Message Date
Ahmad Khalifa
38dc6b814a acpi_iicbus: install the address space handler by default
Signed-off-by: Ahmad Khalifa <ahmadkhalifa570@gmail.com>

Reviewed by:	wulf
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1583

(cherry picked from commit d3b1dcb408e2f63845aee5508fe4c73db1f94b58)
2025-03-25 19:28:39 -06:00
Ahmad Khalifa
513d89fef9 usb: increase USB_PORT_RESET_RECOVERY
10ms seems to be too strict for some configurations, so increase to
20ms.

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

(cherry picked from commit e152944f1a16a4ff33b4e20b813ce4a54b884b90)
2025-03-25 19:28:38 -06:00
Ahmad Khalifa
7d042b0af1 bytgpio: expose PNP info
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1349

(cherry picked from commit 969484b53217cee65d6802f1954f0431cbfc6b45)
2025-03-25 19:28:38 -06:00
Ahmad Khalifa
1a8a24e340 acpi_iicbus: Shift slave address
The address is expected to need shifting.
see https://uefi.org/specs/ACPI/6.5/13_System_Mgmt_Bus_Interface_Specification.html#smbus-slave-addresses

Reviewed by: imp, markj, Elliott Mitchell
Pull Request: https://github.com/freebsd/freebsd-src/pull/1125

(cherry picked from commit 67677a654aa7456f18077ccbaa9c40f39a36d21a)
2025-03-25 19:28:37 -06:00
Ahmad Khalifa
4073e53e42 acpi_cmbat: Use nitems instead of sizeof
Reviewed by: imp, markj, Elliott Mitchell
Pull Request: https://github.com/freebsd/freebsd-src/pull/1125

(cherry picked from commit d0cc25f770aee068bcbaee89aa2f52cc5dd79dd5)
2025-03-25 19:28:37 -06:00
Warner Losh
d3a659a338 usb-msctest: Be more conservative setting GETMAXLUN quirk
Only set the GETMAXLUN quirk when it causes an error, but don't set it
when it returns 0. Since we reset the device when we set any quirk, only
set this quirk when it generates an error so umass will avoid it. When
the command works, there's no reason for umass to avoid it at all.

MFC After: 1 week
Sponsored by: Netflix

(cherry picked from commit b0375f78e32acd7947d28126a5e165f8139a5a23)
2025-03-24 21:01:56 -06:00
Konstantin Belousov
772390b6da mlx5en: bump MLX5E_MAX_BUSDMA_RX_SEGS
(cherry picked from commit 480fc5b8e5dee2f111623eaec95c76575d876aa7)
2025-03-20 05:13:38 +02:00
Konstantin Belousov
466623f29d mlx5en: fix rq->wqe_sz usage
(cherry picked from commit 016f40466afc029df28d699650237b182aa88211)
2025-03-20 05:13:38 +02:00
Konstantin Belousov
f38e9a31ba mlx5: bump the max LRO packet size
(cherry picked from commit c2987d7876a04c292d29c74cd6f9c02a82689ed5)
2025-03-20 05:13:38 +02:00
Konstantin Belousov
c083ab4c8b mlx5en: stop arbitrary limiting max wqe size
(cherry picked from commit 89491b1edb3438ebce84e17fdb6c1acab35df601)
2025-03-20 05:13:38 +02:00
Konstantin Belousov
6cb0bd50b5 mlx5: overwrite only the echo reply timestamp from the last packet in LRO
(cherry picked from commit bc1023849256b786fd21aad06a1a1b577c5dbd9d)
2025-03-20 05:13:38 +02:00
Konstantin Belousov
f6e15b6620 mlx5: assert CQE structure size
(cherry picked from commit 7560ed3a6b9deff85b2e865b6db74eb5e0f5f64b)
2025-03-20 05:13:38 +02:00
Konstantin Belousov
ec55118821 mlx5: correct the predicate asserted in __predict_true()
(cherry picked from commit 903996760d1903a7bb594b7f2ed8072e9e6cef9f)
2025-03-20 05:13:38 +02:00
Konstantin Belousov
7b64ccdf96 mlx5: recalculate tcp checksum for ipv6 hw lro coalesced packet
(cherry picked from commit efe9a3996ee319358c51681a6d9da8b4bf608b03)
2025-03-20 05:13:37 +02:00
Konstantin Belousov
3c5bf8d9d9 mlx5: recalculate tcp checksum for ipv4 hw lro coalesced packet
(cherry picked from commit 3eb6d4b4a25a13b9ea9d825ee44c641b91669d06)
2025-03-20 05:13:37 +02:00
Konstantin Belousov
7ebbf9f756 mlx5_en: correct recalculation of the ipv4 checksum for hw lro packet
(cherry picked from commit dd1bd0ec5c91c21f1f60bb8bc58b2f5e794df43f)
2025-03-20 05:13:37 +02:00
Konstantin Belousov
17a322cae6 mlx5en: follow PRM for setting the max hw lro segment size
(cherry picked from commit c3555174fd97ce12682e5ed1e2d2586016962a8f)
2025-03-20 05:13:37 +02:00
Konstantin Belousov
aebeaf151d mlx5en: explain why interface needs to be reopened on hw lro change
(cherry picked from commit 93e70e3a9442dca31533f0773ede667fd5379b01)
2025-03-20 05:13:37 +02:00
Konstantin Belousov
114a805bef mlx5en: make the hw lro control dynamic
(cherry picked from commit 02fe38b92175cb8f3a77f7a2bb72afb83836ebd2)
2025-03-20 05:13:37 +02:00
Konstantin Belousov
d0a800a7fc mlx5core: add mlx5_core_modify_tir()
(cherry picked from commit 98071573638a1f31e4007894ce20a4fdc8e33a1d)
2025-03-20 05:13:37 +02:00
Konstantin Belousov
9ac8af72a7 mlx5en: control hw LRO with the driver conf sysctl, leaving IFCAP_LRO to sw
(cherry picked from commit 816f27e848e549e6ff895affc29298f68e0bb644)
2025-03-20 05:13:37 +02:00
Konstantin Belousov
cb49625f15 mlx5en: make conf.hw_lro sysctl r/w
(cherry picked from commit bbac54b820cb9b76d19082d1f9f36507c3dd3a0e)
2025-03-20 05:13:37 +02:00
Christos Margiolis
7e8f29eb1b snd_hda: Patch Framework AMD 13th gen
Redirect sound to headphone jack when plugged in.

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

(cherry picked from commit 68b6567d09ddd29a16443ad709e2609a9902a190)
2025-03-20 01:35:59 +01:00
Christos Margiolis
b61c045ff8 sound: Remove redundant check in mixer_clone()
PCM_REGISTERED() does this check through PCM_ALIVE().

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week

(cherry picked from commit cabf76fde8368222a68865953521e1c3668b5298)
2025-03-19 15:52:08 +01:00
Wei Hu
64610df593 mana: remove redundant doorbell in mana_poll_rx_cq()
With the last commit to refill the rx mbuf in batch, the doorbell
in mana_poll_rx_cq() becomes redundant. Remove it to save a few
microseconds spent in mmio call.

Reported by:	NetApp
Reviewed by:	Tallamraju, Sai
Tested by:	whu
Fixes:		9b8701b8 ("mana: refill the rx mbuf in batch")
MFC after:	3 days
Sponsored by:	Microsoft

(cherry picked from commit 47f4137e44b8079c7784604d220a298db07a19a1)
2025-03-18 04:53:56 +00:00
Slava Shwartsman
8a78a9aa99 mlx5: Fix BlueField-4 device description
(cherry picked from commit 7008b9fab5552fd6dcf5a00cd2c62144d54ef3a0)
2025-03-18 03:41:18 +02:00
Christos Margiolis
4ed0ca91a3 sound: Make feed_mixer_apply() __always_inline
Reported by:	mav
Fixes:		4021fa32d92d ("sound: Simplify pcm/feeder_mixer.c")
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 717adecbbb5293d8386caa866c21421ef9eeb22c)
2025-03-17 19:29:17 +01:00
Christos Margiolis
caa06360e6 sound: Update COPYRIGHT notices
Only to files I've currently made significant contributions to.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week

(cherry picked from commit c824383b269d8abe175ea4751194660716d5600e)
2025-03-17 19:29:17 +01:00
Christos Margiolis
65dec16946 sound: Make dev.pcm.X.mode dynamic
Currently dev.pcm.X.mode is calculated only once in pcm_sysinit(), which
is called by pcm_register() during attach, but this can result in
inconsistencies.

For some context, what pcm_mode_init() does is, it checks if "playcount"
is positive, in which case we assume the device supports playback. The
same is done for "reccount" for recording, and if "mixer_dev" is not
NULL, we know the device has a mixer.

The "playcount" and "reccount" variables correspond to the number of
_primary_ playback/recording channels, so we can assume that the primary
channels have been created before reaching pcm_mode_init(). However, for
the mixer that's not always the case. If the mixer is created _after_
pcm_register(), as is the case for snd_dummy(4) for example,
pcm_mode_init() will see that "mixer_dev" is NULL, and report that the
device does not have a mixer, whereas in reality we just created it
afterwards.

While this could be fixed by simply creating the mixers always before
pcm_register(), it is better to be robust and calculate the mode
dynamically.

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

(cherry picked from commit ab95710f30f7255d3a6be22a1a2c375ee0f96868)
2025-03-17 19:29:17 +01:00
Christos Margiolis
31ddfe9d9c sound: Retire SD_F_AUTOVCHAN
This flag is redundant and essentially a no-op, as it is set when the
device supports at least playback or recording, which is almost always
the case. But even if the device is mixer-only (i.e., 0 channels), there
is no reason to keep this flag; it is only used to bail out of the vchan
sysctl handlers, but we already bail out anyway if we try to use the
sysctl in a vchan direction that is not supported.

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

(cherry picked from commit b768f2c7773b6e306fb43687657414f9f42a27d4)
2025-03-17 19:29:15 +01:00
Christos Margiolis
42889e8e2f sound: Take dsp_cdevsw out of header file
Not used outside of pcm/dsp.c.

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

(cherry picked from commit 2fda8597116e760c32f07af43d260041f975b650)
2025-03-17 19:28:54 +01:00
Christos Margiolis
a33356100b sound: Simplify pcm/feeder_mixer.c
- Get rid of macro magic.
- Make feed_mixer_info handling similar to most feeders.

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

(cherry picked from commit 4021fa32d92d656d3d43186cc231695c7ad53d33)
2025-03-17 19:28:54 +01:00
Christos Margiolis
15dc84ba5f sound: Remove feed_matrix_apply_generic()
It does what feed_matrix_apply() already does, so it is redundant.

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

(cherry picked from commit b73b5f70e9f6be951e66531f6f57249eea4ba4dc)
2025-03-17 19:28:54 +01:00
Christos Margiolis
a25f84cf09 sound: Remove macro magic from pcm/feeder_matrix.c
Turn the FEEDMATRIX_DECLARE macro into a single inline function
(feed_matrix_apply()). There is no reason to have this as a macro, it
only complicated the code. An advantage of this patch is that, because
we no longer call the functions created by the macro through function
pointers (apply field of feed_matrix_info), we can call
feed_matrix_apply() directly in feed_matrix_feed().

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

(cherry picked from commit ac24c9da8bb7af731646dd7924841a28e2ad7ad7)
2025-03-17 19:28:54 +01:00
Christos Margiolis
b2adb71308 sound: Remove macro magic from pcm/feeder_eq.c
Turn the FEEDEQ_DECLARE macro into a single inline function
(feed_eq_biquad()). There is no reason to have this as a macro, and it
only complicates the code. An advantage of this patch is that, because
we no longer call the functions created by the macro through function
pointers (biquad_op), we can call feed_eq_biquad() directly in
feed_eq_feed().

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

(cherry picked from commit e18d66d9c515abc729f5c4740b9b999d28abc333)
2025-03-17 19:28:54 +01:00
Christos Margiolis
d8c3c6752b sound: Turn clamp macros into a function
This makes some subsequent feeder refactors easier to implement.

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

(cherry picked from commit 4918fc2e238b581aaf1f63e20003d5fa957f0b09)
2025-03-17 19:28:54 +01:00
Christos Margiolis
33529d6ad4 sound: Refactor the format conversion framework
Merge the PCM_READ|WRITE_* macros defined in pcm/pcm.h, as well as the
intpcm_read|write_* macros defined in pcm/feeder_format.c, into six
inline functions: pcm_sample_read|write[_norm|calc](). The absence of
macro magic makes the code significantly easier to read, use and modify.

Since these functions take the input/output format as a parameter, get
rid of the read() and write() function pointers defined in struct
feed_format_info, as well as the feeder_format_read|write_op()
functions, and use the new read/write functions directly.

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

(cherry picked from commit 433e270f341cf660b2fe125c2e0f733073829188)
2025-03-17 19:28:54 +01:00
Kyle Evans
7215aed797 kern: wg: remove overly-restrictive address family check
IPv4 packets can be routed via an IPv6 nexthop, so the handling of the
parsed address family is more strict than it needs to be.  If we have a
valid header that matches a known peer, then we have no reason to
decline the packet.

Convert it to an assertion that it matches the destination as viewed by
the stack below it, instead.  `dst` may be the gateway instead of the
destination in the case of a nexthop, so the `af` assignment must be
switched to use the destination in all cases.

Add a test case that approximates a setup like in the PR and
demonstrates the issue.

PR:		284857
Reviewed by:	markj (earlier version), zlei

(cherry picked from commit 2bef0d54f74dad6962ef7d1dfa407e95cb4fb4ad)
2025-03-14 21:52:02 -05:00
Wei Hu
5c97b7c296 mana: refill the rx mbuf in batch
Set the default refill threshod to be one quarter of the rx queue
length. User can change this value with hw.mana.rx_refill_thresh
in loader.conf. It improves the rx completion handling by saving
10% to 15% of overall time with this change.

Tested by:	whu
MFC after:	2 weeks
Sponsored by:	Microsoft

(cherry picked from commit 9b8701b81f14f0fa0787425eb9761b765d5faab0)
2025-03-12 09:09:32 +00:00
Wei Hu
dae67894b4 mana: Increase default tx and rx ring size to 1024
Tcp perfomance tests show high number of retries under heave tx
traffic. The numbers of queue stops and wakeups also increase.
Further analysis suggests the FreeBSD network stack tends to send
TSO packets with multiple sg entries, typically ranging from
10 to 16. On mana, every two sgs takes one unit of tx ring.
Therefore, adding up one unit for the head, it takes 6 to 9 units
of tx ring to send a typical TSO packet.

Current default tx ring size is 256, which can get filled up
quickly under heavy load. When tx ring is full, the send queue
is stopped waiting for the ring space to be freed. This could
cause the network stack to drop packets, and lead to tcp
retransmissions.

Increase the default tx and rx ring size to 1024 units. Also
introduce two tuneables allowing users to request tx and rx ring
size in loader.conf:
        hw.mana.rx_req_size
        hw.mana.tx_req_size
When mana is loading, the driver checks these two values and
round them up to power of 2. If these two are not set or
the request values are out of the allowable range, it sets the
default ring size instead.

Also change the tx and rx single loop completion budget to 8.

Tested by:	whu
MFC after:	2 weeks
Sponsored by:	Microsoft

(cherry picked from commit a18e99945414fb1f9d455b780c6fcf2d09cc68d8)
2025-03-12 08:40:56 +00:00
Wei Hu
ec0c098369 Hyper-V: hn: rewrite hn rsc swtich to avoid sysctl hang
Changing the rsc_switch flag using sysctl to turn rsc on or off
could hang. The orignal code sends request to host to get the
mtu setting. Sometimes the host fails to reply, causing
the thread to sleep forever waiting for the host response.

Use existing cached mtu from hn device instead to avoid calling
host.

Reported by:	whu
Tested by:	whu
MFC after:	1 week

(cherry picked from commit da1deb784d9ad3a4015a3f91fa1a5ce394fd3fdb)
2025-03-12 08:18:01 +00:00
Warner Losh
642fc04eda usb: Kill left-over cdefs.h includes
These includes were for __FBSD_RCSID() macro. They weren't formatted
like the rest of the tree so weren't trimmed automatically when that
script was run. Trim them now.

MFC After: 1 week
Sponsored by:		Netflix

(cherry picked from commit ca48e43ba9ee73a07cdbad8365117793b01273bb)
2025-03-11 09:41:19 -06:00
Slava Shwartsman
b328b79f6f mlx5en: Fix domain set usage in TLS tag import functions
(cherry picked from commit 85af37e15958bd050093e6368afe6afe8e7a5ced)
2025-03-11 02:59:11 +02:00
Vladimir Kondratyev
e7d1f208fd gpioaei: Add support for ACPI _EVT method
This method is often used to process GPIO "Power on" button press on
modern x86 laptops with S0ix sleep mode.

Tested with patch from https://reviews.freebsd.org/D26407

Sponsored by:	Future Crew LLC
MFC after:	2 month

(cherry picked from commit adc2c156acb50bac6e8ec66b72cadc8910ce4975)
2025-03-09 23:42:35 +03:00
Ahmad Khalifa
f05f6d9373 acpi_gpiobus: assume GPIO_PIN_INPUT for interrupt pins
Different drivers respond differently to having neither GPIO_PIN_INPUT
or GPIO_PIN_OUTPUT set, this stops the unpredictable results.

(cherry picked from commit 6aab381a498f1a43ba372f4ae9f57ef88b4767b5)
2025-03-09 23:42:13 +03:00
Jasper Tran O'Leary
875ec35c06 gve: Fix qpl_buf_head being initialized improperly
Currently, for DQO QPL our MPASS assertion on qpl_buf_head for available
pending_pkts (i.e. not holding a packet) fails due to incorrect
initialization. The MPASS fails on the first run of packets through the
ring when INVARIANTS is on, and when INVARIANTS is off, things work
without a bug.

The MPASS guards against improper reaping of "pending_pkt" objects,
and thus was failing for the first run through the ring. By correctly
initializing the objects in this patch we make the MPASS not fail on the
first run too.

Signed-off-by: Vee Agarwal <veethebee@google.com>
Signed-off-by: Jasper Tran O'Leary <jtranoleary@google.com>

Reviewed by:	delphij, markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D48968

(cherry picked from commit 73c3fe4db3ebc2bd6cb732aae77ea017fd376d22)
2025-03-07 22:51:48 +00:00
Jasper Tran O'Leary
28ba212a95 gve: Do minor cleanup and bump version
This commit fixes several minor issues:

- Removes an unnecessary function pointer parameter on gve_start_tx_ring
- Adds a presubmit check against style(9)
- Replaces mb() and rmb() macros with native
  atomic_thread_fence_seq_cst() and atomic_thread_fence_acq()
  respectively
- Fixes various typos throughout
- Increments the version number to 1.3.2

Co-authored-by: Vee Agarwal <veethebee@google.com>
Signed-off-by: Vee Agarwal <veethebee@google.com>
Signed-off-by: Jasper Tran O'Leary <jtranoleary@google.com>

Reviewed by:	delphij, markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D48969

(cherry picked from commit 031800c786823a9ad4c4d2f79f217d42dad3f5d1)
2025-03-07 22:51:48 +00:00
Jasper Tran O'Leary
65f5027e38 gve: Fix memory leak during reset
Before this change, during reset we were allocating new memory for
priv->ptype_lut_dqo, irq_db_array and the counter_array over the old
memory. This change ensures we do not allocate new memory during reset
and avoid memory leaks.

Signed-off-by: Vee Agarwal <veethebee@google.com>
Signed-off-by: Jasper Tran O'Leary <jtranoleary@google.com>

Reviewed by:	delphij, markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D48970

(cherry picked from commit 62b2d0c3f4add3bb87081a96412056e17eed31ea)
2025-03-07 22:51:48 +00:00
Jasper Tran O'Leary
9d4823824d gve: Disallow MTUs within a problematic range
If hardware LRO is enabled with GVE, then setting the driver's MTU to a
range of values around 8000 will cause dropped packets and drastically
degraded performance. While this issue is being investigated, we need
to prohibit the driver's MTU being set to a value within this range.

Signed-off-by: Jasper Tran O'Leary <jtranoleary@google.com>

Reviewed by:	delphij, markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D48971

(cherry picked from commit 909e2d7b691f7418a78b1289a51d3b6c46860a9b)
2025-03-07 22:51:48 +00:00
Christos Margiolis
858504a1d8 sound: Call chn_kill() in chn_init() failure
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D48966

(cherry picked from commit bc7e65e950154572d8c9a04dc033075bf37aae40)
2025-03-04 16:46:06 +01:00