]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agodwc3: fix from not working
Bjoern A. Zeeb [Tue, 5 Jul 2022 00:53:42 +0000 (00:53 +0000)]
dwc3: fix from not working

During the review of 09cdf4878c621be4cd229fa88cdccdcdc8c101f7 we
switched from cached registers to reading them as needed.
One read of the two reads was moved after the softreset got triggered
and as a result returned 0 rather than the proper register value.
Moving the read before the softreset gets initiated seems to make
things work again and xhci.c no longer complains about
"Controller does not support 4K page size.".

MFC after: 10 days
X-MFC with: 09cdf4878c621be4cd229fa88cdccdcdc8c101f7
Pointy hat to: bz

2 years agolinux(4): Use saved cpu feature bits
Dmitry Chagin [Mon, 4 Jul 2022 20:42:07 +0000 (23:42 +0300)]
linux(4): Use saved cpu feature bits

MFC after: 3 days

2 years agolinux(4): Implement __vdso_time
Dmitry Chagin [Mon, 4 Jul 2022 20:41:32 +0000 (23:41 +0300)]
linux(4): Implement __vdso_time

PR: 240769
MFC after: 3 days

2 years agosockets: use only soref()/sorele() as socket reference count
Gleb Smirnoff [Mon, 4 Jul 2022 19:40:51 +0000 (12:40 -0700)]
sockets: use only soref()/sorele() as socket reference count

o Retire SS_FDREF as it is basically a debug flag on top of already
  existing soref()/sorele().
o Convert SS_PROTOREF into soref()/sorele().
o Change reference model for the listen queues, see below.
o Make sofree() private.  The correct KPI to use is only sorele().
o Make soabort() respect the model and sorele() instead of sofree().

Note on listening queues.  Until now the sockets on a queue had zero
reference count.  And the reference were given only upon accept(2).  The
assumption was that there is no way to see the queued socket from anywhere
except its head.  This is not true, since queued sockets already have pcbs,
which are linked at least into the global pcb lists.  With this change we
put the reference right in the sonewconn() and on accept(2) path we just
hand the existing reference to the file descriptor.

Differential revision: https://reviews.freebsd.org/D35679

2 years agosockets: use positive flag for file descriptor socket reference
Gleb Smirnoff [Mon, 4 Jul 2022 19:40:51 +0000 (12:40 -0700)]
sockets: use positive flag for file descriptor socket reference

Rename SS_NOFDREF to SS_FDREF and flip all bitwise operations.
Mark sockets created by socreate() with SS_FDREF.

This change is mostly illustrative. With it we see that SS_FDREF
is a debugging flag, since:
* socreate() takes a reference with soref().
* on accept path solisten_dequeue() takes a reference
  with soref() and then soaccept() sets SS_FDREF.
* soclose() checks SS_FDREF, removes it and does sorele().

Reviewed by: tuexen
Differential revision: https://reviews.freebsd.org/D35678

2 years agotcp: use a TCP flag to check if connection has been close(2)d
Gleb Smirnoff [Mon, 4 Jul 2022 19:40:51 +0000 (12:40 -0700)]
tcp: use a TCP flag to check if connection has been close(2)d

The flag SS_NOFDREF is a private flag of the socket layer.  It also
is supposed to be read with SOCK_LOCK(), which we don't own here.

Reviewed by: rrs, tuexen
Differential revision: https://reviews.freebsd.org/D35663

2 years agopca954x: harmonize pca9547 and pca954x and add pca9540 support
Bjoern A. Zeeb [Sat, 2 Jul 2022 23:33:32 +0000 (23:33 +0000)]
pca954x: harmonize pca9547 and pca954x and add pca9540 support

The two implementations for the pca9548 switch and the pca9547 mux
seemed close enough so we can put them together and with a bit more
abstraction add pca9540 support.

While here apply a bit of consistency in variable and driver naming and
use device_has_property instead of the FDT-only OF_ variant.

This disconnects pca9547 from the build but does not yet delete it.

MFC after: 2 weeks
Reviewed by: mmel (earlier version), avg
Differential Revision: https://reviews.freebsd.org/D35701

2 years agorb_tree: fine-tune rebalancing code
Doug Moore [Mon, 4 Jul 2022 17:28:35 +0000 (12:28 -0500)]
rb_tree: fine-tune rebalancing code

Change parts of RB_INSERT_COLOR and RB_REMOVE_COLOR to reduce the
number of operations, by, in some cases, flipping two color bits at a
time instead of flipping each individually, in separate operations,
and by using a switch statement to replace a sequence of if-elses.
Rewrite RB_SET_PARENT to generate fewer instructions.  These changes
reduce the code size by over 100 bytes on some architectures.

Also, allow RB users to define a preprocessor symbol to generate
RB_REMOVE_COLOR code that matches the implementation described in the
original weak-AVL paper in one particular case, instead of the still
correct, but slightly more efficient implementation of that case
currently implemented.

Reviewed by: alc
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D35524

2 years agopmcstat: fix log analysis
Andrew Gallatin [Mon, 4 Jul 2022 16:40:35 +0000 (12:40 -0400)]
pmcstat: fix log analysis

pmcstat has been broken for analyzing logs since D35342 / b6e28991bf3aadb.

This is because the pmc for the first CPU is not added when reading logs
because unlike its clones, its event id is not invalid. That causes us
to fail the assertion at lib/libpmcstat/libpmcstat_logging.c:293
when encountering samples from cpu0.

Fix this by removing the check that the PMC is invalid

Reviewed by: tsoome
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D35709

2 years agoAdd Rockchip PCIe cleanup on attach faulure
Andrew Turner [Thu, 30 Jun 2022 18:16:34 +0000 (19:16 +0100)]
Add Rockchip PCIe cleanup on attach faulure

We should clean up on failure as it may panic the kernel later, e.g.
if we crate the rman, but fail to destroy it on attach faulure.

Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35682

2 years agoFix ofw pcib when it rman_init fails
Andrew Turner [Thu, 30 Jun 2022 18:12:46 +0000 (19:12 +0100)]
Fix ofw pcib when it rman_init fails

rman_fini assumes rman_init has been called successfully. Clean up
init faulure by only calling rman_fini when rman_init has succeeded.

While here add ofw_pcib_fini that can be used by a sub-class to clean
up.

Reviewed by: bz, imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35681

2 years agoSupport decoding mem32 memory in the rk pcie driver
Andrew Turner [Thu, 30 Jun 2022 18:08:32 +0000 (19:08 +0100)]
Support decoding mem32 memory in the rk pcie driver

This is needed with some dtb files.

While here use a switch statement as the two options are mutually
exclusive in any iteration of the loop.

Reviewed by: imp
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35680

2 years agoe6000sw: Fix direct register write logic
Kornel Dulęba [Mon, 4 Jul 2022 06:53:41 +0000 (08:53 +0200)]
e6000sw: Fix direct register write logic

When accessing a register directly from etherswitchcfg one must specify
a register group(e.g. registers of portN) and the register offset within
the group. The latter is passed as the 5 least significant bits.
Extract the former by dividing the register address by 32, not by 5.

Approved by: mw(mentor)
Obtained from: Semihalf
Sponsored by: Stormshield
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D35672

2 years agolockstat: Fix construction of comparision predicates
Kornel Dulęba [Mon, 4 Jul 2022 06:48:52 +0000 (08:48 +0200)]
lockstat: Fix construction of comparision predicates

Passing "0x%p" to sprintf results in double "0x" being printed.
This causes a dtrace script compilation failure when "-d" flag
is specified.
Fix that by removing the extraneous "0x".

Reviewed by: markj
Approved by: mw(mentor)
Obtained from: Semihalf
Sponsored by: Alstom
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D35690

2 years agomountd startup: enable NFSv4 if needed on restart
Mike Karels [Sun, 3 Jul 2022 23:04:41 +0000 (18:04 -0500)]
mountd startup: enable NFSv4 if needed on restart

The mountd script in rc.d sets vfs.nfsd.server_max_nfsvers correctly
when it is run at system startup, relying on the kernel default.
However, if NFSv4 was enabled in /etc/rc.conf later, and the script
was re-run to restart mountd, the sysctl was still set to 3.
Set the sysctl to the right value in all cases.

Reviewed by: rmacklem
MFC after: 1 week

2 years agorouting: hide notify_add and notify_del behind ROUTE_MPATH
Mateusz Guzik [Mon, 4 Jul 2022 08:38:13 +0000 (08:38 +0000)]
routing: hide notify_add and notify_del behind ROUTE_MPATH

Fixes a warn about unused routines without the option.

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoipmi: do not omit lun in BMC addresses
Yuri [Mon, 4 Jul 2022 06:29:52 +0000 (14:29 +0800)]
ipmi: do not omit lun in BMC addresses

Some systems put sensors on non-0 lun, so we should not omit it.  This
was the only difference with the Linux driver, where DIMM sensors could
be queried, but not on FreeBSD.

See this report[1] on the FreeBSD forums:
https://forums.freebsd.org/threads/freebsd-cannot-get-dimm-temperature-sensor-value.85166/

Reviewed by: philip
Tested by: Andrey Lanin[1]
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D35612

2 years agoipmi: correctly handle ipmb requests
Yuri [Mon, 4 Jul 2022 04:55:18 +0000 (12:55 +0800)]
ipmi: correctly handle ipmb requests

Handle IPMB requests using SEND_MSG (sent as driver request as we do not
need to return anything back to userland for this) and GET_MSG (sent as
usual request so we can return the data for RECEIVE_MSG ioctl) pair.

This fixes fetching complete sensor data from boards (e.g. HP ProLiant
DL380 Gen10).

Reviewed by: philip
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D35605

2 years agofile: upgrade to 5.42.
Xin LI [Mon, 4 Jul 2022 00:07:28 +0000 (17:07 -0700)]
file: upgrade to 5.42.

MFC after: 2 weeks

2 years agoVendor import of file 5.42.
Xin LI [Mon, 4 Jul 2022 00:05:11 +0000 (17:05 -0700)]
Vendor import of file 5.42.

2 years agodwc3: improve debugging
Bjoern A. Zeeb [Sat, 2 Jul 2022 21:10:00 +0000 (21:10 +0000)]
dwc3: improve debugging

Rather than hiding behind #if 0, hide the debugging behind DWC3_DEBUG
so it can be turned on with a single define.  Require bootverbose
to print anything so we can still avoid spamming the console if DWC3_DEBUG
is on.
Harmonize the format string in snsp_dwc3_dump_regs() to always print the
full register and also print the XHCI quirks.
Call snsp_dwc3_dump_regs() twice, before and after generic XHCI attachment
and initialisation as this may have an effect on the confirgumation state.

Obtained from: an old debug patch
MFC after: 2 weeks
Reviewed by: mw
Differential Revision: https://reviews.freebsd.org/D35700

2 years agodwc3: add more quirks and checks
Bjoern A. Zeeb [Sat, 2 Jul 2022 20:56:07 +0000 (20:56 +0000)]
dwc3: add more quirks and checks

Rather than just printing the Global SNPS ID Register store it as well
so we can do a version check later.
In addition, for debugging purposes, read the Global Hardware Parameters
Registers and print them.

Based on the snpsid disable an XHCI feature using a quirk prepared
in 447c418da03454a2a00bc115a69c62055a6d5272.
Add the "snps,dis_u3_susphy_quirk" quirk and handle Suspend USB3.0 SS PHY
after power-on-reset/during core initialization (suggested to be cleared)
based on the DWC3_GHWPARAMS0 register.

MFC after: 2 weeks
Obtained from: an old debugging patch
Reviewed by: mw (earlier version), mmel
Differential Revision: https://reviews.freebsd.org/D35699

2 years agodwc3: uncondinationally enable Host IN Auto Retry
Bjoern A. Zeeb [Sat, 2 Jul 2022 19:14:39 +0000 (19:14 +0000)]
dwc3: uncondinationally enable Host IN Auto Retry

Enable dwc3's auto retry feature. For IN transfers with crc errors
or internal overruns this will make the host reply with a
non-terminating retry ACK.  I believe the hope was to improve
reliability after seeing occasional hiccups.

Obtained from: an old debugging patch
MFC after: 2 weeks
Reviewed by: mw
Differential Revision: https://reviews.freebsd.org/D35698

2 years agodwc3: fix snps,dis-del-phy-power-chg-quirk
Bjoern A. Zeeb [Sat, 2 Jul 2022 18:17:13 +0000 (18:17 +0000)]
dwc3: fix snps,dis-del-phy-power-chg-quirk

If snps,dis-del-phy-power-chg-quirk is set, the register bit should be
cleared not ored on (it's the "dis" version).

MFC after: 2 weeks
Reviewed by: mw
Differential Revision: https://reviews.freebsd.org/D35697

2 years agotca6416: add support for tca9539
Bjoern A. Zeeb [Sun, 3 Jul 2022 00:51:13 +0000 (00:51 +0000)]
tca6416: add support for tca9539

Programming-wise tca6416 and tca9539 seem identical so all we have to
do is add the extra ofw_compat_data line.

MFC after: 2 weeks
Reviewed by: mw
Differential Revision: https://reviews.freebsd.org/D35702

2 years agowpa_supplicant: Resolve secondary VAP association issue
J.R. Oldroyd [Sat, 2 Jul 2022 18:15:31 +0000 (11:15 -0700)]
wpa_supplicant: Resolve secondary VAP association issue

Association will fail on a secondary open unprotected VAP when the
primary VAP is configured for WPA. Examples of secondary VAPs are,
hotels, universities, and commodity routers' guest networks.

A broadly similar bug was discussed on Red Hat's bugzilla affecting
association to a D-Link DIR-842.

This suggests that as IEs were added to the 802.11 protocol the old code
was increasingly inadaquate to handle the additional IEs, not only a
secondary VAP.

PR: 264238
Reported by: Jaskie <jiangjun12321@gmail.com>
"J.R. Oldroyd" <fbsd@opal.com>
Submitted by: "J.R. Oldroyd" <fbsd@opal.com>
MFC after: 3 days

2 years agowpa: Enable WEP by default
Cy Schubert [Sun, 3 Jul 2022 18:41:00 +0000 (11:41 -0700)]
wpa: Enable WEP by default

As of hostap 2.10, WEP is disabled by default. This of course is not a
bad thing but requires some planning and an announcment to remove WEP
support by default. A possible src.conf knob or letting users know they
should use the port instead might different options.

MFC after: 3 days

2 years agomount_nfs.8: Update BUGS section for NFSv4.1/4.2
Rick Macklem [Sun, 3 Jul 2022 20:37:23 +0000 (13:37 -0700)]
mount_nfs.8: Update BUGS section for NFSv4.1/4.2

If the "intr" and/or "soft" mount options are used for
NFSv4 mounts, the protocol can be broken when the
operation returns without waiting for the RPC reply.
The likelyhood of failure increases for NFSv4.1/4.2
mounts, since the session slot will be broken when
an RPC reply is not processed.

This is mentioned in the BUGS section of "man mount_nfs",
but there was no specific mention of the session slot
problem.  This patch adds a sentence for this case.

PR: 260011
Reviewed by: gbe
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D35693

2 years agoApply clang fix for assertion building llvm with libc++ 15
Dimitry Andric [Sun, 3 Jul 2022 19:33:22 +0000 (21:33 +0200)]
Apply clang fix for assertion building llvm with libc++ 15

Merge commit f1b0a4fc540f from llvm git (by Richard Smith):

  An expression should only contain an unexpanded parameter pack if it
  lexically contains a mention of the pack.

  Systematically distinguish between syntactic and semantic references to
  packs, especially when propagating dependence from a type into an
  expression. We should consult the type-as-written when computing
  syntactic dependence and should consult the semantic type when computing
  semantic dependence.

  Fixes #54402.

MFC after: 3 days

2 years agosockatmark(3): Add references to 4.4BSD IPC tutorials
Gordon Bergling [Sun, 3 Jul 2022 13:56:42 +0000 (15:56 +0200)]
sockatmark(3): Add references to 4.4BSD IPC tutorials

Obtained from: NetBSD
MFC after: 3 days

2 years agoif_clone: Fix a typo in a source code comment
Gordon Bergling [Sun, 3 Jul 2022 13:13:32 +0000 (15:13 +0200)]
if_clone: Fix a typo in a source code comment

- s/fucntions/functions/

MFC ater: 3 days

2 years agojme(4): Fix a typo in a source code comment
Gordon Bergling [Sun, 3 Jul 2022 13:13:01 +0000 (15:13 +0200)]
jme(4): Fix a typo in a source code comment

- s/fuctions/functions/

MFC after: 3 days

2 years agoata(4): Fix a typo in a source code comment
Gordon Bergling [Sun, 3 Jul 2022 13:12:26 +0000 (15:12 +0200)]
ata(4): Fix a typo in a source code comment

- s/fuctions/functions/

MFC after: 3 days

2 years agosnmp_hostres(3): Fix a typo in a debug message
Gordon Bergling [Sun, 3 Jul 2022 12:57:12 +0000 (14:57 +0200)]
snmp_hostres(3): Fix a typo in a debug message

- s/atempt/attempt/

MFC after: 3 days

2 years agoaic7xxx: Fix a few common typo in source code comments
Gordon Bergling [Sun, 3 Jul 2022 12:10:30 +0000 (14:10 +0200)]
aic7xxx: Fix a few common typo in source code comments

- s/irrespecitve/irrespective/

Obtained from: NetBSD
MFC after: 3 days

2 years agoaic7xxx: Fix a few common typos in source code comments
Gordon Bergling [Sun, 3 Jul 2022 12:06:48 +0000 (14:06 +0200)]
aic7xxx: Fix a few common typos in source code comments

- s/ingnore/ignore/
- s/ingnored/ignored/

MFC after: 3 days

2 years agofreescale: Fix a typo in a source code comment
Gordon Bergling [Sun, 3 Jul 2022 11:55:40 +0000 (13:55 +0200)]
freescale: Fix a typo in a source code comment

- s/transistions/transitions/

MFC after: 3 days

2 years agopmc(3): Fix a common typo in a description
Gordon Bergling [Sun, 3 Jul 2022 11:53:01 +0000 (13:53 +0200)]
pmc(3): Fix a common typo in a description

- s/transistioned/transitioned/

MFC after: 3 days

2 years agopci(4): Fix a common typo in source code comments
Gordon Bergling [Sun, 3 Jul 2022 11:43:44 +0000 (13:43 +0200)]
pci(4): Fix a common typo in source code comments

- s/transistions/transitions/

MFC after: 3 days

2 years agopselect(2): Document what a null pointer for the signalmask means
Warner Losh [Sat, 2 Jul 2022 19:39:24 +0000 (13:39 -0600)]
pselect(2): Document what a null pointer for the signalmask means

When pselect is passed a null pointer for the signal mask, the standard
says it shall behave like select (except for the different timeout
arg). Make a note of that here.

Sponsored by: Netflix

2 years agoacpi: add sys/kernel.h
Warner Losh [Sat, 2 Jul 2022 16:35:04 +0000 (10:35 -0600)]
acpi: add sys/kernel.h

sys/kernel.h is needed for tunable fetching.

Sponsored by: Netflix

2 years agoarm64: NXP add LS1088a clockgen support
Bjoern A. Zeeb [Tue, 28 Jun 2022 00:02:17 +0000 (00:02 +0000)]
arm64: NXP add LS1088a clockgen support

Add a driver for NXP LS1088a clockgen support which passes
configuration information to QorIQ clockgen class.
The implementaiton started off as copy of ls1028 support and was
adjusted accordingly.

Reviewed by: dgr_semihalf.com (earlier), mmel
MFC after: 1 week
Sponsored by: Traverse Technologies (providing Ten64 HW for testing)
Differential Revision: https://reviews.freebsd.org/D35617

2 years agoamd64/efi: Remove setting hints for rsdp
Warner Losh [Sat, 2 Jul 2022 14:01:09 +0000 (08:01 -0600)]
amd64/efi: Remove setting hints for rsdp

Given that hints set this way don't work when a static kenv is compiled
into the kernel. acpi.rsdp has been set for this for the past 6 years,
and all kernels in that time have used it in preference to the hints. As
such, we no longer hints.*, so remove them.

Sponsored by: Netflix
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D35634

2 years agoamd64/efi: Stop falling back to hints for RSDP
Warner Losh [Sat, 2 Jul 2022 14:01:02 +0000 (08:01 -0600)]
amd64/efi: Stop falling back to hints for RSDP

All boot loaders for the last 6 years set acpi.rsdp in addition to the
hints. This was planned for removal ~5 years ago. Belatedly remove it
from here.

Sponsored by: Netflix
Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D35633

2 years agoloader: Set preferred kenv for acpi.rsdp on arm64
Warner Losh [Sat, 2 Jul 2022 14:00:40 +0000 (08:00 -0600)]
loader: Set preferred kenv for acpi.rsdp on arm64

Several years ago, x86 moved from using hints to communicate this
information to using the simpler acpi.rsdp variables. If one compiles
static hints into the kernel, then these hints are ignored. We can
remove this when we branch FreeBSD 15. Thought about BURN_BRIDGES
here, but it's too messy.

Sponsored by: Netflix
Reviewed by: andrew, jhb
Differential Revision: https://reviews.freebsd.org/D35632

2 years agoarm64: Grab the RSDP from acpi.rsdp like x86
Warner Losh [Sat, 2 Jul 2022 14:00:27 +0000 (08:00 -0600)]
arm64: Grab the RSDP from acpi.rsdp like x86

arm64 wasn't updated to grab this from acpi.rsdp when x86 was
update. belatedly update the kernel to grab this information from the
preferred kenv.

Sponsored by: Netflix
Reviewed by: andrew, jhb
Differential Revision: https://reviews.freebsd.org/D35631

2 years agotty: Default to printing kernel stack traceback only on INVARIANT kernels
Warner Losh [Wed, 29 Jun 2022 14:26:58 +0000 (08:26 -0600)]
tty: Default to printing kernel stack traceback only on INVARIANT kernels

Change the default from printing a breif kernel thread stack informaton
back to omitting it for non-invariant kernels in response to
SIGINFO/^T. Full and brief stack support can be selected with the
kern.tty_info_kstacks sysctl.

MFC After: 2 weeks
Sponsored by: Netflix
Reviewed by: grembo, jhb
Differential Revision: https://reviews.freebsd.org/D35576

2 years agoApply llvm fix for assertion/crash building archivers/c-blosc2
Dimitry Andric [Fri, 1 Jul 2022 23:13:46 +0000 (01:13 +0200)]
Apply llvm fix for assertion/crash building archivers/c-blosc2

Merge commit 88ce403c6aab from llvm git (by Florian Hahn):

  [LV] Add new block to place recurrence splice, if needed.

  In some cases, a recurrence splice instructions needs to be inserted
  between to regions, for example if the regions get re-arranged during
  sinking.

  Fixes #56146.

PR: 264979
Reported by: Robert Clausecker <fuz@fuz.su>
MFC after: 3 days

2 years agomount_nfs: Warn that intr, soft are not safe for NFSv4
Rick Macklem [Fri, 1 Jul 2022 21:43:17 +0000 (14:43 -0700)]
mount_nfs: Warn that intr, soft are not safe for NFSv4

If the "intr" and/or "soft" mount options are used for
NFSv4 mounts, the protocol can be broken when the
operation returns without waiting for the RPC reply.
The likelyhood of failure increases for NFSv4.1/4.2
mounts, since the session slot will be broken when
an RPC reply is not processed.

This is mentioned in the BUGS section of "man mount_nfs",
but more needs to be done.  This patch adds code that
generates a warning message when the mount is done.

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

2 years agoMIMIMAL: add uart
Warner Losh [Fri, 1 Jul 2022 17:22:38 +0000 (11:22 -0600)]
MIMIMAL: add uart

While uart could be detected completely through plug and play means, add
it here for two reasons. First, we don't do that from the loader, so
it's not available as a console. Second, even if we did do it from the
loader, there's a limitation in the system today that console drivers
must be compiled into the kernel because the console is selected before
external modules are linked into the kernel. Adding it only increases
the kernel size by ~14k as well.

Sponsored by: Netflix
Idea liked by: des, rpokala, brooks, jhb

2 years agocrypto: Validate return values from CRYPTODEV_PROCESS()
Mark Johnston [Fri, 1 Jul 2022 15:09:39 +0000 (11:09 -0400)]
crypto: Validate return values from CRYPTODEV_PROCESS()

Errors are always handled by the completion callback, so we should check
that they're not also passed back to the caller.

No functional change intended.

Reviewed by: kp, mav, jhb
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35382

2 years agocrypto: Fix the NULL_HMAC finalizer
Mark Johnston [Fri, 1 Jul 2022 15:04:15 +0000 (11:04 -0400)]
crypto: Fix the NULL_HMAC finalizer

The current implementation leaves the digest buffer partially
uninitialized.

Reported by: syzkaller
Reviewed by: jhb
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D35547

2 years agoena: Make first_interrupt a uint8_t
Mark Johnston [Thu, 30 Jun 2022 18:49:46 +0000 (14:49 -0400)]
ena: Make first_interrupt a uint8_t

We do not have atomic(9) routines for bools, and it is not guaranteed
that sizeof(bool) is 1.

This fixes the KASAN and KMSAN kernel builds, which fail because the
compiler refuses to silently cast a _Bool * to a uint8_t * when calling
the atomic(9) sanitizer interceptors.

Reviewed by: Dawid Górecki <dgr@semihalf.com>
MFC after: 2 weeks
Fixes: 0ac122c388d9 ("ena: Use atomic_load/store functions for first_interrupt variable")
Differential Revision: https://reviews.freebsd.org/D35683

2 years agoRevert "rtw88: split driver up into a core and pci part"
Bjoern A. Zeeb [Fri, 1 Jul 2022 13:06:31 +0000 (13:06 +0000)]
Revert "rtw88: split driver up into a core and pci part"

After some discussion, for now, simply revert the change to split
the driver up into if_rtw88_core.ko and if_rtw88_pci.ko as we do
not have an if_rtw88.ko anymore.  We do have code trying to
auto-load modules, e.g. ifconfig, based on if_xxx.ko.

We could, based on Makefile magic or further code, generate a
if_rtw88.ko module with proper dependencies and keep this but for
simplicity stay with the one slightly larger module for now.
Should code appear to do this "properly" we can revisit this once
USB support has landed.

Slightly update the module Makefile to keep the separation of files
between core and pci bits visible and maintainable for the future.

This reverts commit 0f7b9777f8f39fbc230b3e1de2f844d9f839adea.

2 years agoloader: fix powerpc* ofw loader
Alfredo Dal'Ava Junior [Fri, 1 Jul 2022 15:54:01 +0000 (12:54 -0300)]
loader: fix powerpc* ofw loader

With the introduction of llvm14, the powerpc* loader used on ofw/pseries
for 32 and 64 bit architectures puts the .data.rel.ro section after
.data section. This caused a crash kernel didn't boot. Bisect pointed to
change https://reviews.llvm.org/D111717 but problem could be fixed by
adding a section description to make it appear in the expected order.

This patch is based on discussion at:
        https://github.com/llvm/llvm-project/issues/56306

MFC after: 1 day
Sponsored by: Instituto de Pesquisas Eldorado (eldorado.org.br)

2 years agopf: handle dummynet for non-IP packets
Kristof Provost [Fri, 1 Jul 2022 11:13:20 +0000 (13:13 +0200)]
pf: handle dummynet for non-IP packets

Do not panic if we try to dummynet an Ethernet packet that's not IPv4 or
IPv6. Simply give it to dummynet.

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoCatch up with 2004 and improve markup.
Dag-Erling Smørgrav [Thu, 30 Jun 2022 13:36:05 +0000 (13:36 +0000)]
Catch up with 2004 and improve markup.

Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D35676

2 years agostand/uboot: setup archsw before probing devices
Albert Jakiela [Tue, 28 Jun 2022 15:28:35 +0000 (17:28 +0200)]
stand/uboot: setup archsw before probing devices

In some cases ubldr would try to mount a disk device before
the archsw struct was filled with functions pointers.
This would result in a NULL pointer derefrence of the arch_getdev field.
Fix that filling the archsw functions earlier.
Note that this matches the EFI behavoiur.

Reviewed by: imp, mw
Sponsored by: Stormshield
Obtained from: Semihalf
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D35670

2 years agotslog.4: Document what TSLOG excels at
Mateusz Piotrowski [Fri, 1 Jul 2022 09:17:12 +0000 (11:17 +0200)]
tslog.4: Document what TSLOG excels at

Based on an email mhorne@ sent to arch@.

Reviewed by: debdrup, pauamma_gundo.com
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D34565

2 years agoboottrace.4: Document that boottrace is good at tracing one-shot events
Mateusz Piotrowski [Fri, 1 Jul 2022 09:09:46 +0000 (11:09 +0200)]
boottrace.4: Document that boottrace is good at tracing one-shot events

Based on an email mhorne@ sent to arch@.

Reviewed by: debdrup
Differential Revision: https://reviews.freebsd.org/D34566

2 years agoifconfig.8: Polish
Zhenlei Huang [Fri, 1 Jul 2022 08:59:11 +0000 (10:59 +0200)]
ifconfig.8: Polish

MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D35686

2 years agoif_ovpn: handle m_pullup() failure
Kristof Provost [Thu, 30 Jun 2022 18:11:52 +0000 (20:11 +0200)]
if_ovpn: handle m_pullup() failure

Ensure we correctly handle m_pullup() failing in ovpn_finish_rx().

Reported by: Coverity (CID 1490340)
Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agoif_ovpn tests: IPv4-mapped IPv6 address test
Kristof Provost [Thu, 30 Jun 2022 15:47:58 +0000 (17:47 +0200)]
if_ovpn tests: IPv4-mapped IPv6 address test

OpenVPN uses IPv4-mapped IPv6 addresses by default (if we don't specify
'proto udp4', or an IPv4 address to bind to). Test that this works.

Sponsored by:   Rubicon Communications, LLC ("Netgate")

2 years agoif_ovpn: deal with v4 mapped IPv6 addresses
Kristof Provost [Thu, 30 Jun 2022 15:28:15 +0000 (17:28 +0200)]
if_ovpn: deal with v4 mapped IPv6 addresses

Openvpn defaults to binding to IPv6 sockets (with
setsockopt(IPV6_V6ONLY=0)), which we didn't deal with.
That resulted in us trying to in6_selectsrc_addr() on a v4 mapped v6
address, which does not work.

Instead we translate the mapped address to v4 and treat it as an IPv4
address.

Sponsored by: Rubicon Communications, LLC ("Netgate")

2 years agodtrace: Remove local mips support
Brooks Davis [Fri, 1 Jul 2022 07:33:17 +0000 (08:33 +0100)]
dtrace: Remove local mips support

Remove the stub pid probe and all the build glue.

Reviewed by: imp, jhb
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D35541

2 years agolibcompat: Use WORLDTMP sysroot
Brooks Davis [Fri, 1 Jul 2022 07:33:16 +0000 (08:33 +0100)]
libcompat: Use WORLDTMP sysroot

Now that -m32 is fixed, just install libs in ${WORLDTMP}/lib/lib32
and use the installed headers.

Reviewed by: imp, jhb
Obtained from: CheriBSD
Differential Revision: https://reviews.freebsd.org/D34697

2 years agoinstallworld: improve portability of ldd use
Brooks Davis [Fri, 1 Jul 2022 07:33:16 +0000 (08:33 +0100)]
installworld: improve portability of ldd use

b3b462229f97 added a case statement to ignore lines containing strings
in square brackets such as "[vdso]" and "[preloaded]". On MacOS
Monterey where /bin/sh may be zsh, this fails with:

/bin/sh: -c: line 0: syntax error near unexpected token `;;'

Invoke grep in the pipeline to remove such lines instead.

Reviewed by: emaste
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D35618

2 years agoigc: Change default duplex setting
Kornel Dulęba [Thu, 30 Jun 2022 11:57:58 +0000 (13:57 +0200)]
igc: Change default duplex setting

During media selection through ifconfig one might not specify
the duplex setting through the mediaopt flag.
In that case the igc driver would default to full-duplex.
The problem with this approach is that e1000(em/igb) driver
defaults to half-duplex.
Because of that if one connects both NICs and sets media to
e.g. 100baseTX on both of them no link will be found.
Fix that by matching igc behaviour with what e1000 does.

Reviewed by: grehan
Approved by: mw(mentor)
Obtained from: Semihalf
Sponsored by: Stormshield
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D35673

2 years agoAdd myself(kd) as src commiter and mw/emaste as my co-mentors
Kornel Dulęba [Wed, 29 Jun 2022 14:44:20 +0000 (16:44 +0200)]
Add myself(kd) as src commiter and mw/emaste as my co-mentors

Approved by: mw(mentor)
Differential Revision: https://reviews.freebsd.org/D35658

2 years agolibicp_rescue: Fix build for powerpc64le
Jessica Clarke [Fri, 1 Jul 2022 03:28:15 +0000 (04:28 +0100)]
libicp_rescue: Fix build for powerpc64le

This is a repeat of 13cee53cef35 ("libicp: Fix build for powerpc64le")
but for the rescue version of the library.

Fixes: 1f1e2261e341 ("zfs: merge openzfs/zfs@deb121309")

2 years agolibicp: Fix build for powerpc64le
Jessica Clarke [Fri, 1 Jul 2022 00:30:26 +0000 (01:30 +0100)]
libicp: Fix build for powerpc64le

The C sources use the assembly routines for little-endian powerpc64, and
the assembly files have ppc64le in their names, but the guard here was
for big-endian powerpc64.

Fixes: 1f1e2261e341 ("zfs: merge openzfs/zfs@deb121309")

2 years agovmm: Fix snapshots for AMD CPUs
Mihai Burcea [Thu, 30 Jun 2022 23:11:17 +0000 (16:11 -0700)]
vmm: Fix snapshots for AMD CPUs

This patch fixes the AMD implementation for snapshotting.  It removes
unnecessary vmcb fields that should not be saved and duplicates.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D33431

2 years agobhyve: Document the "type" config variable for network device models.
John Baldwin [Thu, 30 Jun 2022 22:14:36 +0000 (15:14 -0700)]
bhyve: Document the "type" config variable for network device models.

2 years agolibvmmapi: Add vm_close()
Vitaliy Gusev [Thu, 30 Jun 2022 21:21:57 +0000 (14:21 -0700)]
libvmmapi: Add vm_close()

Currently there is no way to safely free a vm structure without
leaking the fd.  vm_destroy() closes the fd but also destroys the VM
whereas in some cases a VM needs to be opened (vm_open) and then
closed (vm_close).

Reviewed by: jhb
Sponsored by: vStack
Differential Revision: https://reviews.freebsd.org/D35073

2 years agoLink pwd.db.5 and spwd.db.5 to passwd.5
Mateusz Piotrowski [Thu, 30 Jun 2022 21:02:08 +0000 (23:02 +0200)]
Link pwd.db.5 and spwd.db.5 to passwd.5

Let's make it easier to find documentation for those databases.

MFC after: 3 days

2 years agohier.7: Document /nonexistent
Mateusz Piotrowski [Thu, 30 Jun 2022 19:58:01 +0000 (21:58 +0200)]
hier.7: Document /nonexistent

MFC after: 1 week

2 years agodevfs.5: Replace Nm with Xr devfs 8 where appropriate
Mateusz Piotrowski [Thu, 30 Jun 2022 14:45:23 +0000 (16:45 +0200)]
devfs.5: Replace Nm with Xr devfs 8 where appropriate

MFC after: 3 days

2 years agoReally fix cross-builds from macOS
Jessica Clarke [Thu, 30 Jun 2022 21:08:31 +0000 (22:08 +0100)]
Really fix cross-builds from macOS

LINKER_TYPE is set to mac not macos on macOS.

Fixes: 7927452ac4e9 ("Add RELRO build knob, default to enabled")

2 years ago.github: Attempt to fix and increase robustness of macOS action
Jessica Clarke [Thu, 30 Jun 2022 20:03:26 +0000 (21:03 +0100)]
.github: Attempt to fix and increase robustness of macOS action

Homebrew has added LLVM 14 and made that the default version, but GitHub
continues to install LLVM 13 for now, so it ends up only accessible via
the versioned name and not the unversioned one. We also add an explicit
installation of llvm@13 so that, if GitHub updates the image to using
LLVM 14, the action continues to work, albeit slightly more slowly. This
also ensures the compiler label remains correct rather than outdated, as
has occurred in the past, and that we don't get new versions of LLVM
before we're ready for them, which is especially relevant for stable
branches. This all mirrors how the Ubuntu jobs are configured.

2 years agorb_tree: silence coverity
Doug Moore [Thu, 30 Jun 2022 17:27:33 +0000 (12:27 -0500)]
rb_tree: silence coverity

Add comments to RB_INSERT_COLOR to silence coverity warnings about the
use of an uninitialized variable.  Since other static analyzers will
complain too, add a comment to explain why the complaints are unwarranted.

Reviewed by: markj
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D35671

2 years agobhyve virtio-net: Allow backend type to be explicitly specified.
Yan Ka Chiu [Thu, 30 Jun 2022 17:29:45 +0000 (10:29 -0700)]
bhyve virtio-net: Allow backend type to be explicitly specified.

Surrently virtio-net uses the prefix of the backing interface to
choose the backend.  This patch adds an additional option "type" to
choose the backend type explicitly.  This allows greater flexibility
for end users to manage bhyve specific resources (such as by naming
the tap interfaces to more descriptive names).  The option "type" is
optional.  When it is not presented, the backend is derived from the
name of the backend interface.

For example, the line `-s 3,virtio-net,bsdvm0,type=tap` will create a
virtio-net device for the guest using the tap interface "bsdvm0".

Adding a new "type" option preserves the current legacy format in which
the first value after virtio-net names an instance of a backend.

Note that tap interfaces not following the pattern "tap*" will not be
created on demand via devfs cloning but must be created explicitly.

Reviewed by: vmaffione, jhb
Differential Revision: https://reviews.freebsd.org/D35143

2 years agovmm: Cherry pick illumos commit '13361 bhyve should mask RDT cpuid info'
Vitaliy Gusev [Thu, 30 Jun 2022 17:27:27 +0000 (10:27 -0700)]
vmm: Cherry pick illumos commit '13361 bhyve should mask RDT cpuid info'

Summary:
    commit  1a5f1879be09d3de900b2510692dd12003784d84
    Author: Patrick Mooney <pmooney@pfmooney.com>
    Date:   2020-12-16T20:02:23.000Z

        13361 bhyve should mask RDT cpuid info
        Reviewed by: Andy Fiddaman <andy@omnios.org>
        Reviewed by: Toomas Soome <tsoome@me.com>
        Approved by: Robert Mustacchi <rm@fingolfin.org>

    https://github.com/illumos/illumos-gate/commit/1a5f1879be09d3de900b2510692dd12003784d8

----

We saw similar warning of GP (on Intel Xeon CPU E5-2630 v4 and VM with Ubuntu 20.04 5.4.0-113-generic)  until this commit is applied:

```
[    1.658880] kernel: unchecked MSR access error: WRMSR to 0xc8f (tried to write 0x0000000000000000) at rIP: 0xffffffffacc735b4 (native_write_msr+0x4/0x30)
[    1.662734] kernel: Call Trace:
[    1.663885] kernel:  ? clear_closid_rmid.isra.0+0x36/0x40
[    1.665501] kernel:  resctrl_online_cpu+0xdc/0x3f0
[    1.666952] kernel:  ? __switch_to_asm+0x40/0x70
[    1.668358] kernel:  ? __switch_to+0x7f/0x480
[    1.669693] kernel:  ? cat_wrmsr+0x70/0x70
[    1.670970] kernel:  cpuhp_invoke_callback+0x9b/0x580
[    1.672541] kernel:  ? __schedule+0x2eb/0x740
[    1.673893] kernel:  cpuhp_thread_fun+0xb8/0x120
[    1.675304] kernel:  smpboot_thread_fn+0xd0/0x170
[    1.676685] kernel:  kthread+0x104/0x140
[    1.677948] kernel:  ? sort_range+0x30/0x30
[    1.679299] kernel:  ? kthread_park+0x90/0x90
[    1.680570] kernel:  ret_from_fork+0x35/0x40
[    1.682000] kernel: *** VALIDATE rdt ***
[    1.683454] kernel: resctrl: L3 monitoring detected
```

Reviewed by: markj, jhb
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D35442

2 years agocrypto: Fix assertions for digest-only sessions with separate output.
John Baldwin [Thu, 30 Jun 2022 17:10:00 +0000 (10:10 -0700)]
crypto: Fix assertions for digest-only sessions with separate output.

Digest-only sessions do not generate modified payload as an output, so
don't bother asserting anything about the payload with respect to the
output buffer other than the payload output start being zero.

In addition, a verify request on a digest-only session doesn't
generate any output at all so should never have a separate output
buffer.

PR: 252316
Reviewed by: markj
Co-authored-by: Jeremy Faulkner <gldisater@gmail.com>
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D35578

2 years agobusdma_bounce: Use PRI_ITHD scheduling class for worker thread.
John Baldwin [Thu, 30 Jun 2022 17:06:04 +0000 (10:06 -0700)]
busdma_bounce: Use PRI_ITHD scheduling class for worker thread.

Reviewed by: kib
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D35641

2 years agogcore: Use PT_GETREGSET for NT_THRMISC and NT_PTLWPINFO.
John Baldwin [Thu, 30 Jun 2022 17:04:19 +0000 (10:04 -0700)]
gcore: Use PT_GETREGSET for NT_THRMISC and NT_PTLWPINFO.

This avoids the need for dealing with converting lwpinfo for alternate
ABIs in gcore itself.

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

2 years agoAdd register sets for NT_THRMISC and NT_PTLWPINFO.
John Baldwin [Thu, 30 Jun 2022 17:04:02 +0000 (10:04 -0700)]
Add register sets for NT_THRMISC and NT_PTLWPINFO.

For the kernel this is mostly a non-functional change.  However, this
will be useful for simplifying gcore(1).

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

2 years agogcore: Remove unused typedefs.
John Baldwin [Thu, 30 Jun 2022 17:03:32 +0000 (10:03 -0700)]
gcore: Remove unused typedefs.

These are no longer needed after commit 4965ac059da1 which used
PT_GETREGSET to fetch NT_PRSTATUS and NT_FPREGSET.

Reviewed by: markj, emaste
MFC after: 2 weeks
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D35665

2 years agolibclang_rt: Trim a few more MIPSisms.
John Baldwin [Thu, 30 Jun 2022 17:02:37 +0000 (10:02 -0700)]
libclang_rt: Trim a few more MIPSisms.

The only FreeBSD architectures ending in 'hf' were MIPS hard-float
architectures.

Reviewed by: emaste
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D35591

2 years agotcpsso: improve man page
Michael Tuexen [Thu, 30 Jun 2022 16:37:09 +0000 (18:37 +0200)]
tcpsso: improve man page

Describe explicitly the handling of TCP endpoints in the TIME-WAIT and
SYN-RCVD state.

Reported by: glebius@
Reviewed by: glebius@
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D35651

2 years agoena: Update driver version to v2.6.0
Michal Krawczyk [Fri, 10 Jun 2022 09:18:14 +0000 (11:18 +0200)]
ena: Update driver version to v2.6.0

Some of the changes in this release:
* Style fixes
* Fix ENI stats probing
* Add trace for the last Tx cleanup call
* Prevent LLQ initialization if member isn't exposed
* Improve logging

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Fix invalid KASSERT test in netmap code
Michal Krawczyk [Fri, 10 Jun 2022 09:18:13 +0000 (11:18 +0200)]
ena: Fix invalid KASSERT test in netmap code

The KASSERT was originally added to ensure that the netmap Rx ring is
not NULL, however, it was checking for the opposite.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Align names of constants
Dawid Gorecki [Fri, 10 Jun 2022 09:18:13 +0000 (11:18 +0200)]
ena: Align names of constants

Most of the constants in ena.h file were prefixed with ENA_*, while
others did not have this prefix. Align the constants by prefixing the
remaining constants with ENA.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Remove write-only datapath variable
Michal Krawczyk [Fri, 10 Jun 2022 09:18:11 +0000 (11:18 +0200)]
ena: Remove write-only datapath variable

The ena_qid variable value is never used. It can be safely removed.
That also silences the compilation warning.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Fix styling issues
Dawid Gorecki [Fri, 10 Jun 2022 09:18:11 +0000 (11:18 +0200)]
ena: Fix styling issues

Align code style with FreeBSD style(9) guidelines.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Use device_set_desc in probe
Dawid Gorecki [Fri, 10 Jun 2022 09:18:10 +0000 (11:18 +0200)]
ena: Use device_set_desc in probe

During probe the driver created a temporary buffer to which the value of
DEVICE_DESC constant was printed. This buffer was then copied to the
device structure using device_set_desc_copy. Since the value of this
string is exactly the same for every device using the ENA driver, using
sprintf is unnecessary, and device_set_desc can be used instead.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Remove TSO refs from the documentation
Michal Krawczyk [Fri, 10 Jun 2022 09:18:10 +0000 (11:18 +0200)]
ena: Remove TSO refs from the documentation

The Hardware currently doesn't support TSO feature and it can be
misleading to mention that in the docs.

All references to the docs were removed from the man pages.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Move ena_copy_eni_metrics into separate task
Dawid Gorecki [Fri, 10 Jun 2022 09:18:10 +0000 (11:18 +0200)]
ena: Move ena_copy_eni_metrics into separate task

Copying ENI metrics was done in callout context, this caused the driver
to panic when sample_interval was set to a value other than 0, as the
admin queue call which was executed could sleep while waiting on
a condition variable. Taskqueue, unlike callout, allows for sleeping, so
moving the function to a separate taskqueue fixes the problem.
ena_timer_service is still responsible for scheduling the taskqueue.

Stop draining the callout during ena_up/ena_down. This was done to
prevent a race between ena_up/down and ena_copy_eni_metrics admin queue
calls. Since ena_metrics_task is protected by ENA_LOCK there is no
possibility of a race between ena_up/down and ena_metrics_task.

Remove a comment about locking in ena_timer_service. With ENI metrics
in a separate task this comment became obsolete.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Use atomic_load/store functions for first_interrupt variable
Dawid Gorecki [Fri, 10 Jun 2022 09:18:09 +0000 (11:18 +0200)]
ena: Use atomic_load/store functions for first_interrupt variable

Surround cases of possible simultaneous access to the first_interrupt
variable with atomic_load/store functions.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Store ticks of last Tx cleanup
Dawid Gorecki [Fri, 10 Jun 2022 09:18:09 +0000 (11:18 +0200)]
ena: Store ticks of last Tx cleanup

Store timestamp of last cleanup in Tx ring structure. This does not
change anything during normal operation of the driver but could be
useful when the device fails for some reason.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.

2 years agoena: Prevent LLQ initialization when membar isn't exposed
Dawid Gorecki [Fri, 10 Jun 2022 09:18:08 +0000 (11:18 +0200)]
ena: Prevent LLQ initialization when membar isn't exposed

The ena_com_config_dev_mode() function performs many LLQ related
calculations and sends an admin command to configure LLQ in the device.

All the LLQ related operations are unnecessary if the driver fails to
find LLQ memory bar.

Move LLQ memory bar allocation to separate helper function
ena_map_llq_mem_bar and execute this function before LLQ configuration.
If the LLQ memory bar cannot be allocated, then LLQ configuration is
skipped.

Obtained from: Semihalf
MFC after: 2 weeks
Sponsored by: Amazon, Inc.