Commit Graph

283876 Commits

Author SHA1 Message Date
Peter Holm
be8d01b515 stress2: Added a faster test of fsck_ffs by omitting mount(8) and umount(8) 2023-05-22 10:07:40 +02:00
Peter Holm
ca0088ae27 stress2: Occasionally modify 8 bits 2023-05-22 10:05:34 +02:00
Bjoern A. Zeeb
046d8d89ed LinuxKPI: fix WRITE_ONCE(), remove ACCESS_ONCE()
Fix a gcc warning: "to be safe all intermediate pointers in cast from
'...' to '...' must be 'const' qualified [-Wcast-qual]".
Doing what is essentially a __DECONST() adding the uintptr_t gets
rid of the massive amount of warnings we get in LinuxKPI and lets
us see the actual problems a lot better.
This is a follow-up to 74e908b3c6 which
fixed READ_ONCE().
ACCESS_ONCE() seems to be an obsolete KPI these days in Linux and
FreeBSD does not use it either directly so we can entirely remove
it now.

Sponsored by:	The FreeBSD Foundation
Suggested by:	jhb
Reviewed by:	hselasky
MFC after:	10 days
Differential Revision: https://reviews.freebsd.org/D40084
2023-05-21 23:14:05 +00:00
Hans Petter Selasky
805d759338 mlx4: Move DEFINE_MUTEX() outside function body.
Move static mutex declaration outside function body, to avoid global
variables being declared on the stack, when using SYSINITs.

MFC after:	1 week
Sponsored by:	NVIDIA Networking
2023-05-21 18:20:16 +02:00
Alexander V. Chernikov
63ad5ce733 ifconfig: simplify ifconfig() by factoring out ifa add/del logic
Reviewed by:	kp
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D40180
2023-05-21 09:42:11 +00:00
Alexander V. Chernikov
197bff385e ifconfig: split argument parsing
Simplify main() by factoring out argument parsing code.

Reviewed by:	kp
MFC after:	2 weeks
Differential Revision: https://reviews.freebsd.org/D40179
2023-05-21 09:42:11 +00:00
Fedor Uporov
50be18cc77 ext2fs: Add large sectorsize disks support
The ext2fs does not support disks with sectorsize more 512 bytes.
The main issue is in reading/writing superblock, which is not aligned
with 4k value. Reimplement the superblock reading logic to make it
indifferent to disk logical sector size. The logical sector size
more then page size is not supported, like it is doing on Linux side.

PR:             271105
Reported by:    k(at)vodka.home.kg
Reviewed by:    pfg
MFC after:      2 week
Differential Revision:  https://reviews.freebsd.org/D40047
2023-05-21 08:17:47 +03:00
Bjoern A. Zeeb
525dd4acaa LinuxKPI: implement pci_rescan_bus()
Try to implement pci_rescan_bus().  pci_rescan_method() is already
doing most of the job.  We only have to do the count for the return
value again ourselves.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
Reviewed by:	jhb
Differential Revision: https://reviews.freebsd.org/D40122
2023-05-21 00:31:25 +00:00
Enji Cooper
902dc544cc Revert "Require the OpenSSL 1.1 APIs when compiling ldns"
This particular change appears to have broken the build; the change
needs some massaging to work with OpenSSL 1.1.

This reverts commit c6750ddec9.
2023-05-20 12:00:34 -07:00
Enji Cooper
c6750ddec9 Require the OpenSSL 1.1 APIs when compiling ldns
Moving the APIs from OpenSSL 1.1 supporting APIs to 3.x supporting APIs
is a non-trivial effort. Require 1.1 API compatibility to unblock
updating OpenSSL in base to 3.x.

This mirrors what upstream has done in their configure.ac file.

Submitted by:	Pierre Pronchery <pierre@freebsdfoundation.org>
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D40082
2023-05-20 11:41:24 -07:00
John Baldwin
c98146ae22 cxgbe: Move ethofld_transmit under #ifdef INET || INET.
This fixes a -Wunused-function warning when building LINT-NOIP.

Reported by:	rpokala
2023-05-20 09:27:40 -07:00
John Baldwin
ac6dd01259 netlink: Move an INET-only variable under #if.
This fixes the LINT-NOIP build.
2023-05-20 09:26:46 -07:00
Mateusz Guzik
e0c86f5c2f td: line up with other clean up in thread_reap_domain
NFC
2023-05-20 12:48:15 +00:00
Mateusz Guzik
bbe62559c7 rlimit: line up with other clean up in thread_reap_domain
NFC
2023-05-20 12:46:46 +00:00
Bjoern A. Zeeb
5138ffa877 fwget: remove logging redirects
After adding addpkg() in 10aa369afd
the redirects are no longer needed.  We can now log directly so
simplify the code.

Reported by:	manu
Reviewed by:	manu
Differential Revision: https://reviews.freebsd.org/D40077
2023-05-20 11:20:41 +00:00
Bjoern A. Zeeb
dd8a74e74d fwget: add support for various WiFi NICs
Add support for Realtek, QCA, and Mediatek WiFi NIC cards.
We group the matching entries by driver in sub-functions in order
to semi-automatically create the lists for now.

Reviewed by:	manu
Differential Revision: https://reviews.freebsd.org/D40073
2023-05-20 11:18:51 +00:00
Bjoern A. Zeeb
17cec33e75 fwget: improve the pci base script
When matching "class" only match the class byte and not subclass and
programming interface.
Extend the list of supported classes by network, old, and misc (for no
better names on the latter two).
Extend the list of known vendors for various WiFi NICs.
Add a "pci_fixup_class" as some wireless cards have unexpected PCI
classes set.  In case we cannot find a matching file for the original
try to see if a "fixed up" version exists.  This allows us to avoid
duplicate matching files for the same vendor/driver but different
chipsets.

Reviewed by:	manu
Differential Revision: https://reviews.freebsd.org/D40072
2023-05-20 11:16:42 +00:00
Bjoern A. Zeeb
10aa369afd fwget: simplify adding firmware images to pkg to install
Rather than using echo to return the firmware package name, call a
new function (addpkg) which will also deal with (i) no leading space
and (ii) remove duplicates (as some devices have dual-wifi-cards).
In addition we won't have a line break when having multiple packages.

While here also do not call pkg(8) anymore if there is no package to
install and use the correct variable to install all and not just the
last found package.

Reviewed by:	manu, bapt
Differential Revision: https://reviews.freebsd.org/D40071
2023-05-20 11:13:12 +00:00
Bjoern A. Zeeb
ae1e336e05 LinuxKPI: add put_unaligned_le16() and get_unaligned_be64()
Add the two new functions needed by wireless drivers by the same
implementation pattern we did for different sizes.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
Reviewed by:	emaste
Differential Revision: https://reviews.freebsd.org/D40174
2023-05-20 11:10:31 +00:00
Alexander V. Chernikov
7eee0eaf16 netlink: automatically generate broadcast for IPv4 ifa if not set.
MFC after:	2 weeks
2023-05-20 10:42:08 +00:00
Alexander V. Chernikov
a72b78905a ifconfig: simplify carp vhid setup.
Currently carp implementation peeks into the opaque 'afp->af_addreq'
 buffer, assumes it knows the af-specific layout and assigns vhid
 directly.
Simplify the code and remove abstraction leak by introducing per-afp
 callback for setting vhid.
This change is a pre-requisite to set addresses via Netlink,
 as Netlink implementiation uses different structure layout.

Reviewed by:	kp
Differential Revision: https://reviews.freebsd.org/D40160
MFC after:	2 weeks
2023-05-20 09:49:15 +00:00
Bjoern A. Zeeb
b7afaf8a41 LinuxKPI: add further dummy header files
Wireless drivers try to include these files.  Add them empty for no
better reason yet.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
2023-05-20 00:57:38 +00:00
Bjoern A. Zeeb
369264acf7 LinuxKPI: skbuff: add skb_get_hash()
Add a dummy implementation of skb_get_hash() until we'll hit and
implement it.  It'll help to keep an upcoming wireless driver to
compile.

MFC after:	10 days
2023-05-20 00:57:24 +00:00
Bjoern A. Zeeb
047298203f LinuxKPI: qcom: update qmi and mhi
Update qcom QMI and MHI bits in order to keep an upcoming driver
compiling.

MFC after:	10 days
2023-05-20 00:57:10 +00:00
Bjoern A. Zeeb
6153bef9ec LinuxKPI: netdevice: add dev_set_threaded()
Add dev_set_threaded() to the dummy functions of netdevice.h in order
to keep an upcoming wireless driver compiling.
While here also update the name of a function argument for consistency.

MFC after:	10 days
2023-05-20 00:56:41 +00:00
Bjoern A. Zeeb
63231f4d5b net80211: Radiotap: update for defines
ath1xk drivers require further HE defines.  Some of those we had
already predicted as comments in the past.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
2023-05-20 00:56:21 +00:00
Brian Atkinson
ad0a554614
Hold db_mtx when updating db_state
Commit 555ef90 did some general code refactoring for
dmu_buf_will_not_fill() and dmu_buf_will_fill(). However, the db_mtx was
not held when update db->db_state in those code block. The rest of the
dbuf code always holds the db_mtx when updating db_state. This is
important because cv_wait() db_changed is used to check for db_state
changes.

Updating dmu_buf_will_not_fill() and dmu_buf_will_fill() to hold the
db_mtx when updating db_state.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Brian Atkinson <batkinson@lanl.gov>
Closes #14875
2023-05-19 13:05:53 -07:00
Brian Behlendorf
577e835f30
Probe vdevs before marking removed
Before allowing the ZED to mark a vdev as REMOVED due to a
hotplug event confirm that it is non-responsive with probe.
Any device which can be successfully probed should be left
ONLINE to prevent a healthy pool from being incorrectly
SUSPENDED.  This may occur for at least the following two
scenarios.

1) Drive expansion (zpool online -e) in VMware environments.
   If, during the partition resize operation, a partition is
   removed and re-created then udev will send a removed event.

2) Re-scanning the namespaces of an NVMe device (nvme ns-rescan)
   may result in a udev remove and add event being delivered.

Finally, update the ZED to only kick in a spare when the
removal was successful.

Reviewed-by: Ameer Hamza <ahamza@ixsystems.com>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue #14859
Closes #14861
2023-05-19 13:05:09 -07:00
Randall Stewart
72ae938252 Add a comment to the new tcp_get_srtt method to clarify that ticks
are kept in a shifted form and need to be un-shifted before use.

Suggested by: rpokala@
2023-05-19 15:53:26 -04:00
Baptiste Daroussin
31edf56b15 date: add -z output_zone option
Inpired by OpenBSD date(1), this option allows to do timezone conversion
via the date(1) command.

For example, to determine when the BSDCan livestream begins for me:

$ env -i TZ=EST5EDT date -z Europe/Paris -j 0900

MFC After:		1 week
Reviewed by:		kib, bcr (manpage)
Differential Revision:	https://reviews.freebsd.org/D40159
2023-05-19 21:09:40 +02:00
Randall Stewart
ec6d620b19 There are congestion control algorithms will that pull in srtt, and this can cause issues with rack.
When using rack, cubic and htcp will grab the srtt, but they think it is in ticks. For rack
it is in micro-seconds (which we should probably move all stacks to actually). This causes
issues so instead lets make a new interface so that any CC module can pull the srtt in
whatever granularity they want.

Reviewed by: tuexen
Sponsored by: Netflix Inc
Differential Revision:https://reviews.freebsd.org/D40146
2023-05-19 11:16:28 -04:00
Ed Maste
f326a83c85 Cirrus-CI: switch to -lite LLVM package for native run
This reduces CI cycle time (a small amount).

Suggested by:	brooks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D40136
2023-05-19 09:56:03 -04:00
Colin Percival
40b2870545 mi_startup: Instrument the bubblesort with TSLOG
The bubblesort of SYSINITs is currently responsible for 7% of the
kernel boot time when booting a 1 CPU / 128 MB VM under Firecracker.

It needs to be replaced with a faster sort, but until that happens
at least instrumenting it with TSLOG makes it show up in flamecharts.
2023-05-19 06:46:42 -07:00
Kristof Provost
f3546eacf0 if_bridge: fix potential panic
When a new bridge_rtnode is added it is added with a NULL brt_dst. The
brt_dst is set after the entry is added. This means there's a small
window where another core could also attempt to add this node, leading
to the code attempting to log that the MAC addresses moved to a new
interface.
Aside from that being a spurious log entry it also panics, because
obif is NULL (and we attempt to dereference it).

Avoid this by settings brt_dst before we insert the bridge_rtnode.
Assert that obif is non-NULL, as an extra precaution.

Reported by:	olivier@
Reviewed by:	zlei@
Differential Revision:	https://reviews.freebsd.org/D40147
2023-05-19 15:26:52 +02:00
Alexander V. Chernikov
1377eb268a netlink: add IPv4/IPv6 attribute writers using in[6]_addr instead of
sockaddrs.

MFC after:	2 weeks
2023-05-19 09:45:49 +00:00
Kristof Provost
6408d025cf carp test: improve jail names for unicast_ll_v6 test
Rename the jails used in the unicast_ll_v6 test, to ensure the jail
names are unique to this test.
That is one of the requirements for running these tests in parallel.
2023-05-18 22:12:08 +02:00
Kristof Provost
0d574d8ba8 pfsync tests: check for the correct IP address
When checking if the state synced over we should look for
198.51.100.254, not 198.51.100.2. The test worked because the incorrect
address is a substring of the correct one, but we should fix it anyway.

Reported by:	Naman Sood <naman@freebsdfoundation.org>
MFC after:	1 week
2023-05-18 22:12:07 +02:00
Mateusz Guzik
9a19595cad proc: s/short/int lock-related counters
short is small enough that it can overflow in practice for certain cases
and then trigger wrong asserts.

One known example is vfs namecache resize which grabs all locks at once.

Reported by:	gallatin
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-05-18 19:57:38 +00:00
Mateusz Guzik
6ba1be38f6 proc: s/short/u_char for td_stopsched
bool is not used because of massive header mess

While here move it into a gap.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-05-18 19:44:29 +00:00
George Amanakis
482eeef804 Teach zpool scrub to scrub only blocks in error log
Added a flag '-e' in zpool scrub to scrub only blocks in error log. A
user can pause, resume and cancel the error scrub by passing additional
command line arguments -p -s just like a regular scrub. This involves
adding a new flag, creating new libzfs interfaces, a new ioctl, and the
actual iteration and read-issuing logic. Error scrubbing is executed in
multiple txg to make sure pool performance is not affected.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Co-authored-by: TulsiJain tulsi.jain@delphix.com
Signed-off-by: George Amanakis <gamanakis@gmail.com>
Closes #8995
Closes #12355
2023-05-18 11:59:42 -07:00
Brian Behlendorf
e34e15ed6d
Add the ability to uninitialize
zpool initialize functions well for touching every free byte...once.
But if we want to do it again, we're currently out of luck.

So let's add zpool initialize -u to clear it.

Co-authored-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Rich Ercolani <rincebrain@gmail.com>
Closes #12451 
Closes #14873
2023-05-18 10:02:20 -07:00
Cheng Cui
e5738ee04b
Under RSS, assign a TCP flow's inp_flowid anyway.
Summary:
This brings some benefit of a tcp flow identification for some kernel
modules, such as siftr.

Reviewers: rrs, rscheff, tuexen, #transport!
Approved by: tuexen (mentor), rrs
Subscribers: imp, melifaro, glebius
Differential Revision: https://reviews.freebsd.org/D40061
2023-05-18 11:11:53 -04:00
Peter Wemm
e829181c65
libc: Update copyright text to match current templates. 2023-05-18 11:30:10 -07:00
Jesse Rosenstock
6de1a005d4 traceroute.8: Document TOS as DiffServ and ECN
Reviewed by: imp,karels
Pull Request: https://github.com/freebsd/freebsd-src/pull/744
2023-05-18 11:17:24 -06:00
Dmitry Chagin
1d76741520 linux(4): Implement ptrace_pokeusr for x86_64
Differential Revision:	https://reviews.freebsd.org/D40097
MFC after:		1 week
2023-05-18 20:02:35 +03:00
Dmitry Chagin
3d0addcd35 linux(4): Make ptrace_pokeusr machine dependent
Differential Revision:	https://reviews.freebsd.org/D40096
MFC after:		1 week
2023-05-18 20:01:12 +03:00
Dmitry Chagin
dd2a6cd701 linux(4): Make ptrace_peekusr machine dependend
And partially implement it for x86_64.

Differential Revision:	https://reviews.freebsd.org/D40095
MFC after:		1 week
2023-05-18 20:00:12 +03:00
Dmitry Chagin
38a137f416 linux(4): Move linux_debug decalration to linux_util.h
To avoid inclusion of linux_mib.h with linux_util.h in cases where
we need rate limiting macro.

MFC after:		1 week
2023-05-18 19:58:23 +03:00
Kristof Provost
33ff01cebc carp tests: test unicast carp via link-local addresses
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-05-18 17:47:04 +02:00
Kristof Provost
c2c28c0fa2 carp: fix unicast link-local
If the peer6 address is a link-local address we have to embed the
scopeid, much like we have to for IPv6 multicast as well.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-05-18 17:47:03 +02:00