]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
2 years agoReuse the amd64 loader relocation code on arm64
Andrew Turner [Sun, 17 Jan 2021 18:11:11 +0000 (18:11 +0000)]
Reuse the amd64 loader relocation code on arm64

There is no need to keep multiple copies of the relocation code. The
amd64 code works on arm64 with a few small changes to relocation types.

(cherry picked from commit f6f0b849fb2683feebf2416a793964be0bd05cc5)

2 years agoloader: Partial revert of 987eabdc2ae1
Emmanuel Vadot [Sun, 17 Jan 2021 16:41:25 +0000 (17:41 +0100)]
loader: Partial revert of 987eabdc2ae1

The arm relocation code doesn't not work and make loader not loading
dependancies.

Reported by: Dr. Rolf Jansen <freebsd-rj@obsigna.com>

(cherry picked from commit 0f2434ea000e02e6b1f7f40f489c346c64445242)

2 years agostand/reloc_elf: Handle relative relocations for arm{,64} and riscv
D Scott Phillips [Mon, 21 Sep 2020 22:24:46 +0000 (22:24 +0000)]
stand/reloc_elf: Handle relative relocations for arm{,64} and riscv

Extend the powerpc relative relocation handling from r240782 to a
handful of other architectures.  This is needed to properly read
dependency information from kernel modules.

(cherry picked from commit 987eabdc2ae1c0beba77e4d3b538155e81c7a7d5)

2 years agostand/efihttp: Work around a bug in edk2 http instance reconfiguration
D Scott Phillips [Wed, 9 Sep 2020 16:35:51 +0000 (16:35 +0000)]
stand/efihttp: Work around a bug in edk2 http instance reconfiguration

A bug in the EFI HTTP driver of TianoCore EDK2 causes memory
corruption when an http instance that uses tls is reconfigured,
leading to a crash.

Work around this by forcing a new http instance for each request
instead of reconfiguring the existing one.

The upstream bug report is https://bugzilla.tianocore.org/show_bug.cgi?id=1917

(cherry picked from commit d455cd5ac36f4c1ac76f04e2c2bb4bfb00fe8bcd)

2 years agoZFS: remove duplicate "com.datto:encryption" from loader
Matt Macy [Thu, 27 Aug 2020 21:37:35 +0000 (21:37 +0000)]
ZFS: remove duplicate "com.datto:encryption" from loader

(cherry picked from commit 962619075c531f333b51161b4ec011e1e987ad5a)

2 years agoFix stand/newvers.sh with zsh in sh mode
Alex Richardson [Wed, 12 Aug 2020 15:49:10 +0000 (15:49 +0000)]
Fix stand/newvers.sh with zsh in sh mode

When building on macOS with sh==zsh, newvers.sh was producing an
unterminated string literal due to \\n being turned as a newline. Fix this
by using a here document instead.

(cherry picked from commit cad2917baf6e8d90720f5bfb2463dfa7be35f568)

2 years agoFix compilation error for install.c in loader
Stephen J. Kiernan [Fri, 31 Jul 2020 16:08:25 +0000 (16:08 +0000)]
Fix compilation error for install.c in loader

Fix typo in interp_include() invocation (missing 'p')
Remove setting tftpip, as servip is used by the tftp code in libsa. There
is no separate tftpip global variable any more.

(cherry picked from commit fafe230db0cd8d96ac5f3f74643e0c71e949d623)

2 years agoloader: geli_dev_ioctl does return huge mediasize
Toomas Soome [Tue, 7 Jul 2020 12:24:40 +0000 (12:24 +0000)]
loader: geli_dev_ioctl does return huge mediasize

The DIOCGMEDIASIZE is calculated md->md_sectorsize * md->md_provsize, and
for boot disk, the md_sectorsize is 4k. However, the md_provsize is already
in units of bytes.

(cherry picked from commit 0d1a62068123df267e20530c86d2fc7a4e1aaa2e)

2 years agoAs with r352446 align blocks in boot1.efi
Andrew Turner [Tue, 5 May 2020 09:42:26 +0000 (09:42 +0000)]
As with r352446 align blocks in boot1.efi

We need to ensure the buffers are aligned before passing them to ReadBlocks.
Assume 512 bytes is enough for now.

(cherry picked from commit 3d5e12ebce94791aa0d6df3e81e7a8ac48ee4b51)

2 years agoBuild the arm64 loader with -ffixed-x18
Andrew Turner [Fri, 24 Apr 2020 10:03:11 +0000 (10:03 +0000)]
Build the arm64 loader with -ffixed-x18

This stops the compiler from using the x18 register. Some UEFI
implementations assume this will be preserved when calling the Boot
Services.

(cherry picked from commit a2e2311a40696e39eb24ff4a4d4c0968bba42c8c)

2 years agoloader: misaligned access of dos_partition structure
Toomas Soome [Thu, 19 Mar 2020 17:27:08 +0000 (17:27 +0000)]
loader: misaligned access of dos_partition structure

armv7 crash due to misligned access of dos_partition dp_start field.

Allocate and make copy of dos_partition array to make sure the data
is aligned.

(cherry picked from commit 87d8d5ea3dd0a8ad2c0468660805017d6d45d937)

2 years agoloader: alloc_pread() should set errno if malloc fails
Toomas Soome [Sun, 23 Feb 2020 15:21:15 +0000 (15:21 +0000)]
loader: alloc_pread() should set errno if malloc fails

We may want to find out why alloc_pread() failed.

(cherry picked from commit 91e697162c272aa81f375d3294e43cea97e8c4cd)

2 years agoefi_register_handles() is missing NULL pointer check
Toomas Soome [Thu, 20 Feb 2020 09:02:59 +0000 (09:02 +0000)]
efi_register_handles() is missing NULL pointer check

Add missing check of malloc() result.

(cherry picked from commit 4a82db5fe718a6b4abaf4de7f5d82563dc2f98df)

2 years agoinsert_zfs() is missing NULL pointer check
Toomas Soome [Thu, 20 Feb 2020 09:00:20 +0000 (09:00 +0000)]
insert_zfs() is missing NULL pointer check

Add missing check of malloc() result.

(cherry picked from commit 7afa0d95e212a612b2990c975082757c44c3b50f)

2 years agoefipart_inithandles() is missing NULL pointer check
Toomas Soome [Thu, 20 Feb 2020 08:56:56 +0000 (08:56 +0000)]
efipart_inithandles() is missing NULL pointer check

Add missing check of malloc() result.

(cherry picked from commit 79cbcdcf3ececdb45f02c528d00e53e9600a4f48)

2 years agoconnect_controllers() is missing NULL pointer check
Toomas Soome [Thu, 20 Feb 2020 08:55:18 +0000 (08:55 +0000)]
connect_controllers() is missing NULL pointer check

Add missing check of malloc() result.

(cherry picked from commit ef91a071ac534ed1293f624e4e205916da8f30a4)

2 years agoefihttp_fs_seek() is missing NULL pointer check
Toomas Soome [Thu, 20 Feb 2020 08:53:04 +0000 (08:53 +0000)]
efihttp_fs_seek() is missing NULL pointer check

Add missing check of malloc() result.

(cherry picked from commit 8abc11f65c828a58263e4b4a8eac70fdf7082792)

2 years agoefinet_dev_init() is missing NULL pointer check
Toomas Soome [Thu, 20 Feb 2020 08:48:34 +0000 (08:48 +0000)]
efinet_dev_init() is missing NULL pointer check

Add missing check of malloc() result.

(cherry picked from commit 860545e20b8f09881973b828863f55141fb2250e)

2 years agoIn gptboot, don't assume a partition number is a single digit, 1-9. GPT
Ian Lepore [Sun, 22 Dec 2019 22:33:22 +0000 (22:33 +0000)]
In gptboot, don't assume a partition number is a single digit, 1-9.  GPT
partitions can have 128 partitions, so parse contiguous digits and then
validate that the number is between 1-128 inclusive.

I'm not sure 128 is a hard limit in the GPT standard, but it's the common
number in use, and it's a better upper limit than 9.

(cherry picked from commit 42e08952bb84aa86dfdcc7b80c95b58e515bdce7)

2 years agoUse symbolic names for int13 calls
Warner Losh [Mon, 16 Dec 2019 21:52:12 +0000 (21:52 +0000)]
Use symbolic names for int13 calls

For all the INT13 calls, use symbolic names instead of magic numbers. This makes
it easier to understand what the code is doing w/o a trip to google to find what
these numbers mean.

(cherry picked from commit 7f5499972e115cafc861ec438cd7237422cd9b7c)

2 years agoloader.efi: print ImageBase so we know where we are
Toomas Soome [Fri, 6 Dec 2019 09:50:29 +0000 (09:50 +0000)]
loader.efi: print ImageBase so we know where we are

Output a bit of debugging aid.

(cherry picked from commit fed13eb3e8d6091dcfae45e7652835d519306abe)

2 years agoloader.efi: Default to serial if we don't have a ConOut variable
Emmanuel Vadot [Fri, 8 Nov 2019 20:08:44 +0000 (20:08 +0000)]
loader.efi: Default to serial if we don't have a ConOut variable

In the EFI implementation in U-Boot no ConOut efi variable is created,
this cause loader to fallback to TERM_EMU implementation which is very
very very slow (and uses the ConOut device in the system table anyway).
The UEFI spec aren't clear as if this variable needs to exists or not.

(cherry picked from commit 14fb9485a4dc9c8212bfae6c2049cb4930f4b8e5)

2 years agoloader: show APFS partition type name
Toomas Soome [Mon, 4 Nov 2019 12:20:19 +0000 (12:20 +0000)]
loader: show APFS partition type name

Add small visual aid in lsdev output.

(cherry picked from commit 124003d5870a2da22648cfd8d9a71fda4f0d64a7)

2 years agoloader: zfs.c is missing malloc checks, fix it
Toomas Soome [Sun, 3 Nov 2019 14:36:16 +0000 (14:36 +0000)]
loader: zfs.c is missing malloc checks, fix it

malloc() can return NULL, we need to check the return value.

(cherry picked from commit 21da9f14f6144429874a286bfe21a16cbb0dbabd)

2 years agoloader: should check malloc in zfs_dev_open
Toomas Soome [Sun, 3 Nov 2019 13:03:47 +0000 (13:03 +0000)]
loader: should check malloc in zfs_dev_open

malloc can return NULL.

(cherry picked from commit f4ed0045735d88aa681b4933072ff35a890a86a0)

2 years agoloader: userboot/test should accept more than one disk
Toomas Soome [Sun, 3 Nov 2019 09:14:29 +0000 (09:14 +0000)]
loader: userboot/test should accept more than one disk

allow to specify multiple -d options, test -d disk1 -d disk2 ..

(cherry picked from commit bcbb1e60a1c181310a7ce36af2c202fa789d03e5)

2 years agopthread_mutexattr(3): document each pthread_mutexattr_set/get* function
Konstantin Belousov [Fri, 1 Oct 2021 01:39:39 +0000 (04:39 +0300)]
pthread_mutexattr(3): document each pthread_mutexattr_set/get* function

(cherry picked from commit be6116fdfc4d292b77b3df7d4dda029d26a73d65)

2 years agolibthr(3): explain some internals of the locks implementation
Konstantin Belousov [Fri, 1 Oct 2021 01:17:02 +0000 (04:17 +0300)]
libthr(3): explain some internals of the locks implementation

(cherry picked from commit f5b9747075a9b489226e2a911f8a1597f4b9d072)

2 years agopthread_mutexattr(3): install pthread_mutexattr_get/setpshared links
Konstantin Belousov [Fri, 1 Oct 2021 00:53:44 +0000 (03:53 +0300)]
pthread_mutexattr(3): install pthread_mutexattr_get/setpshared links

(cherry picked from commit 6bda192013fc8e6c994098fe262f2a74f424cb57)

2 years agopthread_mutexattr(3): document pthread_mutexattr_set/getpshared
Konstantin Belousov [Fri, 1 Oct 2021 00:46:16 +0000 (03:46 +0300)]
pthread_mutexattr(3): document pthread_mutexattr_set/getpshared

(cherry picked from commit 0a6e5fc29b43778bd004f7754c730e41a9ce2675)

2 years agopthread_mutexattr(3): use .Fo/.Fc to avoid too long lines
Konstantin Belousov [Fri, 1 Oct 2021 00:40:19 +0000 (03:40 +0300)]
pthread_mutexattr(3): use .Fo/.Fc to avoid too long lines

(cherry picked from commit 9f3b6cdbe87cf92d4099f3f5ff8eff3030a8076b)

2 years agofusefs: don't panic if FUSE_GETATTR fails durint VOP_GETPAGES
Konstantin Belousov [Thu, 16 Sep 2021 23:53:58 +0000 (02:53 +0300)]
fusefs: don't panic if FUSE_GETATTR fails durint VOP_GETPAGES

During VOP_GETPAGES, fusefs needs to determine the file's length, which
could require a FUSE_GETATTR operation.  If that fails, it's better to
SIGBUS than panic.

Sponsored by: Axcient
Reviewed by:  markj, kib
Differential Revision: https://reviews.freebsd.org/D31994

(cherry picked from commit 4f917847c9037d9b76de188c03e13b81224431b2)

buffer pager: allow get_blksize method to return error

Reported and reviewed by: asomers
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D31998

(cherry picked from commit 197a4f29f39e6ae6215a6dbd28ef449d305e6d49)

2 years agoses: Guard the elm_type_names declaration by _KERNEL
Alan Somers [Mon, 30 Aug 2021 20:45:13 +0000 (14:45 -0600)]
ses: Guard the elm_type_names declaration by _KERNEL

Sponsored by: Axcient

(cherry picked from commit cc2d08d3880c2e726849ab2aa23b3d15f8aa3938)

2 years agoses: Correct spelling of "Temperature Sensor"
Alan Somers [Mon, 30 Aug 2021 19:59:32 +0000 (13:59 -0600)]
ses: Correct spelling of "Temperature Sensor"

According to SES 4 revision 2 table 71, it should be singular.

Sponsored by: Axcient

(cherry picked from commit 1fb52e4373e7f645d71059a6a403469f059044c8)

2 years agoperiodic: by default, skip 221.backup-gpart in jails
Alan Somers [Fri, 18 Jun 2021 14:33:08 +0000 (08:33 -0600)]
periodic: by default, skip 221.backup-gpart in jails

It can still be enabled as usual in /etc/periodic.conf

PR: 256253
Reported by: delphij
Submitted by: Miroslav Lachman <000.fbsd@quip.cz>

(cherry picked from commit fcf2227a557552e45646bbcf2422a98baab5c8a8)

2 years agovinvalbuf: do not panic if we were unable to flush dirty buffers
Konstantin Belousov [Sun, 30 May 2021 16:52:42 +0000 (19:52 +0300)]
vinvalbuf: do not panic if we were unable to flush dirty buffers

Return EBUSY instead and let caller to handle the issue.

For vgone()/vnode reclamation, caller first does vinvalbuf(V_SAVE),
which return EBUSY in case dirty buffers where not flushed. Then caller
calls vinvalbuf(0) due to non-zero return, which gets rid of all dirty
buffers without dependencies.

PR: 238565
Reviewed by: asomers, mckusick
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D30555

(cherry picked from commit 27006229f7a40a18a61a0e8fd270bc583326b690)

fusefs: reenable the WriteCluster.cluster_write_err test

The underlying panic was just fixed by
revision 27006229f7a40a18a61a0e8fd270bc583326b690

PR: 238565
(cherry picked from commit 425bbe9e64f7af6bdb30a099bd90a32885de1ab8)

2 years agogmultipath: make physpath distinct from the underlying providers'
Alan Somers [Thu, 22 Apr 2021 21:09:03 +0000 (15:09 -0600)]
gmultipath: make physpath distinct from the underlying providers'

zfsd uses a device's physical path attribute to automatically replace a
missing ZFS disk when a blank disk is inserted into the same physical
slot.  Currently gmultipath passes through its underlying providers'
physical path attribute.  That may cause zfsd to replace a missing
gmultipath provider with a newly arrived, single-path disk.  That would
be bad.

This commit fixes that problem by simply appending "/mp" to the
underlying providers' physical path, in a manner similar to what geli
already does.

Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D29941

(cherry picked from commit 420dbe763f15b076751443edfeeb4f676deb3c44)

2 years agodaemon: add some basic tests
Alan Somers [Wed, 17 Mar 2021 16:35:00 +0000 (10:35 -0600)]
daemon: add some basic tests

Sponsored by: Axcient
Differential Revision: https://reviews.freebsd.org/D29316

(cherry picked from commit 3b57d80c7aa924ed0fad565591f5292c2ac88da5)

2 years agoICMP checksum test: Fix for big endian
Charlie Root [Tue, 12 Jan 2021 01:56:12 +0000 (18:56 -0700)]
ICMP checksum test: Fix for big endian

The in_cksum tests originally tried to simulate a BE environment by
swapping the byte order of the input.  But that's overcomplicated, and
didn't actually work on real BE hardware.  The correct testing strategy
is just to test on the native endianness, and run the tests in both BE
and LE environments.

Submitted by: Renato Riolino <renato.riolino@eldorado.org.br>
Reviewed By: asomers
Differential Revision: https://reviews.freebsd.org/D23193

(cherry picked from commit 292808246db702b9194deb8938e40fd06914aea9)

2 years agoMFC uipc_shm: Fix kern.ipc.posix_shm_list for jails
Jamie Gritton [Wed, 29 Sep 2021 17:20:36 +0000 (10:20 -0700)]
MFC uipc_shm: Fix kern.ipc.posix_shm_list for jails

Fix error return of kern.ipc.posix_shm_list, which caused it (and thus
"posixshmcontrol ls") to fail for all jails that didn't happen to own
the last shm object in the list.

(cherry picked from commit 747a47261eee59b6e9c437cd2c1b3979df5c32ac)

2 years agoBackout 356693. The libsa malloc does provide necessary alignment and
Toomas Soome [Mon, 13 Jan 2020 20:02:27 +0000 (20:02 +0000)]
Backout 356693. The libsa malloc does provide necessary alignment and
memalign by 4 will reduce alignment for some platforms. Thanks for Ian for
pointing this out.

(cherry picked from commit aaeffe5b7064536dc7f4ea75a58125ec69d2706b)

2 years agoloader: allocate properly aligned buffer for network packet
Toomas Soome [Mon, 13 Jan 2020 18:22:54 +0000 (18:22 +0000)]
loader: allocate properly aligned buffer for network packet

Use memalign(4, size) to ensure we have properly aligned buffer.

(cherry picked from commit 659bf32dfc595b6cd6aeda7f05cb57872c64d2d1)

2 years agoFix build for mips.XLP64 kernel, by re-ordering headers
Ravi Pokala [Tue, 31 Mar 2020 20:09:20 +0000 (20:09 +0000)]
Fix build for mips.XLP64 kernel, by re-ordering headers

The log for the failure contained errors like this:

| In file included from ${SRCTOP}/sys/mips/nlm/dev/net/xlpge.c:34:
| In file included from ${SRCTOP}/sys/sys/systm.h:44:
| In file included from ./machine/atomic.h:849:
| ${SRCTOP}/sys/sys/_atomic_subword.h:222:37: error: unknown type name 'u_long'; did you mean 'long'?
| atomic_testandset_acq_long(volatile u_long *p, u_int v)
|                                     ^~~~~~
|                                     long

And similar "unknown type name" errors for u_int, not recognizing bool as a type, etc.

This was caused by including <sys/param.h> too far down; move it up where it belongs.

While here, add a blank line after '__FBSDID()', in keeping with convention.

(cherry picked from commit 144af011b4ee87ed3eba4f2c9f6780f4543ba554)

2 years ago[PowerPC] Fix atomic_cmpset_masked().
Brandon Bergren [Tue, 26 May 2020 19:03:45 +0000 (19:03 +0000)]
[PowerPC] Fix atomic_cmpset_masked().

A recent kernel change caused the previously unused atomic_cmpset_masked() to
be used.

It had a typo in it.

Instead of reading the old value from an uninitialized variable, read it
from the passed-in pointer as intended.

This fixes crashes on 64 bit Book-E.

Obtained from: jhibbits

(cherry picked from commit 9941cb0657d63b4b1570dcf384196bb599bf9024)

2 years agoatomic: Add atomic_cmpset_masked to powerpc and use it
Justin Hibbits [Fri, 15 Nov 2019 04:33:07 +0000 (04:33 +0000)]
atomic: Add atomic_cmpset_masked to powerpc and use it

Summary:
This is a more optimal way of doing atomic_compset_masked() than the
fallback in sys/_atomic_subword.h.  There's also an override for
_atomic_fcmpset_masked_word(), which may or may not be necessary, and is
unused for powerpc.

(cherry picked from commit d0bdb11139424b9dcfe3b73cd5a003055382de03)

2 years agopowerpc/atomic: Fix atomic_cmpset_rel()
Justin Hibbits [Tue, 15 Oct 2019 03:37:21 +0000 (03:37 +0000)]
powerpc/atomic: Fix atomic_cmpset_rel()

Need a release barrier, not an acquire barrier, else bad things happen.

(cherry picked from commit 9551397f51a7041dd0060bae1433d0e802373e35)

2 years agopowerpc: Implement atomic_(f)cmpset_ for short and char
Justin Hibbits [Tue, 8 Oct 2019 01:36:34 +0000 (01:36 +0000)]
powerpc: Implement atomic_(f)cmpset_ for short and char

This adds two implementations for each atomic_fcmpset_ and atomic_cmpset_
short and char functions, selectable at compile time for the target
architecture.  By default, it uses a generic shift-and-mask to perform atomic
updates to sub-components of 32-bit words from <sys/_atomic_subword.h>.
However, if ISA_206_ATOMICS is defined it uses the ll/sc instructions for
halfword and bytes, introduced in PowerISA 2.06.  These instructions are
supported by all IBM processors from POWER7 on, as well as the Freescale/NXP
e6500 core.  Although the e5500 and e500mc both implement PowerISA 2.06 they
do not implement these instructions.

As part of this, clean up the atomic_(f)cmpset_acq and _rel wrappers, by
using macros to reduce code duplication.

ISA_206_ATOMICS requires clang or newer binutils (2.20 or later).

(cherry picked from commit 84046d16eba76392ece41452b6ca3bd5808a1d19)

2 years agomips: use generic sub-word atomic *cmpset
Kyle Evans [Wed, 2 Oct 2019 17:07:59 +0000 (17:07 +0000)]
mips: use generic sub-word atomic *cmpset

Most of this diff is refactoring to reduce duplication between the different
acq_ and rel_ variants.

(cherry picked from commit 281ec62c977aba21b4aa60ed0f532d6a20b669e0)

2 years agoProvide generic sub-word atomic *cmpset
Kyle Evans [Wed, 2 Oct 2019 17:06:28 +0000 (17:06 +0000)]
Provide generic sub-word atomic *cmpset

Provide *cmpset_{8,16} as wrappers around atomic_fcmpset_32. Initial users
will be mips and sparc64, and perhaps parts of powerpc.

This are not for general consumption; machine/atomic.h should include this
header as needed to provide atomic_{,f}cmpset_{8,16} and machine/atomic.h
should provide acq_ and rel_ variants.

(cherry picked from commit b6c5d1ef76cdcfe2103fd2ed8ef8f97e1c740edc)

2 years agosys/dev/cfi: include sys/types.h as well
Kyle Evans [Thu, 2 Jan 2020 22:52:31 +0000 (22:52 +0000)]
sys/dev/cfi: include sys/types.h as well

This will soon be a dependency for machine/atomic.h on mips with the
introduction of 64-bit atomics; the scope here is pretty narrow, so throw it
here in the header just before systm.h, which includes machine/atomic.h

(cherry picked from commit 85ccd84cb3ce35f830cd4c07154152daf41181ef)

2 years agosyslogd: undo regression after r326573
Eugene Grosbein [Mon, 27 Sep 2021 07:25:21 +0000 (14:25 +0700)]
syslogd: undo regression after r326573

Restore ability for our syslogd to collect pre-RFC3164 formatted
messages from remote hosts that was broken with r326573.

Note that parsing of RFC5424 format not changed.

(cherry picked from commit 3b4cc56e524ac947ba0e6571e2c455139c2839ec)

2 years ago12.3: update stable/12 to -PRERELEASE to start the release cycle
Glen Barber [Thu, 7 Oct 2021 00:07:19 +0000 (20:07 -0400)]
12.3: update stable/12 to -PRERELEASE to start the release cycle

Approved by: re (implicit)

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

2 years agomips: fcmpset: do not spin on sc failure
Kyle Evans [Wed, 2 Oct 2019 15:13:40 +0000 (15:13 +0000)]
mips: fcmpset: do not spin on sc failure

For ll/sc architectures, atomic(9) allows failure modes where *old == val
due to write failure and callers should compensate for this. Do not retry on
failure, just leave 0 in ret and fail the operation if we couldn't sc it.
This lets the caller determine if it should retry or not.

(cherry picked from commit 22c2c971a614a72875787e0fd0001906451ee245)

2 years agoatomic_cmpset return value is also an int.
Warner Losh [Fri, 14 Dec 2018 19:48:42 +0000 (19:48 +0000)]
atomic_cmpset return value is also an int.

(cherry picked from commit 3d060215a5013c72b968aa5163833fa31fc92913)

2 years agoatomic_fcmpset* return int, not the type of *.
Warner Losh [Fri, 14 Dec 2018 19:14:51 +0000 (19:14 +0000)]
atomic_fcmpset* return int, not the type of *.

fcmpset returns true/false as a int, so make the return types and
variables match the int to be consistent with other arch.

(cherry picked from commit 2fb9d3808a3a0a8939502600cde69b04550d1e7d)

2 years agoTwo minor issues:
Warner Losh [Tue, 17 Dec 2019 03:20:37 +0000 (03:20 +0000)]
Two minor issues:
(1) Don't define load/store 64 atomics for o32. They aren't atomic
there.
(2) Add comment about why we need 64 atomic define on n32 only.

(cherry picked from commit fa9b4635f0874eedc3d908f2cd21746680c8c2ed)

2 years agoemulated atomic64: disable interrupts as the lock mechanism on !SMP
Kyle Evans [Fri, 3 Jan 2020 18:29:20 +0000 (18:29 +0000)]
emulated atomic64: disable interrupts as the lock mechanism on !SMP

Reviewed by: jhibbits, bdragon
Differential Revision: https://reviews.freebsd.org/D23015

(cherry picked from commit 3a22f09cbff13aed11206af6c839c4e1a5a08bff)

2 years ago[PowerPC] [MIPS] Implement 32-bit kernel emulation of atomic64 operations
Brandon Bergren [Thu, 2 Jan 2020 23:20:37 +0000 (23:20 +0000)]
[PowerPC] [MIPS] Implement 32-bit kernel emulation of atomic64 operations

This is a lock-based emulation of 64-bit atomics for kernel use, split off
from an earlier patch by jhibbits.

This is needed to unblock future improvements that reduce the need for
locking on 64-bit platforms by using atomic updates.

The implementation allows for future integration with userland atomic64,
but as that implies going through sysarch for every use, the current
status quo of userland doing its own locking may be for the best.

Submitted by: jhibbits (original patch), kevans (mips bits)
Reviewed by: jhibbits, jeff, kevans
Differential Revision: https://reviews.freebsd.org/D22976

(cherry picked from commit 9aafc7c0523456c8b5ee8919c97f75277cf4d70b)

2 years agoFix busdma resource leak on usb device detach.
Ian Lepore [Tue, 28 Sep 2021 19:29:10 +0000 (13:29 -0600)]
Fix busdma resource leak on usb device detach.

When a usb device is detached, usb_pc_dmamap_destroy() called
bus_dmamap_destroy() while the map was still loaded. That's harmless on x86
architectures, but on all other platforms it causes bus_dmamap_destroy() to
return EBUSY and leak away any memory resources (including bounce buffers)
associated with the mapping, as well as any allocated map structure itself.

This change introduces a new is_loaded flag to the usb_page_cache struct to
track whether a map is loaded or not. If the map is loaded,
bus_dmamap_unload() is called before bus_dmamap_destroy() to avoid leaking
away resources.

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

(cherry picked from commit dc91a9715f8fda4b3633388830a28a99f73cbe59)

2 years agotests: kqueue: CLOCK_BOOTTIME is an alias of CLOCK_UPTIME
Kyle Evans [Wed, 6 Oct 2021 14:50:32 +0000 (09:50 -0500)]
tests: kqueue: CLOCK_BOOTTIME is an alias of CLOCK_UPTIME

Build-test should be done a buildenv from a newer branch. =-( We don't
have this alias in stable/12, so just provide it locally in a way that
won't break should 155f15118a77 find its way here.

Reported by: Jenkins, naddy
Fixes: f9765c9c1acb ("kqueue: don't arbitrarily restrict ...")

2 years agopf tests: Basic adaptive mode syncookie test
Kristof Provost [Sat, 25 Sep 2021 13:05:02 +0000 (15:05 +0200)]
pf tests: Basic adaptive mode syncookie test

MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D32139

(cherry picked from commit 2f20d80692ceb584842a7642562fc9f610a5b661)

2 years agopf tests: Basic syncookie test
Kristof Provost [Sat, 10 Jul 2021 11:20:44 +0000 (13:20 +0200)]
pf tests: Basic syncookie test

MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D32138

(cherry picked from commit dc0636636bb1937283d4f218732ac2357f4ec4f1)

2 years agopf.conf: document syncookies
Kristof Provost [Sat, 14 Aug 2021 08:42:03 +0000 (10:42 +0200)]
pf.conf: document syncookies

Reviewed by: bcr
Obtained from: OpenBSD
MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D32137

(cherry picked from commit 20f015f08d66d0d953e49245cb95c81c118b9ee9)

2 years agopfctl: userspace adaptive syncookies configration
Kristof Provost [Fri, 13 Aug 2021 11:42:59 +0000 (13:42 +0200)]
pfctl: userspace adaptive syncookies configration

Hook up the userspace bits to configure syncookies in adaptive mode.

MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D32136

(cherry picked from commit 5062afff9de7e67da96e3f0dcb9d8bbd5a4e1c5b)

2 years agopf: hook up adaptive mode configuration
Kristof Provost [Sat, 24 Jul 2021 12:23:59 +0000 (14:23 +0200)]
pf: hook up adaptive mode configuration

The kernel side of pf syncookie adaptive mode configuration.

MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D32135

(cherry picked from commit 955460d41e99031906841870e02063ffdf227f09)

2 years agopf: implement adaptive mode
Kristof Provost [Sat, 24 Jul 2021 11:59:34 +0000 (13:59 +0200)]
pf: implement adaptive mode

Use atomic counters to ensure that we correctly track the number of half
open states and syncookie responses in-flight.
This determines if we activate or deactivate syncookies in adaptive
mode.

MFC after: 1 week
Sponsored by: Modirum MDPay
Differential Revision: https://reviews.freebsd.org/D32134

(cherry picked from commit bf8637181a2bb81206ff8c685f1632d07b8feb13)

2 years agotcp_wrappers: get rid of duplicate fgets declarations
Kyle Evans [Thu, 30 Sep 2021 04:21:24 +0000 (23:21 -0500)]
tcp_wrappers: get rid of duplicate fgets declarations

This is declared in stdio.h, no need for this one.

(cherry picked from commit 4dbd8c72d3030b8f111fdac86ba45ff596595497)

2 years agolibc: ssp: sprinkle around some __dead2
Kyle Evans [Wed, 29 Sep 2021 21:48:20 +0000 (16:48 -0500)]
libc: ssp: sprinkle around some __dead2

This is consistent with, e.g., NetBSD's implementation, which declares
these as noreturn in ssp/ssp.h.

(cherry picked from commit 5487294d79f9ebe72a847d0855adb4df85e0d66e)

2 years agobootp: remove the USE_BFUNCS knob
Kyle Evans [Thu, 30 Sep 2021 03:01:34 +0000 (22:01 -0500)]
bootp: remove the USE_BFUNCS knob

We'd likely be better served by converting these to the equivalent mem*
calls, but just kill the knob for now. The b* macros being defined get
in the way of _FORTIFY_SOURCE.

(cherry picked from commit cfb9be506285cd65120f9686d532130a3757ce56)

2 years agokqueue: document how timers with low/past timeouts are handled
Kyle Evans [Thu, 30 Sep 2021 18:19:05 +0000 (13:19 -0500)]
kqueue: document how timers with low/past timeouts are handled

(cherry picked from commit 4b5554cebb66020f59dc869b835aebbd66e4bb8c)

2 years agokqueue: don't arbitrarily restrict long-past values for NOTE_ABSTIME
Kyle Evans [Wed, 29 Sep 2021 19:55:59 +0000 (14:55 -0500)]
kqueue: don't arbitrarily restrict long-past values for NOTE_ABSTIME

NOTE_ABSTIME values are converted to values relative to boottime in
filt_timervalidate(), and negative values are currently rejected.  We
don't reject times in the past in general, so clamp this up to 0 as
needed such that the timer fires immediately rather than imposing what
looks like an arbitrary restriction.

Another possible scenario is that the system clock had to be adjusted
by ~minutes or ~hours and we have less than that in terms of uptime,
making a reasonable short-timeout suddenly invalid. Firing it is still
a valid choice in this scenario so that applications can at least
expect a consistent behavior.

(cherry picked from commit 9c999a259f00b35f0467acd351fea9157ed7e1e4)
(cherry picked from commit 2f4dbe279f6b5eb87ec493d96f6943ffdb603ba0)

2 years agocam: Fix a typo in a comment
Gordon Bergling [Sat, 2 Oct 2021 08:48:43 +0000 (10:48 +0200)]
cam: Fix a typo in a comment

- s/perorming/performing/

(cherry picked from commit 15c5f657a0107c7c1a3c954252a9ac6bb80f2535)

2 years agovnic: Fix a typo in a comment
Gordon Bergling [Sat, 2 Oct 2021 08:47:21 +0000 (10:47 +0200)]
vnic: Fix a typo in a comment

- s/setings/settings/

(cherry picked from commit fafb1c574d43b8c3acb510d925f599fee461c039)

2 years agoevdev: Fix a typo in a commit
Gordon Bergling [Sat, 2 Oct 2021 08:43:41 +0000 (10:43 +0200)]
evdev: Fix a typo in a commit

- s/prefered/preferred/

(cherry picked from commit efd8749fe5cccb6c3d6b5f3c3515bf89ad306bcc)

2 years agonetvsc: Fix a typo in a comment
Gordon Bergling [Sat, 2 Oct 2021 08:42:18 +0000 (10:42 +0200)]
netvsc: Fix a typo in a comment

- s/prefered/preferred/

(cherry picked from commit 9ebd651b58502f0572a7832d088f53f7a2ad00a5)

2 years agowpa: Fix EAP/PEAP MSCHAPv2 authentication SIGSEGV
Cy Schubert [Tue, 5 Oct 2021 22:09:06 +0000 (15:09 -0700)]
wpa: Fix EAP/PEAP MSCHAPv2 authentication SIGSEGV

25ecdc7d52770caf1c9b44b5ec11f468f6b636f3 (MFCed by
5654815fd3604e024eefdcb34904d3a7c883e8c5) introduced a link error
causing a SIGSEGV when using EAP/PEAP MSCHAPv2 authentication. It was
subsequently addressed by c1d255d3ffdbe447de3ab875bf4e7d7accc5bfc5,
discovered by build time link errors not experienced during testing of
25ecdc7d52770caf1c9b44b5ec11f468f6b636f3. This commit MFCs a portion
of c1d255d3ffdbe447de3ab875bf4e7d7accc5bfc5 addressing only the
SIGSEGV. The rest of c1d255d3ffdbe447de3ab875bf4e7d7accc5bfc5 will
be MFCed in November 2021.

This is a direct commit to stable/12.

PR: 258527
Reported by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
Tested by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>

2 years agosched_ule(4): Fix interactive threads stealing.
Alexander Motin [Tue, 21 Sep 2021 19:56:49 +0000 (15:56 -0400)]
sched_ule(4): Fix interactive threads stealing.

In scenarios when first thread in the queue can migrate to specified
CPU, but later ones can't runq_steal_from() incorrectly returned NULL.

MFC after: 2 weeks

(cherry picked from commit bd84094a51c4648a7c97ececdaccfb30bc832096)

2 years agoboot(9): update to match reality
Mitchell Horne [Tue, 28 Sep 2021 14:36:09 +0000 (11:36 -0300)]
boot(9): update to match reality

This function was renamed to kern_reboot() in 2010, but the man page has
failed to keep in sync. Bring it up to date on the rename, add the
shutdown hooks to the synopsis, and document the (obvious) fact that
kern_reboot() does not return.

Fix an outdated reference to the old name in kern_reboot(), and leave a
reference to the man page so future readers might find it before any
large changes.

Reviewed by: imp, markj
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D32085

(cherry picked from commit 800e74955d4e5f90e7258956ba42228350f71049)

2 years agorman: fix overflow in rman_reserve_resource_bound()
Elliott Mitchell [Mon, 27 Sep 2021 17:13:19 +0000 (14:13 -0300)]
rman: fix overflow in rman_reserve_resource_bound()

If the default range of [0, ~0] is given, then (~0 - 0) + 1 == 0. This
in turn will cause any allocation of non-zero size to fail. Zero-sized
allocations are prohibited, so add a KASSERT to this effect.

History indicates it is part of the original rman code.  This bug may in
fact be older than some contributors.

Reviewed by: mhorne
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D30280

(cherry picked from commit bcddaadbef5850ed9f040836d3f25ff57138ae28)

2 years agontb_hw_intel: fix xeon NTB gen3 bar disable logic
David Bright [Mon, 27 Sep 2021 13:18:46 +0000 (06:18 -0700)]
ntb_hw_intel: fix xeon NTB gen3 bar disable logic

In NTB gen3 driver, it was supposed to disable NTB bar access by
default, but due to incorrect register access method, the bar disable
logic does not work as expected. Those registers should be modified
through NTB bar0 rather than PCI configuration space.

Besides, we'd better to protect ourselves from a bad buddy node so
ingress disable logic should be implemented together.

Submitted by:   Austin Zhang (austin.zhang@dell.com)
Sponsored by:   Dell EMC

(cherry picked from commit e3cf7ebc1d36d068f1d1a83ea73ce2eed547e3cb)

2 years agoipfilter: Print the correct TCP sequence index number
Cy Schubert [Sat, 25 Sep 2021 00:00:20 +0000 (17:00 -0700)]
ipfilter: Print the correct TCP sequence index number

TCP sequence numbers in the FTP proxy are maintained in a two dimensional
array. The debug message prints the same seq[N] for both. Fix that.

(cherry picked from commit df38343e71304169ebca0e4c4fa24b339982d7be)

2 years agoipfilter: Correct a comment
Cy Schubert [Sat, 25 Sep 2021 06:41:22 +0000 (23:41 -0700)]
ipfilter: Correct a comment

Correct a comment's grammar and while at it clarify its meaining.

(cherry picked from commit aa6cfcc820b438cec58fbe0af408d4457f8daf9d)

2 years agoipfilter: Avoid a null if-then-else blocks
Cy Schubert [Wed, 22 Sep 2021 04:58:08 +0000 (21:58 -0700)]
ipfilter: Avoid a null if-then-else blocks

When WITHOUT_INET6 is selected we generate a null if-then-else blocks
due to incorrect placment of #if statments. Move the #if statements
reducing unnecessary runtime comparisons WITHOUT_INET6.

(cherry picked from commit 73db3b64f167972db3ee3f780cecb439b09492b1)

2 years agocmp: add -b, --print-bytes
Kyle Evans [Thu, 23 Sep 2021 05:46:30 +0000 (00:46 -0500)]
cmp: add -b, --print-bytes

This is compatible with GNU cmp.

Reviewed by: bapt, markj (earlier version)
Sponsored by: Klara, Inc.

(cherry picked from commit f66b9b40f403f7c30fec3c4ceed93c6e8fafa8ac)

2 years agocmp: add -i, --ignore-initial, an alternative to skip1/skip2 args
Kyle Evans [Thu, 23 Sep 2021 05:43:32 +0000 (00:43 -0500)]
cmp: add -i, --ignore-initial, an alternative to skip1/skip2 args

This is compatible with GNU cmp.

Reviewed by: markj
Sponsored by: Klara, Inc.

(cherry picked from commit 8d546b6832eea031f95f30eaec3232ec1256a281)

2 years agocmp: add -n, --bytes to limit number of bytes to compare
Kyle Evans [Thu, 23 Sep 2021 05:26:52 +0000 (00:26 -0500)]
cmp: add -n, --bytes to limit number of bytes to compare

This is compatible with GNU cmp.

Reviewed by: markj
Sponsored by: Klara, Inc.

(cherry picked from commit 4e380e8474609875c4cf5277b3755ac29079a8b5)

2 years agocmp: accept SI suffixes for skip1 and skip2
Kyle Evans [Thu, 23 Sep 2021 05:17:07 +0000 (00:17 -0500)]
cmp: accept SI suffixes for skip1 and skip2

This is compatible with GNU cmp.

Reviewed by: bapt (earlier version), markj, imp
Sponsored by: Klara, Inc.

(cherry picked from commit f6787614fd4db2a9d5e649af0e819852ebd5a19d)

2 years agohostname: avoid strcpy() overlap in -d flag handling
Kyle Evans [Sat, 25 Sep 2021 05:00:31 +0000 (00:00 -0500)]
hostname: avoid strcpy() overlap in -d flag handling

We don't need the strcpy() anyways, just use a pointer to the hostname
buffer and move it forward for `hostname -d`.

Sponsored by: Klara, Inc.

(cherry picked from commit 33c1e7271ac21a626829289780b88071ae46ec65)

2 years agoman: reset OPTIND before parsing args
Kyle Evans [Wed, 22 Sep 2021 19:58:19 +0000 (14:58 -0500)]
man: reset OPTIND before parsing args

From jilles: POSIX requires that a script set `OPTIND=1` before using
different sets of parameters with `getopts`, or the results will be
unspecified.

The specific problem observed here is that we would execute `man -f` or
`man -k` without cleaning up state from man_parse_args()' `getopts`
loop.  FreeBSD's /bin/sh seems to reset OPTIND to 1 after we hit the
second getopts loop, rendering the following shift harmless; other
/bin/sh implementations will leave it at what we came into the loop at
(e.g., bash as /bin/sh), shifting off any keywords that we had.

Input from: jilles
Reviewed by: allanjude, bapt, imp
Sponsored by: Klara, Inc.

(cherry picked from commit f555b39e6bb7cbfbe1905e90f64c4dfc4456fabb)

2 years agocmp(1): Add EXAMPLES section
Fernando Apesteguía [Sat, 20 Jun 2020 11:20:16 +0000 (11:20 +0000)]
cmp(1): Add EXAMPLES section

Add a small number of examples depicting the use of -l, -z and byte offsets

(cherry picked from commit 1831993577db18d193e94269e337f6286536814e)

2 years agocmp(1): Add EXAMPLES section
Fernando Apesteguía [Tue, 16 Jun 2020 15:54:59 +0000 (15:54 +0000)]
cmp(1): Add EXAMPLES section

Add simple examples showing the use of -l, -z, stdin and offsets

(cherry picked from commit 022ebaf5432d5a8112c7d75ab9d406176b3dfd39)

2 years agoiflib: ensure that tx interrupts enabled and cleanups
Matt Macy [Sat, 19 Dec 2020 01:08:33 +0000 (17:08 -0800)]
iflib: ensure that tx interrupts enabled and cleanups

Doing a 'dd' over iscsi will reliably cause stalls. Tx
cleaning _should_ reliably happen as data is sent.
However, currently if the transmit queue fills it will
wait until the iflib timer (hz/2) runs.

This change causes the the tx taskq thread to be run
if there are completed descriptors.

While here:

- make timer interrupt delay a sysctl

- simplify txd_db_check handling

- comment on INTR types

Background on the change:

Initially doorbell updates were minimized by only writing to the register
on every fourth packet. If txq_drain would return without writing to the
doorbell it scheduled a callout on the next tick to do the doorbell write
to ensure that the write otherwise happened "soon". At that time a sysctl
was added for users to avoid the potential added latency by simply writing
to the doorbell register on every packet. This worked perfectly well for
e1000 and ixgbe ... and appeared to work well on ixl. However, as it
turned out there was a race to this approach that would lockup the ixl MAC.
It was possible for a lower producer index to be written after a higher one.
On e1000 and ixgbe this was harmless - on ixl it was fatal. My initial
response was to add a lock around doorbell writes - fixing the problem but
adding an unacceptable amount of lock contention.

The next iteration was to use transmit interrupts to drive delayed doorbell
writes. If there were no packets in the queue all doorbell writes would be
immediate as the queue started to fill up we could delay doorbell writes
further and further. At the start of drain if we've cleaned any packets we
know we've moved the state machine along and we write the doorbell (an
obvious missing optimization was to skip that doorbell write if db_pending
is zero). This change required that tx interrupts be scheduled periodically
as opposed to just when the hardware txq was full. However, that just leads
to our next problem.

Initially dedicated msix vectors were used for both tx and rx. However, it
was often possible to use up all available vectors before we set up all the
queues we wanted. By having rx and tx share a vector for a given queue we
could halve the number of vectors used by a given configuration. The problem
here is that with this change only e1000 passed the necessary value to have
the fast interrupt drive tx when appropriate.

Reported by: mav@
Tested by: mav@
Reviewed by:    gallatin@
MFC after:      1 month
Sponsored by:   iXsystems
Differential Revision:  https://reviews.freebsd.org/D27683

(cherry picked from commit 81be655266fac2b333e25f386f32c9bcd17f523d)

2 years agoixgbe: fix impossible condition
Eric van Gyzen [Fri, 21 Aug 2020 19:34:41 +0000 (19:34 +0000)]
ixgbe: fix impossible condition

Coverity flagged this condition: The condition
    offset == 0 && offset == 65535
can never be true because offset cannot be equal
to two different values at the same time.

Submitted by: bret_ketchum@dell.com
Reported by: Coverity
Reviewed by: tsoome, cem
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D26144

(cherry picked from commit ab1c54fec66803235a8923333fa79f2cbfa33354)

2 years agoixgbe: whitespace cleanup pass
Kevin Bowling [Sun, 26 Sep 2021 18:29:00 +0000 (11:29 -0700)]
ixgbe: whitespace cleanup pass

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

(cherry picked from commit 15d077995bd2c56b7b1742ea2d4e9070ff7e9427)

2 years agoiflib: Make if_shared_ctx_t a pointer to const
Mark Johnston [Mon, 8 Mar 2021 17:39:06 +0000 (12:39 -0500)]
iflib: Make if_shared_ctx_t a pointer to const

This structure is shared among multiple instances of a driver, so we
should ensure that it doesn't somehow get treated as if there's a
separate instance per interface.  This is especially important for
software-only drivers like wg.

DEVICE_REGISTER() still returns a void * and so the per-driver sctx
structures are not yet defined with the const qualifier.

Reviewed by: gallatin, erj
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D29102

(cherry picked from commit ffe3def903a5f239c319e5fe12450659658974a5)

2 years agoixgbe(4): Eliminate bogus sizeof() expressions
Conrad Meyer [Wed, 29 Jan 2020 05:31:40 +0000 (05:31 +0000)]
ixgbe(4): Eliminate bogus sizeof() expressions

All of these uses of sizeof() were on the wrong type in relation to the pointer
passed to SYSCTL_ADD_PROC as arg1.  Fortunately, none of the handlers actually
use arg2.  So just don't pass a (non-zero) arg2.

Reported by: Coverity
CID: 1007701

(cherry picked from commit d09fbcd0b6eae765a190eaa4dc931050af7bd25f)

2 years agoixgbe(4): Fix enabling/disabling and reconfiguration of queues
Eric Joyner [Tue, 23 Jul 2019 18:14:32 +0000 (18:14 +0000)]
ixgbe(4): Fix enabling/disabling and reconfiguration of queues

- Wrong order of casting and bit shift caused that enabling and disabling
  queues didn't work properly for queues number larger than 32. Use literals
  with right suffix instead.

- TX ring tail address was not updated during reinitiailzation of TX
  structures. It could block sending traffic.

- Also remove unused variables 'eims' and 'active_queues'.

Submitted by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Reviewed by: erj@
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D20826

(cherry picked from commit 2dc2d580354e95491a033fa9e21c8ef0cbd9bc42)

2 years agoixgbe: Rename 'struct adapter' to 'struct ixgbe_softc'
Kevin Bowling [Sat, 25 Sep 2021 23:12:23 +0000 (16:12 -0700)]
ixgbe: Rename 'struct adapter' to 'struct ixgbe_softc'

Rename the 'struct adapter' to 'struct ixgbe_softc' to avoid type
ambiguity in things like kgdb.

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

(cherry picked from commit b1d5caf3c7504a1ece0498ec3f7360ac760577f7)

2 years agogenoffset.sh: Use 10 X's instead of 5 for pick mkdtemp implementations
Warner Losh [Tue, 7 Sep 2021 16:08:51 +0000 (10:08 -0600)]
genoffset.sh: Use 10 X's instead of 5 for pick mkdtemp implementations

Linux fails to build now because the mkdtemp in the bootstrapped
environment wants 6 or more X's. Use 10 out of an abundance of caution.

Sponsored by: Netflix
Reviewed by: arichards
Differential Revision: https://reviews.freebsd.org/D31863

(cherry picked from commit ecfbb2e30241ee460617ad4e0c0be16d9930945a)

2 years agocdefs.h: Remove redundant #ifdefs
Warner Losh [Tue, 7 Sep 2021 15:34:02 +0000 (09:34 -0600)]
cdefs.h: Remove redundant #ifdefs

Remove redunant #ifdef __GNUC__ inside an #if defined(__GNUC__)
block. They are nops.

Sponsored by: Netflix

(cherry picked from commit 1e7b5f950b2d54ddb257d008592563c4d753aa54)