]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agocxgbe: fix enabling lro & rxtimestamps
Andrew Gallatin [Wed, 26 May 2021 13:54:26 +0000 (09:54 -0400)]
cxgbe: fix enabling lro & rxtimestamps

A recent change caused iq flags, like LRO, to be set before
init_iq(). However, init_iq() clears those flags, so they
became effectively impossible to set.   This change moves
the initializion of these flags to after the call to init_iq().
This fixes LRO.

Differential Revision: https://reviews.freebsd.org/D30460
Reviewed by: np, rrs
Sponsored by: Netflix
Fixes: 43bbae19483fbde0a91e61acad8a6e71e334c8b8 <https://reviews.freebsd.org/R10:43bbae19483fbde0a91e61acad8a6e71e334c8b8>"
3 years agovmm: Let guests enable SMEP/SMAP if the host supports it
Mark Johnston [Wed, 26 May 2021 13:34:52 +0000 (09:34 -0400)]
vmm: Let guests enable SMEP/SMAP if the host supports it

Reviewed by: kib, grehan, jhb
Tested by: grehan (AMD)
MFC after: 3 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D30462

3 years agopf tests: Only log critical errors from scapy
Kristof Provost [Wed, 26 May 2021 11:07:50 +0000 (13:07 +0200)]
pf tests: Only log critical errors from scapy

See a26e895f3d803cc1f4ee1c2b33c61330998808b9. Silence these new tests as
well.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agopf: Move nvlist conversion functions to pf_nv
Kristof Provost [Tue, 18 May 2021 07:24:50 +0000 (09:24 +0200)]
pf: Move nvlist conversion functions to pf_nv

Separate the conversion functions (between kernel structs and nvlists)
to pf_nv. This reduces the size of pf_ioctl.c, which is already quite
large and complex, a good bit. It also keeps all the fairly
straightforward conversion code together.

MFC after: 1 week
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D30359

3 years agoLinuxKPI/OFED/mlx4: cleanup netdevice.h some more
Bjoern A. Zeeb [Wed, 26 May 2021 12:27:26 +0000 (12:27 +0000)]
LinuxKPI/OFED/mlx4: cleanup netdevice.h some more

This removes all unused bits from linux/netdevice.h and migrates two
inline functions into the mlx4 and ofed code respectively.

This gets the mlx4/ofed (struct ifnet) specific bits down to 7 lines
in netdevice.h.

Sponsored by: The FreeBSD Foundation
MFC after: 13 days
Reviewed by: hselasky, kib
Differential Revision: https://reviews.freebsd.org/D30461

3 years agorc.d/random: add support for zero harvest_mask
Eugene Grosbein [Wed, 26 May 2021 11:30:24 +0000 (18:30 +0700)]
rc.d/random: add support for zero harvest_mask

Replace the check for zero harvest_mask with new check for empty string.
This allows one to specify harvest_mask="0" that disables harversting
entropy from all but "pure" sources. Exact bit values for "pure" sources
differ for stable/12 and later branches, so it is handy to use zero.
The check for zero pre-dates introduction of "pure" non-maskable sources
Use empty string to disable altering sysctl kern.random.harvest.mask.

Note that notion of "pure" random sources is not documented in user level
manual pages yet. Still, it helps to extend battery life for hardware
with embedded "Intel Secure Key RNG" by disabling all other sources.

Note that no defaults changed and default behaviour is not affected.

Reported by: Dmitry Luhtionov

3 years agoUnstaticize parts of coredumping code
Edward Tomasz Napierala [Wed, 26 May 2021 09:23:37 +0000 (10:23 +0100)]
Unstaticize parts of coredumping code

This makes it possible to call __elfN(size_segments) and __elfN(puthdr)
from Linux coredump code.

Reviewed By: kib
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D30455

3 years agotcp: Add a socket option to rack so we can test various changes to the slop value...
Randall Stewart [Wed, 26 May 2021 10:43:30 +0000 (06:43 -0400)]
tcp: Add a socket option to rack so we can test various changes to the slop value in timers.

Timer_slop, in TCP, has been 200ms for a long time. This value dates back
a long time when delayed ack timers were longer and links were slower. A
200ms timer slop allows 1 MSS to be sent over a 60kbps link. Its possible that
lowering this value to something more in line with todays delayed ack values (40ms)
might improve TCP. This bit of code makes it so rack can, via a socket option,
adjust the timer slop.

Reviewed by: mtuexen
Sponsered by: Netflix Inc
Differential Revision: https://reviews.freebsd.org/D30249

3 years agoo Fix i2c read operation for large transfers (more than 32 bytes).
Ruslan Bukin [Wed, 26 May 2021 09:55:23 +0000 (10:55 +0100)]
o Fix i2c read operation for large transfers (more than 32 bytes).
o Fix slave address setting.

This allows to read the EDID from an HDMI monitor.

Reviewed by: manu
Sponsored by: UKRI
Differential Revision: https://reviews.freebsd.org/D27139

3 years agoFix a use-after-free in an error case.
Takanori Watanabe [Wed, 26 May 2021 09:23:33 +0000 (18:23 +0900)]
Fix a use-after-free in an error case.

PR: 255872
Submitted by:  lylgood
Differential Revision:  https://reviews.freebsd.org/D30454

3 years agortwn_usb(4): add Mercusys MW150US (N150 Nano) to the rtwn_usb hardware list.
Dmitry Chagin [Wed, 26 May 2021 07:13:08 +0000 (10:13 +0300)]
rtwn_usb(4): add Mercusys MW150US (N150 Nano) to the rtwn_usb hardware list.

MFC after: 2 weeks

3 years agortwn_usb(4): add revision number for D-Link DWA-121 (N150 Nano).
Dmitry Chagin [Wed, 26 May 2021 06:47:30 +0000 (09:47 +0300)]
rtwn_usb(4): add revision number for D-Link DWA-121 (N150 Nano).

MFC after: 2 weeks

3 years agostress2: Added a new ptrace() test scenario
Peter Holm [Wed, 26 May 2021 06:08:56 +0000 (08:08 +0200)]
stress2: Added a new ptrace() test scenario

3 years agostress2: Update the exclude list
Peter Holm [Wed, 26 May 2021 06:06:38 +0000 (08:06 +0200)]
stress2: Update the exclude list

3 years agostress2: Fix cleanup on exit
Peter Holm [Wed, 26 May 2021 06:05:55 +0000 (08:05 +0200)]
stress2: Fix cleanup on exit

3 years agolinux_common: retire extra module version.
Dmitry Chagin [Wed, 26 May 2021 05:34:32 +0000 (08:34 +0300)]
linux_common: retire extra module version.

The second 'linuxcommon' line was added by c66f5b079d2a259c3a65b1efe0f2143cd030dc52
but Linuxulator's modules dependend on 'linux_common'.
To avoid such mistakes in the future rename moduledata name and module
name to  'linux_common' and retire 'linuxcommon' line.

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D30409
MFC after: 2 weeks

3 years agortwn_usb(4): add D-Link DWA-121 (N150 Nano) to the rtwn_usb hardware list
Dmitry Chagin [Wed, 26 May 2021 05:01:04 +0000 (08:01 +0300)]
rtwn_usb(4): add D-Link DWA-121 (N150 Nano) to the rtwn_usb hardware list

MFC after: 2 weeks

3 years agoossl: Use crypto_cursor_segment().
John Baldwin [Tue, 25 May 2021 23:59:19 +0000 (16:59 -0700)]
ossl: Use crypto_cursor_segment().

Reviewed by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30447

3 years agocryptosoft: Use crypto_cursor_segment().
John Baldwin [Tue, 25 May 2021 23:59:19 +0000 (16:59 -0700)]
cryptosoft: Use crypto_cursor_segment().

Reviewed by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30446

3 years agocrypto: Add crypto_cursor_segment() to fetch both base and length.
John Baldwin [Tue, 25 May 2021 23:59:19 +0000 (16:59 -0700)]
crypto: Add crypto_cursor_segment() to fetch both base and length.

This function combines crypto_cursor_segbase() and
crypto_cursor_seglen() into a single function.  This is mostly
beneficial in the unmapped mbuf case where back to back calls of these
two functions have to iterate over the sub-components of unmapped
mbufs twice.

Bump __FreeBSD_version for crypto drivers in ports.

Suggested by: markj
Reviewed by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30445

3 years agoInclude the trailer in the original dst_iov.
John Baldwin [Tue, 25 May 2021 23:59:19 +0000 (16:59 -0700)]
Include the trailer in the original dst_iov.

This avoids creating a duplicate copy on the stack just to
append the trailer.

Reviewed by: gallatin, markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30139

3 years agoAssume OCF is the only KTLS software backend.
John Baldwin [Tue, 25 May 2021 23:59:19 +0000 (16:59 -0700)]
Assume OCF is the only KTLS software backend.

This removes support for loadable software backends.  The KTLS OCF
support is now always included in kernels with KERN_TLS and the
ktls_ocf.ko module has been removed.  The software encryption routines
now take an mbuf directly and use the TLS mbuf as the crypto buffer
when possible.

Bump __FreeBSD_version for software backends in ports.

Reviewed by: gallatin, markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30138

3 years agoktls_ocf: Fix a few places to not hardcode the GMAC hash length.
John Baldwin [Tue, 25 May 2021 23:59:18 +0000 (16:59 -0700)]
ktls_ocf: Fix a few places to not hardcode the GMAC hash length.

This is not a functional change as the Poly1305 hash is the same
length as the GMAC hash length.

Reviewed by: gallatin, markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30137

3 years agocrypto: Add a new type of crypto buffer for a single mbuf.
John Baldwin [Tue, 25 May 2021 23:59:18 +0000 (16:59 -0700)]
crypto: Add a new type of crypto buffer for a single mbuf.

This is intended for use in KTLS transmit where each TLS record is
described by a single mbuf that is itself queued in the socket buffer.
Using the existing CRYPTO_BUF_MBUF would result in
bus_dmamap_load_crp() walking additional mbufs in the socket buffer
that are not relevant, but generating a S/G list that potentially
exceeds the limit of the tag (while also wasting CPU cycles).

Reviewed by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30136

3 years agosglist: Add sglist_append_single_mbuf().
John Baldwin [Tue, 25 May 2021 23:59:18 +0000 (16:59 -0700)]
sglist: Add sglist_append_single_mbuf().

This function appends the contents of a single mbuf to an sglist
rather than an entire mbuf chain.

Reviewed by: gallatin, markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30135

3 years agoSupport unmapped mbufs in crypto buffers.
John Baldwin [Tue, 25 May 2021 23:59:18 +0000 (16:59 -0700)]
Support unmapped mbufs in crypto buffers.

Reviewed by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30134

3 years agoRename m_unmappedtouio() to m_unmapped_uiomove().
John Baldwin [Tue, 25 May 2021 23:59:18 +0000 (16:59 -0700)]
Rename m_unmappedtouio() to m_unmapped_uiomove().

This function doesn't only copy data into a uio but instead is a
variant of uiomove() similar to uiomove_fromphys().

Reviewed by: gallatin, markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30444

3 years agoExtend m_copyback() to support unmapped mbufs.
John Baldwin [Tue, 25 May 2021 23:59:18 +0000 (16:59 -0700)]
Extend m_copyback() to support unmapped mbufs.

Reviewed by: gallatin, markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30133

3 years agoExtend m_apply() to support unmapped mbufs.
John Baldwin [Tue, 25 May 2021 23:59:18 +0000 (16:59 -0700)]
Extend m_apply() to support unmapped mbufs.

m_apply() invokes the callback function separately on each segment of
an unmapped mbuf: the TLS header, individual pages, and the TLS
trailer.

Reviewed by: markj
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D30132

3 years agoamd64/linux*: add required header to get the constant value
Konstantin Belousov [Tue, 25 May 2021 22:19:44 +0000 (01:19 +0300)]
amd64/linux*: add required header to get the constant value

Otherwise asm silently interpret it as the external global symbol.

Reported by: bz
Sponsored by: The FreeBSD Foundation
Fixes: 91aae953cb80

3 years agonfscl: Use hash lists to improve expected search performance for opens
Rick Macklem [Tue, 25 May 2021 21:19:29 +0000 (14:19 -0700)]
nfscl: Use hash lists to improve expected search performance for opens

A problem was reported via email, where a large (130000+) accumulation
of NFSv4 opens on an NFSv4 mount caused significant lock contention
on the mutex used to protect the client mount's open/lock state.
Although the root cause for the accumulation of opens was not
resolved, it is obvious that the NFSv4 client is not designed to
handle 100000+ opens efficiently.  When searching for an open,
usually for a match by file handle, a linear search of all opens
is done.

Commit 3f7e14ad9345 added a hash table of lists hashed on file handle
for the opens.  This patch uses the hash lists for searching for
a matching open based of file handle instead of an exhaustive
linear search of all opens.
This change appears to be performance neutral for a small number
of opens, but should improve expected performance for a large
number of opens.  This patch also moves any found match to the front
of the hash list, to try and maintain the hash lists in recently
used ordering (least recently used at the end of the list).

This commit should not affect the high level semantics of open
handling.

MFC after: 2 weeks

3 years agoipfilter: Fix ip_nat memory leak and use-after-free
Cy Schubert [Tue, 25 May 2021 18:54:49 +0000 (11:54 -0700)]
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

3 years agoBump __FreeBSD_version to 1400015 for LinuxKPI changes.
Bjoern A. Zeeb [Tue, 25 May 2021 17:37:15 +0000 (17:37 +0000)]
Bump __FreeBSD_version to 1400015 for LinuxKPI changes.

Commits 17accc08ae15 and de102f870501 add new files to LinuxKPI
which break drm-kmod.  In addition various other additions where
comitted. Bump __FreeBSD_version to 1400015 to be able to detect this.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

3 years agoLinuxKPI: add addrconf_addr_solict_mult()
Bjoern A. Zeeb [Mon, 24 May 2021 17:49:12 +0000 (17:49 +0000)]
LinuxKPI: add addrconf_addr_solict_mult()

Introduce net/addrconf.h with an implementation to
addrconf_addr_solict_mult() used by WiFi drivers.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30416

3 years agoLinuxKPI: add Exponentially Weighted Moving Average implementation
Bjoern A. Zeeb [Mon, 24 May 2021 17:42:25 +0000 (17:42 +0000)]
LinuxKPI: add Exponentially Weighted Moving Average implementation

Add DECLARE_EWMA() which expands to a per-name EWMA implementation
as used by multiple wireless drivers.

Sposnored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: hselasky, cperciva, dwmalone
Differential Revision: https://reviews.freebsd.org/D30415

3 years agoLinuxKPI: add linux/bsearch.h for sort(9)
Bjoern A. Zeeb [Mon, 24 May 2021 17:52:02 +0000 (17:52 +0000)]
LinuxKPI: add linux/bsearch.h for sort(9)

Add linux/bsearch.h which only includes libkern.h as the sort(9)
functions seem to be compatible.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30417

3 years agoLinuxKPI: byteorder.h
Bjoern A. Zeeb [Mon, 24 May 2021 17:54:16 +0000 (17:54 +0000)]
LinuxKPI: byteorder.h

Add a few more le<n>_{tp,add}_cpu*() #defines/functions found in
wireless drivers.  While here fill most of the combinatorics gaps
and also add the remaining combinations [1].

Suggested by: emaste [1] (for one part)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30418

3 years agoLinuxKPI: cache.h add SMP_CACHE_BYTES
Bjoern A. Zeeb [Mon, 24 May 2021 17:56:53 +0000 (17:56 +0000)]
LinuxKPI: cache.h add SMP_CACHE_BYTES

Add a definition for SMP_CACHE_BYTES and while here include sys/param.h
for CACHE_LINE_SIZE as otherwise code might not compile standalone.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30419

3 years agoLinuxKPI: compiler.h add three more defines
Bjoern A. Zeeb [Mon, 24 May 2021 17:59:13 +0000 (17:59 +0000)]
LinuxKPI: compiler.h add three more defines

Add fallthrough, ____cacheline_aligned_in_smp, and smp_mb() to
linux/compiler.h.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30420

3 years agoLinuxKPI: add cpu.h for cpumask_*()
Bjoern A. Zeeb [Mon, 24 May 2021 18:01:59 +0000 (18:01 +0000)]
LinuxKPI: add cpu.h for cpumask_*()

Add linux/cpu.h for cpumask_*() functions found in wireless drivers
and make sure cpu_online_mask is always initialised.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30421

3 years agoLinuxKPI: add devcoredump.h
Bjoern A. Zeeb [Mon, 24 May 2021 18:04:31 +0000 (18:04 +0000)]
LinuxKPI: add devcoredump.h

Add linux/devcoredump.h with stub implementation of dev_coredumpv()
and dev_coredumpsg() which only free the passed in SG table as needed
for iwlwifi.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30423

3 years agoLinuxKPI: add dev_crit() to linux/device.h
Bjoern A. Zeeb [Mon, 24 May 2021 18:07:31 +0000 (18:07 +0000)]
LinuxKPI: add dev_crit() to linux/device.h

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: emaste, hselasky
Differential Revision: https://reviews.freebsd.org/D30424

3 years agoLinuxKPI: add ether_addr_equal_unaligned()
Bjoern A. Zeeb [Mon, 24 May 2021 18:09:37 +0000 (18:09 +0000)]
LinuxKPI: add ether_addr_equal_unaligned()

Replace the implementation for ether_addr_equal() with
ether_addr_equal_unaligned() and add a define for ether_addr_equal()
pointing to the now ether_addr_equal_unaligned() implementation.
This way ether_addr_equal_unaligned() cannot be broken by accident [1].

Suggested by: emaste [1]
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30425

3 years agoLinuxKPI: net/if_inet6.h add struct inet6_dev { }
Bjoern A. Zeeb [Mon, 24 May 2021 18:11:56 +0000 (18:11 +0000)]
LinuxKPI: net/if_inet6.h add struct inet6_dev { }

Add a dummy struct inet6_dev {}; to net/if_inet6.h.  This is currently
not used for anything but in a declaration.  Just needs to be there.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30426

3 years agoLinuxKPI: add irq_set_affinity_hint()
Bjoern A. Zeeb [Mon, 24 May 2021 18:14:37 +0000 (18:14 +0000)]
LinuxKPI: add irq_set_affinity_hint()

Add an implementation for irq_set_affinity_hint() to linux/interrupt.h
and include linux/hardirq.h for synchronize_irq() as needed by
wireless drivers.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30427

3 years agoLinuxKPI: add linux/{ip,tcp,udp}.h
Bjoern A. Zeeb [Mon, 24 May 2021 18:17:30 +0000 (18:17 +0000)]
LinuxKPI: add linux/{ip,tcp,udp}.h

Add header files for struct and accessors for IPv4, UDP, and TCP.
Only parts of the fields of the structs have been seen while working
on wireless drivers.  The remaining field names are filled up with
the FreeBSD field names for now.  If you have insights into their
correct naming in Linux, feel free to adjust.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30428

3 years agoLinuxKPI: ipv6.h add missing #include
Bjoern A. Zeeb [Mon, 24 May 2021 18:21:55 +0000 (18:21 +0000)]
LinuxKPI: ipv6.h add missing #include

Include linux/bitops.h for a definition of BITS_PER_LONG so that this
file can be used independently.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30429

3 years agoLinuxKPI: add time_is_after_jiffies() definition
Bjoern A. Zeeb [Mon, 24 May 2021 18:24:13 +0000 (18:24 +0000)]
LinuxKPI: add time_is_after_jiffies() definition

This is used by wireless drivers.  Use the time_after() macro as
done for the "after_eq" version.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30430

3 years agoLinuxKPI: change BUILD_BUG_ON()
Bjoern A. Zeeb [Mon, 24 May 2021 18:26:41 +0000 (18:26 +0000)]
LinuxKPI: change BUILD_BUG_ON()

BUILD_BUG_ON() can be used inside functions where the definition to
CTASSERT() (_Static_assert()) seems to not work.
Go back to an old-style CTASSERT() implementation but also add a
variable dclaration to avoid "unsued typedef" errors and dummy-use
the variable to avoid "unusued variable" errors.  Given it is all
self-contained in a block and not used outside this should be
optimised away.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30431

3 years agoLinuxKPI: add ktime_get_boottime_ns() implementation to ktime.h
Bjoern A. Zeeb [Mon, 24 May 2021 18:30:33 +0000 (18:30 +0000)]
LinuxKPI: add ktime_get_boottime_ns() implementation to ktime.h

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30432

3 years agoLinuxKPI: add LINUXKPI_PARAM_charp()
Bjoern A. Zeeb [Mon, 24 May 2021 18:32:11 +0000 (18:32 +0000)]
LinuxKPI: add LINUXKPI_PARAM_charp()

Add yet another version of the various module_param_named() use cases.
This one deals with "charp".

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30433

3 years agoLinuxKPI: add more #defines to pci.h
Bjoern A. Zeeb [Mon, 24 May 2021 18:36:18 +0000 (18:36 +0000)]
LinuxKPI: add more #defines to pci.h

Add more definitions for various PCI uses to linux/pci.h.  Almost all
are defined to their FreeBSD counterparts which are described there.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30434

3 years agoLinuxKPI: add prandom_u32() as used by wireless drivers.
Bjoern A. Zeeb [Mon, 24 May 2021 18:38:58 +0000 (18:38 +0000)]
LinuxKPI: add prandom_u32() as used by wireless drivers.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30435

3 years agoLinuxKPI: add rcu_dereference_check()
Bjoern A. Zeeb [Mon, 24 May 2021 18:40:42 +0000 (18:40 +0000)]
LinuxKPI: add rcu_dereference_check()

Add a define for rcu_dereference_check() to rcu_dereference_protected()
which ignores the check argument.  Our lockdep compat implementation
for use cases found in iwlwifi would return 1 anyway.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30436

3 years agoLinuxKPI: add kfree_sensitive() using zfree().
Bjoern A. Zeeb [Mon, 24 May 2021 18:43:33 +0000 (18:43 +0000)]
LinuxKPI: add kfree_sensitive() using zfree().

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30437

3 years agoLinuxKPI: extract stringify() in their own header file
Bjoern A. Zeeb [Mon, 24 May 2021 18:53:28 +0000 (18:53 +0000)]
LinuxKPI: extract stringify() in their own header file

Add linux/stringify.h as directly included by drivers.  Remove the
definitions from compiler.h and include the new header in places
where the stringify macros are already used without linuxkpi.

I have adjusted the Copyright of the new file according to the commit
originaly adding the macros (99e690772adbcb78c9e8441bedcf1913d72ea72f).

Sposnored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30440

3 years agoLinuxKPI: add kernel_ulong_t typedef in linux/kernel.h.
Bjoern A. Zeeb [Mon, 24 May 2021 18:47:49 +0000 (18:47 +0000)]
LinuxKPI: add kernel_ulong_t typedef in linux/kernel.h.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30438

3 years agoLinuxKPI: add guid_t for ACPI consumers.
Bjoern A. Zeeb [Mon, 24 May 2021 18:50:10 +0000 (18:50 +0000)]
LinuxKPI: add guid_t for ACPI consumers.

Add a placeholder struct for guid_t which is needed by ACPI consumers
in at least one wireless driver.

Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D30439

3 years agotcp: enter network epoch when calling tfb_tcp_fb_fini
Andrew Gallatin [Tue, 25 May 2021 17:45:37 +0000 (13:45 -0400)]
tcp: enter network epoch when calling tfb_tcp_fb_fini

We need to enter the network epoch when calling into
tfb_tcp_fb_fini.  I noticed this when I hit an assert
running the latest rack

Differential Revision: https://reviews.freebsd.org/D30407
Reviewed by: rrs, tuexen
Sponsored by: Netflix

3 years agotcp: Fix bugs related to the PUSH bit and rack and an ack war
Randall Stewart [Tue, 25 May 2021 17:23:31 +0000 (13:23 -0400)]
tcp: Fix bugs related to the PUSH bit and rack and an ack war

Michaels testing with UDP tunneling found an issue with the push bit, which was only partly fixed
in the last commit. The problem is the left edge gets transmitted before the adjustments are done
to the send_map, this means that right edge bits must be considered to be added only if
the entire RSM is being retransmitted.

Now syzkaller also continued to find a crash, which Michael sent me the reproducer for. Turns
out that the reproducer on default (freebsd) stack made the stack get into an ack-war with itself.
After fixing the reference issues in rack the same ack-war was found in rack (and bbr). Basically
what happens is we go into the reassembly code and lose the FIN bit. The trick here is we
should not be going into the reassembly code if tlen == 0 i.e. the peer never sent you anything.
That then gets the proper action on the FIN bit but then you end up in LAST_ACK with no
timers running. This is because the usrclosed function gets called and the FIN's and such have
already been exchanged. So when we should be entering FIN_WAIT2 (or even FIN_WAIT1) we get
stuck in LAST_ACK. Fixing this means tweaking the usrclosed function so that we properly
recognize the condition and drop into FIN_WAIT2 where a timer will allow at least TP_MAXIDLE
before closing (to allow time for the peer to retransmit its FIN if the ack is lost). Setting the fast_finwait2
timer can speed this up in testing.

Reviewed by: mtuexen,rscheff
Sponsored by: Netflix Inc
Differential Revision: https://reviews.freebsd.org/D30451

3 years agofsdb: add missing bufinit() call
Chuck Silvers [Tue, 25 May 2021 16:42:10 +0000 (09:42 -0700)]
fsdb: add missing bufinit() call

The bufinit() call in fsck_ffs was moved in commit f190f9193bc10
from a function that is shared with fsdb to one that is private to fsck_ffs,
so add a bufinit() call in fsdb to compensate for that.

Reviewed by: mckusick
Sponsored by: Netflix

3 years agocam_sim: style: sort includes
Warner Losh [Sat, 22 May 2021 00:52:55 +0000 (18:52 -0600)]
cam_sim: style: sort includes

Sort and remove sys/systm.h, it's not needed.

Sponsored by: Netflix

3 years agoClean up some of the core dumping code.
Edward Tomasz Napierala [Tue, 25 May 2021 10:48:15 +0000 (11:48 +0100)]
Clean up some of the core dumping code.

No functional changes.

Reviewed By: kib
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D30397

3 years agoarm64, riscv: remove reference to fsu_intr_fault
Mitchell Horne [Tue, 25 May 2021 15:22:49 +0000 (12:22 -0300)]
arm64, riscv: remove reference to fsu_intr_fault

This variable no longer exists.

MFC after: 3 days

3 years agopf tests: Test cases for fragment reassembly
Kristof Provost [Thu, 25 Feb 2021 08:50:57 +0000 (09:50 +0100)]
pf tests: Test cases for fragment reassembly

Obtained from: Alexander Bluhm, OpenBSD

3 years agoman5/{hosts,resolver}.5: note that IPv6 addresses are allowed.
Ceri Davies [Tue, 25 May 2021 15:16:24 +0000 (16:16 +0100)]
man5/{hosts,resolver}.5: note that IPv6 addresses are allowed.

The patch in the PR largely no longer applied due to age, but
thanks to Evgeniy Khramtsov for the patches in the PR.

PR: 120024
Reported by: bcran
Approved by: blackend (mentor)
Obtained from: Evgeniy Khramtsov <evgeniy@khramtsov.org> (partly)

3 years agoman4/inet6.4: use "effect" rather than "affect"
Ceri Davies [Tue, 25 May 2021 15:14:19 +0000 (16:14 +0100)]
man4/inet6.4: use "effect" rather than "affect"

Approved by: blackend (mentor)

3 years agousr.bin/chpass: Correct manpage regarding path to temp files
Ceri Davies [Tue, 25 May 2021 15:11:45 +0000 (16:11 +0100)]
usr.bin/chpass: Correct manpage regarding path to temp files

Approved by: blackend (mentor)

3 years agoptrace: add an option to not kill debuggees on debugger exit
Konstantin Belousov [Tue, 18 May 2021 16:26:22 +0000 (19:26 +0300)]
ptrace: add an option to not kill debuggees on debugger exit

Requested by: markj
Reviewed by: jhb (previous version)
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differrential revision: https://reviews.freebsd.org/D30351

3 years agosys_process.c: extract ptrace_unsuspend()
Konstantin Belousov [Tue, 18 May 2021 16:25:50 +0000 (19:25 +0300)]
sys_process.c: extract ptrace_unsuspend()

Reviewed by: jhb
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differrential revision: https://reviews.freebsd.org/D30351

3 years agoamd64: clear PSL.AC in the right frame
Konstantin Belousov [Sat, 22 May 2021 19:48:36 +0000 (22:48 +0300)]
amd64: clear PSL.AC in the right frame

If copyin family of routines fault, kernel does clear PSL.AC on the
fault entry, but the AC flag of the faulted frame is kept intact.  Since
onfault handler is effectively jump, AC survives until syscall exit.

Reported by: m00nbsd, via Sony
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
admbugs: 975

3 years agocam: remove xpt_polled_action
Warner Losh [Tue, 25 May 2021 15:16:49 +0000 (09:16 -0600)]
cam: remove xpt_polled_action

Since periph_runccb now handles all the polling stuff, and
xpt_polled_action is now unused and can be removed.

Sponsored by: Netflix
Reviewed by: mav@
Differential Revision: https://reviews.freebsd.org/D30394

3 years agocam: Remove CAM_SIM_LOCK/UNLOCK macros, they are unused.
Warner Losh [Tue, 25 May 2021 15:16:29 +0000 (09:16 -0600)]
cam: Remove CAM_SIM_LOCK/UNLOCK macros, they are unused.

Sponsored by: Netflix
Reviewed by: mav@
Differential Revision: https://reviews.freebsd.org/D30384

3 years agocam: remove sim callout
Warner Losh [Tue, 25 May 2021 15:14:32 +0000 (09:14 -0600)]
cam: remove sim callout

Nothing is using the sim callout to unfreeze the queue. Remove it to
simplify the SIM. This was introduced in the original CAM commit in 1998
but setting the CAM_SIM_REL_TIMEOUT_PENDING flag was removed in 1999 in
commit 87cfaf0e1fbd which reworked how bus reset worked. That work was
merged just after 3.2R was released. Remove the unused residuals.

Sponsored by: Netflix
Reviewed by: scottl@, mav@
Differential Revision: https://reviews.freebsd.org/D30383

3 years agotaskqueue: Add missing comma to TASKQUEUE_FAST_DEFINE_THREAD
Colin Percival [Tue, 25 May 2021 03:37:55 +0000 (20:37 -0700)]
taskqueue: Add missing comma to TASKQUEUE_FAST_DEFINE_THREAD

Add missing comma to TASKQUEUE_FAST_DEFINE_THREAD arguments to prevent
compilation errors.

Submitted by: ashafer_badland.io
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30449

3 years agoarm64: log vm_fault error for data_abort
Bjoern A. Zeeb [Thu, 20 May 2021 16:43:30 +0000 (16:43 +0000)]
arm64: log vm_fault error for data_abort

Summary:
Log the vm_fault() error in the data_abort panic so it is easier to
find the reason vm_fault() failed (e.g., invalid address).

Reviewed by: andrew
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D30362

3 years agotests/libalias: Add missing copyright statements
Lutz Donnerhacke [Mon, 24 May 2021 19:56:05 +0000 (21:56 +0200)]
tests/libalias: Add missing copyright statements

3 years agotcp: fix a RACK socket buffer lock issue
Michael Tuexen [Mon, 24 May 2021 18:31:23 +0000 (20:31 +0200)]
tcp: fix a RACK socket buffer lock issue

Fix a missing socket buffer unlocking of the socket receive buffer.

Reviewed by: gallatin, rrs
MFC after: 1 week
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D30402

3 years agotcp: Fix an issue with the PUSH bit as well as fill in the missing mtu change for...
Randall Stewart [Mon, 24 May 2021 18:42:15 +0000 (14:42 -0400)]
tcp: Fix an issue with the PUSH bit as well as fill in the missing mtu change for fsb's

The push bit itself was also not actually being properly moved to
the right edge. The FIN bit was incorrectly on the left edge. We
fix these two issues as well as plumb in the mtu_change for
alternate stacks.

Reviewed by: mtuexen
Sponsored by: Netflix Inc
Differential Revision: https://reviews.freebsd.org/D30413

3 years agopf: fix ioctl() memory leak
Kristof Provost [Mon, 24 May 2021 06:32:16 +0000 (08:32 +0200)]
pf: fix ioctl() memory leak

When we create an nvlist and insert it into another nvlist we must
remember to destroy it. The nvlist_add_nvlist() function makes a copy,
just like nvlist_add_string() makes a copy of the string. If we don't
we're leaking memory on every (nvlist-based) ioctl() call.

While here remove two redundant 'break' statements.

PR: 255971
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")

3 years agoDRIVER_MODULE(9): Correct the SYNOPSIS of EARLY_DRIVER_MODULE()
J.R. Oldroyd [Mon, 24 May 2021 14:54:45 +0000 (16:54 +0200)]
DRIVER_MODULE(9): Correct the SYNOPSIS of EARLY_DRIVER_MODULE()

The man page SYNOPSIS for EARLY_DRIVER_MODULE() shows that it has
an "enum sysinit_elem_order order" argument.

The actual macro in sys/bus.h does not have an order argument.

PR: 256103
Reported by: J.R. Oldroyd <fbsd at opal dot com>
Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30411

3 years agoDelete obsolete Solaris compat files
Alan Somers [Mon, 24 May 2021 14:47:44 +0000 (08:47 -0600)]
Delete obsolete Solaris compat files

These files have been unused ever since the OpenSolaris import

Sponsored by: Axcient
MFC after: 2 weeks
Reviewed By: freqlabs
Differential Revision: https://reviews.freebsd.org/D30371

3 years agoarm: RPI-B: Add ext_resources driver
Emmanuel Vadot [Mon, 24 May 2021 10:53:00 +0000 (12:53 +0200)]
arm: RPI-B: Add ext_resources driver

mmc_fdt_helpers needs clock and regulators.
Add all the ext_resources driver to RPI-B conf file to fix the build

Reported by: mjg

3 years agoClean up early arm64 pmap code
Andrew Turner [Thu, 20 May 2021 06:52:15 +0000 (06:52 +0000)]
Clean up early arm64 pmap code

Early in the arm64 pmap code we need to translate between a virtual
address and a physical address. Rather than manually walking the page
table we can ask the hardware to do it for us.

Reviewed by: kib, markj
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D30357

3 years agocxgbetool(8): add a 'clip' subcommand to deal with the CLIP table.
Navdeep Parhar [Sun, 23 May 2021 23:28:31 +0000 (16:28 -0700)]
cxgbetool(8): add a 'clip' subcommand to deal with the CLIP table.

MFC after: 2 weeks
Sponsored by: Chelsio Communications

3 years agocxgbe(4): Overhaul CLIP (Compressed Local IPv6) table management.
Navdeep Parhar [Sun, 23 May 2021 21:58:29 +0000 (14:58 -0700)]
cxgbe(4): Overhaul CLIP (Compressed Local IPv6) table management.

- Process the list of local IPs once instead of once per adapter.  Add
  addresses from all VNETs to the driver's list but leave hardware
  updates for later when the global VNET/IFADDR list locks have been
  released.

- Add address to the hardware table synchronously when a CLIP entry is
  requested for an address that's not already in there.

- Provide ioctls that allow userspace tools to manage addresses in the
  CLIP table.

- Add a knob (hw.cxgbe.clip_db_auto) that controls whether local IPs are
  automatically added to the CLIP table or not.

MFC after: 2 weeks
Sponsored by: Chelsio Communications

3 years agoums(4): Start USB xfers on opening of evdev node unconditionally.
Vladimir Kondratyev [Sun, 23 May 2021 22:41:17 +0000 (01:41 +0300)]
ums(4): Start USB xfers on opening of evdev node unconditionally.

This fixes inability to start USB xfers in a case when FIFO has been
already open()-ed but no read() or poll() calls has been issued yet.

MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D30343

3 years agoums(4): Do not stop USB xfers on FIFO close when evdev is still active
Vladimir Kondratyev [Sun, 23 May 2021 22:38:53 +0000 (01:38 +0300)]
ums(4): Do not stop USB xfers on FIFO close when evdev is still active

This fixes lose of evdev events after moused has been killed.

While here use bitwise operations for UMS_EVDEV_OPENED flag.

Reviewed by: hselasky
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D30342

3 years agotests/libalias: Reduce stress
Lutz Donnerhacke [Sun, 23 May 2021 20:41:26 +0000 (22:41 +0200)]
tests/libalias: Reduce stress

Due to the new, external performance test utility, the regular test
suite can reduce the stress test to a fair amount of activity.

MFC after: 1 week

3 years agovfs: elide vnode locking when it is only needed for audit if possible
Mateusz Guzik [Sun, 23 May 2021 19:28:26 +0000 (21:28 +0200)]
vfs: elide vnode locking when it is only needed for audit if possible

3 years agorun(4): add support for DLINK DWA-130 rev F1 wireless adaptor.
Dmitry Chagin [Sun, 23 May 2021 18:31:51 +0000 (21:31 +0300)]
run(4): add support for DLINK DWA-130 rev F1 wireless adaptor.

PR: 256092
Submitted by: Francois Briere <purplefiasco at gmail.com>
MFC After: 2 weeks

3 years agoktrace: Remove vrele() at the end of ktr_writerequest()
Mark Johnston [Sun, 23 May 2021 17:20:05 +0000 (13:20 -0400)]
ktrace: Remove vrele() at the end of ktr_writerequest()

As of commit fc369a353 we no longer ref the vnode when writing a record.
Drop the corresponding vrele() call in the error case.

Fixes: fc369a353 ("ktrace: fix a race between writes and close")
Reported by: syzbot+9b96ea7a5ff8917d3fe4@syzkaller.appspotmail.com
Reported by: syzbot+6120ebbb354cd52e5107@syzkaller.appspotmail.com
Reviewed by: kib
MFC after: 6 days
Differential Revision: https://reviews.freebsd.org/D30404

3 years agolockprof: move panic check after inspecting the state
Mateusz Guzik [Sun, 23 May 2021 16:04:31 +0000 (16:04 +0000)]
lockprof: move panic check after inspecting the state

3 years agolockprof: pass lock type as an argument instead of reading the spin flag
Mateusz Guzik [Sun, 23 May 2021 15:25:42 +0000 (17:25 +0200)]
lockprof: pass lock type as an argument instead of reading the spin flag

3 years agoAdd support for Gemini Lake LPSS UARTs.
Konstantin Belousov [Sun, 23 May 2021 16:38:54 +0000 (19:38 +0300)]
Add support for Gemini Lake LPSS UARTs.

With this patch:
% dmesg | grep -i uart
uart2: <Intel Gemini Lake SIO/LPSS UART 0> mem 0xa1426000-0xa1426fff,0xa1425000-0xa1425fff irq 4 at device 24.0 on pci0
uart3: <Intel Gemini Lake SIO/LPSS UART 1> mem 0xa1424000-0xa1424fff,0xa1423000-0xa1423fff irq 5 at device 24.1 on pci0
uart4: <Intel Gemini Lake SIO/LPSS UART 2> mem 0xfea10000-0xfea10fff irq 6 at device 24.2 on pci0
uart5: <Intel Gemini Lake SIO/LPSS UART 3> mem 0xa1422000-0xa1422fff,0xa1421000-0xa1421fff irq 7 at device 24.3 on pci0

PR: 256101
Submitted by:  Daniel Ponte <amigan@gmail.com>
MFC after: 1 week

3 years agorsu(4): add ASUS WL-167G V3 to the list of supported devices.
Dmitry Chagin [Sun, 23 May 2021 15:42:29 +0000 (18:42 +0300)]
rsu(4): add ASUS WL-167G V3 to the list of supported devices.

MFC After: 2 weeks

3 years agorun(4): fix manual after d6fd321ef60d43dce9f437187c94a7de2b91ab69.
Dmitry Chagin [Sun, 23 May 2021 13:35:31 +0000 (16:35 +0300)]
run(4): fix manual after d6fd321ef60d43dce9f437187c94a7de2b91ab69.

PR: 255759
MFC After: 2 weeks

3 years agotest/libalias: Fix build errors on various platforms
Lutz Donnerhacke [Sun, 23 May 2021 12:43:00 +0000 (14:43 +0200)]
test/libalias: Fix build errors on various platforms

struct timeval has an unspecified integral type, which needs to be
canonfied before beeing usable by printf(3).

3 years agoThe old thread priority must be stored as part of the EPOCH(9) tracker.
Hans Petter Selasky [Fri, 21 May 2021 08:27:20 +0000 (10:27 +0200)]
The old thread priority must be stored as part of the EPOCH(9) tracker.

Else recursive use of EPOCH(9) may cause the wrong priority to be restored.

Bump the __FreeBSD_version due to changing the thread and epoch tracker
structure.

Differential Revision: https://reviews.freebsd.org/D30375
Reviewed by: markj@
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoath: bump the default node queue size to 128 frames, not 64
Adrian Chadd [Sun, 23 May 2021 04:23:00 +0000 (21:23 -0700)]
ath: bump the default node queue size to 128 frames, not 64

It turns out that, silly adrian, setting it to 64 means only two
AMPDU frames of 32 subframes each.  Thus, whilst those are in-flight,
any subsequent queues frames to that node get dropped.

This ends up being pretty no bueno for performance if any receive
is also going on at that point.

Instead, set it to 128 for the time being to ensure that SOME
frames get queued in the meantime.  This results in some frames
being immediately available in the software queue for transmit
when the two existing A-MPDU frames have been completely sent,
rather than the queue remaining empty until at least one is sent.

It's not the best solution - I still think I'm scheduling receive
far more often than giving time to schedule transmit work -
but at least now I'm not starving the transmit side.

Before this, a bidirectional iperf would show receive at ~ 150mbit/sec.
but the transmit side at like 10kbit/sec.  With it set to 128 it's
now 150mbit/sec receive, and ~ 10mbit receive.  It's better than 10kbit/sec,
but still not as far as I'd like it to be.

Tested:

* AR9380/QCA934x (TL-WDR4300 AP), Macbook pro test STA + AR9380 test STA