1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-11-28 08:02:54 +00:00
Commit Graph

5186 Commits

Author SHA1 Message Date
Justin Hibbits
57609cb2de LinuxKPI: Use IfAPI to get LLADDR
Reviewed by:	bz, emaste
Differential Revision: https://reviews.freebsd.org/D47525
2024-11-13 14:31:20 -05:00
Mark Johnston
a43b745aaf linux sendfile: Fix handling of non-blocking sockets
FreeBSD sendfile() may perform a partial transfer and return EAGAIN if
the socket is non-blocking.  Linux sendfile() expects no error in this
case, so squash EAGAIN.

PR:		282495
Tested by:	pieter@krikkit.xyz
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D47447
2024-11-13 14:15:47 +00:00
Edward Tomasz Napierala
fc595a6b76 Fix "vrefact: wrong use count 0" with DRM
Bump the vnode use count, not its hold count. This fixes a panic triggered
by fstatat(..., AT_EMPTY_PATH) on DRM device nodes, which happens to be
what glxinfo(1) from Ubuntu Jammy is doing.

PR:		kern/274538
Reviewed By:	kib (earlier version), olce
Differential Revision:	https://reviews.freebsd.org/D47391
2024-11-13 10:25:57 +00:00
Bjoern A. Zeeb
edab5a280e LinuxKPI: 802.11: improve lladdr change to not use ifnet internals
The changes from 4aff4048 were based on net80211 which is still using
if_private.h details.  Adjust the code to no longer depend on internal
details of ifnet.  We also switch the "check"-functionn from if_init to
if_transmit which we can query.  Given we do have a per-vif eventhandler
we could do without that check but would still need to check
if_getflags() for IFF_UP.

Sponsored by:	The FreeBSD Foundation
Reported by:	jhibbits
Fixes:		4aff4048
MFC after:	3 days
Reviewed by:	jhibbits
Differential Revision: https://reviews.freebsd.org/D47490
2024-11-09 21:45:14 +00:00
Bjoern A. Zeeb
9b2705121b LinuxKPI: lockdep fix #includes
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
2024-11-02 01:24:42 +00:00
Bjoern A. Zeeb
310743c4cc LinuxKPI: 802.11: improvements to (*ampdu_action)() callers
Annotate lkpi_ic_recv_action(), lkpi_ic_send_action(), and
lkpi_ic_ampdu_enable() with HT specifc debug logging as we only hook
them up currently for debug tracing but later should not need them
anymore.

Start the implementation for lkpi_ic_addba_request(),
lkpi_ic_addba_response(), and lkpi_ic_addba_stop().

Improve the implementation of lkpi_ic_ampdu_rx_start() and
lkpi_ic_ampdu_rx_stop().

Sponsored by:	The FreeBSD Foundation (commit)
MFC after:	3 days
2024-10-31 20:52:28 +00:00
Bjoern A. Zeeb
86bc7259d3 LinuxKPI: 802.11: hookup net80211 callbacks dependent on (*ampdu_action)()
If a LinuxkPI base wireless driver does not support the (*ampdu_action)()
ieee80211_ops function for offloading parts to firmware there is no
reason for us to hook into the net80211 callbacks either but simply
to let software (net80211) handle this.

Sponsored by:	The FreeBSD Foundation (commit)
MFC after:	3 days
2024-10-31 20:52:27 +00:00
Brooks Davis
913bfd86c1 Update mentions of makesyscalls.lua
It is obsolete and will be removed in a followup commit.
2024-10-30 21:04:31 +00:00
Brooks Davis
74231c8172 sysent: regen with refactored code
All changes are no-ops and are one of:
 - Name changes of obsolete system calls in comments
 - Correct prefixes on unimplemented freebsd32 system calls
 - Currently unused macros for FreeBSD 14 compatablity
2024-10-30 21:04:31 +00:00
Bjoern A. Zeeb
7b43f4d064 LinuxKPI: 802.11: adjustments for v6.11 iwlwifi, rtw88 and rtw89
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
2024-10-28 12:16:06 +00:00
Bjoern A. Zeeb
ac1d519c01 LinuxKPI: 802.11: adjustments for v6.11 iwlwifi, rtw88 and rtw89
Bring ing the LinuxKPI 802.11 compat bits which are not altering
the mac80211 ops KPI.

* Add various functions for drvier updates.
* Add functions (some compat code to I assume cleanup some
  mac80211 ops) emulating chanctx changes doing (*config) updates.
* Adjust structs and defines.
* Deal with an enum growing more than 32 bits in printf.
* Add a mtx to struct wiphy which is exposed to the drivers.
  Handle initialization and destruction for now.
* Implementation of wiphy_work and wiphy_delayed_work.
* Set was_assoc for deassoc/deauth in prep_tx_info.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2024-10-28 12:05:06 +00:00
Zhenlei Huang
b4856b8e9d LinuxKPI: Remove stray semicolons
MFC after:	1 week
2024-10-24 23:04:48 +08:00
Bjoern A. Zeeb
5c92f84bb6 LinuxKPI: update rcu_dereference_*() and lockdep_is_held()
Update rcu_dereference_{check,protected}() to call the check and log
once if it fails and if the RCU debug sysctl is turned on.
Also add proper checks for conditions passed in to these functions.
For that implement linux_rcu_read_lock_held() (lots of help from wulf).

(While here also remove extraneous extern for function prototypes).

Update lockdep_is_held() to always be an inline function with argument
annotation so that we do no longer have unused variables
in callers which only call lockdep_is_held().

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	wulf
Differential Revision:  https://reviews.freebsd.org/D46842
2024-10-23 01:43:09 +00:00
Brooks Davis
76ab72e828 sysent: regen for typo fix 2024-10-22 19:21:26 +01:00
Edward Tomasz Napierala
31eec6fe1a linux: support IUTF8
Make Linuxulator support the recently added IUTF8 termios(4) flag.

Reviewed By:	dchagin, emaste, imp
Differential Revision:	https://reviews.freebsd.org/D44525
2024-10-21 08:22:50 +00:00
Bjoern A. Zeeb
157e93e0e8 LinuxKPI: pci: rename PCI_IRQ_LEGACY to PCI_IRQ_INTX
PCI_IRQ_LEGACY was added in 366d68f283 (likely) for rtw88 only.
The define now got renamed and I cannot find any other use but
rtw88 and rtw89.
We keep the old name as comapt while driver updates are in
progress enabling it defining LINUXKPI_VERSION for the two drivers.

Sponsored by;	The FreeBSD Foundation
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D46822
2024-10-17 13:27:05 +00:00
Bjoern A. Zeeb
105331f658 LinuxKPI: netdevice: add alloc_netdev_dummy()
Add alloc_netdev_dummy() which is needed by an updated rtw88 driver.
Given we already call linuxkpi_init_dummy_netdev() ourselves allow the
setup function to be NULL to not initialize and start a tasq td twice.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D46802
2024-10-17 13:27:05 +00:00
Warner Losh
16672453f1 cdefs: Add __deprecated
Add __deprecated decorator. This is for a deprecated interface. copystr
is tagged with this today in copy(9), but don't actually provide it or
use it. copystr is a #define so adding it will have to wait.

LinuxKPI was defining this away completely in compiler.h. Since this is
shared between Linux KPI consumers and OpenZFS, if it's already defined,
use the FreeBSD sys/cdefs.h version, otherwise define it away. For
OpenZFS this will retain it, while for Linux KPI it will tend to drop it
(I think always, but I didn't look at everything).

Sponsored by:		Netflix
Reviewed by:		jhb, emaste
Differential Revision:	https://reviews.freebsd.org/D46137
2024-10-15 15:05:49 -06:00
Warner Losh
481d5a4891 linux.h: don't redefine lower_32_bits if already defined
systrace.c fails to build if we're using a common compiler.h for both
openzfs and linuxkpi. The issue is easy enough to fix: don't redefined
lower_32_bits if it's already defined in linux.h, since it's the least
'standardized'. This will allow systrace.c to build using an equivalent
macro.

MFC After: 3 days
Sponsored by: Netflix
2024-10-15 04:50:44 -06:00
Bjoern A. Zeeb
fa81baa307 LinuxKPI: add cleanup.h for guard DEFINE_GUARD/guard.
iwlwifi v6.11 started to use guard().  _T in the implementation needs
to be exposed to the driver which uses it in DEFINE_GUARD().

Given this is the first instance of attribute(cleanup) in the tree:
- gcc has support for it since at least 2003-06-04
  (0bfa5f65bfb186f10d43304946fd7fcd69988732)
- llvm gained support on 2009-01-31
  (d277d790e0f6f23043397ba919619b5c3e157ff3, llvm-svn 63462).

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D46843
2024-10-14 17:45:42 +00:00
Bjoern A. Zeeb
6621842ccf LinuxKPI: add new dummy headers visibility.h and of_net.h
Those files are required by updated wireless drivers.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2024-10-11 20:58:35 +00:00
Bjoern A. Zeeb
8f9567628c LinuxKPI: add time_is_before_jiffies()
Add time_is_before_jiffies() as needed by iwlwifi from v6.11.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D46841
2024-10-11 20:48:58 +00:00
Austin Shafer
41b746e052 LinuxKPI: 802.11: fix ieee80211_schedule_txq() to avoid rtw89 panic
Some checks are pending
Cross-build Kernel / ${{ matrix.target_arch }} ${{ matrix.os }} (${{ matrix.compiler }}) (clang-12, /usr/lib/llvm-12/bin, ubuntu-20.04, bmake libarchive-dev clang-12 lld-12, amd64, amd64) (push) Waiting to run
Cross-build Kernel / ${{ matrix.target_arch }} ${{ matrix.os }} (${{ matrix.compiler }}) (clang-12, /usr/lib/llvm-12/bin, ubuntu-20.04, bmake libarchive-dev clang-12 lld-12, arm64, aarch64) (push) Waiting to run
Cross-build Kernel / ${{ matrix.target_arch }} ${{ matrix.os }} (${{ matrix.compiler }}) (clang-13, /opt/homebrew/opt/llvm@13/bin, macos-latest, bmake libarchive llvm@13, amd64, amd64) (push) Waiting to run
Cross-build Kernel / ${{ matrix.target_arch }} ${{ matrix.os }} (${{ matrix.compiler }}) (clang-13, /opt/homebrew/opt/llvm@13/bin, macos-latest, bmake libarchive llvm@13, arm64, aarch64) (push) Waiting to run
Cross-build Kernel / ${{ matrix.target_arch }} ${{ matrix.os }} (${{ matrix.compiler }}) (clang-14, /usr/lib/llvm-14/bin, ubuntu-22.04, bmake libarchive-dev clang-14 lld-14, amd64, amd64) (push) Waiting to run
Cross-build Kernel / ${{ matrix.target_arch }} ${{ matrix.os }} (${{ matrix.compiler }}) (clang-14, /usr/lib/llvm-14/bin, ubuntu-22.04, bmake libarchive-dev clang-14 lld-14, arm64, aarch64) (push) Waiting to run
rtw89 TX path was faulting in linuxkpi_ieee80211_next_txq() due to a
"double scheduling" check in linuxkpI_ieee80211_schedule_txq() being
incorrect:
the next pointer may be NULL there if the element is the last in the
tailq, so correctly check tqe_prev.  Without the fix we may have queued
the same element to the tailq twice, and because it was the last element
and had a NULL tqe_next, that NULL value would get propogated into
another node's tqe_prev on removal, and other such nastiness.

With this rtw89 no longer panics.

Reviewed by:	bz
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D47006
2024-10-10 17:42:06 +00:00
Brooks Davis
d9d2e3ab7c sysent: regen comments 2024-10-01 18:46:40 +01:00
Brooks Davis
13227efc5b sysent: regen removing comment alignment 2024-10-01 17:10:08 +01:00
Bjoern A. Zeeb
0b325167f6 LinuxKPI: 802.11: move functions between header files
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
MFC after:	3 days
2024-09-27 17:54:16 +00:00
Konstantin Belousov
927f379180 Regen 2024-09-27 18:02:23 +03:00
Ed Maste
3cf834d069 linuxulator: ignore AT_NO_AUTOMOUNT for all stat variants
Commit ff39d74aa9 ignored AT_NO_AUTOMOUNT for statx(), but did not
change fstat64() or newfstatat(), which also take an equivalent flags
argument.  Add a linux_to_bsd_stat_flags() helper and use it in all
three places.

PR:		281526
Reviewed by:	trasz
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D46711
2024-09-24 13:58:42 -04:00
Bjoern A. Zeeb
c1c989588d LinuxKPI: 802.11: add futher defines to ieee80211.h and nl80211.h
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
MFC after:	3 days
2024-09-13 00:26:26 +00:00
Bjoern A. Zeeb
4b972f77a1 LinuxKPI: some additions for mt76
Add changes required for later mt76 drivers.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2024-09-13 00:25:31 +00:00
Bjoern A. Zeeb
6ed447b51a LinuxKPI; add more defintions to netdevice.h
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
MFC after:	3 days
2024-09-13 00:24:48 +00:00
Bjoern A. Zeeb
c12e3a0525 LinuxKPI: add more fields to mhi.h
Add more fields required by updated wireless drivers to mhi.h.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2024-09-13 00:23:35 +00:00
Bjoern A. Zeeb
01e1131e4a LinuxKPI: add pci_err()
Add pci_err() as a wrapper to dev_err() as needed by an updated driver.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D46660
2024-09-13 00:20:53 +00:00
Mikhail Pchelin
f5a58c2da2 linux80211: fix default deflink.rx_nss
Native Linux implementation sets this as a maximum between 1 and
ht/vht/eht rx SS'es, FreeBSD does the same, but uses 0 as a minimum,
which leads setting it to 0 if we're not in ht/vht case.

This 0 was breaking rtw89 driver, when it was trying to determine
SS number by subtracting 1 from rx_nss and passing the value to the
hardware.

After this patch rtw89 association and simple ping work reliably,
but more work is needed to make the driver robust with heavy traffic
(iperf3) and being long idle.

Reviewed by:	bz
Approved by:	bz
Sponsored by:	Future Crew LLC
Differential Revision:	https://reviews.freebsd.org/D46528
2024-09-06 21:04:52 +03:00
Bjoern A. Zeeb
f5c7feee71 LinuxKPI: add general module_driver(), use it for module_pci_driver()
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
MFC after:	3 days
Reviewed by:	manu
Differential Revision: https://reviews.freebsd.org/D46467
2024-09-05 12:46:21 +00:00
Zhenlei Huang
7bcb122855 LinuxKPI: 802.11: Stop checking for failures from malloc(M_WAITOK)
As a consequence lkpi_ieee80211_ifalloc() now does not fail. Remove
unneeded NULL check.

MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45852
2024-09-03 18:25:21 +08:00
Bjoern A. Zeeb
1847e63d63 LinuxKPI: add no_printk
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
MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D46463
2024-08-31 21:36:01 +00:00
Bjoern A. Zeeb
273cf7d363 LinuxKPI: add eth_hdr()
Add an implementation of eth_hdr() needed by a wireless driver.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D46462
2024-08-31 21:35:02 +00:00
Bjoern A. Zeeb
8adb745dc9 LinuxKPI: add ENAVAIL error code
Used by an updated wireless driver.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D46461
2024-08-31 21:34:01 +00:00
Bjoern A. Zeeb
f29e915bc0 LinuxKPI: add get_random_u8()
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
MFC after:	3 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D46464
2024-08-31 21:32:11 +00:00
Evgenii Khramtsov
84f46335ab linuxkpi: chase spinlock_t in DECLARE_WAIT_QUEUE_HEAD
Remove member m to unbreak consumers, e.g. drm-kmod 5.10-lts branch.

[...]
/tmp/drm-kmod/drivers/gpu/drm/ttm/ttm_module.c:38:8: error: no member named 'm' in 'struct mtx'
   38 | static DECLARE_WAIT_QUEUE_HEAD(exit_q);
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/src/sys/compat/linuxkpi/common/include/linux/wait.h:113:33: note: expanded from macro 'DECLARE_WAIT_QUEUE_HEAD'
  113 |         MTX_SYSINIT(name, &(name).lock.m, spin_lock_name("wqhead"), MTX_DEF)
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/src/sys/sys/mutex.h:528:4: note: expanded from macro 'MTX_SYSINIT'
  528 |                 (mtx),                                                  \
      |                  ^~~
/tmp/drm-kmod/drivers/gpu/drm/ttm/ttm_module.c:38:8: error: no member named 'm' in 'struct mtx'
   38 | static DECLARE_WAIT_QUEUE_HEAD(exit_q);
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/src/sys/compat/linuxkpi/common/include/linux/wait.h:113:33: note: expanded from macro 'DECLARE_WAIT_QUEUE_HEAD'
  113 |         MTX_SYSINIT(name, &(name).lock.m, spin_lock_name("wqhead"), MTX_DEF)
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[...]

Fixes:		ae38a1a1bf ("linuxkpi: spinlock: Simplify code")
MFC after:	?
2024-08-28 09:29:40 +02:00
Mariusz Zaborski
24b1cf7a8a sysent: regen after d0675399 2024-08-27 17:24:54 +02:00
John Baldwin
c0c1b1cd89 freebsd32: Fix a few typos in syscalls.conf comments
Sponsored by:	AFRL, DARPA
2024-08-21 17:14:56 -04:00
Doug Moore
d48524e21f dev_pager: define free_page for mgt devices
Callers of cdev_pager_free_page in the kernel always have object->type
== OBJT_MGTDEVICE. Define a function for them to call that skips the
runtime type check in cdev_pager_free.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D46389
2024-08-21 15:48:59 -05:00
Warner Losh
ce7fac64ba Revert "nvme: Separate total failures from I/O failures"
All kinds of crazy stuff was mixed into this commit. Revert
it and do it again.

This reverts commit d5507f9e43.

Sponsored by:		Netflix
2024-08-15 21:29:53 -06:00
Warner Losh
d5507f9e43 nvme: Separate total failures from I/O failures
When it's a I/O failure, we can still send admin commands. Separate out
the admin failures and flag them as such so that we can still send admin
commands on half-failed drives.

Fixes: 9229b3105d (nvme: Fail passthrough commands right away in failed state)
Sponsored by: Netflix
2024-08-15 20:22:18 -06:00
Fernando Apesteguía
5ab6ed93cd faccessat(2): Honor AT_SYMLINK_NOFOLLOW
Make the system call honor `AT_SYMLINK_NOFOLLOW`.

Also enable this from `linux_faccessat2` where the issue arised the first time.
Update manual pages accordingly.

PR:			275295
Reported by:		kenrap@kennethraplee.com
Approved by:		kib@
Differential Revision:	https://reviews.freebsd.org/D46267
2024-08-11 17:49:06 +02:00
Ed Maste
a1295b2484 linuxkpi: use canonical tests for is_{zero,broadcast}_ether_addr
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
2024-08-08 12:39:14 -04:00
Vladimir Kondratyev
c89d94ad5d LinuxKPI: update linuxkpi_video to Linux 6.6
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
2024-08-07 23:38:38 +03:00
Mark Johnston
01518f5eed sleepqueue: Remove kernel stack swapping support, part 10
- Remove kick_proc0().
- Make the return type of sleepq_broadcast(), sleepq_signal(), etc.,
  void.
- Fix up callers.

Tested by:	pho
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D46128
2024-07-29 01:43:59 +00:00