freebsd.git
3 years agoRevert "contrib/flex: Drop local __dead2 patch"
Alex Richardson [Wed, 21 Apr 2021 09:48:12 +0000 (10:48 +0100)]
Revert "contrib/flex: Drop local __dead2 patch"

I missed the review comment to commit the changes separately, will
reland in multiple smaller commits.

Requested By:   jkim
This reverts commit bbd421cdf6d8c6102e6fd3979c5bec21ace3c2e3.

3 years agoparam.h: bump __FreeBSD_version for commit 4ce1ba652383
Ka Ho Ng [Thu, 15 Apr 2021 09:54:54 +0000 (17:54 +0800)]
param.h: bump __FreeBSD_version for commit 4ce1ba652383

Commit 4ce1ba652383 changed the sndstat(4) ioctls nvlist schema and
definitions.

Approved by: philip (mentor)

3 years agosndstat: nvlist schema and API definition changes
Ka Ho Ng [Wed, 21 Apr 2021 08:19:15 +0000 (16:19 +0800)]
sndstat: nvlist schema and API definition changes

- SNDSTAT_LABEL_* are renamed to SNDST_DSPS_*, and SNDSTAT_LABEL_DSPS
  becomes SNDST_DSPS.
- Centralize channel number/rate/formats into a single nvlist
  The above nvlist is named "info_play" and "info_rec"
- Expose only encoding format in pfmts/rfmts. Userland has no direct
  access to AFMT_ENCODING/CHANNEL/EXTCHANNEL macros, thus it serves no
  meaning to expose too much information through this pair of labels.
  However pminrate/rminrate, pmaxrate/rmaxrate, pfmts/rfmts are
  deprecated and will be removed in future.

This commit keeps ioctls ABI compatibility with __FreeBSD_version
1400006 for now. In future the compat ABI with 1400006 will be removed
once audio/virtual_oss is rebuilt.

Sponsored by: The FreeBSD Foundation
Reviewed by: hselasky
Approved by: philip (mentor)
Differential Revision: https://reviews.freebsd.org/D29770

3 years agoarcmsr(4): Fix SCSI command timeout on ARC-1886.
Xin LI [Wed, 21 Apr 2021 08:03:54 +0000 (01:03 -0700)]
arcmsr(4): Fix SCSI command timeout on ARC-1886.

Many thanks to Areca for continuing to support FreeBSD.

Submitted by: 黃清隆 <ching2048 areca com tw>
MFC after: 2 weeks

3 years agoFix rib generation count for fib algo.
Alexander V. Chernikov [Sat, 17 Apr 2021 18:58:12 +0000 (18:58 +0000)]
Fix rib generation count for fib algo.

Currently, PCB caching mechanism relies on the rib generation
 counter (rnh_gen) to invalidate cached nhops/LLE entries.

With certain fib algorithms, it is now possible that the
 datapath lookup state applies RIB changes with some delay.
In that scenario, PCB cache will invalidate on the RIB change,
 but the new lookup may result in the same nexthop being returned.
When fib algo finally gets in sync with the RIB changes, PCB cache
 will not receive any notification and will end up caching the stale data.

To fix this, introduce additional counter, rnh_gen_rib, which is used
 only when FIB_ALGO is enabled.
This counter is incremented by the control plane. Each time when fib algo
 synchronises with the RIB, it updates rnh_gen to the current rnh_gen_rib value.

Differential Revision: https://reviews.freebsd.org/D29812
Reviewed by: donner
MFC after: 2 weeks

3 years agodconschat: Remove support for FreeBSD 4.x and earlier.
Warner Losh [Tue, 20 Apr 2021 21:46:56 +0000 (15:46 -0600)]
dconschat: Remove support for FreeBSD 4.x and earlier.

Sponsored by: Netflix

3 years agofwcontrol: Remove support for FreeBSD 4.x
Warner Losh [Tue, 20 Apr 2021 21:44:35 +0000 (15:44 -0600)]
fwcontrol: Remove support for FreeBSD 4.x

Sponsored by: Netflix

3 years agobsdinstall: remove compat hacks for FreeBSD 9 and earlier
Warner Losh [Tue, 20 Apr 2021 21:41:39 +0000 (15:41 -0600)]
bsdinstall: remove compat hacks for FreeBSD 9 and earlier

Sponsored by: Netflix

3 years agoRelax rtsock message restrictions.
Alexander V. Chernikov [Mon, 19 Apr 2021 20:49:18 +0000 (20:49 +0000)]
Relax rtsock message restrictions.

Address multiple issues with strict rtsock message validation.

D28668 "normalisation" approach was based on the assumption that
 we always have at least "standard" sockaddr len.
It turned out to be false - certain older applications like quagga
 or routed abuse sin[6]_len field and set it to the offset to the
 first fully-zero bit in the mask. It is impossible to normalise
 such sockaddrs without reallocation.

With that in mind, change the approach to use a distinct memory
 buffer for the altered sockaddrs. This allows supporting the older
 software while maintaining the guarantee on the "standard" sockaddrs.

PR: 255273,255089
Differential Revision: https://reviews.freebsd.org/D29826
MFC after: 3 days

3 years agoFixup ObsoleteFiles after 76681661be28.
Dmitry Chagin [Tue, 20 Apr 2021 21:06:16 +0000 (00:06 +0300)]
Fixup ObsoleteFiles after 76681661be28.

3 years agobhyve: Be explicit that setting config.dump will not start a VM.
John Baldwin [Tue, 20 Apr 2021 20:33:28 +0000 (13:33 -0700)]
bhyve: Be explicit that setting config.dump will not start a VM.

Suggested by: rpokala
Reviewed by: bcr (manpages)
Differential Revision: https://reviews.freebsd.org/D29738

3 years agoetcupdate: Add a revert mode to restore one or more stock files.
John Baldwin [Tue, 20 Apr 2021 20:22:35 +0000 (13:22 -0700)]
etcupdate: Add a revert mode to restore one or more stock files.

Reviewed by: imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D29846

3 years agoetcupdate: Trim trailing whitespace.
John Baldwin [Tue, 20 Apr 2021 20:22:24 +0000 (13:22 -0700)]
etcupdate: Trim trailing whitespace.

Reviewed by: imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D29845

3 years agoetcupdate: Gracefully handle SIGINT when building trees.
John Baldwin [Tue, 20 Apr 2021 20:22:11 +0000 (13:22 -0700)]
etcupdate: Gracefully handle SIGINT when building trees.

Run the 'build_tree' function inside of a subshell and trap SIGINT to
return an error to the caller.  This allows callers to gracefully
cleanup a partially created tree.

While here, redirect stdout/stderr of the subshell to the log file
instead of applying redirections individually to each command executed
while building the tree.

Reviewed by: imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D29844

3 years agoetcupdate: Always extract to a temporary tree.
John Baldwin [Tue, 20 Apr 2021 20:21:42 +0000 (13:21 -0700)]
etcupdate: Always extract to a temporary tree.

etcupdate has had a somewhat nasty race condition since its creation
in that its state machine can get very confused if it is interrupted
while building the tree to compare against.  This is exacerbated by
the fact that etcupdate doesn't emit any output while building the
tree which can take several seconds (especially in recent years with
the addition of the tree-wide buildconfig/installconfig passes).

To mitigate this, always install a new tree into a temporary directory
created via mktemp as was previously done only for dry-runs via -n.
The existing trees are only rotated and the new tree installed as
/var/db/etcupdate/current after the update command has completed.

Reported by: dim, np (and many others)
Reviewed by: imp
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D29843

3 years agoFix leak in libc NFSv4 flags parsing
Andrew Walker [Tue, 20 Apr 2021 19:34:44 +0000 (15:34 -0400)]
Fix leak in libc NFSv4 flags parsing

Free memory allocated by strdup() in parse_flags_verbose().

Submitted by: Andrew Walker <walker.aj325_gmail.com>
Reported by: valgrind
Reviewed by: allanjude, freqlabs, rpokala
MFC after: 3 days
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D29871

3 years agowlanstats: fix build
Sofian Brabez [Tue, 20 Apr 2021 18:31:48 +0000 (18:31 +0000)]
wlanstats: fix build

Add -Wno-cast-align to the CFLAGS to fix the build of wlanstats

Approved by: adrian
MFC after: 1 week

3 years agomprutil: add big endian support
Alfredo Dal'Ava Junior [Sat, 17 Apr 2021 01:01:38 +0000 (22:01 -0300)]
mprutil: add big endian support

This fix mprutil on big endian platforms, as follow up of D25785.

Flash operations are still not working, such as MPI2_FUNCTION_FW_UPLOAD
failing due to timeout.

Firmware version used during tests: 16.00.01.00

Submitted by: Andre Fernando da Silva <andre.silva@eldorado.org.br>
Reviewed by: luporl, Sreekanth Reddy <sreekanth.reddy@broadcom.com> (by e-mail)
Sponsored by: Eldorado Research Institute (eldorado.org.br)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D26040

3 years agoiwnstats: fix build with clang and allow install under /usr/local/sbin
Sofian Brabez [Tue, 20 Apr 2021 17:58:46 +0000 (17:58 +0000)]
iwnstats: fix build with clang and allow install under /usr/local/sbin

iwnstats was not compiling because of some issues raised by the clang
compiler due to -Werror. As a tool it is not connected to world build.

Add missing field "barker_mrc" initialization in struct
iwn_sensitivity_limits for -Wmissing-field-initializers, remove unused
pointer *is on iwn_stats_*_print functions and unused variables for
-Wunused-parameter and -Wunused-variable.

The value for field "barker_mrc" of struct iwn2030_sensitivity_limits
was obtained from linux 3.2 wireless/iwlwifi driver code (iwl-2000.c:115
.barker_corr_th_min_mrc = 390).

Also set BINDIR in Makefile to make it possible to install under
/usr/local/sbin/iwnstats as it require super user.

Reviewed by: adrian
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29800

3 years agotcp_hostcache: use SMR for lookups, mutex(9) for updates.
Gleb Smirnoff [Mon, 22 Mar 2021 22:32:57 +0000 (15:32 -0700)]
tcp_hostcache: use SMR for lookups, mutex(9) for updates.

In certain cases, e.g. a SYN-flood from a limited set of hosts,
the TCP hostcache becomes the main contention point. To solve
that, this change introduces lockless lookups on the hostcache.

The cache remains a hash, however buckets are now CK_SLIST. For
updates a bucket mutex is obtained, for read an SMR section is
entered.

Reviewed by: markj, rscheff
Differential revision: https://reviews.freebsd.org/D29729

3 years agotcp_input: always request read-locking of PCB for any pure SYN segment.
Gleb Smirnoff [Fri, 16 Apr 2021 21:56:14 +0000 (14:56 -0700)]
tcp_input: always request read-locking of PCB for any pure SYN segment.

This is further rework of 08d9c920275.  Now we carry the knowledge of
lock type all the way through tcp_input() and also into tcp_twcheck().
Ideally the rlocking for pure SYNs should propagate all the way into
the alternative TCP stacks, but not yet today.

This should close a race when socket is bind(2)-ed but not yet
listen(2)-ed and a SYN-packet arrives racing with listen(2), discovered
recently by pho@.

3 years agotcp_input: remove comments and assertions about tcpbinfo locking
Gleb Smirnoff [Fri, 16 Apr 2021 21:39:19 +0000 (14:39 -0700)]
tcp_input: remove comments and assertions about tcpbinfo locking

They aren't valid since d40c0d47cd2.

3 years agotcp: Deal with DSACKs, and adjust rescue hole on success.
Richard Scheffenegger [Tue, 20 Apr 2021 12:53:56 +0000 (14:53 +0200)]
tcp: Deal with DSACKs, and adjust rescue hole on success.

When a rescue retransmission is successful, rather than
inserting new holes to the left of it, adjust the old
rescue entry to cover the missed sequence space.

Also, as snd_fack may be stale by that point, pull it forward
in order to never create a hole left of snd_una/th_ack.

Finally, with DSACKs, tcp_sack_doack() may be called
with new full ACKs but a DSACK block. Account for this
eventuality properly to keep sacked_bytes >= 0.

MFC after: 3 days
Reviewed By: kbowling, tuexen, #transport
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29835

3 years agoAdd TCP LRO support for VLAN and VxLAN.
Hans Petter Selasky [Wed, 31 Mar 2021 10:36:36 +0000 (12:36 +0200)]
Add TCP LRO support for VLAN and VxLAN.

This change makes the TCP LRO code more generic and flexible with regards
to supporting multiple different TCP encapsulation protocols and in general
lays the ground for broader TCP LRO support. The main job of the TCP LRO code is
to merge TCP packets for the same flow, to reduce the number of calls to upper
layers. This reduces CPU and increases performance, due to being able to send
larger TSO offloaded data chunks at a time. Basically the TCP LRO makes it
possible to avoid per-packet interaction by the host CPU.

Because the current TCP LRO code was tightly bound and optimized for TCP/IP
over ethernet only, several larger changes were needed. Also a minor bug was
fixed in the flushing mechanism for inactive entries, where the expire time,
"le->mtime" was not always properly set.

To avoid having to re-run time consuming regression tests for every change,
it was chosen to squash the following list of changes into a single commit:
- Refactor parsing of all address information into the "lro_parser" structure.
  This easily allows to reuse parsing code for inner headers.
- Speedup header data comparison. Don't compare field by field, but
  instead use an unsigned long array, where the fields get packed.
- Refactor the IPv4/TCP/UDP checksum computations, so that they may be computed
  recursivly, only applying deltas as the result of updating payload data.
- Make smaller inline functions doing one operation at a time instead of
  big functions having repeated code.
- Refactor the TCP ACK compression code to only execute once
  per TCP LRO flush. This gives a minor performance improvement and
  keeps the code simple.
- Use sbintime() for all time-keeping. This change also fixes flushing
  of inactive entries.
- Try to shrink the size of the LRO entry, because it is frequently zeroed.
- Removed unused TCP LRO macros.
- Cleanup unused TCP LRO statistics counters while at it.
- Try to use __predict_true() and predict_false() to optimise CPU branch
  predictions.

Bump the __FreeBSD_version due to changing the "lro_ctrl" structure.

Tested by: Netflix
Reviewed by: rrs (transport)
Differential Revision: https://reviews.freebsd.org/D29564
MFC after: 2 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoAdd myself (khng) as src committer.
Ka Ho Ng [Tue, 20 Apr 2021 11:27:52 +0000 (19:27 +0800)]
Add myself (khng) as src committer.

Approved by: lwhsu (mentor), philip (mentor)

3 years agopf tests: IPv6 test case for the 'kill state(s)' feature
Kristof Provost [Fri, 16 Apr 2021 15:47:47 +0000 (17:47 +0200)]
pf tests: IPv6 test case for the 'kill state(s)' feature

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

3 years agopf tests: Test cases for the 'kill state(s)' feature
Kristof Provost [Fri, 16 Apr 2021 15:33:17 +0000 (17:33 +0200)]
pf tests: Test cases for the 'kill state(s)' feature

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

3 years agopf: Refactor state killing
Kristof Provost [Fri, 16 Apr 2021 14:34:21 +0000 (16:34 +0200)]
pf: Refactor state killing

Extract the state killing code from pfioctl() and rephrase the filtering
conditions for readability.

No functional change intended.

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

3 years agoassert.3: Document static_assert and _Static_assert
Faraz Vahedi [Tue, 20 Apr 2021 08:50:36 +0000 (10:50 +0200)]
assert.3: Document static_assert and _Static_assert

Reviewed by: imp, 0mp
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29833

3 years agoEnable GitHub actions CI for stable/13 as well
Alex Richardson [Tue, 20 Apr 2021 08:50:36 +0000 (09:50 +0100)]
Enable GitHub actions CI for stable/13 as well

All cross-building patches have been merged to stable/13 so it should
also build fine on macOS+Linux.

Reviewed By: uqs
MFC after: immediately
Differential Revision: https://reviews.freebsd.org/D29831

3 years agoc.7: Fix some typos
Mateusz Piotrowski [Tue, 20 Apr 2021 08:33:34 +0000 (10:33 +0200)]
c.7: Fix some typos

Those misspellings were not picked up by igor because they are not
present in its list of common spelling errors.

Reported by: rpokala

3 years agofork.2: Fix a typo in an example
Mateusz Piotrowski [Tue, 20 Apr 2021 08:24:21 +0000 (10:24 +0200)]
fork.2: Fix a typo in an example

Reported by: rpokala
MFC with: c4207d867c201a726aa3157e09262f72166c89c4

3 years agonfscommon: fix function name in comment
Rick Macklem [Tue, 20 Apr 2021 03:09:46 +0000 (20:09 -0700)]
nfscommon: fix function name in comment

MFC after: 2 weeks

3 years agolinker_set: fix globl/weak symbol redefinitions to work on clang 12
Greg V [Tue, 20 Apr 2021 00:47:15 +0000 (01:47 +0100)]
linker_set: fix globl/weak symbol redefinitions to work on clang 12

In clang 12.0.0.rc2, going from weak to global is now a hard error:

```
/usr/src/stand/libsa/amd64/_setjmp.S:67:25: error: _longjmp changed binding to STB_GLOBAL
.text; .p2align 4,0x90; .globl _longjmp; .type _longjmp,@function; _longjmp:; .cfi_startproc
```

And the other way is a warning, but we have -Werror:

```
error: __start_set_Xcommand_set changed binding to STB_WEAK [-Werror,-Winline-asm]
error: __stop_set_Xcommand_set changed binding to STB_WEAK [-Werror,-Winline-asm]
```

ref: https://reviews.llvm.org/D90108

Reviewed By: arichardson
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29159

3 years agonfsd: fix stripe size reply for the File Layout pNFS server
Rick Macklem [Tue, 20 Apr 2021 00:51:07 +0000 (17:51 -0700)]
nfsd: fix stripe size reply for the File Layout pNFS server

At a recent testing event I found out that I had misinterpreted
RFC5661 where it describes the stripe size in the File Layout's
nfl_util field. This patch fixes the pNFS File Layout server
so that it returns the correct value to the NFSv4.1/4.2 pNFS
enabled client.

This affects almost no one, since pNFS server configurations
are rare and the extant pNFS aware NFS clients seemed to
function correctly despite the erroneous stripe size.
It *might* be needed for correct behaviour if a recent
Linux client mounts a FreeBSD pNFS server configuration
that is using File Layout (non-mirrored configuration).

MFC after: 2 weeks

3 years agoAllow lib/msun/logarithm_test to pass on ld128 platforms
Alex Richardson [Mon, 19 Apr 2021 23:22:45 +0000 (00:22 +0100)]
Allow lib/msun/logarithm_test to pass on ld128 platforms

For some reason the ld128 log1pl() implementation is less accurate than
logl(), but does at least guarantee precision >= the ld80 implementation.
Mark log1p_accuracy_tests as XFAIL for ld128 and increase the log1p tolerance
to the ld80 equivalent in accuracy_tests to avoid losing test coverage for
the other functions.

PR: 253984
Reviewed By: ngie, dim
Differential Revision: https://reviews.freebsd.org/D29039

3 years agolibc/string/memset.c: Use unsigned long for stores
Alex Richardson [Mon, 19 Apr 2021 23:19:20 +0000 (00:19 +0100)]
libc/string/memset.c: Use unsigned long for stores

While most 64-bit architectures have an assembly implementation of this
file, RISC-V does not. As we now store 8 bytes instead of 4 it should speed
up RISC-V.

Reviewed By: kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29536

3 years agolibc/string/bcopy.c: Use intptr_t as the copy type
Alex Richardson [Mon, 19 Apr 2021 23:15:57 +0000 (00:15 +0100)]
libc/string/bcopy.c: Use intptr_t as the copy type

While most 64-bit architectures have an assembly implementation of this
file RISC-V does not. As we now copy 8 bytes instead of 4 it should speed
up RISC-V. Using intptr_t instead of int also allows using this file for
CHERI pure-capability code since trying to copy pointers using integer
loads/stores will invalidate pointers.

Reviewed By: kib
Obtained from: CheriBSD (partially)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29535

3 years agocontrib/flex: Drop local __dead2 patch
Alex Richardson [Mon, 19 Apr 2021 23:05:30 +0000 (00:05 +0100)]
contrib/flex: Drop local __dead2 patch

Upstream flex has added a yynoreturn, so this diff is no longer needed.
Partially reverts r181269. Also regenerate the pre-generated files that
are used for bootstrapping.

Reviewed By: jkim

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

3 years agobsd.compiler.mk: detect Apple Clang for cross-builds
Alex Richardson [Tue, 20 Apr 2021 00:46:36 +0000 (01:46 +0100)]
bsd.compiler.mk: detect Apple Clang for cross-builds

Apple clang uses a different versioning scheme, so if we enable or
disable certain warnings for Clang 11+, those might not be supported
in Apple Clang 11+. This adds 'apple-clang' to COMPILER_FEATURES, so that
bootstrap tools Makefiles can avoid warnings on macOS.

Reviewed By: imp
Differential Revision: https://reviews.freebsd.org/D29680

3 years agoFix off-by-one error in KASSERT from 02f26e98c7f4.
Gleb Smirnoff [Tue, 20 Apr 2021 00:20:19 +0000 (17:20 -0700)]
Fix off-by-one error in KASSERT from 02f26e98c7f4.

3 years agoconfig: style for '\0' and NULL
Warner Losh [Mon, 19 Apr 2021 22:09:42 +0000 (16:09 -0600)]
config: style for '\0' and NULL

Use NULL for pointers instead of '0' (though hey are the same thing in
these cases). Ditto for using the zero character '\0' instead of a naked
0 (ditto).

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

3 years agoe1000: Add support for [Tiger, Alder, Meteor] Lake
Kevin Bowling [Mon, 19 Apr 2021 02:11:27 +0000 (19:11 -0700)]
e1000: Add support for [Tiger, Alder, Meteor] Lake

Add support for current and future client platform PCI IDs. These are
all I219 variants and have no known driver changes versus previous
generation client platform I219 variants.

Reviewed by: markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D29801

3 years agoImprove error reporting in rtsock.c
Alexander V. Chernikov [Mon, 19 Apr 2021 20:36:41 +0000 (20:36 +0000)]
Improve error reporting in rtsock.c

MFC after: 3 days

3 years agoFix typo in rtsock_common.h
Alexander V. Chernikov [Mon, 19 Apr 2021 20:24:42 +0000 (20:24 +0000)]
Fix typo in rtsock_common.h

MFC after: 3 days

3 years agoe1000: Correct promisc multicast filter handling
Kevin Bowling [Fri, 16 Apr 2021 23:15:50 +0000 (16:15 -0700)]
e1000: Correct promisc multicast filter handling

There are a number of issues in the e1000 multicast filter handling
that have been present for a long time. Take the updated approach from
ixgbe(4) which does not have the issues.

The issues are outlined in the PR, in particular this solves crossing
over and under the hardware's filter limit, not programming the
hardware filter when we are above its limit, disabling SBP (show bad
packets) when the tunable is enabled and exiting promiscuous mode, and
an off-by-one error in the em_copy_maddr function.

PR: 140647
Reported by: jtl
Reviewed by: markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D29789

3 years agoixgbe: Clean up unneeded set in ixgbe_if_multi_set
Kevin Bowling [Mon, 19 Apr 2021 19:22:22 +0000 (12:22 -0700)]
ixgbe: Clean up unneeded set in ixgbe_if_multi_set

We don't need to set the bits here since the if/else if/else statements
fully cover setting these bit pairs.

Reported by: markj
Reviewed by: markj, erj
Approved by: #intel_networking
MFC aftter: 1 week
Differential Revision: https://reviews.freebsd.org/D29827

3 years agoCirrus-CI: use FreeBSD 13.0 image for base system CI build
Ed Maste [Mon, 19 Apr 2021 18:36:21 +0000 (14:36 -0400)]
Cirrus-CI: use FreeBSD 13.0 image for base system CI build

We generally want to build and test on the highest release version, and
FreeBSD 13.0 also brings some performance benefits.

Reviewed by: lwhsu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29842

3 years agobsdinstall: restore time selection screen
Yuri Pankov [Mon, 19 Apr 2021 18:39:59 +0000 (21:39 +0300)]
bsdinstall: restore time selection screen

Apparently new dialog does not like the height of 2 for the
timebox widget, use 0 (minimum size) instead.

Do the same for calendar widget as it does not change the
appearance and to prevent possible future surprises.

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D29720

3 years agolinuxkpi: reduce number of stray mm_struct allocations
Konstantin Belousov [Thu, 11 Mar 2021 06:48:22 +0000 (08:48 +0200)]
linuxkpi: reduce number of stray mm_struct allocations

Only allocate struct_mm after we checked that other threads do not carry
useful mm_struct.  If they don't, drop process lock, allocate, and recheck.

Note that for M_NOWAIT allocations we could avoid dropping process lock,
but I do not think that this increased complexity is useful.

Reviewed by: hselasky
Sponsored by: Mellanox Technologies/NVidia Networking
MFC after: 1 week

3 years agolinuxkpi: guarantee allocations of task and mm for interrupt threads
Konstantin Belousov [Thu, 11 Mar 2021 06:34:42 +0000 (08:34 +0200)]
linuxkpi: guarantee allocations of task and mm for interrupt threads

Create and use zones for task and mm.  Reserve items in zones based on the
estimation of the max number of interrupts in the system.  Use M_USE_RESERVE
to allow to take reserved items when allocation occurs from the interrupt
thread context.

Of course, this would only work first time we allocate the task for
interrupt thread. If interrupt is deallocated and allocated anew,
creating a new thread, it might be that zone is depleted. It still
should be good enough for practical uses.

Reviewed by: hselasky
Sponsored by: Mellanox Technologies/NVidia Networking
MFC after: 1 week

3 years agolinuxkpi: some style, wrap too long lines
Konstantin Belousov [Thu, 11 Mar 2021 06:08:51 +0000 (08:08 +0200)]
linuxkpi: some style, wrap too long lines

Reviewed by: hselasky
Sponsored by: Mellanox Technologies/NVidia Networking
MFC after: 1 week

3 years agosysctl vm.objects: report backing object and swap use
Konstantin Belousov [Thu, 15 Apr 2021 09:27:02 +0000 (12:27 +0300)]
sysctl vm.objects: report backing object and swap use

For anonymous objects, provide a handle kvo_me naming the object,
and report the handle of the backing object.  This allows userspace
to deconstruct the shadow chain.  Right now the handle is the address
of the object in KVA, but this is not guaranteed.

For the same anonymous objects, report the swap space used for actually
swapped out pages, in kvo_swapped field.  I do not believe that it is
useful to report full 64bit counter there, so only uint32_t value is
returned, clamped to the max.

For kinfo_vmentry, report anonymous object handle backing the entry,
so that the shadow chain for the specific mapping can be deconstructed.

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29771

3 years agosysctl_handle_string: do not malloc when SYSCTL_IN cannot fault
Konstantin Belousov [Sun, 18 Apr 2021 16:09:30 +0000 (19:09 +0300)]
sysctl_handle_string: do not malloc when SYSCTL_IN cannot fault

In particular, this avoids malloc(9) calls when from early tunable handling,
with no working malloc yet.

Reported and tested by: mav
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 years agolinkat(2): check NIRES_EMPTYPATH on the first fd arg
Konstantin Belousov [Mon, 19 Apr 2021 13:35:25 +0000 (16:35 +0300)]
linkat(2): check NIRES_EMPTYPATH on the first fd arg

Reported by: arichardson
Reviewed by: markj
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D29834

3 years agoflex: Regen bootstrap files
Jung-uk Kim [Mon, 19 Apr 2021 18:20:51 +0000 (14:20 -0400)]
flex: Regen bootstrap files

This also partially reverts r326025 (8a16b7a18f5d).  I do not see any
point of adding SPDX tag in generated file.

MFC after: 3 days
Submitted by: Dan McGregor <dan.mcgregor@usask.ca> (initial version)
Differential Revision: https://reviews.freebsd.org/D28596

3 years agoFix a typo in Gordon's login
Mateusz Piotrowski [Mon, 19 Apr 2021 13:42:31 +0000 (15:42 +0200)]
Fix a typo in Gordon's login

It's gbe, not bge.

Fixes: bffc3fb3c09b Add metor -> mentee information (docs)

3 years agopf tests: Test set keepcounters
Kristof Provost [Thu, 15 Apr 2021 14:53:16 +0000 (16:53 +0200)]
pf tests: Test set keepcounters

MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29781

3 years agopf: Optionally attempt to preserve rule counter values across ruleset updates
Kristof Provost [Thu, 15 Apr 2021 14:12:11 +0000 (16:12 +0200)]
pf: Optionally attempt to preserve rule counter values across ruleset updates

Usually rule counters are reset to zero on every update of the ruleset.
With keepcounters set pf will attempt to find matching rules between old
and new rulesets and preserve the rule counters.

MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29780

3 years agopf: Remove PFRULE_REFS from userspace
Kristof Provost [Thu, 15 Apr 2021 11:41:07 +0000 (13:41 +0200)]
pf: Remove PFRULE_REFS from userspace

PFRULE_REFS should never be used by userspace, so hide it behind #ifdef
_KERNEL.

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

3 years agopf: PFRULE_REFS should not be user-visible
Kristof Provost [Thu, 15 Apr 2021 11:38:56 +0000 (13:38 +0200)]
pf: PFRULE_REFS should not be user-visible

Split the PFRULE_REFS flag from the rule_flag field. PFRULE_REFS is a
kernel-internal flag and should not be exposed to or read from
userspace.

MFC after: 4 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D29778

3 years agobridge tests: Test STP config BPDU validation
Kristof Provost [Thu, 15 Apr 2021 12:55:00 +0000 (14:55 +0200)]
bridge tests: Test STP config BPDU validation

PR: 254924
Reviewed by: donner
Differential Revision: https://reviews.freebsd.org/D29783

3 years agobridgestp: validate timer values in config BPDU
Jonah Caplan [Thu, 15 Apr 2021 09:28:42 +0000 (11:28 +0200)]
bridgestp: validate timer values in config BPDU

IEEE Std 802.1D-2004 Section 17.14 defines permitted ranges for timers.
Incoming BPDU messages should be checked against the permitted ranges.
The rest of 17.14 appears to be enforced already.

PR: 254924
Reviewed by: kp, donner
Differential Revision: https://reviews.freebsd.org/D29782

3 years agolinux(4): bump osrelease to 4.4.0.
Edward Tomasz Napierala [Mon, 19 Apr 2021 10:37:47 +0000 (11:37 +0100)]
linux(4): bump osrelease to 4.4.0.

This is required for the current Arch Linux binaries to work.

PR: 254112
Reviewed By: emaste
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D29218

3 years agoRevert "lib/libc/net/nsdispatch.c: Fix missing unlock and add locking annotations"
Alex Richardson [Mon, 19 Apr 2021 08:36:47 +0000 (09:36 +0100)]
Revert "lib/libc/net/nsdispatch.c: Fix missing unlock and add locking annotations"

This commit should not have introduced any functional changes, but
apparently it did. This appears to have broken LDAP setups.
Reverting for now. Will reland once I have fixed the breakage.

This reverts commit 5245bf7b92b74e556527b4916a8deba386fe5772.
Reported By: Александр Недоцуков, brd
MFC after: immediately

3 years agoAMD-vi: Fortify IVHD device_identify process
Ka Ho Ng [Mon, 19 Apr 2021 08:07:03 +0000 (16:07 +0800)]
AMD-vi: Fortify IVHD device_identify process

- Use malloc(9) to allocate ivhd_hdrs list. The previous assumption
  that there are at most 10 IVHDs in a system is not true. A counter
  example would be a system with 4 IOMMUs, and each IOMMU is related
  to IVHDs type 10h, 11h and 40h in the ACPI IVRS table.
- Always scan through the whole ivhd_hdrs list to find IVHDs that has
  the same DeviceId but less prioritized IVHD type.

Sponsored by: The FreeBSD Foundation
MFC with: 74ada297e897
Reviewed by: grehan
Approved by: lwhsu (mentor)
Differential Revision: https://reviews.freebsd.org/D29525

3 years ago[ath] Add ath_hal_getnav and ath_hal_setnav so the driver layer
Adrian Chadd [Thu, 1 Apr 2021 04:48:59 +0000 (21:48 -0700)]
[ath] Add ath_hal_getnav and ath_hal_setnav so the driver layer
can check the NAV as appropriate.

3 years ago[ath_hal] Add get/set NAV functions
Adrian Chadd [Wed, 31 Mar 2021 16:38:15 +0000 (09:38 -0700)]
[ath_hal] Add get/set NAV functions

The NAV (network allocation vector) register reflects the current MAC
tracking of NAV - when it will stay quiet before transmitting.

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

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

This code just adds the ability to get/set the NAV; the driver will
need to take care of using it during transmit hangs and beacon misses
to see if it's due to a trash looking NAV.

3 years ago[ath_hal] ar9300: save TSF across full chip reset
Adrian Chadd [Wed, 31 Mar 2021 03:30:24 +0000 (20:30 -0700)]
[ath_hal] ar9300: save TSF across full chip reset

This saves the TSF across a a full reset.  The TSF is otherwise cleared
and subsequent beaconing stops until the TSF catches up to nexttbtt.

3 years agoless: upgrade to v581.
Xin LI [Mon, 19 Apr 2021 02:46:19 +0000 (19:46 -0700)]
less: upgrade to v581.

MFC after: 2 weeks

3 years agoVendor import of less v581.
Xin LI [Mon, 19 Apr 2021 01:15:19 +0000 (18:15 -0700)]
Vendor import of less v581.

3 years agobhyve.8: Fix mandoc -Tlint issues
Mateusz Piotrowski [Sun, 18 Apr 2021 23:53:06 +0000 (01:53 +0200)]
bhyve.8: Fix mandoc -Tlint issues

While here, keep network backends section consistent with other
sections.

MFC after: 2 weeks

3 years agobhyve: Document the format for HD audio backends
Mateusz Piotrowski [Sun, 18 Apr 2021 23:50:29 +0000 (01:50 +0200)]
bhyve: Document the format for HD audio backends

- This change is done for consistency with other backend definitions.

MFC after: 2 weeks

3 years agobhyve.8: Improve AHCI backends documentation
Mateusz Piotrowski [Sun, 18 Apr 2021 23:44:23 +0000 (01:44 +0200)]
bhyve.8: Improve AHCI backends documentation

- Document the backend format.

MFC after: 2 weeks

3 years agobhyve.8: Improve documentation of NVME backend
Mateusz Piotrowski [Sun, 18 Apr 2021 23:16:51 +0000 (01:16 +0200)]
bhyve.8: Improve documentation of NVME backend

- Document the configuration format.
- Document two additional configuration options: eui64 and dsm.

MFC after: 2 weeks

3 years agobhyve.8: Improve framebuffer backends description
Mateusz Piotrowski [Sun, 18 Apr 2021 22:59:44 +0000 (00:59 +0200)]
bhyve.8: Improve framebuffer backends description

- Use appropriate mdoc macros
- Document that tcp= is a synonym to rfb= (tcp is used in the examples,
  but never mentioned)
- Clarify the IP address specification

MFC after: 2 weeks

3 years agobhyve.8: Clean up virtio console device backends description
Mateusz Piotrowski [Sun, 18 Apr 2021 22:23:26 +0000 (00:23 +0200)]
bhyve.8: Clean up virtio console device backends description

MFC after: 2 weeks

3 years agobhyve.8: Clean up TTY, boot ROM, and pass-through descriptions
Mateusz Piotrowski [Sun, 18 Apr 2021 22:09:22 +0000 (00:09 +0200)]
bhyve.8: Clean up TTY, boot ROM, and pass-through descriptions

MFC after: 2 weeks

3 years agobhyve.8: Clean up 9P device backends section
Mateusz Piotrowski [Sun, 18 Apr 2021 21:52:48 +0000 (23:52 +0200)]
bhyve.8: Clean up 9P device backends section

MFC after: 2 weeks

3 years agobhyve.8: Clean up SCSI device backends section
Mateusz Piotrowski [Sun, 18 Apr 2021 21:49:18 +0000 (23:49 +0200)]
bhyve.8: Clean up SCSI device backends section

MFC after: 2 weeks

3 years agobhyve.8: Clean up block storage device backends description
Mateusz Piotrowski [Sun, 18 Apr 2021 21:39:53 +0000 (23:39 +0200)]
bhyve.8: Clean up block storage device backends description

MFC after: 2 weeks

3 years agobhyve.8: Clean up network backends section
Mateusz Piotrowski [Sun, 18 Apr 2021 21:29:30 +0000 (23:29 +0200)]
bhyve.8: Clean up network backends section

- Reformat the format lists, use appropriate mdoc macros for
  readability.
- Add a missing Oxford comma.

MFC after: 2 weeks

3 years agobhyve.8: Improve emulation description of the -s flag
Mateusz Piotrowski [Sun, 18 Apr 2021 21:08:39 +0000 (23:08 +0200)]
bhyve.8: Improve emulation description of the -s flag

- Set width of the list to the longest key word for readability.
- Separate descriptions of amd_hostbridge and hostbridge emulations.
  Also, wordsmith their descriptions for consistency with other entries.
- Use Cm instead of Li for command modifiers.
- Do not stylize AMD with Li, there's no need to do it.
- Mention COM3 and COM4 in the definition of lpc.
- Fix a typo in the definition of ahci-hd ("hard drive" instead of
  "hard-drive").

MFC after: 2 weeks

3 years agobhyve.8: Clean up the slot description of -s
Mateusz Piotrowski [Sun, 18 Apr 2021 20:56:19 +0000 (22:56 +0200)]
bhyve.8: Clean up the slot description of -s

Also, remove the macros of the nested list which contained slot,
emulation and conf. This decreases the indention of the -s description.
It was necessary to clean up the slot description.

MFC after: 2 weeks

3 years agobhyve.8: Clean-up synopsis of -s
Mateusz Piotrowski [Sun, 18 Apr 2021 20:28:47 +0000 (22:28 +0200)]
bhyve.8: Clean-up synopsis of -s

- Document "-s help" separately for readability.
- Use appropriate mdoc macros.

MFC after: 2 weeks

3 years agotcp: keep SACK scoreboard sorted when doing rescue retransmission
Richard Scheffenegger [Sun, 18 Apr 2021 20:14:14 +0000 (22:14 +0200)]
tcp: keep SACK scoreboard sorted when doing rescue retransmission

Reviewed By: tuexen, kbowling, #transport
MFC after: 3 days
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D29825

3 years agobhyve.8: Fix indention in the signals table
Mateusz Piotrowski [Sun, 18 Apr 2021 20:06:12 +0000 (22:06 +0200)]
bhyve.8: Fix indention in the signals table

MFC after: 2 weeks

3 years agobhyve.8: Clean up description of -r
Mateusz Piotrowski [Sun, 18 Apr 2021 20:03:40 +0000 (22:03 +0200)]
bhyve.8: Clean up description of -r

There is no need to wrap those flags in Op macros.

MFC after: 2 weeks

3 years agobhyve.8: Fix the synopsis of -p
Mateusz Piotrowski [Sun, 18 Apr 2021 20:01:30 +0000 (22:01 +0200)]
bhyve.8: Fix the synopsis of -p

Use appropriate mdoc macros.

MFC after: 2 weeks

3 years agobhyve.8: Improve the description of the -m flag
Mateusz Piotrowski [Sun, 18 Apr 2021 19:56:13 +0000 (21:56 +0200)]
bhyve.8: Improve the description of the -m flag

- Stylize the synopsis with proper mdoc macros
- Do some wordsmithing on the description for consistency.

MFC after: 2 weeks

3 years agobhyve.8: Improve the description and synopsis of -l
Mateusz Piotrowski [Sun, 18 Apr 2021 19:41:15 +0000 (21:41 +0200)]
bhyve.8: Improve the description and synopsis of -l

- Describe "-l help" separately for readability.
- List all the supported comX devices explicitly
- Use Cm instead of Ar for command modifiers (i.e., literal values a
  user can specify as an argument to the command).
- Explain where to get more information about the possible values of the
  conf argument.

MFC after: 2 weeks

3 years agobhyve.8: Sort the options in the OPTIONS section
Mateusz Piotrowski [Sun, 18 Apr 2021 18:26:04 +0000 (20:26 +0200)]
bhyve.8: Sort the options in the OPTIONS section

No content change intended. Just moving the option descriptions around
to follow the order suggested by style(9).

MFC after: 2 weeks

3 years agobhyve: Improve the option description in the usage message
Mateusz Piotrowski [Sun, 18 Apr 2021 18:13:54 +0000 (20:13 +0200)]
bhyve: Improve the option description in the usage message

- Sort options as suggested by style(9)
- Capitalize some words like CPU and HLT
- Add a missing description for the -G flag

MFC after: 2 weeks

3 years agobhyve: Fix synopsis in the usage message
Mateusz Piotrowski [Sun, 18 Apr 2021 18:04:12 +0000 (20:04 +0200)]
bhyve: Fix synopsis in the usage message

In particular:
- Sort short options to align with style(9)
- Add two missing flags: -G and -r
- Drop unnecessary angle brackets for consistency
- Rename the "vm" argument to vmname for consistency with the manual
  page

MFC after: 2 weeks

3 years agobhyve.8: Make synopsis more readable
Mateusz Piotrowski [Sun, 18 Apr 2021 17:54:45 +0000 (19:54 +0200)]
bhyve.8: Make synopsis more readable

There is no need to squeeze all the possible options into one synopsis
entry. Let "-l help" and "-s help" be listed separately.

While here, keep -s and its arguments on the same line.

MFC after: 2 weeks

3 years agoMinor style tidy: if( -> if (
Warner Losh [Sun, 18 Apr 2021 17:19:15 +0000 (11:19 -0600)]
Minor style tidy: if( -> if (

Fix a few 'if(' to be 'if (' in a few places, per style(9) and
overwhelming usage in the rest of the kernel / tree.

MFC After: 3 days
Sponsored by: Netflix

3 years agoMinor style cleanup
Warner Losh [Sun, 18 Apr 2021 17:10:59 +0000 (11:10 -0600)]
Minor style cleanup

We prefer 'while (0)' to 'while(0)' according to grep and stlye(9)'s
space after keyword rule. Remove a few stragglers of the latter.
Many of these usages were inconsistent within the file.

MFC After: 3 days
Sponsored by: Netflix

3 years agomips/octeon SDK: Fix __cvmx_cmd_queue_lock asm for clang 11
Justin Hibbits [Sun, 18 Apr 2021 16:59:04 +0000 (11:59 -0500)]
mips/octeon SDK: Fix __cvmx_cmd_queue_lock asm for clang 11

The 'ticket' and 'my_ticket' arguments are both read and written within
the same asm block.  Clang is stricter with the constraints than gcc4
was, so accepts the '=r' at face value and will happily overwrite
registers that "should" be preserved.

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

This fixes a panic on bringing up the octe interfaces.

3 years agojail.conf(5): emphasize where to find jail parameters
Fernando Apesteguía [Sun, 18 Apr 2021 15:53:42 +0000 (17:53 +0200)]
jail.conf(5): emphasize where to find jail parameters

Some people expect jail.conf(5) to have a list of jail parameters.
jail(8) contains a comprehensive list of all parameters to be used during jail
invocation or in jail.conf.

Highlighting where to look for jail parameters seems a reasonable solution.

PR: 244569
Reported by: joneum@
Approved by: 0mp (manpages, mentor)
Reviewed by: debdrup
Differential Revision: https://reviews.freebsd.org/D28701

3 years agofib algo: do not reallocate datapath index for datapath ptr update.
Alexander V. Chernikov [Sun, 18 Apr 2021 15:03:58 +0000 (16:03 +0100)]
fib algo: do not reallocate datapath index for datapath ptr update.

Fib algo uses a per-family array indexed by the fibnum to store
 lookup function pointers and per-fib data.

Each algorithm rebuild currently requires re-allocating this array
 to support atomic change of two pointers.

As in reality most of the changes actually involve changing only
 data pointer, add a shortcut performing in-flight pointer update.

MFC after: 2 weeks