Commit graph

2322 commits

Author SHA1 Message Date
Bjoern A. Zeeb 8e93258f26 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]
MFC after:	6 weeks
2022-09-09 16:32:17 +00:00
Bjoern A. Zeeb 549198b1ab LinuxKPI, dev: 80211 update mac80211 KPI
Update the mac80211 ops KPI for (*conf_tx), (*assign_vif_chanctx),
(*unassign_vif_chanctx), (*start_ap), and (*stop_ap), as well as
ieee80211_beacon_get_tim() and ieee80211_beacon_get_template().

Update in-tree drivers iwlwifi and rtw88 accordingly based on upstream
changes (as well as out-of-tree ones).  This was triggered by trying to
synchronize more drivers to a common state.

MFC after:	1 week
2022-09-07 23:38:54 +00:00
Bjoern A. Zeeb e3a0b1202b LinuxKPI: 80211 / iwlwifi: improve queue management
For one initialise vif->hw_queues later set in lkpi_80211_txq_tx_one()
for drivers using them.  This may still need slightly more cleanup once
we get QUEUE_CONTROL-supporting drivers into the tree.

For the other rework and improve how we deal with tid/ac/txq in
lkpi_80211_txq_tx_one() and cleanup old comments and unused code.
This seems to reduce (remove) "Invalid TXQ id" reports from iwlwifi.
(The assumption is that the frame(s) triggering this WARN_ONCE or the
added FreeBSD specific logging were sent with lkpi_80211_mo_tx()).

Adjust the one logging from e674ddec0b
to IWL_DEBUG_TX so that now this is fixed it is also not always logged
anymore but leave it in case we need to further debug queues in the
future.

Tested by:	pstef, Kevin Oberman (rkoberman gmail.com)
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-09-05 21:03:03 +00:00
Bjoern A. Zeeb 26a3694833 iwlwifi: move an ieee80211_get_tid() call
Introduce a local change.  It seems ieee80211_get_tid() does not deal
with non-dataqos packets unlike net80211's ieee80211_gettid().
Gernally all calls in Linux drivers to ieee80211_get_tid() seem to
be proceeded by an ieee80211_is_data_qos() check.

Moving the ieee80211_get_tid() has no difference in the result, but
(a) saves us the call if we do not need it due to an earlier return,
and (b) allows us to put an assert into the LinuxKPI ieee80211_get_tid()
implementation to avoid accidentally returning random frame header data
in case of a missing earlier ieee80211_is_data_qos() check in (future/
other) drivers.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-08-31 23:01:36 +00:00
Martin Matuska 08aba0aec7 zfs: merge openzfs/zfs@a582d5299
Notable upstream pull request merges:
  #13717 Fix zpool status in case of unloaded keys
  #13753 Prevent zevent list from consuming all of kernel memory
  #13767 arcstat: fix -p option
  #13785 Updates for snapshots_changed property

Obtained from:	OpenZFS
OpenZFS commit:	a582d52993
2022-08-26 00:58:56 +02:00
Bjoern A. Zeeb e674ddec0b iwlwifi: add FreeBSD specific debugging
"Invalid TXQ id" and "Queue <n> is stuck <x> <y>" are two errors seen
more commonly by FreeBSD users.  Try to gather some extra data the
"easy way" adding more error logging for these situations in the hope
to find a clue or at least do more targetd debugging in the future.
Note that for one of the errors the Linux Intel driver has a TODO to
print register data.  If that will show up in future versions of the
driver this may also help.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-08-17 16:11:47 +00:00
Martin Matuska 271171e0d9 zfs: merge openzfs/zfs@b3d0568cf
Notable upstream pull request merges:
  #9372 Implement a new type of zfs receive: corrective receive (-c)
  #13635 Add snapshots_changed as property
  #13636 Add support for per dataset zil stats and use wmsum counters
  #13643 Fix scrub resume from newly created hole
  #13670 Fix memory allocation for the checksum benchmark
  #13695 Skip checksum benchmarks on systems with slow cpu
  #13711 zpool: fix redundancy check after vdev removal

Obtained from:	OpenZFS
OpenZFS commit:	b3d0568cfd
2022-08-14 01:14:21 +02:00
Warner Losh 4f0c9b76cf stand: Only compile decompression routines
We don't need the compress rotuines, nor zstd_opt.c. Remove them.
Expand the number of places we omit code for IN_LIBSA (which are FreeBSD
specific). Due to the agressive optimization, though, this doesn't
reduce the size of the loader. It does reduce the number of 'false
positives' for places to omit to reduce the size as well as reducing the
build time slightly.

Sponsored by:		Netflix
Reviewed by:		tsoome, delphij
Differential Revision:	https://reviews.freebsd.org/D36145
2022-08-12 21:48:18 -06:00
Emmanuel Vadot c9ccf3a32d Import device-tree files from Linux 5.18
Sponsored by:   Beckhoff Automation GmbH & Co. KG
2022-08-10 14:32:46 +02:00
Emmanuel Vadot e67e85659c Import device-tree files from Linux 5.17
Sponsored by:   Beckhoff Automation GmbH & Co. KG
2022-08-10 14:29:43 +02:00
Emmanuel Vadot 8cc087a1ee Import device-tree files from Linux 5.16
Sponsored by:   Beckhoff Automation GmbH & Co. KG
2022-08-10 14:27:16 +02:00
Emmanuel Vadot 354d7675fe Import device-tree files from Linux 5.15
Sponsored by:	Beckhoff Automation GmbH & Co. KG
2022-08-10 14:21:52 +02:00
Emmanuel Vadot 5956d97f4b Import device-tree files from Linux 5.14 2022-08-10 14:12:15 +02:00
Mark Adler 2969066f73 zlib: Fix extra field processing bug that dereferences NULL state->head.
The recent commit to fix a gzip header extra field processing bug
introduced the new bug fixed here.

(cherry picked from zlib commit 1eb7682f845ac9e9bf9ae35bbfb3bad5dacbd91d)
2022-08-08 14:19:27 -04:00
Mark Adler dc3509f1aa zlib: Fix a bug when getting a gzip header extra field with inflate().
If the extra field was larger than the space the user provided with
inflateGetHeader(), and if multiple calls of inflate() delivered
the extra header data, then there could be a buffer overflow of the
provided space. This commit assures that provided space is not
exceeded.

(cherry picked from zlib commit eff308af425b67093bab25f80f1ae950166bece1)
2022-08-04 22:30:20 -04:00
Mark Johnston 100ddf8922 qat: Move qat_c2xxx firmware files and build glue into separate dirs
Reviewed by:	Zdziarski, KrzysztofX <krzysztofx.zdziarski@intel.com>
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D36032
2022-08-04 09:37:55 -04:00
Bjoern A. Zeeb 13a7663c52 iwlwifi firmware: update to -73 / newer builds for 9xxx
Update iwlwifi 22000 firmware to -73 and rebuilds for 9000/9260.
Update the driver to accept the newer version.

Firmware was obtained from linux-firmware at
150864a4d73e8c448eb1e2c68e65f07635fe1a66.

Sponsored by:	The FreeBSD Foundation
MFC after:	23 days
2022-07-31 00:41:33 +00:00
Bjoern A. Zeeb 467d3e2e8a LinuxKPI 802.11/iwlwifi/rtw88: update KPI
Upgrade the argument of (*bss_info_changed) mac80211 ops function call
from 32 to 64 bit.
Add an extra argument to ieee80211_beacon_get_template().

Both changes are needed in order to keep other out-of-tree drivers in
synch and to move forward.

The driver changes were extracted from Linux wireless-testing
7b7090b4c6a906cc7c3e2a460335f705b93f4506 and
6e8912a503759bb8f1f01c5b761d0d45815fa6de.

Sponsored by:	The FreBSD Foundation
MFC after:	1 week
2022-07-28 23:39:03 +00:00
Julian Grajkowski 78ee8d1c4c qat: Import a new Intel (R) QAT driver
QAT in-tree driver ported from out-of-tree release available
from 01.org.

The driver exposes complete cryptography and data compression
API in the kernel and integrates with Open Crypto Framework.
Details of supported operations, devices and usage can be found
in man and on 01.org.

Patch co-authored by: Krzysztof Zdziarski <krzysztofx.zdziarski@intel.com>
Patch co-authored by: Michal Jaraczewski <michalx.jaraczewski@intel.com>
Patch co-authored by: Michal Gulbicki <michalx.gulbicki@intel.com>
Patch co-authored by: Julian Grajkowski <julianx.grajkowski@intel.com>
Patch co-authored by: Piotr Kasierski <piotrx.kasierski@intel.com>
Patch co-authored by: Adam Czupryna <adamx.czupryna@intel.com>
Patch co-authored by: Konrad Zelazny <konradx.zelazny@intel.com>
Patch co-authored by: Katarzyna Rucinska <katarzynax.kargol@intel.com>
Patch co-authored by: Lukasz Kolodzinski <lukaszx.kolodzinski@intel.com>
Patch co-authored by: Zbigniew Jedlinski <zbigniewx.jedlinski@intel.com>

Reviewed by:	markj, jhb (OCF integration)
Reviewed by:	debdrup, pauamma (docs)
Sponsored by:	Intel Corporation
Differential Revision: https://reviews.freebsd.org/D34632
2022-07-27 11:12:35 -04:00
Mark Johnston f4f56ff43d qat: Rename to qat_c2xxx and remove support for modern chipsets
A replacement QAT driver will be imported, but this replacement does not
support Atom C2xxx hardware.  So, the existing driver will be kept
around to provide opencrypto offload support for those chipsets.

Reviewed by:	pauamma, emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35817
2022-07-27 11:10:52 -04:00
Alfredo Dal'Ava Junior 56e8444a17 zfs: fixup build on powerpc64le
This complements 0a7fa9d11b removing
a #warning added intentionally, replacing it by a "TODO" comment.

PR:	265003
2022-07-08 18:52:14 -03:00
Piotr Kubaj 0a7fa9d11b zfs: fix powerpc64le build
PR:	265003
Reviewed by: alfredo (on IRC)
2022-07-08 18:10:24 +02:00
Martin Matuska a0b956f5ac zfs: merge openzfs/zfs@cb01da680
Notable upstream pull request merges:
  #12438 Avoid panic with recordsize > 128k, raw sending and no large_blocks
  #13015 Fix dnode byteswapping
  #13256 Add a "zstream decompress" subcommand
  #13555 Scrub mirror children without BPs
  #13576 Several sorted scrub optimizations
  #13579 Fix and disable blocks statistics during scrub
  #13582 Several B-tree optimizations
  #13591 Avoid two 64-bit divisions per scanned block
  #13606 Avoid memory copies during mirror scrub
  #13613 Avoid memory copy when verifying raidz/draid parity

Obtained from:	OpenZFS
OpenZFS commit:	cb01da6805
2022-07-08 00:02:36 +02:00
Bjoern A. Zeeb 17732dd8f0 Revert "rtw88: split driver up into a core and pci part"
After some discussion, for now, simply revert the change to split
the driver up into if_rtw88_core.ko and if_rtw88_pci.ko as we do
not have an if_rtw88.ko anymore.  We do have code trying to
auto-load modules, e.g. ifconfig, based on if_xxx.ko.

We could, based on Makefile magic or further code, generate a
if_rtw88.ko module with proper dependencies and keep this but for
simplicity stay with the one slightly larger module for now.
Should code appear to do this "properly" we can revisit this once
USB support has landed.

Slightly update the module Makefile to keep the separation of files
between core and pci bits visible and maintainable for the future.

This reverts commit 0f7b9777f8.
2022-07-01 13:06:31 +00:00
Martin Matuska 1f1e2261e3 zfs: merge openzfs/zfs@deb121309
Notable upstream pull request merges:
  #12918 Introduce BLAKE3 checksums as an OpenZFS feature
  #13553 Reduce ZIO io_lock contention on sorted scrub
  #13537 Improve sorted scan memory accounting
  #13540 AVL: Remove obsolete branching optimizations
  #13563 FreeBSD: Improve crypto_dispatch() handling

Obtained from:	OpenZFS
OpenZFS commit:	deb1213098
2022-06-23 17:49:33 +02:00
Jung-uk Kim c7f14adfda ACPICA: Revert an upstream patch to appease useless warnings
This patch removes warnings messages like the following added in ACPICA
20220331:

    ACPI Warning: Firmware issue: Excessive sleep time (0xxx ms > 10 ms)
    in ACPI Control Method (20220331/exsystem-347)

Note the original author of this patch wants to back it out:

https://github.com/acpica/acpica/pull/780
2022-06-13 21:40:30 -04:00
Bjoern A. Zeeb 9c951734c2 rtw88: update Realtek's rtw88 driver
Update rtw88 based on wireless-testing at
4e051428044d5c47cd2c81c3b154788efe07ee11 (tag: wt-2022-06-10).

This is in preparation to apply USB changes to work on these and
LinuxKPI for them over the next weeks, as well to debug a
reported issue, and possibly extract and upstream some local fixes.

MFC after:	3 days
2022-06-13 13:57:42 +00:00
Bjoern A. Zeeb 0f7b9777f8 rtw88: split driver up into a core and pci part
Split the driver up into two modules (if_rtw88_pci.ko and rtw88_core.ko).
This is in preparation for the hopefully eventually upcoming USB support
using the same driver core.

Note: this changes the module name to load to if_rtw88_pci.ko instead of
if_rtw88.ko.  If using devmatch(8) everything should stay the same as
the driver name (used for net.wlan.devices) stays rtw88.  If using
kld_list in rc.conf or loader.conf you will need to adjust the name.
Update man page for this.

MFC after:	3 days
2022-06-12 18:35:58 +00:00
Bjoern A. Zeeb 728afa885f rtw88: plug various skb leaks in error cases
Based on manual inspection the skbs are not freed in those unlikely
cases, though all would give an error message so would have gone noticed
if happened.
While here fix a typo in one of these error messages.

MFC after:	3 days
2022-06-05 18:10:24 +00:00
Bjoern A. Zeeb 75c779fb27 iwlwifi: disable more MEI (Management Engine) code
It is unclear why this hasn't bothered anyone in months; I can only assume
optimization levels but it seems there were unresolved symbols in
iwlwifi after d9836fb4b9:
link_elf_obj: symbol iwl_mvm_send_roaming_forbidden_event undefined

Hide more of the currently unsupported (GPL-only) MEI (Management Engine)
code behind #ifdef to avoid this.

Reported by:	dchagin
Tested by:	dchagin
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-06-04 16:24:19 +00:00
Martin Matuska e3aa18ad71 zfs: merge openzfs/zfs@b9d98453f
Notable upstream pull request merges:
  #12321 Fix inflated quiesce time caused by lwb_tx during zil_commit()
  #13244 zstd early abort
  #13360 Verify BPs as part of spa_load_verify_cb()
  #13452 More speculative prefetcher improvements
  #13466 Expose zpool guids through kstats
  #13476 Refactor Log Size Limit
  #13484 FreeBSD: libspl: Add locking around statfs globals
  #13498 Cancel in-progress rebuilds when we finish removal
  #13499 zed: Take no action on scrub/resilver checksum errors
  #13513 Remove wrong assertion in log spacemap

Obtained from:	OpenZFS
OpenZFS commit:	b9d98453f9
2022-06-03 18:17:53 +02:00
Bjoern A. Zeeb 645886d028 iwlwifi: add sysctl to dump PCI IDs/ names / firmware-prefixes
Add a FreeBSD-specifc SYSCTL_PROC to dump the list of
PCI IDs / name / firmware-prefix which can be post-processed
for man pages (iwlwifi.4 and iwlwififw.4) or the wiki.

The output still yields duplicates depending on by what information
you need so one may wants to filter them out (try not to use sort/uniq).

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-06-03 14:50:15 +00:00
Bjoern A. Zeeb 6cf748ad94 LinuxKPI 802.11 / iwlwifi / rtw88 : re-factor ieee802211_sta for MLO
Working on an update for rtw88 baed on wireless-testing I ran into
a build issue with struct ieee802211_sta.  Some fields were factored
out into their own struct apparently preparing for MLO (Multi Link
Operation).

In order to be able to update one driver we have to adjust both
rtw88 and iwlwifi (and the ones still out-of-tree) now.

This is mostly a sed-replace job and no functional changes are
intended.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-05-20 18:45:18 +00:00
Martin Matuska 716fd348e0 zfs: merge openzfs/zfs@c0cf6ed67
Notable upstream pull request merges:
  #10662 zvol_wait: Ignore locked zvols
  #12789 Improve log spacemap load time
  #12812 Improved zpool status output, list all affected datasets
  #13277 FreeBSD: Use NDFREE_PNBUF if available
  #13302 Make zfs_max_recordsize default to 16M
  #13311 Fix error handling in FreeBSD's get/putpages VOPs
  #13345 FreeBSD: Fix translation from ABD to physical pages
  #13373 zfs: holds: dequadratify
  #13375 Corrected edge case in uncompressed ARC->L2ARC handling
  #13388 Improve mg_aliquot math
  #13405 Reduce dbuf_find() lock contention
  #13406 FreeBSD: use zero_region instead of allocating a dedicated page

Obtained from:	OpenZFS
OpenZFS commit:	c0cf6ed679
2022-05-19 00:55:59 +02:00
Bjoern A. Zeeb 88a15f72cf iwlwifi: import two fixes from linux v5.18-rc7
Import two changes from torvalds/linux.git at tag: v5.18-rc7:
b20bdd9cc9740ac1f2138adab25ddd51245c67be
    iwlwifi: mvm: Don't fail if PPAG isn't supported
7635a1ad8d92dcc8247b53f949e37795154b5b6f
    iwlwifi: iwl-dbg: Use del_timer_sync() before freeing

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-05-16 18:07:36 +00:00
Bjoern A. Zeeb 275172b519 iwlwifi: update firmware
Update to the latest iwlwifi firmware based on
 linux-firmware at b19cbdca78ab2adfd210c91be15a22568e8b8cae
 (tag: 20220509)
and update firmware module Makefiles accordingly.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-05-16 16:18:14 +00:00
Bjoern A. Zeeb fac1f59384 iwlwifi: update driver from iwlwifi-next
Import code update from iwlwifi-next
 at e89600ebeeb14d18c0b062837a84196f72542830.

This amongst other things removes the deprecated BCAST_FILTERING option,
which we had disabled before due to firmware issues.
Also prepares us for the next firmware update.

The "enable_ini" module option has become an integer with a
sysctl proc equivalent handler.  Disable the module parameter changing
for the moment until we'll have working LinuxKPI support or implement
it as SYSCTL_PROC in FreeBSD directly.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-05-16 15:54:57 +00:00
John Baldwin c4a6d412c9 vchiq: Remove unused devclass argument to DRIVER_MODULE. 2022-05-10 10:21:39 -07:00
Bjoern A. Zeeb e140d551b7 rtw88: deal with debug messages
The 'failed to write TX skb to HCI' error message is twice in the code.
Print the function name and along with the message and also the reported
error so it can possibly be helpful.

The 'failed to get tx report from firmware' was purposefully changed
away from debugging in the upstream Linux driver in
584dce175f0461d5d9d63952a1e7955678c91086 . Revert that decision and
extend the logging by the actual queue length so we get an idea how
sever the problem is (see PR for a report).

PR: 		248235
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
X-MFC:		only to get the reminder for later
2022-04-27 15:20:34 +00:00
Jung-uk Kim 11d64c1d53 acpica: Drop a local patch in favor of an upstream patch
Use ACPI_ERROR() instead of fprintf().

https://github.com/acpica/acpica/pull/768
2022-04-15 16:29:09 -04:00
John Baldwin 2257e87203 dpaa: Remove unused variables. 2022-04-13 16:08:23 -07:00
John Baldwin 3fbf4ca60b libnv: Mark a variable only used in a custom assertion as unused. 2022-04-13 16:08:19 -07:00
Roger Pau Monné b93f47eaee xen/acpi: upload Cx and Px data to Xen
When FreeBSD is running as dom0 (initial domain) on a Xen system it
has access to the native ACPI tables and is the OSPM. However the
hypervisor is the entity in charge of the CPU idle and frequency
states, and in order to perform this duty it requires information
found the ACPI dynamic tables that can only be parsed by the OSPM.

Introduce a new Xen specific ACPI driver to fetch the Processor
related information and upload it to Xen. Note that this driver needs
to take precedence over the generic ACPI CPU driver when running as
dom0, so downgrade the probe score of the native driver to
BUS_PROBE_DEFAULT in order for the Xen specific driver to use
BUS_PROBE_SPECIFIC.

Tested on an Intel NUC to successfully parse and upload both the Cx and
Px states to Xen.

Sponsored by: Citrix Systems R&D
Reviewed by: jhb kib
Differential revision: https://reviews.freebsd.org/D34841
2022-04-12 10:03:26 +02:00
Bjoern A. Zeeb 3443476ca9 rtw88: downgrade rtw8822c firmware to 9.9.10
Firmware version 9.9.11 added support for hw_scan and is reportedly
causing more problems than 9.9.10 does.  Until we get a chance to
test this out downgrade the firmware in order to help people testing
more.

Sponsored by:	The FreeBSD Foundation
PR:		248235
MFC after:	2 days
X-MFC:		just to get the reminder with the original commit
X-MFC with:	73d4ebea35
2022-04-08 11:14:54 +00:00
John Baldwin 6d0a82ffc7 krping: Remove unused variable. 2022-04-07 17:01:28 -07:00
John Baldwin 3f0871d7fc ngatm: Expand #if 0 to cover all lines involving mlen. 2022-04-07 17:01:26 -07:00
Ed Maste ab5c7dff95 zlib: replace CRLF line endings in zlib.map
MFC after:	3 days
2022-04-04 15:10:03 -04:00
Xin LI 0a21252adf sys/contrib/zlib: Always define Z_U8 and Z_U4
This is a temporary hack for zlib to make sure that the library
still builds when building with Z_SOLO (used in kernel and loader),
as zlib is depending on limits.h which is only available in STDC
case.

PR:		kern/262977
MFC after:	3 days
2022-04-03 14:38:31 -07:00
Jung-uk Kim ab71bbb75a acpica: Import ACPICA 20220331
(cherry picked from commit ca1c95cc69)
2022-03-31 21:59:23 -04:00
Bjoern A. Zeeb 73d4ebea35 rtw88: import firmware for Realtek's rtw88 supported chipsets.
Import the most recent versions of the firmware images for the
rtw88 driver.

This is based on linux-firmware at 681281e49fb6778831370e5d94e6e1d97f0752d6.

The license of the firmware matches the previous rtwnfw(4) firmware
files (modulo a Copyright year) and you can find a copy in
sys/contrib/dev/rtw88fw/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 (imp)
MFC after:	2 weeks
2022-04-01 00:07:24 +00:00
Bjoern A. Zeeb 2774f20680 rtw88: import Realtek's rtw88 driver
Import rtw88 based on wireless-testing at
5d5d68bcff1f7ff27ba0b938a4df5849849b47e3 with adjustments for FreeBSD.

While our version of the driver has knowledge about the incapablity
of DMA above 4GB we do see errors if people have more than that
often already showing when laoding firmware.
The problem for that is currently believed to be outside this driver
so importing it anyway for now.

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 (imp) [1]
MFC after:	2 weeks
2022-04-01 00:07:24 +00:00
Xin LI c61bc1110c MFV 7b495a2a7a (zlib): Correct incorrect inputs provided to the CRC
functions.

MFC after:	3 days
2022-03-31 15:35:58 -07:00
Xin LI cd8822075a MFV c144cc5479: zlib 1.2.12.
MFC after:	3 days
Relnotes:	yes
2022-03-31 07:25:53 -07:00
Mateusz Guzik 40c911e8da zfs: use zero_region instead of allocating a dedicated page 2022-03-29 11:18:55 +00:00
Martin Matuska da5137abdf zfs: merge openzfs/zfs@bc3f12bfa (master) into main
Notable upstream pull request merges:
  #12083 libzfs: FreeBSD doesn't resize partitions for you
  #13106 add physical device size to SIZE column in 'zpool list -v'
  #13158 Allow zfs send to exclude datasets
  #13190 module: zfs: zio_inject: zio_match_handler: don't << -1
  #13219 FreeBSD: add missing replay check to an assert in zfs_xvattr_set
  #13220 module: freebsd: avoid a taking a destroyed lock in zfs_zevent bits
  #13221 Fix ACL checks for NFS kernel server

Obtained from:	OpenZFS
OpenZFS commit:	bc3f12bfac
2022-03-29 12:07:34 +02:00
Mateusz Guzik bb92cd7bcd vfs: NDFREE(&nd, NDF_ONLY_PNBUF) -> NDFREE_PNBUF(&nd) 2022-03-24 10:20:51 +00:00
Mateusz Guzik b3b50e64d7 zfs: add missing replay check to an assert in zfs_xvattr_set 2022-03-15 11:38:58 +00:00
Martin Matuska c03c5b1c80 zfs: merge openzfs/zfs@a86e08941 (master) into main
Notable upstream pull request merges:
  #9078:  log xattr=sa create/remove/update to ZIL
  #11919: Cross-platform xattr user namespace compatibility
  #13014: Report dnodes with faulty bonuslen
  #13016: FreeBSD: Fix zvol_cdev_open locking
  #13019: spl: Don't check FreeBSD rwlocks for double initialization
  #13027: Fix clearing set-uid and set-gid bits on a file when
          replying a write
  #13031: Add enumerated vdev names to 'zpool iostat -v' and
          'zpool list -v'
  #13074: Enable encrypted raw sending to pools with greater ashift
  #13076: Receive checks should allow unencrypted child datasets
  #13098: Avoid dirtying the final TXGs when exporting a pool
  #13172: Fix ENOSPC when unlinking multiple files from full pool

Obtained from:	OpenZFS
OpenZFS commit:	a86e089415
2022-03-08 18:53:02 +01:00
Bjoern A. Zeeb 3d248a914d iwlwifi: adjust the LinuxKPI pci return for now
Rather than having LinuxKPI return BUS_PROBE_DEFAULT, return
"one less" so that on conflict of IDs others would be preferred.

This means that iwm(4) will attach instead of iwlwifi(4) for the
chipsets iwm(4) supports and iwlwifi(4) only for the other--in iwm(4)
unsupported--chipsets.  This is done so that we can enable auto-loading
of drivers but for the upcoming 13.1-Release people with working iwm(4)
will not yet be affected by iwlwifi(4).

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-03-03 23:16:40 +00:00
Xin LI 561524cfb0 Remove prototype of x86emu_init_default.
It's removed in 3219f535d9 (r198251) as part of code refactor.

MFC after:	2 weeks
2022-02-27 15:11:17 -08:00
Marco Devesas Campos 5f702d6d9a vchiq: Add compat string for rpi4
The RPi 4 has a newer vchiq compatible device, add it to the list.

Reviewed by: imp
2022-02-27 09:46:49 -07:00
Bjoern A. Zeeb 062103fc93 iwlwifi: update firmware
Update to the latest firmware based on
linux-firmware at c53073d4e1485ac9f7cb065db466793c495aead7
and update firmware module Makefiles accordingly.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-02-24 21:42:02 +00:00
Bjoern A. Zeeb 51152e5e61 iwlwifi: enhance debug information
Add a string of the debug type to the output of the debug message so it
is easier to search for specific events in a trace with lots of debugging
on.  While here remove superflous ().

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-02-24 21:42:01 +00:00
Bjoern A. Zeeb d9836fb4b9 iwlwifi: update from iwlwifi-next
Import new code from iwlwifi-next at cb0a1fb7fd86b0062692b5056ca8552906509512
(matching tag: iwlwifi-next-for-kalle-2022-02-18).

Also add files not previously imported because we are not yet compiling
them to ease updating and having them when needed.

This adds MEI (Management Engine) support upstream which we cannot import
(currently GPL-only) so we have stub functions for the missing bits.

This also reduces the diff to upstream.  Changes submitted to avoid
problems with const and  with void * arithmetics were merged.

In the module build Makefile disable CONFIG_IWLWIFI_OPMODE_MODULAR
as we are building iwlwifi as a single module.

Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
2022-02-24 21:42:01 +00:00
Bjoern A. Zeeb 9ad210c159 iwlwifi: fix the build
Pull in a case statement from the upcoming iwlwifi update to
unbreak the build after d875aa1587 .

Reported by:	cy
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
X-MFC with:	d875aa1587
2022-02-23 01:09:26 +00:00
Roger Pau Monné 3a9fd8242b xen: import Xen 4.16 public headers in sys/contrib/
The current path of the Xen headers at /sys/xen/interface/ is not
correct, as those headers are imported verbatim from the Xen sources
and shouldn't be modified, as any modifications would be lost when a
new version is imported.

Changes to the public headers must be first done in Xen upstream so
that they can be backported and new imports will already carry them.

Import Xen 4.16 headers in sys/contrib/xen/. It's unlikely that we
will import different Xen code, so don't place them inside of any
subdirectory. If in the future other pieces of Xen code need to be
imported the headers will need to move into an include/ subdirectory.

Note that this commit does not yet modify the include path to use the
newly imported headers.

Sponsored by: Citrix Systems R&D
2022-02-07 10:11:56 +01:00
Ryan Moeller 47e46b1123 zfs: Fix zvol_cdev_open locking
First open locking changes were correctly applied to zvol_geom_open but
incorrectly applied to zvol_cdev_open, causing spa_namespace_lock to be
held indefinitely.

Make the first open locking in zvol_cdev_open match zvol_geom_open.

This change has been accepted upstream in openzfs/zfs#13016 but is not
yet merged.

Reviewed by:	mav
Fixes:		e92ffd9b62
Sponsored by:	iXsystems, Inc.
2022-01-26 18:37:52 +00:00
Eric Joyner e438f0a975
ice_ddp: Update to 1.3.27.0
This is intended to be used with forthcoming ice(4) driver version 1.34.2.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>

Sponsored by:	Intel Corporation
2022-01-24 18:25:56 -08:00
Marcin Wojtas eb4c4f4a2e ena: merge ena-com v2.5.0 upgrade
Merge commit '2530eb1fa01bf28fbcfcdda58bd41e055dcb2e4a'

Adjust the driver to the upgraded ena-com part twofold:

First update is related to the driver's NUMA awareness.

Allocate I/O queue memory in NUMA domain local to the CPU bound to the
given queue, improving data access time. Since this can result in
performance hit for unaware users, this is done only when RSS
option is enabled, for other cases the driver relies on kernel to
allocate memory by itself.

Information about first CPU bound is saved in adapter structure, so
the binding persists after bringing the interface down and up again.

If there are more buckets than interface queues, the driver will try to
bind different interfaces to different CPUs using round-robin algorithm
(but it will not bind queues to CPUs which do not have any RSS buckets
associated with them). This is done to better utilize hardware
resources by spreading the load.

Add (read-only) per-queue sysctls in order to provide the following
information:
- queueN.domain: NUMA domain associated with the queue
- queueN.cpu:    CPU affinity of the queue

The second change is for the CSUM_OFFLOAD constant, as ENA platform
file has removed its definition. To align to that change, it has been
added to the ena_datapath.h file.

Submitted by: Artur Rojek <ar@semihalf.com>
Submitted by: Dawid Gorecki <dgr@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.
2022-01-23 20:27:13 +01:00
Martin Matuska e92ffd9b62 zfs: merge openzfs/zfs@17b2ae0b2 (master) into main
Notable upstream pull request merges:
  #12766 Fix error propagation from lzc_send_redacted
  #12805 Updated the lz4 decompressor
  #12851 FreeBSD: Provide correct file generation number
  #12857 Verify dRAID empty sectors
  #12874 FreeBSD: Update argument types for VOP_READDIR
  #12896 Reduce number of arc_prune threads
  #12934 FreeBSD: Fix zvol_*_open() locking
  #12947 lz4: Cherrypick fix for CVE-2021-3520
  #12961 FreeBSD: Fix leaked strings in libspl mnttab
  #12964 Fix handling of errors from dmu_write_uio_dbuf() on FreeBSD
  #12981 Introduce a flag to skip comparing the local mac when raw sending
  #12985 Avoid memory allocations in the ARC eviction thread

Obtained from:	OpenZFS
OpenZFS commit:	17b2ae0b24
2022-01-22 23:05:15 +01:00
Cy Schubert 64e33c5cb1 Revert "wpa: Import wpa 2.10."
This reverts commit 5eb81a4b40, reversing
changes made to c6806434e7 and
this reverts commit 679ff61123.

What happend is git rebase --rebase-merges doesn't do what is expected.
2022-01-18 08:10:33 -08:00
Cy Schubert 5eb81a4b40 wpa: Import wpa 2.10.
The long awaited hostapd 2.10 is finally here.

MFC after:	3 weeks
2022-01-18 07:45:39 -08:00
Bjoern A. Zeeb e200809190 LinuxKPI / iwlwifi: fix spelling of constants
Fix the spelling of IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_*
(was "NOMIMAL").  The original version came from iwlwifi
in iwlwifi-next.  Other drivers (from wireless-testing) already
use the correct spelling and need this change in LinuxKPI.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2022-01-09 02:21:05 +00:00
Bjoern A. Zeeb 58101517cb iwlwifi: import correct firmware versions for select Intel iwlwifi/mvm
The firmware files for 3160, 7260, and 7265 imported contain old versions
no longer supported by the driver.
Replace with latest versions from linux-firmware to possibly also
support these chip revisions.

Reported by:	FreeBSD User (freebsd walstatt-de.de) on wireless (2021-12-30)
Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2021-12-31 11:51:18 +00:00
Warner Losh 373d5df3e3 remove octeon sdk
Octeon is a mips-only target.

Sponsored by:		Netflix
2021-12-31 00:28:12 -07:00
Bjoern A. Zeeb 586c8e3233 iwlwifi: plug memory modified after free
In certain situations we saw a memory modified after free.  This was
tracked down to a pointer not NULLed after free and used in a different
code path.  It is unclear how the race happens pending further
investigation but setting the pointer to NULL after free and adding a
check in the 2nd code path handling the case gracefully helps for now.

While here improve another debug messge in sta handling.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2021-12-27 18:47:26 +00:00
Bjoern A. Zeeb 8f06a2b550 iwlwifi: cherry-pick fixes from upstream iwlwifi-next
Cherry-pick f973795a8d19cbf3d03807704eb7c6ff65788d5a (Fix a double free
in iwl_txq_dyn_alloc_dma), db66abeea3aefed481391ecc564fb7b7fb31d742
(synchronize with FW after multicast commands),
d5d8ee526d1401173ad1261c3b6388a4f947e0a3 (remove session protection
upon station removal), and 8e967c137df3b236d2075f9538cb888129425d1a
(avoid clearing a just saved session protection id).

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2021-12-27 18:47:26 +00:00
Bjoern A. Zeeb 81ff67ffbe iwlwifi: also depend on linuxkpi_wlan
The 802.11 compat code is split off linuxkpi.ko into linuxkpi_wlan.ko
in case it is built as a module.  Depend on that.
While here adjust our module to a longer version to avoid conflicts.

Sponsored by:	The FreeBSD Foundation
MFC after:	3 days
2021-12-27 18:47:25 +00:00
Cy Schubert 3b9b51fe46 ipfilter: Move kernel bits to netpfil
Through fixes and improvements our ipfilter sources have diverged
enough to warrant move from contrib into sys/netpil. Now that I'm
planning on implementing MSS clamping as in iptables it makes more
sense to move ipfilter to netpfil.

This is the first of three commits the ipfilter move.

Suggested by glebius on two occaions.

Suggested by and discussed with:	glebius
Reviewed by:				glebius, kp (for #network)
MFC after:				1 month
Differential Revision:		https://reviews.freebsd.org/D33510
2021-12-20 06:16:33 -08:00
Martin Matuska 681ce946f3 zfs: merge openzfs/zfs@f291fa658 (master) into main
Notable upstream pull request merges:
  #11711 Vdev Properties Feature
  #12717 VOP_RENAME fixes for FreeBSD
  #12746 Enable strict hole reporting by default
  #12770 ZFS send/recv with ashift 9->12 leads to data corruption
  #12828 FreeBSD: Add vop_standard_writecount_nomsyn
  #12828 zfs: Fix a deadlock between page busy and the teardown lock
  #12828 FreeBSD: Catch up with more VFS changes

Obtained from:	OpenZFS
OpenZFS commit:	f291fa658e
2021-12-16 14:38:34 +01:00
Alan Somers b214fcceac Change VOP_READDIR's cookies argument to a **uint64_t
The cookies argument is only used by the NFS server.  NFSv2 defines the
cookie as 32 bits on the wire, but NFSv3 increased it to 64 bits.  Our
VOP_READDIR, however, has always defined it as u_long, which is 32 bits
on some architectures.  Change it to 64 bits on all architectures.  This
doesn't matter for any in-tree file systems, but it matters for some
FUSE file systems that use 64-bit directory cookies.

PR:             260375
Reviewed by:    rmacklem
Differential Revision: https://reviews.freebsd.org/D33404
2021-12-15 20:54:57 -07:00
Cy Schubert 7835925aa4 ipfilter fil.c: Fix two typos in comments
MFC after:	3 days
2021-12-15 08:09:39 -08:00
Cy Schubert 8f945ad25f ipfilter: Replace sprintf with range checking version (snprintf)
MFC after:	1 week
2021-12-14 06:19:20 -08:00
Cy Schubert e263821fea ipfilter radix_ipf: name is only valid with RDX_DEBUG
ipf_rdx_node.name is only vaild when RDX_DEBUG is defined.

MFC after:	1 week
2021-12-14 06:19:20 -08:00
Cy Schubert 8d2a8d243e ipfilter: The SNPRINTF macro doesn't exist, remove it
MFC after:	1 week
2021-12-14 06:19:20 -08:00
Cy Schubert 8f19f3d31a ipfilter: Fix struct ifnet pointer type
The fr_info struct contains a summary of a packet. One of its fields
is a pointer to the ifnet struct the packet arrived on. It is pointed
to by a void* because ipfilter supports multiple O/Ses. Unfortunately
this makes it difficult it examine with DTrace. Defining fin_ifp as a
pointer to an ifnet struct makes the struct it points to using a DTrace
script possible.

MFC after:	1 week
2021-12-13 06:24:50 -08:00
Cy Schubert 664882ab16 ip_log: remove set-but-not-unused vars
MFC after:	3 days
2021-12-10 21:52:54 -08:00
Bjoern A. Zeeb df38ada293 modules: increase MAXMODNAME and provide backward compat
With various firmware files used by graphics and wireless drivers
we are exceeding the current 32 character module name (file path
in kldxref) length.
In order to overcome this issue bump it to the maximum path length
for the next version.
To be able to MFC provide backward compat support for another version
of the struct as the offsets for the second half change due to the
array size increase.

MAXMODNAME being defined to MAXPATHLEN needs param.h to be
included first.  With only 7 modules (or LinuxKPI module.h) not
doing that adjust them rather than including param.h in module.h [1].

Reported by:	Greg V (greg unrelenting.technology)
Sponsored by:	The FreeBSD Foundation
Suggested by:	imp [1]
MFC after:	10 days
Reviewed by:	imp (and others to different level)
Differential Revision:	https://reviews.freebsd.org/D32383
2021-12-09 18:09:53 +00:00
Jessica Clarke 6010a892b4 zlib: Fix bootstrap build on macOS
gzlib.c uses lseek but does not include unistd.h, where it is defined to
live. On FreeBSD this happens to work due to sys/types.h declaring it,
but on macOS it fails due to being only implicitly declared, which is
treated as an error by default by the system Clang.

MFC after:	1 week
2021-12-07 00:24:19 +00:00
Robert Wing 5916ae1fb1 libnv: read entire datagram in nvlist_recv()
When SOCK_DGRAM is used, a portion of the datagram is discarded during
the initial recv() when getting the nvlist_header.

To workaround this, use MSG_PEEK for the initial recv() when using a
datagram socket.

Add tests for SOCK_DGRAM with nvlist_send()/nvlist_recv().

Differential Revision:	https://reviews.freebsd.org/D32722
2021-12-06 09:54:55 -09:00
Robert Wing db158b9942 libnv: let nvlist_recv() pass flags to recv()
Differential Revision:	https://reviews.freebsd.org/D32721
2021-12-06 09:54:55 -09:00
Cy Schubert 130df64793 ipfilter: Avoid more null if-then-else blocks
As in 73db3b64f1, when WITHOUT_INET6 is selected, null if-then-else
blocks are generated because #if statements are incorrectly placed.
Moving the #if statements reduces unnecessary runtime comparisons or
compiler optimizations.

MFC after:	3 days
2021-12-04 06:33:13 -08:00
Cy Schubert 1ca73c39a5 ipfilter: Correct a comment and add notation
Correct a comment to accurately reflect what is being done. While
we're at it document the next step in the process.

MFC after:	3 days
2021-12-04 06:33:13 -08:00
Cy Schubert 06b96a4bd6 ipfilter: Correct function description
As of 874b1a3548, ip_proxy_check() return codes have been simplified.
The original comment was also incorrect in the first place.

MFC after:	3 days
2021-12-04 06:33:13 -08:00
Cy Schubert 106f42596e ipfilter: Add DTrace SDT probe
Add an SDT probe, using the newly created DT5 macro, in similar vein
to DEBUG_PARSE printf for when FTP junk is anticipated and ok. This
will assist in debugging port (active) FTP proxy issues.

MFC after:	3 days
2021-12-04 06:33:12 -08:00
Cy Schubert ca8bf28e1e ipfilter: New DT5 DTrace macro
Define a new DT5 DTrace macro used to call DTRACE_PROBE5, for use with
SDT probes with five arguments.

MFC after:	3 days
2021-12-04 06:33:12 -08:00
Cy Schubert fca9c3871d ipfilter: Whitespace cleanup
Clean up whitespace from compaction of DTn macro definitions.

MFC after:	3 days
2021-12-04 06:33:12 -08:00
Cy Schubert 2d74fed5be ipfilter: Compat and simplify DTrace macro definitions
Use a compound #if to simplify and compact DTn DTRACE_PROBEn macros
used by ipfilter.

MFC after:	3 days
2021-12-04 06:33:12 -08:00
Cy Schubert b7f127b6e5 ipfilter: Save a word of stack space
Rather than save the return code into an intermediate variable, which BTW
is optimized out anyway, explicitly remove the return code from the stack.

MFC after:	3 days
2021-12-04 06:33:12 -08:00
Bjoern A. Zeeb bfcc09ddd4 iwlwifi: import Intel's iwlwifi/mvm driver.
Over the past few months we published multiple snapshots for this
Linux derived driver and it has become fairly stable in terms of
minimal local changes needed for new updates.

The current version is based on iwlwifi-next update at
cbaa6aeedee5f92dafa5982eceea2a1f98ce4f7d with the addition of
a hand full of files replaced for FreeBSD.

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

Do not yet hook this to the build until the remaining compat code
is all in.  Along with the firmware import this will make publishing
the last bits and final testing a lot easier.

Sponsored by:   The FreeBSD Foundation
Approved by:    core (imp) [1]
MFC after:      10 days
2021-11-28 19:17:04 +00:00
Bjoern A. Zeeb f4c129f5fb iwlwifi: import firmware for Intel iwlwifi/mvm supported chipsets.
Import the most recent versions of the firmware images for iwlwifi
chipsets supported by the "mvm" sub-driver.
This is based on linux-firmware at f5d519563ac9d2d1f382a817aae5ec5473811ac8.
The license of the firmware matches the previous iwnfw(4) and
iwmfw(4) firmware files and you can find a copy in
sys/contrib/dev/iwlwififw/LICENCE.iwlwifi_firmware .

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.
There is an open issue concerning kldxref that we need to resolve
(D32383).

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
2021-11-28 19:17:03 +00:00
Mateusz Guzik 3ffcfa599e vfs: add vop_stdadd_writecount_nomsync
This avoids needing to inspect the mount point every time.

Reviewed by:	kib (previous version)
Differential Revision:	https://reviews.freebsd.org/D33125
2021-11-26 12:06:08 +00:00
Mateusz Guzik 7e1d3eefd4 vfs: remove the unused thread argument from NDINIT*
See b4a58fbf64 ("vfs: remove cn_thread")

Bump __FreeBSD_version to 1400043.
2021-11-25 22:50:42 +00:00
Mark Johnston 705a6ee2b6 zfs: Fix a deadlock between page busy and the teardown lock
When rolling back a dataset, ZFS has to purge file data resident in the
system page cache.  To do this, it loops over all vnodes for the
mountpoint and calls vn_pages_remove() to purge pages associated with
the vnode's VM object.  Each page is thus exclusively busied while the
dataset's teardown write lock is held.

When handling a page fault on a mapped ZFS file, FreeBSD's page fault
handler busies newly allocated pages and then uses VOP_GETPAGES to fill
them.  The ZFS getpages VOP acquires the teardown read lock with vnode
pages already busied.  This represents a lock order reversal which can
lead to deadlock.

To break the deadlock, observe that zfs_rezget() need only purge those
pages marked valid, and that pages busied by the page fault handler are,
by definition, invalid.  Furthermore, ZFS pages always transition from
invalid to valid with the teardown lock held, and ZFS never creates
partially valid pages.  Thus, zfs_rezget() can use the new
vn_pages_remove_valid() to skip over pages busied by the fault handler.

PR:		258208
Tested by:	pho
Reviewed by:	avg, sef, kib
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D32931
2021-11-20 11:21:25 -05:00
Martin Matuska dae1713419 zfs: merge openzfs/zfs@269b5dadc (master) into main
Notable upstream pull request merges:
  #12285 Introduce a tunable to exclude special class buffers from L2ARC
  #12689 Check l2cache vdevs pending list inside the vdev_inuse()
  #12735 Enable edonr in FreeBSD
  #12743 FreeBSD: fix world build after de198f2
  #12745 Restore dirty dnode detection logic

Obtained from:	OpenZFS
OpenZFS commit:	269b5dadcf
2021-11-17 09:39:40 +01:00
Martin Matuska 81b22a9892 zfs: merge openzfs/zfs@6c8f03232 (master) into main
Notable upstream pull request merges:
  #12333: Creating gang ABDs for Raidz optional IOs
  #12668: FreeBSD: Catch up with recent VFS changes
  #12687: Skip spacemaps reading in case of pool readonly import
  #12704: Fix some FreeBSD VOPs to synchronize properly with teardown
  #12724: Fix lseek(SEEK_DATA/SEEK_HOLE) mmap consistency

Obtained from:	OpenZFS
OpenZFS commit:	6c8f03232a
2021-11-10 14:22:37 +01:00
Mike Karels 20d5940396 kernel: deprecate Internet Class A/B/C
Hide historical Class A/B/C macros unless IN_HISTORICAL_NETS is defined;
define it for user level.  Define IN_MULTICAST separately from IN_CLASSD,
and use it in pf instead of IN_CLASSD.  Stop using class for setting
default masks when not specified; instead, define new default mask
(24 bits).  Warn when an Internet address is set without a mask.

MFC after:	1 month
Reviewed by:	cy
Differential Revision: https://reviews.freebsd.org/D32708
2021-11-09 09:32:38 -06:00
Olivier Houchard 74e9b5f29a Merge commit 'ce929fe84f9c453263af379f3b255ff8eca01d48'
Import CK as of commit 2265c7846f4ce667f5216456afe2779b23c3e5f7.
2021-10-29 19:18:03 +02:00
Mark Johnston 70f51f0e47 Revert "Handle partial reads in zfs_read"
This reverts commit 59eab1093a.

The change suppressed EFAULT originating from uiomove().  The deadlock
avoidance mechanism implemented by vn_io_fault1() in the VFS handles
such errors by wiring the user pages and retrying, but this change
caused read() to return early instead.  This can result in short I/O,
causing misbehaviour in some applications, and possibly other
consequences.

Until this is resolved somehow, revert the commit.

Approved by:	mm
2021-10-22 15:16:42 -04:00
Martin Matuska 6ba2210ee0 zfs: merge openzfs/zfs@ec64fdb93 (master) into main
Notable upstream pull request merges:
  #12392 Avoid panic in case of pool errors and missing L2ARC
  #12448 skip snapshot in zfs_iter_mounted()
  #12516 Fix NFS and large reads on older kernels
  #12533 Fail invalid incremental recursive send gracefully
  #12569 FreeBSD: Really zero the zero page
  #12575 Reject zfs send -RI with nonexistent fromsnap
  #12602 Correct refcount_add in dmu_zfetch
  #12650 zpool should call zfs_nicestrtonum() with non-NULL handle

Obtained from:	OpenZFS
OpenZFS commit:	ec64fdb93d
2021-10-21 15:06:06 +02:00
Mateusz Guzik 2b68eb8e1d vfs: remove thread argument from VOP_STAT
and fo_stat.
2021-10-11 13:22:32 +00:00
Mateusz Guzik b4a58fbf64 vfs: remove cn_thread
It is always curthread.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D32453
2021-10-11 13:21:47 +00:00
Jung-uk Kim 1b7a2680fb Import ACPICA 20210930
(cherry picked from commit c509b6ab0d)
2021-09-30 22:05:52 -04:00
Cy Schubert 4a7b49a0da ipfilter: Save time and cycles swapping bucket table sizes
NAT hash tables are inverted for inbound vs outbound. Rather than spend
the time and cycles swapping them, let's simply calculate the bucket
lengths inversely.

MFC after:	1 week
2021-09-29 17:44:02 -07:00
Cy Schubert aa6cfcc820 ipfilter: Correct a comment
Correct a comment's grammar and while at it clarify its meaining.

MFC after:	3 days
2021-09-27 11:13:50 -07:00
Cy Schubert df38343e71 ipfilter: Print the correct TCP sequence index number
TCP sequence numbers in the FTP proxy are maintained in a two dimensional
array. The debug message prints the same seq[N] for both. Fix that.

MFC after:	3 days
2021-09-27 11:13:50 -07:00
Cy Schubert 1605eaa6d2 ipfilter: Locking sysctls here is not required
Locking of data structures touched by sysctls is more finely locked
in ipflter therefore higher level locks are redundant.

MFC after:	3 days
2021-09-24 11:41:02 -07:00
Cy Schubert 73db3b64f1 ipfilter: Avoid a null if-then-else blocks
When WITHOUT_INET6 is selected we generate a null if-then-else blocks
due to incorrect placment of #if statments. Move the #if statements
reducing unnecessary runtime comparisons WITHOUT_INET6.

MFC after:	1 week
2021-09-24 11:41:02 -07:00
Konstantin Belousov cf0ee8738e Drop cloudabi
According to https://github.com/NuxiNL/cloudlibc:
CloudABI is no longer being maintained. It was an awesome experiment,
but it never got enough traction to be sustainable.

There is no reason to keep it in FreeBSD.

Approved by:	ed (private mail)
Reviewed by:	emaste
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D31923
2021-09-22 00:18:44 +03:00
Martin Matuska 53b70c86d9 zfs: merge openzfs/zfs@4a1195ca5 (master) into main
Notable upstream pull request merges:
  #11312 Temporarily use root credentials to mount snapshots in .zfs
  #12246 arc: Drop an incorrect assert
  #12443 Fixed data integrity issue when underlying disk returns error
         to zfs
  #12522 Compressed receive with different ashift can result in incorrect
         PSIZE on disk
  #12535 Verify embedded blkptr's in arc_read()
  #12541 Allow sending corrupt snapshots even if metadata is corrupted

Obtained from:	OpenZFS
OpenZFS commit:	4a1195ca50
2021-09-15 17:30:53 +02:00
Stefan Grundmann e673ac3ffb libnv: Fix array unpack endianness logic
When a nvlist(9) is converted into a binary buffer by nvlist_pack(9),
the host endianness is encoded in the nvlist_header of the binary
buffer. The nvlist_unpack(9) function converts a given binary buffer
to an nvlist. In the conversion process the endianness encoded in the
nvlist_header is evaluated and -- should the encoded endianness differ
from the endianess of the decoding host -- endianness conversion is
applied to nvlist_header and nvpair_header elements as well as
to some nvpair values.

In 2015 @oshogbo extended libnv with array support (in 347a39b).
The unpacking code misses the possible need to convert the endianness
of the nvph_nitems element of nvpair_headers.

The patch (re)enables libnv to unpack nvlists regardless of the
endianness of the packing host.

Pull Request:	https://github.com/freebsd/freebsd-src/pull/528
2021-09-13 21:21:14 +02:00
Martin Matuska 21b492ed51 zfs: merge openzfs/zfs@3b89d9518 (master) into main
Notable upstream pull request merges:
  #12022 Fix endianness issues with zstd
  #12319 Extend zpool-iostat to account for ZIO_PRIORITY_REBUILD
  #12458 Add hole punching support on FreeBSD version 1400032
  #12473 Initialize parity blocks before RAID-Z reconstruction benchmarking
  #12511 Make 'zpool labelclear -f' work on offlined disks
  #12514 FreeBSD: Don't remove SA xattr if not SA znode

Obtained from:	OpenZFS
OpenZFS commit:	3b89d9518d
2021-08-31 09:02:21 +02:00
Dimitry Andric 130a690ae1 Fix acpica macros that subtract null pointers
Clang 13.0.0 produces a new -Werror warning about the ACPI_TO_INTEGER(p)
and ACPI_OFFSET(d, f) macros in acpica's actypes.h:

    sys/contrib/dev/acpica/components/dispatcher/dsopcode.c:708:31: error: performing pointer subtraction with a null pointer has undefined behavior [-Werror,-Wnull-pointer-subtraction]
        ObjDesc->Region.Address = ACPI_PTR_TO_PHYSADDR (Table);
                                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
    sys/contrib/dev/acpica/include/actypes.h:664:41: note: expanded from macro 'ACPI_PTR_TO_PHYSADDR'
    #define ACPI_PTR_TO_PHYSADDR(i)         ACPI_TO_INTEGER(i)
                                            ^~~~~~~~~~~~~~~~~~
    sys/contrib/dev/acpica/include/actypes.h:661:41: note: expanded from macro 'ACPI_TO_INTEGER'
    #define ACPI_TO_INTEGER(p)              ACPI_PTR_DIFF (p, (void *) 0)
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    sys/contrib/dev/acpica/include/actypes.h:656:82: note: expanded from macro 'ACPI_PTR_DIFF'
    #define ACPI_PTR_DIFF(a, b)             ((ACPI_SIZE) (ACPI_CAST_PTR (UINT8, (a)) - ACPI_CAST_PTR (UINT8, (b))))
                                                                                     ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.

This problem of undefined behavior was also reported to acpica by @cem
in 2018: https://github.com/acpica/acpica/issues/407, but it seems there
was never any fix committed for it upstream.

Instead fix these locally, for ACPI_TO_INTEGER by simply casting the
incoming pointer to ACPI_SIZE (which corresponds roughly to uintptr_t
and size_t), and for ACPI_OFFSET by reusing our __offsetof definition
from sys/cdefs.h.

Reviewed by:	emaste, kib, imp
MFC after:	3 days
Differential Revision: https://reviews.freebsd.org/D31710
2021-08-30 21:34:34 +02:00
Ed Maste 0637070b5b ngatm: remove one of doubled semicolons
Discussed with:	harti
2021-08-30 11:39:30 -04:00
Zhenlei Huang 62e1a437f3 routing: Allow using IPv6 next-hops for IPv4 routes (RFC 5549).
Implement kernel support for RFC 5549/8950.

* Relax control plane restrictions and allow specifying IPv6 gateways
 for IPv4 routes. This behavior is controlled by the
 net.route.rib_route_ipv6_nexthop sysctl (on by default).

* Always pass final destination in ro->ro_dst in ip_forward().

* Use ro->ro_dst to exract packet family inside if_output() routines.
 Consistently use RO_GET_FAMILY() macro to handle ro=NULL case.

* Pass extracted family to nd6_resolve() to get the LLE with proper encap.
 It leverages recent lltable changes committed in c541bd368f.

Presence of the functionality can be checked using ipv4_rfc5549_support feature(3).
Example usage:
  route add -net 192.0.0.0/24 -inet6 fe80::5054:ff:fe14:e319%vtnet0

Differential Revision: https://reviews.freebsd.org/D30398
MFC after:	2 weeks
2021-08-22 22:56:08 +00:00
Alexander V. Chernikov 36e15b717e routing: Fix crashes with dpdk_lpm[46] algo.
When a prefix gets deleted from the RIB, dpdk_lpm algo needs to know
 the nexthop of the "parent" prefix to update its internal state.
The glue code, which utilises RIB as a backing route store, uses
 fib[46]_lookup_rt() for the prefix destination after its deletion
 to fetch the desired nexthop.
This approach does not work when deleting less-specific prefixes
 with most-specific ones are still present. For example, if
 10.0.0.0/24, 10.0.0.0/23 and 10.0.0.0/22 exist in RIB, deleting
 10.0.0.0/23 would result in 10.0.0.0/24 being returned as a search
 result instead of 10.0.0.0/22. This, in turn, results in the failed
 datastructure update: part of the deleted /23 prefix will still
 contain the reference to an old nexthop. This leads to the
 use-after-free behaviour, ending with the eventual crashes.

Fix the logic flaw by properly fetching the prefix "parent" via
 newly-created rt_get_inet[6]_parent() helpers.

Differential Revision: https://reviews.freebsd.org/D31546
PR:	256882,256833
MFC after:	1 week
2021-08-17 20:46:22 +00:00
Martin Matuska 2faf504d1a zfs: merge openzfs/zfs@8ae86e2ed (master) into main
Notable upstream pull request merges:
  #12422 Fix/improve dbuf hits accounting
  #12406 Increase default volblocksize from 8KB to 16KB
  #12398 Remove b_pabd/b_rabd allocation from arc_hdr_alloc()
  #12397 Run arc_evict thread at higher priority
  #12297 Avoid vq_lock drop in vdev_queue_aggregate()
  #12161 Restore FreeBSD sysctl processing for arc.min and arc.max

Obtained from:	OpenZFS
OpenZFS commit:	8ae86e2edc
2021-08-17 21:10:44 +02:00
Ed Maste 8fa63f44e6 ipfilter: remove doubled semicolons
Local commit; ipfilter upstream is inactive.

Discussed with:	cy
MFC after:	3 days
2021-08-16 13:16:42 -04:00
Mark Johnston d75884df78 ck: Correct asm output operand widths in amd64 pointer intrinsics
This does not appear to change generated code with the default
toolchain.  However, KMSAN makes use of output operand specifications to
instrument inline asm, and with incorrect specifications we get false
positives in code that uses the CK_(S)LIST macros.

This was submitted upstream:
https://github.com/concurrencykit/ck/pull/175

The commit applies the same change locally to make KMSAN usable until
something equivalent is merged upstream.

MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2021-08-10 21:27:54 -04:00
Ed Maste 9feff969a0 Remove "All Rights Reserved" from FreeBSD Foundation sys/ copyrights
These ones were unambiguous cases where the Foundation was the only
listed copyright holder (in the associated license block).

Sponsored by:	The FreeBSD Foundation
2021-08-08 10:42:24 -04:00
Martin Matuska 1f88aa0941 zfs: merge openzfs/zfs@f3678d70f (master) into main
Notable upstream pull request merges:
  #12339 Read past end of argv array in zpool_do_import()
  #12365 Fixes in persistent L2ARC
  #12383 Fixes for KMSAN reports
  #12425 Avoid small buffer copying on write
  #12428 Fix unfortunate NULL in spa_update_dspace
  #12446 Allow disabling of unmapped I/O on FreeBSD

Obtained from:	OpenZFS
OpenZFS commit:	f3678d70ff
2021-08-08 04:01:26 +02:00
Jung-uk Kim 97c0b5ab18 acpica: Import ACPICA 20210730
(cherry picked from commit 34cfdff1f3)
2021-07-31 00:16:27 -04:00
John Baldwin 8843787aa1 ena: Remove redundant declaration of ena_log_level.
GCC6 raises a -Wredundant-decl error due to duplicate declarations
in ena_fbsd_log.h and ena_plat.h.

Sponsored by:	Chelsio Communications
2021-07-23 16:07:35 -07:00
Martin Matuska 3f9d360c82 zfs: merge openzfs/zfs@14b43fbd9 (master) into main
Notable upstream pull request merges:
  #12271 Tinker with slop space accounting with dedup
  #12279 Fix ARC ghost states eviction accounting
  #12284 Add Module Parameter Regarding Log Size Limit
  #12300 Introduce dsl_dir_diduse_transfer_space()
  #12314 Optimize allocation throttling
  #12348 Minor ARC optimizations
  #12350 Detect HAVE_LARGE_STACKS at compile time
  #12356 Use SET_ERROR for more errors in FreeBSD vnops
  #12375 FreeBSD: Ignore make_dev_s() errors
  #12378 FreeBSD: Switch from MAXPHYS to maxphys on FreeBSD 13+

Obtained from:	OpenZFS
OpenZFS commit:	14b43fbd9c
2021-07-23 02:50:13 +02:00
Ed Maste 79e6eb5c01 zfs: Remove zfs-images submodule
This can cause issues like 'No url found for submodule path' in
downstream or derived projects making use of submodules.

Reviewed by:	imp
2021-07-19 16:40:09 -04:00
Konstantin Belousov dbaad75f28 zfs: add missed dependency of zfs module on zlib
Reviewed by:	mm
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D31207
2021-07-18 01:44:22 +03:00
Martin Matuska 5eb61f6c65 zfs: merge openzfs/zfs@07a4c76e9 (master) into main
Notable upstream pull request merges:
  #12299 file reference counts can get corrupted
  #12320 FreeBSD: Use unmapped I/O for scattered/gang ABD buffers

Obtained from:	OpenZFS
OpenZFS commit:	07a4c76e90
2021-07-12 23:24:45 +02:00
Hans Petter Selasky c3987b8ea7 ibcore: Declare ib_post_send() and ib_post_recv() arguments const
Since neither ib_post_send() nor ib_post_recv() modify the data structure
their second argument points at, declare that argument const. This change
makes it necessary to declare the 'bad_wr' argument const too and also to
modify all ULPs that call ib_post_send(), ib_post_recv() or
ib_post_srq_recv(). This patch does not change any functionality but makes
it possible for the compiler to verify whether the
ib_post_(send|recv|srq_recv) really do not modify the posted work request.

Linux commit:
f696bf6d64b195b83ca1bdb7cd33c999c9dcf514
7bb1fafc2f163ad03a2007295bb2f57cfdbfb630
d34ac5cd3a73aacd11009c4fc3ba15d7ea62c411

MFC after:	1 week
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-07-12 14:22:33 +02:00
Martin Matuska 7cd22ac434 zfs: merge openzfs/zfs@bdd11cbb9 (master) into main
Notable upstream pull request merges:
  #12274 Optimize txg_kick() process
  #12281 Move gethrtime() calls out of vdev queue lock
  #12287 Remove refcount from spa_config_*(
  #12289 Compact dbuf/buf hashes and lock arrays
  #12290 Remove avl_size field from struct avl_tree
  #12294 Upstream: dmu_zfetch_stream_fini leaks refcount
  #12295 Fix abd leak, kmem_free correct size of abd_t
  #12328 FreeBSD: Hardcode abd_chunk_size to PAGE_SIZE

Obtained from:	OpenZFS
OpenZFS commit:	bdd11cbb90
2021-07-07 23:31:52 +02:00
Kornel Duleba ddb928096b dts: fsl-ls1028a: Correct ECAM PCIE window ranges
Currently all PCIE windows point to bus address 0x0, which does not match
the values obtained from hardware during EA.
Replace those values with CPU addresses, since in reality we
have a 1:1 mapping between the two.

This patch is queued for Linux v5.14 in linux-next tree:
6bee93d93111 "arm64: dts: fsl-ls1028a: Correct ECAM PCIE window ranges"
2021-07-01 20:23:40 +02:00
Emmanuel Vadot 2eb4d8dc72 Import device-tree files from Linux 5.13
Sponsored by:	Diablotin Systems
2021-07-01 17:51:01 +02:00
Emmanuel Vadot 82ea1a07b4 Import device-tree files from Linux 5.12
Sponsored by:	Diablotin Systems
2021-07-01 17:41:57 +02:00
Emmanuel Vadot 5def4c47d4 Import device-tree files from Linux 5.11
Sponsored by:	Diablotin Systems
2021-07-01 17:21:47 +02:00
Martin Matuska 2617128a21 zfs: merge openzfs/zfs@4694131a0 (master) into main
Notable upstream pull request merges:
  #12253 module/zfs: simplify ddt_stat_add() loop
  #12288 Avoid 64bit division in multilist index functions

Obtained from:	OpenZFS
OpenZFS commit:	4694131a0a
2021-06-30 08:02:44 +02:00
Martin Matuska 33b8c039a9 zfs: merge openzfs/zfs@5e2c8338b (master) into main
Notable upstream pull request merges:
  #12183 Optimize small random numbers generation
  #12227 Revert Consolidate arc_buf allocation checks
  #12266 Fix flag copying in resume case
  #12273 zfs_metaslab_mem_limit should be 25 instead of 75
  #12276 Update cache file when setting compatibility property
  #12280 Help compiller optimize out abd_verify()
  #12282 FreeBSD: fix compilation of FreeBSD world after 29274c9f6

Obtained from:	OpenZFS
OpenZFS commit:	5e2c8338bf
2021-06-26 02:21:11 +02:00
Eric Joyner 070f7812da
ice_ddp: Revert mode back to 0644
The last commit (538ef055b7) accidentally
set the executable bits for this file. This is not intended to be
executed at all. (Would that even work?)

Sponsored by:	Intel Corporation
2021-06-25 10:28:28 -07:00
Eric Joyner 538ef055b7
ice_ddp: Update to 1.3.24.0
This version is intended to be used with the 0.29.4 version of the
ice(4) driver, which will be be committed afterwards.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>

Reviewed by:	stallamr_netapp.com
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D30887
2021-06-25 10:21:39 -07:00
Marcin Wojtas 3fc5d816f8 Merge tag 'vendor/ena-com/2.4.0'
Update the driver in order not to break its compilation
and make use of the new ENA logging system

Migrate platform code to the new logging system provided by ena_com
layer.

Make ENA_INFO the new default log level.

Remove all explicit use of `device_printf`, all new logs requiring one
of the log macros to be used.
2021-06-24 16:15:18 +02:00
Martin Matuska 0d8fe23735 zfs: merge openzfs/zfs@c4c162c1e (master) into main
Notable upstream pull request merges:
  #12054 Avoid deadlock when removing L2ARC devices under I/O
  #12172 Use wmsum for arc, abd, dbuf and zfetch statistics
  #12221 vdev_draid_min_asize() ignores reserved space

Obtained from:	OpenZFS
OpenZFS commit:	c4c162c1e8
2021-06-20 09:18:44 +02:00
Martin Matuska 3ff01b231d zfs: merge openzfs/zfs@afa7b3484 (master) into main
Notable upstream pull request merges:
  #12149: Multiple man-pages: Move to appropriate section
  #12158: Re-embed multilist_t storage
  #12191: Convert non-libzpool libraries to -fvisibility=hidden
  #12196: Unify manpage makefiles, move pages to better sexions, ...
  #12210: libzutil: import filtering optimisation
  #12212: Remove pool io kstats

Obtained from:	OpenZFS
OpenZFS commit:	afa7b34845
2021-06-13 04:38:47 +02:00
Mariusz Zaborski 89d5cbb822 libnv: optimize nvlist size calculation
If we had a multiple nvlist, during nvlist_pack, we calculated the size
of every nvlist separately. For example, if we had a nvlist with three
nodes each containing another (A contains B, and B contains C), we first
calculated the size of nvlist A (which contains B, C), then we calculate
the size of B (which contains C, notice that we already did the
calculation of B, when we calculate A), and finally C. This means that
this calculation was O(N!). This was done because each time we pack
nvlist, we have to put its size in the header
(the separate header for A, B, and C).

To not break the ABI and to reduce the complexity of nvlist_size,
instead of calculating the nvlist size when requested,
we track the size of each nvlist.

Reported by:	pjd, kp
Tested by:	kp
2021-06-11 17:51:29 +02:00
Martin Matuska 1603881667 zfs: merge openzfs/zfs@75b4cbf62 (master) into main
Notable upstream pull request merges:
  #11710 Allow zfs to send replication streams with missing snapshots
  #11751 Avoid taking global lock to destroy zfsdev state
  #11786 Ratelimit deadman zevents as with delay zevents
  #11803 ZFS traverse_visitbp optimization to limit prefetch
  #11813 Allow pool names that look like Solaris disk names
  #11822 Atomically check and set dropped zevent count
  #11822 Don't scale zfs_zevent_len_max by CPU count
  #11833 Refactor zfsdev state init/destroy to share common code
  #11837 zfs get -p only outputs 3 columns if "clones" property is empty
  #11843 libzutil: zfs_isnumber(): return false if input empty
  #11849 Use dsl_scan_setup_check() to setup a scrub
  #11861 Improvements to the 'compatibility' property
  #11862 cmd/zfs receive: allow dry-run (-n) to check property args
  #11864 receive: don't fail inheriting (-x) properties on wrong dataset type
  #11877 Combine zio caches if possible
  #11881 FreeBSD: use vnlru_free_vfsops if available
  #11883 FreeBSD: add support for lockless symlink lookup
  #11884 FreeBSD: add missing seqc write begin/end around zfs_acl_chown_setattr
  #11896 Fix crash in zio_done error reporting
  #11905 zfs-send(8): Restore sorting of flags
  #11926 FreeBSD: damage control racing .. lookups in face of mkdir/rmdir
  #11930 vdev_mirror: don't scrub/resilver devices that can't be read
  #11938 Fix AVX512BW Fletcher code on AVX512-but-not-BW machines
  #11955 zfs get: don't lookup mount options when using "-s local"
  #11956 libzfs: add keylocation=https://, backed by fetch(3) or libcurl
  #11959 vdev_id: variable not getting expanded under map_slot()
  #11966 Scale worker threads and taskqs with number of CPUs
  #11994 Clean up use of zfs_log_create in zfs_dir
  #11997 FreeBSD: Don't force xattr mount option
  #11997 FreeBSD: Implement xattr=sa
  #11997 FreeBSD: Use SET_ERROR to trace xattr name errors
  #11998 Simplify/fix dnode_move() for dn_zfetch
  #12003 FreeBSD: Initialize/destroy zp->z_lock
  #12010 Fix dRAID self-healing short columns
  #12033 Revert "Fix raw sends on encrypted datasets when copying back snapshots"
  #12040 Reinstate the old zpool read label logic as a fallback
  #12046 Improve scrub maxinflight_bytes math
  #12049 FreeBSD: avoid memory allocation in arc_prune_async
  #12052 FreeBSD: incorporate changes to the VFS_QUOTACTL(9) KPI
  #12061 Fix dRAID sequential resilver silent damage handling
  #12072 Let zfs diff be more permissive
  #12077 FreeBSD: Retry OCF ENOMEM errors.
  #12088 Propagate vdev state due to invalid label corruption
  #12091 libzfs: On FreeBSD, use MNT_NOWAIT with getfsstat
  #12097 FreeBSD: Update dataset_kstats for zvols in dev mode
  #12104 FreeBSD boot code reminder after zpool upgrade
  #12114 Introduce write-mostly sums

Obtained from:	OpenZFS
OpenZFS commit:	75b4cbf625
2021-06-08 16:52:44 +02:00
Martin Matuska ed9215c8e0 zfs: merge openzfs/zfs@3522f57b6 (master) to main
This changes branch tracking of sys/contrib/openzfs to a new
direct-import branch vendor/openzfs/master.

No functional changes.

OpenZFS tag:	2.1.0-rc1
2021-06-08 16:25:14 +02:00
Mark Johnston e755e2776d ngatm: Handle errors from uni_msg_extend()
uni_msg_extend() may fail due to a memory allocation failure.  In this
case, though, the message is freed, so callers shouldn't touch it.

PR:		255861
Reviewed by:	harti
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30611
2021-06-06 16:44:47 -04:00
Jung-uk Kim 1970d69303 Import ACPICA 20210604
(cherry picked from commit 395770967c)
2021-06-05 01:58:00 -04:00
Jason A. Harmening a4b07a2701 VFS_QUOTACTL(9): allow implementation to indicate busy state changes
Instead of requiring all implementations of vfs_quotactl to unbusy
the mount for Q_QUOTAON and Q_QUOTAOFF, add an "mp_busy" in/out param
to VFS_QUOTACTL(9).  The implementation may then indicate to the caller
whether it needed to unbusy the mount.

Also, add stbool.h to libprocstat modules which #define _KERNEL
before including sys/mount.h.  Otherwise they'll pull in sys/types.h
before defining _KERNEL and therefore won't have the bool definition
they need for mp_busy.

Reviewed By:	kib, markj
Differential Revision: https://reviews.freebsd.org/D30556
2021-05-30 14:53:47 -07:00
Jason A. Harmening 271fcf1c28 Revert commits 6d3e78ad6c and 54256e7954
Parts of libprocstat like to pretend they're kernel components for the
sake of including mount.h, and including sys/types.h in the _KERNEL
case doesn't fix the build for some reason.  Revert both the
VFS_QUOTACTL() change and the follow-up "fix" for now.
2021-05-29 17:48:02 -07:00
Jason A. Harmening 6d3e78ad6c VFS_QUOTACTL(9): allow implementation to indicate busy state changes
Instead of requiring all implementations of vfs_quotactl to unbusy
the mount for Q_QUOTAON and Q_QUOTAOFF, add an "mp_busy" in/out param
to VFS_QUOTACTL(9).  The implementation may then indicate to the caller
whether it needed to unbusy the mount.

Reviewed By:	kib, markj
Differential Revision: https://reviews.freebsd.org/D30218
2021-05-29 14:05:39 -07:00
Cy Schubert 323a4e2c4e ipfilter: Fix ip_nat memory leak and use-after-free
Unfortunately the wrong elemet is freed, also resulting in use-after-free.

PR:		255859
Submitted by:	lylgood@foxmail.com
Reported by:	lylgood@foxmail.com
MFC after:	3 days
2021-05-25 11:58:14 -07:00
Ceri Davies c1a148873d sys/*/conf/*, docs: fix links to handbook
While here, fix all links to older en_US.ISO8859-1 documentation
in the src/ tree.

PR:             255026
Reported by:    Michael Büker <freebsd@michael-bueker.de>
Reviewed by:    dbaio
Approved by:    blackend (mentor), re (gjb)
MFC after:      10 days
Differential Revision: https://reviews.freebsd.org/D30265
2021-05-20 09:27:10 +01:00
Martin Matuska 9f1dc86c46 zfs: restore copyright disclaimer change from 4b84b4cca
The change will be pull-requested to upstream.

X-MFC-with:	4b84b4cca4
2021-04-26 22:16:50 +02:00
Martin Matuska 4b84b4cca4 zfs: fix non-functional mismerges from vendor/openzfs
- fix copyright in module/os/freebsd/spl/spl_acl.c
- fix mismerge in non-processed module/os/linux/zfs/zfs_uio.c

MFC after:      3 days
Obtained from:  OpenZFS
2021-04-26 03:05:13 +02:00
Mateusz Guzik 7ea3223c78 zfs: use vn_seqc_read_notmodify for racing .. lookups
Catching an in-flight unlocked vnode is fine here.

Reported by;	pho
2021-04-22 13:18:39 +00:00
Mateusz Guzik 9c651561a2 zfs: damage control racing .. lookups in face of mkdir/rmdir
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D29769
2021-04-21 15:25:32 +00:00
Adrian Chadd bed90bf8ed [ath_hal] Add get/set NAV functions
The NAV (network allocation vector) register reflects the current MAC
tracking of NAV - when it will stay quiet before transmitting.

Other devices transmit their frame durations in their 802.11 PHY headers
and all devices that hear a frame - even if it's one in an encoding
they don't understand - will understand the low bitrate PHY header that
includes the frame duration.  So, they'll set NAV to this value so
they'll stay quiet until the transmit completes.

Anyway, sometimes the PHY NAV header is garbled and sometimes, notably
older broadcom devices, will fake a long NAV so they can get "cleaner" air
for local calibration.  When this happens, the hardware will stay quiet
for quite some time and this can lead to missed/stuck beacons, or
(for Very Large Values) a MAC hang.

This code just adds the ability to get/set the NAV; the driver will
need to take care of using it during transmit hangs and beacon misses
to see if it's due to a trash looking NAV.
2021-04-18 22:52:31 -07:00
Adrian Chadd dead34f822 [ath_hal] ar9300: save TSF across full chip reset
This saves the TSF across a a full reset.  The TSF is otherwise cleared
and subsequent beaconing stops until the TSF catches up to nexttbtt.
2021-04-18 22:49:54 -07:00
Justin Hibbits 6525c2d4de mips/octeon SDK: Fix __cvmx_cmd_queue_lock asm for clang 11
The 'ticket' and 'my_ticket' arguments are both read and written within
the same asm block.  Clang is stricter with the constraints than gcc4
was, so accepts the '=r' at face value and will happily overwrite
registers that "should" be preserved.

Mark these operands to not clobber other operands, so they get their own
registers.

This fixes a panic on bringing up the octe interfaces.
2021-04-18 12:05:55 -05:00
Martin Matuska 6db169e920 zfs: merge openzfs/zfs@3522f57b6 (master)
Notable upstream pull request merges:
  #11742 When specifying raidz vdev name, parity count should match
  #11744 Use a helper function to clarify gang block size
  #11771 Support running FreeBSD buildworld on Arm-based macOS hosts

This is the last update that will be MFCed into stable/13.

From now on, the tracking of OpenZFS branches will be different:
- main continues tracking openzfs/zfs/master
- stable/13 is going to track openzfs/zfs/zfs-2.1-release

Obtained from:	OpenZFS
MFC after:	1 week
2021-04-14 12:51:51 +02:00
Mateusz Guzik 97ed4babb5 zfs: avoid memory allocation in arc_prune_async 2021-04-11 07:19:56 +02:00
Mateusz Guzik feea35bed0 zfs: make vnlru_free_vfsops use conditional on version
Diff reduction against upstream.
2021-04-11 04:57:26 +00:00
Mateusz Guzik a7fbfdee73 zfs: change format string in zio_fini to get rid of the cast 2021-04-10 20:33:43 +00:00
Kristof Provost ab8d25880e libnv: Allow use in non-sleepable contexts
44c125c4ce switched the nvlist allocations
to be M_WAITOK, but this precludes the use in non-sleepable contexts.
(E.g. with a nonsleepable lock held).

All callers for these allocation functions already cope with memory
alloation failures, so there's no reason to allow sleeping during
allocations.

Reviewed by:	melifaro, oshogbo
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D29556
2021-04-07 15:54:10 +02:00
Jung-uk Kim 429f71bf08 ACPICA: Fix build with options ACPI_DEBUG 2021-04-01 21:18:49 -04:00
Jung-uk Kim cfd1ed4681 Merge ACPICA 20210331.
(cherry picked from commit 1e02e5b0ba)
2021-04-01 19:36:59 -04:00
Jessica Clarke 3a314eb5bb zfs: Cherry-pick upstream commit ef977fce66 to fix macOS/arm64 bootstrap
Upstream commit message:

  Support running FreeBSD buildworld on Arm-based macOS hosts

  Arm-based Macs are like FreeBSD and provide a full 64-bit stat from the
  start, so have no stat64 variants. Thus, define stat64 and fstat64 as
  aliases for the normal versions.

  Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
  Signed-off-by: Jessica Clarke <jrtc27@jrtc27.com>
  Closes #11771

MFC after:	1 week
2021-03-27 02:23:59 +00:00
Cy Schubert 874b1a3548 ipfilter: simplify ipf_proxy_check() return codes
ipf_proxy_check() returns -1 for an error and 0 or 1 for success.
ipf_proxy_check()'s callers check for error and if the return code
is 0, they change it to 1 prior to returning to their callers. Simply
by returning -1 or 1 we reduce complexity and cycles burned changing
0 to 1.

MFC after:	1 week
2021-03-24 01:57:56 -07:00
Emmanuel Vadot 6be3386466 Update DTS files from Linux v5.10 2021-03-23 15:00:35 +01:00
Martin Matuska f9693bef8d zfs: merge OpenZFS master-891568c99
Notable upstream pull request merges:
  #11652 Split dmu_zfetch() speculation and execution parts
  #11682 Fix zfs_get_data access to files with wrong generation
  #11735 Clean up RAIDZ/DRAID ereport code
  #11737 Initialize metaslab range trees in metaslab_init
  #11739 FreeBSD: make seqc asserts conditional on replay
  #11763 Allow setting bootfs property on pools with indirect vdevs
  #11767 FreeBSD: Fix memory leaks in kstats

Obtained from:	OpenZFS
MFC after:	2 weeks
2021-03-21 02:17:59 +01:00
Mateusz Guzik e9272225e6 vfs: fix vnlru marker handling for filtered/unfiltered cases
The global list has a marker with an invariant that free vnodes are
placed somewhere past that. A caller which performs filtering (like ZFS)
can move said marker all the way to the end, across free vnodes which
don't match. Then a caller which does not perform filtering will fail to
find them. This makes vn_alloc_hard sleep for 1 second instead of
reclaiming, resulting in significant stalls.

Fix the problem by requiring an explicit marker by callers which do
filtering.

As a temporary measure extend vnlru_free to restart if it fails to
reclaim anything.

Big thanks go to the reporter for testing several iterations of the
patch.

Reported by:	Yamagi <lists yamagi.org>
Tested by:	Yamagi <lists yamagi.org>
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D29324
2021-03-18 14:59:03 +00:00
Martin Matuska 9db44a8e5d zfs: merge OpenZFS master-9305ff2ed
Notable upstream pull request merges:
  #11153 Scalable teardown lock for FreeBSD
  #11651 Don't bomb out when using keylocation=file://
  #11667 zvol: call zil_replaying() during replay
  #11683 abd_get_offset_struct() may allocate new abd
  #11693 Intentionally allow ZFS_READONLY in zfs_write
  #11716 zpool import cachefile improvements
  #11720 FreeBSD: Clean up zfsdev_close to match Linux
  #11730 FreeBSD: bring back possibility to rewind the
         checkpoint from bootloader

Obtained from:	OpenZFS
MFC after:	2 weeks
2021-03-14 02:32:14 +01:00
Mariusz Zaborski 653ed678c7 zfs: bring back possibility to rewind the checkpoint from
Add parsing of the rewind options.

When I was upstreaming the change [1], I omitted the part where we
detect that the pool should be rewind. When the FreeBSD repo has
synced with the OpenZFS, this part of the code was removed.

[1] FreeBSD repo: 277f38abff
[2] OpenZFS repo: f2c027bd6a

Originally reviewed by:		tsoome, allanjude
Originally reviewed by:		kevans (ok from high-level overview)

Signed-off-by: Mariusz Zaborski <oshogbo@vexillium.org>

PR:		254152
Reported by:	Zhenlei Huang <zlei.huang at gmail.com>
Obtained from:	https://github.com/openzfs/zfs/pull/11730
2021-03-13 12:56:17 +01:00
Mateusz Guzik 59146a6921 zfs: make seqc asserts conditional on replay
Avoids tripping on asserts when doing pool recovery.
2021-03-13 09:31:49 +00:00
Alexander V. Chernikov d5be41beb7 Fix dpdk/ldradix fib lookup algorithm preference calculation.
The current preference number were copied from IPv4 code,
 assuming 500k routes to be the full-view. Adjust with the current
 reality (100k full-view).

Reported by:	Marek Zarychta <zarychtam at plan-b.pwste.edu.pl>
MFC after:	3 days
2021-03-07 22:17:53 +00:00
Martin Matuska caed7b1c39 zfs: merge OpenZFS master-bedbc13da
Notable upstream commits:
  8e43fa12c Fix vdev_rebuild_thread deadlock
  03ef8f09e Add missing checks for unsupported features
  2e160dee9 Fix assert in FreeBSD-specific dmu_read_pages
  bedbc13da Cancel TRIM / initialize on FAULTED non-writeable vdevs

MFC after:	1 week
Obtained from:	OpenZFS
2021-03-03 02:15:33 +01:00
Mateusz Guzik 1d8510c1a6 zfs: add missing seqc write begin/end around zfs_acl_chown_setattr
It happens to trip over an assert but does not matter for correctness at
this time. However, do it for future proofing.

Reported by:	avg
2021-02-27 22:29:50 +00:00
Martin Matuska c170aa9f37 zfs: add missing checks for unsupported features
After the merge of OpenZFS master-9312e0fd1 it has become possible to
import ZFS pools witn an active org.illumos:edonr feature on FreeBSD,
leading to a panic.

In addition, "zpool status" reported all pools without edonr as upgradable
and "zpool upgrade -v" lists edonr in the list of upgradable features.

This is an accepted but not yet included bugfix by upstream.

Obtained from:		https://github.com/openzfs/zfs/pull/11653
Differential Revision:	https://reviews.freebsd.org/D28935
Reported by:		garga (on freebsd-current@)
Reviewed by:		freqlabs
X-MFC-with:		ba27dd8be8
2021-02-27 00:05:50 +01:00
Eric Joyner a7ac518bff ice_ddp: Update package file to 1.3.19.0
This package is intended to be used with ice(4) version 0.28.1-k.
That update will happen in a forthcoming commit.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Sponsored by: Intel Corporation
2021-02-22 18:02:19 -08:00
Cy Schubert a805ffbcbc ipfilter: Make LARGE_NAT a tunable.
LARGE_NAT is a C macro that increases
	NAT_SIZE from 127 to 2047,
	RDR_SIZE from 127 to 2047,
	HOSTMAP_SIZE from 2047 to 8191,
	NAT_TABLE_MAX from 30000 to 180000, and
	NAT_TABLE_SZ from 2047 to 16383.

These values can be altered at runtime using the ipf -T command however
some adminstrators of large firewalls rebuild the kernel to enable
LARGE_NAT at boot. This revision adds the tunable net.inet.ipf.large_nat
which allows an administrator to set this option at boot instead of build
time. Setting the LARGE_NAT macro to 1 is unaffected allowing build-time
users to continue using the old way.
2021-02-22 11:20:18 -08:00
Martin Matuska ba27dd8be8 zfs: merge OpenZFS master-9312e0fd1
Notable upstream changes:
  778869fa1 Fix reporting of mount progress
  e7adccf7f Disable use of hardware crypto offload drivers on FreeBSD
  03e02e5b5 Fix checksum errors not being counted on repeated repair
  64e0fe14f Restore FreeBSD resource usage accounting
  11f2e9a49 Fix panic if scrubbing after removing a slog device

MFC after:	2 weeks
2021-02-22 13:01:17 +01:00
Martin Matuska ee36e25a86 zfs: merge OpenZFS master-bf156c966
Notable upstream changes:
    bf156c966 Remove unused abd_alloc_scatter_offset_chunkcnt
    658fb8020 Add "compatibility" property for zpool feature sets

This update introduces a new pool property called "compatibility"
that can be used to enable a limited set of pool features on pool
creation and "stick" to it, so the "zpool upgrade" does not
accidentally enable features that are not desired. The value of
this property may then be changed later.

See zpool-features(5) for more information about the "compatibility"
pool property.

Obtained from:	OpenZFS
MFC after:	2 weeks
2021-02-18 15:19:35 +01:00
Martin Matuska afcb3c4cb4 zfs: change file mode of all merged tests
If the ksh files are not executable then the tests are not run
and reported as failed.

MFC after:	2 weeks
X-MFC-with:	6b52139eb8
2021-02-16 12:23:43 +01:00
Martin Matuska 184c1b9439 zfs: merge OpenZFS master-436ab35a5
- speed up writing to ZFS pools without ZIL devices (aa755b3)
- speed up importing ZFS pools (2d8f72d, a0e0199, cf0977a)
...

MFC after:		2 weeks
Reviewed by:		mjg (partial)
Tested by:		pho
Differential Revision:	https://reviews.freebsd.org/D28677
2021-02-16 02:46:28 +01:00
Martin Matuska 5dce03847f zfs: Avoid updating the L2ARC device header unnecessarily
From openzfs-master 0ae184a6b commit message:
  If we do not write any buffers to the cache device and the evict hand
  has not advanced do not update the cache device header.

Cherry-picked from openzfs 0ae184a6ba
Patch Author:   George Amanakis <gamanakis@gmail.com>

MFC after:	        3 days
Reviewed by:            delphij
Differential Revision:  https://reviews.freebsd.org/D28682
2021-02-15 10:56:08 +01:00
Martin Matuska f15e18a642 zfs: fix RAIDZ2/3 not healing parity with 2+ bad disks
From openzfs-master 62d4287f2 commit message:
  When scrubbing, (non-sequential) resilvering, or correcting a checksum
  error using RAIDZ parity, ZFS should heal any incorrect RAIDZ parity by
  overwriting it.  For example, if P disks are silently corrupted (P being
  the number of failures tolerated; e.g. RAIDZ2 has P=2), `zpool scrub`
  should detect and heal all the bad state on these disks, including
  parity.  This way if there is a subsequent failure we are fully
  protected.

  With RAIDZ2 or RAIDZ3, a block can have silent damage to a parity
  sector, and also damage (silent or known) to a data sector.  In this
  case the parity should be healed but it is not.

Cherry-picked from openzfs 62d4287f27
Patch Author:	Matthew Ahrens <matthew.ahrens@delphix.com>

MFC after:		3 days
Reviewed by:		delphij
Differential Revision:	https://reviews.freebsd.org/D28681
2021-02-15 10:50:10 +01:00
Cy Schubert 1e811efbc5 Fix non-IPv6 build post 57785538c6.
57785538c6 change the test for FreeBSD
from __FreeBSD_version to __FreeBSD__. However this test was performed
before sys/param.h was included, therefore __FreeBSD_version was never
defined. As the test was never true opt_random_ip_id.h was never included.

Submitted by:	bdragon
Reported by:	bdragon
MFC after:	1 week
X-MFC with:	57785538c6
2021-02-09 17:18:25 -08:00
Antonio Russo e9d419a053 Set file mode during zfs_write
Apply https://github.com/openzfs/zfs/pull/11576

Direct commit from upstream openzfs. Full commit message below:

Set file mode during zfs_write

3d40b65 refactored zfs_vnops.c, which shared much code verbatim between
Linux and BSD.  After a successful write, the suid/sgid bits are reset,
and the mode to be written is stored in newmode.  On Linux, this was
propagated to both the in-memory inode and znode, which is then updated
with sa_update.

3d40b65 accidentally removed the initialization of newmode, which
happened to occur on the same line as the inode update (which has been
moved out of the function).

The uninitialized newmode can be saved to disk, leading to a crash on
stat() of that file, in addition to a merely incorrect file mode.

Reviewed-by: Ryan Moeller <ryan@ixsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Antonio Russo <aerusso@aerusso.net>
Closes #11474
Closes #11576

Obtained from:	openzfs/zfs@f8ce8aed0
MFC after:	0 days
Sponsored by:	iXsystems, Inc.
2021-02-09 12:30:06 -05:00
Cy Schubert 57785538c6 Simplify the FreeBSD check using __FreeBSD__ compiler macro.
Rather than rely on __FreeBSD_version, defined in sys/param.h, use
__FreeBSD__ defined by the compiler.

Reported by:	emaste
MFC after:	1 week
2021-02-08 16:36:27 -08:00
Cy Schubert 344f1083e1 ipfilter: Use the softn (NAT softc) host map size in ip_nat6 calculation.
The ipfilter NAT table host map size is a tunable that defaults to
a macro value defined at build time. HOSTMAP_SIZE is saved in softn
(the ipnat softc) at initialization. It can be tuned (changed) at runtime
using the ipf -T command. If the hostmap_size tunable is adjusted the
calculation to determine where to put new entries in the table was
incorrect. Use the tunable in the NAT softc instead of the static build
time value.

MFC after:	1 week
2021-02-05 18:39:38 -08:00
Cy Schubert e673debe7d Simplify BSD macro tests.
All FreeBSD and NetBSD are BSD >= 199306 and have been for a long time.

MFC after:	1 week
2021-02-05 18:39:38 -08:00
Cy Schubert 0f34c80f37 Replace the redundant MENTAT macro with SOLARIS.
MENTAT and SOLARIS are synonymous. Remove the extraneous duplicate
macro.

MFC after:	1 week
2021-02-01 17:19:15 -08:00
Cy Schubert 7071734fae Indentation cleanup resulting from the cleanup of #ifdefs.
The conscious decision was made not to perform any indentation or
whitespace cleanup while cleaning out old redunant #ifdefs. The
reason for this was to avoid confusing future readers of history and
diffs with cosmetic changes, making bisection of any possible bugs
introduced more difficult. This commit cleans up the whitespace
detritus left behind from the previous #ifdef cleanup commits.

MFC after:	1 week
2021-02-01 17:19:15 -08:00
Cy Schubert 4cd1807c7d Retire the K&R/STD C __P prototype declarations.
In the old days when K&R C and STD C were each in use a workaround
(read hack) was required to allow the same code to work on each
without modification. All C compilers support STD C. We can finally
put the __P prototype to rest.

MFC after:	1 week
2021-02-01 17:19:15 -08:00
Mateusz Guzik 69c5fa5cd1 zfs: remove incomplete ifdefs for lockless symlink support
This wil be handled differently upstream and merged later.
2021-02-01 13:18:27 +01:00
Jung-uk Kim 29f37e9bcc acpica: Import ACPICA 20210105.
(cherry picked from commit a61ec1492c)
2021-01-29 20:53:07 -05:00
Jung-uk Kim 385fb5d933 acpica: Import ACPICA 20201217.
(cherry picked from commit a4634ed777)
2021-01-29 19:48:02 -05:00
Cy Schubert 83edbc3cb5 ipfilter: Retire pre-standard C support.
All C compilers in 2021 support standard C and architectures that did
not were retired long ago. Simplify by removing now redundant
pre-standard C code.

MFC after:	1 week
2021-01-25 14:46:45 -08:00
Mateusz Guzik 7af02ef0b2 zfs: use atomic_load_consume_ptr for z_cached_symlink 2021-01-25 22:40:15 +00:00
Mateusz Guzik cc96f92a57 atomic: make atomic_store_ptr type-aware 2021-01-25 22:40:15 +00:00
Mateusz Guzik f40d6217f2 zfs: fix panics with invariant kernels from zfs_replay_setattr 2021-01-25 22:40:14 +00:00
Mateusz Guzik 3110d4ebd6 zfs: add support for lockless symlink lookup
Reviewed by:	kib (previous version)
Tested by:	pho (previous version)
Differential Revision:	https://reviews.freebsd.org/D27488
2021-01-23 15:04:43 +00:00
John Baldwin d86d319495 Simplify dynamic ipfilter sysctls.
Pass the structure offset in arg2 instead of arg1.  This avoids
having to undo the pointer arithmetic on arg1.  Instead arg2 can
be used directly as an offset relative to the desired structure.

Reviewed by:	cy
Obtained from:	CheriBSD
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D27961
2021-01-20 16:34:25 -08:00
Emmanuel Vadot 19775aa7bc Re-apply f81b2b9a8a to the new device-tree import 2021-01-15 20:07:13 +01:00
Emmanuel Vadot 78abc9e2e6 Revert upstream commit 27c90e5e48d0
It changed the #pinctrl-cells value to be equal to 2 and the macro
that generates the values.
Based on the bindings docs a value of 2 is only acceptable if the node
used pinctrl-single,bits and not pinctrl-single,pins

This allow booting further on the beaglebone black with 5.9 DTS
2021-01-15 20:07:08 +01:00
Emmanuel Vadot c66ec88fed Add 'sys/contrib/device-tree/' from commit '5ee353c36d3c9c7f63df7c7671875e73fba70958'
git-subtree-dir: sys/contrib/device-tree
git-subtree-mainline: 94611a8388
git-subtree-split: 5ee353c36d
2021-01-15 12:28:57 +01:00
Alan Somers 58a08f9e99 [skip ci] Delete an accidentally-committed comment
MFC-With:	19cca0b961
2021-01-11 17:01:22 -07:00
Alan Somers 19cca0b961 aio: fix the tests when ZFS is not available
Don't try to cleanup the zpool if we couldn't create a zpool in the
first place.

Submitted by:	tmunro
MFC-with:	022ca2fc7f
2021-01-09 17:16:38 -07:00
Alexander V. Chernikov 537d134373 Bring DPDK route lookups to FreeBSD.
This change introduces loadable fib lookup modules based on
 DPDK rte_lpm lib targeted for high-speed lookups in large-scale tables.
It is based on the lookup framework described in D27401.

IPv4 module is called dpdk_lpm4. It wraps around rte_lpm [1] library.
This library implements variation of DIR24-8 [2] lookup algorithm.
Module provide lockless route lookups and in-place incremental updates,
 allowing for good RIB performance.

IPv6 module is called dpdk_lpm6. It wraps around rte_lpm6 [3] library.
Implementation can be seen as multi-bit trie where the stride or number of bits
 inspected on each level varies from level to level.
It can vary from 1 to 14 memory accesses, with 5 being the average value
 for the lengths that are most commonly used in IPv6.
Module provide lockless route lookups for global unicast addresses
 and in-place incremental updates, allowing for good RIB performance.

Implementation details:
* wrapper code lives in `sys/contrib/dpdk_rte_lpm/dpdk_lpm[6].c`.
* rte_lpm[6] implementation contains both RIB and FIB code.
 . RIB ("rule_") code, backed by array of hash tables part has been commented out,
 as base radix already provides all the necessary primitives.
* link-local lookups are currently implemented as base radix lookup.
 This part should be converted to something like read-only radix trie.

Usage detail:
Compile kernel with option FIB_ALGO and load dpdk_lpm4/dpdk_lpm6
 module at any time. They will be picked up automatically when
 amount of routes raises to several thousand.

[1]: https://doc.dpdk.org/guides/prog_guide/lpm_lib.html
[2]: http://yuba.stanford.edu/~nickm/papers/Infocom98_lookup.pdf
[3]: https://doc.dpdk.org/guides/prog_guide/lpm6_lib.html

Differential Revision: https://reviews.freebsd.org/D27412
2021-01-09 12:41:04 +00:00
Hans Petter Selasky 376e130b47 Fix memory leaks in error paths in krping.
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking
2021-01-08 12:35:55 +01:00
Matt Macy b363d3d52a OpenZFS: Fix issues caused by reversed commits + rebase 2021-01-07 17:42:10 -08:00
Matt Macy 7877fdebee OpenZFS merge main-gf11b09
- add dRAID support
- fix duplicate close handling
- fix memory leak in prefetch
- fix problem with SIMD benchmarking on FreeBSD boot
...
2021-01-07 16:55:59 -08:00
Thomas Munro a5e284038e open(2): Add O_DSYNC flag.
POSIX O_DSYNC means that writes include an implicit fdatasync(2), just
as O_SYNC implies fsync(2).

VOP_WRITE() functions that understand the new IO_DATASYNC flag can act
accordingly, but we'll still pass down IO_SYNC so that file systems that
don't understand it will continue to provide the stronger O_SYNC
behaviour.

Flag also applies to fcntl(2).

Reviewed by: kib, delphij
Differential Revision: https://reviews.freebsd.org/D25090
2021-01-08 13:15:56 +13:00
Conrad Meyer 98689d0ffb libprivatezstd: Restrict symbol visibility similar to upstream
We have to relax three symbols to dynamically link zstd(1), but the rest
are the same.
2021-01-03 11:26:46 -08:00
Conrad Meyer bcae12b591 zstd: Fix non-FreeBSD CI libzstd build
Fix non-FreeBSD CI build after v1.4.8.  This definition was only used in
zstd(1), which isn't part of non-FreeBSD CI (I guess).  The ifdef was
added in v1.4.5 import.

Upstream does not currently support shared-linked zstd(1), but I have
proposed https://github.com/facebook/zstd/pull/2450 .  If that is
adopted, we can add -DZSTD_PROGRAMS_LINK_SHARED to our libzstd build and
drop some diffs.

Reported by:	uqs
2021-01-03 07:42:00 -08:00
Mateusz Guzik 82397d7919 vfs: denote vnode being a mount point with VIRF_MOUNTPOINT
Reviewed by:	kib (previous version)
Differential Revision:	https://reviews.freebsd.org/D27794
2021-01-03 06:50:06 +00:00
Hans Petter Selasky aca12148b1 Improve error message printing in krping.
Don't print completion queue flush as an error.

MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-12-28 14:37:09 +01:00
Ryan Libby f2d48b5e2c Merge commit d8a09b3a0 from openzfs git (by Ryan Libby):
lua: avoid gcc -Wreturn-local-addr bug

  Avoid a bug with gcc's -Wreturn-local-addr warning with some
  obfuscation.  In buggy versions of gcc, if a return value is an
  expression that involves the address of a local variable, and even if
  that address is legally converted to a non-pointer type, a warning may
  be emitted and the value of the address may be replaced with zero.
  Howerver, buggy versions don't emit the warning or replace the value
  when simply returning a local variable of non-pointer type.

  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90737

  Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
  Signed-off-by: Ryan Libby <rlibby@FreeBSD.org>
  Closes #11337
2020-12-27 14:33:13 -08:00
Ryan Libby 21ce674e3c Merge commit 956f94010 from openzfs git (by Ryan Libby):
spa: avoid type narrowing warning

  Building the spa module for i386 caused gcc to emit
  -Wint-to-pointer-cast "cast to pointer from integer of different size"
  because spa.spa_did was uint64_t but pthread_join (via thread_join in
  spa_deactivate) takes a pointer (32-bit on i386).  Define spa_did to be
  pointer-size instead.  For now spa_did is in fact never non-zero and the
  thread_join could instead be ifdef'd out, but changing the size of
  spa_did may be more useful for the future.

  Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
  Signed-off-by: Ryan Libby <rlibby@FreeBSD.org>
  Closes #11336
2020-12-27 14:33:13 -08:00
Ryan Libby 48184e7661 Merge commit c7500ded3 from openzfs git (by Ryan Libby):
FreeBSD libzfs: gcc requires __thread after static

  Building libzfs with gcc on FreeBSD failed because gcc is picky about
  the order of keywords in declarations with __thread, whereas clang is
  more relaxed.

  https://gcc.gnu.org/onlinedocs/gcc/Thread-Local.html

  Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
  Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
  Signed-off-by: Ryan Libby <rlibby@FreeBSD.org>
  Closes #11331
2020-12-27 14:33:13 -08:00
Ryan Libby e67d933d9c Merge commit 3fcd73747 from openzfs git (by Adrian Chadd):
Fix compiling on FreeBSD + gcc - don't assume illmnos bits

  This looks like it was once from the illumnos compat code.
  FreeBSD doesn't have cmn_err as a compiler format attribute, so
  it definitely errors out.

  It doesn't show up on LLVM because it doesn't trigger at all.

  Add in the format flags but keep them behind #if 0 for now;
  there are too many format issues that trigger when one does
  format checking in the shared code.

  Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
  Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
  Signed-off-by: adrian chadd <adrian@freebsd.org>
  Closes #11068
  Closes #11069
2020-12-27 14:33:13 -08:00
Ryan Libby 913f2d2e0c Merge commit 79a357c2a from openzfs git (by Adrian Chadd):
Fix pointer-is-uint64_t-sized assumption in the ioctl path

  This shows up when compiling freebsd-head on amd64 using gcc-6.4.
  The lib32 compat build ends up tripping over this assumption.

  Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
  Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
  Signed-off-by: adrian chadd <adrian@freebsd.org>
  Closes #11068
  Closes #11069
2020-12-27 14:33:13 -08:00
Michal Meloun b9cbd68d1c ARM: Enhance common Nvidia Tegra drivers by support for Tegra210 SoC.
MFC after:	4 weeks
2020-12-26 19:13:10 +01:00
Conrad Meyer f7cd7fe51c sys/contrib/zstd: Import zstd 1.4.8
Merge commit 'f6ae97673c28bdb9ae795bd235ab6f26f2536a2d' into main

Changes from 1.4.5:
  * https://github.com/facebook/zstd/releases/tag/v1.4.8
  * https://github.com/facebook/zstd/releases/tag/v1.4.7
  (and there was no public v1.4.6)

Conflicts:
	sys/contrib/zstd/lib/common/zstd_internal.h (new ZSTD_NO_INTRINSICS)
2020-12-25 07:42:41 -08:00
Konstantin Belousov cd85379104 Make MAXPHYS tunable. Bump MAXPHYS to 1M.
Replace MAXPHYS by runtime variable maxphys. It is initialized from
MAXPHYS by default, but can be also adjusted with the tunable kern.maxphys.

Make b_pages[] array in struct buf flexible.  Size b_pages[] for buffer
cache buffers exactly to atop(maxbcachebuf) (currently it is sized to
atop(MAXPHYS)), and b_pages[] for pbufs is sized to atop(maxphys) + 1.
The +1 for pbufs allow several pbuf consumers, among them vmapbuf(),
to use unaligned buffers still sized to maxphys, esp. when such
buffers come from userspace (*).  Overall, we save significant amount
of otherwise wasted memory in b_pages[] for buffer cache buffers,
while bumping MAXPHYS to desired high value.

Eliminate all direct uses of the MAXPHYS constant in kernel and driver
sources, except a place which initialize maxphys.  Some random (and
arguably weird) uses of MAXPHYS, e.g. in linuxolator, are converted
straight.  Some drivers, which use MAXPHYS to size embeded structures,
get private MAXPHYS-like constant; their convertion is out of scope
for this work.

Changes to cam/, dev/ahci, dev/ata, dev/mpr, dev/mpt, dev/mvs,
dev/siis, where either submitted by, or based on changes by mav.

Suggested by: mav (*)
Reviewed by:	imp, mav, imp, mckusick, scottl (intermediate versions)
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
Differential revision:	https://reviews.freebsd.org/D27225
2020-11-28 12:12:51 +00:00
Ian Lepore a7623790fb Add the firmware blob required to use the sdma hardware in the imx6
processor, and its associated license text (which is similar to a
bsd-3-clause, but with a prohibition against decompiling).  Install a copy
of the license in /usr/share/doc/legal/imx, to comply with the license terms
that requires a copy of the license to be delivered along with the firmware.

Obtained from:	https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/imx/sdma/sdma-imx6q.bin https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/LICENSE.sdma_firmware
2020-11-26 01:40:04 +00:00
Marcin Wojtas 9eb1615f33 Adjust ENA driver files to latest ena-com changes
* Use the new API of ena_trace_*
* Fix typo syndrom --> syndrome
* Remove validation of the Rx req ID (already performed in the ena-com)
* Remove usage of deprecated ENA_ASSERT macro

Submitted by:   Ido Segev <idose@amazon.com>
Submitted by:   Michal Krawczyk <mk@semihalf.com>
Obtained from:  Semihalf
Sponsored by:   Amazon, Inc
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D27115
2020-11-18 14:59:22 +00:00
Marcin Wojtas 4f8f476e73 Fix completion descriptors alignment for the ENA
The latest generation hardware requires IO CQ (completion queue)
descriptors memory to be aligned to a 4K. It needs that feature for
the best performance.

Allocating unaligned descriptors will have a big performance impact as
the packet processing in a HW won't be optimized properly. For that
purpose adjust ena_dma_alloc() to support it.

It's a critical fix, especially for the arm64 EC2 instances.

Submitted by: Ido Segev <idose@amazon.com>
Obtained from: Amazon, Inc
MFC after: 1 week
Differential revision:  https://reviews.freebsd.org/D27114
2020-11-18 14:50:12 +00:00
Cy Schubert dd4f81cd06 Restore identification of VDEVs using non-native block size.
NAME         STATE     READ WRITE CKSUM
    dsk02        ONLINE       0     0     0
      mirror-0   ONLINE       0     0     0
        ada1s4a  ONLINE       0     0     0
        ada2s4a  ONLINE       0     0     0  block size: 512B configured,
					     4096B native

Reviewed by:		tsoome (previous FreeBSD phab version)
Differential Revision:	https://reviews.freebsd.org/D26880

Upstream commit:	3928ec5339
Reviewed-by:		Matt Macy <mmacy@FreeBSD.org>
Reviewed-by:		Toomas Soome <tsoome@me.com>
Reviewed-by:		Brian Behlendorf <behlendorf1@llnl.gov>
Signed off by:		Cy Schubert <cy@FreeBSD.org>
Closes #11088
2020-11-18 01:18:45 +00:00
Emmanuel Vadot 04b8208fc0 vchiq: Rename timer func so they do not conflict with linuxkpi 2020-11-17 14:41:23 +00:00
Mateusz Guzik 5596f836e7 zfs: disable periodic arc updates
They are only there to provide less innacurate statistics for debuggers.
However, this is quite heavy-weight and instead it would be better to
teach debuggers how to obtain the necessary information.
2020-11-14 19:23:07 +00:00
Jung-uk Kim fbde34778b MFV: r367652
Merge ACPICA 20201113.
2020-11-13 22:45:26 +00:00
Mateusz Guzik 4426311a3c zfs: combine zio caches if possible
This deduplicates 2 sets of caches using the same sizes.

Memory savings fluctuate a lot, one sample result is buildworld on zfs
saving ~180MB RAM in reduced page count associated with zio caches.
2020-11-10 14:23:46 +00:00
Mateusz Guzik 41ce62251c zfs: g/c unused data_alloc_arena 2020-11-10 14:21:23 +00:00
Mariusz Zaborski 36d6566e59 Check if the ZVOL has been written before calling zil_async_to_sync.
The ZIL will be opened on the first write, not earlier.

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Mariusz Zaborski <oshogbo@vexillium.org>
OpenZFS Pull Request: https://github.com/openzfs/zfs/pull/11152
PR:		250934
2020-11-08 14:08:00 +00:00
Mateusz Guzik ff19fd6242 zfs: remove 2 assertions that teardown lock is not held
They are not very useful and hard to implement with rms.

This has a side effect of simplying the code.
2020-11-07 16:58:38 +00:00
Mark Johnston acb5785aae Add firmware modules for qat(4), take two
My script to convert git commits to svn patch does not handle binary
files correctly, and r367387 committed a set of empty files as a result.

MFC with:	r367387
Sponsored by:	Rubicon Communications, LLC (Netgate)
2020-11-06 16:12:06 +00:00
Mark Johnston f078c492a9 Add firmware modules for qat(4)
MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC (Netgate)
2020-11-05 16:00:30 +00:00
Mateusz Guzik aebc96831f zfs: lz4: add optional kmem_alloc support
lz4 port from illumos to Linux added a 16KB per-CPU cache to accommodate for
the missing 16KB malloc. FreeBSD supports this size, making the extra cache
harmful as it can't share buckets.
2020-11-05 03:25:23 +00:00
Mateusz Guzik 926ad187fd zfs: use rms lock for teardown handling
This deserializes otherwise non-contending operations.

The previous scheme of using 17 locks hashed by curthread runs into
conflicts very quickly.
2020-11-04 21:22:41 +00:00
Mateusz Guzik 4008dd4581 zfs: macroify teardown handling 2020-11-04 21:19:54 +00:00
Mateusz Guzik ae5642a670 zfs: rename teardown inactive macros to mimick rrm convention 2020-11-04 21:19:25 +00:00