]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agocxgbe(4): Move the hw-specific parts of VXLAN setup to a separate function.
Navdeep Parhar [Fri, 23 Apr 2021 07:26:47 +0000 (00:26 -0700)]
cxgbe(4): Move the hw-specific parts of VXLAN setup to a separate function.

It can be called to (re)apply the settings in the driver softc to the
hardware.

MFC after: 2 weeks
Sponsored by: Chelsio Communications

3 years agocxgbe(4): Add flag to reliably stop the driver from accessing hw stats.
Navdeep Parhar [Fri, 23 Apr 2021 00:45:52 +0000 (17:45 -0700)]
cxgbe(4): Add flag to reliably stop the driver from accessing hw stats.

There are two kinds of routines in the driver that read statistics from
the hardware: the cxgbe_* variants read the per-port MPS/MAC registers
and the vi_* variants read the per-VI registers.  They can be called
from the 1Hz callout or if_get_counter.  All stats collection now takes
place under the callout lock and there is a new flag to indicate that
these routines should not access any hardware register.

MFC after: 2 weeks
Sponsored by: Chelsio Communications

3 years agolibkiconv: address memory leak in not-found cases
Ed Maste [Wed, 21 Apr 2021 17:45:27 +0000 (13:45 -0400)]
libkiconv: address memory leak in not-found cases

Found in "Understanding and Detecting Disordered Error Handling with
Precise Function Pairing" by Qiushi Wu et al.

Reviewed by: imp, jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29896

3 years agocxgbe(4): Fix minor nit in the display of MPS TCAM entries.
Navdeep Parhar [Thu, 22 Apr 2021 22:36:51 +0000 (15:36 -0700)]
cxgbe(4): Fix minor nit in the display of MPS TCAM entries.

MFC after: 3 days

3 years agocxgbe(4): make the logging helpers a little more robust.
Navdeep Parhar [Thu, 22 Apr 2021 22:28:43 +0000 (15:28 -0700)]
cxgbe(4): make the logging helpers a little more robust.

MFC after: 3 days
Sponsored by: Chelsio Communications

3 years agohv_kbd: Fix build with EVDEV_SUPPORT kernel option disabled.
Vladimir Kondratyev [Thu, 22 Apr 2021 22:13:25 +0000 (01:13 +0300)]
hv_kbd: Fix build with EVDEV_SUPPORT kernel option disabled.

Reported by: olivier
MFC with: e4643aa4c4ff

3 years agocxgbe/t4_tom: Implement tod_pmtu_update.
Navdeep Parhar [Tue, 13 Apr 2021 23:31:08 +0000 (16:31 -0700)]
cxgbe/t4_tom: Implement tod_pmtu_update.

tod_pmtu_update was added to the kernel in 01d74fe1ffc.

Sponsored by: Chelsio Communications

3 years agonewvers.sh: better regexp for the FreeBSD_version line
Warner Losh [Thu, 22 Apr 2021 16:43:43 +0000 (10:43 -0600)]
newvers.sh: better regexp for the FreeBSD_version line

Tested with: cirrus-ci https://cirrus-ci.com/build/6012323274948608
Reviewed by: emaste@, rgrimes@
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D29869

3 years agostats.7: Add dwatch(1) to the list
Fernando Apesteguía [Thu, 22 Apr 2021 13:54:45 +0000 (15:54 +0200)]
stats.7: Add dwatch(1) to the list

PR: 255303
Approved by: 0mp (mentor)
Differential Revision: https://reviews.freebsd.org/D29924

3 years agopvscsi: Advertise maxio of 256k.
Warner Losh [Wed, 21 Apr 2021 18:10:42 +0000 (12:10 -0600)]
pvscsi: Advertise maxio of 256k.

While the PV SCSI SG list can handle 512k of SG entries, it can only do
so for I/O that's aligned to 4k or better. newfs_msdos does unaligned
I/O, so triggers too long for host errors in cam when a 512k I/O is
attempted. Prefer power of 2 256k to the absolute maximum 508k, though
that can be revisited should the latter show to give significant
performance improvement.

MFC After: 3 days
Tested by: darius on discord (508k version of patch)
Sponsored by: Netflix

3 years agobhyve: Gracefully handle virtio-scsi with no conf
Ryan Moeller [Thu, 22 Apr 2021 16:06:08 +0000 (12:06 -0400)]
bhyve: Gracefully handle virtio-scsi with no conf

Fixes segfault with the command `bhyve -s 0,virtio-scsi`, which is used
by some third party software to probe bhyve for virtio-scsi support.

Reviewed by: jhb
MFC after: 1 day
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D29926

3 years agozfs: use vn_seqc_read_notmodify for racing .. lookups
Mateusz Guzik [Thu, 22 Apr 2021 13:18:39 +0000 (13:18 +0000)]
zfs: use vn_seqc_read_notmodify for racing .. lookups

Catching an in-flight unlocked vnode is fine here.

Reported by; pho

3 years agoocs_fc: Fix memory leak in ocs_scsi_io_alloc()
Ram Kishore Vegesna [Mon, 19 Apr 2021 15:40:59 +0000 (21:10 +0530)]
ocs_fc: Fix memory leak in ocs_scsi_io_alloc()

PR: 254690
Approved by: mav(mentor)
MFC after: 2 weeks

3 years agoAdd more USB quirks for Kingston devices.
Hans Petter Selasky [Thu, 22 Apr 2021 10:40:17 +0000 (12:40 +0200)]
Add more USB quirks for Kingston devices.

PR: 253855
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoAdd more USB quirks for Garmin devices.
Hans Petter Selasky [Thu, 22 Apr 2021 10:31:33 +0000 (12:31 +0200)]
Add more USB quirks for Garmin devices.
Sort the Garmin products while at it.

PR: 254664
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoRemove USB device ID added by SVN r150701 in the CDC USB ethernet driver.
Hans Petter Selasky [Thu, 22 Apr 2021 10:22:39 +0000 (12:22 +0200)]
Remove USB device ID added by SVN r150701 in the CDC USB ethernet driver.
Since then, the FreeBSD USB stack has got proper USB RNDIS support.

PR: 254345
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years ago__FreeBSD_version: update the references to the doc tree
Ka Ho Ng [Thu, 22 Apr 2021 09:36:22 +0000 (17:36 +0800)]
__FreeBSD_version: update the references to the doc tree

Update the reference of which file to update in the doc tree when
bumping __FreeBSD_version.

This change is to catch up with commit f8fed61b80 in the doc repository.

MFC after: 3 days
Approved by: lwhsu (mentor)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29920

3 years agoFix vtnet TCP lro panic
Alexander V. Chernikov [Mon, 19 Apr 2021 15:58:41 +0000 (16:58 +0100)]
Fix vtnet TCP lro panic

Differential Revision: https://reviews.freebsd.org/D29900
Reviewed by: hps, kp

3 years agonewbus: style nit (align comments)
Warner Losh [Sun, 18 Apr 2021 05:44:25 +0000 (23:44 -0600)]
newbus: style nit (align comments)

Sponsored by: Netflix

3 years agonewbus: Optimize/Simplify kobj_class_compile_common a little
Warner Losh [Wed, 21 Apr 2021 21:35:54 +0000 (15:35 -0600)]
newbus: Optimize/Simplify kobj_class_compile_common a little

"i" is not used in this loop at all. There's no need to initialize and
increment it.

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

3 years agoriscv: Assert that SUM is not set in SSTATUS for exceptions.
John Baldwin [Wed, 21 Apr 2021 20:57:20 +0000 (13:57 -0700)]
riscv: Assert that SUM is not set in SSTATUS for exceptions.

Reviewed by: mhorne
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D29764

3 years agoriscv: Clear SUM in SSTATUS for supervisor mode exceptions.
John Baldwin [Wed, 21 Apr 2021 20:57:04 +0000 (13:57 -0700)]
riscv: Clear SUM in SSTATUS for supervisor mode exceptions.

Previously, a page fault taken during copyin/out and related functions
would run the entire fault handler while permitting direct access to
user addresses.  This could also leak across context switches (e.g. if
the page fault handler was preempted by an interrupt or slept for disk
I/O).

To fix, clear SUM in assembly after saving the original version of
SSTATUS in the supervisor mode trapframe.

Reviewed by: mhorne, jrtc27
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D29763

3 years agopmcstat: fix the usage message for -t
Mitchell Horne [Wed, 21 Apr 2021 20:44:52 +0000 (17:44 -0300)]
pmcstat: fix the usage message for -t

A slight mix-up of the flags means this case isn't triggered when it
should be. Now, `pmcstat -s event -t 1234` will print the correct
error message.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agopmcstat: set initial counter value to zero
Mitchell Horne [Wed, 21 Apr 2021 20:28:12 +0000 (17:28 -0300)]
pmcstat: set initial counter value to zero

For an infrequent event, pmcstat may report (u_long)-1 for CPUs where
the counter was never incremented. Just set this to zero, instead.

ev->ev_count is passed as the 'count' argument to pmc_allocate(3), but
this wasn't always the case.

Reviewed by: gnn
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29887

3 years agopmc_allocate(3): document the count argument
Mitchell Horne [Wed, 21 Apr 2021 20:27:49 +0000 (17:27 -0300)]
pmc_allocate(3): document the count argument

This was added in b2ca2e50b9aa, and serves to provide an initial value
to the PMC, eliminating the need for a second syscall via pmc_set(3).

Reviewed by: gnn, 0mp (manpages)
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29885

3 years agoPath MTU discovery hooks for offloaded TCP connections.
Navdeep Parhar [Tue, 13 Apr 2021 00:25:22 +0000 (17:25 -0700)]
Path MTU discovery hooks for offloaded TCP connections.

Notify the TOE driver when when an ICMP type 3 code 4 (Fragmentation
needed and DF set) message is received for an offloaded connection.
This gives the driver an opportunity to lower the path MTU for the
connection and resume transmission, much like what the kernel does for
the connections that it handles.

Reviewed by: glebius@
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D29755

3 years agoAdd required checks for unmapped mbufs in ipdivert and ipfw
Mark Johnston [Wed, 21 Apr 2021 19:38:01 +0000 (15:38 -0400)]
Add required checks for unmapped mbufs in ipdivert and ipfw

Also add an M_ASSERTMAPPED() macro to verify that all mbufs in the chain
are mapped.  Use it in ipfw_nat, which operates on a chain returned by
m_megapullup().

PR: 255164
Reviewed by: ae, gallatin
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29838

3 years agosystat: Handle SIGWINCH to properly window resizing and adjust
Michael Reifenberger [Wed, 21 Apr 2021 18:31:58 +0000 (20:31 +0200)]
systat: Handle SIGWINCH to properly window resizing and adjust
-swap disk stat based on new size.

Display corrupts after resizing a window.
Process SIGWINCH to redraw all window.

Submitted by:   Yoshihiro Ota ota@j.email.ne.jp
Differential Revision:  https://reviews.freebsd.org/D29337

3 years agosystat: Avoid incorrect reallocation in pigs.c
Michael Reifenberger [Wed, 21 Apr 2021 18:09:21 +0000 (20:09 +0200)]
systat: Avoid incorrect reallocation in pigs.c

Stop free() even if kvm_getprocs as we can come back but set nprocs = 0.
Check nprocs in showpigs() to ensure not try displaying with kvm_getprocs failed.
Current code can have pt with non-null after kvm_getprocs() failure.

Replace to realloc for simpler operations.

Submitted by: Yoshihiro Ota ota@j.email.ne.jp
Reviewed by: mckusick@
Differential Revision: https://reviews.freebsd.org/D29303

3 years agozfs: damage control racing .. lookups in face of mkdir/rmdir
Mateusz Guzik [Thu, 15 Apr 2021 07:54:18 +0000 (09:54 +0200)]
zfs: damage control racing .. lookups in face of mkdir/rmdir

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D29769

3 years agovn_open_vnode(): handle error when fp == NULL
Konstantin Belousov [Mon, 19 Apr 2021 10:25:30 +0000 (13:25 +0300)]
vn_open_vnode(): handle error when fp == NULL

If VOP_ADD_WRITECOUNT() or adv locking failed, so VOP_CLOSE() needs to
be called, we cannot use fp fo_close() when there is no fp.  This occurs
when e.g. kernel code directly calls vn_open() instead of the open(2)
syscall.

In this case, VOP_CLOSE() can be called directly, after possible lock
upgrade.

Reported by: nvass@gmx.com
PR: 255119
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D29830

3 years agorc: make the 'linux' script explicitly load filesystem modules
Edward Tomasz Napierala [Wed, 21 Apr 2021 11:54:29 +0000 (12:54 +0100)]
rc: make the 'linux' script explicitly load filesystem modules

This removes a minor annoyance with Linux jails, where you often
want linux_mounts_enable="NO", yet you want those filesystems
available for mounting in jails; normally mount(8) would result
in kernel automatically loading the KLD, but this doesn't work
inside jails or chroots.

PR: 242955
Sponsored By: EPSRC
Differential Revision: https://reviews.freebsd.org/D29725

3 years agoloader: do not output empty menu title
Toomas Soome [Wed, 21 Apr 2021 11:42:10 +0000 (14:42 +0300)]
loader: do not output empty menu title

As we output spaces around the menu title, we should also check,
if the title is actually empty string.

PR: 255299
Submitted by: Jose Luis Duran
Reported by: Jose Luis Duran
MFC after: 1 week

3 years agoAppend Keyboard Layout specified option for using VNC.
Michael Reifenberger [Wed, 21 Apr 2021 10:38:26 +0000 (12:38 +0200)]
Append Keyboard Layout specified option for using VNC.
Part one: supporting QEMU Extended Keyboard Event Message

PR:             246121
Submitted by:   koinec@yahoo.co.jp
Differential Revision: https://reviews.freebsd.org/D29430

3 years agoUpdate rtsock_l3 test after 2fe5a79425c79f7b828acd91da66d97230925fc8
Alex Richardson [Wed, 21 Apr 2021 09:58:34 +0000 (10:58 +0100)]
Update rtsock_l3 test after 2fe5a79425c79f7b828acd91da66d97230925fc8

Two of these tests now pass. Looking at Jenkins to find the first commit
where this behaviour changed indicates that
2fe5a79425c79f7b828acd91da66d97230925fc8 is the most likely cause.

Reviewed By: melifaro
Differential Revision: https://reviews.freebsd.org/D28886

3 years agotools/build/bootstrap-m4: regenerate after d37f81e35b
Alex Richardson [Wed, 21 Apr 2021 09:53:04 +0000 (10:53 +0100)]
tools/build/bootstrap-m4: regenerate after d37f81e35b

Reviewed by: jkim

3 years agousr.bin/lex: regenerate bootstrap files after d37f81e35b
Alex Richardson [Wed, 21 Apr 2021 09:50:33 +0000 (10:50 +0100)]
usr.bin/lex: regenerate bootstrap files after d37f81e35b

Reviewed by: jkim

3 years agocontrib/flex: Drop local __dead2 patch
Alex Richardson [Wed, 21 Apr 2021 09:48:55 +0000 (10:48 +0100)]
contrib/flex: Drop local __dead2 patch

Upstream flex has added a yynoreturn macro, so this diff is no longer
needed. Partially reverts r181269.

Reviewed By: jkim
Differential Revision: https://reviews.freebsd.org/D29679

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