Commit graph

38974 commits

Author SHA1 Message Date
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
Konstantin Belousov
2226c0e785 mlx5en: remove unneeded protocol and port parameters from mlx5e_add_vxal_rule
(cherry picked from commit e012189d02)
2021-07-26 16:51:11 +03:00
Konstantin Belousov
692ba7de91 mlx5: fix typo, KENREL_MIN_LEVEL->KERNEL_MIN_LEVEL
(cherry picked from commit 859e41e901)
2021-07-26 16:51:11 +03:00
Konstantin Belousov
d2fcc95d34 mlx5en: announce mce(4) capabilities for stateless VxLAN offloading
(cherry picked from commit bf202a8d7a)
2021-07-26 16:51:10 +03:00
Konstantin Belousov
56fd9780ad mlx5en: handle checksum and TSO offloading for VxLAN packets on TX
(cherry picked from commit 7c9febf9f1)
2021-07-26 16:51:10 +03:00
Konstantin Belousov
2ec7f3d2fe mlx5en: handle offloaded Rx checksums calculated for tunneled packets
(cherry picked from commit 149349e01e)
2021-07-26 16:51:10 +03:00
Konstantin Belousov
56e096ec86 mlx5en: build TIRs to handle inner RSS
(cherry picked from commit fba6942f19)
2021-07-26 16:51:10 +03:00
Konstantin Belousov
64f13da9dc mlx5en: allow software parser for created send queues
(cherry picked from commit 5e12b3bb43)
2021-07-26 16:51:10 +03:00
Konstantin Belousov
8ab58a780d mlx5en: register vxlan start/stop handlers
(cherry picked from commit 861a612d7b)
2021-07-26 16:51:10 +03:00
Konstantin Belousov
ed08b37119 mlx5en: eliminate magic constant
(cherry picked from commit 1b36b3869f)
2021-07-26 16:51:10 +03:00
Konstantin Belousov
f9b965c238 mlx5en: style, remove redundant parentheses
(cherry picked from commit 16816f9689)
2021-07-26 16:51:10 +03:00
Konstantin Belousov
273cc11d5c mlx5en: increase the limit MLX5E_MAX_TX_HEADER
(cherry picked from commit 8b8c71d7ac)
2021-07-26 16:51:10 +03:00
Konstantin Belousov
3e8436ec78 mlx5: Flow steering tree: increase number of supported flow tables from 3 to 5
(cherry picked from commit bc56a8f9e7)
2021-07-26 16:51:10 +03:00