Commit graph

42775 commits

Author SHA1 Message Date
Ed Maste
752c25c01c vt: add comments for KDMKTONE ioctl implementation
The KDMKTONE ioctl, introduced in commit 916347f77e, is used to beep
the PC speaker.  For historical reasons the frequency is specified as an
8254 PIT divisor for a 1.19MHz clock.  Linux provides this same ioctl.
Add a comment to vtterm_beep to avoid someone wanting to "fix" this in
the future.

Also add an XXX comment that the period unit is supposed to be "timer
ticks."  Note that nothing in the base system uses this ioctl.

Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D47395

(cherry picked from commit adba3c74209eb5d2197b9092002cc9d7505fd3c6)
2024-11-04 08:54:10 -05:00
Warner Losh
1c9f1cb4f0 vt: Fix frequency calcuation for bell
386BSD provided a MD function sysbeep. This took two arguments (pitch
and period). Pitch was jammed into the PIT's divisor directly (which
means the argument was expected to sound a tone at '1193182 / pitch'
Hz). FreeBSD inherited this interface.

In commit e465985885 (svn 177642, Mar 26 2008), phk changed this
function to take a tone to sound in hz. He converted all in-tree
instances of 1193182 / hz to just hz (and kept the few misguided folks
that passed hz directly unchanged -- this was part of what motivated the
change). He converted the places where we pre-computed the 8254 divisor
from being pitch to 1193182 / pitch (since that converts the divisor to
the frequency and the interfaces that were exposed to userland exposed
it in these units in places, continuing the tradition inherited from SCO
System V/386 Unix in spots).

In 2009, Ed Shouten was contracted by the FreeBSD Foundation to write /
finish newcons. This work was done in perforce and was imported into
subversion in user/ed/newcons in revision 199072
(https://svnweb.freebsd.org/base?view=revision&revision=199072) which
was later imported into FreeBSD by ray@ (Aleksandr Rybalko).

From that earliest import into svn import to this date, we ring the bell
with:
      sysbeep(1193182 / VT_BELLPITCH, VT_BELLDURATION);
where VT_BELLPITCH was defined to be 800. This results in a bell
frequency of 1491Hz, more or less today. This is similar to the
frequency that syscons and pcvt used (1493Hz and 1500Hz respectively).
This in turn was inherited from 386BSD, it seems, which used the hard
coded value 0x31b which is 795 -> 1500Hz.

This '800' was intended to be the bell tone (eg 800Hz) and this
interface was one that wasn't converted. The most common terminal prior
to the rise of PCs was the VT100, which had an approximately 800Hz
bell. Ed Shouten has confirmed that the original intent was 800Hz and
changing this was overlooked after the change to -current was made.
This restors that original intent and makes the bell less obnoxious in
the process.

Reviewed by:		des, adrian
Differential Revision:	https://reviews.freebsd.org/D32594
Sponsored by:		Netflix

(cherry picked from commit ba48d52ca6)

This change was accidentally reverted in 80f21bb039.

(cherry picked from commit 2416be588ea113cc06b924ed85861ed3bc391fe0)
2024-11-03 11:57:19 -05:00
Colin Percival
c2cd78d944 GPIO: Add ACPI _AEI support
Changes to acpi_gpiobus.c handle discovering and parsing the _AEI
objects and storing necessary data in device ivars.  A new gpioaei.c
file implements the device, which simply requests an interrupt when
the pin is triggered and invokes the appropriate _Exx or _Lxx ACPI
method.

This makes the GPIO "power button" work on arm64 Graviton systems,
allowing EC2 "Stop"/"Reboot" instance calls to be handled cleanly.
(Prior to this change, those requests would time out after 4 minutes
and the instance would be forcibly killed.)

Reviwed by:	imp, andrew, Ahmad Khalifa
MFC after:	3 days
Sponsored by:	Amazon
Differential Revision:	https://reviews.freebsd.org/D47253
Co-authored-by:	Andrew Turner <andrew@FreeBSD.org>

(cherry picked from commit 9709bda03cd0f20eba0ba4276fc3c2e06354a54f)
2024-11-03 08:01:28 -08:00
Colin Percival
1f69417607 acpi_gpiobus: Narrow scope of NOT_YET
GPIO interrupts work just fine and will be used shortly.  We still
do not support GPIO_INTR_SHAREABLE however, so leave that within
the NOT_YET scope.

Reviwed by:	andrew
MFC after:	1 week
Sponsored by:	Amazon
Differential Revision:	https://reviews.freebsd.org/D47251

(cherry picked from commit 2d4219919a48aa6d67ae62e2b8859ffe3b035bd2)
2024-11-03 08:01:27 -08:00
Colin Percival
fffdfe2f67 gpiobus: Make gpiobus_read_ivar extern
This allows acpi_gpiobus to override the method and fall back to the
generic gpiobus_read_ivar function if needed.

Reviewed by:	andrew
MFC after:	1 week
Sponsored by:	Amazon
Differential Revision:	https://reviews.freebsd.org/D47250

(cherry picked from commit bc0d10d01c3c69004d600e14d53cd0dceffe4b09)
2024-11-03 08:01:27 -08:00
Colin Percival
5fa51c3653 ACPI: Add ACPI_Q_AEI_NOPULL quirk and use in EC2
AWS Graviton [1234] systems have a bug in their ACPI where they mark
the PL061's GPIO pins as needing to be configured in PullUp mode (in
fact the PL061 has no pullup/pulldown resistors); this flag needs to
be removed in order for _AEI objects to be handled on these systems.

Reviewed by:	Ali Saidi
MFC after:	1 week
Sponsored by:	Amazon
Differential Revision:	https://reviews.freebsd.org/D47239

(cherry picked from commit 2f3f867ac6dd7ff3769366b828b79c44b38828e1)
2024-11-03 08:01:27 -08:00
Colin Percival
e177e64294 ACPI: Implement power button on !x86
ACPI sleep states are only implemented on x86 systems, so having the
ACPI power button attempt to enter "S5" (or other state as configured
via the hw.acpi.power_button_state sysctl) is not useful.

On non-x86 systems, implement the power button with a call to
    shutdown_nice(RB_POWEROFF)
to shut down the system.

Reviewed by:	Andrew
Tested on:	Graviton 2
MFC after:	2 weeks
Sponsored by:	Amazon
Differential Revision:	https://reviews.freebsd.org/D47094

(cherry picked from commit f41ef9d80b3d272e08dd9e2ea3c1d8d3f2818066)
2024-11-03 08:01:27 -08:00
Colin Percival
7c8f273bfb acpi_gpiobus: OR GPIO_PIN_(IN|OUT)PUT into flags
Right now flags is set to 0 before this "=" -> "|=" change, but it will
matter when the NOT_YET section above becomes effective.

MFC after:	2 weeks
Sponsored by:	Amazon

(cherry picked from commit c808132731aa999947f4f7810157d7d8d9aaf61e)
2024-11-03 08:01:27 -08:00
Ahmad Khalifa
14887d2c86 gpiobus(4): Add an acpi variant of gpiobus
This currently only implements the address space handler and attempts to
configure pins with flags obtained from ACPI.

Reviewed by:	wulf
MFC after:	1 month
Pull Request:	https://github.com/freebsd/freebsd-src/pull/1359

(cherry picked from commit 92adaa5862d5ea94318a011e0618622d0fb72521)
2024-11-03 08:01:27 -08:00
Mark Johnston
16b24ba872 igc: Remove a bogus register write in igc_if_queues_free()
As explained in PR 277038, iflib calls IFDI_DETACH() and then
IFDI_QUEUES_FREE().  With igc, the latter writes to a register after it
has been unmapped.

igc_if_detach() already calls igc_release_hw_control(), and looking at
callers of igc_if_queues_free(), that appears to be sufficient.  So,
just remove the igc_release_hw_control() call.

PR:		277038
Reported by:	Mike Belanger <mibelanger@qnx.com>
Reviewed by:	kbowling
Tested by:	kbowling
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D47293

(cherry picked from commit 35d05a14ed7e9935be1ed0fe965b91aaaa4c92ef)
2024-11-02 14:29:26 +00:00
Eric Joyner
b8ab635de4
iavf(4): Get MSI-X BAR index at runtime instead of hardcoding it
This allows iavf to load on E830 devices since those devices place their MSI-X
BAR at a different location than in previous 800 series products.

Signed-off-by: Eric Joyner <erj@FreeBSD.org>

Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D46952

(cherry picked from commit e53a21abdf2953714e44e3c54b4bb78557cb096c)
2024-10-31 09:54:24 -07:00
osamaabb
6bf02434bd ena: Update driver version to v2.8.0
Features:
* Add support for device request reset message over AENQ
* Support LLQ entry size recommendation from device
* Support max large LLQ depth from the device
* Expand PHC infrastructures
* Configuration notification support

Bug Fixes:
* Fix leaking ifmedia resources on detach
* Fix netmap socket chain unmapping issue
* Properly reinit netmap structs upon sysctl changes
* Correctly count missing TX completions

Minor Changes:
* Add reset reason for corrupted TX/RX completion descriptors
* Add reset reason for missing admin interrupts
* Improve reset reason statistics
* Update licenses

Approved by: cperciva (mentor)
Sponsored by: Amazon, Inc.

(cherry picked from commit ce4cc746bb4171a131ab9099947a500c0de18ff4)
2024-10-31 14:54:12 +00:00
Osama Abboud
7a39823d8e ena: Fix leaking ifmedia resources on detach
ifmedia_add() allocates an ifmedia_entry during ena_attach.
Current code doesn't release this memory during ena_detach()

This commit calls ifmedia_removeall() to properly free the
allocated memory during ena_detach().

Also, in case ena_attach fails, we need to detach ifmedia
which was allocated within ena_setup_ifnet().

This bug was first described in:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=278100

Reviewed by: zlei
Approved by: cperciva (mentor)
Sponsored by: Amazon, Inc.

(cherry picked from commit 449496eb28daec8d5b852fa4be1e337c2957345c)
2024-10-31 14:54:12 +00:00
Osama Abboud
86ec26e7a9 ena: Support max large LLQ depth from the device
Large LLQ depth size is currently calculated by dividing the maximum
possible size of LLQ by 2.
In newer paltforms, starting from r8g the size of BAR2,
which contains LLQ, will be increased, and the maximum depth of
wide LLQ will be set according to a value set by the device, instead of
hardcoded division by 2.

The new value will be stored by the device in max_wide_llq_depth field
for drivers that expose ENA_ADMIN_LLQ_FEATURE_VERSION_1 or higher to
the device.

There is an assumption that max_llq_depth >= max_wide_llq_depth, since
they both use the same bar, and if it is possible to have a wide LLQ
of size max_wide_llq_depth, it is possible to have a normal LLQ of the
same size, since it will occupy half of the space.

Also moved the large LLQ case calculation of max_tx_queue_size
before its rounddown.

Approved by: cperciva (mentor)
Sponsored by: Amazon, Inc.

(cherry picked from commit d0419551d96c8f995bdf6388a8e69684be33f9b5)
2024-10-31 14:54:11 +00:00
Osama Abboud
4d18878ada ena: Support LLQ entry size recommendation from device
This commit adds support for receiving LLQ entry size recommendation
from the device. The driver will use the recommended entry size, unless
the user specifically chooses to use regular or large LLQ entry.

Also added enum ena_llq_header_size_policy_t and llq_plociy field in
order to support the new feature.

Approved by: cperciva (mentor)
Sponsored by: Amazon, Inc.

(cherry picked from commit b1c38df05d79c81ee1e9fd0942774820a4ffcb63)
2024-10-31 14:54:11 +00:00
Osama Abboud
ebb857f4ce ena: Add support for device request reset message over AENQ
This commit adds a handler for the new aenq message
ENA_ADMIN_DEVICE_REQUEST_RESET,
which in turn causes the driver to trigger reset of a new type:
ENA_REGS_RESET_DEVICE_REQUEST. Also adds counting of such occurrences in
a new statistic for it.

Approved by: cperciva (mentor)
Sponsored by: Amazon, Inc.

(cherry picked from commit 705879424bc76fcc925e78eb7643dbf4bd9a11eb)
2024-10-31 14:54:11 +00:00
Osama Abboud
9aa14351c1 ena: Reinit netmap adapter struct upon sysctl changes
When attaching ENA driver, ena_netmap_attach() is invoked which, in turn
calls netmap_attach which, initializes a struct netmap_adapter,
allocating the struct's netmap_ring and the struct selinfo.

When we change the interface number of queues we need to reinit the
netmap adapter struct as well, so we need to detach it in order to free
the memory allocated by netmap_attach and allocate new memory based on
the new parameters like number of rings, ring size etc...

Without detaching and attaching the netmap interface, if we're to change
the number of queues from 8 to 2 for example and try to enable netmap,
the kernel will panic since the original netmap struct within the
kernel's possession still thinks that the driver has 8 queues which will
eventually cause a non-allocated virtual address access fault.

Approved by: cperciva (mentor)
Sponsored by: Amazon, Inc.

(cherry picked from commit f9c9c01de87e0440380b939c684d9939d48ce175)
2024-10-31 14:54:11 +00:00
Osama Abboud
8b43095ad8 ena: Clear NS_MOREFRAG flag for last netmap slot
When processing packets within the rx-flow
ena_netmap_rx_load_desc doesn't know the number of descriptors, so it
sets NS_MOREFRAG to all the slots to indicate that there are more
fragments for this packet.
The code calls ena_netmap_rx_load_desc() for every descriptor in
this packet to map the relevant buffer into the netmap shared memory.
After ena_netmap_rx_load_desc() calls, we need to unset the NS_MOREFRAG
for the last fragment to indicate that this is the last fragment,
so we explicitly turn off NS_MOREFRAG flag.
Current code overrides all other flags and sets NS_BUF_CHANGED.
This patch unsets the relevant flag only.

Approved by: cperciva (mentor)
Sponsored by: Amazon, Inc.

(cherry picked from commit 2f17afd19a3534dc1755c52edb0c2f70ea0eb1e4)
2024-10-31 14:54:11 +00:00
Osama Abboud
b0830d2b6b ena: Handle wrap around for prefetch in netmap
Netmap index wraps around based on the number of netmap kernel ring
slots.
Currently the driver prefetches the next slot using nm_i + 1 which may
be wrong since it does not handle wrap around.
This patch fixes that by using the kernel API for fetching the next
netmap index.

Approved by: cperciva (mentor)
Sponsored by: Amazon, Inc.

(cherry picked from commit ce20b51cb71bfb548fcaafc4bacb8290460f03d5)
2024-10-31 14:54:11 +00:00
Osama Abboud
b47eb2848a ena: Properly unmap last socket chain in netmap
In case ena_com_prepare_tx() fails within the netmap tx flow,
the driver will unmap the last socket chain.
Currently, the driver unmaps the wrong socket within
ena_netmap_unmap_last_socket_chain().

Illustration of the flow:

1- ena_netmap_tx_frames()
2- ena_netmap_tx_frame()
3- ena_netmap_tx_map_slots()
3.1- Map slot
3.2- Advance to the next socket
4- ena_com_prepare_tx()
4.1- ena_com_prepare_tx() fails
5- ena_netmap_unmap_last_socket_chain()

In step 5, where the driver unmaps the socket, the netmap
index already points at the next entry, meaning we're unmapping the
wrong socket in case ena_com_prepare_tx() fails.
In order to fix that, the driver should first update the netmap index to
point at the previous entry and only then update the socket parameters.

Approved by: cperciva (mentor)
Sponsored by: Amazon, Inc.

(cherry picked from commit f236e544a2ff685ae151f3232e3785a6a9aab035)
2024-10-31 14:54:11 +00:00
Osama Abboud
d38362c0ee ena: Make global counters style unified
This commit changes the code so all global counters will have the
same line break.

Approved by: cperciva (mentor)
Sponsored by: Amazon, Inc.

(cherry picked from commit 90953d2f829a45669b0c88a6a03da481f2d54e46)
2024-10-31 14:54:11 +00:00
Osama Abboud
cc489c17d2 ena: Trigger reset when mbuf is NULL error happens
The mbuf is NULL issue happens when the device sends the driver
a completion with a wrong request id.
Trigger a reset whenever this happens.

Approved by: cperciva (mentor)
Sponsored by: Amazon, Inc.

(cherry picked from commit da73e3a7d08c215a5d8530fea9a9730f8ac3709f)
2024-10-31 14:54:11 +00:00
Osama Abboud
db0c751ed7 ena: Add differentiation for missing TX completions reset
This commit adds differentiation for a reset caused by missing tx
completions, by verifying if the driver didn't receive tx
completions caused by missing interrupts.
The cleanup_running field was added to ena_ring because
cleanup_task.ta_pending is zeroed before ena_cleanup() runs.

Also ena_increment_reset_counter() API was added in order to support
only incrementing the reset counter.

Approved by: cperciva (mentor)
Sponsored by: Amazon, Inc.

(cherry picked from commit a33ec635d1f6d574d54e6f6d74766d070183be4c)
2024-10-31 14:54:11 +00:00
osamaabb
a20c06c6f1 ena: Set ena_min_poll_delay_us default value
This commit sets the default value for ena_min_poll_delay_us to 100.

This commit does not change the behavior of the driver, the delay is
calculated as MAX(ENA_MIN_ADMIN_POLL_US, delay_us), where the first
field is already defined as 100.
The second parameter, delay_us is taken from ena_min_poll_delay_us
which is currently unset - 0.

Approved by: cperciva (mentor)
Sponsored by: Amazon, Inc.

(cherry picked from commit 637ff00f2f9bd6c8509d0e2ac8959c7a23f09650)
2024-10-31 14:54:11 +00:00
Osama Abboud
a0594d1f65 ena: Add reset reason for missing admin interrupt
There can be cases when we trigger reset if an admin interrupt
is missing.
In order to identify this use-case specifically,
this commit adds a new reset reason.

Approved by: cperciva (mentor)
Sponsored by: Amazon, Inc.

(cherry picked from commit 274319acb48424958242d55e1b0c7d4528da7f70)
2024-10-31 14:54:10 +00:00
Osama Abboud
e445e3afde ena: Add reset reason for corrupted RX cdescs
RX completion descriptors may sometimes contain errors due
to corruption. Upon identifying such a case, the driver will
trigger a reset with an explicit reset reason
ENA_REGS_RESET_RX_DESCRIPTOR_MALFORMED.

Approved by: cperciva (mentor)
Sponsored by: Amazon, Inc.

(cherry picked from commit 4af71159db3cd4a37055b2b3d982ec53703c5c3d)
2024-10-31 14:54:10 +00:00
Osama Abboud
189bc23fd0 ena: Add reset reason for corrupted TX cdescs
TX completion descriptors may sometimes contain errors due
to corruption. Upon identifying such a case, the driver will
trigger a reset with an explicit reset reason
ENA_REGS_RESET_TX_DESCRIPTOR_MALFORMED.

Approved by: cperciva (mentor)
Sponsored by: Amazon, Inc.

(cherry picked from commit 38727218460008a500fbc18f08c90082ed678895)
2024-10-31 14:54:10 +00:00
Osama Abboud
89940eed91 ena: Improve reset reason statistics
The driver uses different reset reasons.
Some of them are counted and presented in the driver statistics.
There are cases where statistics are counted on a ring level,
but these are zeroed after a reset procedure takes place.

This commit makes the following changes:
1. Add statistics for the unrepresented reset reasons.
2. Add reset reasons which are counted on a ring level,
to be also global for better tracking.

Approved by: cperciva (mentor)
Sponsored by: Amazon, Inc.

(cherry picked from commit 89ce3f6314f6feba0e6626be51832d44df611218)
2024-10-31 14:54:10 +00:00
Osama Abboud
b1718de62f ena: Update license signatures to 2024
This commit updates all the license signatures to 2024.

Approved by: cperciva (mentor)
Sponsored by: Amazon, Inc.

(cherry picked from commit 8d6806cd08c093fc001db1f94cf122368b8d1549)
2024-10-31 14:54:10 +00:00
Osama Abboud
740fb85ba2 ena: Add configuration notifications interface support
This commit is part of the effort of notifying the user of non-optimal
or performance impacting practices.
A new interface is serving as a communication channel
between the device and the driver. One of the goals of this channel is
to create a new mechanism of notifying the driver and user in case of
sub-optimal configuration using a bitmap.

Approved by: cperciva (mentor)
Sponsored by: Amazon, Inc.

(cherry picked from commit 8cd86b51be4ab0fe70bad4830e608d56db5c850f)
2024-10-31 14:54:10 +00:00
Osama Abboud
e31fe28929 ena: Count all currently missing TX completions in check
Currently we count all of the newly added and already existing
missing tx completions in each iteration of
check_missing_comp_in_tx_queue() causing duplicate counts
to missing_tx_comp stat.

This commit adds a new counter new_missed_tx within the relevant
function which only counts the newly added missing tx completions
in each iteration of check_missing_comp_in_tx_queue().
This will allow us to update missing_tx_comp stat accurately without
counting duplicates.

Approved by: cperciva (mentor)
Sponsored by: Amazon, Inc.

(cherry picked from commit 1f67704e2cd85a507776312b52dc63d8690b9260)
2024-10-31 14:54:10 +00:00
Osama Abboud
418d3190d7 ena: Fix customer metrics deallocation statement place
Upstream commit [1] made if_alloc_domain() never fail, then also do the
wrappers if_alloc(), if_alloc_dev(), and if_gethandle().

Upstream commit [2] removed the NULL check conducted by the driver.
This commit also removes err_customer_metrics_alloc goto label.

Commit [2] leaves behind a floating free() statement that
deallocates customer_metrics_array. This commit places the
deallocation statement where it belongs.

[1] commit 4787572d05 ("ifnet: make if_alloc_domain() never fail")
[2] commit aa3860851b9f ("net: Remove unneeded NULL check for the allocated ifnet")

Approved by: cperciva (mentor)
Sponsored by: Amazon, Inc.

(cherry picked from commit 5517ca8486bfbf4d0cd369898f3e4d10cd614a9a)
2024-10-31 14:54:10 +00:00
Michael Tuexen
f84956ab37 al_eth: improve TCP LRO
Use the appropriate function to flush correctly all entries. The old
code does not remove the element from the hash table, only from the
active queue.

Reviewed by:		Peter Lei, rscheff
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D46434

(cherry picked from commit 0b45d36510d8c629fcc49805bc64e5893f4ba63c)
2024-10-31 12:19:40 +01:00
Michael Tuexen
c87c8fda44 neta: improve TCP LRO
Use the appropriate function to flush correctly all entries. The old
code does not remove the element from the hash table, only from the
active queue.

Reviewed by:		Peter Lei, rscheff
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D46433

(cherry picked from commit 5203dcce2527fd235648e2b855a13f62247eb2de)
2024-10-31 12:18:52 +01:00
Zhenlei Huang
02e61e1d9e ocs_fc: Remove a stray semicolon
MFC after:	1 week

(cherry picked from commit 36756195a342dbfb8fcfc7561b1d656fc6310d05)
2024-10-31 12:40:18 +08:00
Zhenlei Huang
1d8eda2e32 mpi3mr: Remove a stray semicolon
MFC after:	1 week

(cherry picked from commit 86a2c910c05c65d1318aef81ddbde8ac7eab79b9)
2024-10-31 12:40:18 +08:00
Zhenlei Huang
e96a62ea65 mana: Remove stray semicolons
MFC after:	1 week

(cherry picked from commit 6ccf4f4071c5bf85a9aad593e92d1623e949c039)
2024-10-31 12:40:17 +08:00
Zhenlei Huang
88971439fb enic: Remove a stray semicolon
MFC after:	1 week

(cherry picked from commit 75ff90814aec7a68e719d326f8dd0a7e1d0fc66d)
2024-10-31 12:40:17 +08:00
ScottD
843c1b5160 cxgb(4): Register ifmedia callbacks before ether_ifattach.
This prevents a panic that occurs if netlink tries to invoke the
driver's media callbacks during ifattach.

PR:		282374
Reported by:	ScottD <biscuits.carry.0j@icloud.com>

(cherry picked from commit f2daf89954a45c7eed22990dd4cf2cf879763dc0)
2024-10-30 18:09:06 -07:00
Gary Bisson
b99bb1c7ad if_ffec: fix MAC address bootverbose print
Remove extraneous colon at the end.

Pull Request:	https://github.com/freebsd/freebsd-src/pull/1479

Signed-off-by: Gary Bisson <gary.bisson@ezurio.com>
(cherry picked from commit 6a7aa5530c0d860c98c982968ac27728daaac7aa)
2024-10-30 17:49:45 -07:00
Gary Bisson
bba78206c5 if_ffec: fix imx6sx compatible flags
The i.MX 6 SoloX does support Gigabit and AVB features as can be seen in
its technical reference manual [1] or even Linux kernel [2].

Fixes: 94bc2117b4 ("Add i.MX 8M Quad support")

[1] https://www.nxp.com/webapp/Download?colCode=IMX6SXRM
[2]
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/net/ethernet/freescale/fec_main.c?h=linux-6.6.y#n206

Pull Request:	https://github.com/freebsd/freebsd-src/pull/1479

Signed-off-by: Gary Bisson <gary.bisson@ezurio.com>
(cherry picked from commit c222619cd4807e9e0274e6fadcbe259cf5cabc26)
2024-10-30 17:49:30 -07:00
Eric Joyner
25ad37c953
ice: Remove RDMA feature block on E830 devices
The decision to disable RDMA on E830 devices has been reversed; some
SKUs will officially launch with RDMA support.

This reverts a change introduced in "ice: Update to 1.42.5-k".

Signed-off-by: Eric Joyner <erj@FreeBSD.org>

Sponsored by:	Intel Corporation

(cherry picked from commit 03e1f25dcb200edbd6553ffc2748e7410b9ff264)
2024-10-30 13:53:03 -07:00
Eric Joyner
38a1655adc
ice: Update to 1.43.2-k
- Add extra time while waiting for an EMPR to finish on E830 and E825C
  devices
- Fix debug mask sysctl help message
- Handle EAGAIN error messages from the Get Link Status AQ command by
  retrying them several times
- Handle the condition where E830 extended temperature SKUs can have the
  chip initialize without the PHY subsystem being ready due to very low
  temperatures; the driver will print out a message when this happens
- Fix inability to set link speed using the advertise_speed sysctl when
  link is down and the link_active_on_if_down sysctl is set to 0
- Fix issue where VLANs would not properly be set back up after a
  hardware reset (e.g. PF reset) (Thanks jacob.e.keller@intel.com)

Signed-off-by: Eric Joyner <erj@FreeBSD.org>

Tested by:	Jeffrey Pieper <jeffrey.e.pieper@intel.com>
Relnotes:	yes
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D46951

(cherry picked from commit f377a0c7dfa97035844e58c2aec810001bebce17)
2024-10-30 13:52:47 -07:00
Eric Joyner
5f92347a9b
ice: Update to 1.42.5-k
- Removes duplicate E825C printout
- Fixes a package download issue with E830
- Updates mentions of E830-XXV to E830-L
- Fix FW logging on load issue by limiting the setting of FW log masks
  and other global configuration to just the first PF of the controller
- Update ice_hw_autogen.h with timesync registers (unused in this
  driver)
- Fix possible overflow condition in NVM access function
- Blocks RDMA load on E830 devices

Signed-off-by: Eric Joyner <erj@FreeBSD.org>

Tested by:	Jeffrey Pieper <jeffrey.e.pieper@intel.com>
Relnotes:	yes
Sponsored by:	Intel Corporation
Differential Revision:	https://reviews.freebsd.org/D46950

(cherry picked from commit 440addc642496f8d04fe17af9eb905ac4a5bdbd8)
2024-10-30 13:52:25 -07:00
Eric Joyner
5cf8640220
ice: Update to 1.42.1-k
Summary:
- Adds E830 device support
- Adds pre-release E825C support (for the Ethernet device included in
  an upcoming Xeon D platform)
- Add sysctl for E810 devices to print out PHY debug statistics (mostly
  for FEC debugging)
- Adds per-TX-queue tso counter sysctl to count how many times a TSO offload
  was requested for a packet, matching other Intel drivers
- Various bug fixes

Signed-off-by: Eric Joyner <erj@FreeBSD.org>

Tested by:	Jeffrey Pieper <jeffrey.e.pieper@intel.com>
Relnotes:	yes
Sponsored by:	Intel Corporation
Differential Revisison:	https://reviews.freebsd.org/D46949

(cherry picked from commit f2635e844dd138ac9dfba676f27d41750049af26)
2024-10-30 13:52:07 -07:00
Jeremiah Lott
86efff5491 ixv: Check cap return before MSI-X enable write
In the QEMU workaround code in if_ixv.c, the ixv driver calls
pci_find_cap(dev, PCIY_MSIX, &rid). It is not checking the return code
from that function and the function appears to always be failing. This
then causes the driver to use the rid variable uninitialized, which
will mean setting a bit at an arbitrary offset in pci config space. For
now, this seems to have no adverse impact, but it could easily cause
very subtle problems.

PR:		207037
Sponsored by:	BBOX.io

(cherry picked from commit b87b3696c973ef0a9df70143cd89f6b488531e93)
2024-10-29 18:01:04 -07:00
Konstantin Belousov
3aedf015d1 if_ixv: fix build without NETMAP
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit b0993e3bcaec60701f3ae56df255433eb4bcd091)
2024-10-28 22:03:00 -07:00
Kevin Bowling
9679df8eea ixv: Dynamically size the receive packet size
If MTU of the if_ixv VF driver is configured between 1501 and 2030, and
if a peer box have bigger MTU and sends a packet bigger than MTU into
this guest, kernel could crash.

Dynamically calculate the receive packet size on rx_mbuf_sz as ix(4)
does.

PR:		268092
Reported by:	Kumara Babu <nkumarababu@gmail.com>
Sponsored by:	BBOX.io

(cherry picked from commit cdbe3de5383706da0f6d3c29f1ec2dcfed366bf1)
2024-10-28 17:29:03 -07:00
Andrew Gallatin
ee373c1234 acpi_ged: Handle events directly
Handle ged interrupts directly from the interrupt handler,
while the interrupt source is masked, so as to conform
with the acpi spec, and avoid spurious interrupts and
lockups on boot.

When an acpi ged interrupt is encountered, the spec requires
the os (as stated in 5.6.4: General Purpose Event Handling)
to leave the interrupt source masked until it runs the
EOI handler.  This is not a good fit for our method of
queuing the work (including the EOI ack of the interrupt),
via the AcpiOsExecute() taskqueue mechanism.

Note this fixes a bug where an arm64 server could lock up if
it encountered a ged interrupt at boot.  The lockup was
due to running on a single core (due to arm64 not using
EARLY_AP_STARTUP), and due to that core encountering a
new interrupt each time the interrupt handler unmasked
the interrupt source, and having the EOI queued on a taskqueue
which never got a chance to run. This is also possible
on any platform when using just a single processor.
The symptom of this is a lockup at boot, with:
"AcpiOsExecute: failed to enqueue task, consider
increasing the debug.acpi.max_tasks tunable" scrolling
on console.

Similarly, spurious interrupts would occur when running
with multiple cores, because it was likely that the
interrupt would fire again immediately, before the
ged task could be run, and before an EOI could be sent
to lower the interrupt line.  I would typically see
3-5 copies of every ged event due to this issue.

This adds a tunable, debug.acpi.ged_defer, which can be
set to 1 to restore the old behavior.  This was done
because acpi is a complex system, and it may be
theoretically possible something the ged handler does
may sleep (though I cannot easily find anthing by inspection).

MFC after: 1 month
Reviewed by: andrew, jhb, imp
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D42158

(cherry picked from commit be91b4797e2c8f3440f6fe3aac7e246886f9ebca)
2024-10-28 19:02:24 -04:00
Mark Johnston
9f984fc683 netmap: Make memory pools NUMA-aware
Each netmap adapter associated with a physical adapter is attached to a
netmap memory pool.  contigmalloc() is used to allocate physically
contiguous memory for the pool, but ideally we would ensure that all
such memory is allocated from the NUMA domain local to the adapter.

Augment netmap's memory pools with a NUMA domain ID, similar to how
IOMMU groups are handled in the Linux port.  That is, when attaching to
a physical adapter, ensure that the associated memory pools are local to
the adapter's associated memory domain, creating new pools as needed.

Some types of ifnets do not have any defined NUMA affinity; in this case
the domain ID in question is the sentinel value -1.

Add a sysctl, dev.netmap.port_numa_affinity, which can be used to enable
the new behaviour.  Keep it disabled by now to avoid surprises in case
netmap applications are relying on zero-copy optimizations to forward
packets between ports belonging to different NUMA domains.

Reviewed by:	vmaffione
MFC after:	2 weeks
Sponsored by:	Klara, Inc.
Differential Revision:	https://reviews.freebsd.org/D46666

(cherry picked from commit 1bae9dc584272dd75dc4e04cb5d73be0e9fb562a)
2024-10-28 16:39:50 +00:00