]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agoefivar: Add --quiet to not report errors
Warner Losh [Fri, 9 Apr 2021 22:35:08 +0000 (16:35 -0600)]
efivar: Add --quiet to not report errors

Add -q/--quiet flag to the command line. With it, errors are not reported at
all. Instead nothing is printed and the exit code is non-zero.

Reviewed by: markj
Sponsored by: Netflix, Inc
Differential Revision: https://reviews.freebsd.org/D29619

(cherry picked from commit 3c0dcbfc8501155af2c5461de10fd01c615524a0)

2 years agortsold: fix memory leak in script execution
Eric van Gyzen [Wed, 23 Feb 2022 16:49:12 +0000 (10:49 -0600)]
rtsold: fix memory leak in script execution

Since commit 04e9edb54428, rtsold has leaked the memory for the
argument vector of every script it runs.

Reported by: Coverity
Reviewed by: markj
Fixes: 04e9edb5442826a14616157962361ff81e4a38fe
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D34355

(cherry picked from commit 331b84b5db11b17d1bb0cdbce986efb587a1e5ee)

2 years agortsold: Use correct error in llflags_get()
Eric van Gyzen [Wed, 23 Feb 2022 16:29:53 +0000 (10:29 -0600)]
rtsold: Use correct error in llflags_get()

Set errno to EINVAL if the name overflows the buffer, as was done
before commit ecce515d54bc.

Reviewed by: dab, markj
Fixes: ecce515d54bcea54fea03f731aad646c87761d22
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D34354

(cherry picked from commit a2a8efb4f6c15ad0880167cb22452e50aaacf52f)

2 years agosendfile_test: fix copy-paste bug
Eric van Gyzen [Thu, 24 Feb 2022 22:53:03 +0000 (16:53 -0600)]
sendfile_test: fix copy-paste bug

Require the newly opened file descriptor to be good, instead of
re-requiring the one that was required three lines earlier.
Thankfully, opening /dev/null is really unlikely to fail.

Reported by: Coverity
MFC after: 1 week
Sponsored by: Dell EMC Isilon

(cherry picked from commit a8fea07c3053293f35e00b9073b33ff6f1d9a067)

2 years agoelfdump: handle small files more gracefully
Eric van Gyzen [Thu, 17 Feb 2022 15:53:48 +0000 (09:53 -0600)]
elfdump: handle small files more gracefully

elfdump -E on an empty file would complain "Invalid argument" because
it tried to mmap zero bytes.  With the -E flag, elfdump should
simply exit non-zero.  For tiny files, the code would reference off
the end of the mapped region.

Ensure the file is large enough to contain an ELF header before mapping it.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

(cherry picked from commit 86e5e10daf54da7df358a06033f3a3bd8c852a08)

2 years agoIntegrate contrib/file/tests with kyua/atf
Eric van Gyzen [Wed, 16 Feb 2022 15:50:43 +0000 (09:50 -0600)]
Integrate contrib/file/tests with kyua/atf

This could be done better by making each test a separate ATF test case.
This exercise is left for the reader.

Reviewed by: delphij (earlier version)
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D34303

(cherry picked from commit 1581ec9a4502c1f0e4f0ce290190864abf946d6f)

2 years agonewfs_msdos: connect the ATF test from NetBSD
Eric van Gyzen [Mon, 31 Jan 2022 20:43:04 +0000 (14:43 -0600)]
newfs_msdos: connect the ATF test from NetBSD

NetBSD has an ATF test for newfs_msdos.  Connect it to the build.
Adapt it for FreeBSD.  This would have caught the bug fixed by my
previous commit.

Reviewed by: delphij, emaste
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D34116

(cherry picked from commit 4e71258227d6a0d7ae5adadb0f3672bfce2bc906)

2 years agoAllow downstream projects to easily add private and internal libs
Eric van Gyzen [Fri, 14 Jan 2022 14:12:57 +0000 (08:12 -0600)]
Allow downstream projects to easily add private and internal libs

Allow projects based on the FreeBSD tree to append to _PRIVATELIBS
and _INTERNALLIBS by simply maintaining their own lists of
LOCAL_PRIVATELIBS and LOCAL_INTERNALLIBS, respectively.

Reviewed by: bdrewery
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D33901

(cherry picked from commit d7f944a0460531cfb3ec9ae7d4bfd9dc29481ab8)

2 years agosem_clockwait_np test: fix usage of ATF API
Eric van Gyzen [Fri, 1 Oct 2021 11:25:48 +0000 (06:25 -0500)]
sem_clockwait_np test: fix usage of ATF API

ATF_REQUIRE_ERRNO requires the given errno iff the given expression is
true.  These test cases used it incorrectly, potentially allowing
sem_clockwait_np to succeed when it was expected to fail.  Use separate
ATF calls to require failure and the expected errno.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

(cherry picked from commit 35e4527e88d3843cccf2f15a32b1fa041a01d693)

2 years agosem test: move sem_clockwait_np tests into individual cases
Eric van Gyzen [Fri, 1 Oct 2021 11:24:27 +0000 (06:24 -0500)]
sem test: move sem_clockwait_np tests into individual cases

Move these tests into individual test cases for all the usual reasons.
No functional change intended.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

(cherry picked from commit 2334abfd01ba92dfa6a7ab6f2c4cc45fa64ffd3c)

2 years agosem_clockwait_np test: relax time constraint on VMs
Eric van Gyzen [Fri, 1 Oct 2021 10:37:17 +0000 (05:37 -0500)]
sem_clockwait_np test: relax time constraint on VMs

In a guest on a busy hypervisor, the time remaining after an
interrupted sleep could be much lower than other environments.
Relax the lower bound on VMs.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

(cherry picked from commit 31466594cd09d1413dbd8cab516fafc3557c2200)

2 years agoFix lockstat:::thread-spin dtrace probe with LOCK_PROFILING
Eric van Gyzen [Mon, 2 Aug 2021 18:54:57 +0000 (13:54 -0500)]
Fix lockstat:::thread-spin dtrace probe with LOCK_PROFILING

The spinning start time is missing from the calculation due to a
misplaced #endif.  Return the #endif where it's supposed to be.

Submitted by: Alexander Alexeev <aalexeev@isilon.com>
Reviewed by: bdrewery, mjg
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D31384

(cherry picked from commit 428624130abfc225b479a09a3060d0939569b1ea)

2 years agoaio_md_test: label the md
Eric van Gyzen [Fri, 23 Jul 2021 13:57:44 +0000 (08:57 -0500)]
aio_md_test: label the md

Add a label to md devices created by this test.  The next time this
test leaks md devices, finding the culprit will be much easier.

Thanks to: sobomax, for adding labels in r322969
MFC after: 1 week
Sponsored by: Dell EMC Isilon

(cherry picked from commit 9666cda9764a1d19cbf967940508dc6d2020cbfb)

2 years agoaio_md_test: NUL-terminate result of readlink
Eric van Gyzen [Fri, 23 Jul 2021 13:49:55 +0000 (08:49 -0500)]
aio_md_test: NUL-terminate result of readlink

readlink does not NUL-terminate the output buffer.  This led to spurious
failures to destroy the md device because the unit number was garbage.
NUL-terminate the output buffer.

Reported by: ASLR
MFC after: 1 week
Sponsored by: Dell EMC Isilon

(cherry picked from commit ea0e1b19f232331bffa75a0a64a6859c40f1cc4d)

2 years agoaio_md_test: fix cleanup
Eric van Gyzen [Fri, 23 Jul 2021 13:24:52 +0000 (08:24 -0500)]
aio_md_test: fix cleanup

ATF cleanup functions cannot use functions such as ATF_REQUIRE
and atf_tc_fail.  These functions assert that a test case is
currently running, which is not true during cleanup, so the
process aborts.  Change the cleanup function to simply print
to stderr and return.

MFC after: 1 week
Sponsored by: Dell EMC Isilon

(cherry picked from commit c6f92e64b6140f9e095b41687ff09ff973c28e14)

2 years agolibprocstat kstack: fix race with thread creation
Eric van Gyzen [Thu, 27 May 2021 16:33:22 +0000 (11:33 -0500)]
libprocstat kstack: fix race with thread creation

When collecting kernel stacks for a target process, if the process
adds a thread between the two calls to sysctl, ignore the additional
threads.  Previously, procstat would print only a useless error
message.  Now, it prints a consistent snapshot of the stacks.
We know that snapshot is already stale, but it could still be stale
even with a more complex fix to reallocate and retry, so such a fix
is hardly worth the effort.

Reported by: Daniel.Mitchell@emc.com
MFC after: 1 week
Sponsored by: Dell EMC Isilon

(cherry picked from commit 427f12f150e875c40acb84f292a80bfa0b90a1a2)

2 years agoWait longer for a previous IPI to be sent
Eric van Gyzen [Mon, 26 Apr 2021 15:01:17 +0000 (10:01 -0500)]
Wait longer for a previous IPI to be sent

When sending an IPI, if a previous IPI is still pending delivery,
native_lapic_ipi_vectored() waits for the previous IPI to be sent.
We've seen a few inexplicable panics with the current timeout of 50 ms.
Increase the timeout to 1 second and make it tunable.

No hardware specification mentions a timeout in this case; I checked
the Intel SDM, Intel MP spec, and Intel x2APIC spec.  Linux and illumos
wait forever.  In Linux, see __default_send_IPI_shortcut() in
arch/x86/kernel/apic/ipi.c.  In illumos, see apic_send_ipi() in
usr/src/uts/i86pc/io/pcplusmp/apic_common.c.  However, misbehaving hardware
could hang the system if we wait forever.

Reviewed by: mav kib
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D29942

(cherry picked from commit 2f32a971b7f936170b4d61318238e6cf89f198b5)

2 years agouefisign: handle empty sections
Eric van Gyzen [Tue, 6 Apr 2021 14:42:20 +0000 (09:42 -0500)]
uefisign: handle empty sections

loader.efi has an empty set_Xfic section.  Handle it correctly.

```
Sections:
Idx Name          Size      VMA               LMA               File off  Algn
[...]
3 set_Xcom      00000168  00000000000d4000  00000000000d4000  000d0e00  2**2
      CONTENTS, ALLOC, LOAD, DATA
4 set_Xfic      00000000  00000000000d4168  00000000000d4168  00000000  2**2
      ALLOC, LOAD, DATA
5 .sdata        00000448  00000000000d5000  00000000000d5000  000d1000  2**2
      CONTENTS, ALLOC, LOAD, DATA
[...]
```

Reviewed by: trasz, dab
Reported by: andy.y.liu@dell.com
Tested by: andy.y.liu@dell.com
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D29606

(cherry picked from commit 12db51d20823a5e3b9e5f8a2ea73156fe1cbfc28)

2 years agouefisign: fix handling of errors from child proc
Eric van Gyzen [Tue, 6 Apr 2021 14:36:52 +0000 (09:36 -0500)]
uefisign: fix handling of errors from child proc

Close the unused pipe file descriptors so the parent will notice if
the child exits prematurely.  Previously, the parent would block
forever on a read from the pipe.

    $ uefisign -c foo.cert -k foo.key -o loader.efi loader.efi.unsigned
    uefisign: section points inside the headers
    load: 0.06  cmd: uefisign 4502 [piperd] 7.25r 0.00u 0.00s 0% 5968k
    ... _sleep+0x1be pipe_read+0x3d6 kern_readv+0x8c sys_read+0x83 ...

Reviewed by: trasz
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D29605

(cherry picked from commit 9e6158d274829249322efb3767e6ac2e690cc4a9)

2 years agocxgbe(4): Fix build warning for LINT-NOIP.
Navdeep Parhar [Mon, 10 Jan 2022 20:32:39 +0000 (12:32 -0800)]
cxgbe(4): Fix build warning for LINT-NOIP.

MFC after: 1 week
Sponsored by: Chelsio Communications

(cherry picked from commit 94e6b3fee1e5f1ae52741c367c4a3f93a0c0708d)

2 years agocxgbe(4): Fix "set but not used [-Wunused-but-set-variable]" warnings.
Navdeep Parhar [Wed, 5 Jan 2022 20:23:06 +0000 (12:23 -0800)]
cxgbe(4): Fix "set but not used [-Wunused-but-set-variable]" warnings.

Sponsored by: Chelsio Communications

(cherry picked from commit 39d5cbdc1b783e2f199349a7a20b6d7c58e180a0)

2 years agolibctf: Use const ctf_file_t references in string lookup routines
Mark Johnston [Wed, 23 Feb 2022 23:37:40 +0000 (18:37 -0500)]
libctf: Use const ctf_file_t references in string lookup routines

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 45c23c2608ec3e34b5c7ce18eca91a46419e363c)

2 years agofbt: Remove handling for CTFv1
Mark Johnston [Wed, 23 Feb 2022 14:58:35 +0000 (09:58 -0500)]
fbt: Remove handling for CTFv1

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 2997ab002e0c3430aff00c8b6f6b0c44c6707bd7)

2 years agolibctf: Remove checks for CTFv1
Mark Johnston [Wed, 23 Feb 2022 14:57:41 +0000 (09:57 -0500)]
libctf: Remove checks for CTFv1

Per commit 7db423d69273 ("libctf: Rip out CTFv1 support") this support
is obsolete.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 565518046c9e721ea6ff608d44f1e89d344e5e02)

2 years agolibdtrace: Add a missing newline to an error message
Mark Johnston [Wed, 23 Feb 2022 16:31:51 +0000 (11:31 -0500)]
libdtrace: Add a missing newline to an error message

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 1ef441f69933dd3246c9b563c0c8f328e474b359)

2 years agomps/mpr: Add missing newlines in error messages.
Alexander Motin [Tue, 22 Feb 2022 20:06:48 +0000 (15:06 -0500)]
mps/mpr: Add missing newlines in error messages.

MFC after: 1 week

(cherry picked from commit 074bed4f486b4fa54e4d9bd2fccfad3cce732ba1)

2 years agoriscv: Fix another race in pmap_pinit()
Mark Johnston [Tue, 22 Feb 2022 14:26:33 +0000 (09:26 -0500)]
riscv: Fix another race in pmap_pinit()

Commit c862d5f2a789 ("riscv: Fix a race in pmap_pinit()") did not really
fix the race.  Alan writes,

 Suppose that N entries in the L1 tables are in use, and we are in the
 middle of the memcpy().  Specifically, we have read the zero-filled
 (N+1)st entry from the kernel L1 table.  Then, we are preempted.  Now,
 another core/thread does pmap_growkernel(), which fills the (N+1)st
 entry.  Finally, we return to the original core/thread, and overwrite
 the valid entry with the zero that we earlier read.

Try to fix the race properly, by copying kernel L1 entries while holding
the allpmaps lock.  To avoid doing unnecessary work while holding this
global lock, copy only the entries that we expect to be valid.

Fixes: c862d5f2a789 ("riscv: Fix a race in pmap_pinit()")
Reported by: alc, jrtc27
Reviewed by: alc
Sponsored by: The FreeBSD Foundation

(cherry picked from commit d5c0a7b6d3923d2a6967810d0aa3e148a39351c1)

2 years agoriscv: Fix a race in pmap_pinit()
Mark Johnston [Tue, 8 Feb 2022 18:15:54 +0000 (13:15 -0500)]
riscv: Fix a race in pmap_pinit()

All pmaps share the top half of the address space.  With 3-level page
tables, the top-level kernel map entries are not static: they might
change if the kernel map is extended (via pmap_growkernel()) or a 1GB
mapping in the direct map is demoted (not implemented yet).  Thus the
riscv pmap maintains the allpmaps list to synchronize updates to
top-level entries.

When a pmap is created, it is inserted into this list after copying
top-level entries from the kernel pmap.  The copying is done without
holding the allpmaps lock, and it is possible for pmap_pinit() to race
with kernel map updates.  In particular, if a thread is modifying L1
entries, and a concurrent pmap_pinit() copies the old version of the
entries, it might not receive the update.

Fix the problem by copying the kernel map entries after inserting the
pmap into the list.  This ensures that the nascent pmap always receives
updates, though pmap_distribute_l1() may race with the page copy.

Reviewed by: mhorne, jhb
Sponsored by: The FreeBSD Foundation

(cherry picked from commit c862d5f2a789925efe70fc64247caa5148e98a54)

2 years agoreadelf: add Arm address mask note type NT_ARM_ADDR_MASK
Ed Maste [Tue, 22 Feb 2022 17:40:39 +0000 (12:40 -0500)]
readelf: add Arm address mask note type NT_ARM_ADDR_MASK

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

(cherry picked from commit 817e68d8e64a4949a8b390b302738d45107aee49)

2 years agosrc.libnames.mk: add a comment explaining libssp_nonshared
Ed Maste [Tue, 22 Feb 2022 21:22:03 +0000 (16:22 -0500)]
src.libnames.mk: add a comment explaining libssp_nonshared

libssp_nonshared is a special case for (only) i386 and power*.  Add a
comment explaining why, based on the original commit message that added
it.

MFC after: 1 week
Fixes: 0f61170882cb ("libssp_nonshared: use only on i386 and ppc")
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 9aa786cbb50e997739f31094dc8d45260f19c63c)

2 years agobridge: Don't share broadcast packets
Kristof Provost [Sat, 19 Feb 2022 15:34:31 +0000 (16:34 +0100)]
bridge: Don't share broadcast packets

if_bridge duplicates broadcast packets with m_copypacket(), which
creates shared packets. In certain circumstances these packets can be
processed by udp_usrreq.c:udp_input() first, which modifies the mbuf as
part of the checksum verification. That may lead to incorrect packets
being transmitted.

Use m_dup() to create independent mbufs instead.

Reported by: Richard Russo <toast@ruka.org>
Reviewed by: donner, afedorov
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D34319

(cherry picked from commit 36637dd19dba79088e53c6f2aa026415eae9f8f0)

2 years agonetinet: allow UDP tunnels to be removed
Kristof Provost [Tue, 15 Feb 2022 10:49:39 +0000 (11:49 +0100)]
netinet: allow UDP tunnels to be removed

udp_set_kernel_tunneling() rejects new callbacks if one is already set.
Allow callbacks to be cleared. The use case for this is OpenVPN DCO,
where the socket is opened by userspace and then adopted by the kernel
to run the tunnel. If the DCO interface is removed but userspace does
not close the socket (something the kernel cannot prevent) the installed
callbacks could be called with an invalidated context.

Allow new functions to be set, but only if they're NULL (i.e. allow the
callback functions to be cleared).

Reviewed by: tuexen
MFC after: 3 weeks
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D34288

(cherry picked from commit 995cba5a0c9659e623b910429222ac2831a2ecca)

2 years agopf tests: Test per-anchor tables
Kristof Provost [Thu, 17 Feb 2022 13:13:50 +0000 (14:13 +0100)]
pf tests: Test per-anchor tables

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

(cherry picked from commit 7d3fc84b2d3eb18b675200dbf7732ef41eb79fe2)

2 years agopf tests: remove a stray 'set -x'
Kristof Provost [Thu, 17 Feb 2022 12:40:41 +0000 (13:40 +0100)]
pf tests: remove a stray 'set -x'

'set -x' is very useful when debugging tests, but does not need to be
left in.

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

(cherry picked from commit 7f55a9b490cc792491eebb50e46680b8eb2153ee)

2 years agovm_pageout: Print a more accurate message to the console before an OOM kill
Mark Johnston [Fri, 14 Jan 2022 20:03:53 +0000 (15:03 -0500)]
vm_pageout: Print a more accurate message to the console before an OOM kill

Previously we'd always print "out of swap space."  This can be
misleading, as there are other reasons an OOM kill can be triggered.  In
particular, it's entirely possible to trigger an OOM kill on a system
with plenty of free swap space.

Reviewed by: kib
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 4a864f624a7097f1d032a0350ac70fa6c371179e)

2 years agortld.1: Fix misplaced text
John F. Carr [Fri, 25 Feb 2022 16:09:03 +0000 (11:09 -0500)]
rtld.1: Fix misplaced text

PR: 262194
Fixes: f90218886fc8 ("rtld: introduce PRELOAD_FDS")

(cherry picked from commit 6c799530d8dc91d4e5c390274b8a27231f369a56)

2 years agocxgbe(4): Fix illegal hardware access in cxgbe_refresh_stats.
Navdeep Parhar [Sat, 12 Feb 2022 00:58:46 +0000 (16:58 -0800)]
cxgbe(4): Fix illegal hardware access in cxgbe_refresh_stats.

cxgbe_refresh_stats takes into account VI_SKIP_STATS but not
VI_INIT_DONE when deciding whether to read the hardware stats.  But
before this change VI_SKIP_STATS was set only for VIs with VI_INIT_DONE.
That meant that cxgbe_refresh_stats always accessed the hardware for
uninitialized VIs, and this is a problem if the adapter is suspended or
in the middle of a reset.

Fix this by setting VI_SKIP_STATS on all VIs during suspend.  While
here, ignore VI_INIT_DONE in vi_refresh_stats too to be consistent with
cxgbe_refresh_stats.

Sponsored by: Chelsio Communications

(cherry picked from commit 08c7dc7fd4735b85e9696d0439af6cc98b23b25d)

2 years agocxgbe(4): Avoid unsafe hardware access in the ifmedia ioctls.
Navdeep Parhar [Fri, 11 Feb 2022 23:37:17 +0000 (15:37 -0800)]
cxgbe(4): Avoid unsafe hardware access in the ifmedia ioctls.

The hardware is unavailable when the device is suspended or in the
middle of a reset.

Sponsored by: Chelsio Communications

(cherry picked from commit 39a36707bd33b86a115651678028baeb616c8365)

2 years agocxgbe(4): Fix bad races between sysctl and driver detach.
Navdeep Parhar [Thu, 13 Jan 2022 22:21:49 +0000 (14:21 -0800)]
cxgbe(4): Fix bad races between sysctl and driver detach.

The default sysctl context setup by newbus for a device is eventually
freed by device_sysctl_fini, which runs after the device driver's detach
routine.  sysctl nodes associated with this context must not use any
resources (like driver locks, hardware access, counters, etc.) that are
released by driver detach.

There are a lot of sysctl nodes like this in cxgbe(4) and the fix is to
hang them off a context that is explicitly freed by the driver before it
releases any resource that might be used by a sysctl.

This fixes panics when running "sysctl dev.t6nex dev.cc" in a tight loop
and loading/unloading the driver in parallel.

Reported by: Suhas Lokesha
Sponsored by: Chelsio Communications

(cherry picked from commit a727d9531afbd58e304acc27e3717031e78bff90)

2 years agocxgbe(4): Fix regression in previous attempt to fix FEC selection.
Navdeep Parhar [Mon, 10 Jan 2022 21:54:06 +0000 (13:54 -0800)]
cxgbe(4): Fix regression in previous attempt to fix FEC selection.

Sponsored by: Chelsio Communications

(cherry picked from commit d0ff9b029c7175e20c801126be127db7c651b02e)

2 years agocxgbe(4): Do not ignore the return value of ifmedia_ioctl.
Navdeep Parhar [Mon, 10 Jan 2022 21:01:51 +0000 (13:01 -0800)]
cxgbe(4): Do not ignore the return value of ifmedia_ioctl.

This ensures that the driver reports an error instead of failing
silently when an invalid media is requested.

Reported by: Suhas Lokesha @ Chelsio
Sponsored by: Chelsio Communications

(cherry picked from commit cdd7fe04cb803d49a2fb6389be70f4378ae3ca3b)

2 years agocxgbe(4): Do not request an FEC that is invalid for the requested speed.
Navdeep Parhar [Wed, 5 Jan 2022 18:45:06 +0000 (10:45 -0800)]
cxgbe(4): Do not request an FEC that is invalid for the requested speed.

This eliminates error messages like this from the driver when running at
50Gbps with 100G cables:
[3726] cc0: l1cfg failed: 71
[4407] cc0: l1cfg failed: 71

Note that link comes up anyway with or without this change.

Reported by: Suhas Lokesha @ Chelsio
Sponsored by: Chelsio Communications

(cherry picked from commit f3c2987f2f5c91f0801fa8bbf9e1bc09d91aeb46)

2 years agocxgbe(4): Update firmwares to 1.26.6.0.
Navdeep Parhar [Mon, 3 Jan 2022 22:35:45 +0000 (14:35 -0800)]
cxgbe(4): Update firmwares to 1.26.6.0.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
CHANGES
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Version : 1.26.6.0
Date    : 01/03/2022
================================================================================

Fixes
-----
BASE:
- Fixed one module eeprom read failure.
- Fixed an issue with speed selection when 40G and 25G are advertised and
  supported.
- Fixed a random traffic hang when T5 receives invalid ets BW in dcbx
  messages from a switch.
- Fixed very long link up time with few switches.
================================================================================

Obtained from: Chelsio Communications
Sponsored by: Chelsio Communications

(cherry picked from commit 3b76242433e5651bce0c89ce98af450c0cd02ad1)

2 years agocxgbe(4): Fix stats collection for ports with port_id != tx_chan
Navdeep Parhar [Mon, 3 Jan 2022 21:31:46 +0000 (13:31 -0800)]
cxgbe(4): Fix stats collection for ports with port_id != tx_chan

This fixes a driver panic during stats collection when a port's id does
not match its tx channel.  The bug affected only the T580 card running
with a non-default VPD.

Reported by: Suhas Lokesha @ Chelsio
Sponsored by: Chelsio Communications

(cherry picked from commit bbab9ab5796028e6ef9d765bfd307936bde14e89)

2 years agocxgbe(4): Fix panic on driver detach after a partially failed attach.
Navdeep Parhar [Wed, 29 Dec 2021 00:46:09 +0000 (16:46 -0800)]
cxgbe(4): Fix panic on driver detach after a partially failed attach.

sge->ctrlq is not always allocated during attach (eg. if firmware
initialization fails) and detach should be able to deal with this.

Sponsored by: Chelsio Communications

(cherry picked from commit b99651c52fa52cdef5688859e0bc7f3fb2085a2f)

2 years agocxgbe(4): Update firmwares to 1.26.4.0
Navdeep Parhar [Thu, 9 Dec 2021 19:10:48 +0000 (11:10 -0800)]
cxgbe(4): Update firmwares to 1.26.4.0

(Rest is from the README that came with the firmware)

Version : 1.26.4.0
Date    : 12/02/2021

Fixes
-----

BASE:
- Fixed error on setting 25G speed on 100G copper with multiple FEC set in
  firmware commands.
- Handle link of unknown optics modules by enabling module tx unconditionally.
- Fixed link not coming up for 25G CRS phys. Firmware incorrectly tried to
  bring up the link in RS-FEC but as per IEEE spec, it must be BASER FEC.
- Fixed an issue where firmware doesn't automatically retry next FEC if driver
  asks to bring up the link using RS-FEC and link doesn't come up.

Obtained from: Chelsio Communications
Sponsored by: Chelsio Communications

(cherry picked from commit 357ba2cf17bf2a201ada5c54822e4f92ff2df296)

2 years agocxgbe(4): Change the way t4_shutdown_adapter brings the link(s) down.
Navdeep Parhar [Mon, 15 Nov 2021 18:55:04 +0000 (10:55 -0800)]
cxgbe(4): Change the way t4_shutdown_adapter brings the link(s) down.

Modify the GPIO pins only on the Base-T cards and even there drive all
of them low instead of putting them in hi-z state.  For the rest (this
is the common case), directly power off the PLLs of the high speed
serdes.  This is the simplest method that does not involve or conflict
with the firmware but still works with all T4-T6 cards regardless of
what's plugged into the port.

This fixes a problem where the peer wouldn't always see a link down if
it is connected to the device using a -CR4 copper cable.

Sponsored by: Chelsio Communications

(cherry picked from commit a8eacf9329e2984f9c950fb5ef6447be4676007a)

2 years agocxgbe(4): Keep link configuration compatible with really old firmwares.
Navdeep Parhar [Thu, 11 Nov 2021 00:10:41 +0000 (16:10 -0800)]
cxgbe(4): Keep link configuration compatible with really old firmwares.

Sponsored by: Chelsio Communications

(cherry picked from commit 8e76bae0b72e53da80c48ba138b1cfd712724df4)

2 years agocxgbe(4): internal knob for flexible control over FEC selection.
Navdeep Parhar [Wed, 10 Nov 2021 19:38:54 +0000 (11:38 -0800)]
cxgbe(4): internal knob for flexible control over FEC selection.

Recent firmwares have support for autonomous FEC selection and a "force"
knob to let the driver control this behavior (or not) in a fine grained
manner. This change adds a driver knob so that all the different ways of
configuring the link FEC can be exercised. Note that this controls the
internal driver/firmware interaction for link configuration and is not
meant for general use.

Sponsored by: Chelsio Communications

(cherry picked from commit 448bcd01dc5edcbbf23975588f131e13cd09778f)

2 years agocxgbe(4): separate sysctls for user-requested and in-use FEC.
Navdeep Parhar [Wed, 10 Nov 2021 18:54:53 +0000 (10:54 -0800)]
cxgbe(4): separate sysctls for user-requested and in-use FEC.

Recent firmwares have more leeway in FEC selection and there is a need
to track the FECs requested by the driver separately from the FEC in use
on the link. The existing dev.<port>.<inst>.fec sysctl can read both but
its behavior depends on the link state and it is sometimes hard to find
out what was requested when the link is up.

Split the fec sysctl into two (requested_fec and link_fec) to get access
to both pieces of information regardless of the link state.

Sponsored by: Chelsio Communications

(cherry picked from commit f6a2e1100fa09742aa29d8e51fd6181fb5c171bb)

2 years agocxgbe(4): sysctl to track the last L1_CFG32 requested by the driver.
Navdeep Parhar [Wed, 3 Nov 2021 18:00:44 +0000 (11:00 -0700)]
cxgbe(4): sysctl to track the last L1_CFG32 requested by the driver.

dev.<port>.<inst>.rcaps

 # sysctl dev.cc | grep rcaps
 dev.cc.1.rcaps: 581107776
 dev.cc.0.rcaps: 582156414

Sponsored by: Chelsio Communications

(cherry picked from commit d99b1d83b9e9ae2c47ffbd71a7c2a261d9eae2dd)

2 years agofsck_ffs: don't try to write in read-only mode
Chuck Silvers [Tue, 29 Jun 2021 21:29:15 +0000 (14:29 -0700)]
fsck_ffs: don't try to write in read-only mode

(cherry picked from commit ed1a156b038dee0e7a02c2935186ad5d8f4c36c1)

Sponsored by: Netflix

2 years agoiwlwifi: update firmware
Bjoern A. Zeeb [Thu, 24 Feb 2022 21:40:20 +0000 (21:40 +0000)]
iwlwifi: update firmware

Update to the latest firmware based on
linux-firmware at c53073d4e1485ac9f7cb065db466793c495aead7
and update firmware module Makefiles accordingly.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 062103fc93c308dec65a183c51dc7f53b8c76e6d)

2 years agoiwlwifi: enhance debug information
Bjoern A. Zeeb [Thu, 24 Feb 2022 21:38:27 +0000 (21:38 +0000)]
iwlwifi: enhance debug information

Add a string of the debug type to the output of the debug message so it
is easier to search for specific events in a trace with lots of debugging
on.  While here remove superflous ().

Sponsored by: The FreeBSD Foundation

(cherry picked from commit 51152e5e6150746ad5514f169c8fd1d04b010b35)

2 years agoiwlwifi: update from iwlwifi-next
Bjoern A. Zeeb [Thu, 24 Feb 2022 21:34:13 +0000 (21:34 +0000)]
iwlwifi: update from iwlwifi-next

Import new code from iwlwifi-next at cb0a1fb7fd86b0062692b5056ca8552906509512
(matching tag: iwlwifi-next-for-kalle-2022-02-18).

Also add files not previously imported because we are not yet compiling
them to ease updating and having them when needed.

This adds MEI (Management Engine) support upstream which we cannot import
(currently GPL-only) so we have stub functions for the missing bits.

This also reduces the diff to upstream.  Changes submitted to avoid
problems with const and  with void * arithmetics were merged.

In the module build Makefile disable CONFIG_IWLWIFI_OPMODE_MODULAR
as we are building iwlwifi as a single module.

Sponsored by:   The FreeBSD Foundation

(cherry picked from commit d9836fb4b9380e2ed1c38455fb31a3832b452671)

2 years agoLinuxKPI: update 802.11 headers
Bjoern A. Zeeb [Tue, 22 Feb 2022 22:57:31 +0000 (22:57 +0000)]
LinuxKPI: update 802.11 headers

Add new defines, struct members, and (stub) functions needed for an
updated iwlwifi.  Most of the defines are for rfkill or HE.

Pull in a case statement from the upcoming iwlwifi update to
not break the build.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit d875aa1587ce7d1651cabe395ed991f2384795cd)
(cherry picked from commit 9ad210c15933e5a49c51fba134e77d84cfdba94f)

2 years agoLinuxKPI: change DECLARE_FLEX_ARRAY()
Bjoern A. Zeeb [Tue, 22 Feb 2022 22:48:08 +0000 (22:48 +0000)]
LinuxKPI: change DECLARE_FLEX_ARRAY()

DECLARE_FLEX_ARRAY can be used inside a structure.  On FreeBSD due to
-Wgnu-variable-sized-type-not-at-end this yields an error.  Use [0]
instead of [] to overcome this.

Sponsored by: The FreeBSD Foundation
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D34350

(cherry picked from commit fab601c5b76a1183c1849222667481fdde948ef9)

2 years agoLinuxKPI: add MODULE_IMPORT_NS()
Bjoern A. Zeeb [Tue, 22 Feb 2022 22:45:50 +0000 (22:45 +0000)]
LinuxKPI: add MODULE_IMPORT_NS()

Add dummy MODULE_IMPORT_NS() used by an updated iwlwifi.

Sponsored by: The FreeBSD Foundation
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D34349

(cherry picked from commit f6fb9b524ff91a6049d2e0bf713f4fc5760148b6)

2 years agoLinuxKPI: skbuff.h add skb_postpush_rcsum()
Bjoern A. Zeeb [Tue, 22 Feb 2022 22:54:48 +0000 (22:54 +0000)]
LinuxKPI: skbuff.h add skb_postpush_rcsum()

Add a stub for skb_postpush_rcsum() needed by an updated iwlwifi.

Sponsored by: The FreeBSD Foundation

(cherry picked from commit a3e07b6ef3e12b7e6f8b4cfbd6eca7a7c3749d00)

2 years agoLinuxKPI: USB change successful probe result to BUS_PROBE_DEFAULT
Bjoern A. Zeeb [Fri, 18 Feb 2022 22:16:57 +0000 (22:16 +0000)]
LinuxKPI: USB change successful probe result to BUS_PROBE_DEFAULT

Rather than returning 0 (which is BUS_PROBE_SPECIFIC) return
BUS_PROBE_DEFAULT to give other drivers a possible chance too
to attach.

Reported by: jhb
Reviewed by: hselasky, jhb, imp
Differential Revision: https://reviews.freebsd.org/D34317

(cherry picked from commit 810ca5629aae1c525f29fae5498a64b596736094)

2 years agoLinuxKPI: return value for linux_pci_probe()
Bjoern A. Zeeb [Mon, 17 Jan 2022 00:47:13 +0000 (00:47 +0000)]
LinuxKPI: return value for linux_pci_probe()

In linux_pci_probe() return BUS_PROBE_DEFAULT rather than 0
(which actually is BUS_PROBE_SPECIFIC and means 'Only this
driver can use this device').

Sponsored by:   The FreeBSD Foundation
Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D33913

(cherry picked from commit 39d8c3870752c597700c32c9dd57d421a1334611)

2 years agoRELNOTES: Add entry for bhyve NVMe 1.4 support
Chuck Tuffli [Tue, 22 Feb 2022 07:09:09 +0000 (23:09 -0800)]
RELNOTES: Add entry for bhyve NVMe 1.4 support

This is a direct commit.

2 years agobhyve nvme: Advertise Namespace changed AEN
Chuck Tuffli [Wed, 23 Feb 2022 15:18:54 +0000 (07:18 -0800)]
bhyve nvme: Advertise Namespace changed AEN

Advertise Namespace Attribute Notices events in the Optional
Asynchronous Events Supported (OAES) field of the Identify Controller
data structure. Additionally, rename the enums and macros to clarify
these are AEN's related to Notices and not generic information.

Reported by: andy@omniosce.org

(cherry picked from commit e0ac9dc2b069c309c0dc18d3170d9883c421bfd9)

2 years agonvme: fix spelling of Namespace
Chuck Tuffli [Mon, 21 Feb 2022 18:34:46 +0000 (10:34 -0800)]
nvme: fix spelling of Namespace

Fix spelling of a macro definition.

PR: 262141

(cherry picked from commit c2318cf80a9edf5bfcd5ed20037c8d0b80a78d69)

2 years agonvme: Add OAES bit-field definitions
Chuck Tuffli [Mon, 21 Feb 2022 18:34:14 +0000 (10:34 -0800)]
nvme: Add OAES bit-field definitions

Create definitions for the Optional Asynchronous Events Supported (OAES)
values. Also adds a helper macro for the common use case of "mask and
shift". E.g.
    value = NVME_CTRLR_DATA_OAES_NS_ATTR_MASK << NVME_CTRLR_DATA_OAES_NS_ATTR_SHIFT;
becomes
    value = NVMEB(NVME_CTRLR_DATA_OAES_NS_ATTR);

(cherry picked from commit e71afa1202750b7cc8d49e77b7eed0114ece1657)

2 years agoUpdate fsdb(8) to reflect new structure of fsck_ffs(8).
Kirk McKusick [Wed, 23 Feb 2022 23:39:52 +0000 (15:39 -0800)]
Update fsdb(8) to reflect new structure of fsck_ffs(8).

(cherry picked from commit c5d476c98c2275966f68c7b81dab2421b143f5a9)

2 years agoAvoid unaligned writes by fsck_ffs(8).
Kirk McKusick [Sun, 20 Feb 2022 21:18:05 +0000 (13:18 -0800)]
Avoid unaligned writes by fsck_ffs(8).

(cherry picked from commit 7a1c1f6a0332c5b60349a5df0e3ce64e5005b2ff)

2 years agofetch(1): merge several improvements for handling of soft failures
Eugene Grosbein [Mon, 24 Jan 2022 04:03:42 +0000 (11:03 +0700)]
fetch(1): merge several improvements for handling of soft failures

Let "fetch -a" resume truncated transfer automatically to perform
another attempt if it obtained some new data in previous one
making progress.

Do not consider HTTP 5XX errors as soft failures.
Also, authorization errors should not be considered as soft failures.

(cherry picked from commit e3bad5f7aa86a0911cf8d28395e7a29395739985)
(cherry picked from commit a4efbe0d6da28eea0de4d414af25e7853ab8adfa)
(cherry picked from commit bf599c03f09dea0f7e188e002b42d782af6841c3)
(cherry picked from commit 08a2504a207c9302939bc0d1173fe44875e2a2e4)
(cherry picked from commit 85f15576b423b9ad5b8a9e6dab3e71558ebe4335)

2 years agokeymap: Add extra Alt Gr mapping for Brazillian Portuguese ABNT2 keyboards
Alfredo Dal'Ava Junior [Wed, 23 Feb 2022 00:35:09 +0000 (21:35 -0300)]
keymap: Add extra Alt Gr mapping for Brazillian Portuguese ABNT2 keyboards

This adds missing Alt Gr mappings for the keys "q", "w", "e" an "c" to
conform with ABNT2 standard.

PR: 256416
Submitted by: Neebz <vpguyrhpjltta@logicstreak.com>
Reviewed by: emaste
MFC after: 2 weeks
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D33801

(cherry picked from commit 07625bc4b30d66be5690d65debe56153aaf648bd)

2 years agoMFC b58cf1cb35ab:
Ryan Stone [Thu, 7 Jan 2021 17:25:56 +0000 (12:25 -0500)]
MFC b58cf1cb35ab:

Fix race condition in linuxkpi workqueue

Consider the following scenario:

1. A delayed_work struct in the WORK_ST_TIMER state.
2. Thread A calls mod_delayed_work()
3. Thread B (a callout thread) simultaneously calls
linux_delayed_work_timer_fn()

The following sequence of events is possible:

A: Call linux_cancel_delayed_work()
A: Change state from TIMER TO CANCEL
B: Change state from CANCEL to TASK
B: taskqueue_enqueue() the task
A: taskqueue_cancel() the task
A: Call linux_queue_delayed_work_on().  This is a no-op because the
state is WORK_ST_TASK.

As a result, the delayed_work struct will never be invoked.  This is
causing address resolution in ib_addr.c to stop permanently, as it
never tries to reschedule a task that it thinks is already scheduled.

Fix this by introducing locking into the cancel path (which
corresponds with the lock held while the callout runs).  This will
prevent the callout from changing the state of the task until the
cancel is complete, preventing the race.

Differential Revision: https://reviews.freebsd.org/D28420
Reviewed by: hselasky
MFC after: 2 months

(cherry picked from commit b58cf1cb35abc095d7fb9773630794b38bbc6b1d)

2 years agoMFC 2290dfb40fce:
Ryan Stone [Wed, 19 May 2021 19:10:03 +0000 (15:10 -0400)]
MFC 2290dfb40fce:

Enter the net epoch before calling ip6_setpktopts

ip6_setpktopts() can look up ifnets via ifnet_by_index(), which
is only safe in the net epoch.  Ensure that callers are in the net
epoch before calling this function.

Sponsored by: Dell EMC Isilon
MFC after: 4 weeks
Reviewed by: donner, kp
Differential Revision: https://reviews.freebsd.org/D30630

(cherry picked from commit 2290dfb40fce0ab46d91244282014173c7316e42)

2 years agoMFC 315bca194a14:
Ryan Stone [Wed, 7 Jul 2021 20:04:10 +0000 (16:04 -0400)]
MFC 315bca194a14:

Fix an early return in ctld UCL parser

If the UCL ctld parser encountered a port that used the CTL
ioctl device, it fell into a special case that had an erroneous
early return.  This caused all configuration in the target
following the port attribute to be skipped.  Fix this by replacing
the return with a continue so that the rest of the config is
parsed correctly.

Sponsored by: Dell EMC Isilon
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D31703
Reviewed by: bapt

(cherry picked from commit 315bca194a14f3b9ec683675bafa8d990d16bfaf)

2 years agovt: fix double-click word selection for first/last word on line
Ed Maste [Mon, 21 Feb 2022 04:09:36 +0000 (23:09 -0500)]
vt: fix double-click word selection for first/last word on line

Previously when double-clicking on the first word on a line we would
select from the cursor position to the end of the word, not from the
beginning of the line.  Similarly, when double-clicking on the last word
on a line we would select from the beginning of the word to the cursor
position rather than the end of the line.

This is because we searched backward or forward for a space character to
mark the beginning or end of a word.  Now, use the beginning or end of
the line if we do not find a space.

PR: 261553
Sponsored by: The FreeBSD Foundation

(cherry picked from commit 692bb3f0291b21337eb9a778f71a5b97a47e4c11)
(cherry picked from commit 521dbfd6b1085511769c419d44f11842e92067f5)

2 years agombuf: make M_ASSERT_NO_SND_TAG() as strict as other similar asserts
Hans Petter Selasky [Fri, 25 Feb 2022 09:57:10 +0000 (10:57 +0100)]
mbuf: make M_ASSERT_NO_SND_TAG() as strict as other similar asserts

Fixes: 17cbcf33c3b6

(cherry picked from commit f59fa112807b85abbd070c8ef6b1ac6e70207acb)

2 years agofreebsd-update.conf.5: Sort options
Mateusz Piotrowski [Thu, 17 Feb 2022 09:54:07 +0000 (10:54 +0100)]
freebsd-update.conf.5: Sort options

Reported by: pauamma_gundo.com
MFC after: 1 week

(cherry picked from commit bf8e97858365fe121968445c593dd4128d5f5490)

2 years agofreebsd-update.conf.5: Address style issues
Mateusz Piotrowski [Thu, 17 Feb 2022 09:40:48 +0000 (10:40 +0100)]
freebsd-update.conf.5: Address style issues

- Do not set Os to FreeBSD explicitly. We don't do it in other manual
  pages.
- Remove macros from the -width specifier.
- Use Xr instead of Cm to refer to the freebsd-update command.
- Address some mandoc lint warnings and use \(em instead of --.
- Wordsmith some paragraphs.
- Add a missing El macro.

MFC after: 1 week

(cherry picked from commit b80bb8b197aed4db48810d67be0239fd029c6465)

2 years agofreebsd-update.8: Document CreateBootEnv
Mateusz Piotrowski [Fri, 4 Feb 2022 10:20:49 +0000 (11:20 +0100)]
freebsd-update.8: Document CreateBootEnv

Also, add bectl(8) to section "See Also". [1]

PR: 261716
Reviewed by: debdrup, pauamma_gundo.com
MFC after: 1 week
Fixes: f28f13890541 freebsd-update: create a ZFS boot environment on install
Differential Revision: https://reviews.freebsd.org/D34169
Co-authored-by: Tobias Rehbein <tobias.rehbein@web.de> [1]

(cherry picked from commit 6d17f2d04302af6408127b9f8a307e2977c6d086)

2 years agoena: update ENA version to v2.5.0
Michal Krawczyk [Mon, 3 Jan 2022 13:51:59 +0000 (14:51 +0100)]
ena: update ENA version to v2.5.0

Some of the changes in this release:
- IPv6 L4 checksum offload fixes.
- Optimization of the Tx req_id validation.
- Timer service adjustments.
- NUMA awareness for the kernel RSS mode.

Submitted by: Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 8a5b4859c7fcefac7db611ef38450ef0a66d68a8)

2 years agoena: fix man page typos and update contact section
Michal Krawczyk [Mon, 3 Jan 2022 13:51:52 +0000 (14:51 +0100)]
ena: fix man page typos and update contact section

Verified spelling in the README and fixed the typos.

Also updated the contact section by removing Artur and adding Dawid
Gorecki who is now the second ENA FreeBSD driver developer.

Submitted by: Michal Krawczyk <mk@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 95161adfcb9261af81015b9c8ec97a445a993e4c)

2 years agoena: do not call reset if device is unresponsive
Dawid Gorecki [Mon, 3 Jan 2022 13:50:29 +0000 (14:50 +0100)]
ena: do not call reset if device is unresponsive

If the device becomes unresponsive, the driver will not be able to
finish the reset process correctly. Timeout during version validation
indicates that the device is currently not responding. In that case
do not perform the reset and instead reschedule timer service. Because
of that the driver will continue trying to reset the device until it
succeeds or is detached.

Submitted by: Dawid Gorecki <dgr@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit d10ec3ad7739a6f621d398d034632f68f647d72f)

2 years agoena: start timer service on attach
Dawid Gorecki [Mon, 3 Jan 2022 13:50:13 +0000 (14:50 +0100)]
ena: start timer service on attach

The timer service was started when the interface was brought up and it
was stopped when it was brought down. Since ena_up requires the device
to be responsive, triggering the reset would become impossible if the
device became unresponsive with the interface down.

Since most of the functions in timer service already perform the check
to see if the device is running, this only requires starting the callout
in attach and stopping it when bringing the interface up or down to
avoid race between different admin queue calls.

Since callout functions for timer service are always called with the
same arguments, replace callout_{init,reset,drain} calls with
ENA_TIMER_{INIT,RESET,DRAIN} macros.

Submitted by: Dawid Gorecki <dgr@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 78554d0c707c9401dbae53fb8bc65d291a5a09a5)

2 years agoena: rework tx req_id validation logic
Artur Rojek [Mon, 3 Jan 2022 13:50:06 +0000 (14:50 +0100)]
ena: rework tx req_id validation logic

Since `ena_com_tx_comp_req_id_get` already checks for `req_id` validity,
the logic was exiting early, never giving `validate_tx_req_id` a chance
to trigger device reset.
Rewrite the logic so that device reset is called based on return value
of `ena_com_tx_comp_req_id_get` instead.

Submitted by: Artur Rojek <ar@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit b168d0c850f34e8178d815ba3a87de2657a02ca9)

2 years agoena: properly handle IPv6 L4 checksum offload
Dawid Gorecki [Mon, 3 Jan 2022 13:49:58 +0000 (14:49 +0100)]
ena: properly handle IPv6 L4 checksum offload

ena_tx_csum function did not check if IPv6 checksum offload was
requested it only checked checksum offloading flags for IPv4 packets.
Because of that, when encountering CSUM_IP6_* flags, the function simply
returned without actually setting checksum offloading in ena_ctx.
Check CUSM_IP6_* flags to enable IPv6 checksum offload.

Additionally, only IPv4 header was being parsed regardless of EtherType
field, because of that, value of L4 protocol read when actually trying
to send IPv6 packets was wrong. Use ip6_lasthdr function to get length
of all IPv6 headers and payload protocol.

Set the DF flag to 1 in order to allow the device to offload the IPv6
checksum calculation and achieve optimal performance.

Add CSUM6_OFFLOAD and CSUM_OFFLOAD definitions into ena_datapath.h.

Submitted by: Dawid Gorecki <dgr@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit 2bbef9d95dc10a69a3c5813a517f6e8fe583539a)

2 years agoena: merge ena-com v2.5.0 upgrade
Marcin Wojtas [Sun, 23 Jan 2022 19:21:17 +0000 (20:21 +0100)]
ena: merge ena-com v2.5.0 upgrade

Merge commit '2530eb1fa01bf28fbcfcdda58bd41e055dcb2e4a'

Adjust the driver to the upgraded ena-com part twofold:

First update is related to the driver's NUMA awareness.

Allocate I/O queue memory in NUMA domain local to the CPU bound to the
given queue, improving data access time. Since this can result in
performance hit for unaware users, this is done only when RSS
option is enabled, for other cases the driver relies on kernel to
allocate memory by itself.

Information about first CPU bound is saved in adapter structure, so
the binding persists after bringing the interface down and up again.

If there are more buckets than interface queues, the driver will try to
bind different interfaces to different CPUs using round-robin algorithm
(but it will not bind queues to CPUs which do not have any RSS buckets
associated with them). This is done to better utilize hardware
resources by spreading the load.

Add (read-only) per-queue sysctls in order to provide the following
information:
- queueN.domain: NUMA domain associated with the queue
- queueN.cpu:    CPU affinity of the queue

The second change is for the CSUM_OFFLOAD constant, as ENA platform
file has removed its definition. To align to that change, it has been
added to the ena_datapath.h file.

Submitted by: Artur Rojek <ar@semihalf.com>
Submitted by: Dawid Gorecki <dgr@semihalf.com>
Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

(cherry picked from commit eb4c4f4a2e18659b67a6bf1ea5f473c7ed8c854f)

2 years agomlx5e: Make TLS tag zones unmanaged
Hans Petter Selasky [Thu, 24 Feb 2022 09:59:38 +0000 (10:59 +0100)]
mlx5e: Make TLS tag zones unmanaged

These zones are cache zones used to allocate TLS offload contexts from
firmware.  Releasing items from the cache is a sleepable operation due
to the need to await a response from the firmware command freeing the
tag, so items cannot be reclaimed from the zone in non-sleepable
contexts.  Since the cache size is limited by firmware limits, avoid
this by setting UMA_ZONE_UNMANAGED to avoid reclamation by uma_timeout()
and the low memory handler.

Reviewed by: hselasky, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34142

(cherry picked from commit 235ed6a48629771e4bc89141fdfe865b71024758)

2 years agouma: Add UMA_ZONE_UNMANAGED
Hans Petter Selasky [Thu, 24 Feb 2022 09:59:28 +0000 (10:59 +0100)]
uma: Add UMA_ZONE_UNMANAGED

Allow a zone to opt out of cache size management.  In particular,
uma_reclaim() and uma_reclaim_domain() will not reclaim any memory from
the zone, nor will uma_timeout() purge cached items if the zone is idle.
This effectively means that the zone consumer has control over when
items are reclaimed from the cache.  In particular, uma_zone_reclaim()
will still reclaim cached items from an unmanaged zone.

Reviewed by: hselasky, kib
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34142

(cherry picked from commit 389a3fa693ef61c35e15b36f042fb24197b7afb1)

2 years agomlx5en: Use a UMA cache zone for managing TLS send tags
Hans Petter Selasky [Thu, 24 Feb 2022 09:59:19 +0000 (10:59 +0100)]
mlx5en: Use a UMA cache zone for managing TLS send tags

Instead of allocating directly from a normal zone. This way
import and release are guaranteed to process all allocated and then
deallocated items. Also, the release occurs in a sleepable context when
caller of uma_zfree() or uma_zdestroy() can sleep itself.

Sponsored by: NVIDIA Networking

(cherry picked from commit 0f7b6e11c01d5360c9423d6938b160fe2d030ab0)

2 years agomlx5en: Fix TLS worker thread race.
Hans Petter Selasky [Thu, 24 Feb 2022 09:59:14 +0000 (10:59 +0100)]
mlx5en: Fix TLS worker thread race.

Create a dedicated free state, in case the taskqueue worker is still pending,
to avoid re-activation of a freed send tag.

Sponsored by: NVIDIA Networking

(cherry picked from commit 015f22f5d0338882ab4a1e1585622ff3568dface)

2 years agomlx5en: Improve RX- and TX- TLS refcounting.
Hans Petter Selasky [Thu, 24 Feb 2022 09:59:07 +0000 (10:59 +0100)]
mlx5en: Improve RX- and TX- TLS refcounting.

Use the send tag refcounting mechanism to refcount the RX- and TX- TLS
send tags. Then it is no longer needed to wait for refcounts to reach
zero when destroying RX- and TX- TLS send tags as a result of pending
data or WQE commands.

This also ensures that when TX-TLS and rate limiting is used at the same
time, the underlying SQ is not prematurely destroyed.

Sponsored by: NVIDIA Networking

(cherry picked from commit ebdb70064900a2ba2e3f8341328edc34e619170d)

2 years agomlx5en: Add missing refcount decrement on link-down.
Hans Petter Selasky [Thu, 24 Feb 2022 09:59:01 +0000 (10:59 +0100)]
mlx5en: Add missing refcount decrement on link-down.

Sponsored by: NVIDIA Networking

(cherry picked from commit d2a788a522f78f7c4b014df9097348419d90fae4)

2 years agomlx5en: Improve CQE error debugging.
Hans Petter Selasky [Thu, 24 Feb 2022 09:58:54 +0000 (10:58 +0100)]
mlx5en: Improve CQE error debugging.

Sponsored by: NVIDIA Networking

(cherry picked from commit bc531a1faa99b94b7b7761f1640304dd815eec5d)

2 years agoAdd more USB host controller PCI ID's.
Hans Petter Selasky [Thu, 24 Feb 2022 09:58:44 +0000 (10:58 +0100)]
Add more USB host controller PCI ID's.

Submitted by: Gary Jennejohn <gljennjohn@gmail.com>
Sponsored by: NVIDIA Networking

(cherry picked from commit e85af89fa7613a4bb506ca6ab8ecafbfbfde782d)

2 years agoxhci: add PCI IDs for USB controllers found on Supermicro M12SWA-TF
Hans Petter Selasky [Thu, 24 Feb 2022 09:58:39 +0000 (10:58 +0100)]
xhci: add PCI IDs for USB controllers found on Supermicro M12SWA-TF

(cherry picked from commit 4b4cce02ac01a943aa1816e7ea9ae6017539e7bb)

2 years agousb(4): Belatedly add a PCI device ID for AMD Bolton chipset
Hans Petter Selasky [Thu, 24 Feb 2022 09:58:32 +0000 (10:58 +0100)]
usb(4): Belatedly add a PCI device ID for AMD Bolton chipset

(cherry picked from commit 379797d4b4865336f56e327640f574f1e2956a7d)

2 years agoAdd new USB host controller PCI ID's.
Hans Petter Selasky [Thu, 24 Feb 2022 09:58:16 +0000 (10:58 +0100)]
Add new USB host controller PCI ID's.

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
Sponsored by: NVIDIA Networking

(cherry picked from commit 42cf33dd1a8d6ff2548c8a7fb267879734ddfde3)

2 years ago13.1: update stable/13 to -PRERELEASE to start the release cycle
Glen Barber [Thu, 24 Feb 2022 04:21:49 +0000 (23:21 -0500)]
13.1: update stable/13 to -PRERELEASE to start the release cycle

Approved by: re (implicit)
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoiichid(4): Perform acknowledgement of I2C device interrupt after RESET command
Vladimir Kondratyev [Tue, 30 Nov 2021 21:29:50 +0000 (00:29 +0300)]
iichid(4): Perform acknowledgement of I2C device interrupt after RESET command

in sampling mode to workaround firmware bug.

This fixes reboot or poweroff on frame.work laptops after first touch.

(cherry picked from commit c508b0818b245ea136d6538d68868cb3541f8f8f)

2 years agodumpfs(8): add option to only print superblock information
Robert Wing [Fri, 2 Jul 2021 22:18:17 +0000 (14:18 -0800)]
dumpfs(8): add option to only print superblock information

Add an option to dumpfs, `-s`, that only prints the super block information.

Reviewed by: chs, imp
Differential Revision: https://reviews.freebsd.org/D30881

(cherry picked from commit dc3548453689b30ad712e4391a99d3e7df0cad40)

2 years agotcp_twrespond: send signed segment when connection is TCP-MD5
Robert Wing [Mon, 20 Dec 2021 20:30:24 +0000 (11:30 -0900)]
tcp_twrespond: send signed segment when connection is TCP-MD5

When a connection is established to use TCP-MD5, tcp_twrespond() doesn't
respond with a signed segment. This results in the host performing the
active close to remain in a TIME_WAIT state and the other host in the
LAST_ACK state. Fix this by sending a signed segment when the connection
is established to use TCP-MD5.

Reviewed by: glebius
Differential Revision: https://reviews.freebsd.org/D33490

(cherry picked from commit 2a28b045ca7f9b24dc2a8fee2148578edfc87143)

2 years agoFix dtrace SDT probe tcp:::debug-input
Robert Wing [Tue, 21 Dec 2021 02:15:43 +0000 (17:15 -0900)]
Fix dtrace SDT probe tcp:::debug-input

The tcp:::debug-input probe is passed an mbuf pointer, use the correct
translator for ipinfo_t when defining tcp:::debug-input.

Fixes: 82988b50a17c ("Add an mbuf to ipinfo_t translator to finish ...")
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D33066

(cherry picked from commit 08d157a8321c845dad9f2d6eecea07639a23411a)