]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
17 months agoptrace(2): document PT_SC_REMOTE
Konstantin Belousov [Fri, 2 Dec 2022 03:00:08 +0000 (05:00 +0200)]
ptrace(2): document PT_SC_REMOTE

Tested by: pho

(cherry picked from commit a98613f2389227effeb9d86e47e53ea01ecddfe5)

17 months agoFixes for ptrace_syscallreq()
Konstantin Belousov [Thu, 22 Dec 2022 23:51:34 +0000 (01:51 +0200)]
Fixes for ptrace_syscallreq()

Tested by: pho

(cherry picked from commit 974be51b3f6070f9aae02e115ea6099f90bc9175)

17 months agoptrace(2): add PT_SC_REMOTE remote syscall request
Konstantin Belousov [Wed, 30 Nov 2022 08:45:52 +0000 (10:45 +0200)]
ptrace(2): add PT_SC_REMOTE remote syscall request

Tested by: pho

(cherry picked from commit 140ceb5d956bb8795a77c23d3fd5ef047b0f3c68)

17 months agoptrace(2): explain how to select specific thread to operate on
Konstantin Belousov [Mon, 5 Dec 2022 22:43:18 +0000 (00:43 +0200)]
ptrace(2): explain how to select specific thread to operate on

Tested by: pho

(cherry picked from commit 0e07241c372d7352537a4a786c96a580a721be3c)

17 months agoAdd a thread debugging flag TDB_BOUNDARY
Konstantin Belousov [Thu, 1 Dec 2022 00:29:35 +0000 (02:29 +0200)]
Add a thread debugging flag TDB_BOUNDARY

Tested by: pho

(cherry picked from commit f0592b3c8dd8e172f0e7165c11371108d4d8838d)

17 months agosys: rename td_coredump to td_remotereq
Konstantin Belousov [Wed, 30 Nov 2022 08:48:24 +0000 (10:48 +0200)]
sys: rename td_coredump to td_remotereq

Tested by: pho

(cherry picked from commit e6feeae2f915c76275b83b7365ae966a8f8dd016)

17 months agocompat32: move struct ptrace_sc_ret32 definition from .c to .h
Konstantin Belousov [Thu, 1 Dec 2022 01:31:58 +0000 (03:31 +0200)]
compat32: move struct ptrace_sc_ret32 definition from .c to .h

Tested by: pho

(cherry picked from commit f081a291a17de0e28e5b7f5adba312f0dcb59b0f)

17 months agoposixshm_test: add naive page accounting test
Konstantin Belousov [Sat, 3 Dec 2022 22:54:36 +0000 (00:54 +0200)]
posixshm_test: add naive page accounting test

For MFC, the deallocation part of the test is disabled because it is
not merged to stable/13.

Tested by: pho

(cherry picked from commit 91ddfd352f59beb8262f98c2e8a22722207e5aa6)

17 months agoposixshm_test: small style fixes
Konstantin Belousov [Sat, 3 Dec 2022 22:54:13 +0000 (00:54 +0200)]
posixshm_test: small style fixes

Tested by: pho

(cherry picked from commit f1f030246f3e72af0ee3ba82a0e8b9f6d9559b69)

17 months agoposixshmcontrol(1): for regular shmfd, report used pages number
Konstantin Belousov [Wed, 23 Nov 2022 22:01:05 +0000 (00:01 +0200)]
posixshmcontrol(1): for regular shmfd, report used pages number

Tested by: pho

(cherry picked from commit 1bbc5101348b9ca23cef6bde6c22751e69e8cf91)

17 months agoshmfd: account for the actually allocated pages
Konstantin Belousov [Wed, 23 Nov 2022 21:26:38 +0000 (23:26 +0200)]
shmfd: account for the actually allocated pages

Tested by: pho

(cherry picked from commit 0919f29d91031cf42eca99266bffe7b0faef8f1b)

17 months agotmpfs_getattr(): Only take vm_object lock on 32bit machines
Konstantin Belousov [Sat, 17 Dec 2022 11:03:32 +0000 (13:03 +0200)]
tmpfs_getattr(): Only take vm_object lock on 32bit machines

Tested by: pho

(cherry picked from commit 4d903a1a74d9526aba4d177e89c10f97df5662f2)

17 months agotmpfs: for used pages, account really allocated pages, instead of file sizes
Konstantin Belousov [Thu, 20 Oct 2022 13:17:43 +0000 (16:17 +0300)]
tmpfs: for used pages, account really allocated pages, instead of file sizes

PR: 223015
Tested by: pho

(cherry picked from commit 37aea2649ff707f23d35309d882b38e9ac818e42)

17 months agovm_pager_allocate(): override resulting object type
Konstantin Belousov [Sun, 4 Dec 2022 00:37:28 +0000 (02:37 +0200)]
vm_pager_allocate(): override resulting object type

Tested by: pho

(cherry picked from commit cd086696c2cb6d23bac3bc749836d36a9280ae98)

17 months agovm_page_grab_valid(): clear *mp in case of pager denying page allocation
Konstantin Belousov [Sat, 17 Dec 2022 00:12:14 +0000 (02:12 +0200)]
vm_page_grab_valid(): clear *mp in case of pager denying page allocation

Tested by: pho

(cherry picked from commit 3249449190c2c71ecfc4fa5f518f94ff552df440)

17 months agovm_pager: add method to veto page allocation
Konstantin Belousov [Thu, 20 Oct 2022 13:15:46 +0000 (16:15 +0300)]
vm_pager: add method to veto page allocation

Tested by: pho

(cherry picked from commit ec201dddfbddd3a77dd3f3afc9b007d0e13e7ad1)

17 months agovm_pager: add methods for page insertion and removal notifications
Konstantin Belousov [Thu, 20 Oct 2022 12:55:38 +0000 (15:55 +0300)]
vm_pager: add methods for page insertion and removal notifications

Tested by: pho

(cherry picked from commit d537d1f12e8829faccd395115193b03b578f1176)

17 months agotmpfs: make vm_object point to the tmpfs node instead of vnode
Konstantin Belousov [Thu, 20 Oct 2022 12:00:21 +0000 (15:00 +0300)]
tmpfs: make vm_object point to the tmpfs node instead of vnode

Tested by: pho

(cherry picked from commit d9dc64f1589360f2062ad92d63f69e13121e472a)

17 months agoProvide consistent prototype for swp_pager_meta_free()
Konstantin Belousov [Fri, 9 Dec 2022 15:21:16 +0000 (17:21 +0200)]
Provide consistent prototype for swp_pager_meta_free()

Tested by: pho

(cherry picked from commit 645510e62e34d9af4c2d57c7a6443a494511918d)

17 months agoMake swap_pager_freespace() global
Konstantin Belousov [Wed, 26 Oct 2022 22:13:27 +0000 (01:13 +0300)]
Make swap_pager_freespace() global

Tested by: pho

(cherry picked from commit baa1ccceefdf4954a88e54ca18c6ab1762faa326)

17 months agoAdd 'show tmpfs' ddb command
Konstantin Belousov [Thu, 20 Oct 2022 14:30:00 +0000 (17:30 +0300)]
Add 'show tmpfs' ddb command

Tested by: pho

(cherry picked from commit 83aff0f08c525ea3c394f3dd6598665cd369d53c)

17 months agotmpfs: minor style
Konstantin Belousov [Mon, 24 Oct 2022 13:30:38 +0000 (16:30 +0300)]
tmpfs: minor style

Tested by: pho

(cherry picked from commit e77f2f9dc683bb5ac725c5844fc36c831138e841)

17 months agouiomove_object: hide diagnostic under bootverbose
Konstantin Belousov [Sun, 23 Oct 2022 11:36:17 +0000 (14:36 +0300)]
uiomove_object: hide diagnostic under bootverbose

Tested by: pho

(cherry picked from commit 7ec4b29b086b67b8c778d2bc50c90e9e0655c03e)

17 months agorouting: Use NET_EPOCH_[CALL|WAIT] macros
Zhenlei Huang [Wed, 21 Dec 2022 01:33:31 +0000 (09:33 +0800)]
routing: Use NET_EPOCH_[CALL|WAIT] macros

Reviewed by: melifaro, kp
Differential Revision: https://reviews.freebsd.org/D37729

(cherry picked from commit 73336a6fd85b0267cebdbe1c91dc009a5ef8059e)

17 months agolio: Remove unneeded include
Zhenlei Huang [Wed, 21 Sep 2022 20:52:00 +0000 (14:52 -0600)]
lio: Remove unneeded include

Reviewed by: adiran, imp
Differential Revision: https://reviews.freebsd.org/D36501

(cherry picked from commit d819ddba9aa458f6e91df059426d9a2f1ac0b92d)

17 months agoLINT: Omit bnxt on i386
Warner Losh [Thu, 19 Jan 2023 15:31:51 +0000 (08:31 -0700)]
LINT: Omit bnxt on i386

bnxt is broken on i386, so omit it from all the LINT builds.

Sponsored by: Netflix

17 months agox86: ignore stepping for APL30 errata
Corvin Köhne [Tue, 9 Aug 2022 07:07:59 +0000 (09:07 +0200)]
x86: ignore stepping for APL30 errata

The issue is present in all apollolake cpus and it doesn't look like
there'll be a fix in the future.

See
https://www.intel.com/content/dam/www/public/us/en/documents/specification-updates/pentium-celeron-n-series-j-series-datasheet-spec-update.pdf

MFC after: 1 week
Sponsored by: Beckhoff Automation GmbH & Co. KG
Differential Revision: https://reviews.freebsd.org/D37621

(cherry picked from commit 122405c9034b624dd6771d578ef2467aa96cc145)

x86: Remove redundant parentheses

Reported by: avg
Sponsored by: Beckhoff Automation GmbH & Co. KG
MFC after: 1 week
MFC-With: b223c1f1a0ac ("x86: Add another cpuid for Apollo Lake errata APL30")

(cherry picked from commit 821b850a3bb73a78eef97ea22d1dc6ea82195b65)

x86: Add another cpuid for Apollo Lake errata APL30

Sponsored by: Beckhoff Automation GmbH & Co. KG
MFC after: 1 week

(cherry picked from commit b223c1f1a0ac83a3bd1475add9b794bad1749b2f)

17 months agobnxt: Only filter out i386
Warner Losh [Sat, 5 Nov 2022 04:35:37 +0000 (22:35 -0600)]
bnxt: Only filter out i386

Only i386 is missing bus_read_8. The other 32-bit platforms can be fixed
with a cast to a printf.

Suggested by: kevans
Sponsored by: Netflix

(cherry picked from commit eb40e3e757a7eb80c2b5c38ce05fc4b411b369f9)

17 months agoif_bnxt: Added support for mgmt interface for passthrough hwrms
Sumit Saxena [Fri, 4 Nov 2022 22:40:29 +0000 (16:40 -0600)]
if_bnxt: Added support for mgmt interface for passthrough hwrms

Added support for application management interface. There are two types of commands supported:

1. Firmware IOCTLs: These ioctls are meant for firmware
   consumption. Driver acts as a transport for these.
2. Driver only IOCTLs: These ioctls are meant for driver
   consumption. Driver will serve these ioctls without sending them down
   to firmware.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36448

(cherry picked from commit 58d84ef87094691bf1ad9608964ec85f120cd34a)

17 months agoif_bnxt: Add support for smaller backing_store_cfg message size
Sumit Saxena [Fri, 4 Nov 2022 22:33:21 +0000 (16:33 -0600)]
if_bnxt: Add support for smaller backing_store_cfg message size

Add compat logic to fallback to the older/smaller backing_store_cfg
message size.

Reviewed by: imp
Differentil Revision: https://reviews.freebsd.org/D36447

(cherry picked from commit 2ed061f08d9e2fe35bb8ff925cc19768d2430e77)

17 months agoif_bnxt: Fix the PORT_PHY_CFG HWRM requests while setting Pause
Sumit Saxena [Fri, 4 Nov 2022 22:31:24 +0000 (16:31 -0600)]
if_bnxt: Fix the PORT_PHY_CFG HWRM requests while setting Pause

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36446

(cherry picked from commit 19a57f85baac915a3642733c8a856517f4e95cb3)

17 months agoif_bnxt: Fix the issue when kernel invokes _init() again without _stop()
Sumit Saxena [Fri, 4 Nov 2022 22:28:51 +0000 (16:28 -0600)]
if_bnxt: Fix the issue when kernel invokes _init() again without _stop()

Fixed the issue when kernel invokes _init() when it is already in
_init() state by invoking _stop() in such case.

Reviewed by: imp
Differential Revsion: https://reviews.freebsd.org/D36445

(cherry picked from commit baef1301a2bc60be3908f44dff1f83dbbd8f812a)

17 months agoif_bnxt: Remove sysctl node vlan_only which is not being used
Sumit Saxena [Fri, 4 Nov 2022 22:26:03 +0000 (16:26 -0600)]
if_bnxt: Remove sysctl node vlan_only which is not being used

Removed sysctl node vlan_only which is not being used after migrating
from l2_set_rx_mask to l2_filter_alloc.

Reviewed by: imp
Differential Revsion: https://reviews.freebsd.org/D36444

(cherry picked from commit 72e9dbb58cad5262190cf2eae47f764021072128)

17 months agoif_bnxt: Add support for VLAN on Thor
Sumit Saxena [Fri, 4 Nov 2022 22:24:32 +0000 (16:24 -0600)]
if_bnxt: Add support for VLAN on Thor

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36443

(cherry picked from commit 91fcacc355971f74aa26fc7861020dc3a2a2d717)

17 months agoif_bnxt: Add support for RSS on Thor
Sumit Saxena [Fri, 4 Nov 2022 22:21:20 +0000 (16:21 -0600)]
if_bnxt: Add support for RSS on Thor

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36442

(cherry picked from commit cfdca95f7834d2c10749fb14e12495d8aa7d1be0)

17 months agoif_bnxt: Display firmware version along with SIT package version
Sumit Saxena [Fri, 4 Nov 2022 22:18:38 +0000 (16:18 -0600)]
if_bnxt: Display firmware version along with SIT package version

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36441

(cherry picked from commit 6033382aab2e6108e6faa273fd945274e161cd5b)

17 months agoif_bnxt: Add support for async link status update
Sumit Saxena [Fri, 4 Nov 2022 22:14:49 +0000 (16:14 -0600)]
if_bnxt: Add support for async link status update

Reivewed by: imp
Differential Revision: https://reviews.freebsd.org/D36440

(cherry picked from commit fb4b7e02d236c2c06a87fc3dacd8af6bcfbfb5c1)

17 months agoif_bnxt: Add support for admin down/up and jumbo
Sumit Saxena [Fri, 4 Nov 2022 22:11:10 +0000 (16:11 -0600)]
if_bnxt: Add support for admin down/up and jumbo

Make ifconfig up/down work, as well as adding support for jumbo frames.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36439

(cherry picked from commit 055196a7d777509bebab0e718a0d333cf2660178)

17 months agoif_bnxt: add support for Thor controller
Sumit Saxena [Fri, 4 Nov 2022 22:05:57 +0000 (16:05 -0600)]
if_bnxt: add support for Thor controller

Added support for Thor controller.
Below are the supported operations:

1. IPv4 ping (ICMP)
2. iperf / netperf (IPv4 TCP)
3. Promiscuous (tcpdump)
4. Can achieve 20 Gbps on a 25 G link (Uni-Di)
5. Can achieve 60 Gbps on a 100 G link (Uni-Di)
6. Port level and queue level driver stats.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36438

(cherry picked from commit 8945584f93ee3689c90fd6b6ee6d824381813ef2)

17 months agoif_bnxt: Convert all doorbell writes into function pointers
Sumit Saxena [Fri, 4 Nov 2022 22:01:30 +0000 (16:01 -0600)]
if_bnxt: Convert all doorbell writes into function pointers

This is preparatory patch for making a base for Broadcom's Thor
controller support. It converts all doorbell writes into function
pointers.

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36437

(cherry picked from commit 49a3df78c75f29dfa4991314535c0eac4f5a73fa)

17 months agoif_bnxt: update hsi_struct_def.h headers
Sumit Saxena [Fri, 4 Nov 2022 21:56:50 +0000 (15:56 -0600)]
if_bnxt: update hsi_struct_def.h headers

Updates the drivers to Broadcom's latest:
HWRM Version 1.10.2.34 using HSI definition version 1.8.4

Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D36436

(cherry picked from commit 97315f68fe87ae391d2dd2f8c636beac9754ab73)

17 months agobnxt: Remove unused devclass argument to DRIVER_MODULE.
John Baldwin [Mon, 9 May 2022 19:22:00 +0000 (12:22 -0700)]
bnxt: Remove unused devclass argument to DRIVER_MODULE.

(cherry picked from commit 64d3221c61122b9a6a73f107c8145e92b47eb4c8)

17 months agobnxt: Remove dead write to cp_ring_id
Warner Losh [Mon, 28 Feb 2022 17:13:27 +0000 (10:13 -0700)]
bnxt: Remove dead write to cp_ring_id

Since this is read from memory, reading it and then ignoring it is dead
code...

Sponsored by: Netflix

(cherry picked from commit 44b4f0370fe90d11306e9d3fdcacdc5b4ccc946e)

17 months agoxdr: store chars consistently
Brooks Davis [Wed, 18 Jan 2023 19:13:15 +0000 (19:13 +0000)]
xdr: store chars consistently

Cast char's through unsigned char before storing as an integer in
xdr_char(), this ensures that the encoded form is consistently not
sign-extended following Open Solaris's example.

Prior to this change, platforms with signed chars would sign extend
values with the high bit set but ones with unsigned chars would not
so 0xff would be stored as 0x000000ff on unsigned char platforms and
0xffffffff on signed char platforms.  Decoding has the same
result for either form so this is a largely cosmetic change, but it
seems best to produce consistent output.

For more discussion, see https://github.com/openzfs/zfs/issues/14173

Reviewed by: mav, imp
Differential Revision: https://reviews.freebsd.org/D37992

(cherry picked from commit a872c37054172f3f7a03aef263ca5886a749771f)

17 months agoLinuxKPI: add (skeleton) functions to make drivers compile
Bjoern A. Zeeb [Sat, 3 Dec 2022 23:00:04 +0000 (23:00 +0000)]
LinuxKPI: add (skeleton) functions to make drivers compile

Add more functions to netdevice.h (netif_napi_add_tx() being the only
one implemented) and add platform_device.h and netlink.h in order to
make driver code compile.
The skeleton functions are used only in very limited scope and not at
all in our usage so far but add (invasive) #ifdef if removed.
Add pr_debug() calls to each of them in order to log a TODO (if DEBUG
compiled in) and someone should hit them in the future.

Commented on by: hselasky (earlier version)
Differential Revision: https://reviews.freebsd.org/D37599

(cherry picked from commit 75388b9ca5e566fb7cbd62a37cea1f66d8203fc6)

17 months agoLinuxKPI: pci: add [linuxkpi_]pci_get_device()
Bjoern A. Zeeb [Fri, 2 Dec 2022 22:14:09 +0000 (22:14 +0000)]
LinuxKPI: pci: add [linuxkpi_]pci_get_device()

Add a version of pci_get_device() as linuxkpi_pci_get_device()
not (yet) supporting the last argument.
Due to conflicts we cannot redefine it as we would normally do
in LinuxKPI so drivers have to be adjusted.

Differential Revision: https://reviews.freebsd.org/D37593

(cherry picked from commit 8f61992d7cc1108cebc1337451a15a0af420984c)

17 months agoLinuxKPI: fix pci_alloc_irq_vectors() for MSI
Bjoern A. Zeeb [Mon, 28 Nov 2022 18:05:48 +0000 (18:05 +0000)]
LinuxKPI: fix pci_alloc_irq_vectors() for MSI

pci_alloc_irq_vectors() is given a min and max vector value.
pci_enable_msi() will always succeed independent of these arguments as
it does not know about them.  Further it will only ever allocate
1 "vector" not supporting any other amount.
So upfront check that (a) the available pci_msi_count() can satisfy the
requested minv and (b) given the pci_enable_msi() hard coded limit check
that minv is not larger than 1.
If we cannot satisfy either requirement return an error.

This fixes problems with drivers which check that the returned value
of allocated "vectors" will match their requests and only otherwise try
to fall back to ask for 1 or deal otherwise.

Sponsored by: The FreeBSD Foundation
Reviewed by: hselasky (earlier version)
Differential Revision: https://reviews.freebsd.org/D37522

(cherry picked from commit e9715b1c4474333ff119aba3a9a74bff91f72372)

17 months agoLinuxKPI: add kstrtou32_from_user() and mac_pton()
Bjoern A. Zeeb [Sat, 22 Oct 2022 18:02:58 +0000 (18:02 +0000)]
LinuxKPI: add kstrtou32_from_user() and mac_pton()

While here:
- fix an argument of kstrtouint_from_user() to correct signedness.
- make kstrtou32() call kstrtouint() to avoid duplication (keep inline
  function)

Add kstrtou32_from_user() based on other examples in the file
making it a copy of the now fixed kstrtouint_from_user().

Also add a rudimentarily hacked up version of mac_pton() which is
leanient accepting non-well-formed input but so far only with ':'
separators.  It does not seem to obviously belong to any networking
header file so add it here.

Both new functions are needed for debugfs support for iwlwifi hence
coming together in one commit.

Sponsored by: The FreeBSD Foundation
Commented on by: emaste
Differential Revision: https://reviews.freebsd.org/D37088

(cherry picked from commit f82cf28b317b6b3ffd1418ab9c5b230145da8f75)

17 months agortw88: use #define for NL80211_BAND_2GHZ instead of hardcoded number
Bjoern A. Zeeb [Fri, 13 Jan 2023 01:05:01 +0000 (01:05 +0000)]
rtw88: use #define for NL80211_BAND_2GHZ instead of hardcoded number

Use NL80211_BAND_2GHZ instead of a hard coded 0 as array index for the
band.  While LinuxKPI provides a KPI compatibility some of these values
may not necessarily be KBI compatible (in this case they shoule be so
this is a NOP) and after all it is better style.

No functional change.

(cherry picked from commit 8aaefd0512daea0f9869cd2fe3cee9443d5fb6aa)

17 months agoiwlwifi: mark a declaration for a non-existent function
Bjoern A. Zeeb [Fri, 13 Jan 2023 01:00:00 +0000 (01:00 +0000)]
iwlwifi: mark a declaration for a non-existent function

iwl_trans_pcie_send_hcmd() does not seem to exist (anymore).  Mark it
as __linux__ so we can submit the cleanup with the next upstream run.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit f797d5f37089de8134b4599bb033635ac7d07bef)

17 months agoLinuxKPI: 802.11: implement some *eleme/ie* lookup functions
Bjoern A. Zeeb [Sat, 31 Dec 2022 01:33:28 +0000 (01:33 +0000)]
LinuxKPI: 802.11: implement some *eleme/ie* lookup functions

Implement cfg80211_find_elem(), ieee80211_bss_get_elem(),
ieee80211_bss_get_ie(), and cfg80211_find_vendor_ie() with the last
one having a short cut always also checking oui_type in the pattern.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 5db817d864241232c51d654836996282c69f5e28)

17 months agoLinuxKPI: 802.11: move ieee80211_{unregister,restart}_hw out of header
Bjoern A. Zeeb [Sat, 31 Dec 2022 02:24:23 +0000 (02:24 +0000)]
LinuxKPI: 802.11: move ieee80211_{unregister,restart}_hw out of header

Migrate the two functions from the header into the implementation file
in order to have access to more facilities and not to run into possible
allocation/locking/... problems in the future.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 4b0af114370a5cb876012c381d3156c8fbdf7f40)

17 months agoLinuxKPI; 802.11: update mac80211.h structures and fields
Bjoern A. Zeeb [Sat, 31 Dec 2022 02:15:28 +0000 (02:15 +0000)]
LinuxKPI; 802.11: update mac80211.h structures and fields

Cleanup some fields and structures and add new ones.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit c990500bf1028d55cdd370037c78ea808956e0fc)

17 months agoLinuxKPI: 802.11: implement ieee80211_get_hdrlen_from_skb()
Bjoern A. Zeeb [Sat, 31 Dec 2022 02:02:01 +0000 (02:02 +0000)]
LinuxKPI: 802.11: implement ieee80211_get_hdrlen_from_skb()

Implement ieee80211_get_hdrlen_from_skb() doing basic sanity checks
on lengths (minimal length or skb data length vs. header length).

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 339119949660916aa40b1d67dbe002dd7eb0d709)

17 months agoLinuxKPI: 802.11: set sta supported legacy rates
Bjoern A. Zeeb [Sat, 31 Dec 2022 00:33:34 +0000 (00:33 +0000)]
LinuxKPI: 802.11: set sta supported legacy rates

When initializing the sta set the per-band supported legacy rates
as some drivers take the information from there.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit b6b352e4c7125e7d85ba382f05b1bad8454b6233)

17 months agoLinuxKPI: 802.11: implement cfg80211_{get,put}_bss
Bjoern A. Zeeb [Sat, 31 Dec 2022 01:18:16 +0000 (01:18 +0000)]
LinuxKPI: 802.11: implement cfg80211_{get,put}_bss

Implement cfg80211_{get,put}_bss currently doing malloc/free bits,
so hopefully the drivers get the calls right.

cfg80211_get_bss() sets up a lookup structure which may also take a
result (first hit wins) and calls ieee80211_scan_iterate() comparing
the various values in the iterator funcion.  Some of the checks are
partially pointless (as it seems the drivers are not interested in
these parts [ANY] but we keep them for documentation purposes should
futher values arise in the future).

We currently only iterate over the first VAP which will do for now.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 5edde07c2aba02d0f7d30bbb0f203ec3e920e273)

17 months agoLinuxKPI: 802.11: implement cfg80211_get_ies_channel_number()
Bjoern A. Zeeb [Sat, 31 Dec 2022 01:59:20 +0000 (01:59 +0000)]
LinuxKPI: 802.11: implement cfg80211_get_ies_channel_number()

Using the previous changes implement cfg80211_get_ies_channel_number()
either based on DSPARMS (or for the future HTINFO).

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 13d87d92e401523f8d8e817720d40dc31cdfa444)

17 months agoLinuxKPI: add simplified version of page_frag_cache
Bjoern A. Zeeb [Sat, 3 Dec 2022 00:33:34 +0000 (00:33 +0000)]
LinuxKPI: add simplified version of page_frag_cache

For the moment and the currently only consumer (mt76) add a simplified
version of the page_frag_cache.  We will only accept fragement sizes up
to 1 PAGE_SIZE (KASSERT) and we will always return a full page.
Should we add more consumers or small (or large) objects would become a
problem we can always add a more elaborate version.

Discussed with: markj
Reviewed by: markj (,hselasky commented as well)
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D37595

(cherry picked from commit 55038a6306a570c9f2df89f5ad076de0f7d98152)

LinuxKPI: fix possible NULL dereference in linuxkpi_page_frag_alloc()

Reported by: Coverity via emaste
Coverity ID: 1502345
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 51e94a4658d23016dd0ae67c189a89f53281cbcd)

17 months agoLinuxKPI: pm.h add pm_sleep_ptr and DEFINE_SIMPLE_DEV_PM_OPS
Bjoern A. Zeeb [Mon, 28 Nov 2022 22:31:28 +0000 (22:31 +0000)]
LinuxKPI: pm.h add pm_sleep_ptr and DEFINE_SIMPLE_DEV_PM_OPS

Extend pm.h by pm_sleep_ptr and DEFINE_SIMPLE_DEV_PM_OPS().
For the moment this duplicates some parts (as can be seen in the earlier
review I tried to simplify bits but given our implementation this
was easier in the end).

While here and cleanup the SIMPLE_DEV_PM_OPS() bits (white-space only).

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D37527

(cherry picked from commit 4052b0e4b218f916b1f491a5ec9e41d38029215b)

17 months agoLinuxKPI: pci.h add more MSI related constanst and pci_is_enabled()
Bjoern A. Zeeb [Mon, 31 Oct 2022 22:14:10 +0000 (22:14 +0000)]
LinuxKPI: pci.h add more MSI related constanst and pci_is_enabled()

Add more MSI related constansts defined to our native defines and
pci_is_enabled().  All are needed for another wireless driver.

Differential Revision: https://reviews.freebsd.org/D37225

(cherry picked from commit 5f2f582ccceec8729ee85bf191a2f7373c2994a4)

17 months agoLinuxKPI,lindebugfs: add u8 base type and blob support
Bjoern A. Zeeb [Sat, 22 Oct 2022 18:12:16 +0000 (18:12 +0000)]
LinuxKPI,lindebugfs: add u8 base type and blob support

Add debugfs_create_u8() based on other already present implementations.
Add a read-only implementation for debugfs_create_blob().

Both are needed for iwlwifi debugfs support.

Sponsored by: The FreeBSD Foundation
OKed by: jfree (earlier version)
Differential Revision: https://reviews.freebsd.org/D37090

(cherry picked from commit 0fce2dc1573019d0732f33fa7c26cc228655d3e8)

17 months agoLinuxKPI: SKB: implement skb_peek()
Bjoern A. Zeeb [Mon, 28 Nov 2022 18:47:08 +0000 (18:47 +0000)]
LinuxKPI: SKB: implement skb_peek()

Sponsored by: The FreeBSD Foundation

(cherry picked from commit ce9f36610ea9ff29d42a2bcfed44b020c2e56dcb)

17 months agortw88: correct SRCS+= in Makefile
Bjoern A. Zeeb [Mon, 28 Nov 2022 15:48:44 +0000 (15:48 +0000)]
rtw88: correct SRCS+= in Makefile

Properly spell a SRCS+= for an optional file (this is why it stayed
unnoticed so far).

(cherry picked from commit 4495b4eb510d87277ed2dd4d27f7cebc7a76b4a8)

17 months agoLinuxKPI: 802.11: minor header updates
Bjoern A. Zeeb [Mon, 28 Nov 2022 21:21:06 +0000 (21:21 +0000)]
LinuxKPI: 802.11: minor header updates

- add comments for enum values constantly looked up, and another one to
  a net80211 equivalent (should possibly re-define those in the future?)
- add another nl80211_sta_info flag
- add enum environment_cap used in cfg80211.h in the future.

(cherry picked from commit 69cc1630014b7c50f754f5d49cfd4ed2905a5c48)

17 months agoLinuxKPI: ethtool.h add more definitions
Bjoern A. Zeeb [Sun, 30 Oct 2022 17:07:49 +0000 (17:07 +0000)]
LinuxKPI: ethtool.h add more definitions

While we do not currently use ethtool, add the definitions to avoid
other longer-term maintenance problems with drivers.

Also migrate ETH_GSTRING_LEN into here from if_ether.h as it seems this
is where it belongs.

Differential Revision: https://reviews.freebsd.org/D37214

(cherry picked from commit 1b91eba37b294fd191a9dc79a80f52495af9418d)

17 months agoLinuxKPI: add a no-op generic_file_llseek()
Bjoern A. Zeeb [Sat, 22 Oct 2022 20:27:42 +0000 (20:27 +0000)]
LinuxKPI: add a no-op generic_file_llseek()

This is needed for debugfs implementations in drivers.

Sponsored by: The FreeBSD Foundation
OKed by: jfree
Differential Revision: https://reviews.freebsd.org/D37092

(cherry picked from commit af393426b321e885d1db5f0a0571f34969a59a9f)

17 months agoLinuxKPI: iwlwifi: rtw88: rtw89: remove budget argument from netif_napi_add()
Bjoern A. Zeeb [Mon, 28 Nov 2022 15:12:58 +0000 (15:12 +0000)]
LinuxKPI: iwlwifi: rtw88: rtw89: remove budget argument from netif_napi_add()

In preparation for future updates remove the budget argument from the
netif_napi_add() in drivers and update LinuxKPI to reflect that it is
gone and only set it internally.  This required changes to the currently
committed wireless drivers based on LinuxKPI (iwlwifi, rtw88, rtw89).

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 23c73dbae7b2f64014b275643efbe92f449feaa2)

17 months agoLinuxKPI: SKB update
Bjoern A. Zeeb [Mon, 28 Nov 2022 20:54:57 +0000 (20:54 +0000)]
LinuxKPI: SKB update

- skb_reset_tail_pointer(): we do not do offsets so do a plain reset
- skb_add_rx_frag(): adjust data_len to keep track of the frag
- based on that implement skb_is_nonlinear() and skb_linearize()
- implement build_skb() and adjust linuxkpi_kfree_skb() and ddb macro.

Sponsored by: The FreeBSD Foundation (partially)

(cherry picked from commit 5504bd59a39ba0bd0014308ff1aa5d4899432a3e)

17 months agolindebugfs,rtw88,rtw89: correct module dependencies
Bjoern A. Zeeb [Sun, 25 Sep 2022 21:36:10 +0000 (21:36 +0000)]
lindebugfs,rtw88,rtw89: correct module dependencies

In f697b9432d9c7aa4c5ab5f5445ef5dc1bd40ce00 the name of the PSEUDOFS
was changed from debugsfs to lindebugfs but the in-tree consumers
were not updated now leaving the drivers not loading if compiled
with debugfs support due to missing dependencies.

(cherry picked from commit 1a2b55732ff27fba2533724a72a39d33516c9417)

17 months agortw89: import firmware for Realtek's rtw89 supported chipsets.
Bjoern A. Zeeb [Fri, 9 Sep 2022 12:52:54 +0000 (12:52 +0000)]
rtw89: import firmware for Realtek's rtw89 supported chipsets.

Import the most recent versions of the firmware images for the
rtw89 driver.

This is based on linux-firmware at 2f2f0181581d3e35bfdb9fc65f609ee9d3fbaeb7.

The license of the firmware matches the previously added rtw88(4) firmware
and you can find a copy in sys/contrib/dev/rtw89fw/LICENCE.rtlwifi_firmware.txt.

Add build infrastructure to create the .ko files but do not yet hook
it up to the build until all parts are in the tree.

Approved by: core.11 (imp) [2022-03-27]

(cherry picked from commit 866e021654cfb72c050fd228dee476fb92fa6f48)

17 months agortw89: import Realtek's rtw89 driver
Bjoern A. Zeeb [Fri, 9 Sep 2022 12:41:07 +0000 (12:41 +0000)]
rtw89: import Realtek's rtw89 driver

Import rtw89 based on wireless-testing at (tag: wt-2022-09-02)
78667a29c116c6b186a37e28cd8dd7fa9923aee8 with adjustments for FreeBSD.

For the moment this will stay disconnected from the build until the
last bits are flushed out, but this will help people with a card to
do testing and possibly help improving.

Given the lack of full license texts on non-local files this is
imported under the draft policy for handling SPDX files (D29226). [1]

Approved by: core.11 (imp) [1] [2022-03-27]

(cherry picked from commit 8e93258f2686c76b4e3b384a904d8b4413976229)

17 months agodevice_get_property: add a HANDLE case
Bjoern A. Zeeb [Thu, 29 Sep 2022 12:41:58 +0000 (12:41 +0000)]
device_get_property: add a HANDLE case

This will resolve a reference and return the appropriate handle, a node
on the simplebus or an ACPI_HANDLE for ACPI.  For now we do not try to
further abstract the return type.

Reviewed by: mw
Differential Revision: https://reviews.freebsd.org/D36793

(cherry picked from commit 99e6980fcf5e12654c3e89b97b774de807d740a4)

17 months agoEnable taking snapshots on UFS/FFS filesystems using journaled soft updates.
Kirk McKusick [Sun, 13 Nov 2022 06:56:03 +0000 (22:56 -0800)]
Enable taking snapshots on UFS/FFS filesystems using journaled soft updates.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D36491

(cherry picked from commit 78f41298760509f5c2b5865b2158c801d4023363)

17 months agodma: dma.conf.5 as MLINK to dma.8
Ed Maste [Wed, 4 Jan 2023 18:47:26 +0000 (13:47 -0500)]
dma: dma.conf.5 as MLINK to dma.8

There's no separate man page for dma.conf, but the format is documented
in dma.8.

Reviewed by: bapt
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D37944

(cherry picked from commit 45396fda8b73146d3980797d48704184a5aa99ff)

17 months agoiwmbtfw(8): Fix a typo in a kernel message
Gordon Bergling [Wed, 11 Jan 2023 11:22:18 +0000 (12:22 +0100)]
iwmbtfw(8): Fix a typo in a kernel message

- s/succesful/successful/

(cherry picked from commit 40bb52c89b87c1417be5ded6808bd674d512900e)

17 months agoMFV: xz 5.4.0
Xin LI [Sun, 1 Jan 2023 04:25:17 +0000 (20:25 -0800)]
MFV: xz 5.4.0

(cherry picked from commit 73ed8e77a79398eb8e7b600a0b67f286e9e5cd53)

17 months agoFix vop_readdir's ncookies handling in UFS and EXT2.
Kirk McKusick [Mon, 2 Jan 2023 03:29:43 +0000 (19:29 -0800)]
Fix vop_readdir's ncookies handling in UFS and EXT2.

Submitted by: Kusumi Tomohiro
PR:           267706

(cherry picked from commit e84e44215fe19dad4d1779d5ee0b2f2d2739f016)

17 months agomrsas(4): Fix a typo in a source code comment
Gordon Bergling [Wed, 11 Jan 2023 09:48:14 +0000 (10:48 +0100)]
mrsas(4): Fix a typo in a source code comment

- s/reqest/request/

(cherry picked from commit e018483b10e7cf2cd852406648ccaf1f159ecb8d)

17 months agotcp_rack(4): Fix a typo in a source code comment
Gordon Bergling [Wed, 11 Jan 2023 11:02:25 +0000 (12:02 +0100)]
tcp_rack(4): Fix a typo in a source code comment

- s/postion/position/

(cherry picked from commit 432a398d86972f31bd66d3fad9bdd17acf5e8d7d)

17 months agoisci(4): Fix common typos in source code comments
Gordon Bergling [Wed, 11 Jan 2023 09:45:08 +0000 (10:45 +0100)]
isci(4): Fix common typos in source code comments

- s/reuqest/request/
- s/requst/request/

(cherry picked from commit be51810f8d68937ec4e2ce05e89938bda34d8364)

17 months agotty(4): Fix a typo in a source code comment
Gordon Bergling [Wed, 11 Jan 2023 11:12:48 +0000 (12:12 +0100)]
tty(4): Fix a typo in a source code comment

- s/charaters/characters/

(cherry picked from commit a74be23c6ed766dcb1bfeeea2f18c0d176e487c0)

17 months agolibthr(3): Fix a typo in a source code comment
Gordon Bergling [Wed, 11 Jan 2023 10:48:14 +0000 (11:48 +0100)]
libthr(3): Fix a typo in a source code comment

- s/extentions/extensions/

(cherry picked from commit 085a77a677b1265407456eaaf440350af8e8fd15)

17 months agovr(4): Fix a typo in a source code comment
Gordon Bergling [Wed, 11 Jan 2023 09:51:34 +0000 (10:51 +0100)]
vr(4): Fix a typo in a source code comment

- s/reuqest/request/

(cherry picked from commit 70182a0cfb4bed3515cb7bcb2c5cde75bb61d069)

17 months agoice: Fix a typo in a source code comment
Gordon Bergling [Wed, 11 Jan 2023 09:50:32 +0000 (10:50 +0100)]
ice: Fix a typo in a source code comment

- s/reqest/requests/

(cherry picked from commit b6f9c6aadc686cf5a890afe16e26a0082fa25c87)

17 months agoi386: Fix a typo in a source code comment
Gordon Bergling [Wed, 11 Jan 2023 10:29:23 +0000 (11:29 +0100)]
i386: Fix a typo in a source code comment

- s/betwen/between/

(cherry picked from commit 77a863b6c217f3c143e1a8514a0fe409d5936c0f)

17 months agotcp_hpts: Fix a typo in a source code comment
Gordon Bergling [Wed, 11 Jan 2023 10:33:29 +0000 (11:33 +0100)]
tcp_hpts: Fix a typo in a source code comment

- s/subract/subtract/

(cherry picked from commit d68f15420528e11f69a7bda365608581bfc34e64)

17 months agoahci(4): Fix a typo in a source code comment
Gordon Bergling [Wed, 11 Jan 2023 09:46:58 +0000 (10:46 +0100)]
ahci(4): Fix a typo in a source code comment

- s/reqests/requests/

(cherry picked from commit bc9228749c2ab31192a17ef01cfb363480144cdc)

17 months agocxgbe(4): Fix a few common typos in source code comments
Gordon Bergling [Wed, 11 Jan 2023 09:53:07 +0000 (10:53 +0100)]
cxgbe(4): Fix a few common typos in source code comments

- s/Reqests/Requests/

(cherry picked from commit f273b4561386b8df7d4ea7b7b176bf9df298e1d7)

17 months agomvs(4): Fix a typo in a source code comment
Gordon Bergling [Wed, 11 Jan 2023 09:49:22 +0000 (10:49 +0100)]
mvs(4): Fix a typo in a source code comment

- s/reqests/requests/

(cherry picked from commit f272a059a40aee4eda44294bc5dfdf0bd7e5c02d)

17 months agolibiscsiutil: Fix a typo in a source code comment
Gordon Bergling [Wed, 11 Jan 2023 10:52:55 +0000 (11:52 +0100)]
libiscsiutil: Fix a typo in a source code comment

- s/sesion/session/

(cherry picked from commit 29b36af9981e7f194abe68b0359448846c021cd6)

17 months agorouting: unbreak the build of a bunch of kernels
Mateusz Guzik [Thu, 11 Aug 2022 21:50:37 +0000 (21:50 +0000)]
routing: unbreak the build of a bunch of kernels

Sponsored by: Rubicon Communications, LLC ("Netgate")

(cherry picked from commit f73e4f6c5817bf6bbf8b34c656b7a7acf6c87e47)

17 months agoUpdate rtsock_l3 test after 2fe5a79425c79f7b828acd91da66d97230925fc8
Alex Richardson [Wed, 21 Apr 2021 09:58:34 +0000 (10:58 +0100)]
Update rtsock_l3 test after 2fe5a79425c79f7b828acd91da66d97230925fc8

Two of these tests now pass. Looking at Jenkins to find the first commit
where this behaviour changed indicates that
2fe5a79425c79f7b828acd91da66d97230925fc8 is the most likely cause.

Reviewed By: melifaro
Differential Revision: https://reviews.freebsd.org/D28886

(cherry picked from commit 67f2f67fc8ce8484066e95dabac5af892888fca1)

17 months agorouting: add missed RIB_WUNLOCK in the add_route_flags().
Alexander V. Chernikov [Fri, 30 Dec 2022 15:54:06 +0000 (15:54 +0000)]
routing: add missed RIB_WUNLOCK in the add_route_flags().

MFC after: 2 weeks

(cherry picked from commit 06e879593a445dd785d531a06fb19ab68076985b)

17 months agoroute: allow RTM_CHANGE notifications in rt_routemsg().
Alexander V. Chernikov [Thu, 15 Dec 2022 10:39:06 +0000 (10:39 +0000)]
route: allow RTM_CHANGE notifications in rt_routemsg().

MFC after: 2 weeks

(cherry picked from commit 3636a967f310e3380ff7d8d63728ca9e7a5b6ce2)

17 months agorouting: provide dedicated function for nhgrp creation and linking.
Alexander V. Chernikov [Fri, 2 Dec 2022 17:58:03 +0000 (17:58 +0000)]
routing: provide dedicated function for nhgrp creation and linking.

There is a need to store client metadata in nexthops and nexthop groups.
This metadata is immutable and participate in nhop/nhg comparison.

Nexthops KPI already supports its: nexthop creation pattern is
```
nhop_alloc()
nhop_set_...()
...
nhop_get_nhop()
```

This change provides a similar pattern for the nexthop groups.
Specifically, it adds nhgrp_alloc(), nhgrp_get_nhgrp() and
nhgrp_set_uidx().

MFC after: 2 weeks

(cherry picked from commit 42f8123a4fa8354f07e3ebce1d3b6c2def7db5a3)

17 months agonetinet: pass cred instead of the curthread to ifaddr manipulation funcs.
Alexander V. Chernikov [Mon, 26 Sep 2022 12:07:18 +0000 (12:07 +0000)]
netinet: pass cred instead of the curthread to ifaddr manipulation funcs.

Pass the credentials directly to the functions, so non-ioctl kernel
 users can also performan address manipulations.

MFC after: 2 weeks

(cherry picked from commit f375bf0e6f0bc6bce3e5b3c6adabc465be2665d0)

17 months agorouting: constantify nh/nhg argument in <nhop|nhgrp>_get_origin().
Alexander V. Chernikov [Thu, 8 Sep 2022 10:21:25 +0000 (10:21 +0000)]
routing: constantify nh/nhg argument in <nhop|nhgrp>_get_origin().

MFC after: 1 month

(cherry picked from commit e7624170772d28c89e841b817634666bbc658ffd)

17 months agorouting: add abitity to set the protocol that installed route/nexthop.
Alexander V. Chernikov [Thu, 8 Sep 2022 09:05:53 +0000 (09:05 +0000)]
routing: add abitity to set the protocol that installed route/nexthop.

Routing daemons such as bird need to know if they install certain route
 so they can clean it up on startup, as a form of achieving consistent
 state during the crash recovery.
Currently they use combination of routing flags (RTF_PROTO1) to detect
 these routes when interacting via route(4) rtsock protocol.
Netlink protocol has a special "rtm_protocol" field that is filled and
 checked by the route originator. To prepare for the upcoming netlink
 introduction, add ability to record origing to both nexthops and
 nexthop groups via <nhop|nhgrp>_<get|set>_origin() KPI. The actual
 calls will be used in the followup commits.

MFC after: 1 month

(cherry picked from commit 000250be0d2dc7a241f1c9b9c27d941af781ca46)

17 months agonetinet6: call lle_event eventhandler after updating state
Alexander V. Chernikov [Mon, 5 Sep 2022 12:57:20 +0000 (12:57 +0000)]
netinet6: call lle_event eventhandler after updating state

Fix nd6_na_input() eventhandler call: run eventhandler after lle
 state transition.

Old behaviour (as seen by event handler):
 * fe80::5054:ff:fe8c:63e9 dev vtnet0 lladdr 52:54:00:8c:63:e9 INCOMPLETE
New behaviour:
* fe80::5054:ff:fe8c:63e9 dev vtnet0 lladdr 52:54:00:8c:63:e9 REACHABLE

MFC after: 2 weeks

(cherry picked from commit db98b4205093a6ee201ce0b8d83c77d5b730d7cb)

17 months agorouting: allow logging framework to be used outside of the subsystem
Alexander V. Chernikov [Mon, 5 Sep 2022 10:44:27 +0000 (10:44 +0000)]
routing: allow logging framework to be used outside of the subsystem

MFC after: 2 weeks

(cherry picked from commit 4bccbf03d81b2bafb93c1674eaa2f70e7226a25a)