Commit Graph

142818 Commits

Author SHA1 Message Date
Dmitry Chagin
ee55d560e8 linux(4): Add a simple rseq syscall implementation.
To avoid annoyng messages from glibc-2.35 test suite add the simple
implementation of rseq syscall which is do nothing for now.

I plan to implement it if and when the API stabilizes.

MFC after:	2 weeks
2022-04-26 19:35:56 +03:00
Dmitry Chagin
75e409495f linux(4): Regen for rseq syscall. 2022-04-26 19:35:55 +03:00
Dmitry Chagin
f202f35db0 linux(4): Change rseq syscall definition to match Linux actual one.
MFC after:	2 weeks
2022-04-26 19:35:54 +03:00
Doug Moore
fa8a6585c7 vm_phys: avoid waste in multipage allocation
In vm_phys_alloc_contig, for an allocation bigger than the size of any
buddy queue free block, avoid examining any maximum-size free block
more than twice, by only starting to consider a sequence of adjacent
max-blocks starting at a max-block that does not follow another
max-block.  If that first max-block follows adjacent blocks of smaller
size, and if together they provide enough memory to reduce by one the
number of max-blocks required for this allocation, use them as part of
this allocation.

Reviewed by:	markj
Tested by:	pho
Discussed with:	alc
Differential Revision:	https://reviews.freebsd.org/D34815
2022-04-26 02:56:23 -05:00
John Baldwin
651a887f4e xen: Use devclass_find to lookup devclasses in identify.
While here, use driver->name instead of hardcoding the xenpv and
xen_et strings both for devclass_find() and BUS_ADD_CHILD().

Reviewed by:	Elliott Mitchell <ehem+freebsd@m5p.com>, imp, royger
Differential Revision:	https://reviews.freebsd.org/D35001
2022-04-25 11:55:30 -07:00
Warner Losh
ccaec73d0b ada: Eliminate dead code
We never use the cgd that we get from the XPT_GDEV_TYPE call. Prior to
9a6844d55f we used it to determine if READ AHEAD or WRITE CACHING was
supported. However, all that information was moved into adasetflags so
we no longer need to this since it's cached in the softc and updated
with the IDENTIFY data changes automatically.

Sponsored by:		Netflix
Reviewed by:		mav
Differential Revision:	https://reviews.freebsd.org/D35039
2022-04-25 12:55:04 -06:00
Warner Losh
9d899bbcb7 cam: Small reorg of ata xpt async code
Use a switch rather than a nested if to simplify the async event
processing code. No functional changes intended.

Sponsored by:		Netflix
Reviewed by:		mav
Differential Revision:	https://reviews.freebsd.org/D35038
2022-04-25 12:55:04 -06:00
Mark Johnston
efb8f0b8db linuxkpi: Mitigate a seqlock livelock
Disable preemption in seqlock write sections when using the _irqsave
variant.  This ensures that a writer can't be preempted and subsequently
starved by a reader running in a callout handler on the same CPU.

This fixes occasional display hangs seen when using the i915 driver.

Tested by:	emaste, wulf
Reviewed by:	wulf, hselasky
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35021
2022-04-25 09:13:03 -04:00
Bjoern A. Zeeb
b3e7f403a5 LinuxKPI: 802.11 ieee80211_sn_sub() fix
In ieee80211_sn_sub() we need to shift the mask before applying it.
This fixes the logic from 978f25e840.

Reported by:	J.R. Oldroyd (fbsd opal.com)
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2022-04-25 11:35:57 +00:00
Dmitry Chagin
4a700f3c32 sigtimedwait: Prevent timeout math overflows.
Our kern_sigtimedwait() calculates absolute sleep timo value as 'uptime+timeout'.
So, when the user specifies a big timeout value (LONG_MAX), the calculated
timo can be less the the current uptime value.
In that case kern_sigtimedwait() returns EAGAIN instead of EINTR, if
unblocked signal was caught.

While here switch to a high-precision sleep method.

Reviewed by:		mav, kib
In collaboration with:	mav
Differential revision:	https://reviews.freebsd.org/D34981
MFC after:		2 weeks
2022-04-25 10:23:15 +03:00
Dmitry Chagin
6201a50d0d linux(4): Refactor signal send methods.
Created a couple of helpers to send signals to the specific thread or to
the whole process. Use helpers in the corresponding syscalls.
This fixes the confusion where a signal destined for a whole process
was sent to a specific thread and vice versa.
There is an exclusion for the linux_kill() syscall that takes a pid
argument and should send a signal to the whole process, but I know
at least one example where kill() takes tid.

MFC after:		2 weeks
2022-04-25 10:22:51 +03:00
Dmitry Chagin
fe894a3705 linux(4): Check that the thread tid in the thread group pid in linux_tdfind().
MFC after:		2 weeks
2022-04-25 10:21:51 +03:00
Dmitry Chagin
bbddd5881d linux(4): Microoptimize bsd_to_linux_sockaddr().
Differential Revision:	https://reviews.freebsd.org/D34725
MFC after:		2 weeks
2022-04-25 10:21:20 +03:00
Dmitry Chagin
91e7bdcdcf Add timespecvalid_interval macro and use it.
Reviewed by:		jhb, imp (early rev)
Differential revision:	https://reviews.freebsd.org/D34848
MFC after:		2 weeks
2022-04-25 10:20:54 +03:00
Kevin Lo
5586515ab1 Add a new RDC phy
Reviewed by:	jhb
Obtained from:	NetBSD via Andrius V
Differential Revision:	https://reviews.freebsd.org/D35034
2022-04-25 10:00:58 +08:00
Kevin Lo
8f216d282c Restore original MDC speed control register value after MAC reset, if it
wasn't default

Since vte_reset changes register value to MDCSC_DEFAULT value, which may not
be the original value, thus causing some phy registers read failures.
Restoring VTE_MDCSC value to original after reset solves the link state
flapping issue.

Thanks to jhb ("the code looks ok") for his review.
Reviewed by:	jhb
Obtained from:	NetBSD via Andrius V
Differential Revision:	https://reviews.freebsd.org/D34956
2022-04-25 09:56:20 +08:00
Warner Losh
b43cfe7171 ada/da: Borrow comment from nda about cleanup
Remove a XXX comment and replace it with a more accurate comment about
what happens to I/O queued to the hardware.

Sponsored by:		Netflix
2022-04-24 15:11:56 -06:00
Warner Losh
48ae3f4f64 ata/nvme: Add comment
Steal the comment from daonninvalidate about the call to disk_gone().

Sponsored by:		Netflix
2022-04-24 15:11:52 -06:00
Warner Losh
347a8e93fe g_vfs_done: Only report ENXIO once
The contract with the lower layers is that once ENXIO is reported, all
further I/O to the device is not possible. This is reported when the
device departs for good or changes in some material manner out from
underneath the system. Since the lower layers terminate all pending I/O
when this is detected with ENXIO, reporting more than one provides no
extra value. ENXIO suppression done with atomics due to race described
in e8827f4094. It's on the error path and a rare event, so this won't affect
performance.

Sponsored by:		Netflix
Reviewed by:		mckusick, kib
Differential Revision:	https://reviews.freebsd.org/D35034
2022-04-24 14:01:33 -06:00
Warner Losh
e8827f4094 g_vfs_done: Report when we switch on ENXIO conversion
On the 0 -> 1 transition of sc_enxio_active, report that we're doing
this. This is a rare, but interesting, event. Convert to using atomics
to set this field to prevent a rare race:

    In CAM, when we invalidate a device, one thread (T1) will start the
    process in error processing called from *dadone
    (cam_periph_error). This routine will queue work to xpt_async_td
    (T2) and indicate to *dadone to call biodone(ENXIO) for the bio. T2
    wakes up and basically waits to acquire the periph lock. T2 will do
    so when T1 drops the periph lock just before T1's call to
    biodone. T2 acquires the lock and calls biodone(ENXIO) on all
    pending bios. These two threads will race and we could lose the
    printf or get two in rare cases. Since we only touch sc_enxio_active
    in an error path that's infrequent, the extra atomic traffic will be
    rare but will ensure robustness.

Sponsored by:		Netflix
Reviewed by:		kib
Differential Revision:	https://reviews.freebsd.org/D35037
2022-04-24 14:01:08 -06:00
Warner Losh
f58385f3da geom_vfs: make sc_orphaned a bool
Differential Revision:	https://reviews.freebsd.org/D35036
Sponsored by:		Netflix
2022-04-24 14:01:08 -06:00
Warner Losh
965e919506 bio: Add the speedup flags to PRINT_BIO_FLAGS
The BIO_SPEEDUP_WRITE and BIO_SPEEDUP_TRIM bits are part of the flags
word, so print them as such.

Sponsored by:		Netflix
Differential Revision:	https://reviews.freebsd.org/D35035
2022-04-24 14:01:08 -06:00
Warner Losh
c08ceddbf7 nda: Fix comment
Fix a comment that was left over from the orignial
implementation. Explain how pending transactions in hardware are
completed/aborted in the SIM prior to ndacleanup being called.

Sponsored by:		Netflix
2022-04-23 20:31:46 -06:00
Alexander Motin
38f8addaab CAM: Replicate e0ceec676d from da to ada and nda.
MFC after:	1 week
2022-04-23 20:15:17 -04:00
John Baldwin
a8280123e4 KTLS: Add a new recrypt operation to the software backend.
When using NIC TLS RX, packets that are dropped and retransmitted are
not decrypted by the NIC but are passed along as-is.  As a result, a
received TLS record might contain a mix of encrypted and decrypted
data.  If this occurs, the already-decrypted data needs to be
re-encrypted so that the resulting record can then be decrypted
normally.

Add support for this for sessions using AES-GCM with TLS 1.2 or TLS
1.3.  For the recrypt operation, allocate a temporary buffer and
encrypt the the payload portion of the TLS record with AES-CTR with an
initial IV constructed from the AES-GCM nonce.  Then fixup the
original mbuf chain by copying the results from the temporary buffer
back into the original mbufs for any mbufs containing decrypted data.

Once it has been recrypted, the mbuf chain can then be decrypted via
the normal software decryption path.

Co-authored by:	Hans Petter Selasky <hselasky@FreeBSD.org>
Reviewed by:	hselasky
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D35012
2022-04-22 15:52:50 -07:00
John Baldwin
663ae8f7f9 KTLS: Construct IV directly in crp.crp_iv for TLS 1.3 AEAD encryption.
Previously this used a temporary nonce[] buffer.  The decrypt hook for
TLS 1.3 as well as the hooks for TLS 1.2 already constructed the IV
directly in crp.crp_iv.

Reviewed by:	hselasky
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D35027
2022-04-22 15:52:27 -07:00
John Baldwin
a4c5d490f6 KTLS: Move OCF function pointers out of ktls_session.
Instead, create a switch structure private to ktls_ocf.c and store a
pointer to the switch in the ocf_session.  This will permit adding an
additional function pointer needed for NIC TLS RX without further
bloating ktls_session.

Reviewed by:	hselasky
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D35011
2022-04-22 15:52:12 -07:00
John Baldwin
f2d166d532 amd64 NOTES: Add entries for qlxgb, glxgbe, and glxge. 2022-04-22 15:18:06 -07:00
John Baldwin
5bf623bbcd amd64 NOTES: Sort the axp entry. 2022-04-22 15:18:06 -07:00
John Baldwin
618aa8cd0a qlxgb/qlxgbe/qlxge: Fix build without INET and/or without INET6.
This is in preparation for adding these drivers to amd64 NOTES.
2022-04-22 15:18:05 -07:00
Mateusz Guzik
f7daf71038 iwm: plug set-but-not-used vars
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-04-22 22:16:25 +00:00
Kristof Provost
e68b35e408 Bump __FreeBSD_version for udp_tun_func_t() prototype change
742e7210d0 changed the prototype of udp_tun_func_t(). Bump
__FreeBSD_version so that external modules can #ifdef for it as
required.

PR:		263297
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-04-22 20:04:38 +02:00
Reid Linnemann
0abcc1d2d3 pf: Add per-rule timestamps for rule and eth_rule
Similar to ipfw rule timestamps, these timestamps internally are
uint32_t snaps of the system time in seconds. The timestamp is CPU local
and updated each time a rule or a state associated with a rule or state
is matched.

Reviewed by:	kp
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D34970
2022-04-22 19:53:20 +02:00
Kristof Provost
797b94504f udp6: allow udp_tun_func_t() to indicate it did not eat the packet
Implement the same filter feature we implemented for UDP over IPv6 in
742e7210d. This was missed in that commit.

Pointed out by:	markj
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-04-22 16:55:23 +02:00
John F. Carr
f010b9c2b9 pci: recognize "non-essential instrumentation" devices
Some AMD EPYC VCPUs generated boot message of the type:

     pci4: <unknown> at device 0.0 (no driver attached)

These are displayed for device class 0x13 devices, e.g.:

none8@pci0:130:0:0:	class=0x130000 rev=0x00 hdr=0x00 vendor=0x1022 \
			device=0x148a subvendor=0x1022 subdevice=0x148a
    vendor     = 'Advanced Micro Devices, Inc. [AMD]'
    device     = 'Starship/Matisse PCIe Dummy Function'
    class      = non-essential instrumentation

Since these devices serve no purpose (no driver attaches) I have
enabled the reporting of suich devices only for verbose boots (a
diversion from the patch provided in the PR).

A verbose boot will now display such devices as:

  pci4: <non-essential instrumentation> at device 0.0 (no driver attached)

PR:		263469
Reported by:	jfc@mit.edu (John F. Carr)
MFC after:	1 week
2022-04-22 16:39:23 +02:00
Adrian Chadd
e8de31cace net80211: Fix traffic hang on STA/AP VAPs on a multi-VAP interface
This took an embarrasingly long time to find.

The state changes for a radio with a STA /and/ AP VAP gets a bit messy.
The AP maps are marked as waiting, waiting for the STA AP to find a
channel to use before the AP VAPs become active.

However, the code path that clears the OACTIVE flag on a VAP only runs
during a successful run of ieee80211_newstate_cb().

So here is how it goes:

* the STA VAP goes down and needs to scan;
* the AP vap goes RUN->INIT; but it doesn't YET call ieee80211_newstate_cb();
* meanwhile - a send on the AP VAP causes the VAP to set the OACTIVE flag here;
* then the STA VAP finishes scan and goes to RUN;
* which will call wakeupwaiting() as part of the STA VAP transition to RUN;
* .. then the AP VAP goes INIT->RUN directly via a call to hostap_newstate
  in wakeupwaiting rather than it being through the deferred path;
* /then/ the ieee80211_newstate_cb() is called, but it sees the state go
  RUN->RUN;
* .. which results in the OACTIVE flag never being cleared.

This clears the OACTIVE flag when a VAP transitions RUN->RUN; the
driver layer or net80211 layer can set it if required in a subsequent
transmit.

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

Reviewed by: bz
2022-04-21 22:49:01 -07:00
Piotr Kubaj
1d307cc85c powerpc: add GENERIC64LE-NODEBUG config and improve GENERIC64-NODEBUG
Also remove whitespace from GENERIC-NODEBUG.

Approved by: jhibbits (src)
Differential review:	https://reviews.freebsd.org/D34785
2022-04-22 01:06:13 +02:00
John Baldwin
d96f81b0c5 qlxge: Inline the one use of a variable only used in a debug trace.
The other QL_DPRINT*() invocations in qls_init_hw_if() all used the
expanded form instead of the local variable.  The module build always
defines QL_DBG in CFLAGS so doesn't trip over this, but adding qlxge
to a kernel config builds without QL_DBG.

Reported by:	olivier
2022-04-21 14:01:02 -07:00
John Baldwin
a6c09f20e8 psm: Swap the unit member in the softc for a device_t.
This entails various changes to make this driver more "modern"
(new-bus vs pre-new-bus) using device_log() and device_printf() rather
than psm%d.  It also fixes the device_busy/unbusy calls to use sc->dev
directly rather than looking the device_t up via the devclass and
unit.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D35006
2022-04-21 13:52:48 -07:00
John Baldwin
4b337ada34 KTLS: Free the MAC session when destroying AES-CBC software sessions.
Reviewed by:	hselasky
MFC after:	1 week
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D35013
2022-04-21 13:49:40 -07:00
John Baldwin
92e40a9b92 busdma_bounce: Batch bounce page free operations when possible.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D34968
2022-04-21 12:01:55 -07:00
John Baldwin
d4ab3a8d4f busdma_bounce: Add free_bounce_pages helper function.
Deduplicate code to iterate over the bpages list in a bus_dmamap_t
freeing bounce pages during bus_dmamap_unload.

Reviewed by:	imp
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D34967
2022-04-21 10:42:14 -07:00
John Baldwin
10fe9a1fb4 busdma_bounce: Make the map waiting list per-bounce-zone.
When pages are freed to a bounce zone, only maps waiting for pages for
that zone can make forward progress.  If a map for a different bounce
zone is at the head of the global list, then requests that could
otherwise make forward progress will be stalled waiting on the other
bounce zone.  If bounce zones shared bounce pages then a global list
would still make sense to prevent "later" requests from starving an
earlier request but that is not a concern with per-zone bounce page
pools.

Reviewed by:	imp
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D34966
2022-04-21 10:41:09 -07:00
John Baldwin
d11f5d4762 busdma_bounce: Use a simple kproc to invoke deferred requests.
Rather than using a software interrupt with a single handler, just
create a dedicated kernel process woken up with a simple wakeup().

Reviewed by:	imp
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D34965
2022-04-21 10:40:35 -07:00
John Baldwin
c7aa0304d5 Run softclock threads at a hardware ithread priority.
Add a new PI_SOFTCLOCK for use by softclock threads.  Currently this
maps to PI_AV which is the second-highest ithread priority.

Reviewed by:	mav, kib
Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D33693
2022-04-21 10:40:01 -07:00
John Baldwin
1ac10fa429 acpi_toshiba: Use device_get_softc in attach.
Rather than a detour via the devclass and hardcoding unit 0.

While here, remove a check for sc being NULL.  It will never be NULL
when attach is called.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D35010
2022-04-21 10:29:15 -07:00
John Baldwin
c1d90b2d02 vgapm: Use devclass_find to lookup the vga devclass in suspend and resume.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D35009
2022-04-21 10:29:15 -07:00
John Baldwin
0b377a49fa FB_INSTALL_CDEV: Remove this option and related code.
This option was never enabled in GENERIC and does not appear to work
(the cdevsw is stored in a global array but never passed to make_dev
to be associated with a character device).

Reviewed by:	emaste
Differential Revision:	https://reviews.freebsd.org/D35008
2022-04-21 10:29:14 -07:00
John Baldwin
6b06f746db sc: Use devclass_find to lookup the sc devclass.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D35007
2022-04-21 10:29:14 -07:00
John Baldwin
108adb2ff5 arcmsr: Remove never-true NULL check from cdev callbacks.
si_drv1 will always hold a non-NULL pointer.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D35005
2022-04-21 10:29:14 -07:00
John Baldwin
a9e5e04e64 arcmsr: Store softc pointer in si_drv1 of cdev.
Rather than fetching the softc using the controller's unit number as
an index into the devclass.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D35004
2022-04-21 10:29:14 -07:00
John Baldwin
907f35efff ccp: Use devclass_find to lookup devclass in db_show_ccp.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D35003
2022-04-21 10:29:14 -07:00
John Baldwin
3d7e90fc20 cpufreq_curr_sysctl: Use devclass_find to lookup cpufreq devclass.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D35002
2022-04-21 10:29:14 -07:00
John Baldwin
e9d92100c7 hidbus: Use devclass_find to lookup the devclass for hidbus.
Reviewed by:	wulf, imp
Differential Revision:	https://reviews.freebsd.org/D35000
2022-04-21 10:29:14 -07:00
John Baldwin
9b6761bd13 twe: Use devclass_find in twe_report debug function.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D34999
2022-04-21 10:29:14 -07:00
John Baldwin
13bebcd35f pcm: Initialize pcm_devclass in sound_modevent.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D34998
2022-04-21 10:29:14 -07:00
John Baldwin
8109ec9d89 pcm: Remove dead code from sound_modevent.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D34997
2022-04-21 10:29:14 -07:00
John Baldwin
489e8f24a5 smbios/vpd: Use devclass_find to lookup devclass in module event handler.
While here, use a modern function declaration for smbios_modevent and
vpd_modevent.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D34996
2022-04-21 10:29:14 -07:00
John Baldwin
82496a256f nvme: Use devclass_find to lookup the nvme devclass.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D34995
2022-04-21 10:29:14 -07:00
John Baldwin
967949e7c5 mlx: Use devclass_find to lookup the devclass for mlxd.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D34994
2022-04-21 10:29:14 -07:00
John Baldwin
517a8a715a hptiop: Store softc pointer in si_drv1 of cdev.
Rather than fetching the softc using the controller's unit number as
an index into the devclass.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D34993
2022-04-21 10:29:13 -07:00
John Baldwin
5a03f17a9a acpi_tz: Lookup devclass by name when needed.
Cache the value in a local variable in the worker thread.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D34992
2022-04-21 10:29:13 -07:00
John Baldwin
9066471175 acpi_isab: Check the unit in probe instead of using the devclass.
This is an alternate way to only attach to isab0 for the reasons
described in commit 852989bdbf.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D34991
2022-04-21 10:29:13 -07:00
John Baldwin
33883cdce4 acpi_hpet: Use devclass_find to find devclass in identify.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D34990
2022-04-21 10:29:13 -07:00
John Baldwin
97c076d237 acpi_ec: Use device_get_devclass to find devclass in probe.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D34989
2022-04-21 10:29:13 -07:00
John Baldwin
e206dddcfe acpi_cpu: Use device_get_devclass to find devclass in attach.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D34988
2022-04-21 10:29:13 -07:00
John Baldwin
3730d6aa8f acpi_apei: Use devclass_find to find devclass in identify.
Reviewed by:	mav
Differential Revision:	https://reviews.freebsd.org/D34987
2022-04-21 10:29:13 -07:00
John Baldwin
5a84b710a9 acpi_acad: Use devclass_find to find the acpi_acad devclass.
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D34986
2022-04-21 10:29:13 -07:00
Mark Johnston
5d691ab4f0 mld6: Ensure that mld_domifattach() always succeeds
mld_domifattach() does a memory allocation under the global MLD mutex
and so can fail, but no error handling prevents a null pointer
dereference in this case.  The mutex is only needed when updating the
global softc list; the allocation and static initialization of the softc
does not require this mutex.  So, reduce the scope of the mutex and use
M_WAITOK for the allocation.

PR:		261457
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D34943
2022-04-21 13:23:59 -04:00
Kristof Provost
efc64d02a6 pf: counter argument to pfr_pool_get() may never be NULL
Coverity points out that if counter was NULL when passed to
pfr_pool_get() we could potentially end up dereferencing it.
Happily all users of the function pass a non-NULL pointer. Enforce this
by assertion and remove the pointless NULL check.

Reported by:	Coverity (CID 273309)
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-04-21 17:59:45 +02:00
Kristof Provost
4302035063 pfsync: NULL check before dereference
Move the use of 'sc' to after the NULL check.
It's very unlikely that we'd actually hit this, but Coverity is correct
that it's not a good idea to dereference the pointer and only then NULL
check it.

Reported by:	Coverity (CID 1398362)
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-04-21 17:59:45 +02:00
Kristof Provost
ed6287c141 pf: remove pointless NULL check
pfi_kkif_attach() always returns non-NULL, and we dereference the
pointer before we check it, so that's pointless.

Reported by:	Coverity (CID 1007345)
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-04-21 17:59:45 +02:00
Hans Petter Selasky
cda31e7349 xhci(4): Ensure the so-called data toggle gets properly reset.
Use the drop and enable endpoint context commands to force a reset of
the data toggle for USB 2.0 and USB 3.0 after:
 - clear endpoint halt command (when the driver wishes).
 - set config command (when the kernel or user-space wants).
 - set alternate setting command (only affected endpoints).

Some XHCI HW implementations may not allow the endpoint reset command when
the endpoint context is not in the halted state.

Reported by:		Juniper and Gary Jennejohn
MFC after:		1 week
Sponsored by:		NVIDIA Networking
2022-04-21 17:01:13 +02:00
Misho
0c6a2fa33e if_bnxt: Allow bnxt interfaces to use vlans
When VLAN HW filter is disabled, the NIC does not pass any vlan tagged
traffic. Setting these flags on the device allows vlan tagged traffic to
pass.

PR:		236983
Tested by:	pi
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D34824
2022-04-21 09:31:51 +01:00
Konstantin Belousov
d282bb42c3 syscons: silent 'set but unused' warning in some configurations
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2022-04-21 01:55:12 +03:00
Doug Moore
11fced21cc dev/iommu: Include offset in maxaddr check.
If iommu_gas_match_one has to adjust for a boundary crossing, its
check against maxaddr includes 'offset' in its calculation, to ensure
that the allocated memory does not exceed the max address. However, if
there's no boundary crossing adjustment, then the maxaddr check
disregards 'offset'. Fix that.

Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D34978
2022-04-20 17:24:11 -05:00
Kristof Provost
a879e40ca2 callout: fix using shared rmlocks
15b1eb142c changed the callout code to store the CALLOUT_SHAREDLOCK flag
in c_iflags (where it used to be c_flags), but failed to update the
check in softclock_call_cc(). This resulted in the callout code always
taking the write lock, even if a read lock had been requested (with
the CALLOUT_SHAREDLOCK flag in callout_init_rm()).

Reviewed by:	markj
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D34959
2022-04-20 13:06:50 +02:00
Kristof Provost
812839e5aa pf: allow the use of tables in ethernet rules
Allow tables to be used for the l3 source/destination matching.
This requires taking the PF_RULES read lock.

Sponsored by:	Rubicon Communications, LLC ("Netgate")
Differential Revision:	https://reviews.freebsd.org/D34917
2022-04-20 13:01:12 +02:00
Gordon Bergling
7fad3ed8e9 iicbus(4): Fix two typos in kernel error messages
- s/occured/occurred/

MFC after:3 days
2022-04-20 12:55:44 +02:00
Gordon Bergling
88cdccff3f oce(4): Fix a typo in a sysctl description
- s/interupt/interrupt/

MFC after:	3 days
2022-04-20 12:51:52 +02:00
Kornel Duleba
06f659c39d dmar: Disable PMR in driver attach routine
Previously it was disabled right before translation was enabled.
This way the disable logic is still executed even when translation
is not be activated, e.g. with hw.iommu.dma=0 tunable set.
On some platforms we need to disable PMR in order for core dump to work.
At the same time it was observed that enabling translation has
a significant impact on network performance.
With this patch PMR can be disabled, with IOMMU translation not being
turned on by appending the following to the loader.conf:

hw.dmar.enable=1
hw.dmar.pmr.disable=1
hw.dmar.dma=0

Sponsored by: Stormshield
Obtained from: Semihalf
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D34907
2022-04-20 09:40:28 +02:00
Wojciech Macek
14b7706264 mac_pimd: Support for privilege drop in pimd
Create new kernel module for privilege check in case
the user wants to run pimd daemon.

Sponsored by:		Stormshield
Obtained from:		Semihalf
2022-04-20 08:07:37 +02:00
Michael Tuexen
89c6aba7cf sctp: cleanup
MFC after:	3 days
2022-04-19 21:40:22 +02:00
Michael Tuexen
868868f14e sctp: improve stopping of timers
Reported by:	syzbot+c9c70062320aaad19de7@syzkaller.appspotmail.com
MFC after:	3 days
2022-04-19 21:29:41 +02:00
John Baldwin
e8d1145d10 cxgbe: Remove unused devclass arguments to *DRIVER_MODULE().
Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D34964
2022-04-19 10:44:08 -07:00
John Baldwin
2a99dd30df Deprecate the 'devclass' argument from *DRIVER_MODULE() macros.
This argument is useless for the vast majority of drivers.  For now,
use __VA_ARGS__ wrapper macros so that that the *DRIVER_MODULE()
macros accept both the old version (with a devclass) and the new
version (which omits the argument and stores NULL in the
driver_module_data structure).  This provides an API compatiblity
shim that can be merged to older stable branches.

Once all drivers relevant to 14.0 (both in and out of tree) have been
updated, the API compat shims can be dropped.

Reviewed by:	imp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D34963
2022-04-19 10:43:57 -07:00
John Baldwin
5bdea8826b devclass_add_driver: Permit NULL to be passed in dcp.
This permits a driver module structure that doesn't want to store a
pointer to the new driver's devclass.

Reviewed by:	imp
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D34962
2022-04-19 10:43:50 -07:00
Gordon Bergling
f45f90c5d6 videomode: Fix a typo in an kernel message
- s/Seperate/Separate/

Obtained from:	NetBSD
MFC after:	3 days
2022-04-19 17:09:52 +02:00
Stefan Eßer
ecbbb0c85e ffs: plug a set-but-not-used var 2022-04-19 16:51:12 +02:00
Alan Somers
8c47d8f538 prometheus_sysctl_exporter: fix metric aliasing
When exporting sysctls to Prometheus, the exporter replaces "." with
"_".  This caused several metrics to alias, confusing the Prometheus
server.  Fix it by:

* Renaming the "tcp_log_bucket" UMA zone to "tcp_log_id_bucket".  Also,
  rename "tcp_log_node" to "tcp_log_id_node" for consistency.

* Not exporting sysctls with "(LEGACY)" in the description.  That is
  used by ZFS sysctls that have been replaced by others, many of which
  alias to the same Prometheus metric name (like "vfs.zfs.arc_max" and
  "vfs.zfs.arc.max").

PR:		259607
Reported by:	delphij
MFC after:	2 weeks
Sponsored by:	Axcient
Reviewed by:	delphij,rew,thj
Differential Revision: https://reviews.freebsd.org/D34952
2022-04-19 06:56:39 -06:00
Mateusz Guzik
19447fc488 sfxge: plug set-but-not-used vars
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-04-19 12:45:57 +00:00
Mateusz Guzik
b338b1fd50 tcp: plug set-but-not-used vars
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-04-19 12:45:57 +00:00
Mateusz Guzik
c5c981d443 signals: plug a set-but-not-used var
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-04-19 12:45:57 +00:00
Mateusz Guzik
db2ce6914b sctp: plug set-but-not-used vars
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-04-19 12:45:57 +00:00
Mateusz Guzik
93494e425b linux: plug a set-but-not-used var
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-04-19 12:45:57 +00:00
Mateusz Guzik
11c5495554 ext2: plug a set-but-not-used var
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-04-19 12:45:57 +00:00
Mateusz Guzik
d37dca9ec9 cxgbe: plug a set-but-not-used var
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-04-19 12:45:56 +00:00
Michael Tuexen
a12d89332e sctp: hold the inp lock while calling ip6_output
This fixes an issue with handling IPPROTO_IPV6 level socket
options.

Reported by:	syzbot+66ede232c3d1271c6226@syzkaller.appspotmail.com
MFC after:	3 days
2022-04-19 13:03:08 +02:00
Mateusz Guzik
f2edc91557 uart: plug a set-but-not-used var
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-04-19 09:34:55 +00:00
Mateusz Guzik
0fd5c29944 tcp/rack: plug a set-but-not-used var
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2022-04-19 09:33:35 +00:00