Commit graph

149465 commits

Author SHA1 Message Date
Frank Hilgendorf
4e219655d0 bwn: remove unused ic_headroom
Unlike bwi(4), bwn(4) does not rely on ic_headroom (despite having it
set) but splits the bwn_txhdr (first) segment into its own transaction.
Remove ic_headroom to avoid net80211 troubles with not enough space in
the mbuf around ieee80211_mbuf_adjust().

PR:		275616

(cherry picked from commit 59dba901f227420647e4856f03cb782a3375c220)
2024-02-18 18:31:14 +00:00
Bjoern A. Zeeb
19a405d238 LinuxKPI: 802.11: bring in some HT code
Fix defines and structures to use proper types.

Bring in basic ni->sta synchronization, some channel width handling,
and overload the net80211 functions so that we can talk to
driver/firmware to setup parameters.  We will likely not need one
or two of those but it is good for tracing currently.

Cover HT and bits of VHT code in LinuxKPI behind apropriate #ifdef
which are currently not enabled (like LKPI_80211_HW_CRYPTO) until
confirmed to work.
Last, IEEE80211_AMPDU_RX_START made some firmware unhappy.

This will allow others to work on it and test as well.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 9fb914634eff85b3b36bcbf39c1faf2967b0aa9e)
2024-02-18 18:31:13 +00:00
Bjoern A. Zeeb
82abd21857 ath: Revert "Use NET_TASK_INIT() and NET_GROUPTASK_INIT() for drivers that process"
This reverts commit 6c3e93cb5a for
sys/dev/ath/if_ath.c only.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 82506f26c03aa312b91e01a797f31e061749a76d)
2024-02-18 18:31:13 +00:00
Bjoern A. Zeeb
5193a7cfcb Revert "[ath] Attempt to fix epoch handling."
This reverts commit af2441fbc7.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit eb3821e6d92fa45ece7ec08efde45e35be1bdc95)
2024-02-18 16:43:39 +00:00
Bjoern A. Zeeb
dd2988b0bc Revert "Enter the network epoch in USB WiFi drivers when processing input"
This reverts commit 17c328b6ae.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 75f298492a12d53df97c26963ec9f2dc0b052878)
2024-02-18 16:42:38 +00:00
Bjoern A. Zeeb
b4038a0b67 Revert "Widen EPOCH(9) usage in USB WLAN drivers."
This reverts commit 21c4082de9.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 39b702797994fbd62a21dd3af6d4cd7045fded23)
2024-02-18 16:42:32 +00:00
Bjoern A. Zeeb
9a8147ca8f Revert "Widen EPOCH(9) usage in PCI WLAN drivers."
This reverts commit b65f813c1a.
As a side effect this also seems to fix wtap which seems to have
lost the epoch over the input path in between.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 1c6dd33d26eb02c6145383a49150965eeca61120)
2024-02-18 16:42:28 +00:00
Bjoern A. Zeeb
8e599ff98d net80211: move net_epoch into net80211
Move the net_epoch into net80211 around the if_input calls and out of
the driver (in this first case LinuxKPI).  This reduces coverage but
also allows us to alloc in calls like (*ampdu_rx_start) which do not
actually pass data up the stack.

The follow-up commits will revert b65f813c1a,
21c4082de9,
17c328b6ae,
af2441fbc7,
and 6c3e93cb5a for ath.

Sponsored by:	The FreeBSD Foundation
Tested by:	few (rtwn, ath, iwlwifi, ...)
Reviewed by:	adrian
Differential Revision: https://reviews.freebsd.org/D42427

(cherry picked from commit de607e3c230be88f6232b9c9fd6c37199648dc8c)
2024-02-18 16:42:21 +00:00
Bjoern A. Zeeb
826c28fa98 net80211: ieee80211_dump_node() check for channel to be set
Avoid panics in case ieee80211_dump_node() gets called before a
channel context is set.

Sponsored by:	The FreeBSD Foundation

(cherry picked from commit c93be3079be5f07fe3596ec389826e45f5dc82bd)
2024-02-18 16:42:00 +00:00
Bjoern A. Zeeb
bc3ab3badd iwlwififw: add firmware for the Bz/B200 chipset
The iwlwifi driver already supports the chipset as "Bz TBD"
(also in 14.0).  Add the firmware for it.  Successfully tested
for 0x8086/0x272b/0x8086/0x00f4 on arm64 thanks to donated
hardware [1].

    Firmware was obtained from linux-firmware at
    9552083a783e5e48b90de674d4e3bf23bb855ab0 .

Sponsored by:	The FreeBSD Foundation
Sponsored by:	Martin Hoehne / minipci.biz (B200 card) [1]
MFC after:	3 days

(cherry picked from commit b647615ede46af66cd0c8bd5a321d4a2cccdabe0)
2024-02-18 16:41:52 +00:00
Bjoern A. Zeeb
7e72ea8cd1 ath10k/rtw89: make compile again after LinuxKPI changes
Both drivers are not yet attached to the build so this change is
for people currently trying them out.

In 96ab16ebab6319dce9b3041961b0ab6e20a4fecc the sys/rman.h include
was removed.  In various wireless drivers we prefer to directly use
bus_dma functions rather than io* LinuxKPI once.  In order to cast
the pointer we need sys/rman.h back for our native 'struct resource'
in their pci.c implementations.
Long-term we should consider providing some lkpi_-FreeBSD-specific
wrapper functions to avoid this problem.

MFC after:	3 days

(cherry picked from commit c8e7f78a3d28ff6e6223ed136ada8e1e2f34965e)
2024-02-18 16:41:46 +00:00
Bjoern A. Zeeb
fcc737d59e rtw89: improve debugging and fix a sleep issue
Improve log messages to be more helpful in error cases.
Change one LinuxKPI sleep function as we cannot call the original
one from a context we cannot sleep.
Both cases were hit during testing.

MFC after:	3 days

(cherry picked from commit 118d0ff54d4f7cffe6a13a1e0cdb2fe23fbfce74)
2024-02-18 16:41:34 +00:00
Bjoern A. Zeeb
7730aec6b7 LinuxKPI: reduce impact of large MAXCPU
Start scaling arrays dynamically instead of using MAXCPU, resulting in
extra allocations on startup but reducing the overall memory footprint.
For the static single CPU mask we provide two versions to further save
memory depending on a low or high CPU count system.  The threshold to
switch is currently at 128 CPUs on 64bit platforms.
More detailed comments on the implementations can be found in the code.

If I am not wrong on a MAXCPU=65536 system the memory footprint should
roughly go down from 512M to 1.5M for the static single CPU mask.

Submitted by:	olce (most of this final version)
Sponsored by:	The FreeBSD Foundation
PR:		274316
Differential Revision: https://reviews.freebsd.org/D42345

(cherry picked from commit 488e8a7faca51a71987fbf00cd36cfcd19269db7)
2024-02-18 16:41:24 +00:00
Bjoern A. Zeeb
7117d4b22f LinuxKPI: implement memset_after()
memset_after() is needed by iwlwifi d3.c.

Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D43644

(cherry picked from commit 2d9d35837d8ea3ee7d7447d63a8755d45ec2fd96)
2024-02-18 16:41:17 +00:00
Bjoern A. Zeeb
55baa8265a LinuxKPI: sort dev_<loglevel>() functions
Sort the dev_<loglevel> functions by loglevel order, add the dev_alert()
version and an indentation change.

No functional changes.

Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D43719

(cherry picked from commit 70617458676eb0b0076aa19657d21f2a9f3b704a)
2024-02-18 16:41:06 +00:00
Mark Johnston
c8691d183d tcp: Silence a -Wunused-function warning in tcp_ratelimit.h
No functional change intended.

(cherry picked from commit 876fddc886987ddbc89c412b15874749764167ac)
2024-02-18 15:26:28 +01:00
Konstantin Belousov
bda0c0dc87 Remove redundand prototype, fixing the build.
This is a direct commit to stable/14.
2024-02-18 14:45:49 +02:00
Konstantin Belousov
e331ce2d60 aio_read2/aio_write2: add AIO_OP2_VECTORED
(cherry picked from commit 8dfc788b8480a13f1f945f0a94d8b1e327af5c6f)
2024-02-18 12:01:46 +02:00
Konstantin Belousov
e9014ead57 libc: add aio_read2() and aio_write2() functions
(cherry picked from commit 06cb1c3f9528f088bdaf10d28dcfe7eeaad726d3)
2024-02-18 12:01:46 +02:00
Konstantin Belousov
1298ecb6ba lio_listio(2): add LIO_FOFFSET flag to ignore aiocb aio_offset
(cherry picked from commit e4b7bbd6ab77e908a60362aa29e518f224a117b0)
2024-02-18 12:01:46 +02:00
Vladimir Kondratyev
2d120981e2 Bump __FreeBSD_version after linuxkpi changes 2024-02-18 00:01:03 +03:00
Vladimir Kondratyev
6d4b6edcf3 LinuxKPI: Allow kmalloc to be called when FPU protection is enabled
Amdgpu driver does a lot of memory allocations in FPU-protected sections
of code for certain display cores, e.g. for DCN30. This does not work
on FreeBSD as its malloc function can not be run within a critical
section. Check this condition and temporally exit from FPU-protected
context to workaround issue and reduce source code patching.

Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu (previous version)
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D42822

(cherry picked from commit c0b8047bdc13040eafb162c4b7b5dba11034ff4b)
2024-02-17 23:58:39 +03:00
Vladimir Kondratyev
1a8c2dc098 LinuxKPI: Constify src parameter of bitmap_copy
in bitmap_from_arr32() to fix build on 32 bit archs.

Sponsored by:	Serenity Cyber Security, LLC
Fixes:	5ae2e6f913fa ("LinuxKPI: Add bitmap_intersects(), bitmap_from_arr32()")
MFC after:	1 week

(cherry picked from commit dbca442414191a43f334435b7910b63cb2777d53)
2024-02-17 23:58:39 +03:00
Vladimir Kondratyev
8aa9315b53 LinuxKPI: Define ioread64() in linux/io.h only on 64 bit archs.
32 bit archs includes nonatomic version from linux/io-64-nonatomic-*.h

Sponsored by:   Serenity Cyber Security, LLC
Fixes:		dcfc983373c3 ("LinuxKPI: Implement ioread64()")
MFC after:      1 week

(cherry picked from commit 73ccd188c43a6cd52a12ac33411896220b2d2e54)
2024-02-17 23:58:39 +03:00
Vladimir Kondratyev
455fa56ad4 LinuxKPI: Add acpi_dev_present() function.
acpi_dev_present detects that a given ACPI device is present based on
Hardware ID, Unique ID and Hardware Revision of the device.

Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42823

(cherry picked from commit 04952a9456e226460d1d95c42ea53861b1133b1a)
2024-02-17 23:58:39 +03:00
Vladimir Kondratyev
a87884e34e LinuxKPI: Add pcie_capability_clear_and_set_word() function
It does a Read-Modify-Write operation using clear and set bitmasks on
PCI Express Capability Register at pos. As certain PCI Express
Capability Registers are accessed concurrently in RMW fashion, hence
require locking which is handled transparently to the caller.

Sponsored by:	Serenity CyberSecurity, LLC
Reviewed by:	manu, bz
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42821

(cherry picked from commit 808ae4e29b6b9c9acc7eab013c5045370df8182a)
2024-02-17 23:58:39 +03:00
Vladimir Kondratyev
06e0d2934d LinuxKPI: Add x86_vendor field to struct cpuinfo_x86
and initialize it at linuxkpi module load.

Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42820

(cherry picked from commit b8c88a61750174f62db45784d6b4dc98de4073b1)
2024-02-17 23:58:39 +03:00
Vladimir Kondratyev
0972bacc7f LinuxKPI: Add linux/apple-gmux.h
Sponsored by:	Serenity Cyber Security, LLC
Obtained from:	OpenBSD
Reviewed by:	manu, bz
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42819

(cherry picked from commit 730387b64e10b617f6f0b6f3a64501dc35dd7861)
2024-02-17 23:58:39 +03:00
Vladimir Kondratyev
a620fdcdb7 LinuxKPI: Rename linux_list_add to __list_add() in linux/list.h
to match Linux

Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu, bz
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42818

(cherry picked from commit c58ddc25462699c0d13bf703adbed661bb102cac)
2024-02-17 23:58:39 +03:00
Vladimir Kondratyev
559999c00b LinuxKPI: Add linux/ioport.h header
Sponsored by:	Serenity Cyber Security, LLC
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42817

(cherry picked from commit 9903d83d67ea5eed7c36fbe8b4afe6c4dd148d0e)
2024-02-17 23:58:38 +03:00
Vladimir Kondratyev
c535e8ae7f LinuxKPI: Add get_random_u64() function
Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu, bz
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42816

(cherry picked from commit 7f88d742e578c4cef4e26ce10b9a936e58237964)
2024-02-17 23:58:38 +03:00
Vladimir Kondratyev
96e464b8d5 LinuxKPI: Add linux/dynamic_debug.h header
Sponsored by:	Serenity Cyber Security, LLC
Obtained from:	OpenBSD
Reviewed by:	manu
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42815

(cherry picked from commit 2b037743a77dcf31095fe1fedd21870b3aa6494b)
2024-02-17 23:58:38 +03:00
Vladimir Kondratyev
529f2534da LinuxKPI: Add acpi_video_backlight_use_native()
We assume that backlight (in Linux term) is always "native".

Also stub acpi_video_register_backlight()

Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu, bz
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42814

(cherry picked from commit 745067c58514c4323dc16697e19f59dd08a8e963)
2024-02-17 23:58:38 +03:00
Vladimir Kondratyev
edeb8cfad0 LinuxKPI: Add bitmap_intersects(), bitmap_from_arr32()
and bitmap_shift_right() functions to linux/bitmap.h

They perform calculation of two bitmaps intersection,
copying the contents of u32 array of bits to bitmap and
logical right shifting of the bits in a bitmap.

Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42812

(cherry picked from commit 5ae2e6f913fa1df5f3262255558b76af05409a09)
2024-02-17 23:58:38 +03:00
Vladimir Kondratyev
cdceed0413 LinuxKPI: Add cancel_work() function.
Cancel a work not waiting for it to finish.

Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu, kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42811

(cherry picked from commit 1b2f43a7427ebf51561867f6c497833268014512)
2024-02-17 23:58:38 +03:00
Vladimir Kondratyev
ada94bf9e8 LinuxKPI: Add write_seqcount_invalidate() and seqprop_sequence()
functions to linux/seqlock.h

Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42810

(cherry picked from commit 64e30cba3f0432fa684728b67850b6254d3713ea)
2024-02-17 23:58:38 +03:00
Vladimir Kondratyev
4d5091c23c LinuxKPI: Chase for new "name" argument of register_shrinker()
Linux uses it only if SHRINKER_DEBUG config option is enabled. Ignore it.

Sponsored by:	Serenity Cyber Security, LLC
Reviewers:	manu, bz
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42809

(cherry picked from commit a39ed121eab16bd2579422f71df7ef29b55965d1)
2024-02-17 23:58:38 +03:00
Vladimir Kondratyev
fcfc3fe00d LinuxKPI: Add ida_alloc_min()
ida_alloc_min() allocates an unused ID. between min and INT_MAX.

While here allow end parameter of ida_simple_get() be larger than
INT_MAX. Linux caps the value to INT_MAX.

Sponsored by:	Serenity Cyber Security, LLC
Reviewers:	manu, bz
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42806

(cherry picked from commit c7312643b7e5f01adc2a3094c5139f5dcab5f0a4)
2024-02-17 23:58:38 +03:00
Vladimir Kondratyev
67cc189db4 LinuxKPI: Add IOMEM_ERR_PTR() to linux/io.h
The function creates an error pointer.

Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu, bz
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42805

(cherry picked from commit af787b8e8b803dbb2c6bd06629974ba39bd0fb70)
2024-02-17 23:58:37 +03:00
Vladimir Kondratyev
f3ce597171 LinuxKPI: Add ktime_get_raw_fast_ns() to linux/ktime.h
It is implemented like ktime_get_raw_ns() function but uses less
precise getnanouptime() call.

Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu, bz
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42804

(cherry picked from commit e964da141523e1eec2322082936cdb20ba0cf4a7)
2024-02-17 23:58:37 +03:00
Vladimir Kondratyev
06db4f5b62 LinuxKPI: Add xa_(un)lock_irq to linux/xarray.h
On FreeBSD they are equal to non-irq version.

Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu, bz
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42803

(cherry picked from commit 66f9a98335dcc2a3c1eead0d80ccc9fee12bbb31)
2024-02-17 23:58:37 +03:00
Vladimir Kondratyev
a2decec200 LinuxKPI: Add asm/hypervisor.h header
Sponsored by:	Serenity Cyber Security, LLC
Obtained from:	OpenBSD
Reviewed by:	manu, bz
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42802

(cherry picked from commit 206e9fea7502dccd126a721c30a1675bdef48633)
2024-02-17 23:58:37 +03:00
Vladimir Kondratyev
460a6c6a9f LinuxKPI: Implement ioread64()
Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu, bz
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42801

(cherry picked from commit dcfc983373c3e3dcd7025e5f65832ab696832261)
2024-02-17 23:58:37 +03:00
Vladimir Kondratyev
11b0824a80 LinuxKPI: Add linux/iosys-map.h header
Sponsored by:	Serenity Cyber Security, LLC
Obtained from:	OpenBSD
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42799

(cherry picked from commit f8ab2f5bae1d4e4e13f95f4738c9bb49fcda6261)
2024-02-17 23:58:37 +03:00
Vladimir Kondratyev
c254bc21dd LinuxKPI: Add some header pollution and dummy headers
required by recent drm-kmod to be succesfully compiled.

Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu, bz
Obtained from:	OpenBSD (partially)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42798

(cherry picked from commit 1bce29bcf121c1e16205fabb100f798d88f757c1)
2024-02-17 23:58:37 +03:00
Vladimir Kondratyev
b62373d46a LinuxKPI: Add xen/xen.h header
It contains proxy-implementation of xen_initial_domain() and
xen_pv_domain() required by latest drm-kmod.

Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu, bz
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42797

(cherry picked from commit c612e3c262db6c8256159c4ed39018788017c7e2)
2024-02-17 23:58:37 +03:00
Vladimir Kondratyev
21d85c41bb LinuxKPI: Split linux/container_of.h off from linux/kernel.h
Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu, bz
MFC after:      1 week
Differential Revision:	https://reviews.freebsd.org/D42796

(cherry picked from commit fa862482fb0a8759984437d71221b17377625491)
2024-02-17 23:58:36 +03:00
Vladimir Kondratyev
c3a10c2332 LinuxKPI: Add static_assert() macro
And move it along BUILD_BUG family in to
linux/build_bug.h to match Linux.

Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu, bz
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42800

(cherry picked from commit 31ef29091b0fbadefb4ccfb21e4b30ca7ddca3ed)
2024-02-17 23:58:36 +03:00
Vladimir Kondratyev
8291858235 LinuxKPI: Implement dev_dbg_once() macro
Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu, bz
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42795

(cherry picked from commit a01259965319897b836019f1d4dcf1b5a5a6ea1a)
2024-02-17 23:58:36 +03:00
Vladimir Kondratyev
1341925217 LinuxKPI: Add str_on_off and other helpers to linux/string_helpers.h
Sponsored by:	Serenity Cyber Security, LLC
Reviewed by:	manu, bz, imp (previous version)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D42794

(cherry picked from commit ae1084ff01bf9d9a9a2c56caf6c7095f3e96f579)
2024-02-17 23:58:36 +03:00