FreeBSD/src 41a46c2sys/dev/e1000 em_txrx.c igb_txrx.c

e1000: fix rx accounting for multi-descriptor packets

The receive paths accumulate ri->iri_len across the descriptors making
up a packet, then add that running total to rxr->rx_bytes on every
iteration of the loop.  A packet spanning descriptors of length l1, l2
and l3 thus contributes 3*l1 + 2*l2 + l3 instead of l1 + l2 + l3.

Single descriptor packets, the common case, are accounted correctly,
so this only shows up on jumbo frames.

Add the per descriptor length instead.  iflib memsets the if_rxd_info
before each isc_rxd_pkt_get() call, so summing len gives the same total
as the final iri_len, and the frame error path that returns without
incrementing rx_packets keeps counting bytes exactly as before.

MFC after:      1 week
DeltaFile
+2-2sys/dev/e1000/em_txrx.c
+1-1sys/dev/e1000/igb_txrx.c
+3-32 files

FreeBSD/src 941113asys/dev/e1000 if_em.c

e1000: fix 82574 MSI-X interrupt throttling

em_newitr() and the per-queue interrupt_rate sysctl both tested
que->msix to decide whether an 82574 is running in MSI-X mode.  0 is a
valid MSI-X vector so queue 0 was misclassified as legacy/MSI.

Test sc->intr_type == IFLIB_INTR_MSIX instead.  While here, index the tx
EITR read by tque->msix rather than tque->me so it matches the register
em_newitr() actually writes; the two differ once tx_num_queues exceeds
rx_num_queues.

Also seed que->itr_setting in em_initialize_receive_unit() with the rate
the hardware was just programmed with.  Otherwise an itr_setting left
over from AIM across an interface re-init makes the change detection in
em_newitr() suppress the write that would restore it, leaving the
hardware at the default rate while software believes otherwise.

Fixes:          3e501ef89667 ("e1000: Re-add AIM")
MFC after:      3 days
DeltaFile
+20-4sys/dev/e1000/if_em.c
+20-41 files

FreeBSD/src 0bd6a16sys/dev/e1000 if_em.c if_em.h

e1000: Defer link-up notification until after TSO reset

em_automask_tso() changes the enabled TSO capabilities when the link
moves between 10/100 and 1000 Mb/s.  A running interface must be
reinitialized to apply the new capability set.  Do not publish
LINK_STATE_UP until the requested iflib reset has completed.

Replace link_active with an explicit state machine that distinguishes
the physical link, its publication to iflib, and an outstanding reset
barrier.  Preserve that barrier across a link flap with
DOWN_RESET_PENDING, and only publish DOWN if UP was previously
published.

Only request a reset for a running interface or for an initialization
while the interface is administratively up.  In other states the next
initialization will apply the capability changes, avoiding a reset
request that iflib's admin task could discard.

Reviewed by:    Faraz Vahedi <kfv at kfv.io>

    [2 lines not shown]
DeltaFile
+61-18sys/dev/e1000/if_em.c
+9-1sys/dev/e1000/if_em.h
+70-192 files

FreeBSD/src 9af47fcusr.bin/tail tail.c

tail: Allow repetitive or contraditory options

Unlike its GNU counterpart, our tail(1) has always errored out if given
repetitive or contradictory options, even prior to Keith Bostic's 1991
reimplementation.  There is no good reason to continue to do so, not
even tradition, since many other commands (including head(1)) simply
apply the rightmost option in cases like this.

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

(cherry picked from commit 9fc14dbe4897c4541113b9ba98236fbd7eb75380)
DeltaFile
+0-2usr.bin/tail/tail.c
+0-21 files

FreeBSD/src 3ab5936contrib/tzcode zic.c localtime.c

tzcode: Update to 2026c

MFC after:      1 week

(cherry picked from commit 28f617de7d9b9c708eacb3c2c13e5287e1b7354d)
DeltaFile
+181-170contrib/tzcode/zic.c
+44-34contrib/tzcode/localtime.c
+70-7contrib/tzcode/NEWS
+10-56contrib/tzcode/zdump.c
+23-27contrib/tzcode/tz-link.html
+17-28contrib/tzcode/Makefile
+345-3229 files not shown
+414-37915 files

FreeBSD/src 8c2e1decontrib/tzcode zic.c localtime.c

tzcode: Update to 2026c

MFC after:      1 week

(cherry picked from commit 28f617de7d9b9c708eacb3c2c13e5287e1b7354d)
DeltaFile
+181-170contrib/tzcode/zic.c
+44-34contrib/tzcode/localtime.c
+70-7contrib/tzcode/NEWS
+10-56contrib/tzcode/zdump.c
+23-27contrib/tzcode/tz-link.html
+17-28contrib/tzcode/Makefile
+345-3229 files not shown
+414-37915 files

FreeBSD/src 58e2ad5usr.bin/tail tail.c

tail: Allow repetitive or contraditory options

Unlike its GNU counterpart, our tail(1) has always errored out if given
repetitive or contradictory options, even prior to Keith Bostic's 1991
reimplementation.  There is no good reason to continue to do so, not
even tradition, since many other commands (including head(1)) simply
apply the rightmost option in cases like this.

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

(cherry picked from commit 9fc14dbe4897c4541113b9ba98236fbd7eb75380)
DeltaFile
+0-2usr.bin/tail/tail.c
+0-21 files

FreeBSD/src bc81728lib/libc/tests/stdlib/libatexit libatexit.cc

[test] libatexit: leverage __{BEGIN,END}_DECLS

This change converts the longhand form of `extern "C" {` and its
corresponding `}` into `__BEGIN_DECLS` and `__END_DECLS`, respectively.

The new form is much easier to grep for and is a best practice to use in
the FreeBSD tree.

This is meant to be a non-functional change.

MFC after:      1 week
DeltaFile
+7-4lib/libc/tests/stdlib/libatexit/libatexit.cc
+7-41 files

FreeBSD/src 64038dblib/libc/tests/stdlib/libatexit libatexit.cc

libc: tests: add static to resolve -Wmissing-prototypes

The function create_staticobj() is only used inside this translation unit.
Clang produces a -Wmissing-prototypes warning during standard buildworld.
This warning will become a fatal compile error if MK_WERROR is enabled for hardened builds.

PR: 285870
Fixes: ee9ce1078 ("libc: tests: add some tests for __cxa_atexit...")
Signed-off-by: Zhang Qiyue <peter-open-source.probing805 at aleeas.com>
Reviewed-by: ngie
Pull-Request: https://github.com/freebsd/freebsd-src/pull/2321
DeltaFile
+1-1lib/libc/tests/stdlib/libatexit/libatexit.cc
+1-11 files

FreeBSD/src 5f346dblib/libusb libusb.h

libusb: Sync interface for libusb_init_option

Sponsored by:   The FreeBSD Foundation
DeltaFile
+5-3lib/libusb/libusb.h
+5-31 files

FreeBSD/src 340c6aflib/libusb libusb.h

libusb: Add LIBUSB_DT_SUPERSPEED_HUB

Sponsored by:   The FreeBSD Foundation
DeltaFile
+1-0lib/libusb/libusb.h
+1-01 files

FreeBSD/src 3ebb70fstand/common gfx_fb.c

stand: Fix build failure due to old EDK2 interface

In 43b8edb320519, we change EFI_GRAPHICS_OUTPUT_PROTOCOL from
EFI_GRAPHICS_OUTPUT. However, this patch is not MFC to stable/15. As a
result, we need to use the old interface to prevent compile failure.

Fixes: 1802f2ca7215
Sponsored by:   The FreeBSD Foundation
DeltaFile
+1-1stand/common/gfx_fb.c
+1-11 files

FreeBSD/src b78f880sys/x86/include specialreg.h

x86/specialreg: Add MSR_AMD_CPUID01 MSR

Reviewed by:    markj
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision:  https://reviews.freebsd.org/D56311
DeltaFile
+1-0sys/x86/include/specialreg.h
+1-01 files

FreeBSD/src 8f7ea6bsys/x86/cpufreq hwpstate_intel.c

hwpstate_intel: Minimize ifdef for i386 build

Reported by:    jrtc27
Fixes:  bdc0f7678257
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 02c440e204041e92da403a64b70c2e1fdf3a4f73)
DeltaFile
+0-4sys/x86/cpufreq/hwpstate_intel.c
+0-41 files

FreeBSD/src 493676dsys/x86/include kvm.h

kvm: Support non-default CPUID leaf

KVM does not always use 0x40000000 as its CPUID base. For example, QEMU
adds a 0x100 offset when nested virtualization is detected and the host
exposes Hyper-V enlightenment hints. To accommodate this behavior,
switch the detection logic to use the CPUID leaf returned by do_cpuid(),
making the implementation more flexible.

See:
https://github.com/qemu/qemu/blob/master/target/i386/kvm/kvm.c#L2300

Reviewed by:    kib
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58146

(cherry picked from commit 86691d52a6d3796ad36ba474cf0a9493f6d99202)
DeltaFile
+3-4sys/x86/include/kvm.h
+3-41 files

FreeBSD/src 1802f2cstand/common gfx_fb.c gfx_fb.h, stand/ficl gfx_loader.c

stand: Bulk operations on each gfxfb_blt if shadow buffer enabled

Previously, gfxfb_blt flushed the framebuffer on every call. Since a
single drawing operation may invoke gfxfb_blt multiple times, this can
result in unnecessary flushes.

Instead, write updates to the shadow buffer (when present) and mark the
affected area as dirty. Flushing is deferred so multiple gfxfb_blt calls
can be coalesced into a single update. As before, only the dirty region
is flushed.

This fixes the slow bootloader problem in some platforms.

Reviewed by:    imp, adrian, obiwac
Tested by:      obiwac, jrm
MFC after:      2 weeks
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D57373

(cherry picked from commit 32da2f23ae4d18888d34682b0ddb49ec80c0bb26)
DeltaFile
+203-22stand/common/gfx_fb.c
+7-0stand/common/gfx_fb.h
+4-3stand/ficl/gfx_loader.c
+2-1stand/liblua/gfx_utils.c
+216-264 files

FreeBSD/src 592bf24sys/x86/cpufreq hwpstate_intel.c

hwpstate_intel: Fix i386 build

Reviewed by:    olce
Fixes:  7b26353a59d6
MFC after:      3 days
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D58208

(cherry picked from commit bdc0f7678257eaa739b9c816285504470e71e3de)
DeltaFile
+8-0sys/x86/cpufreq/hwpstate_intel.c
+8-01 files

FreeBSD/src 4a1a1bfstand/common gfx_fb.c

stand: Fix shadow buffer offset handling

The shadow buffer is addressed relative to `tg_origin`, which includes
the padding offset, whereas `gfxfb_blt` operates on coordinates without
that offset. To make `gfx_fb_copy_area` emulate the behavior of
`gfxfb_blt`, the source coordinates must include the padding offset,
while the destination coordinates must not. The original implementation
omitted the offset from the source coordinates; this change corrects
that.

Additionally, `gfx_fb_cons_display` already applies the padding offset,
so the redundant adjustment is removed.

PR:             296246
Reported by:    2khramtsov at gmail.com
Reviewed by:    imp
Tested by:      2khramtsov at gmail.com, junchoon at dec.sakura.ne.jp,
naito.yuichiro_ at gmail.com
Fixes:          32da2f23ae4d

    [5 lines not shown]
DeltaFile
+15-11stand/common/gfx_fb.c
+15-111 files

FreeBSD/src 73a7f5apackages/bhyve Makefile

packages: make bhyve depend on acpi

bhyve(8) on amd64 needs iasl(8) to run, otherwise it fails with:

  /bin/sh: /usr/sbin/iasl: not found
  bhyve: BASL failed @ build_dsdt:484
      Failed to execute basl_compile(ctx, basl_fwrite_dsdt): Unknown
  error: 32512
  bhyve: BASL failed @ acpi_build:899
      Failed to execute build_dsdt(ctx): Unknown error: 32512
  Assertion failed: (error == 0), function bhyve_init_platform_late, file
  /home/pkgbuild/worktrees/main/usr.sbin/bhyve/amd64/bhyverun_machdep.c,
  line 394.

Register the "acpi" package which provides iasl(8) as a dependency for
bhyve on amd64.

Reviewed by:            markj (previous revision), ivy
Differential Revision:  https://reviews.freebsd.org/D56498

    [3 lines not shown]
DeltaFile
+5-0packages/bhyve/Makefile
+5-01 files

FreeBSD/src b5a144b. README.md

README.md: Add packages/ directory

Fixes:  bb75b0d581f7 ("packages: Convert world to a subdir build")
MFC after:      2 weeks
Reviewed by:    des, emaste
Differential Revision:  https://reviews.freebsd.org/D56839

(cherry picked from commit e3e5b86e3b9e00f1fe89e54d13dcd665e63eb4c6)
DeltaFile
+1-0README.md
+1-01 files

FreeBSD/src 477500epackages Makefile

packages: Fix building packages when WITHOUT_BLOCKLIST is set

Reviewed by:    emaste
MFC after:      1 week
Sponsored by:   Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D57601

(cherry picked from commit cd0a101b01d685092d073a367f0e7374f7259256)
DeltaFile
+2-1packages/Makefile
+2-11 files

FreeBSD/src a0871fcpackages/sound Makefile

packages/sound: Add dependency on bsdconfig

Since the devd rules use sysrc, bsdconfig should be installed.

MFC after:      3 days

(cherry picked from commit 82aca8ef0dd73a09e46271158f822a7e49082cd0)
DeltaFile
+3-0packages/sound/Makefile
+3-01 files

FreeBSD/src f8b81bf. Makefile.inc1

Makefile.inc1: Only copy locales to INSTALLTMP on FreeBSD

Makefile.inc1 copies locales to ${INSTALLTMP} to avoid issues when
running make installworld on a live system.  However, this can break
on non-FreeBSD systems, e.g. on openSUSE where /usr/share/locales
has mode 0555, which means after we copy it, we can't delete it,
so the build fails.

Since this functionality is only useful when installing over a
live system, disable it when the build host is not FreeBSD.

MFC after:      2 weeks
Reviewed by:    kevans, emaste
Sponsored by:   https://www.patreon.com/bsdivy
Differential Revision:  https://reviews.freebsd.org/D56677

(cherry picked from commit 4429630d1ca9d90c886bae1eaa0d8ee32d0fee12)
DeltaFile
+9-2Makefile.inc1
+9-21 files

FreeBSD/src a020a88lib/clang Makefile.inc lldb.pre.mk, lib/clang/liblldb Makefile

llvm: Move libprivatelldb to the lldb package

Set PACKAGE=lldb in lldb.pre.mk rather than in individual Makefiles;
change lib/clang/Makefile.inc from PACKAGE=clang to PACKAGE?=clang to
avoid overwriting it.

This is safe to MFC to stable/15 since the moved library will be
picked up automatically by pkg.

MFC after:      2 weeks
Reviewed by:    emaste
Sponsored by:   https://www.patreon.com/bsdivy
Differential Revision:  https://reviews.freebsd.org/D56674

(cherry picked from commit 7970815be40b1fa604a6554f5ee0f95f834454b5)
DeltaFile
+1-1lib/clang/Makefile.inc
+2-0lib/clang/lldb.pre.mk
+0-1usr.bin/clang/lldb/Makefile
+0-1usr.bin/clang/lldb-server/Makefile
+0-1lib/clang/liblldb/Makefile
+3-45 files

FreeBSD/src 1d0ae66packages Makefile, packages/kyua kyua.ucl

packages: Convert world to a subdir build

Instead of driving the world package build from Makefile.inc1,
use a subdir build where each package has a subdirectory under
packages/ using the new <bsd.pkg.mk>.

Convert some metadata that was previously in the UCL files (e.g.
sets and dependencies) to Makefile variables.

Build the packages under objdir (not repodir), and use the new
stagepackages target to copy them to repodir when creating the
repository.

Determine an explicit list of packages to build in packages/Makefile
based on enabled src.conf options, and add logic to abort the build
if we attempt to build an empty package.  This inverts the previous
logic in Makefile.inc1 which would simply skip empty packages.

There are a few advantages to doing it this way:

    [26 lines not shown]
DeltaFile
+218-0share/mk/bsd.pkg.mk
+164-0packages/Makefile
+92-0share/mk/bsd.pkg.pre.mk
+0-58release/packages/ucl/kyua-all.ucl
+54-0packages/kyua/kyua.ucl
+0-52release/packages/ucl/dma-all.ucl
+528-110440 files not shown
+5,435-4,938446 files

FreeBSD/src f948e6brelease/packages create-sets.sh

packages: Make create-sets.sh more robust during release

Commit d1c176fedfc9 made create-sets.sh exit when it encounters an
error, instead of creating an empty repository.  However, this turns
out to cause some issues:

1. A package not having any sets is considered an error, but during
   the release build, we stuff a 'pkg' package into the repository
   which doesn't have any sets, which causes a failure.  Avoid this
   by simply ignoring the pkg package.

2. No error was printed in this case, which made the problem hard
   to diagnose.  Add an explicit error message.

3. A similar problem occurred running on a repository which already
   contained sets, which is not usually done during the build, but
   is not necessarly an inappropriate thing to do.  Fix this one by
   ignoring set packages when looking for sets.


    [13 lines not shown]
DeltaFile
+48-4release/packages/create-sets.sh
+48-41 files

FreeBSD/src 9b6e6b2packages Makefile

packages: Fix clang conditional

Various src.conf options can cause us to build something that ends up
in the clang package, but MK_TOOLCHAIN is not one of them; copy the
proper conditional from lib/Makefile to decide if we need to build
the package.

This fixes the build when LLVM/clang is entirely disabled.

Fixes:  bb75b0d581f7 ("packages: Convert world to a subdir build")
MFC after:      2 weeks
Reviewed by:    emaste
Sponsored by:   https://www.patreon.com/bsdivy
Differential Revision:  https://reviews.freebsd.org/D56657

(cherry picked from commit e6d112bbbbf0b09f0f18a85a0a3c6d5a49aff653)
DeltaFile
+2-1packages/Makefile
+2-11 files

FreeBSD/src 58c0851libexec/rc/rc.d Makefile, packages Makefile.arm Makefile.powerpc

acpi: Remove userland bits on non-ACPI platforms

ACPI is only supported on amd64, arm64 and i386.  Don't install the
power_profile rc script or devd configuration on other platforms.

This avoids creating a useless FreeBSD-acpi package on those platforms.

MFC after:      2 weeks
Reviewed by:    imp
Sponsored by:   https://www.patreon.com/bsdivy
Differential Revision:  https://reviews.freebsd.org/D56650

(cherry picked from commit c4b244af42a1f20937939a824b753a92c9c0a46f)
DeltaFile
+0-17packages/Makefile.arm
+0-17packages/Makefile.powerpc
+0-6packages/acpi/Makefile
+4-0tools/build/mk/OptionalObsoleteFiles.inc
+3-0libexec/rc/rc.d/Makefile
+3-0sbin/devd/Makefile
+10-401 files not shown
+10-417 files

FreeBSD/src b04fa0flibexec/rc/rc.d Makefile, packages Makefile.i386 Makefile.arm

apm: Only install rc script on i386

The apm(8) rc script only works on i386, but it's installed on all
platforms.  Only install it on i386, which avoids creating a useless
FreeBSD-apm package on other platforms.

While here, build the acpi package on i386.

Relnotes:       yes
MFC after:      2 weeks
Reviewed by:    imp
Sponsored by:   https://www.patreon.com/bsdivy
Differential Revision:  https://reviews.freebsd.org/D56629

(cherry picked from commit b7daab8be1d4555f23a297e60e4128c01caabf82)
DeltaFile
+18-0packages/Makefile.i386
+3-3libexec/rc/rc.d/Makefile
+0-6packages/apm/Makefile
+3-0tools/build/mk/OptionalObsoleteFiles.inc
+0-1packages/Makefile.arm
+0-1packages/Makefile.arm64
+24-112 files not shown
+24-138 files

FreeBSD/src d2ce6ed. Makefile.inc1

Makefile.inc1: Always use ${PKG_CMD}

Previously we had a mix of ${PKG_CMD} and bare 'pkg', which is
wrong, and breaks the build when 'pkg' isn't in the tools path,
e.g. when cross-building.

MFC after:      2 weeks
Reviewed by:    wosch, emaste
Sponsored by:   https://www.patreon.com/bsdivy
Differential Revision:  https://reviews.freebsd.org/D56655

(cherry picked from commit b866d05ea2860f9ccc27c75ff0501372896b5bf2)
DeltaFile
+4-4Makefile.inc1
+4-41 files