It seems during the initial buildup of the file, the defines were
either mixed or not flagged as "FIXME".
Define the values through to the net80211 definitions and also
annotate them by at least some standards reference.
Fixes: 6b4cac814e
Reviewed by: cc
Differential Revision: https://reviews.freebsd.org/D43658
(cherry picked from commit 53eb2c63c9628f7f19d88d759e1932c10c9f08af)
For iwlwifi(4) d3.c we need another struct in struct ieee80211_key_seq
and related WLAN_KEY_LEN_* defines in.
Reviewed by: cc, emaste
Differential Revision: https://reviews.freebsd.org/D43646
(cherry picked from commit 2f029bf911e29dc46c32ea142daba4f26a2078f4)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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)
sys/rman.h defines `resource` structure which conflicts with the Linux
structure of the same name. To fix that remove reference to sys/rman.h
from linux/pci.h and move resource management code to linux_pci.c.
Update consumers which were depending on linux/pci.h pollution.
No functional changes intended.
Sponsored by: Serenity Cyber Security, LLC
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D42792
(cherry picked from commit 96ab16ebab6319dce9b3041961b0ab6e20a4fecc)
[Why]
The i915 DRM driver in Linux 5.18 relies on this indirect include.
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D43030
(cherry picked from commit d6d1e73e5f66f3b12881fffceff58ca54b506792)
[Why]
This header and str_yes_no() are now used by the i915 DRM driver in
Linux 5.18.
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D43014
(cherry picked from commit 38138beb42d1892dbd8ebb29c01c4471c86d8845)
[Why]
The passed structure may not have a `.store` field. This is the case in
the amdgpu DRM driver starting with Linux 5.18.
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D43023
(cherry picked from commit d752a5e82ac92603fadf82e7de75878e1f5d054a)
[Why]
The amdgpu DRM driver started to use it in Linux 5.18.
[How]
The function is a no-op as I'm not sure how to implement this with
sysctls yet.
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D43022
(cherry picked from commit 509707e8b6b7326c7f4793b6e291f0a8e6939412)
[Why]
The amdgpu DRM driver started to use it in Linux 5.18.
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D43021
(cherry picked from commit b723bcd05a991d446491e914f2b9f35e66227398)
[Why]
`linux_compat.c` is already too long. I will need to add `struct kset`
in a follow-up commit, so let's move the existing `struct kobject` code
to its own file.
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D43019
(cherry picked from commit 80446fc7b5e5d22e2bac28bc0474dbe2fec83e43)
[Why]
This is consistent with Linux.
[How]
The definition is moved from <linux/shmem_fs.h> to <linux/pagemap.h> and
the latter is included from the former. This is how it is done on Linux.
Prototypes are also expanded with argument names. I got a build failure
in the DRM 5.18 drivers because the compiler considered that the
`pgoff_t` argument was there twice.
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D43018
(cherry picked from commit 4e0d3f7b3c3295e51ded2bab39f36842f405b4eb)
[Why]
We need this for the `bool` type.
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D43016
(cherry picked from commit 50a56453dadbd05eb1c43addaf2773a1ef417445)
[Why]
Some files in DRM rely on this indirect include to use `struct rb_*`.
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D42835
(cherry picked from commit b292c995cfa88cc73d5d77b6b94ae1b78296793f)
[Why]
This function takes an offset and a length as argument, not a physical
address and a number of pages.
This misuse caused the `set_memory_*()` and
`arch_io_reserve_memtype_wc()` functions to return EINVAL.
Another problem was the fact that they returned errors as a positive
integer, whereas Linux uses negative integers.
[How]
Physical addresses and number of pages are converted to offset+length in
the `set_memory_*()` functions.
`arch_io_reserve_memtype_wc()` now calls `pmap_change_attr()` directly
instead of using `set_memory_wc()`.
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D42053
(cherry picked from commit 1e99b2ee90956f275c3668e92a408400f2dada1c)
Substituting 'uma_align_cache' by the appropriately named accessor
uma_get_cache_align_mask() made apparent that dma_get_cache_alignment()
was off by one, since it was defined to be the mask derived from the
alignment value.
Reviewed by: markj, bz
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42264
(cherry picked from commit 2c7dd66d09a1b92a4698232996cded6e5315b3bd)
Create the uma_get_cache_align_mask() accessor and put it in a separate
private header so as to minimize namespace pollution in header/source
files that need only this function and not the whole 'uma.h' header.
Make sure the accessors have '_mask' as a suffix, so that callers are
aware that the real alignment is the power of two that is the mask plus
one. Rename the stem to something more explicit. Rename
uma_set_cache_align_mask()'s single parameter to 'mask'.
Hide 'uma_align_cache' to ensure that it cannot be set in any other way
then by a call to uma_set_cache_align_mask(), which will perform sanity
checks in a further commit. While here, rename it to
'uma_cache_align_mask'.
This is also in preparation for some further changes, such as improving
the sanity checks, eliminating internal resolving of UMA_ALIGN_CACHE and
changing the type of the 'uma_cache_align_mask' variable.
Reviewed by: markj, kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D42258
(cherry picked from commit dc8f7692fd1de628814f4eaf4a233dccf4c92199)
Commit 3f686532c9 tried to fix an issue with not properly starting
at the first page in the sg list to prevent a panic. This worked but
with the side effect of incrementing "s" during the final iteration
causing it to be NULL since the list had ended.
In cases non-DEBUG kernels this causes a panic with drm-5.15, since
"s" is NULL when we later pass it to sg_mark_end().
This change decouples the iteration sg from the return value so that
it is never incremented past the final page in the chain.
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D41574
(cherry picked from commit 09b0401e91a92bcb58ea1873857b42f8211f660f)
It seems the mac_header can be set to offset 0 for frames received.
Remove the warning splattering messages to the console for each packet.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit f0e59b6903c881859d7f4eaf269b2336b774c7bc)
So we can use it in non-linuxkpi sources.
Reviewed by: emaste, mmel
Differential Revision: https://reviews.freebsd.org/D41767
Sponsored by: Beckhoff Automation GmbH & Co. KG
(cherry picked from commit 229c65a83fbe0ede8c617e35d8f8c14d5ebadc19)
This is a set of updates of the mt76 driver based on wireless-testing
(wt-2023-05-11) 711dca0ca3d77414f8f346e564e9c8640147f40d (after v6.4-rc1),
This adds support for mt7996 as well.
(wt-2023-06-09) 7bd20e011626ccc3ad53e57873452b1716fcfaaa (after v6.4-rc5),
(wt-2023-07-24) 62e409149b62a285e89018e49b2e115757fb9022 (after v6.5-rc3),
(wt-2023-08-06) 2a220a15be657a24868368892e3e2caba2115283 (after v6.5-rc4).
The current version of LinuxKPI lacks support for "page pool" which
needs enhancing and updating a decade or so old shortcut mapping
struct page directly to struct vm_page.
MFC after: 20 days
Adjust and add structs, fields, functions to make more modern versions
of LinuxKPI based wireless drivers (based on wireless-testing (
wt-2023-06-09, wt-2023-07-24, and later)) compile.
Some of these changes can only be applied once all drivers get
updated to not break the old versions currently in the tree.
Mark those changes with __FOR_LATER_DRV_UPDATE for now and flip the
switch at a later point.
Sponsored by: The FreeBSD Foundation
MFC after: 20 days
Fix arguments to a trace line and remove another trace line until we
actually will have the skb to trace along with a future implementation.
Sponsored by: The FreeBSD Foundation
MFC after: 10 days