]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
15 months agonetlink: call genetlink notification handler upon successful family
Alexander V. Chernikov [Fri, 17 Feb 2023 17:58:53 +0000 (17:58 +0000)]
netlink: call genetlink notification handler upon successful family
search.

MFC after: 3 days

15 months agonetlink: simplify temporary address allocation in rtnl_handle_getlink().
Alexander V. Chernikov [Fri, 17 Feb 2023 17:57:44 +0000 (17:57 +0000)]
netlink: simplify temporary address allocation in rtnl_handle_getlink().

MFC after: 3 days

15 months agonetlink: fix if_allocdescr() malloc options argument.
Alexander V. Chernikov [Fri, 17 Feb 2023 17:35:28 +0000 (17:35 +0000)]
netlink: fix if_allocdescr() malloc options argument.

The current value was based on the initial revision of D37566 and
 was not updated afterwards.

MFC after: 1 day

15 months agonetlink: validate rtable value in RTM_<NEW|DEL|GET>ROUTE.
Alexander V. Chernikov [Fri, 17 Feb 2023 17:31:40 +0000 (17:31 +0000)]
netlink: validate rtable value in RTM_<NEW|DEL|GET>ROUTE.

Reported by: Stefan Grundmann <sg2342@googlemail.com>
MFC after: 1 day

15 months agorouting: always pass rtentry to add_route_flags().
Alexander V. Chernikov [Fri, 17 Feb 2023 17:20:38 +0000 (17:20 +0000)]
routing: always pass rtentry to add_route_flags().

add_route_flags() uses `rt` prefix data to lookup the the current
 rtentry from the routing table. Update rib_add_route_px() to
 always pass rtentry regardless of the op_flags.

Reported by: Stefan Grundmann <sg2342@googlemail.com>
MFC after: 1 day

15 months agotcp: Don't try to disconnect a socket multiple times.
John Baldwin [Fri, 17 Feb 2023 17:13:53 +0000 (09:13 -0800)]
tcp: Don't try to disconnect a socket multiple times.

When the checks for INP_TIMEWAIT were removed, tcp_usr_close() and
tcp_usr_disconnect() were no longer prevented from calling
tcp_disconnect() on a socket that was already disconnected.  This
triggered a panic in cxgbe(4) for TOE where the tcp_disconnect() on an
already-disconnected socket invoked tcp_output() on a socket that was
already in time-wait.

Reviewed by: rrs, np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D37112

15 months agocxgbe: Queue NIC TLS mbufs internally.
John Baldwin [Fri, 17 Feb 2023 17:07:17 +0000 (09:07 -0800)]
cxgbe: Queue NIC TLS mbufs internally.

Set internal mbuf properties and queue NIC TLS mbuf chains to the
connection's TX queue directly.

Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D38579

15 months agocxgbe: Move helper functions for mbuf metadata to adapter.h.
John Baldwin [Fri, 17 Feb 2023 17:06:12 +0000 (09:06 -0800)]
cxgbe: Move helper functions for mbuf metadata to adapter.h.

Previously private to t4_sge.c, this allows other parts of the driver
(such as NIC TLS) to use these helpers directly.

Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D38578

15 months agocxgbe: Allow parse_pkt to internally queue a packet.
John Baldwin [Fri, 17 Feb 2023 17:03:23 +0000 (09:03 -0800)]
cxgbe: Allow parse_pkt to internally queue a packet.

If parse_pkt returns EINPROGRESS, return from cxgbe_transmit
without queueing the packet in a txq.  Use this to move the call
to ethofld_transmit for packet pacing into parse_pkt.

Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D38577

15 months agonfsd: Get rid of useless "pool" field in nfs_fha_new.c
Rick Macklem [Fri, 17 Feb 2023 15:34:40 +0000 (07:34 -0800)]
nfsd: Get rid of useless "pool" field in nfs_fha_new.c

Since svcpool_create() is now called from an initialization function,
the pool field of fha_params is always non-NULL, so just get
rid of it and the useless check for it being NULL.

MFC after: 3 months

15 months agoBump __FreeBSD_version after linuxkpi changes
Emmanuel Vadot [Fri, 17 Feb 2023 13:57:24 +0000 (14:57 +0100)]
Bump __FreeBSD_version after linuxkpi changes

Needed to add a graphics/drm-515-kmod port.

Sponsored by: Beckhoff Automation GmbH & Co. KG

15 months agolinuxkpi: Add more suspend defines
Emmanuel Vadot [Fri, 17 Feb 2023 13:49:52 +0000 (14:49 +0100)]
linuxkpi: Add more suspend defines

Needed by drm 5.15-lts

Sponsored by: Beckhoff Automation GmbH & Co. KG

15 months agorc.conf.5: clarify source directories
Jamie Landeg-Jones [Thu, 16 Feb 2023 11:55:01 +0000 (12:55 +0100)]
rc.conf.5: clarify source directories

In 454adf0fa4d787bf6e6ff7be0aa6c27a91d2be8e some of the issues reported in the
PR where addressed. This commit adds a clarification about how the prefix of the
directories to be sourced actually behave.

PR: 197152
Reported by: jason.mann+freebsd@gmail.com
Approved by: manpages (bcr@)
Differential Revision: https://reviews.freebsd.org/D38627

15 months agoMFV: zlib 1.2.13.
Xin LI [Fri, 17 Feb 2023 07:57:24 +0000 (23:57 -0800)]
MFV: zlib 1.2.13.

Relnotes: yes
MFC after: 3 days

15 months agonfscommon: Revert use of nfsstatsv1_p in nfs_commonkrpc.c
Rick Macklem [Fri, 17 Feb 2023 01:44:19 +0000 (17:44 -0800)]
nfscommon: Revert use of nfsstatsv1_p in nfs_commonkrpc.c

Commit 9d329bbc9aea converted a lot of accesses to nfsstatsv1
to use nfsstatsv1_p instead.  However, the accesses in
nfs_commonkrpc.c are for client side and should not be
converted.  This patch puts them back in the correct
pre-commit 9d329bbc9aea form.

MFC after: 3 months

15 months agollvm: make sure to use ELFv2 ABI on powerpc64
Piotr Kubaj [Thu, 16 Feb 2023 23:49:43 +0000 (00:49 +0100)]
llvm: make sure to use ELFv2 ABI on powerpc64

Currently LLVM is more or less set up to use ELFv2, but it still defaults to
ELFv1 in some places. This causes lld to generate broken binaries when used
with LTO.

PR: 269455
Approved by: dim
MFC after: 3 days

15 months agokrpc: Replace !jailed() with IS_DEFAULT_VNET()
Rick Macklem [Thu, 16 Feb 2023 22:32:50 +0000 (14:32 -0800)]
krpc: Replace !jailed() with IS_DEFAULT_VNET()

Since svcpool_create() is now called from an initialization function,
!jailed() no longer works.  Replace it with IS_DEFAULT_VNET().

MFC after: 3 months

15 months agozfs: merge openzfs/zfs@57cfae4a2 (master)
Martin Matuska [Thu, 16 Feb 2023 21:38:51 +0000 (22:38 +0100)]
zfs: merge openzfs/zfs@57cfae4a2 (master)

Notable upstream pull request merges:
  #13816 Fix a race condition in dsl_dataset_sync() when
         activating features
  #14402 Prefetch on deadlists merge
  #14410 Improve resilver ETAs
  #14428 Resilver performance tuning
  #14439 Resolve WS-2021-0184 vulnerability in zstd
  #14440 EIO caused by encryption + recursive gang
  #14448 Fix console progress reporting for recursive send
  #14454 Improve arc_read() error reporting
  #14460 Restore FreeBSD to use .rodata
  #14474 Reduce need for contiguous memory for ioctls

Obtained from: OpenZFS
OpenZFS commit: 57cfae4a2f04aaff10c45b3f7975e0fe3ef3e8b8

15 months agopowerpc: remove nexus_get_cpus()
Mitchell Horne [Mon, 13 Feb 2023 17:38:41 +0000 (13:38 -0400)]
powerpc: remove nexus_get_cpus()

It is identical in functionality to root_get_cpus().

Reviewed by: jhibbits
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D38494

15 months agokern/clock: remove interrupt reporting from watchdog_fire()
Elliott Mitchell [Thu, 16 Feb 2023 21:18:54 +0000 (17:18 -0400)]
kern/clock: remove interrupt reporting from watchdog_fire()

The interrupt counts may have been valuable in the past, but now DDB can
readily provide them via 'show intrcnt'. This is one of the only
consumers of these counter arrays outside of the interrupt code itself,
and this should be avoided.

Reviewed by: mhorne, fuz
Differential Revision: https://reviews.freebsd.org/D37870

15 months agoClean up additional obsolete MLINKS
Mitchell Horne [Mon, 13 Feb 2023 18:29:12 +0000 (14:29 -0400)]
Clean up additional obsolete MLINKS

Sponsored by: The FreeBSD Foundation
Fixes: d1c7405ef68a ("PCBGROUP.9: remove obsolete man page")
Fixes: 52f9a2823c64 ("rtalloc.9: remove obsolete man page")

15 months agoconfig: address a number of Coverity issues
Kyle Evans [Thu, 16 Feb 2023 20:36:17 +0000 (14:36 -0600)]
config: address a number of Coverity issues

Highlights:
- Various memory leaks
- FILE* leaks
- `tsize` in moveifchanged() is only needed if !changed, and `from_sb`
    is only valid if !changed.
- Simplify trivially true expression
- Sanity check elfdump size output (+ fix variable sizes) (des@)

CID: 1471167100639115053331505275150534915053061505232
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D38643

15 months agoconfig: error out on malformed env/hint lines
Kyle Evans [Thu, 16 Feb 2023 20:36:17 +0000 (14:36 -0600)]
config: error out on malformed env/hint lines

We need these to be assignments, error out if they're not.

While we're here, tag errout as __printflike so that the compiler will
sanity check the format string + args.

CID: 1505293
Reviewed by: emaste, imp
Differential Revision: https://reviews.freebsd.org/D38642

15 months agoconfig: push path() into moveifchanged()
Kyle Evans [Thu, 16 Feb 2023 20:36:16 +0000 (14:36 -0600)]
config: push path() into moveifchanged()

Every caller path()s its arguments anyways, just simplify these and push
path() into moveifchanged().  This fixes a number of memory leaks in the
process since path() allocates memory, which we will now free().

While we're here, make sure we close from_fd/to_fd appropriately.

CID: 14710401471714147204510069071006908
Reviewed by: emaste, imp
Differential Revision: https://reviews.freebsd.org/D38641

15 months agoconfig: fix some common issues with path() usage
Kyle Evans [Thu, 16 Feb 2023 20:36:16 +0000 (14:36 -0600)]
config: fix some common issues with path() usage

None of the callers check that the allocation in path() failed, so let's
check in path() and abort instead of failing.

Along those lines, none of the callers seem to acknowledge that the
returned string needs to be free()d -- let's do that as well.  There are
a couple not addressed in this commit that will be addressed in a future
commit by pushing the path() call down into moveifchanged() instead and
freeing it properly there.

CID: 150527115052501505279
Reviewed by: emaste, imp

15 months agoRevert "cpuset: add --count"
Mateusz Guzik [Thu, 16 Feb 2023 18:12:46 +0000 (18:12 +0000)]
Revert "cpuset: add --count"

The patch introduced a behavior change coming from getopt_long, namely
the entire argument array would be parsed looking for opts, which
affected uses spawning new processes without passing '--' to delimit
where cpuset arguments end. [1]

Apart from that turns out the change had a bug: using CPU_LEVEL_ROOT
instead of CPU_LEVEL_WHICH, returning a different cpuset than intended.
[2]

The intended functionality is provided with nproc(1), which landed after
this change.

As such, revert for the time being.

This reverts commit d9d5f2c042a51a9f0dd69eb1fc349efd81ffa483.

Reported by: Mark Millard [1]
Reported by: jbeich [2]

15 months agoefivar: Really look for labels for the provider with right efimedia
Warner Losh [Thu, 16 Feb 2023 15:53:53 +0000 (08:53 -0700)]
efivar: Really look for labels for the provider with right efimedia

The prior code mistakently thought that the g_consumer that hung off the
provider we found were the right thing to use to find all the glabel
aliases for this node. However, the only way to find that is to iterate
through all the geoms that belong to the glabel geom class, looking for
those geoms with the same name as the provider with the right efimedia.
Do this in a way that caches glabel class, and allows for it to be
absent. Tighten the filter for mounted filesystems to only look
for the ones that are mounted on /dev/.. since the rest of the code
assumes that.

MFC After: 3 days
Sponsored by: Netflix
Reviewed by: corvink, asomers
Differential Revision: https://reviews.freebsd.org/D38619

15 months agoefibootmgr: Add --efidev (-u) to discover UEFI's device path to a dev or file
Warner Losh [Thu, 16 Feb 2023 15:53:45 +0000 (08:53 -0700)]
efibootmgr: Add --efidev (-u) to discover UEFI's device path to a dev or file

"efibootmgr --efidev unix-path" will return the UEFI device-path to the
file or device specified by unix-path. It's useful for debugging, but
may also be useful for scripting.

Sponsored by: Netflix
Reviewed by: corvink, manu
Differential Revision: https://reviews.freebsd.org/D38617

15 months agoefivar: support device paths as well as mounted paths in path_to_dp
Warner Losh [Thu, 16 Feb 2023 15:53:35 +0000 (08:53 -0700)]
efivar: support device paths as well as mounted paths in path_to_dp

In path_to_dp, allow passing in either the actual device path "eg
/dev/foo/bar" or the path where the device is mounted (say
/mnt/baz/bing). In the former case we'll assume the path within the
device is nothing (the relpath). In the latter, we'll take from the
mount point on down as the relpath.

Sponsored by: Netflix
Reviewed by: corvink, manu, asomers
Differential Revision: https://reviews.freebsd.org/D38616

15 months agoefivar: Allow NULL paths in build_dp
Warner Losh [Thu, 16 Feb 2023 15:53:26 +0000 (08:53 -0700)]
efivar: Allow NULL paths in build_dp

Allow there to be NULL paths in buildp. This lets us return the device
path to the partition, as well as to files on the partition.

Sponsored by: Netflix
Reviewed by: corvink, manu, asomers
Differential Revision: https://reviews.freebsd.org/D38615

15 months agoefivar: Try harder to find label's efimedia
Warner Losh [Thu, 16 Feb 2023 15:53:15 +0000 (08:53 -0700)]
efivar: Try harder to find label's efimedia

If there's no efimedia attribute on the provider, and the provider's a
glabel, then find the 'parent' geom. In this case, the provider's name
is label-type/name, but the geom's label will that of the underlying
device (eg ada0p1). If it is, recurisvely call find_geom_efimedia with
the geom's name, which shuold have the efimedia attribute.

Sponsored by: Netflix
Reviewed by: corvink, manu, asomers
Differential Revision: https://reviews.freebsd.org/D38614

15 months agolibpcap: Make pcap/bpf.h a wrapper around system net/bpf.h
Joseph Mingrone [Mon, 13 Feb 2023 22:06:51 +0000 (18:06 -0400)]
libpcap: Make pcap/bpf.h a wrapper around system net/bpf.h

In the past, we modified pcap/pcap.h to include the system net/bpf.h
rather than libpcap's own pcap/bpf.h.  However, starting around 1.10.2,
libpcap requires a few extern functions defined in pcap/bpf.h to build.
Simply reverting that local change and pulling in pcap/bpf.h is not a
solution, because some ports with '#include <pcap.h>' such as mail/spamd
and net/xprobe require the system net/bpf.h to be pulled in.  To
accommodate both requirements, make pcap/bpf.h a wrapper around the
system net/bpf.h, but retain the extern function definitions.  This is
in preparation for libpcap 1.10.3.

Approved by: cy, philip, emaste, delphij (earlier revision)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D38575

15 months agonetlink: fix interface dump.
Alexander V. Chernikov [Thu, 16 Feb 2023 13:17:58 +0000 (13:17 +0000)]
netlink: fix interface dump.

The current code missed interface addition when reallocating
 temporary buffer.
Tweak the code to perform the reallocation first and add
 interface afterwards unconditionally.

Reported by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
MFC after: 3 days

15 months agoVendor import of zlib 1.2.13.
Xin LI [Thu, 16 Feb 2023 09:12:35 +0000 (01:12 -0800)]
Vendor import of zlib 1.2.13.

15 months agopfsync: ensure 'error' is always initialised
Kristof Provost [Thu, 16 Feb 2023 08:16:35 +0000 (09:16 +0100)]
pfsync: ensure 'error' is always initialised

Reported by: Herbert J. Skuhra <herbert@gojira.at>
MFC after: 2 weeks

15 months agopfsync: support deferring IPv6 packets
Kristof Provost [Tue, 14 Feb 2023 06:11:38 +0000 (07:11 +0100)]
pfsync: support deferring IPv6 packets

When we send out a deferred packet we must make sure to call
ip6_output() for IPv6 packets. If not we might end up attempting to
ip_fragment() an IPv6 packet, which could lead to us reading outside of
the mbuf.

PR: 268246
Reviewed by: melifaro, zlei
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D38586

15 months agoipsec: only update lastused when it changes
Mateusz Guzik [Wed, 8 Feb 2023 09:53:05 +0000 (09:53 +0000)]
ipsec: only update lastused when it changes

to limit cache-line bouncing.

Note that as there is no atomic_store we are hoping the compiler wont
speculatively do the store. It is not employed because the size depends
on target arch.

Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D38433

15 months agoExclude MMCCAM kernels from make universe
Mateusz Guzik [Wed, 8 Feb 2023 22:02:16 +0000 (22:02 +0000)]
Exclude MMCCAM kernels from make universe

They don't provide any value and are quite arbitrary.

Note arm64 GENERIC-MMCCAM was already excluded, just not the NODEBUG
variant.

The option is already build-tested with arm64 LINT kernel.

Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D38458

15 months agohyperv: Fix Coverity issues in the Hyper-V driver
Robert Herndon [Sun, 12 Feb 2023 05:09:20 +0000 (23:09 -0600)]
hyperv: Fix Coverity issues in the Hyper-V driver

Summary:
Coverity reports the use of two uninitialized variables in the hyperv
driver. Examination shows the variables can be accessed while
uninitialized in error cases. Fix both.

CID: 1365235
CID: 1365236
Sponsored by: Dell Technologies
MFC after: 1w

Test Plan: Changes in use at $WORK

Reviewers: robert.herndon_dell.com, vangyzen, bret_ketchum_dell.com

Subscribers: imp, badger

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

15 months agonfsd: Wrap nfsstatsv1_p in the NFSD_VNET() macro
Rick Macklem [Thu, 16 Feb 2023 01:39:07 +0000 (17:39 -0800)]
nfsd: Wrap nfsstatsv1_p in the NFSD_VNET() macro

Commit 7344856e3a6d added a lot of macros that will front end
vnet macros so that nfsd(8) can run in vnet prison.
The nfsstatsv1_p variable got missed.  This patch wraps all
uses of nfsstatsv1_p with the NFSD_VNET() macro.
The NFSD_VNET() macro is still a null macro.

MFC after: 3 months

15 months agowc: Make the read buffer static.
Dag-Erling Smørgrav [Thu, 16 Feb 2023 00:40:30 +0000 (00:40 +0000)]
wc: Make the read buffer static.

The read buffer in cnt() is 64 kB, which is a bit excessive for a stack variable.  MAXBSIZE has grown since this code was originally written, and it might grow again in the future.  Since the program is single-threaded and cnt() does not recurse, we can safely make the buffer static.

While there, constify p since it is only used to read.

Sponsored by: Klara, Inc.
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D38608

15 months agowc: Improve test coverage.
Dag-Erling Smørgrav [Thu, 16 Feb 2023 00:40:22 +0000 (00:40 +0000)]
wc: Improve test coverage.

* Add a test that causes mbrtowc() to return 0.

* Add a test that causes mbrtowc() to return -2.

Sponsored by: Klara, Inc.
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D38605

15 months agotarfs: Use a separate debug bit for bounce buffer usage.
Dag-Erling Smørgrav [Thu, 16 Feb 2023 00:40:18 +0000 (00:40 +0000)]
tarfs: Use a separate debug bit for bounce buffer usage.

Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D38588

15 months agokgssapi: Add macros so that gssd(8) can run in vnet prison
Rick Macklem [Wed, 15 Feb 2023 23:18:46 +0000 (15:18 -0800)]
kgssapi: Add macros so that gssd(8) can run in vnet prison

Commit 7344856e3a6d added a lot of macros that will front end
vnet macros so that nfsd(8) can run in vnet prison.
This patch adds similar macros named KGSS_VNETxxx so that
the gssd(8) daemon can run in a vnet prison, once the
macros front end the vnet ones.  For now, they are null macros.

This is the last commit that adds macros.  The next step is
to change the macros to front end the vnet ones.

MFC after: 3 months

15 months agoefidp: Remove write only variable
Warner Losh [Wed, 15 Feb 2023 23:03:02 +0000 (16:03 -0700)]
efidp: Remove write only variable

Sponsored by: Netflix

15 months agolibefivar: Add note about extra compiler flags
Warner Losh [Wed, 15 Feb 2023 23:02:56 +0000 (16:02 -0700)]
libefivar: Add note about extra compiler flags

Add a note about why we need these extra compiler flags to suppress
warnings. EDK2 upstream code is being used verbatim and as of the last
update these issuse persist, but are benign.

Sponsored by: Netflix
Reviewed by: asomers
Differential Revision: https://reviews.freebsd.org/D38613

15 months agoixgbe(4): Filter out spurious link up indication
Krzysztof Galazka [Wed, 15 Feb 2023 22:35:40 +0000 (14:35 -0800)]
ixgbe(4): Filter out spurious link up indication

Extend SFP+ cage crosstalk fix by re-checking link state after 5ms delay
to filter out spurious link up indication by transceiver with no fiber
cable connected.

Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Reviewed by: erj@
Tested by: Gowtham Kumar Ks <gowtham.kumar.ks@intel.com>
MFC after: 3 days
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D38395

15 months agoixl(4): Fix MAC/VLAN filters accounting
Krzysztof Galazka [Wed, 15 Feb 2023 22:28:01 +0000 (14:28 -0800)]
ixl(4): Fix MAC/VLAN filters accounting

- Account for a filter required to enable reception of untagged frames
while registering and unregistering VLANs to avoid trying to add more
filters than HW supports

- While adding MAC/VLAN filters, pre-set matching method field in the
Admin Queue Command response buffer to expected error value to work
around an issue with some FW versions, which do not update that field if
operation fails, and be able correctly track which filters were
configured in HW.

- Remove unused IXL_MAX_FILTERS macro definition

- Update number of available MAC/VLAN filters as in newer FW versions it
was decreased by one.

- Simplify i40e_dma_mem structure

Signed-off-by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Signed-off-by: Eric Joyner <erj@FreeBSD.org>
Reviewed by: erj@
Tested by: Gowtham Kumar Ks <gowtham.kumar.ks@intel.com>
MFC after: 3 days
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D37457

15 months agolinuxkpi: Add `strscpy_pad()` to <linux/string.h>
Jean-Sébastien Pédron [Tue, 14 Feb 2023 23:46:13 +0000 (00:46 +0100)]
linuxkpi: Add `strscpy_pad()` to <linux/string.h>

It's the same as `strscpy()` except that it fills the rest of the
destination buffer with zeroes if the source buffer is shorter.

Reviewed by: manu
Approved by: manu

15 months agolinuxkpi: Define `debugfs_initialized()`
Jean-Sébastien Pédron [Tue, 14 Feb 2023 23:38:59 +0000 (00:38 +0100)]
linuxkpi: Define `debugfs_initialized()`

It always return true on FreeBSD, at least for now, because all DRM
drivers using it depend on lindebugfs.

Reviewed by: manu
Approved by: manu

15 months agocxgbe: Don't leak memory resource if t4iov attach fails.
John Baldwin [Wed, 15 Feb 2023 21:34:00 +0000 (13:34 -0800)]
cxgbe: Don't leak memory resource if t4iov attach fails.

Co-authored by: np
Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D38580

15 months agoaio: Fix more synchronization issues in aio_biowakeup.
John Baldwin [Wed, 15 Feb 2023 21:32:52 +0000 (13:32 -0800)]
aio: Fix more synchronization issues in aio_biowakeup.

- Use atomic_store to set job->error.  atomic_set does an or
  operation, not assignment.

- Use refcount_* to manage job->nbio.

  This ensures proper memory barriers are present so that the last bio
  won't see a possibly stale value of job->error.

- Don't re-read job->error after reading it via atomic_load.

Reported by: markj (1)
Reviewed by: mjg, markj
Differential Revision: https://reviews.freebsd.org/D38611

15 months agonproc: denote an incompatiblity with Linux
Mateusz Guzik [Wed, 15 Feb 2023 20:17:27 +0000 (20:17 +0000)]
nproc: denote an incompatiblity with Linux

On Linux _NPROCESSORS_CONF reports CPU threads disabled by the kernel,
while it does not on FreeBSD.

Flip _NPROCESSORS_ONLN to _NPROCESSORS_CONF. While it keeps reporting
the same value, it will automagically unbreak should someone change the
above.

15 months agonetlink: use ifmedia to provide vlan interface operstate.
Alexander V. Chernikov [Wed, 15 Feb 2023 20:22:47 +0000 (20:22 +0000)]
netlink: use ifmedia to provide vlan interface operstate.

Netlink customers rely on admin and operational state when
 working with interfaces. The current implementation retuns
 "unknown" operstate for all interface types except IFT_ETHER
 and IFT_LOOP.

This change updates the code to fetch vlan operstate in the same way
 as for the ether interfaces. For the rest of the interface types,
 operstate is now mapped to the admin state.

Reported by: Marek Zarychta <zarychtam@plan-b.pwste.edu.pl>
MFC after: 3 days

15 months agoprofil(2): profil(II) was in the v3 sources
Warner Losh [Wed, 4 Jan 2023 16:41:16 +0000 (09:41 -0700)]
profil(2): profil(II) was in the v3 sources

profil(II) is in the scanned 3rd edition manual that we have. We don't
have the 3rd edition sources, nor do we have the 4th edition souces. We
have a mostly complete (missing pipes) 4th edition C rewrite where
profil system call number is reserved, but it's not implemented (it's in
the manx section for things that apeared to have been in 3rd edition but
weren't yet part of the reimplemented 4th edition). The 5th edition
sources we have do have it, however. For other items that have appeared
in earlier manuals, we've added the simple verbage to the manual and
relegated the rest of the data for that file to the commit message.

15 months agoaio_biowakeup: Various style fixes.
John Baldwin [Wed, 15 Feb 2023 18:57:08 +0000 (10:57 -0800)]
aio_biowakeup: Various style fixes.

15 months agoaio: Fix a test and set race in aio_biowakeup.
Keith Reynolds [Wed, 15 Feb 2023 18:56:39 +0000 (10:56 -0800)]
aio: Fix a test and set race in aio_biowakeup.

Use atomic_fetchadd in place of separate atomic_subtract / atomic_load.

Reviewed by: markj
Sponsored by: HPE TidalScale
Differential Revision: https://reviews.freebsd.org/D38559

15 months agoinpcb: use family specific sockaddr argument for bind functions
Gleb Smirnoff [Wed, 15 Feb 2023 18:30:16 +0000 (10:30 -0800)]
inpcb: use family specific sockaddr argument for bind functions

Do the cast from sockaddr to either IPv4 or IPv6 sockaddr in the
protocol's pr_bind method and from there on go down the call
stack with family specific argument.

Reviewed by: zlei, melifaro, markj
Differential Revision: https://reviews.freebsd.org/D38601

15 months agozdb: zero-pad checksum output follow up
Brian Behlendorf [Wed, 15 Feb 2023 17:06:29 +0000 (09:06 -0800)]
zdb: zero-pad checksum output follow up

Apply zero padding for checksums consistently.  The SNPRINTF_BLKPTR
macro was not updated in commit ac7648179c8 which results in the
`cli_root/zdb/zdb_checksum.ksh` test case reliably failing.

Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Reviewed-by: Akash B <akash-b@hpe.com>
Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #14497

15 months agoMechanically convert mlx5en(4) to IfAPI
Justin Hibbits [Mon, 19 Sep 2022 20:58:00 +0000 (16:58 -0400)]
Mechanically convert mlx5en(4) to IfAPI

Reviewed by: zlei
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D38595

15 months agokrpc: Add macros so that rpc.tlsservd can run in vnet prison
Rick Macklem [Wed, 15 Feb 2023 13:58:21 +0000 (05:58 -0800)]
krpc: Add macros so that rpc.tlsservd can run in vnet prison

Commit 7344856e3a6d added a lot of macros that will front end
vnet macros so that nfsd(8) can run in vnet prison.
This patch adds similar macros named KRPC_VNETxxx so that
the rpc.tlsservd(8) daemon can run in a vnet prison, once the
macros front end the vnet ones.  For now, they are null macros.

MFC after: 3 months

15 months agoDrop space in "vm object" lock name to improve wchan
Ed Maste [Wed, 15 Feb 2023 13:31:17 +0000 (08:31 -0500)]
Drop space in "vm object" lock name to improve wchan

Lock names are shown in top as a `*` followed by the first five
characters of the name.  `*vmobj` a little more obvious and easier to
search for than `*vm ob`.

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

15 months agoAdd an example using /etc/rc.conf syntax
Poul-Henning Kamp [Wed, 15 Feb 2023 11:39:15 +0000 (11:39 +0000)]
Add an example using /etc/rc.conf syntax

15 months agocpuset: Add compat shim to the sched_affinity functions
Dmitry Chagin [Wed, 15 Feb 2023 09:23:15 +0000 (12:23 +0300)]
cpuset: Add compat shim to the sched_affinity functions

To allow to run a newer world on a pre-1400079 kernel a compat shims to
the sched_affinity functions has beed added.

Reported by: antoine
Tested by: antoine
Reviewed by: kib
Differential revision: https://reviews.freebsd.org/D38555
MFC after: 3 days

15 months agousb: Remove unused member in struct mos_softc
Zhenlei Huang [Wed, 15 Feb 2023 05:07:19 +0000 (13:07 +0800)]
usb: Remove unused member in struct mos_softc

Spotted by jhibbits in D37812.

Reviewed by: #network, glebius
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D38581

15 months agotarfs: Don't panic if the parent of a new node is not a directory.
Dag-Erling Smørgrav [Wed, 15 Feb 2023 02:12:45 +0000 (02:12 +0000)]
tarfs: Don't panic if the parent of a new node is not a directory.

PR: 269519
Sponsored by: Juniper Networks, Inc.
Sponsored by: Klara, Inc.
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D38587

15 months agotmpfs: remove IFF macro
Konstantin Belousov [Mon, 13 Feb 2023 23:47:44 +0000 (01:47 +0200)]
tmpfs: remove IFF macro

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

15 months agotmpfs: remove bogus MPASS(VOP_ISLOCKED(vp)) asserts
Konstantin Belousov [Mon, 13 Feb 2023 23:23:24 +0000 (01:23 +0200)]
tmpfs: remove bogus MPASS(VOP_ISLOCKED(vp)) asserts

VOP_ISLOCKED() does not return bool, its only reliable use it to check
that the vnode is exclusively locked by the calling thread.  Almost all
asserts of this form repeated auto-generated assertions from
vnode_if.src for VOPs, in the incorrect way.

In two places where the assertions would be meaningful, convert them to
ASSERT_VOP_LOCKED() statements.

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

15 months agosys/param.h: Add _WANT_P_OSREL
Konstantin Belousov [Tue, 14 Feb 2023 08:52:14 +0000 (10:52 +0200)]
sys/param.h: Add _WANT_P_OSREL

Use it instead of defining IN_RTLD by base sources that want P_OSREL_
defines in userspace, but are not rtld.
This allows to remove abuse of IN_RTLD from userspace.

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

15 months agolinuxkpi: Move `IS_ENABLED()` and friends to <linux/kconfig.h>
Jean-Sébastien Pédron [Mon, 13 Feb 2023 20:52:08 +0000 (21:52 +0100)]
linuxkpi: Move `IS_ENABLED()` and friends to <linux/kconfig.h>

The header is included in <linux/xarray.h> like it is on Linux. Some DRM
code depends on this header "pollution".

Reviewed by: bz
Approved by: bz
Differential Revision: https://reviews.freebsd.org/D38567

15 months agowc: Clean up and modernize.
Dag-Erling Smørgrav [Tue, 14 Feb 2023 22:26:34 +0000 (22:26 +0000)]
wc: Clean up and modernize.

* Drop <err.h>, which is unnecessary since we use libxo.

* As per POSIX, report an error if output fails.

* Fix some type mismatches.

* Use bool instead of int where appropriate.

* Avoid repeatedly checking for a null filename.

* Miscellaneous other tidying.

* Add tests (partly derived from work performed by SHENG-YI HONG <i19780219111@kimo.com>).

Sponsored by: Klara, Inc.
Reviewed by: kevans
Differential Revision: https://reviews.freebsd.org/D38496

15 months agolinuxkpi: Add <linux/cc_platform.h>
Jean-Sébastien Pédron [Tue, 14 Feb 2023 21:44:21 +0000 (22:44 +0100)]
linuxkpi: Add <linux/cc_platform.h>

It defines the `cc_platform_has()` function.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38596

15 months agolinuxkpi: Update `ww_mutex_trylock()` API for Linux 5.16
Jean-Sébastien Pédron [Mon, 13 Feb 2023 22:22:54 +0000 (23:22 +0100)]
linuxkpi: Update `ww_mutex_trylock()` API for Linux 5.16

It gains new `struct ww_acquire_ctx *` argument we don't use currently.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38568

15 months agolinuxkpi: Declare `struct fwnode_handle` in <linux/fwnode.h>
Jean-Sébastien Pédron [Mon, 13 Feb 2023 20:51:00 +0000 (21:51 +0100)]
linuxkpi: Declare `struct fwnode_handle` in <linux/fwnode.h>

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38566

15 months agolinuxkpi: Add `synchronize_shrinkers()`
Jean-Sébastien Pédron [Mon, 13 Feb 2023 20:49:28 +0000 (21:49 +0100)]
linuxkpi: Add `synchronize_shrinkers()`

It takes the lock and release it immediately to make sure no shrinkers
are running in parallel.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38565

15 months agolinuxkpi: Define `totalram_pages()`
Jean-Sébastien Pédron [Wed, 8 Feb 2023 17:52:43 +0000 (18:52 +0100)]
linuxkpi: Define `totalram_pages()`

It returns `physmem`.

`__FreeBSD_version` is bumped to 1400080. We need that to remove a copy
of this function in the i915 DRM driver, maintained outside of base.

Reviewed by: manu
Approved by: manu
Differential Revision: https://reviews.freebsd.org/D38531

15 months agolinuxkpi: Accept NULL as a value in `linux_xarray`
Jean-Sébastien Pédron [Sat, 11 Feb 2023 10:12:08 +0000 (11:12 +0100)]
linuxkpi: Accept NULL as a value in `linux_xarray`

Linux' XArray allows to store a NULL pointer as a value. `xa_load()`
would return NULL for both an unused index and an index set to NULL. But
it impacts `xa_alloc()` which needs to find the next available index.

However, our implementation relies on a radix tree (see `linux_radix.c`)
which does not accept NULL pointers as values. I'm not sure if this is a
limitation or a feature, so to work around this, a NULL value is
replaced by `NULL_VALUE`, an unlikely address, when we pass it to
linux_radix.

Reviewed by: emaste, manu
Approved by: emaste, manu
Differential Revision: https://reviews.freebsd.org/D38543

15 months agokrpc: Remove VNET_NFSD #ifdefs
Rick Macklem [Tue, 14 Feb 2023 21:53:39 +0000 (13:53 -0800)]
krpc: Remove VNET_NFSD #ifdefs

The consensus is that the VNET_NFSD kernel option is not
needed, so this commit removes its use from the kernel RPC.

MFC after: 3 months

15 months agonfsd: Continue adding macros so nfsd can run in a vnet prison
Rick Macklem [Tue, 14 Feb 2023 21:33:35 +0000 (13:33 -0800)]
nfsd: Continue adding macros so nfsd can run in a vnet prison

Commit 7344856e3a6d added a lot of macros that will front end
vnet macros so that nfsd(8) can run in vnet prison.
This patch adds some more, to allow the nfsuserd(8) daemon to
run in vnet prison, once the macros map to vnet ones.
This is the last commit for NFSD_VNET_xxx macros, but there are
still some for KRPC_VNET_xxx and KGSS_VNET_xx to allow the
rpc.tlsservd(8) and gssd(8) daemons to run in a vnet prison.

MFC after: 3 months

15 months agofusefs: fix some resource leaks
Alan Somers [Sat, 11 Feb 2023 23:43:30 +0000 (16:43 -0700)]
fusefs: fix some resource leaks

fusefs would leak tickets in three cases:
* After FUSE_CREATE, if the server returned a bad inode number.
* After a FUSE_FALLOCATE operation during VOP_ALLOCATE
* After a FUSE_FALLOCATE operation during VOP_DEALLOCATE

MFC after: 3 days
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D38526

15 months agoCirrus-CI: use makefs if root size exceeds QEMU's virtual FAT limit
Ed Maste [Mon, 13 Feb 2023 17:39:39 +0000 (12:39 -0500)]
Cirrus-CI: use makefs if root size exceeds QEMU's virtual FAT limit

We use QEMU's virtual FAT support to avoid having to create a disk
image because it is much faster, but it has a limit of about 500MB.
Artifacts produced by the GCC 12 CI job exceeded this size.

Add support for creating a FAT partition image and MBR-partitioned disk
image and use it when the file system is too large for QEMU.

In one run the Cirrus-CI LLVM test task took 1m33s using QEMU's virtual
FAT while the GCC task took 6m48s using makefs+mkimg.

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

15 months agoSuppress Clang static analyzer complaint in zfs_replay_create()
Richard Yao [Tue, 14 Feb 2023 19:05:41 +0000 (14:05 -0500)]
Suppress Clang static analyzer complaint in zfs_replay_create()

Clang's static analyzer incorrectly complains about an undefined value
here when lr->lr_common.lrc_txtype == TX_SYMLINK and txtype ==
TX_CREATE. This is impossible, because of this line:

txtype = (lr->lr_common.lrc_txtype & ~TX_CI((uint64_t)0x1 << 63));

Changing the code to compare against txtype suppresses the report.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14472

15 months agoLinux: use filemap_range_has_page()
Brian Behlendorf [Tue, 14 Feb 2023 19:04:34 +0000 (11:04 -0800)]
Linux: use filemap_range_has_page()

As of the 4.13 kernel filemap_range_has_page() can be used to
check if there is a page mapped in a given file range.  When
available this interface should be used which eliminates the
need for the zp->z_is_mapped boolean.

Reviewed-by: Brian Atkinson <batkinson@lanl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #14493

15 months agoGive strlcat() full buffer lengths rather than smaller buffer lengths
Richard Yao [Tue, 14 Feb 2023 19:03:42 +0000 (14:03 -0500)]
Give strlcat() full buffer lengths rather than smaller buffer lengths

strlcat() is supposed to be given the length of the destination buffer,
including the existing contents. Unfortunately, I had been overzealous
when I wrote a51288aabbbc176a8a73a8b3cd56f79607db32cf, since I gave it
the length of the destination buffer, minus the existing contents. This
likely caused a regression on large strings.

On the topic of being overzealous, the use of strlcat() in
dmu_send_estimate_fast() was unnecessary because recv_clone_name is a
fixed length string. We continue using strlcat() mostly as defensive
programming, in case the string length is ever changed, even though it
is unnecessary.

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Closes #14476

15 months agointrng: track counter allocation with a bitmap
Mitchell Horne [Tue, 14 Feb 2023 18:02:12 +0000 (14:02 -0400)]
intrng: track counter allocation with a bitmap

Crucially, this allows releasing counters, and interrupt sources by
extension. Where before we were incrementing intrcnt_index with atomics,
now we protect the bitmap using the existing isrc_table_lock mutex.

Reviewed by: mmel
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D38437

15 months agointrng: sort includes
Mitchell Horne [Sat, 4 Feb 2023 17:04:30 +0000 (13:04 -0400)]
intrng: sort includes

MFC after: 3 days

15 months agopfil: add pfil_mem_{in,out}() and retire pfil_run_hooks()
Gleb Smirnoff [Tue, 14 Feb 2023 18:02:49 +0000 (10:02 -0800)]
pfil: add pfil_mem_{in,out}() and retire pfil_run_hooks()

The 0b70e3e78b0 changed the original design of a single entry point
into pfil(9) chains providing separate functions for the filtering
points that always provide mbufs and know the direction of a flow.
The motivation was to reduce branching.  The logical continuation
would be to do the same for the filtering points that always provide
a memory pointer and retire the single entry point.

o Hooks now provide two functions: one for mbufs and optional for
  memory pointers.
o pfil_hook_args() has a new member and pfil_add_hook() has a
  requirement to zero out uninitialized data. Bump PFIL_VERSION.
o As it was before, a hook function for a memory pointer may realloc
  into an mbuf.  Such mbuf would be returned via a pointer that must
  be provided in argument.
o The only hook that supports memory pointers is ipfw:default-link.
  It is rewritten to provide two functions.
o All remaining uses of pfil_run_hooks() are converted to
  pfil_mem_in().
o Transparent union of pfil_packet_t and tricks to fix pointer
  alignment are retired. Internal pfil_realloc() reduces down to
  m_devget() and thus is retired, too.

Reviewed by: mjg, ocochard
Differential revision: https://reviews.freebsd.org/D37977

15 months agonet: use pfil_mbuf_{in,out} where we always have an mbuf
Gleb Smirnoff [Tue, 14 Feb 2023 18:02:49 +0000 (10:02 -0800)]
net: use pfil_mbuf_{in,out} where we always have an mbuf

This finalizes what has been started in 0b70e3e78b0.

Reviewed by: kp, mjg
Differential revision: https://reviews.freebsd.org/D37976

15 months agosys/_endian.h: Move powerpc workaround into _endian.h
Warner Losh [Tue, 14 Feb 2023 17:48:05 +0000 (10:48 -0700)]
sys/_endian.h: Move powerpc workaround into _endian.h

Powerpc compilers often define _BIG_ENDIAN or _LITTLE_ENDIAN depending
on the byte order of the target. This interfers with the endian.h and
sys/endian.h APIs which expect those two to be 4321 or 1234.
Unconditionally undefine these two before we define them to work around
this issue. By including endian.h, the programmer is saying they want
this API not the native one. This matches historic practice as well.

Fixes: e35448a901aa
Sponsored by: Netflix
Noticed by: powerpc, powerpc64 CI jobs

15 months agoatkbd: correct bogus character in #ifdef
Ed Maste [Tue, 14 Feb 2023 16:54:12 +0000 (11:54 -0500)]
atkbd: correct bogus character in #ifdef

Fixes: f20058955c9d ("sys/kbio.h: make pre-unicode keymap...")
Sponsored by: The FreeBSD Foundation

15 months agobsd.cpu.mk: Simplify armv[67] support
Warner Losh [Tue, 14 Feb 2023 16:49:26 +0000 (09:49 -0700)]
bsd.cpu.mk: Simplify armv[67] support

Drop a clause that's no longer relevant to v4/v5. Drop support for
softfloat for v[45]. Simplify soft float expression by assuming we're
always either armv6 or armv7.

Sponsored by: Netflix
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D38584

15 months agoarmv5: Remove dead code
Warner Losh [Tue, 14 Feb 2023 16:49:00 +0000 (09:49 -0700)]
armv5: Remove dead code

No need to mark anything as broken on armv5 anymore.

Sponsored by: Netflix
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D38583

15 months agolibc: Simplify soft-float on 32-bit arm
Warner Losh [Tue, 14 Feb 2023 16:48:51 +0000 (09:48 -0700)]
libc: Simplify soft-float on 32-bit arm

Simplify the tests for 32-bit arm soft float support. For the files
included only on arm, drop the test entirely. For others, test
MACHINE_CPUARCH against arm.

No functional change intended. File lists appear the same before / after
the change.

Sponsored by: Netflix
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D38582

15 months agoarm: Remove armv5 supprt
Warner Losh [Tue, 14 Feb 2023 16:48:37 +0000 (09:48 -0700)]
arm: Remove armv5 supprt

This can only be true on armv5, so we can GC it.

Sponsored by: Netflix
Reviewed by: fuz@fuz.su, brooks, emaste
Differential Revision: https://reviews.freebsd.org/D38563

15 months agopowerpc: Drop old workaround for old gcc
Warner Losh [Tue, 14 Feb 2023 16:47:08 +0000 (09:47 -0700)]
powerpc: Drop old workaround for old gcc

Very old versions of gcc defined _BIG_ENDIAN and _LITTLE_ENDIAN. So to
work around that, we undefined them here. However, that causes problems
for programs that do:

(and many other variations on that theme). Since this often is the
result of weirdly nested includes in the ports world that are hard to
unwind, drop this workaround to help more ports build out of the box.
If there's still an issue here (and my testing hasn't shown it), we'll
fix the issue in a brand-new way once I have a reproducer.

This fixes the mesa-devel build, and others

Sponsored by: Netflix
Tested by: pkubaj
MFC After: 3 days
Differential Revision: https://reviews.freebsd.org/D38564

15 months agoPort Linuxulator to IfAPI
Justin Hibbits [Wed, 1 Feb 2023 21:30:22 +0000 (16:30 -0500)]
Port Linuxulator to IfAPI

Reviewed by: dchagin
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D38349

15 months agoFinish mechanical conversion of axgbe(4) to IfAPI.
Justin Hibbits [Tue, 7 Feb 2023 18:40:06 +0000 (13:40 -0500)]
Finish mechanical conversion of axgbe(4) to IfAPI.

Sponsored by: Juniper Networks, Inc.

15 months agoIfAPI: Style cleanup
Justin Hibbits [Fri, 10 Feb 2023 21:33:30 +0000 (16:33 -0500)]
IfAPI: Style cleanup

Summary:
Clean up style issues from IfAPI additions.

Casts to (struct ifnet *) made sense when `if_t` was a `void *`, but
since it's a `struct ifnet *` it no longer makes sense.  Fix whitespace
errors, among others.

Reviewed by: kib, glebius
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D38499

15 months agoIfAPI: Add capabilities2/capenable2 accessors
Justin Hibbits [Fri, 10 Feb 2023 15:45:44 +0000 (10:45 -0500)]
IfAPI: Add capabilities2/capenable2 accessors

Summary:
As a stopgap measure add basic accessors for the if_capabilities2 and
if_capenable2 members to further hide the ifnet details.

Sponsored by: Juniper Networks, Inc.
Reviewed by: glebius, kib
Differential Revision: https://reviews.freebsd.org/D38487

15 months agoIfAPI: More accessors
Justin Hibbits [Fri, 10 Feb 2023 15:53:19 +0000 (10:53 -0500)]
IfAPI: More accessors

Summary:
Add the following accessors needed by infiniband drivers:
* if_getaddrlen()
* if_setbroadcastaddr()
* if_resolvemulti()

With these accessors, and additional changes on the drivers' side, an
amd64 kernel can be compiled with `struct ifnet` completely hidden.

Reviewed by: melifaro
Sponsored by: Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D38488