igc(4): document adaptive interrupt moderation
Describe the disabled, adaptive, and low-latency settings and their
interrupt-rate tradeoffs.
MFC after: 1 week
e1000: restore packet-size AIM
Restore the packet-size calculation introduced in a69ed8dfb381 and used
by igb(4) until the iflib conversion in f2d6ace4a684. It derives
interrupt holdoff from average packet size, so RSS queue count does not
change its behavior.
The calculation follows the pre-iflib code. Retain the current normal
and low-latency rate caps, and keep the current setting when an interval
has no usable sample.
Fixes: 3e501ef89667 ("e1000: Re-add AIM")
MFC after: 1 week
igc: count TSO wire segments in the AIM counters
The transmit path bills one packet of ipi_len bytes per request. For
TSO that is the whole unsegmented payload, up to 64 KiB, rather than a
packet size that appears on the wire.
Count the segments the hardware emits and the header carried by each
segment. Non-TSO accounting is unchanged.
MFC after: 1 week
e1000: count TSO wire segments in the AIM counters
The transmit paths billed one packet of ipi_len bytes per request. For
TSO that is the whole unsegmented payload, up to 64KB, so the average
size the moderation calculation sees is not a size that appears on the
wire.
Count the segments the hardware will put on the wire and the header each
of them carries.
Non-TSO accounting is unchanged.
MFC after: 1 week
igc: use packet-size AIM
Use the packet-size calculation introduced for igb(4) in a69ed8dfb381
and retained there until the iflib conversion in f2d6ace4a684. It
derives interrupt holdoff from average packet size, so RSS queue count
does not change its behavior.
The calculation follows the pre-iflib igb code. Retain igc's normal and
low-latency rate caps, and keep the current setting when an interval has
no usable sample.
MFC after: 1 week
igc: fix RX accounting for multi-descriptor packets
The receive path adds the running packet length to rx_bytes for every
descriptor. A packet spanning descriptors of length l1, l2, and l3 is
therefore counted as 3*l1 + 2*l2 + l3.
Add each descriptor length once. Single-descriptor accounting remains
unchanged.
MFC after: 1 week
e1000: make AIM counter sampling coherent
Sample free-running counters by delta instead of clearing them from the
interrupt filter, which can race their producers. Publish byte and
packet counts together at the TX and RX doorbells so each sample is
coherent.
Aggregate every TX ring assigned to the interrupt vector so unequal RX
and TX queue counts are safe. Count RX bytes only after a frame is
accepted.
MFC after: 1 week
igc: synchronize interrupt moderation state
Keep the saved EITR value synchronized with hardware across
reinitialization. Correct EITR encoding, decoding, and MSI-X register
selection, and reject nonpositive fallback rates.
Apply the packet-buffer fallback without permanently disabling AIM.
MFC after: 1 week
em(4): document adaptive interrupt moderation
Describe the disabled, adaptive, and low-latency settings and their
interrupt-rate tradeoffs.
MFC after: 1 week
igc: make AIM counter sampling coherent
Sample free-running counters by delta instead of clearing them from the
interrupt filter, which can race their producers. Publish byte and
packet counts together at the TX and RX doorbells so each sample is
coherent.
Aggregate every TX ring assigned to the interrupt vector so unequal RX
and TX queue counts are safe. Count RX bytes only after a frame is
accepted.
MFC after: 1 week
e1000: synchronize interrupt moderation state
Keep the saved EITR and PBA values synchronized with hardware across
reinitialization. Correct EITR encoding, decoding, and MSI-X register
selection, and reject nonpositive fallback rates.
Treat only sub-gigabit links as sub-gigabit and apply the packet-buffer
fallback without permanently disabling AIM.
MFC after: 1 week
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
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
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]
bc: Fix tests
Stop generating test scripts at build time. The dc test script is
broken and simply fixing the code that generates it won't help as there
is no reliable way to ensure it gets regenerated if it already exists in
the object tree.
MFC after: 1 week
Reviewed by: se
Differential Revision: https://reviews.freebsd.org/D56511
(cherry picked from commit 67a63eae7b2d10d29983c9698894f1bfff4ffc6e)
bc: Fix tests
Stop generating test scripts at build time. The dc test script is
broken and simply fixing the code that generates it won't help as there
is no reliable way to ensure it gets regenerated if it already exists in
the object tree.
MFC after: 1 week
Reviewed by: se
Differential Revision: https://reviews.freebsd.org/D56511
(cherry picked from commit 67a63eae7b2d10d29983c9698894f1bfff4ffc6e)
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)
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)
[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
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
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
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)
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)
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)