Commit graph

38986 commits

Author SHA1 Message Date
Konstantin Belousov
dfda6a71e7 /dev/pci: clarify meaning of writeable file descriptor
(cherry picked from commit 85ae35ef37)
2021-08-03 12:52:36 +03:00
Kevin Bowling
bb048438e7 igb: clean up igb_txrx comments
Reviewed by:	grehan
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D31227

(cherry picked from commit ff01d6343f)
2021-08-02 19:04:46 -07:00
Kevin Bowling
b91bb9b07f e1000: Add missing branch prediction
I missed this edit from the ixgbe review (D30074)

Reviewed by:	gallatin
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D30073

(cherry picked from commit 9fd0cda92d)
2021-08-02 19:04:31 -07:00
Kevin Bowling
4ccafcfc86 e1000: Clean up igb_txrx
The intention here is to reduce differences between em, igb, igc, ixgbe.

The main functional change is logical simplification in igb_rx_checksum
and getting interface caps from scctx instead of the ifp.

Reviewed by:	gallatin, markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D30073

(cherry picked from commit 41f0225714)
2021-08-02 19:04:05 -07:00
Alexander Motin
156b889469 mrsas(4): Report more correct maximum I/O size.
Subtract one SGE for the case of misaligned address.  Also take into
account maximum number of sectors reported by firmware, that gives
nicer 256KB limit instead of 276KB calculated from the SGE limit.

While there, remove number of I/O size checks, duplicating what is
already checked by CAM and busdma(9).

MFC after:	1 month
Sponsored by:	iXsystems, Inc.

(cherry picked from commit fa3d57c256)
2021-08-02 11:56:10 -04:00
Kevin Bowling
fe6803c18e ixgbe: Clean up ix_txrx
The intention here is to reduce differences with D30072.
The only functional change is logical simplification in
ixgbe_rx_checksum.

Reviewed by:	gallatin
Differential Revision:	https://reviews.freebsd.org/D30074

(cherry picked from commit 51e46835e1)
2021-07-29 17:27:24 -07:00
Kevin Bowling
ebdd2bc441 ixgbe: Print FW NVM and Option ROM versions
It can be useful for system operators to see this kind of information
when correlating issues or requesting support from the OEM or Intel for
hardware and firmware issues.

Reviewed by:	gallatin
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D30178

(cherry picked from commit 7660e4ea5c)
2021-07-29 17:26:45 -07:00
Mitchell Horne
862ea25915 hwpmc_arm64: add a PMCDBG to the interrupt handler
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 13f5a3076b)
2021-07-29 12:05:55 -03:00
Mitchell Horne
83166f8714 arm64 support for pmu-events
8cc3815f:
hwpmc_arm64: accept raw event codes for PMC_OP_PMCALLOCATE

Make it possible to specify event codes without an offset of
PMC_EV_ARMV8_FIRST, by setting a machine-dependent flag. This is
required to make use of event definitions from pmu-events.

Reviewed by:	ray (slightly earlier version)
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30602

28dd6730:
libpmc: enable pmu_utils on arm64

This allows supported libpmc to query/select from the pmu-events table,
which may have a more complete set of events than what we define
manually. A future update to these definitions should greatly improve
this support. The alias table is empty for now, until this future import
is complete.

Add the Foundation's copyright for recent work on this file.

Reviewed by:	ray (slightly earlier version)
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D30603

27ea55fc:
libpmc/hwpmc: fix issues with arm64 pmu-events support

Due to a mis-merge, the changes committed to libpmc never called
pmu_parse_event(), or set pm->pm_ev. However, this field shouldn't be
used to carry the actual pmc event code anyway, as it is expected to
contain the index into the pmu event array (otherwise, it breaks event
name lookup in pmclog_get_event()). Add a new MD field,
pm_md.pm_md_config, to pass the raw event code to arm64_allocate_pmc().

Additionally, the change made to pmc_md_op_pmcallocate was incorrect, as
this is a union, not a struct. Restore the proper padding size.

Reviewed by:	luporl, ray, andrew
Fixes:		28dd6730a5 ("libpmc: enable pmu_utils on arm64")
Fixes:		8cc3815f02 ("hwpmc_arm64: accept raw event codes...")
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D31221

(cherry picked from commit 8cc3815f02)
(cherry picked from commit 28dd6730a5)
(cherry picked from commit 27ea55fc65)
2021-07-29 12:02:05 -03:00
Mitchell Horne
d876c5a052 hwpmc_arm64: fill kern.hwpmc.cpuid
This will be used to detect supported pmu events. The expected format is
the MIDR register with the revision and variant fields masked. See also:
lib/libpmc/pmu-events/arch/arm64/mapfile.csv.

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

(cherry picked from commit 5867cccdc4)
2021-07-29 12:01:11 -03:00
Mitchell Horne
a2d252f89f hwpmc_arm64.c: fix return style
In accordance to style(9).

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 2129c8f677)
2021-07-29 12:01:10 -03:00
Andrew Turner
19135e372f arm64: Fix finding the pmc event ID
The lower pmc event bits were masked off to find the PMC event ID.
The doesn't work when there are more events. Switch it to use the
offser relative to the first event while also checking the ID is
in the expected range.

Reviewed by:	gnn, ray
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D29600

(cherry picked from commit 24b2f4ea49)
2021-07-29 12:00:37 -03:00
Yang Zhong
50b26566c7 mmc: Drain the intrhook in mmc_detach()
Buggy SD card drivers may attach and detach a mmc(4) driver instance in
quick succession.  In this case mmc(4) must disestablish its intrhook
callback during detach.  Thus, this change adds a call to
config_intrhook_drain(), which blocks or does nothing if the intrhook is
running or has already ran (the SD card was plugged in), and
disestablishes the hook if it hasn't ran yet (the SD card was not
plugged in).

PR:		254373
Reviewed by:	imp, manu, markj
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit d5341d72a1)
2021-07-29 08:11:50 -04:00
Mark Johnston
9788041842 uart: Fix an out-of-bounds read in ns8250_bus_probe()
The problem is that ns8250_bus_probe() accesses a field from the
ns8250_softc, which embeds the generic UART softc, but the ns8250_softc
hasn't yet been allocated because we're still probing.

This is a regression from commit 0aefb0a63c.  This fixed a problem
where one of the upper four IER bits, which are usually reserved, needs
to be set in order to get RX interrupts before the RX FIFO is full.  At
the same time, we avoid clearing those reserved bits (see commit
58957d8717, though other UART drivers I looked at do not bother with
this).

So, copy what ns8250_init() does to disable interrupts, since we don't
know what the "right" mask is at this point.

Reported by:	syzbot+f256beefd0df9eb796e7@syzkaller.appspotmail.com
Reviewed by:	imp
Sponsored by:	The FreeBSD Foundation

(cherry picked from commit 4a9a41650c)
2021-07-26 21:46:34 -04:00
Navdeep Parhar
6e405dd9e4 cxgbe(4): Remove some dead code.
(cherry picked from commit 3965469eaa)
2021-07-26 10:49:25 -07:00
Hans Petter Selasky
5b803f6820 mlx5: Numa domain improvements.
Properly allocate all mlx5en(4) structures from correct numa domain.

While at it cleanup unused numa domain integers deriving from the
Linux version of mlx5en(4).

Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 7c3eff94bd)
2021-07-26 18:04:33 +02:00
Hans Petter Selasky
2b4db9bbc2 mlx5: Fix for uninitialized "uid" field.
Make sure the "uid" field gets properly set when destroying DCT and QP
objects by making a copy of the field when creating such objects.

Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit cbf6911e10)
2021-07-26 18:04:33 +02:00
Hans Petter Selasky
191a0e65a0 mlx4: Map core_clock page to user space only when allowed
Currently when we map the hca_core_clock page to the user space,
there are vulnerable registers, one of which is semaphore, on
this page as well. If user read the wrong offset, it can modify the
above semaphore and hang the device.

Hence, mapping the hca_core_clock page to the user space only when
user required it specifically.

After this patch, mlx4 core_clock won't be mapped to user space by
default. Oppose to current state, where mlx4 core_clock is always mapped
to user space.

Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit c8301cbb0f)
2021-07-26 18:04:33 +02:00
Hans Petter Selasky
fdab56d1f6 mlx5en: Allow binding channels to CPUs when RSS is not enabled.
Submitted by:	Netflix
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit c8d16d1e08)
2021-07-26 18:04:33 +02:00
Hans Petter Selasky
857966b357 mlx5en: Allocate per-channel doorbells.
To avoid congestion on the same PCI memory register space when
traffic consists mostly of small packets.

Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 9dfa21486e)
2021-07-26 18:04:33 +02:00
Hans Petter Selasky
0ebff67cab mlx5en: Wait for all TLS connections to terminate when unloading driver.
The driver expects all TLS tags to be returned to the driver before
it can free the UMA zone where the TLS tags reside.

Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 3a934ba7a3)
2021-07-26 18:04:33 +02:00
Hans Petter Selasky
cd08d4c537 mlx4ib and mlx5ib: Set slid to zero in Ethernet completion struct
IB spec says that a lid should be ignored when link layer is Ethernet,
for example when building or parsing a CM request message (CA17-34).
However, since ib_lid_be16() and ib_lid_cpu16()  validates the slid,
not only when link layer is IB, we set the slid to zero to prevent
false warnings in the kernel log.

Linux commit:
65389322b28f81cc137b60a41044c2d958a7b950

Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 30416d4e82)
2021-07-26 18:04:33 +02:00
Hans Petter Selasky
1554e2673b mlx5en: Configure relaxed PCI read and write ordering for ethernet.
This may improve performance in some configurations.

Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit de2437f199)
2021-07-26 18:04:32 +02:00
Hans Petter Selasky
c41403c5ca mlx5en: Check for pci_channel_offline() when draining sendqueue.
This speeds up detach in hypervisor environments.

Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 4692d9808e)
2021-07-26 18:04:32 +02:00
Hans Petter Selasky
763d239db2 mlx5ib: Implement support for enabling and disabling RoCE ECN.
RoCE is short for Remote direct memory access over Converged Ethernet.
ECN is short for Explicit Congestion Notification.

Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 8abf5ac0e6)
2021-07-26 18:04:32 +02:00
Hans Petter Selasky
526c54f54b mlx5ib: Extend parameter macros so that more arguments may be added.
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 42f719d611)
2021-07-26 18:04:32 +02:00
Hans Petter Selasky
75b63f08d2 mlx5core: Don't query the PCI config space for offline during a firmware command.
Querying the PCI config space for offline for every firmware command blocks
the PCI bus and affects performance. Especially for packet pacing and TLS
when objects are frequently created and destroyed.

Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit e787b5acb1)
2021-07-26 18:04:32 +02:00
Hans Petter Selasky
47f7e8e423 ibcore: Declare ib_post_send() and ib_post_recv() arguments const
Since neither ib_post_send() nor ib_post_recv() modify the data structure
their second argument points at, declare that argument const. This change
makes it necessary to declare the 'bad_wr' argument const too and also to
modify all ULPs that call ib_post_send(), ib_post_recv() or
ib_post_srq_recv(). This patch does not change any functionality but makes
it possible for the compiler to verify whether the
ib_post_(send|recv|srq_recv) really do not modify the posted work request.

Linux commit:
f696bf6d64b195b83ca1bdb7cd33c999c9dcf514
7bb1fafc2f163ad03a2007295bb2f57cfdbfb630
d34ac5cd3a73aacd11009c4fc3ba15d7ea62c411

Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit c3987b8ea7)
2021-07-26 18:04:32 +02:00
Hans Petter Selasky
b383248ef6 mlx5: Set default timestamp format for mlx5en(4) and mlx5ib.
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 4fb0a74e08)
2021-07-26 18:04:32 +02:00
Hans Petter Selasky
a7a80f1771 mlx5: Add new timestamp mode bits.
These fields declare which timestamp mode is supported
by the device per RQ/SQ/QP.

In addition add the ts_format field to the select the mode
for RQ/SQ/QP.

Linux commit:
a6a217dddcd544f6b75f0e2a60b6e84c1d494b7e

Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 915fc66cb5)
2021-07-26 18:04:32 +02:00
Hans Petter Selasky
1c1c0acb31 ibcore: Simplify ib_modify_qp_is_ok().
All callers to ib_modify_qp_is_ok() provides enum ib_qp_state makes the
checks of out-of-scope redundant. Let's remove them together with updating
function signature to return boolean result.

While at it remove unused "ll" parameter from ib_modify_qp_is_ok().

Linux commit:
19b1f54099b6ee334acbfbcfbdffd1d1f057216d
d31131bba5a1630304c55ea775c48cc84912ab59

Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit d92a9e5604)
2021-07-26 18:04:31 +02:00
Hans Petter Selasky
f919e25214 mlx5core: Make sure error code is propagated on error.
If mlx5_init_once() fails, mlx5_load_one() should fail too, else the
device instance remains attached causing problems at reboot.

Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit d8cbfa101c)
2021-07-26 18:04:30 +02:00
Hans Petter Selasky
2cbd288904 ibcore: Introduce ib_port_phys_state enum.
In order to improve readability, add ib_port_phys_state enum to replace
the use of magic numbers.

Linux commit:
72a7720fca37fec0daf295923f17ac5d88a613e1

Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 4238b4a7a2)
2021-07-26 18:04:30 +02:00
Hans Petter Selasky
349d037802 mlx5ib: Fix XRC QP support after introducing extended atomic.
Extended atomics are supported with RC and XRC QP types, but Linux commit
a60109dc9a95 added an unneeded check to to_mlx5_access_flags().
This broke XRC QPs.

The following ib_atomic_bw invocation over XRC reproduces the issue:
ib_atomic_bw -d mlx5_1 --connection=XRC --atomic_type=FETCH_AND_ADD

It is safe to remove such checks because the QP type was already checked
in ib_modify_qp_is_ok(), which was previously called from
mlx5_ib_modify_qp().

Linux commit:
13f8d9c16693afb908ead3d2a758adbe6a79eccd

Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit cf88b86e49)
2021-07-26 18:04:29 +02:00
Hans Petter Selasky
f1d4741b76 mlx5ib: Limit mkey page size to 2GB
The maximum page size in the mkey context is 2GB.

Until today, we didn't enforce this requirement in the code, and therefore,
if we got a page size larger than 2GB, we have passed zeros in the
log_page_shift instead of the actual value and the registration failed.

This patch limits the driver to use compound pages of 2GB for mkeys.

Linux commit:
762f899ae7875554284af92b821be8c083227092

Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 565cb4e8cc)
2021-07-26 18:04:28 +02:00
Hans Petter Selasky
cae3be82c3 mlx5ib: Simplify mlx5_ib_cont_pages()
The patch simplifies mlx5_ib_cont_pages and fixes the following
issues in the original implementation:

First issues is related to alignment of the PFNs. After the check
base + p != PFN, the alignment of the PFN wasn't checked. So the PFN
sequence 0, 1, 1, 2 would result in a page_shift of 13 even though
the 3rd PFN is not 8KB aligned.

This wasn't actually a bug because it was supported by all the
existing mlx5 compatible device, but we don't want to require
this support in all future devices.

Another issue is because the inner loop didn't advance PFN so
the test "if (base + p != pfn)" always failed for SGE with
len > (1<<page_shift).

Linux commit:
d67bc5d4e3e100d762c0f57ea67f28bc219698a6

Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 21bc3710a4)
2021-07-26 18:04:28 +02:00
Hans Petter Selasky
6b49b46f26 mlx5en: Add more error checks in the transmit path.
- Upon error more completion events than requested may be generated,
  particularly when using the completion event factor feature.
- Count number of event errors in the transmit path.

Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 4f4739a77b)
2021-07-26 18:04:28 +02:00
Hans Petter Selasky
24cf63c778 mlx5ib: Support RAW Ethernet when RoCE is disabled in mlx5ib(4)
On some environments, such as certain SRIOV VF configurations, RoCE is
not supported for mlx5 Ethernet ports. Currently, the driver will not
open IB device on that port.

This is problematic, since we do want user-space RAW Ethernet (RAW_PACKET
QPs) functionality to remain in place. For that end, enhance the relevant
driver flows such that we do create a device instance in that case.

Linux commit:
ca5b91d63192ceaa41a6145f8c923debb64c71fa

Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit 626cb01d44)
2021-07-26 18:04:28 +02:00
Hans Petter Selasky
906117f773 mlx5en: Add missing media types for 100GBit/s, 200Gbit/s and 400Gbit/s.
Make the mlx5e_mode_table[] array one dimensional, because there is only
one entry, 10G ER/LR, which share the same protocol bit.

This patch only adds support for basic sub-type distinguishing for the
extended protocol bits. Use verbose ifconfig eeprom output to get actual
media type.

Remove write only "connector_type" variable while at it.

Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking

(cherry picked from commit a888087fba)
2021-07-26 18:04:28 +02:00
Konstantin Belousov
9dee4f6789 mlx5: drop Giant around VSC lock and CRSPACE enumeration on attach
(cherry picked from commit 78f5ebaed6)
2021-07-26 16:51:12 +03:00
Konstantin Belousov
f2e512d09b mlx5: add a knob to administratively disable mlx5 fw dump setup
(cherry picked from commit 8391db038d)
2021-07-26 16:51:12 +03:00
Konstantin Belousov
180c45c1b4 mlx5: Fix PBMC register mapping
(cherry picked from commit 0fc0b62b0f)
2021-07-26 16:51:12 +03:00
Konstantin Belousov
4348f0758c mlx5: Fix PPLM register mapping
(cherry picked from commit 06a3fd0e5c)
2021-07-26 16:51:11 +03:00
Konstantin Belousov
14e2413289 mlx5en: add ASCII art providing an overview of flow tables organization
(cherry picked from commit b1277d42d7)
2021-07-26 16:51:11 +03:00
Konstantin Belousov
a6925a8e34 mlx5en: vxlan: do not report TCP inner packet as UDP for software parser
(cherry picked from commit 1db1e58d93)
2021-07-26 16:51:11 +03:00
Hans Petter Selasky
976a59ba6d mlx5en: Add missing error case when creating VXLAN flow tables.
(cherry picked from commit 2f7ce2326f)
2021-07-26 16:51:11 +03:00
Hans Petter Selasky
40fa8f462b mlx5en: Fix for IPv6 VxLAN checksum offload.
(cherry picked from commit 1918b253d3)
2021-07-26 16:51:11 +03:00
Konstantin Belousov
518c3f34d0 mlx5en: Honor IFCAP_VXLAN_HWCSUM
(cherry picked from commit 48acda2b2d)
2021-07-26 16:51:11 +03:00
Konstantin Belousov
779fd2390b mlx5en: remove all dynamic vxlan steering rules on close and reinstall on open
(cherry picked from commit 0e4cb0d5a4)
2021-07-26 16:51:11 +03:00
Konstantin Belousov
c0d0e85679 mlx5en: add mlx5e_add_vxlan_rule_from_db() helper
(cherry picked from commit 559eaa44d9)
2021-07-26 16:51:11 +03:00