Commit Graph

283905 Commits

Author SHA1 Message Date
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
Kristof Provost
2d9d97e66e ifconfig: improve error checking for carp peer6
getaddrinfo() returns 0 if it succeeded, but it's not guaranteed to
return 1 on error. Check for success rather than for one specific error.

Without this fix commands such as `ifconfig bnxt1 inet6 add vhid 1 peer6
2001:db8::1/64` would segfault ifconfig.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
2023-05-18 17:47:03 +02:00
Bjoern A. Zeeb
2e6756b752 ifconfig: improve trimming off interface number at end
When trying to auto-load a module, we trim the interface number off
the end.  Currently we stop at the first digit.  For interfaces which
have numbers in the driver name this does not work well.
In the current example ifconfig ath10k0 would load ath(4) instead of
ath10k(4).  For module/interface names like rtw88[0] we never guess
correctly.
To improve for the case we can, start trimming off digits from the
end rather than the front.

Sponsored by:	The FreeBSD Foundation
Reported by:	thierry
MFC after:	20 days
Reviewed by:	melifaro, thierry
Differential Revision: https://reviews.freebsd.org/D40137
2023-05-18 15:22:53 +00:00
Colin Percival
dc5361ea16 rc.d/netif: Don't DAD if lo0 is the only IPv6 IF
The code in rc.d/netif waiting for IPv6 Duplicate Address Detection if
any network interfaces support IPv6.  Unfortunately, since lo0 *always*
has IPv6 enabled, this means unconditionally sleeping, even on systems
which have no external IPv6 interfaces.

Since we presume that there is little risk of a duplicate address being
assigned on lo0, amend the test to wait only if there is an interface
*other than lo0* which supports IPv6.

Reviewed by:	bz
Differential Revision:	https://reviews.freebsd.org/D40141
2023-05-18 08:20:15 -07:00
Dmitry Chagin
0f62290e7f linux(4): Check fd passed to unlockpt()
In our implementation, grantpt() and unlockpt() don't actually have
any use, because PTY's are created on the fly and already have proper
permissions upon creation.
Atleast check that a proper fd passed to unlockpt(). For grantpt()
Glibc calls TIOCGPTN ioctl which would fail if fd is not a master.

Differential Revision:	https://reviews.freebsd.org/D40100
MFC after:		1 week
2023-05-18 10:55:39 +03:00
Gleb Smirnoff
743516d51f ktls: don't try to unlock pcb if tcp_drop() already did
Reviewed by:	rrs, gallatin
2023-05-17 10:25:28 -07:00
Kajetan Staszkiewicz
8c23afdb57 pf: Standardize rtableid
Prepare for rtableid being included in struct pfsync_state where it will
be int32_t. Make variables which will be set to and from it the same
width.

Reviewed by:	kp
Sponsored by:	InnoGames GmbH
Differential Revision:	https://reviews.freebsd.org/D40013
2023-05-17 15:57:42 +02:00
Corvin Köhne
26d9f973d8
bhyve: error out if fwcfg user file isn't read completely
At the moment, fwcfg reads the file once at startup and passes these
data to the guest. Therefore, we should always read the whole file.
Otherwise we should error out.

Additionally, GCC12 complains that the comparison whether
fwcfg_file->size is lower than 0 is always false due to the limited
range of data type.

Reviewed by:		markj
Fixes:			ca14781c81 ("bhyve: add cmdline option for user defined fw_cfg items")
MFC after:		1 week
Sponsored by:		Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D40076
2023-05-17 15:39:37 +02:00
Kristof Provost
bdd4717752 pf: release rules lock before passing the packet to dummynet
In the Ethernet rules we held the PF_RULES lock while we called
ip_dn_io_ptr() (i.e. dummynet). That meant that we could end up back in
pf while still holding the PF_RULES lock.
That's not immediately fatal, because that lock is recursive, but still
not ideal.

There also appear to be scenarios where this can actually trigger
deadlocks.

We don't need to hold the PF_RULES lock, as long as we make a local copy
of the data we need from the rule (in this case, the action and
bridge_to target). It's safe to keep the struct ifnet pointer around,
because we remain in NET_EPOCH.

See also:	https://redmine.pfsense.org/issues/14373
MFC after:	1 week
Reviewed by:	mjg
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D40067
2023-05-17 15:20:18 +02:00
Andrew Turner
37c1ef5ac0 Move the arm64 sigcode to .rodata
The kernel doesn't execute this code, it's only ever copied to
userspace. Move it to .rodata as we don't need to modify it.

Sponsored by:	Arm Ltd
Differential Revision:	https://reviews.freebsd.org/D39399
2023-05-17 12:28:45 +01:00
Bjoern A. Zeeb
71fde8e507 LinuxKPI: add ns_to_timespec64()
Add ns_to_timespec64() which does not seem to require anything from
us given timespec64 is aliases to timespec.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D40123
2023-05-17 10:22:07 +00:00
Piotr Kubaj
2e57f7bf20 ix(4): correct max MTU
The max MTU for the ix(4) is 9710.

Differential revision:	https://reviews.freebsd.org/D40003
Approved by:	erj, bcr
2023-05-17 12:16:22 +02:00
Piotr Kubaj
d0cdec7a20 em: sync platform detection with Linux
Switch 16 and 23 adapters from tgp to adp.

PR:	270929
Differential revision:	https://reviews.freebsd.org/D39977
Approved by:	erj, kbowling
2023-05-17 12:14:02 +02:00
Alexander V. Chernikov
b50e1465e8 routing: plug mbuf leak for the packets hitting IPv6 blackhole route
Reported by:	Dmitriy Smirnov <fox@sage.su>
Tested by:	Dmitriy Smirnov <fox@sage.su>
MFC after:	1 day
2023-05-17 09:06:04 +00:00
Alexander V. Chernikov
4c63ecf5c7 routing: fix panic triggered by the 'gr_idx != 0' assert in nhg code
Nexthop groups can be referenced by the external code. The reference
 can be released after the VNET destruction. Furthermore, nexthop
 groups use a single per-rib lock, which is destroyed during the
 VNET desctruction. To eliminate use-after-free problem, each nhg
 is marked as "unlinked" during the VNET destruction stage, leaving
 nhg_idx intact. Normally there should not be such nexthops, but if
 there are any, the kernel will panic on 'gr_idx != 0' when the
 last nhg reference is released.

Address this by using the assert checks only when the nexthop group
 is destroyed during "valid" VNET lifetime.

MFC after:	3 days
2023-05-17 08:40:29 +00:00
Konstantin Belousov
848d5bb1ab net/if_var.h: consistently use if_t over struct ifnet *
Reviewed by:	jhibbits
Sponsored by:	NVidia networking
Differential revision:	https://reviews.freebsd.org/D40125
2023-05-17 06:31:07 +03:00
Konstantin Belousov
616a6c9f66 net/if.h: fix style of if_t definition
Reviewed by:	jhibbits
Sponsored by:	NVidia networking
Differential revision:	https://reviews.freebsd.org/D40125
2023-05-17 06:30:59 +03:00
Kajetan Staszkiewicz
cdc231bd49 pfsync: Remove deletion of states using the full pfsync_state struct
State deletions are sent over pfsync using struct pfsync_del_c.

Remove the code for receiving state deletions using struct pfsync_state
as such deletions are never sent. Rename functions and constants so that
only the "compressed" versions remain.

Reviewed by:	kp
Sponsored by:	InnoGames GmbH
Differential Revision:	https://reviews.freebsd.org/D40004
2023-05-17 02:39:58 +02:00
Bjoern A. Zeeb
262c5e8193 LinuxKPI: skbuff.h: add skb_hwtstamps(), implement *mac_header()
Add a dummy skb_hwtstamps() function for now, and implement
skb_mac_header(), skb_reset_mac_header(), and skb_set_mac_header().

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
2023-05-16 21:26:50 +00:00
Bjoern A. Zeeb
972bf40b62 LinuxKPI: add ptp_clock_kernel.h
Add the new ptp_clock_kernel.h with structs and dummy functions for
kernel ptp support.  This is needed for the next iwlwifi update.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
2023-05-16 21:26:40 +00:00
Dmitry Chagin
0282f87530 ktrace: Simplify ae6ac587, drop the sa var declaration
Suggested by:		kib
MFC after:		5 days
2023-05-16 22:46:26 +03:00
Alexander V. Chernikov
4c91a5dfe4 ifconfig: make interface and address listing use Netlink as transport
Differential Revision: https://reviews.freebsd.org/D40044
2023-05-16 19:39:13 +00:00
Alexander V. Chernikov
10b94e4064 netlink: add support for adding/deleting interface addresses
Differential Revision: https://reviews.freebsd.org/D40103
MFC after:	2 weeks
2023-05-16 19:39:13 +00:00