FreeBSD/src 7c450d1sys/dev/bnxt/bnxt_en bnxt_sriov.c if_bnxt.c

bnxt_en: Address review comments for core SR-IOV support

This patch addresses the code review comments provided for:
https://reviews.freebsd.org/D56197

* P7 VF PCI ID: rename NETXTREME_E_P7_VF to E_P7_VF (P7/Thor2 line drops the
  Netxtreme name in product strings; other VF device IDs are unchanged).
* Use the return value of bnxt_vf_parse_schema() in bnxt_iov_vf_add() to
  decide when to call bnxt_set_vf_admin_mac(); make parse_schema() return
  bool and remove the has_admin_mac field.
* In bnxt_free_vf_resources(), fix indentation after dma_free_coherent() so
  the NULL assignment is clearly separate from the call.
* In bnxt_hwrm_func_vf_resource_free(), use first_vf_id/last_vf_id in the
  HWRM_FUNC_VF_RESC_FREE loop.

MFC after:      1 month
Reviewed by:    ssaxena
Differential Revision: https://reviews.freebsd.org/D56644
DeltaFile
+16-15sys/dev/bnxt/bnxt_en/bnxt_sriov.c
+2-2sys/dev/bnxt/bnxt_en/if_bnxt.c
+1-1sys/dev/bnxt/bnxt_en/bnxt.h
+0-1sys/dev/bnxt/bnxt_en/bnxt_sriov.h
+19-194 files

FreeBSD/src c972c5asys/dev/bnxt/bnxt_en bnxt_hwrm.c if_bnxt.c

bnxt_en: VF ring reservation, HWRM registration, and PF-only operation guards

VFs require separate HWRM commands for ring reservation and async
completion ring setup, so a common PF/VF dispatcher is introduced and
the async CR path is extended to handle both.  The PF must populate the
VF request forwarding bitmap during driver registration so the firmware
correctly forwards VF-originated HWRM commands.  VF reservation strategy
and min-guaranteed capability flags are now parsed for correct resource
partitioning, and PF-only operations (DCB, NVM, package version sysctl)
are guarded against VF invocation.

The short command buffer allocation is also reordered before the function
reset to ensure extended HWRM messages are available when needed, a
prerequisite uncovered during VF bring-up.

MFC after:      1 month
Reviewed by:    ssaxena
Differential Revision: https://reviews.freebsd.org/D56232
DeltaFile
+93-12sys/dev/bnxt/bnxt_en/bnxt_hwrm.c
+18-5sys/dev/bnxt/bnxt_en/if_bnxt.c
+5-4sys/dev/bnxt/bnxt_en/bnxt_sysctl.c
+3-0sys/dev/bnxt/bnxt_en/bnxt_dcb.c
+1-0sys/dev/bnxt/bnxt_en/bnxt_hwrm.h
+1-0sys/dev/bnxt/bnxt_en/bnxt.h
+121-216 files

FreeBSD/src 8743209sys/dev/bnxt/bnxt_en bnxt_sriov.c if_bnxt.c

bnxt_en: Re-enable SR-IOV after firmware reset

When the firmware undergoes a hot-reset and the driver re-opens the
device, previously active Virtual Functions lose their resource
configuration.  bnxt_reenable_sriov() restores that configuration by
replaying bnxt_cfg_hw_sriov() with the saved resource parameters.

The function is called from bnxt_fw_reset_task() in the
BNXT_FW_RESET_STATE_OPENING state, guarded by #ifdef PCI_IOV.
Because bnxt_cfg_hw_sriov() is a no-op when active_vfs is zero the
call is safe on any PF regardless of whether VFs were ever created.

MFC after:      1 month
Reviewed by:    ssaxena
Differential Revision: https://reviews.freebsd.org/D56201
DeltaFile
+10-0sys/dev/bnxt/bnxt_en/bnxt_sriov.c
+3-0sys/dev/bnxt/bnxt_en/if_bnxt.c
+13-02 files

FreeBSD/src ea4ab7esys/dev/bnxt/bnxt_en bnxt_sriov.c if_bnxt.c

bnxt_en: Add per-VF trust, spoof-check and promiscuous controls

Expose per-VF policy knobs via the FreeBSD sysctl tree and enforce
them at the data-path level.

Trust (dev.bnxt.<unit>.vfN.trusted):
  bnxt_set_vf_trust() sets/clears BNXT_VF_TRUST and sends
  HWRM_FUNC_CFG with FLAGS_TRUSTED_VF_ENABLE/DISABLE.
  bnxt_create_trusted_vf_sysctls() / bnxt_destroy_trusted_vf_sysctls()
  manage the sysctl lifetime with VF creation/teardown.

Spoof-check (dev.bnxt.<unit>.vfN.spoofchk):
  bnxt_set_vf_spoofchk() issues HWRM_FUNC_CFG with
  SRC_MAC_ADDR_CHECK_ENABLE/DISABLE.

Promiscuous gating:
  bnxt_is_trusted_vf() queries firmware via HWRM_FUNC_QCFG.
  bnxt_promisc_ok() returns false for untrusted VFs, preventing them
  from entering promiscuous mode.  bnxt_promisc_set() is updated to

    [9 lines not shown]
DeltaFile
+266-1sys/dev/bnxt/bnxt_en/bnxt_sriov.c
+4-2sys/dev/bnxt/bnxt_en/if_bnxt.c
+270-32 files

FreeBSD/src fcf100dsys/dev/bnxt/bnxt_en bnxt_sriov.c if_bnxt.c

bnxt_en: Add VF forwarded HWRM request handling

Enable the Physical Function to proxy HWRM commands issued by Virtual
Functions through the firmware forwarded-request mechanism.

When a VF issues a command that requires PF arbitration, the firmware
delivers a CMPL_BASE_TYPE_HWRM_FWD_REQ completion to the PF async ring.

* bnxt_process_async_msg() recognises CMPL_BASE_TYPE_HWRM_FWD_REQ,
  identifies the originating VF by its firmware function ID, sets the
  corresponding bit in pf.vf_event_bmap, and raises
  BNXT_HWRM_EXEC_FWD_REQ_SP_EVENT to schedule deferred processing.

* bnxt_sp_task() dispatches to bnxt_hwrm_exec_fwd_req(), which iterates
  over all pending VF bits and calls bnxt_vf_req_validate_snd() for each.

* bnxt_vf_req_validate_snd() inspects the encapsulated request type:
  HWRM_FUNC_VF_CFG (MAC change) is handled by bnxt_vf_configure_mac()
  which enforces trust/existing-MAC rules; HWRM_CFA_L2_FILTER_ALLOC is

    [8 lines not shown]
DeltaFile
+178-0sys/dev/bnxt/bnxt_en/bnxt_sriov.c
+22-0sys/dev/bnxt/bnxt_en/if_bnxt.c
+200-02 files

FreeBSD/src a5bedb4sys/dev/bnxt/bnxt_en if_bnxt.c bnxt_hwrm.c

bnxt_en: Add VF load path and PF/VF context differentiation

Teach the driver to distinguish a Physical Function from a Virtual
Function at probe time and configure each appropriately.

* Introduce bnxt_is_vf_device() to identify all known VF device IDs
  (NetXtreme-C/E Gen1-3, Thor1/2, Hyper-V variants).  Add corresponding
  PVID entries to bnxt_vendor_info_array.

* Refactor the iflib shared context: rename bnxt_sctx_init to
  bnxt_sctx_template, add a Thor2-specific bnxt_sctx_template_p7, and
  build per-call PF/VF instances via bnxt_init_sctx_variants(); the VF
  instance carries IFLIB_IS_VF.  bnxt_register() selects the correct sctx.

* bnxt_attach_pre(): replace the hard-coded NPAR/VF switch with
  bnxt_set_flags_by_devid(); on a VF call bnxt_approve_mac() to request
  PF approval for the firmware-assigned MAC address.

* bnxt_hwrm_func_qcaps(): populate fw_fid and MAC for PF and VF contexts

    [12 lines not shown]
DeltaFile
+153-42sys/dev/bnxt/bnxt_en/if_bnxt.c
+77-29sys/dev/bnxt/bnxt_en/bnxt_hwrm.c
+62-0sys/dev/bnxt/bnxt_en/bnxt_sriov.c
+1-0sys/dev/bnxt/bnxt_en/bnxt.h
+293-714 files

FreeBSD/src f2f831bsys/dev/bnxt/bnxt_en bnxt_sriov.c bnxt_sriov.h, sys/modules/bnxt/bnxt_en Makefile

bnxt_en: Add core SR-IOV infrastructure

Introduce the foundational building blocks for SR-IOV Virtual Function
support on Broadcom NetXtreme-C/E adapters.

* Add bnxt_sriov.h: defines the extended bnxt_vf_info structure (per-VF
  firmware FID, MAC addresses, VLAN, flags, DMA command buffers, resource
  counts), the bnxt_resc_map helper, flag macros (BNXT_VF_TRUST,
  BNXT_VF_SPOOFCHK, etc.), and prototypes for all SR-IOV functions.

* Add bnxt_sriov.c: implements the SR-IOV attachment sequence
  (bnxt_sriov_attach), the iflib IOV callbacks (bnxt_iov_init,
  bnxt_iov_uninit, bnxt_iov_vf_add), VF resource allocation and
  firmware configuration helpers (bnxt_alloc_vf_resources,
  bnxt_cfg_hw_sriov, bnxt_hwrm_func_vf_resc_cfg, bnxt_hwrm_func_buf_rgtr,
  bnxt_hwrm_func_vf_resource_free), and the per-VF parameter helper.

* Extend bnxt.h: include bnxt_sriov.h; extend bnxt_pf_info with VF-
  tracking fields (vf array, firmware FID/MAC, resource-reservation

    [15 lines not shown]
DeltaFile
+469-0sys/dev/bnxt/bnxt_en/bnxt_sriov.c
+116-0sys/dev/bnxt/bnxt_en/bnxt_sriov.h
+29-26sys/dev/bnxt/bnxt_en/bnxt.h
+17-2sys/dev/bnxt/bnxt_en/if_bnxt.c
+1-0sys/modules/bnxt/bnxt_en/Makefile
+632-285 files

FreeBSD/src 8d584f0sys/netgraph/bluetooth/drivers/ubt ng_ubt_rtl.c, usr.sbin/bluetooth/rtlbtfw rtlbtfw.conf main.c

bluetooth: remove redundant 0x0bda entries from ng_ubt_rtl, rtlbtfw

Generic Realtek vendor rules already match all 0x0bda Bluetooth devices.
Remove the redundant per-product entries from ng_ubt_rtl.c,
rtlbtfw main.c, and rtlbtfw.conf.

Reviewed by:    wulf
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D56137

(cherry picked from commit f3fc362c0fb27731e2c22523e0cedf1adec26c44)
DeltaFile
+0-68usr.sbin/bluetooth/rtlbtfw/rtlbtfw.conf
+6-18sys/netgraph/bluetooth/drivers/ubt/ng_ubt_rtl.c
+6-18usr.sbin/bluetooth/rtlbtfw/main.c
+12-1043 files

FreeBSD/src 54922e4usr.sbin/mixer/tests mixer_test.sh

mixer(8) tests: Remove tests for deprecated control values

Fixes:          a28bb575c89c ("mixer(8): Deprecate some unintuitive control values")
Sponsored by:   The FreeBSD Foundation
MFC after:      1 week
DeltaFile
+1-17usr.sbin/mixer/tests/mixer_test.sh
+1-171 files

FreeBSD/src e6d112bpackages 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
DeltaFile
+2-1packages/Makefile
+2-11 files

FreeBSD/src 036ff38cddl/lib/libzpool Makefile

libzpool: Set -Wno-error=typedef-redefinition for clang

In some versions of LLVM (at least 21), the <*intrin.h> headers contain
unguarded duplicate typedefs; this isn't permitted prior to C11, and
libzpool is built as C99.  FreeBSD's LLVM backported LLVM PR #153820
to fix this, but other versions of LLVM (e.g., upstream, or on Linux)
don't have the patch, so this breaks the build.

Add -Wno-error=typedef-redefinition to downgrade this from an error
to a warning.

MFC after:      2 weeks
Reviewed by:    dim, emaste
Sponsored by:   https://www.patreon.com/bsdivy
Differential Revision:  https://reviews.freebsd.org/D56653
DeltaFile
+5-0cddl/lib/libzpool/Makefile
+5-01 files

FreeBSD/src b866d05. 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
DeltaFile
+4-4Makefile.inc1
+4-41 files

FreeBSD/src d455c4b. Makefile.inc1

Makefile.inc1: Use ln -n instead of ln -h

We support both -h and -n, but GNU coreutils only supports -n,
so use that instead.  This fixes the package build on Linux.

MFC after:      2 weeks
Reviewed by:    (wosch, imp) (previous version), emaste
Better fix than the original patch suggested by: jrtc27
Sponsored by:   https://www.patreon.com/bsdivy
Differential Revision:  https://reviews.freebsd.org/D56656
DeltaFile
+1-1Makefile.inc1
+1-11 files

FreeBSD/src 0068c70release/scripts make-pkg-package.sh

make-pkg-package: Add set -e; abort if a cmd fails

This makes it less likely we will silently generate broken artifacts.

Reviewed by:    ivy
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D56671
DeltaFile
+2-0release/scripts/make-pkg-package.sh
+2-01 files

FreeBSD/src af7911dsys/dev/ena ena.h

ena: Update driver version to v2.8.3

Features:
* Report RX overrun errors via sysctl hw stats

Bug Fixes:
* Budget rx descriptors, not packets, to fix jumbo frame throughput

Minor Changes:
* pmap_change_attr void * API change for FreeBSD 16.0+
* Adjust ena_[rt]x_cleanup to return bool

MFC after: 2 weeks
Sponsored by: Amazon, Inc.
Differential Revision: https://reviews.freebsd.org/D56641
DeltaFile
+1-1sys/dev/ena/ena.h
+1-11 files

FreeBSD/src e3f4a63sys/dev/ena ena.c ena.h

ena: Report RX overrun errors

Extract rx_overruns from the keep alive descriptor reported by
the device and expose it via sysctl hw stats.

RX overrun errors occur when a packet arrives but there are not
enough free buffers in the RX ring to receive it.

MFC after: 2 weeks
Sponsored by: Amazon, Inc.
Differential Revision: https://reviews.freebsd.org/D56640
DeltaFile
+4-0sys/dev/ena/ena.c
+2-0sys/dev/ena/ena.h
+2-0sys/dev/ena/ena_sysctl.c
+8-03 files

FreeBSD/src 8c84a6etests/sys/netpfil/pf nat.sh

tests/pf/nat: endpoint_independent: wait for tcpdump to start

This matches pflog.sh tests and fixes flaky tests found in CI[0].

[0] https://ci.freebsd.org/job/FreeBSD-main-amd64-test/28126/testReport/junit/sys.netpfil.pf/nat/endpoint_independent_exhaust/

PR:     289628
Reviewed by:    glebius
Approved by:    lwhsu (mentor)
Sponsored by:   The FreeBSD Foundation
MFC after:      3 days
Differential Revision:  https://reviews.freebsd.org/D56145

(cherry picked from commit 60000d94b4e85caf931230a8a7ae86888db00d01)
DeltaFile
+28-16tests/sys/netpfil/pf/nat.sh
+28-161 files

FreeBSD/src 3219371tests/sys/netinet fibs_test.sh

tests/fibs_test: unskip udp_dontroute6 testcase

This test now consistently passes (300+ consecutive runs).

Approved by:    lwhsu (mentor)
Signed-off-by:  Siva Mahadevan <me at svmhdvn.name>
PR:             244172
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit e93e57d3da2ea54598b5db01cc12a3acd656faba)
DeltaFile
+0-3tests/sys/netinet/fibs_test.sh
+0-31 files

FreeBSD/src 4846afcrelease/scripts pkg-stage.sh

pkg-stage: Improve symlink creation

Invoke ln with -n and -f.  In normal use it doesn't matter, but during
development this might be run in a partially populated leftover tree.

Reviewed by:    ivy
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D52883
DeltaFile
+2-2release/scripts/pkg-stage.sh
+2-21 files

FreeBSD/src 43e7448sys/fs/fuse fuse_vnops.c fuse_node.c

fusefs: better handling for low-memory conditions

Under conditions of low memory, getblk can fail.  fusefs was not
handling those failures very systematically.  It was always using
PCATCH, which appears to have been originally copy/pasted from the NFS
client code, but isn't always appropriate:

* During fuse_vnode_setsize_immediate, which can be called from many
  different VOPs and from the vn_delayed_setsize mechanism, remove
  PCATCH.  Some of these callers cannot tolerate allocate failure.

* In fuse_inval_buf_range, don't assume that getblk will always succeed.

* When calling fuse_inval_buf_range from VOP_ALLOCATE,
  VOP_COPY_FILE_RANGE, or VOP_WRITE (with IO_DIRECT), return EINTR if
  the allocation fails.

* When calling fuse_inval_buf_range from VOP_DEALLOCATE, remove PCATCH.
  This VOP must not fail with EINTR.

    [8 lines not shown]
DeltaFile
+17-7sys/fs/fuse/fuse_vnops.c
+1-5sys/fs/fuse/fuse_node.c
+18-122 files

FreeBSD/src fac95c7lib/libsys pdfork.2

pdfork.2: correct pdrfork's HISTORY section

Since pdrfork will be included in FreeBSD 15.1

Reviewed by:    kib
Differential Revision: https://reviews.freebsd.org/D56513

(cherry picked from commit 9d39213d222395eb40323102db018cbedf773ddf)
DeltaFile
+2-2lib/libsys/pdfork.2
+2-21 files

FreeBSD/src ea27ec1tools/build/options makeman.lua

makeman.lua: Downgrade `make showconfig` error to warning

The sh-based makeman silently ignored errors from `make showconfig`.
Ignore errors also from makeman.lua (but emit a warning).

We may want to revisit this in the future, but want makeman.lua to
behave identically for now.

PR:             294822
Reviewed by:    kevans
Sponsored by:   The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D56663
DeltaFile
+4-1tools/build/options/makeman.lua
+4-11 files

FreeBSD/src 0988abdtests/sys/netgraph eiface_test.sh Makefile

tests/netgraph: Add a test for races between if_detach() and vnet_if_return()

A ng_eiface(4) or physical interface does not involve the cloner hence
the detaching is a bit different with epair(4). Add more tests to cover
that.

PR:             292993
MFC after:      3 days
Differential Revision:  https://reviews.freebsd.org/D56609
DeltaFile
+67-0tests/sys/netgraph/eiface_test.sh
+2-0tests/sys/netgraph/Makefile
+69-02 files

FreeBSD/src afa4648tests/sys/net if_clone_test.sh, tests/sys/netgraph eiface_test.sh

tests: Temporarily skip two testcases

The changes [1] and [2] made to CURRENT introduce races between ifnet
detach and vmove operations. That requires extra effort to fix. They
are not MFCed to stable branches so the latter are not affected.
Temporarily skip two affected tests on CURRENT right now.

[1] 0bf42a0a05b9 bpf: virtualize bpf_iflist
[2] a4d766caf711 bpf: add a crutch to support if_vmove

PR:             292993
Discussed with: kp
DeltaFile
+2-0tests/sys/net/if_clone_test.sh
+2-0tests/sys/netgraph/eiface_test.sh
+4-02 files

FreeBSD/src f4be169tests/sys/net if_clone_test.sh

tests/net/if_clone_test: Add a test for races between if_detach() and if_vmove_reclaim()

Ideally we shall have tests for all possible races. It is races between
if_detach(), if_vmove_loan(), if_vmove_reclaim() and vnet_if_return().
Well that requires too many tests and it appears to be less valuable to
have them all. So focus on potential in future regressions related to
recent fixes [1] and [2] only.

[1] ee9456ce3753 ifnet: Fix races in if_vmove_reclaim()
[2] ba7f47d47dc1 ifnet: if_detach(): Fix races with vmove operations

MFC after:      3 days
Differential Revision:  https://reviews.freebsd.org/D56606
DeltaFile
+29-0tests/sys/net/if_clone_test.sh
+29-01 files

FreeBSD/src 80c73c8usr.sbin/bsdinstall/partedit partedit_efi.c

bsdinstall: Add SPDX-License-Identifier tags

Reviewed by:    emaste
Sponsored by:   The FreeBSD Foundation
DeltaFile
+2-0usr.sbin/bsdinstall/partedit/partedit_efi.c
+2-01 files

FreeBSD/src 43315a8sys/powerpc/powerpc machdep.c

powerpc: remove dead code call into x86 perfmon

FreeBSD and NetBSD has copied these lines from the x86 architecture when
porting to other machines and forgetting to delete them.

Reviewed by:    mhorne
Sponsored by:   Netflix
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2154

(cherry picked from commit 0ac31026e1e0fb4e4b8a2eaa8ce2ead6a945dc6e)
DeltaFile
+0-3sys/powerpc/powerpc/machdep.c
+0-31 files

FreeBSD/src 2fb7264share/man/man7 security.7, usr.bin/mdo mdo.1

mdo.1: Cross-reference with security.7

MFC after:      3 days
Reviewed by:    olce
Differential Revision:  https://reviews.freebsd.org/D56024

(cherry picked from commit e23f0deceac4fb77c14066d4a76074548ee75fc4)
DeltaFile
+3-2usr.bin/mdo/mdo.1
+2-1share/man/man7/security.7
+5-32 files

FreeBSD/src 050ee86share/man/man7 security.7, usr.bin/mdo mdo.1

mdo.1: Cross-reference with security.7

MFC after:      3 days
Reviewed by:    olce
Differential Revision:  https://reviews.freebsd.org/D56024

(cherry picked from commit e23f0deceac4fb77c14066d4a76074548ee75fc4)
DeltaFile
+3-2usr.bin/mdo/mdo.1
+2-1share/man/man7/security.7
+5-32 files

FreeBSD/src 4a56a9ashare/man/man7 tuning.7

tuning.7: Fix suds typo in manual pages

MFC after:              3 days
Fixes:                  fc32c802158f Add two new manual pages
Differential Revision:  https://reviews.freebsd.org/D55814

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