Split up the lhw lock and the scan lock. The latter is a mtx
while the former changes from mtx to sx as mac80211 downcalls may
sleep (and the ic lock is not usable in that case either and a larger
project to fix).
This will also enforce some lookups under lock (mostly scan) as well
as general protection for more compat code and avoid a possible
deadlock with one of the upcoming callbacks from driver into the
compat code.
Sponsored by: The FreeBSD Foundation
MFC after: 7 days
- Mark assert dummy variables as __unused.
- Use a dummy (void) cast of the flags argument passed to
spin_unlock_irqrestore so it gets treated as used.
Reviewed by: manu, hselasky
Differential Revision: https://reviews.freebsd.org/D39349
Rather than printing ic_name ourselves (or not at all) use ic_printf()
as a common function from net80211 where possible.
Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Those adds a new devres and will exectute some function on release.
Reviewed by: bz
Differential Revision: https://reviews.freebsd.org/D39142
Sponsored by: Beckhoff Automation GmbH & Co. KG
This is a direct port of the Linux code as the licence allows it, so
style(9) isn't respected to allow applying directly the upstream commits.
Do not add it to linuxkpi directly but add a new linuxkpi_hdmi module
that drm modules will require later, no need to bloat linuxkpi more.
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D39122
By checking Ubuntu, there is no `/sys/subsystem' in sysfs. To compatible
with Ubuntu, delete the 'subsystem' creation in Linux compatible module.
On the other hand, the sysfs `/sys/subsystem' cause failure for some
Linux udev cases. In Linux udev source code, there is a function named
`scan_devices_all', and it will scan `/sys/subsystem' if it is existed,
but now there are nothing in /sys/subsystem `, and it returns empty
to cause some use cases failed.
Reviewed by: dchagin
Differential Revision: https://reviews.freebsd.org/D38885
MFC after: 1 month
XMFC with: ifAPI
This new <asm/memtype.h> header is included from <linux/pci.h> because
that's how it is included in Linux too. DRM drivers depend on this.
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D39052
This required non-trivial changes to `linux_seq_file.c` to manage a new
`(struct seq_file)->size` field. This field is read directly by DRM
drivers, so we can't alias it to a call to sbuf_len(9).
`single_open_size()` also depended on the ability to allocate the sbuf
with a specified size instead of relying on `sbuf_new_auto()`.
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D39056
DRM drivers set some pointers to `ZERO_SIZE_PTR` directly (without
allocating anything), to treat pointers which were "initialized" (set to
`ZERO_SIZE_PTR`) with no memory allocation like really allocated
pointers. NULL isn't used because it represents a third state.
Reviewed by: emaste, manu
Approved by: emaste, manu
Differential Revision: https://reviews.freebsd.org/D39055
It defines a small part of the IOMMU API of Linux. We don't implement
that yet.
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D39054
This is not the same as querying the PCIE ASPM capability. The function
should return if the feature is actually enabled or not. It always
return false on FreeBSD.
Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D39053
This fixes an instapanic when restarting wpa_supplicant on my laptop's
iwlwifi device. After this change, iwlwifi enters a nonfunctional
state if wpa_supplicant is restarted, but "service netif restart wlan0"
is enough to get it working again.
releng/13.2 candidate.
Reviewed by: bz
MFC after: 3 days
For further use in linux_ioctl_socket add bsd_to_linux_ifflags() which
accepts FreeBSD interface flags and translate it to Linux if flags.
Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D38873
Split the linux_ioctl_socket() function on two counterparts, where
the linux_ioctl_socket_ifreq() intended to use in a code path which
requires the struct ifreq manipulation, i.e., translating in/out
values of the struct, while the linux_ioctl_socket() function is left
as is, it calls sys_ioctl() without touching in/out values.
Due to structures ifreq, sockaddr difference between FreeBSD and Linux
the linux_ioctl_socket_ifreq() calls kern_ioctl() directly, converting
in and out values to FreeBSD and to Linux accordingly.
Finally, modify the ifname_linux_to_bsd() to return error code, not
an unstable reference to the interface.
Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D38794
For now we are using mixed names to access struct ifreq members, some
of Linux (ifr_name, ifr_ifindex), others of FreeBSD. To avoid conflicts
switch to use FreeBSD names.
Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D38792
Enter the net epoch when traversing a list of interfaces. For that
split the ifname_linux_to_bsd() function on two counterparts, where
the ifname_linux_to_ifp() intended to use in epoch, while the
ifname_linux_to_bsd() intended to be a self-contained.
Until the linux_ioctl_coket() function is refactored, the
ifname_linux_to_bsd() temporarily returns interface outside
of the net epoch.
Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D38790
Migrate linux and linprocfs to use the IfAPI interfaces instead of
direct ifnet accesses.
The code initially writed by jhibbits@, and adapted by me to 3ab3c9c2.
Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D38735
According to the Linux sources the kernel exposes a proces virtual
memory size via proc filesystem into the three files - stat, status
and statm. This is the struct mm->total_vm value adjusted to the
corresponding units - bytes, kilobytes and pages.
The fix is based on a fernape@ analysis.
PR: 265937
Reported by: Ray Bellis
MFC after: 3 days
Netlink should translate a FreeBSD interface name to a Linux
interface name.
Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D38715
MFC after: 3 days
We have some amount of interface names translation functions which are
differs by bugs implementation. Consolidates it in a one place.
Fixup loopback interface names translation and use ifnet methods and
accessors, where possible.
Reviewed by: melifaro
Differential Revision: https://reviews.freebsd.org/D38714
MFC after: 3 days
X-MFC with: 32fdc75fe7