Make a pass over skbuff.h:
- implement some missing bits,
- sprinkle some const,
- add locking and read/write_once calls as needed to provide
synchronization as expected by Linux,
- fix some typos,
- remove return from void functions,
- adjust tracing macros.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
PR: 283903 (rtw88 skb leak)
Tested by: Guillaume Outters (guillaume-freebsd outters.eu)
Differential Revision: https://reviews.freebsd.org/D49101
ieee80211_sta_recalc_aggregates() shows up in TODO traces but there is
nothing we have to do there until we have active links (MLO support).
Make the TODO conditional for a time when we will get there.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Define cfg80211 IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK to
net80211 IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK.
We should likely at some point make a sweep and replace all the
values with the defines from the comments for the matching net80211
version.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Implement cfg80211_chandef_create() to work with HT. Update enum
with HT channel types. When calling the function from LinuxKPI 802.11
code, pass in NL80211_CHAN_HT20 if HT is supported rather than NO_HT.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
They are used by the DRM drivers in Linux 6.7.
Bump `FreeBSD_version` because external drivers that use `struct
shrinker` will have to be recompiled.
Reviewed by: bz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48747
This helps developers working with linuxkpi find out a function is
already defined but is just a stub.
Reported by: bz
Reviewed by: bz, emaste
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48862
Commit 03e39d3d42 decreased the Linux
version that exposes this constant to be Linux 6.7. It happens that the
constant is older.
However, it is removed in Linux 6.10. Let's change the version condition
to say that it is defined for any version before 6.10.
Reported by: bz
Reviewed by: bz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48861
To use the old version, one has to explicitly set `LINUXKPI_VERSION` to
the expected version of Linux KPI.
Reported by: bz
Reviewed by: bz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48860
Implement mac80211 functions ieee80211_iter_keys[_rcu](), and
ieee80211_get_key_rx_seq() (*).
Implement an internal function lkpi_sta_del_keys() to delete keys
when we are leaving RUN (AUTHORIZED) state.
Improve and make work (*) the net80211 vap function pointers
(*iv_key_set)(), (*iv_key_delete)() implementations.
Correct the logic in lkpi_80211_txq_tx_one() and factor most crypto
related bits out into lkpi_hw_crypto_prepare() (*).
(*) We are currently supporting CCMP only. I would hope we will
not have to do full WEP/TKIP support anymore given both are deprecated.
The entire logic remains behind the LKPI_80211_HW_CRYPTO pre-processor
condition and with this commit in addition behind a tunable.
The code is compiled in by default now but the tunable remains off until
wider testing has shown no problems.
I have seen one net80211 triggered panic on shutdown related to deleting
keys which I cannot reproduce anymore and could have been fixed by
9763fec11b83; otherwise we will have to investigate as it shows again.
The dedicated hw crypto tracing option can help in that case with debug
kernels.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Fixes: b35f6cd066
Implement the mac80211 (*sta_statistics) to obtain station statistics.
Fix up struct station_info for that.
Add supporting funtions to decode station_info and rate_info_bw fields
to make the output more usable to human beings.
Add a per-VIF (VAP) sysctl to export that information. This is mostly
used for now to see what the driver/fw thinks about its TX rate.
We should later gather this information in different ways and pass it
to net80211 to export it to user space so we can finally have nice
station information (also for the non-AP side).
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
rtw88 seems to have an skb leak still.
Add a WARN_ONCE to __skb_queue_purge() just to make sure there is no
glitch due to missing locking.
Also add a rolling error reporting for skb allocation failures in
LinuxKPI to gather some more information if possible about queue
states.
This is a corrected version of what was initially part of D48474.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
ieee80211_vif_usable_links() shows up in TODO() tracking.
Turns out the return (1) is likely wrong and should be 0 given we do
not support MLD yet. For now return the valid_links bitmap and leave
an IMPROVE as likely not all of the valid ones will be useable.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
For now we only return the legacy rate and have two TODOs for HT and
VHT which still need to be implemented as needed.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Given I was looking at the struct make it more packed at the beginning
at least. In fact it did not shrink but the tx_time_est got expanded.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Convert a lot more LinuxKPI rx_status fields to net80211 rx_stats
bits for as much as we can see fit. Factor the entire logic out
into its own function as it got quite long.
Now only net80211 needs to start using more of these values and
report them.
Also fix some related fields and struct definitions in LinuxKPI.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Implement ieee80211_rate_set_vht(), ieee80211_rate_get_vht_{mcs,nss}(),
and ieee80211_get_vht_max_nss().
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Add the mask and shift for the VHT Extended NSS BW Support field.
Document them in net80211 and further related bitmasks in LinuxKPI.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D48975
Add this attribute which is a no-op for us but in linux represent that
the guest memory encryption is active.
drm ttm started to check this flag in > 6.1.92
Sponsored by: Beckhoff Automation GmbH & Co. KG
Linux has removed timespec_to_jiffies() half a decade ago [1].
I cannot find any use of it anymore in recent drm-kmod branches
or in the tree so retire it.
While here also retire it from drm2.
Reported by: emaste (D48318) [1].
Sponsored by: The freeBSD Foundation
MFC after: 2 weeks
Reviewed by: emaste, dumbbell (tested all drm-kmod versions, thanks!)
Differential Revision: https://reviews.freebsd.org/D48379
Implement the combination of all four functions, the *_vif versions
from mac80211.h as a wrapper to the non-*_vif ones in cfg80211.h.
Put the function pairs next to each other and in the right files
and harmonize argument naming, etc.
Both of them have shown up too often in the todo-tracing to bother
enough to implement them now for a time in the future when we will
support HE/EHT.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
[Why]
This function is used by hhe DRM generic code starting with Linux 6.7.
Reviewed by: manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48761
[Why]
The i915 DRM driver relies on this chain of includes to access the
definition of `struct tasklet_struct` in `<linux/interrupt.h>`.
Reviewed by: imp, manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48760
[Why]
This is used by the amdgpu DRM driver starting with Linux 6.7.
[How]
The function just returns 0 for now.
Reviewed by: manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48759
[Why]
This is used by the amdgpy DRM driver starting from Linux 6.7.
[How]
The function always returns false, like `pci_is_thunderbolt_attached()`
because we don't have an API for this in FreeBSD yet.
Reviewed by: manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48758
[Why]
This is used by the i915 DRM driver starting from Linux 6.7.
Reviewed by: manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48757
[Why]
In Linux 6.7, the signature of `get_file_rcu()` changed significantly,
going from:
bool get_file_rcu(struct linux_file *f);
... to:
struct linux_file * get_file_rcu(struct linux_file **f);
I.e., both the argument and the return value changed in an incompatible
way.
This is used by the i915 DRM driver.
[How]
This patch introduces the variant and hide the new prototype behind
`LINUXKPI_VERSION >= 60700`.
Reviewed by: manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48756
[Why]
The i915 DRM driver started to access the `xa_lock` field in Linux 6.7.
Reviewed by: manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48754
[Why]
This function is used by the i915 DRM driver starting with Linux 6.7.
Reviewed by: manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48753
[Why]
This function is used by the i915 DRM driver in Linux 6.7.
Reviewed by: manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48752
[Why]
Some files in the i915 DRM driver in Linux 6.7 depend on these implicit
inclusions.
Reviewed by: manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48751
[Why]
It is already defined in <asm-generic/io.h> to use the FreeBSD versions.
Reviewed by: manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48750
[Why]
This is used by the amdkfd DRM driver in Linux 6.7.
Reviewed by: manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48749
[Why]
This field is used by the i915 DRM driver in Linux 6.7.
Reviewed by: manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48748
[Why]
This new API is used by the amdgpu DRM driver is Linux 6.7.
[How]
This is the same as `pci_get_class()` except that it searches a PCI
device matching the base class only; the subclass is ignored.
Reviewed by: manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48746
[Why]
This is used by the amdgpu DRM driver in Linux 6.7.
Reviewed by: manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48744
[Why]
DRM drivers in Linux 6.7 already use this constant.
Reviewed by: manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48742
[Why]
Some files in DRM rely on namespace pollution: they use the
<linux/rcupdate.h> API without including it explicitly.
[How]
Reproduce the Linux chain of includes even if it means nothing on
FreeBSD. This allows consumers of <linux/idr.h> to "inherit"
<linux/rcupdate.h> API.
Reviewed by: manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48741
The way we got the kernel metadata pointer was by calling
preload_search_by_type with one of the following three: "elf kernel",
"elf32 kernel" and "elf64 kernel". Which one(s) we used wasn't
consistent though. Sometimes we would only try "elf kernel", and other
times we would try one of the latter two if the first failed. However,
the loader only ever sets "elf kernel" as the kernel type.
Now, the kmdp is a global, preload_kmdp, and it's initialized using
preload_initkmdp in machdep.c (or machdep_boot.c on arm/64).
preload_initkmdp takes a single boolean argument that tells us whether
not finding the kmdp is fatal or not.
Reviewed by: imp, kib
Pull Request: https://github.com/freebsd/freebsd-src/pull/1394
No functional change (intended).
Reviewed by: kib
MFC after: 4 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D48497
There are possible problems when jiffies (ticks) which still are int
wrap around. Also given this did not touch every single place some
checks may be broken now.
Reported by: markj
This reverts commit fd27f86dd7.
It seems these functions work with unsigned long and not int in Linux.
Start simply replacing the int where I came across it while debugging
a wireless driver timer modification. Also sprinkle in some "const".
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D48318
Make iwlwifi compile with debugfs after the last updates and turn it on
for both iwlwifi and rtw88 in order to be able to get at least some
useful information on driver/firwmare state.
Sponsored by: The FreeBSD Foundation
MFC after: 10 days
Add a print mask for use with %b to aid debugging. It is a lot easier
to read names than numbers.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
This will help us to get minimally better lock coverage in iwlwifi
though not yet against the LinuxKPI implementation which will likely
switch to this in the future. At least the TODO() logging noise is
out of the way.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
net80211 node ni_chw currently encodes the channel width as Mhz number.
LinuxKPI 802.11 uses enum ieee80211_sta_rx_bw for the same.
Rather than keeping the "20" and "40" throughout the code (eventually
expanded to 80/160/320) switch them over to use the enum throughout
and add a print mask for debug output. While designed as bitmask it
is not supposed to be used as such; the bitmask is only used to be
able to use %b with a print mask.
Once we get to 320Mhz channel widths we would otherwise also need to
extend the uint8_t in struct ieee80211_node; making
enum ieee80211_sta_rx_bw __packed allows us for three more channel
widths without breaking the KBI (if we were not to use %b with a
print_mask but use a lookup function for the string we could extend
it for a long time).
Sponsored by: The FreeBSD Foundation
MFC after: 14 days
Reviewed by: adrian
Differential Revision: https://reviews.freebsd.org/D47891
Add sys/sytm.h for __diagused which unbreaks compilation of
drm-kmod 5.10-lts on main.
Sponsored by: The FreeBSD Foundation
Reported by: Evgenii Khramtsov
PR: 282479
Fixes: 5c92f84bb6
MFC after: 3 days
Bring in the LinuxKPI 802.11 compat bits which are altering
the mac80211 KPI.
* In struct ieee80211_bss_conf chandef -> chanreq.
* Various struct ieee80211_ops gained a link_id arguemnt,
stop gained a suspend flag.
* Various functions gained a link_id argument.
* ieee80211_tx_status() was renamed to ieee80211_tx_status_skb()
Sponsored by: The FreeBSD Foundation
MFC after: 3 days