FreeBSD/src 7e35682share/mk bsd.lib.mk

bsd.lib.mk: document INTERNALLIB and PRIVATELIB

(cherry picked from commit e60861eb41ca9d141a0d967db3ecbe2b2909c300)
DeltaFile
+14-0share/mk/bsd.lib.mk
+14-01 files

FreeBSD/src feac4c3sys/vm vm_object.c

vm_object_page_remove(): clear pager even if there is no resident pages

(cherry picked from commit 72a447d0bc768c7fe8a9c972f710c75afebd581b)
DeltaFile
+2-1sys/vm/vm_object.c
+2-11 files

FreeBSD/src ba5ef9dshare/mk bsd.lib.mk

bsd.lib.mk: document INTERNALLIB and PRIVATELIB

(cherry picked from commit e60861eb41ca9d141a0d967db3ecbe2b2909c300)
DeltaFile
+15-0share/mk/bsd.lib.mk
+15-01 files

FreeBSD/src 10f12fbsys/vm vm_object.c

vm_object_page_remove(): clear pager even if there is no resident pages

(cherry picked from commit 72a447d0bc768c7fe8a9c972f710c75afebd581b)
DeltaFile
+2-1sys/vm/vm_object.c
+2-11 files

FreeBSD/src d790b16lib/libc/stdbit stdc_first_trailing_one.3 stdc_bit_width.3

libc/stdbit: add man pages for stdbit functions

This adds man pages for each group of functions in <stdbit.h>.
The man pages have cross references to one-another.
Cross references from external man pages to these will be added
in a later commit.

Reviewed by:    pauamma at gundo.com, kib
Approved by:    markj (mentor)
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D53659
DeltaFile
+110-0lib/libc/stdbit/stdc_first_trailing_one.3
+104-0lib/libc/stdbit/stdc_bit_width.3
+98-0lib/libc/stdbit/stdc_has_single_bit.3
+93-0lib/libc/stdbit/stdc_first_trailing_zero.3
+93-0lib/libc/stdbit/stdc_first_leading_one.3
+92-0lib/libc/stdbit/stdc_first_leading_zero.3
+590-09 files not shown
+1,283-015 files

FreeBSD/src d39e310share/man/man3 stdbit.3 Makefile

man/man3: add stdbit.3

This is the overview man page for the <stdbit.h> functions.

Reviewed by:    pauamma at gundo.com, adrian
Approved by:    markj (mentor)
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D53658
DeltaFile
+120-0share/man/man3/stdbit.3
+1-0share/man/man3/Makefile
+121-02 files

FreeBSD/src 6296500include stdbit.h, lib/libc/stdbit Symbol.map stdc_bit_ceil.c

libc: implement C23 <stdbit.h> functions

This new header complies with ISO/IEC 9899:2024 (C23).

Contrary to glibc, we do not provide inline definitions in
<stdbit.h> as we expect our system compiler to soon recognise
these as builtins anyway.

Relnotes:       yes
MFC after:      1 month
Reviewed by:    adrian
Approved by:    markj (mentor)
Differential Revision:  https://reviews.freebsd.org/D53657
DeltaFile
+124-0include/stdbit.h
+85-0lib/libc/stdbit/Symbol.map
+71-0lib/libc/stdbit/stdc_bit_ceil.c
+60-0lib/libc/stdbit/stdc_leading_ones.c
+60-0lib/libc/stdbit/stdc_leading_zeros.c
+57-0lib/libc/stdbit/stdc_first_leading_zero.c
+457-013 files not shown
+973-219 files

FreeBSD/src 2fb8cbclib/libc/tests/stdbit stdbit-test-framework.c stdbit-test-kernel.c

libc/tests: add stdbit test framework and unit tests

This adds unit tests for all 70 functions in <stdbit.h>.

I'm sorry for the test framework, but it makes it so I don't
have to write 70 unit tests by hand.

Reviewed by:    adrian, des
Approved by:    markj (mentor)
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D53660
DeltaFile
+80-0lib/libc/tests/stdbit/stdbit-test-framework.c
+68-0lib/libc/tests/stdbit/stdbit-test-kernel.c
+30-0lib/libc/tests/stdbit/stdc_first_leading_zero_test.c
+29-0lib/libc/tests/stdbit/stdc_first_leading_one_test.c
+27-0lib/libc/tests/stdbit/stdc_first_trailing_zero_test.c
+26-0lib/libc/tests/stdbit/stdc_leading_ones_test.c
+260-013 files not shown
+513-019 files

FreeBSD/src 5bfdb66lib/libc/string ffs.3, share/man/man3 intro.3 bitstring.3

man/man3: add cross references to stdbit(3)

Add cross references to relevant stdbit man pages

Approved by:    markj (mentor)
MFC after:      1 month
Differential Revision: https://reviews.freebsd.org/D53661
DeltaFile
+9-2share/man/man3/intro.3
+2-0lib/libc/string/ffs.3
+1-0share/man/man3/bitstring.3
+12-23 files

FreeBSD/src 7998a82sys/arm/include _stdint.h, sys/arm64/include _stdint.h

sys/stdint.h: add C23 _WIDTH macros

The platform-dependent macros are added to the various
_stdint.h headers, those that are always the same are
added directly to _stdint.h.

We may want to move the definitions for WCHAR_* and
WINT_* out of the platform header files as those are
always the same.

Approved by:    markj (mentor)
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D53830
DeltaFile
+33-0sys/x86/include/_stdint.h
+33-0sys/powerpc/include/_stdint.h
+29-0sys/sys/stdint.h
+23-0sys/riscv/include/_stdint.h
+23-0sys/arm/include/_stdint.h
+23-0sys/arm64/include/_stdint.h
+164-06 files

FreeBSD/src 4a1c752lib/libc/tests/gen limits_test.c Makefile

libc/tests: add test for *_MAX, *_MIN, and *_WIDTH

This file checks the correctness of the various _MAX, _MIN, and
_WIDTH macros defined for the libc types.  It assumes that none
of the types have padding bits.

Approved by:    markj (mentor)
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D53831
DeltaFile
+101-0lib/libc/tests/gen/limits_test.c
+1-0lib/libc/tests/gen/Makefile
+102-02 files

FreeBSD/src 7326bc7sys/arm/include _limits.h, sys/arm64/include _limits.h

sys/limits.h: add C23 _WIDTH macros

For compliance with IOS/IEC 9899:2024 ("C23").

These macros define the width in bits of the basic integer types.
Another new macro, BITINT_MAXWIDTH, is not yet included as I do not
understand what it should be set to.  Perhaps it is compiler-specific.

Approved by:    markj (mentor)
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D53825
DeltaFile
+20-0sys/sys/limits.h
+3-0sys/arm/include/_limits.h
+3-0sys/arm64/include/_limits.h
+3-0sys/powerpc/include/_limits.h
+3-0sys/riscv/include/_limits.h
+3-0sys/x86/include/_limits.h
+35-06 files

FreeBSD/src 8666fdasys/dev/aq aq_ring.c

aq(4): Fix VLAN tag test

Previously emitted a compiler warning "warning: bitwise comparison
always evaluates to false."

Looking at the OpenBSD driver (which is based on this code) it looks
like the VLAN flag should be set if either of these bits is.  In the
OpenBSD driver these are AQ_RXDESC_TYPE_VLAN and AQ_RXDESC_TYPE_VLAN2
rather than a magic number 0x60.

Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53836
DeltaFile
+1-1sys/dev/aq/aq_ring.c
+1-11 files

FreeBSD/src 0156be4sys/dev/aq aq_main.c

aq(4): Remove unimplemented functions

aq_if_priv_ioctl and aq_if_debug have prototypes but are not yet
implemented.  Just remove the commented-out DEVMETHODs and the unused
prototypes, to clear a build-time warning; the DEVMETHODs and prototypes
can be readded if / when they are implemented.
DeltaFile
+0-4sys/dev/aq/aq_main.c
+0-41 files

FreeBSD/src 14eb7ecsys/dev/aq aq_hw.c

aq(4): Remove #include of user header <unistd.h>

pause() has 2 different definition in unistd.h and sys/systm.h
DeltaFile
+0-1sys/dev/aq/aq_hw.c
+0-11 files

FreeBSD/src 2b587c0sys/dev/aq aq_main.c

aq(4): Remove unused DRIVER_MODULE devclass
DeltaFile
+4-0sys/dev/aq/aq_main.c
+4-01 files

FreeBSD/src 4756f5fsys/dev/aq aq_main.c aq_media.c

aq(4): Port to IfAPI

Direct access to struct ifnet members is not possible in FreeBSD 15;
accessors must be used.  These exist in all supported FreeBSD versions,
so we do not need to make this conditional.
DeltaFile
+8-8sys/dev/aq/aq_main.c
+6-6sys/dev/aq/aq_media.c
+2-2sys/dev/aq/aq_ring.c
+16-163 files

FreeBSD/src 493d26csys/dev/aq aq_hw_llh_internal.h aq_hw_llh.c

sys: Import snapshot of Aquantia ACQ107 vendor driver

Obtained from https://github.com/Aquantia/aqtion-freebsd commit
c61d27b1d94af72c642deefa0595884481ea7377.

This is not using a vendor branch.  The formerly-upstream repo is
abandoned and I do not believe it will receive updates.  This initial
import serves as a snapshot of the vendor code, but from here we will
iterate on it in the tree as our own code.

Bug fixes, code cleanup, and build infrastructure will follow.

NetBSD and OpenBSD have derivatives of this driver (with additional
hardware support).  We can look to changes in those drivers, and the
Linux driver, to add support here.

Reviewed by:    adrian
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D53813
DeltaFile
+3,335-0sys/dev/aq/aq_hw_llh_internal.h
+1,986-0sys/dev/aq/aq_hw_llh.c
+1,329-0sys/dev/aq/aq_main.c
+1,176-0sys/dev/aq/aq_hw_llh.h
+907-0sys/dev/aq/aq_hw.c
+581-0sys/dev/aq/aq_ring.c
+9,314-012 files not shown
+12,109-018 files

FreeBSD/src 029a09fsys/sys _types.h

sys/_types.h: Actually unbreak gcc build

Fixes:          19728f31ae42 ("sys/_types.h: Unbreak gcc build")
Reviewed by:    emaste
Differential Revision:  https://reviews.freebsd.org/D53986
DeltaFile
+4-1sys/sys/_types.h
+4-11 files

FreeBSD/src 7d8effcsys/netpfil/pf pf.c, tests/sys/netpfil/pf divert-to.sh

pf: handle divert packets

In a divert setup pf_test_state() may return PF_PASS, but not set the state
pointer. We didn't handle that, and as a result crashed immediately afterwards
trying to dereference that NULL state pointer.

Add a test case to provoke the problem.

PR:             260867
MFC after:      2 weeks
Submitted by:   Phil Budne <phil.budne at gmail.com>
Sponsored by:   Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 66f2f1c83247f05a3a599d7e88c7e7efbedd16b5)
DeltaFile
+43-0tests/sys/netpfil/pf/divert-to.sh
+12-8sys/netpfil/pf/pf.c
+55-82 files

FreeBSD/src a009793sys/netpfil/pf pf.c, tests/sys/netpfil/pf divert-to.sh

pf: handle divert packets

In a divert setup pf_test_state() may return PF_PASS, but not set the state
pointer. We didn't handle that, and as a result crashed immediately afterwards
trying to dereference that NULL state pointer.

Add a test case to provoke the problem.

PR:             260867
MFC after:      2 weeks
Submitted by:   Phil Budne <phil.budne at gmail.com>
Sponsored by:   Rubicon Communications, LLC ("Netgate")

(cherry picked from commit 66f2f1c83247f05a3a599d7e88c7e7efbedd16b5)
DeltaFile
+42-2tests/sys/netpfil/pf/divert-to.sh
+12-8sys/netpfil/pf/pf.c
+54-102 files

FreeBSD/src f56c684lib/libc/riscv/string strchrnul.S Makefile.inc

libc: scalar strchrnul() in RISC-V assembly

Scalar implementation of strchrnul() in RISC-V assembly and changes to the
corresponding manpage.

Performance was benchmarked on a HiFive Unmatched (SiFive HF105-001) board
using: https://github.com/clausecker/strperf

os: FreeBSD
arch: riscv
        │ strchrnul_baseline │          strchrnul_scalar           │
        │       sec/op       │   sec/op     vs base                │
Short            680.2µ ± 5%   435.3µ ± 0%  -36.01% (p=0.000 n=20)
Mid              314.7µ ± 3%   221.4µ ± 0%  -29.63% (p=0.000 n=20)
Long             152.3µ ± 0%   138.5µ ± 0%   -9.08% (p=0.000 n=20)
geomean          319.5µ        237.2µ       -25.75%

        │ strchrnul_baseline │          strchrnul_scalar          │
        │       MiB/s        │   MiB/s     vs base                │

    [13 lines not shown]
DeltaFile
+116-0lib/libc/riscv/string/strchrnul.S
+1-0lib/libc/riscv/string/Makefile.inc
+117-02 files

FreeBSD/src b06836fshare/man/man7 simd.7

simd.7: add scalar strnlen() for RISC-V to manpage

MFC after:      1 month
MFC to:         stable/15
Approved by:    mhorne, markj (mentor)
Reviewed by:    fuz, Jari Sihvola <jsihv at gmx.com>
Sponsored by:   Google LLC (GSoC 2024)
Differential Revision:  https://reviews.freebsd.org/D46230

(cherry picked from commit 474a80d3ff8516df5c379fa7f8e563cecb032060)
DeltaFile
+1-1share/man/man7/simd.7
+1-11 files

FreeBSD/src bb2cbe8share/man/man7 simd.7

simd.7: add scalar memcpy() for RISC-V to manpage

MFC after:      1 month
MFC to:         stable/15
Approved by:    mhorne, markj (mentor)
Reviewed by:    fuz
Sponsored by:   Google LLC (GSoC 2024)
Differential Revision:  https://reviews.freebsd.org/D46139

(cherry picked from commit c80dfcb37261e5e8575d41801e64a39b7db6f4f8)
DeltaFile
+2-2share/man/man7/simd.7
+2-21 files

FreeBSD/src 3f0dda7lib/libc/riscv/string strnlen.S Makefile.inc

libc: scalar strnlen() in RISC-V assembly

Optimized implementation of strnlen() in RISC-V assembly

Performance was measured using strperf on a HiFive Unmatched (SiFive HF105-001) board.

os: FreeBSD
arch: riscv
        │ strnlen_baseline │           strnlen_scalar            │
        │      sec/op      │   sec/op     vs base                │
Short          787.0µ ± 0%   430.9µ ± 1%  -45.24% (p=0.000 n=20)
Mid            621.6µ ± 0%   195.1µ ± 1%  -68.61% (p=0.000 n=20)
Long           569.4µ ± 1%   100.6µ ± 0%  -82.34% (p=0.000 n=20)
geomean        653.1µ        203.7µ       -68.81%

        │ strnlen_baseline │            strnlen_scalar            │
        │      MiB/s       │    MiB/s     vs base                 │
Short           158.8 ± 0%    290.1 ± 1%   +82.62% (p=0.000 n=20)
Mid             201.1 ± 0%    640.6 ± 1%  +218.59% (p=0.000 n=20)

    [11 lines not shown]
DeltaFile
+143-0lib/libc/riscv/string/strnlen.S
+1-0lib/libc/riscv/string/Makefile.inc
+144-02 files

FreeBSD/src 1369056tools/build depend-cleanup.sh

depend-cleanup.sh: clean up after riscv64 enhanced string function patch set

This ensures an incremental build succeeds after import of
D47275, D46023, D45730, D45693, D46139, D46230, D46047, and D53248.

Approved by:    markj (mentor)
MFC after:      1 month
MFC to:         stable/15
Differential Revision:  https://reviews.freebsd.org/D53485

(cherry picked from commit d59e924d2969ce2c8bec0fc4500989865fbece75)
DeltaFile
+27-0tools/build/depend-cleanup.sh
+27-01 files

FreeBSD/src 65f6088share/man/man7 simd.7

simd.7: document bcopy() and bzero() as accelerated on riscv64

Event:          Google Summer of Code 2024
MFC after:      1 month
MFC to:         stable/15
Approved by:    markj (mentor)
Differential Revision:  https://reviews.freebsd.org/D53248

(cherry picked from commit d6870bb941fe235e0031f8bfb53fbd120ff859f9)
DeltaFile
+2-2share/man/man7/simd.7
+2-21 files

FreeBSD/src 4e63278share/man/man7 simd.7

simd.7: add scalar strchrnul() for RISC-V to manpage

index() and strchr() are implemented by calling strchrnul(), so they
also get to be marked as platform-specific.

MFC after:      1 month
MFC to:         stable/15
Approved by:    markj (mentor)
Reviewed by:    fuz
Sponsored by:   Google LLC (GSoC 2024)
Differential Revision:  https://reviews.freebsd.org/D46047

(cherry picked from commit 39fef5b9fa943f301776e0b0bf406cedd7c29af2)
DeltaFile
+4-4share/man/man7/simd.7
+4-41 files

FreeBSD/src be97631lib/libc/riscv/string bcopy.c bzero.c

libc/riscv64: implement bcopy() and bzero() through memcpy() and memset()

This picks up the accelerated string functions written by
strajabot@.

Event:          Google Summer of Code 2024
MFC after:      1 month
MFC to:         stable/15
See also:       79e01e7e643c9337d8d6046b6db7df674475a099
Approved by:    markj (mentor)
Differential Revision:  https://reviews.freebsd.org/D53248

(cherry picked from commit b5dbf3de561189140c73f915bd50c28ea69a1e19)
DeltaFile
+14-0lib/libc/riscv/string/bcopy.c
+14-0lib/libc/riscv/string/bzero.c
+2-0lib/libc/riscv/string/Makefile.inc
+30-03 files

FreeBSD/src 650ac47lib/libc/riscv/string strlen.S Makefile.inc

libc: scalar strlen() in RISC-V assembly

Includes a scalar implementation of strlen() for the RISC-V
architecture and changes to the corresponding manpage.

Performance was benchamarked using before and after:
https://github.com/clausecker/strperf

os: FreeBSD
arch: riscv
        │ strlen_baseline │             strlen_scalar              │
        │     sec/op      │   sec/op     vs base                   │
Short        541.2µ ± 17%   401.6µ ± 0%  -25.78% (p=0.000 n=21+20)
Mid          249.6µ ±  3%   191.9µ ± 0%  -23.13% (p=0.000 n=21+20)
Long         124.6µ ±  0%   110.7µ ± 0%  -11.13% (p=0.000 n=21+20)
geomean      256.3µ         204.3µ       -20.26%

        │ strlen_baseline │              strlen_scalar               │
        │       B/s       │      B/s       vs base                   │

    [13 lines not shown]
DeltaFile
+77-0lib/libc/riscv/string/strlen.S
+1-0lib/libc/riscv/string/Makefile.inc
+78-02 files