FreeBSD/src fdca6b7sys/dev/bnxt/bnxt_en if_bnxt.c

bnxt: Report actual link speed, rather than hard-coded 100Gbs

We need to report the actual link speed, rather than a hard-coded
100Gbs for a variety of reasons, but most importantly, as reporting
100Gbs on a 10g link breaks lacp when this NIC is in an LACP bundle
with other vendors' NICs after e98ed8d99fd4 (lacp:
Simplify lacp_compose_key()), as the fake 100g puts this nic
into a different aggregation group.

Sponsored by: Netflix
Reviewed by: glebius
Tested by: glebius
DeltaFile
+1-1sys/dev/bnxt/bnxt_en/if_bnxt.c
+1-11 files

FreeBSD/src 074ff87sys/net iflib.c

iflib: handle transient errors from isc_txd_encap()

Until we introduced support for nic ktls offload, all error returns
from isc_txd_encap() indicated a permanent failure. Iflib remapped all
those failures to ENOMEM, which was treated by the tcp stack as a
permanent error and passed back to the caller. This was done to avoid
creating "infinite loops" where a packet couldn't be mapped for
transmit, and kept being sent over and over.

Now that we have support for nic ktls offload, some ktls offload
drivers may return ENOBUFS from their encap function to indicate that,
for example, the ktls context may not yet be fully initialized.  This
needs to be treated as a transient error so that the TCP stack may
re-try at a later time. To achieve this, pass the raw error back to
the caller when the encap routine returns an error aside from EFBIG.

Note that I audited all in-tree iflib drivers. Only ice and ixl ran
return anything other than 0 from their encap, which is EFBIG. both of
which are still treated as they were before.

    [8 lines not shown]
DeltaFile
+5-2sys/net/iflib.c
+5-21 files

FreeBSD/src ed4f5e5sys/dev/hwpmc hwpmc_ibs.h

hwpmc_ibs: Add more IBS register definitions

Small change to add additional IBS register definitions for the new pmc
tools.  Most of the definitions are for Zen 4 and above where we get
detailed information regarding the source of a completed memory
operation.

Reviewed by:    mhorne
Sponsored by:   Netflix
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2292
DeltaFile
+33-1sys/dev/hwpmc/hwpmc_ibs.h
+33-11 files

FreeBSD/src cf469absys/dev/hwpmc hwpmc_amd.c

hwpmc_amd: Avoid using PMCs if in use by firmware

Some firmwares use the PMCs to monitor OS performance.  We can't be
certain that the BIOS would detect any change to the counters if we
reprogram them.  In cases where the firmware is using the PMCs to
control power management this could have dangerous side effects or
unexpected performance effects.

During initialization, detect if any of the counters are enabled and
fail if so.

Reported by:    Sandipan Das
Reviewed by:    mhorne
MFC after:      1 week
Sponsored by:   Netflix
Pull Request:   https://github.com/freebsd/freebsd-src/pull/2277
DeltaFile
+77-33sys/dev/hwpmc/hwpmc_amd.c
+77-331 files

FreeBSD/src e61edb9sys/cam/ctl scsi_ctl.c

ctl: Use CAM_PRIORITY_NORMAL for queued CCBs

Previously this was using CAM_PRIORITY_NONE which tripped over the
assertion added in b4b166b8c46b8.

PR:             293076
Reported by:    Ken J. Thomson <thomsonk at yandex.com>
Reviewed by:    imp
Sponsored by:   Chelsio Communications
Differential Revision:  https://reviews.freebsd.org/D56995

(cherry picked from commit 887841731be60a958e471b9fd79261169b67b7ad)
DeltaFile
+5-3sys/cam/ctl/scsi_ctl.c
+5-31 files

FreeBSD/src 7e04dc8usr.sbin/ctld ctld.cc

ctld: Simplify pidfile rename handling in conf::apply

Explicitly copy the pidfile path from the initial configuration file
to the kernel-derived configuration to avoid having to check if the
old path is empty as a special case in conf::apply().

Sponsored by:   Chelsio Communications
Differential Revision:  https://reviews.freebsd.org/D56533

(cherry picked from commit 9306d0449ba6fffadf08d5ab61aea596369e03f4)
DeltaFile
+10-15usr.sbin/ctld/ctld.cc
+10-151 files

FreeBSD/src c1a05ddusr.sbin/ctld ctld.cc ctld.hh

ctld: Add a dedicated conf method for shutting down

Currently the main loop creates an empty config and applies it to
force a shutdown of all of the existing configuration.  While this is
functional and does avoid duplicating some code, it is also a bit
clunky and requires a special hack in the pidfile path handling
in the conf::apply method.

Instead, use a dedicated conf::shutdown method which tears down the
CTL ports and LUNs and closes the sockets.

Sponsored by:   Chelsio Communications
Differential Revision:  https://reviews.freebsd.org/D56532

(cherry picked from commit f1c5de5fab9d5cada11935418db11e19ebff7e34)
DeltaFile
+40-16usr.sbin/ctld/ctld.cc
+1-0usr.sbin/ctld/ctld.hh
+41-162 files

FreeBSD/src 415d241usr.sbin/ctld ctld.cc

ctld: Remove redundant call to conf::isns_schedule_update

This is already called at the end of conf::apply.

Sponsored by:   Chelsio Communications
Differential Revision:  https://reviews.freebsd.org/D56530

(cherry picked from commit 4f90de0933218fd257300c6341abf157387f7641)
DeltaFile
+0-2usr.sbin/ctld/ctld.cc
+0-21 files

FreeBSD/src a9269dcsys/amd64/amd64 machdep.c

amd64: Don't set an initial FPU state save size

This used to be needed to initialize the pcb pointer when the pcb was
allocated on the kstack.

Reviewed by:    kib
Sponsored by:   AFRL, DARPA
Pull Request:   https://ron-dev.freebsd.org/FreeBSD/src/pulls/23

(cherry picked from commit 860aaecf1bb659d8cc6023aaa2d27273823faa75)
DeltaFile
+0-1sys/amd64/amd64/machdep.c
+0-11 files

FreeBSD/src f62f0a1sys/arm64/arm64 swtch.S

arm64: Adjust the kernel stack pointer at the end of fork_trampoline

All other paths that return from the kernel to userspace pop the user
trapframe off of the kernel stack pointer before returning to
userspace in restore_registers.  fork_trampoline was missing this, so
all of the user faults after fork pushed another trapframe leaving a
trapframe's worth of wasted space on the kstack.

This would be fatal after a future change to remove duplicate
initialization of td_frame in cpu_fork() as without this fix each time
a thread was recycled it would "lose" another trapframe's worth of
space.

Reviewed by:    kib, andrew
Pull Request:   https://ron-dev.freebsd.org/FreeBSD/src/pulls/23

(cherry picked from commit a1e07f21dc7458d85bd0d04c294f0389d4591666)
DeltaFile
+2-0sys/arm64/arm64/swtch.S
+2-01 files

FreeBSD/src 615a9c4sys/arm64/iommu smmu.c

arm64/iommu: Add a missing close parenthesis

Fixes:          6dc813301a17 ("sys: Use is_pci_device instead of direct comparisons to devclasses")
Sponsored by:   Chelsio Communications
(cherry picked from commit 8de34a84224b9a353bc0a9d6d3f95540b0e72707)
DeltaFile
+1-1sys/arm64/iommu/smmu.c
+1-11 files

FreeBSD/src cb2d864usr.sbin/ctld ctld.cc ctld.hh

ctld: Only check physical port linking in a single configuration context

Commit 969876fcee57 moved struct pport from being per-configuration to
being a "global" object shared across multiple configurations.  As a
result, the check for duplicate ports actually spanned across
configurations, such that reloading a configuration would now think
that existing physical ports were already linked.

The linking field in pport added in the C++-ification (commit
6acc7afa34aa) faithfully replicated this bug (albeit simpler as I had
noticed that the TAILQ links weren't used after the earlier commit).

To restore the desired behavior, remove the linking field from struct
pport entirely and use a local unordered_map in conf::add_pports which
tracks if a given pport is claimed by more than one target.

PR:             293076
Reported by:    Ken J. Thomson <thomsonk at yandex.com>
Fixes:          969876fcee57 ("ctld: parse config file independently of getting kernel info")

    [3 lines not shown]
DeltaFile
+7-5usr.sbin/ctld/ctld.cc
+0-4usr.sbin/ctld/ctld.hh
+7-92 files

FreeBSD/src 9de8461usr.sbin/ctld ctld.cc kernel.cc

ctld: Refactor ioctl port handling

- Normalize ioctl port names when the port name is first added to
  the configuration.  This can catch potential duplicate port names
  sooner and helps with other parts of this change.

- When recognizing existing ioctl ports, always expand the name to
  include the physical and virtual port numbers.  This permits binding
  ioctl/0/0 or ioctl/1/0 to a target, for example.

- When adding physical ports to a target, first check for an existing
  kernel port to reuse.  This handles both ioctl and non-ioctl ports
  and removes the need for the conf::add_port method for ioctl ports
  to check in kports.

- If an existing kport isn't found when adding physical ports, check
  to see if the port name is an ioctl port.  If so, call conf::add_port
  to add an ioctl port.  This add_port method overload is now simpler
  as it always creates a new port.

    [11 lines not shown]
DeltaFile
+49-31usr.sbin/ctld/ctld.cc
+4-1usr.sbin/ctld/kernel.cc
+1-1usr.sbin/ctld/ctld.hh
+54-333 files

FreeBSD/src d0f6c4busr.sbin/ctld kernel.cc

ctld: Don't ignore pp/vp values of kernel ports with pp == 0 but vp != 0

Fixes:          c6f1e9b8a412 ("ctld: Simplify XML parsing memory management")
Sponsored by:   Chelsio Communications
(cherry picked from commit 7a436d378951bedbdaa71d45bf236fb001323549)
DeltaFile
+1-1usr.sbin/ctld/kernel.cc
+1-11 files

FreeBSD/src d344b9asys/arm64/arm64 swtch.S

arm64 locore: Fix a comment typo: Of -> If

Reviewed by:    kib, andrew
Sponsored by:   AFRL, DARPA
Pull Request:   https://ron-dev.freebsd.org/FreeBSD/src/pulls/23

(cherry picked from commit fce595344c51850a7113430c77e70c8777383a98)
DeltaFile
+1-1sys/arm64/arm64/swtch.S
+1-11 files

FreeBSD/src a2b0b41sys/amd64/amd64 trap.c

amd64: Drop segment descriptor details from trap messsages

Segment descriptor contents are fixed on amd64 and not very interesting
compared to the other values that are displayed.

While here, include both the thread and process details of the current
thread and drop redundant output of the trap number.

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

(cherry picked from commit 00b96a777845d9b558b2303cbef03ba5197b593a)
DeltaFile
+3-13sys/amd64/amd64/trap.c
+3-131 files

FreeBSD/src cafe7b0usr.sbin/ctld ctld.hh

ctld: Mark a few more isns_* methods in the conf class private

These are only invoked from other methods in the conf class.

Sponsored by:   Chelsio Communications
Differential Revision:  https://reviews.freebsd.org/D56531

(cherry picked from commit 63d7b7fad2dd2343854c60f0da4ac46ef5b0d8b1)
DeltaFile
+3-3usr.sbin/ctld/ctld.hh
+3-31 files

FreeBSD/src c9c0474sys/arm64/include pcpu.h

arm64: Remove unneeded declaration from <machine/pcpu.h>

Reviewed by:    kib, andrew
Sponsored by:   AFRL, DARPA
Pull Request:   https://ron-dev.freebsd.org/FreeBSD/src/pulls/23

(cherry picked from commit d01e5afbbf9bc879e570f59dddc147c0efa8b990)
DeltaFile
+0-1sys/arm64/include/pcpu.h
+0-11 files

FreeBSD/src e71677csys/dev/sound/pcm ac97.c

sys: Use is_pci_device instead of checking device or devclass names

Reviewed by:    bz, imp
Sponsored by:   Chelsio Communications
Differential Revision:  https://reviews.freebsd.org/D56998

(cherry picked from commit be4f245e1e4fe60d43aaff5b11b45f2a9a66a51c)
DeltaFile
+1-1sys/dev/sound/pcm/ac97.c
+1-11 files

FreeBSD/src 02d7be3sys/dev/vnic thunder_bgx_fdt.c

vnic: Add missing #include

Reported by:    bz, olivier
Fixes:          6dc813301a17 ("sys: Use is_pci_device instead of direct comparisons to devclasses")
Sponsored by:   Chelsio Communications
(cherry picked from commit 8c9dc47b5fcaf58a89b1511118b78a65737b20cc)
DeltaFile
+1-0sys/dev/vnic/thunder_bgx_fdt.c
+1-01 files

FreeBSD/src 59fa4e2sys/arm64/cavium thunder_pcie_pem.c, sys/dev/bge if_bge.c

sys: Use is_pci_device instead of direct comparisons to devclasses

Reviewed by:    bz
Sponsored by:   Chelsio Communications
Differential Revision:  https://reviews.freebsd.org/D56997

(cherry picked from commit 6dc813301a173e2e1993c3064df162e6218c1231)
DeltaFile
+8-24sys/dev/iommu/busdma_iommu.c
+3-10sys/dev/bge/if_bge.c
+3-10sys/x86/iommu/intel_drv.c
+2-8sys/dev/pci/pci.c
+2-7sys/dev/vnic/thunder_bgx_fdt.c
+1-5sys/arm64/cavium/thunder_pcie_pem.c
+19-646 files not shown
+29-8312 files

FreeBSD/src e375116share/man/man9 pci.9 Makefile, sys/dev/pci pci.c pcivar.h

pci: Add is_pci_device helper function

This returns true if a given device is a PCI device (child of a PCI
bus).

Reviewed by:    bz, kib
Sponsored by:   Chelsio Communications
Differential Revision:  https://reviews.freebsd.org/D56996

(cherry picked from commit ffcf5e356644252f2f6c89ba01057af45c216559)
DeltaFile
+10-1share/man/man9/pci.9
+11-0sys/dev/pci/pci.c
+2-1share/man/man9/Makefile
+1-0sys/dev/pci/pcivar.h
+24-24 files

FreeBSD/src 36b1770sys/compat/linuxkpi/common/include/linux pci.h

LinuxKPI: Check the devclass of the parent device in dev_is_pci

Reviewed by:    bz
Fixes:          c41d83548b6c ("LinuxKPI: pci.h add more defines and functions")
Sponsored by:   Chelsio Communications
Differential Revision:  https://reviews.freebsd.org/D57066
(cherry picked from commit 6a043d0814a29e756f5d26e7b59a360e1d6dfa45)
DeltaFile
+2-2sys/compat/linuxkpi/common/include/linux/pci.h
+2-21 files

FreeBSD/src 355bdadlib/libsys clock_gettime.2

clock_gettime.2: Fix a couple of typos

Reviewed by:    emaste
Differential Revision:  https://reviews.freebsd.org/D56990

(cherry picked from commit 52fa2f9f8d57e4dde555567794c6b3e0e242b8a1)
DeltaFile
+2-2lib/libsys/clock_gettime.2
+2-21 files

FreeBSD/src 655013dsys/arm64/vmm vmm_hyp.c

arm64/vmm: Enforce a data barrier before tlbi for non-VHE

Exception entry does not include an implicit, architectural data
barrier.

Reported by:    Ben Simner <ben.simner at cl.cam.ac.uk>
Reviewed by:    andrew
Fixes:          5577bb2f67ff ("arm64/vmm: Support tlbi from VHE")
Differential Revision:  https://reviews.freebsd.org/D56855
(cherry picked from commit 04987aa1d8099e5f8f5dd8c68e65f315b3f1fd6c)
DeltaFile
+0-4sys/arm64/vmm/vmm_hyp.c
+0-41 files

FreeBSD/src 4ea1d25contrib/mandoc lib.in

mandoc: Updating FreeBSD thead library descriptions

Remove libkse as it has been obsolete for many years and drop 1:1 from
description of libthr.

Reviewed by:    brooks
Sponsored by:   AFRL, DARPA
Differential Revision:  https://reviews.freebsd.org/D56850

(cherry picked from commit 8766e2122ac02ff4d86c254d8ef1c41d4a7f76a0)
DeltaFile
+1-2contrib/mandoc/lib.in
+1-21 files

FreeBSD/src ad47ebacontrib/mandoc lib.in

mandoc: Add an entry for libsys to lib.in

Reviewed by:    brooks, emaste
Obtained from:  CheriBSD
Sponsored by:   AFRL, DARPA
Differential Revision:  https://reviews.freebsd.org/D56849

(cherry picked from commit 538f0564c1197605d7ab80ba39cbf27cc9c90fed)
DeltaFile
+1-0contrib/mandoc/lib.in
+1-01 files

FreeBSD/src 1268357sys/kern subr_kobj.c

kobj: Use M_WAITOK in kobj_init

Blocking allocation is safe in all of the current callers of kobj_init
(most of them do a M_WAITOK malloc of the structure passed as the
first argument to kobj_init just before calling it).  kobj_init
doesn't return an error code but instead panics if the nested malloc
in kobj_class_compile1 fails, so using M_WAITOK here is more robust.

Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D56625

(cherry picked from commit 5df7dae10dc02ade8639b0171e0d3cc8db790e41)
DeltaFile
+1-1sys/kern/subr_kobj.c
+1-11 files

FreeBSD/src 47cfba9sys/kern subr_kobj.c

kobj: Assert class passed to kobj_init_static is compiled

Inspired by discussion in
https://github.com/freebsd/freebsd-src/pull/2016

Reviewed by:    imp
Differential Revision:  https://reviews.freebsd.org/D56624

(cherry picked from commit 5a6e5954d14b589bcba0125d10a6c7b62b588f4b)
DeltaFile
+2-0sys/kern/subr_kobj.c
+2-01 files

FreeBSD/src a40ffc7sys/cam/ctl ctl_frontend_ioctl.c

ctl_ioctl_frontend: Reject out-of-range initiator IDs

Various places in CTL assume that initiator IDs are not larger than
CTL_MAX_INIT_PER_PORT.  Other IDs such as lun IDs are validated in
places such as ctl_scsiio_precheck, but initiator IDs submitted by
userland were not previously validated.

PR:             291059
Reported by:    Hans Rosenfeld <rosenfeld at grumpf.hope-2000.org>
Reviewed by:    asomers
Sponsored by:   Chelsio Communications
Differential Revision:  https://reviews.freebsd.org/D56628

(cherry picked from commit 6f8312bdff236ad64d1c15c239051359d8245a68)
DeltaFile
+8-3sys/cam/ctl/ctl_frontend_ioctl.c
+8-31 files