proc0_post: Clear relevant thread stats directly
rufetch() has several other effects besides clearing these per-thread
stats most of which are explicitly discarded by the subsequent calls
to ruxreset(). Just clear the relevant stats directly instead.
Reviewed by: olce, kib, markj
Differential Revision: https://reviews.freebsd.org/D54050
ruxreset: Add an inline function to reset all the stats in rusage_ext
Use it in proc0_post to reset per-process CPU usage.
Suggested by: olce
Reviewed by: olce, kib
Differential Revision: https://reviews.freebsd.org/D54049
thread0: Clear td_rux stats in proc0_post
proc0_post aims to reset the CPU usage accounting for all threads and
processes in the system to zero once the time of day is verified.
However, not all of the per-thread stats were not being cleared,
resulting in over-reported time for thread0 post-boot.
Reviewed by: olce, kib, markj
Fixes: bed4c5241663 ("Implement RUSAGE_THREAD. Add td_rux...")
Differential Revision: https://reviews.freebsd.org/D54040
ipfilter: Restrict ipfilter within a jail
Add a sysctl/tunable (net.inet.ipf.jail_allowed) to control whether a
jail can manage its own ipfilter rules, pools, and settings. A jail's
control over its own ipfilter rules and settings may not be desireable.
The default is jail access to ipfilter is denied.
The host system can stil manage a jail's rules by attaching the rules,
using the on keyword, limiting the rule to the jail's interface. Or
the sysctl/tunable can be enabled to allow a jail control over its own
ipfilter rules and settings.
Implementation note: Rather than store the jail_allowed variable,
referenced by sysctl(9), in a global area, storing the variable in the
ipfilter softc is consistent with ipfilter's use of its softc.
Discussed with: emaste, jrm
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D53623
ipfilter: Disable ipfs(8) by default
At the moment ipfs(8) is a tool that can be easily abused. Though the
concept is sound the implementation needs some work.
ipfs(8) should be considered experimental at the moment.
This commit also makes ipfs support in the kernel optional.
Reviewed by: emaste, glebius
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D53787
mt76: ieee80211_is_first_frag() operates on the seq_ctrl field not on fc.
Pass the correct field to ieee80211_is_first_frag(); otherwise the results
may vary.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit c67fd35e58c6ee1e19877a7fe5998885683abedc)
mt76: add LINUXKPI_PARAM_PREFIX for module_param*
In order to not overwrite sysctl/tunables under compat.linuxkpi
we need to prefix the module_param* names with a per-driver/file
designator to make them (more) uniq. Add the FreeBSD specific
LINUXKPI_PARAM_PREFIX defines for that where missing in mt76.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 853e0440c97a4a1797edd6d653fba4398dc885e8)
mt76: util.h: extend worker name
In mt76_worker_setup() add the "name" argument to the description
for the worker thread. That way we have a chance to keep them apart.
While here, rename a variable and shorten the the (c)/SPDX section
according to new style.
(cherry picked from commit 9492230fd3d1e58696e9fd99cb9680b27bf1d424)
mt76: set appropriate CONFIG options for the module build
Always set CONFIG_ARCH_DMA_ADDR_T_64BIT as it is true for all
architectures we support. Add an option for CONFIG_NET_MEDIATEK_SOC_WED,
which we currently do not yet support.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 87aa494dfca73204516799033821ab1db184933f)
LinuxKPI: mt76: depend on CONFIG_NET_MEDIATEK_SOC_WED
If CONFIG_NET_MEDIATEK_SOC_WED is not set then be silent; if
CONFIG_NET_MEDIATEK_SOC_WED is set we will enable logic or rather te
pr_debug("TODO") calls for now.
Spsonsored by: The FreeBSD Foundation
(cherry picked from commit 51c73fc5f5dd95c6a0e3d232091a732a14c7ecc9)
LinuxKPI: 802.11: move ieee80211_offload_flags
Move the enum and leave a comment on the struct member for the vif
about the type.
No functional changes.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit b10ff7ed37a9b891bec7e1093e44fa7abb2054b4)
LinuxKPI: 802.11: fill in more skeleton functions
Some of these are used by mt76 and while I was here and it only was
a handfull I figured I should just clean this all up.
There is one problem in that between 802.11az and 802.11-2024 action
frame formats have changed; I got compile errors from iwlwifi(4) given
I updated them to -2024 so we remain on older versions for the moment.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit af22833348c6c7ffed0186651437b5f50be1550b)
LinuxKPI: 802.11: make airtime fairness an IMPROVE
We are ways away from implementing "airtime fairness" in LinuxKPI
(or rather net80211). For now make it an 'improve' rather than a
'todo' to get the logging away. Everything will work without it.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 86bfe5b4d5a7b90d3746059dd1f87cdd5a0bf90c)
LinuxKPI: device: add a pr_debug("TODO") call to device_release_driver()
The logic in device_release_driver() got disabled in 93b14194acaf2
and since left alone. Add a pr_debug() call so we have a chance to
notice if that code is actually still in need to be fixed and re-enabled.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit fc9666d0fc0c2541e44bfbcaa5bb1b670395687c)
LinuxKPI: page.c: remove a spurious character from a comment
No functional changes.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 45d8bfdcba37996993748f4667646f5dc9f54506)
LinuxKPI: 802.11: when synching HT and VHT cap, mask rx_mcs
When we sync the sta data, mask the rx_mcs with what the hardware is
able to do so that we do not leave, e.g., a 2nd stream enabled on a 1x1
chipset.
iwlwifi(4) has a further check for the smps_mode to limit to NSS=1 but
I believe that is historic and not actually in use anymore.
This fixes firmware crashes on TLC updates with nss=1 but the nss=2 array
index also being populated (with HT/VHT80/160 mcs information):
data being populated:
iwlwifi0: 0x20101A0D | ADVANCED_SYSASSERT
iwlwifi0: 0x00000006 | umac data1
iwlwifi0: 0x00000001 | umac data2
iwlwifi0: 0x000003FF | umac data3
iwlwifi0: 0x____050F | last host cmd
Reported by: Claudio Zumbo (claudiozumbo gmail.com), Erik Power
Tested by: Claudio Zumbo, Erik Power (eppower umich.edu)
[4 lines not shown]
LinuxKPI: pci: undo the pci_resource_len() check in lkpi_pci_request_region()
Creating non-passthru SR-IOV interfaces on a mlx5en(4) failed.
The problem lies in the pci_resource_len() call but not that the BAR length
is tmeporary 0 but in that we call lkpi_pci_get_bar() with a true argument
which will create the BAR resource for us and report the approriate length
back. However, the later call to bus_alloc_resource_any() will then fail
given the resource already exists.
Restore the previous behaviour and let bus_alloc_resource_any() do the
work. Adjust the return values from -ENODEV to -EBUSY to match callers
expectations.
In linuxkpi_pcim_request_all_regions(), like in linuxkpi_pci_request_regions(),
filter out the -EBUSY errors as "not an error" and try the next bar.
This also seems to be consistent with the expectations of the callers.
PR: 290793
Reported by: David BOYER (jcduss13 gmail.com)
[7 lines not shown]
LinuxKPI: 802.11: initialize a backpointer on the link_sta
iwlwifi/mld uses the back pointer in iwl_mld_link_sta_from_mac80211().
Initialize it to make BE200 cards work again.
Sponsored by: The FreeBSD Foundation
PR; 290808
(cherry picked from commit d1180baa9b99538481f3780fc8f4e6e464a15e99)
LinuxKPI: 802.11: use a _check rather than a _protected version for linksta
Switch to link_sta_dereference_check rather than _protected to access
the value. The actual problem we hit was elsewhere though.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 0021f70800a1d83a42e3a4dff10c352e67a1bcce)
LinuxKPI: 802.11: implement mtx support for ieee80211_iterate_interfaces
Implement the lockdep_assert_wiphy call for
ieee80211_iterate_active_interfaces_mtx() to avoid a warning when
used and to make sure callers comply with assumptions.
Leave an "IMPROVE" note as we can likely switch another of the multiple
callers to RCU.
Sponsored by: The FreeBSD Foundation
(cherry picked from commit 90b6a9ac0c1f4333f87f4b172482f40979324d7c)
iwlwifi/mld: only get tid after checking that it is a dataqos frame
Like we did for mvm, only get the tid after all the other checks are
done by the function in order to not trigger an assert. Linux will
likely return a random value there which later is not used as the
driver does an early return. In LinuxKPI we do check that the frame
assumptions hold up, which does not go so well for a random frame.
Sponsored by: The FreeBSD Foundation
PR: 290808
(cherry picked from commit 9040277864ab28cabfc53f238e900bc19ac75d7e)
LinuxKPI: 802.11: initialize the passed in chandef in cfg80211_chandef_create
cfg80211_chandef_create() gets passed a pointer to a cfg80211_chan_def.
It seems that several users are passing in an uninitialized variable
from the stack and expect cfg80211_chandef_create() to initialize it.
Run memset() on the struct, which for all callers currently seems to do
the right thing, to avoid later accesses to uninitialized struct members
like "punctured".
Reported by: CI (gcc build)
Sponsonred by: The FreeBSD Foundation
(cherry picked from commit 640205bc22c8b2bd31c766f4d0c409c183a8b8dc)
certctl.8: Prefer the new TRUSTDESTDIR variable
With the reimplementation in C of certctl, the environment variable
previously known as CERTDESTDIR was renamed to TRUSTDESTDIR for
consistency.
Although the previous variable is still valid, prefer the new one, as it
is described in the manual page, while the old one is not.
Reviewed by: des
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D54044
(cherry picked from commit 5c7176bba30ab3b250177cba3923bdc84b68a7c7)
setaudit: Add an update mode
By default, setaudit(8) overwrites the whole audit session state. For
the purpose of overwriting only a single field, e.g., the audit user,
this is inconvenient. Add -U to accomodate this case: when specified,
setaudit(8) will first fetch the current session state block and then
will only overwrite those fields specified on the command line.
Reviewed by: csjp
MFC after: 2 weeks
Sponsored by: Modirum MDPay
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D53672
(cherry picked from commit 1238610a27d5bc0914f524296ff587d86eec4c52)