Move some ieee8022_{is,has,get}_... functions working on header fields
from mac80211.h to ieee80211.h to avoid problems with #includes.
No functional changes.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 0b325167f60def621536632460caf68e2fab4fb8)
Upstream new defines, enum values, etc. for coming driver updates which
are non-conflicting with the current state.
The only notable change is the rename of the enum ieee80211_ap_reg_power
but the enum name had not been used so far by any driver in the tree
(only in mac80211.h) but an updated version of ath11k does use it so we
need to correct our initial naming.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit c1c989588df67396392edceb0e7e7028abc06c49)
Add new enums to netdevice.h (including one which is referenced but
no value of it is used in a driver so we have to add a "dummy" value
to avoid an empty enum).
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 6ed447b51a9d6cf22aae2dfba6efce3922ae6d57)
Add more fields required by updated wireless drivers to mhi.h.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit c12e3a05252ac9f43a6db379f88e4b4a07c06d46)
Add pci_err() as a wrapper to dev_err() as needed by an updated driver.
Sponsored by: The FreeBSD Foundation
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D46660
(cherry picked from commit 01e1131e4a20ea377d580ecce210aa86726e71c6)
Factor out module_pci_driver() from 366d68f283 into a general
module_driver() so other bus attachments can also use the same kind
of macro without duplicating all the lines.
Redefine module_pci_driver() using the new general macro.
No functional changes intended.
Sponsored by: The FreeBSD Foundation
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D46467
(cherry picked from commit f5c7feee7129dc88a2e5dc3ce0a075cb5e4f534a)
Add a version of no_printk(), which seems to be there to have format
string checking while never calling the printk. It seems a very weird
thing and it needs a return code and for some reason my initial
while (0) { } version hadn't worked while porting over new code but
could have been further downstream format string problems.
if (0) seems to do the job though I would have expected that to more
likely simply get optimised out without any futher format checking.
Sponsored by: The FreeBSD Foundation
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D46463
(cherry picked from commit 1847e63d63f440cfcb2f4ee2c2ee8990f0272d88)
Add an implementation of eth_hdr() needed by a wireless driver.
Sponsored by: The FreeBSD Foundation
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D46462
(cherry picked from commit 273cf7d36336eeed5fc2ad42e5e12a36e36650a0)
Used by an updated wireless driver.
Sponsored by: The FreeBSD Foundation
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D46461
(cherry picked from commit 8adb745dc9716e769ef0f7e993cea8a07735d5d8)
Add a get_random_u8() implementation following the u36 and u64 versions.
We'll likely want to macro-ify them in the future and add all the types
which makes sense just to be done.
Sponsored by: The FreeBSD Foundation
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D46464
(cherry picked from commit f29e915bc0d216a87f222a208caeb2172c93e4ea)
Trying to use lindebugfs for debugging wirless drivers two issues
became apparent:
(a) a panic in lindebugfs calling a hard coded release function if the
caller had not provided one. This seems to be based on assumptions
that no longer hold up. Remove the hard coded release function to
prevent panics.
(b) In LinuxKPI simple_read_from_buffer() would call copy_to_user() but
buffers weren't setup for this (lindebugfs copies data from its
own buffer) and then pseudofs will do another copyout to the user
on this; remove the copy_to_user() and simply copy the data over
to the provided buffer; this works for as long as the only consumers
remain debugfs callers (which currently seems to be the case).
[the only out-of-tree consumers I am aware off are two drm-kmod
drivers/gpu/drm/amd/pm/* debugfs functions I cannot test].
Sponsored by: The FreeBSD Foundation
Tested by: jfree
Differential Revision: https://reviews.freebsd.org/D45755
(cherry picked from commit 5668c22a13c6befa9b8486387d38457c40ce7af4)
If IEEE80211 debugging is turned on in kernel configs also turn on
LinuxKPI 802.11 and SKB debugging (sysctls) to have them available.
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D45820
(cherry picked from commit 59d262fe969af5a8a83f0ccd7586c9bd2c8fb1f3)
In order to allow the allocator to change in the future move it into
the implementation file from being an inline function in the header.
While here factor out the size calculation and add a comment as-to why
this is done. We will need the size (_s) in the future to make a
decision on how to allocate.
Sponsored by: The FreeBSD Foundation
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D45815
(cherry picked from commit 1f7df757017404011732196e65981d9325f7a89f)
They are functionally equivalent, but the updated form mirrors the tests
in sys/net/ethernet.h and avoids confusion.
Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D21037
(cherry picked from commit a1295b24842d209e6bf93a4823193d56ad2db064)
disable hdmi_audio_infoframe_pack_for_dp function for now as it depends
on not imported yet drm sources and is not used by drm-kmod.
Reviewed by: manu
Sponsored by: Serenity CyberSecurity, LLC
Differential Revision: https://reviews.freebsd.org/D46224
(cherry picked from commit c89d94ad5d95fd15e891b2723caae8a6104ee153)
pci_iomap_range creates a virtual mapping cookie for a PCI BAR.
As compared with pci_iomap it got extra offset parameter.
Sponsored by: Serenity CyberSecurity, LLC
MFC after: 1 week
Reviewed by: manu, bz
Differential Revision: https://reviews.freebsd.org/D45904
(cherry picked from commit fcc350c375f776318d0da8021109631492ab9261)
acpi_dev_get_first_match_dev returns the first match of ACPI device
and acpi_device_handle returns its ACPI handle.
Sponsored by: Serenity Cyber Security, LLC
MFC after: 1 week
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D45847
(cherry picked from commit 3e90716331cdbdee7465213d389a33f90dad11cf)
It finds out if a given PCI device matches a given pci_id table.
Sponsored by: Serenity Cyber Security, LLC
MFC after: 1 week
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D45846
(cherry picked from commit 5b1171a0b75fc88bffb5a67b0b02d8d59eb8d5c4)
devm_device_add_group creates a managed attribute group for a device.
Sponsored by: Serenity Cyber Security, LLC
MFC after: 1 week
Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D45845
(cherry picked from commit a1181662d3707d8165d7153a0aa5d76ea1ddc11a)
__diag macros turn individual warnings and errors on and off locally,
depending on version of compiler. Add dummy implementation as drm-kmod
set warnings separately for each file.
Sponsored by: Serenity Cyber Security, LLC
MFC after: 1 week
Reviewed by: manu, emaste
Differential Revision: https://reviews.freebsd.org/D45842
(cherry picked from commit 742088d9fb545296c8677119757a967141ba7d4a)
and dummy num_possible_nodes() implementation.
We do not fully support NUMA in LinuxKPI yet.
Sponsored by: Serenity CyberSecurity, LLC
MFC after: 1 week
Reviewed by: manu, bz
Differential Revision: https://reviews.freebsd.org/D45613
(cherry picked from commit 889f74af66b82e4401fb69ed8af6b9b4f48ce53b)
This include prevents usage of any kernel.h helpers in sched.h and
all of dependencies. Linux does not have it too.
Fix building of kernel and drm-kmod after than.
Sponsored by: Serenity CyberSecurity, LLC
MFC after: 1 week
Reviewed by: manu, bz
Differential Revision: https://reviews.freebsd.org/D45692
(cherry picked from commit 256eb8d5361143b7d436a195530e0eefe1450e6d)
from linux/kernel.h to match Linux and
allow direct linux/kstrtox.h inclusion.
Sponsored by: Serenity Cyber Security, LLC
MFC after: 1 week
Reviewed by: bz
Differential Revision: https://reviews.freebsd.org/D45454
(cherry picked from commit a97f3a9ec96a2de542326a158d1ab8e65ad4fe5f)
It returns absolute value of the difference between the arguments.
Add LinuxKPI version check as the macro was moved from drm-kmod to
linux/math.h in Linux kernel commit 46f12960aad (6.6 timeframe).
Sponsored by: Serenity Cyber Security, LLC
MFC after: 1 week
Reviewed by: bz, emaste
Differential Revision: https://reviews.freebsd.org/D45453
(cherry picked from commit afc450fac9f04f11cd916916ac28ffc52a973e1e)
To match Linux and allow direct linux/math.h inclusion.
Sponsored by: Serenity Cyber Security, LLC
MFC after: 1 week
Reviewed by: bz
Differential Revision: https://reviews.freebsd.org/D45452
(cherry picked from commit 588064e658d32f037854dd852b988728197a28de)
It returns the minimum that is not zero, except both equals to zero.
Sponsored by: Serenity Cyber Security, LLC
MFC after: 1 week
Reviewed by: bz, emaste, ssaxena
Differential Revision: https://reviews.freebsd.org/D45450
Differential Revision: https://reviews.freebsd.org/D45451
(cherry picked from commit 07c7c41ca1e31c20c2e2d8fb68c148f521831e4d)
To match Linux and allow direct linux/minmax.h inclusion.
Sponsored by: Serenity Cyber Security, LLC
MFC after: 1 week
Reviewed by: bz
Differential Revision: https://reviews.freebsd.org/D45449
(cherry picked from commit f79474c4e3eeb48c6acb0a9e3163195a50cef577)
'cond' in WARN_ON need be bracketed,
otherwise it is wrong for multiple conditions.
Reviewed by: wulf
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D44604
(cherry picked from commit 21f4cf5ccf87fd15d4d71f89d4c3ecab13f26146)
want_init_on_free returns if heap memory zeroing on free is enabled.
FreeBSD does not zeroes heap memory on free().
Sponsored by: Serenity Cyber Security
Reviewed by: emaste
MFC after: 1 week
(cherry picked from commit 56041ee817fff844e5b2de7eedc447e388ab988e)
It returns bus/device/function number for given PCI device.
Also add intermediate PCI_DEVID macro used in some drivers.
Sponsored by: Serenity Cyber Security, LLC
Reviewed by: emaste
MFC after: 1 week
(cherry picked from commit f1206503e5a0073f56710bfebb6e503dcf612536)
get_random_u32_below returns a random integer in the interval [0, ceil),
with uniform distribution.
Sponsored by: Serenity CyberSecurity, LLC
Reviewed by: emaste
MFC after: 1 week
(cherry picked from commit 9289c1f6f1514e714b17026c50ec09282f079cba)