Commit Graph

562 Commits

Author SHA1 Message Date
Hans Petter Selasky
3a1bf85503 mlx5en: Remove unused hardware TLS field.
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-02-01 16:21:14 +01:00
Hans Petter Selasky
33a6a7a72a mlx5en: Make the receive packet indirection table, RQT, static instead of dynamic.
Allocate the RQT once, pointing all initial entries to the drop RQN.
When opening the channels simplify modify the RQT, directing all traffic
to the new RQNs. Similarly when closing the channels point all RQT entries
back to the so-called drop RQN.

MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-02-01 16:21:14 +01:00
Hans Petter Selasky
7800af352a mlx5en: Set CQN in RQ parameters for drop RQ.
Else creating the drop RQ fails.

MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-02-01 16:21:14 +01:00
Hans Petter Selasky
03567b0dfa mlx5en: Set channel pointer for drop receive queue.
A valid channel pointer is needed to get the priv pointer during init.

MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-02-01 16:21:14 +01:00
Hans Petter Selasky
4e40e984da mlx5en: Print error code when opening drop RQ fails.
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-02-01 16:21:14 +01:00
Hans Petter Selasky
27b778ae55 mlx5en: Implement dummy receive queue, RQ, for dropping packets.
What is a drop RQ and why is it needed?

The RSS indirection table, also called the RQT, selects the
destination RQ based on the receive queue number, RQN. The RQT is
frequently referred to by flow steering rules to distribute traffic
among multiple RQs. The problem is that the RQs cannot be destroyed
before the RQT referring them is destroyed too. Further, TLS RX
rules may still be referring to the RQT even if the link went
down. Because there is no magic RQN for dropping packets, we create
a dummy RQ, also called drop RQ, which sole purpose is to drop all
received packets. When the link goes down this RQN is filled in all
RQT entries, of the main RQT, so the real RQs which are about to be
destroyed can be released and the TLS RX rules can be sustained.

MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-02-01 16:21:14 +01:00
Hans Petter Selasky
a60f953424 mlx5en: Make the hw_lro parameter read only tunable.
This prevents the so-called TIR context from changing during runtime.

MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-02-01 16:21:14 +01:00
Hans Petter Selasky
788e9e7478 mlx5: Remove support for FreeBSD 10 and older.
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-02-01 16:21:13 +01:00
Hans Petter Selasky
2d5e5a0d75 mlx5en: Patch to inhibit transmit doorbell writes during packet reception.
During packet reception the network stack frequently transmit data in
response to TCP window updates. To reduce the number of transmit doorbells
needed, inhibit all transmit doorbells designated for the same channel until
after the reception of packets for the given channel is completed.

While at it slightly refactor the mlx5e_tx_notify_hw() function:

1) The doorbell information is always stored into sq->doorbell.d64 .
No need to pass a separate pointer to this variable.

2) Move checks for skipping doorbell writes inside this function.

MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-02-01 16:21:13 +01:00
Konstantin Belousov
0f7b6e11c0 mlx5en: Use a UMA cache zone for managing TLS send tags
Instead of allocating directly from a normal zone. This way
import and release are guaranteed to process all allocated and then
deallocated items. Also, the release occurs in a sleepable context when
caller of uma_zfree() or uma_zdestroy() can sleep itself.

MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-02-01 14:45:58 +02:00
Konstantin Belousov
028130b8e4 mlx5ib: idiomatic use of preprocessor, in particular paths
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-02-01 14:45:58 +02:00
Konstantin Belousov
7060097908 mlx5ib: normalize use of the opt_*.h files
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-02-01 14:45:57 +02:00
Konstantin Belousov
89918a2375 mlx5en: idiomatic use of preprocessor, in particular paths
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-02-01 14:45:57 +02:00
Konstantin Belousov
b984b95693 mlx5en: normalize use of the opt_*.h files
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-02-01 14:45:57 +02:00
Hans Petter Selasky
12c56d7dc4 mlx5: idiomatic use of preprocessor, in particular paths
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-02-01 14:45:57 +02:00
Konstantin Belousov
ee9d634bd3 mlx5: normalize use of the opt_*.h files
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2022-02-01 14:45:57 +02:00
Warner Losh
c6df6f5322 Create wrapper for Giant taken for newbus
Create a wrapper for newbus to take giant and for busses to take it too.
bus_topo_lock() should be called before interacting with newbus routines
and unlocked with bus_topo_unlock(). If you need the topology lock for
some reason, bus_topo_mtx() will provide that.

Sponsored by:		Netflix
Reviewed by:		mav
Differential Revision:	https://reviews.freebsd.org/D31831
2021-12-09 17:04:45 -07:00
Cy Schubert
db0ac6ded6 Revert "wpa: Import wpa_supplicant/hostapd commit 14ab4a816"
This reverts commit 266f97b5e9, reversing
changes made to a10253cffe.

A mismerge of a merge to catch up to main resulted in files being
committed which should not have been.
2021-12-02 14:45:04 -08:00
Cy Schubert
266f97b5e9 wpa: Import wpa_supplicant/hostapd commit 14ab4a816
This is the November update to vendor/wpa committed upstream 2021-11-26.

MFC after:      1 month
2021-12-02 13:35:14 -08:00
Gordon Bergling
c937fb286f mlx5: Correct a typo in a sysctl description
- s/parameteres/parameters/

MFC after:	3 days
2021-12-02 10:51:18 +01:00
Elyes HAOUAS
9097ac9af4 Fix typo on "Celsius"
"Celcius" --> "Celsius"

Signed-off-by: Elyes HAOUAS <ehaouas@noos.fr>
Pull Request: https://github.com/freebsd/freebsd-src/pull/551/files
2021-11-18 23:05:32 -07:00
Konstantin Belousov
0eb2dcd32e mlx5_en: fix use of CALLOUT_DIRECT
Reported by:	markj
Reviewed by:	hselasky
Sponsored by:	NVIDIA Networking
MFC after:	1 week
2021-10-05 13:07:36 +03:00
John Baldwin
c782ea8bb5 Add a switch structure for send tags.
Move the type and function pointers for operations on existing send
tags (modify, query, next, free) out of 'struct ifnet' and into a new
'struct if_snd_tag_sw'.  A pointer to this structure is added to the
generic part of send tags and is initialized by m_snd_tag_init()
(which now accepts a switch structure as a new argument in place of
the type).

Previously, device driver ifnet methods switched on the type to call
type-specific functions.  Now, those type-specific functions are saved
in the switch structure and invoked directly.  In addition, this more
gracefully permits multiple implementations of the same tag within a
driver.  In particular, NIC TLS for future Chelsio adapters will use a
different implementation than the existing NIC TLS support for T6
adapters.

Reviewed by:	gallatin, hselasky, kib (older version)
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D31572
2021-09-14 11:43:41 -07:00
Gordon Bergling
04389c855e Fix some common typos in comments
- s/configuraiton/configuration/
- s/specifed/specified/
- s/compatiblity/compatibility/

MFC after:	5 days
2021-08-08 10:16:06 +02:00
Hans Petter Selasky
d2cbfbc57b mlx5/mlx4: Bump driver version to 3.7
While at it only output driver version to dmesg(8) when hardware is present.

Differential Revision:	https://reviews.freebsd.org/D29100
MFC after:	1 week
Reviewed by:	kib and markj
Sponsored by:	NVIDIA Networking
2021-07-28 13:47:05 +02:00
Hans Petter Selasky
b633e08c70 ibcore: Kernel space update based on Linux 5.7-rc1.
Overview:

This is the first stage of a RDMA stack upgrade introducing kernel
changes only based on Linux 5.7-rc1.

This patch is based on about four main areas of work:
- Update of the IB uobjects system:
  - The memory holding so-called AH, CQ, PD, SRQ and UCONTEXT objects
    is now managed by ibcore. This also require some changes in the
    kernel verbs API. The updated verbs changes are typically about
    initialize and deinitialize objects, and remove allocation and
    free of memory.

- Update of the uverbs IOCTL framework:
  - The parsing and handling of user-space commands has been
    completely refactored to integrate with the updated IB uobjects
    system.

- Various changes and updates to the generic uverbs interfaces in
  device drivers including the new uAPI surface.

- The mlx5_ib_devx.c in mlx5ib and related mlx5 core changes.

Dependencies:

- The mlx4ib driver code has been updated with the minimum changes
needed.

- The mlx5ib driver code has been updated with the minimum changes
needed including DV support.

Compatibility:

- All user-space facing APIs are backwards compatible after this
  change.

- All kernel-space facing RDMA APIs are backwards compatible after
  this change, with exception of ib_create_ah() and ib_destroy_ah()
  which takes a new flag.

- The "ib_device_ops" structure exist, but only contains the driver ID
  and some structure sizes.

Differences from Linux:

- Infiniband drivers must use the INIT_IB_DEVICE_OPS() macro to set
  the sizes needed for allocating various IB objects, when adding
  IB device instances.

Security:

- PRIV_NET_RAW is needed to use raw ethernet transmit features.
- PRIV_DRIVER is needed to use other privileged operations.

Based on upstream Linux, Torvalds (5.7-rc1):
8632e9b5645bbc2331d21d892b0d6961c1a08429

MFC after:	1 week
Reviewed by:	kib
Differential Revision:	https://reviews.freebsd.org/D31149
Sponsored by:	NVIDIA Networking
2021-07-28 13:28:29 +02:00
Konstantin Belousov
1db1e58d93 mlx5en: vxlan: do not report TCP inner packet as UDP for software parser
Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies // NVIDIA Networking
MFC after:	1 week
2021-07-22 15:34:24 +03:00
Hans Petter Selasky
7c3eff94bd 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).

MFC after:	1 week
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-07-12 14:52:45 +02:00
Hans Petter Selasky
cbf6911e10 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.

MFC after:	1 week
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-07-12 14:38:51 +02:00
Hans Petter Selasky
c8d16d1e08 mlx5en: Allow binding channels to CPUs when RSS is not enabled.
MFC after:	1 week
Submitted by:	Netflix
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-07-12 14:22:34 +02:00
Hans Petter Selasky
9dfa21486e mlx5en: Allocate per-channel doorbells.
To avoid congestion on the same PCI memory register space when
traffic consists mostly of small packets.

MFC after:	1 week
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-07-12 14:22:34 +02:00
Hans Petter Selasky
3a934ba7a3 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.

MFC after:	1 week
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-07-12 14:22:34 +02:00
Hans Petter Selasky
30416d4e82 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

MFC after:	1 week
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-07-12 14:22:34 +02:00
Hans Petter Selasky
de2437f199 mlx5en: Configure relaxed PCI read and write ordering for ethernet.
This may improve performance in some configurations.

MFC after:	1 week
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-07-12 14:22:34 +02:00
Hans Petter Selasky
4692d9808e mlx5en: Check for pci_channel_offline() when draining sendqueue.
This speeds up detach in hypervisor environments.

MFC after:	1 week
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-07-12 14:22:33 +02:00
Hans Petter Selasky
8abf5ac0e6 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.

MFC after:	1 week
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-07-12 14:22:33 +02:00
Hans Petter Selasky
42f719d611 mlx5ib: Extend parameter macros so that more arguments may be added.
MFC after:	1 week
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-07-12 14:22:33 +02:00
Hans Petter Selasky
e787b5acb1 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.

MFC after:	1 week
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-07-12 14:22:33 +02:00
Hans Petter Selasky
c3987b8ea7 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

MFC after:	1 week
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-07-12 14:22:33 +02:00
Hans Petter Selasky
4fb0a74e08 mlx5: Set default timestamp format for mlx5en(4) and mlx5ib.
MFC after:	1 week
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-07-12 14:22:33 +02:00
Hans Petter Selasky
915fc66cb5 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

MFC after:	1 week
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-07-12 14:22:33 +02:00
Hans Petter Selasky
d92a9e5604 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

MFC after:	1 week
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-07-12 14:22:32 +02:00
Hans Petter Selasky
d8cbfa101c 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.

MFC after:	1 week
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-07-12 14:22:31 +02:00
Hans Petter Selasky
4238b4a7a2 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

MFC after:	1 week
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-07-12 14:22:31 +02:00
Hans Petter Selasky
cf88b86e49 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

MFC after:	1 week
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-07-12 14:22:30 +02:00
Hans Petter Selasky
565cb4e8cc 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

MFC after:	1 week
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-07-12 14:22:29 +02:00
Hans Petter Selasky
21bc3710a4 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

MFC after:	1 week
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-07-12 14:22:29 +02:00
Hans Petter Selasky
4f4739a77b 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.

MFC after:	1 week
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-07-12 14:22:29 +02:00
Hans Petter Selasky
626cb01d44 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

MFC after:	1 week
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-07-12 14:22:29 +02:00
Hans Petter Selasky
a888087fba 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.

MFC after:	1 week
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-07-12 14:22:29 +02:00
Konstantin Belousov
78f5ebaed6 mlx5: drop Giant around VSC lock and CRSPACE enumeration on attach
This code practically has not sleeping points, so Giant is locked for very
long time.

Noted and reviewed by:	hselasky
MFC after:      1 week
Sponsored by:   Mellanox Technologies // NVIDIA Networking
2021-07-12 12:34:40 +03:00
Konstantin Belousov
8391db038d mlx5: add a knob to administratively disable mlx5 fw dump setup
MFC after:	1 week
Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-07-12 12:34:40 +03:00
Konstantin Belousov
0fc0b62b0f mlx5: Fix PBMC register mapping
Import Linux commit 534b1204ca4694db1093b15cf3e79a99fcb6a6da

Add reserved mapping to cover all the register in order to avoid setting
arbitrary values to newer FW which implements the reserved fields.

Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies // NVIDIA Networking
MFC after:	1 week
2021-07-12 12:34:40 +03:00
Konstantin Belousov
06a3fd0e5c mlx5: Fix PPLM register mapping
Import Linux commit ce28f0fd670ddffcd564ce7119bdefbaf08f02d3:
Add reserved mapping to cover all the register in order to avoid
setting arbitrary values to newer FW which implements the reserved
fields.

Taken from:	https://patches.linaro.org/patch/417255/
Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies // NVIDIA Networking
MFC after:	1 week
2021-07-12 12:34:40 +03:00
Konstantin Belousov
b1277d42d7 mlx5en: add ASCII art providing an overview of flow tables organization
Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies/NVidia Networking
MFC after:	1 week
2021-07-12 12:34:39 +03:00
Hans Petter Selasky
2f7ce2326f mlx5en: Add missing error case when creating VXLAN flow tables.
While at it remove redundant checks for IFCAP_VXLAN_HWCSUM flag.

MFC after:	1 week
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-07-12 12:34:39 +03:00
Hans Petter Selasky
1918b253d3 mlx5en: Fix for IPv6 VxLAN checksum offload.
Add missing check for IPv6 mbuf offload flags and remove L3 WQE checksum flag for IPv6.

MFC after:	1 week
Reviewed by:	kib
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-07-12 12:34:39 +03:00
Konstantin Belousov
48acda2b2d mlx5en: Honor IFCAP_VXLAN_HWCSUM
In particular, avoid creating TIR or installing flow rules for VXLAN
if the capability is disabled.

Reported and reviewed by:	hselasky
Sponsored by:	Mellanox Technologies/NVidia Networking
MFC after:	1 week
2021-07-12 12:34:39 +03:00
Konstantin Belousov
0e4cb0d5a4 mlx5en: remove all dynamic vxlan steering rules on close and reinstall on open
Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies/NVidia Networking
MFC after:	1 week
2021-07-12 12:34:39 +03:00
Konstantin Belousov
559eaa44d9 mlx5en: add mlx5e_add_vxlan_rule_from_db() helper
Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies/NVidia Networking
MFC after:	1 week
2021-07-12 12:34:39 +03:00
Konstantin Belousov
e012189d02 mlx5en: remove unneeded protocol and port parameters from mlx5e_add_vxal_rule
the values are already passed in the db element

Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies/NVidia Networking
MFC after:	1 week
2021-07-12 12:34:38 +03:00
Konstantin Belousov
859e41e901 mlx5: fix typo, KENREL_MIN_LEVEL->KERNEL_MIN_LEVEL
Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies/NVidia Networking
MFC after:	1 week
2021-07-12 12:34:38 +03:00
Konstantin Belousov
bf202a8d7a mlx5en: announce mce(4) capabilities for stateless VxLAN offloading
Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies/NVidia Networking
MFC after:	1 week
2021-07-12 12:34:38 +03:00
Konstantin Belousov
7c9febf9f1 mlx5en: handle checksum and TSO offloading for VxLAN packets on TX
Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies/NVidia Networking
MFC after:	1 week
2021-07-12 12:34:38 +03:00
Konstantin Belousov
149349e01e mlx5en: handle offloaded Rx checksums calculated for tunneled packets
Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies/NVidia Networking
MFC after:	1 week
2021-07-12 12:34:38 +03:00
Konstantin Belousov
fba6942f19 mlx5en: build TIRs to handle inner RSS
Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies/NVidia Networking
MFC after:	1 week
2021-07-12 12:34:38 +03:00
Konstantin Belousov
5e12b3bb43 mlx5en: allow software parser for created send queues
Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies/NVidia Networking
MFC after:	1 week
2021-07-12 12:34:37 +03:00
Konstantin Belousov
861a612d7b mlx5en: register vxlan start/stop handlers
Handlers maintain flow rules and inform hardware about non-standard VxLAN
port in use.  The database of the vxlan end points is maintained.

Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies/NVidia Networking
MFC after:	1 week
2021-07-12 12:34:37 +03:00
Konstantin Belousov
1b36b3869f mlx5en: eliminate magic constant
Use sizeof(struct udphdr) where appropriate

Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies/NVidia Networking
MFC after:	1 week
2021-07-12 12:34:37 +03:00
Konstantin Belousov
16816f9689 mlx5en: style, remove redundant parentheses
Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies/NVidia Networking
MFC after:	1 week
2021-07-12 12:34:37 +03:00
Konstantin Belousov
8b8c71d7ac mlx5en: increase the limit MLX5E_MAX_TX_HEADER
to accomodate for large inline headers for VxLAN TX

Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies/NVidia Networking
MFC after:	1 week
2021-07-12 12:34:37 +03:00
Konstantin Belousov
bc56a8f9e7 mlx5: Flow steering tree: increase number of supported flow tables from 3 to 5
Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies/NVidia Networking
MFC after:	1 week
2021-07-12 12:34:37 +03:00
Konstantin Belousov
c8bdc78be1 mlx5: cqe64: update the tunneled bit name with recent PRM
Reviewed by:	hselasky
Sponsored by:	Mellanox Technologies/NVidia Networking
MFC after:	1 week
2021-07-12 12:34:36 +03:00
Bjoern A. Zeeb
1411f52fac mlx4/OFED: replace the struct net_device with struct ifnet
Given all the code does operate on struct ifnet, the last step in this
longer series of changes now is to rename struct net_device to
struct ifnet (that is what it was defined to in the LinuxKPi code).
While mlx4 and OFED are "shared" code the decision was made years ago
to not write it based on the netdevice KPI but the native ifnet KPI
for most of it.  This commit simply spells this out and with that
frees "struct netdevice" to be re-done on LinuxKPI to become a more
native/mixed implementation over time as needed by, e.g., wireless
drivers.

Sponsored by:	The FreeBSD Foundation
MFC after:	10 days
Reviewed by:	hselasky
Differential Revision: https://reviews.freebsd.org/D30515
2021-06-18 21:20:08 +00:00
Bjoern A. Zeeb
4ded022d3b mlx5: remove dependency on ifnet specifics of linux/netdevice.h
Rename the last remaining bits depending on ifnet from linux/netdevice.h
instead of using the compat macros. This helps clearing up
struct netdevice being struct ifnet from linux/netdevice.h.

Sponsored-by:	The FreeBSD Foundation
MFC-after:	2 weeks
Reviewed-by:	hselasky, kib
X-D-R:		D29366
Differential Revision:	https://reviews.freebsd.org/D29497
2021-04-02 10:01:30 +00:00
Gleb Smirnoff
3f43ada98c Catch up with 6edfd179c8: mechanically rename IFCAP_NOMAP to IFCAP_MEXTPG.
Originally IFCAP_NOMAP meant that the mbuf has external storage pointer
that points to unmapped address.  Then, this was extended to array of
such pointers.  Then, such mbufs were augmented with header/trailer.
Basically, extended mbufs are extended, and set of features is subject
to change.  The new name should be generic enough to avoid further
renaming.
2021-01-29 11:46:24 -08:00
Hans Petter Selasky
b8051298b0 Fix missing value in uar_page field for ratelimit in mlx5en(4).
This is a regression issue after the new UAR API was introduced
by f8f5b459d2 .

MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-01-28 14:51:58 +01:00
Hans Petter Selasky
064009e794 Add support for enabling and disabling IFCAP_VLAN_HWTSO via
ifconfig(8) in mlx5en(4).

MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2021-01-25 11:28:05 +01:00
Hans Petter Selasky
e47a6525e7 Add missing init of new fields after new UAR API was introduced
by f8f5b459d2 in mlx5ib.

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking
2021-01-14 11:44:54 +01:00
Emmanuel Vadot
105a37cac7 linuxkpi: Add more pci functions needed by DRM
-pci_get_class : This function search for a matching pci device based on
   the class/subclass and returns a newly created pci_dev.
 - pci_{save,restore}_state : This is analogous to ours with the same name
 - pci_is_root_bus : Return true if this is the root bus
 - pci_get_domain_bus_and_slot : This function search for a matching pci
   device based on domain, bus and slot/function concat into a single
   unsigned int (devfn) and returns a newly created pci_dev
 - pci_bus_{read,write}_config* : Read/Write to the config space.

While here add some helper function to alloc and fill the pci_dev struct.

Reviewed by:   hselasky, bz (older version)
Differential Revision:	   https://reviews.freebsd.org/D27550
2021-01-12 12:31:00 +01:00
Hans Petter Selasky
431980466f Don't offset the UAR map twice in mlx5en(4).
The new UAR API already offsets the UAR map pointer the mlx5en(4) is using.
While at it remove some no longer needed variables for keeping track
of the current BF offset.

This fixes a regression issue after the new UAR allocation APIs
were introduced.

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking
2021-01-08 18:35:49 +01:00
Hans Petter Selasky
f8f5b459d2 Update user access region, UAR, APIs in the core in mlx5core.
This change include several changes as listed below all related to UAR.
UAR is a special PCI memory area where the so-called doorbell register and
blue flame register live. Blue flame is a feature for sending small packets
more efficiently via a PCI memory page, instead of using PCI DMA.

- All structures and functions named xxx_uuars were renamed into xxx_bfreg.
- Remove partially implemented Blueflame support from mlx5en(4) and mlx5ib.
- Implement blue flame register allocator.
- Use blue flame register allocator in mlx5ib.
- A common UAR page is now allocated by the core to support doorbell register
  writes for all of mlx5en and mlx5ib, instead of allocating one UAR per
  sendqueue.
- Add support for DEVX query UAR.
- Add support for 4K UAR for libmlx5.

Linux commits:
7c043e908a74ae0a935037cdd984d0cb89b2b970
2f5ff26478adaff5ed9b7ad4079d6a710b5f27e7
0b80c14f009758cefeed0edff4f9141957964211
30aa60b3bd12bd79b5324b7b595bd3446ab24b52
5fe9dec0d045437e48f112b8fa705197bd7bc3c0
0118717583cda6f4f36092853ad0345e8150b286
a6d51b68611e98f05042ada662aed5dbe3279c1e

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking
2021-01-08 13:33:46 +01:00
Hans Petter Selasky
3764792007 Fix whitespace in mlx5en(4).
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking
2021-01-08 13:33:46 +01:00
Hans Petter Selasky
9a47ae044b Bump driver versions for mlx5en(4) and mlx4en(4).
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking
2021-01-08 12:35:55 +01:00
Hans Petter Selasky
89c0b4fa11 Bump some copyrights in mlx5en(4).
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking
2021-01-08 12:35:55 +01:00
Hans Petter Selasky
a00718e1df Implement SIOCGIFRSSKEY and SIOCGIFRSSHASH and mlx5en(4).
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking
2021-01-08 12:35:55 +01:00
Hans Petter Selasky
480570dbb3 Fixes for SRIOV in mlx5core.
- call pci_iov_detach() on detaching from PCI device to take care of hang
  on destroying VFs after PF is down.

- disable eswitch SRIOV support right after pci_iov_detach(),
  else the eswitch cleanup sometimes occur while the SRIOV flow table
  is still present.

Submitted by: kib@
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking
2021-01-08 12:35:55 +01:00
Hans Petter Selasky
98140747ca Update the PCI ID list in mlx5core.
- Add descriptions for new devices.
- Add support for Bluefield.

MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking
2021-01-08 12:35:54 +01:00
Hans Petter Selasky
82c7abe778 The "unsigned" type is the same like "unsigned int".
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking
2021-01-08 12:35:54 +01:00
Hans Petter Selasky
87b3c8cc99 Fix spelling in mlx5core.
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking
2021-01-08 12:35:54 +01:00
Hans Petter Selasky
daa150aaa3 Properly handle case where firmware dump returns more registers on second pass
in mlx5core.

Submitted by: kib@
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking
2021-01-08 12:35:54 +01:00
Hans Petter Selasky
50a9f8bbc1 Downgrade error about missing VSC to warning and make messages consistent
in mlx5core.

Submitted by: kib@
MFC after: 1 week
Sponsored by: Mellanox Technologies // NVIDIA Networking
2021-01-08 12:35:53 +01:00
Hans Petter Selasky
9e7fa1e66c Collect statistics from all rate-limit queues in mlx5en(4).
MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-12-28 14:39:51 +01:00
Hans Petter Selasky
caf4397197 Remove erradic assert after SVN r367149 in mlx5en(4).
The ratelimit tags may be shared, especially for unlimited TLS
traffic, and then the refcount is allowed to be greater than one
when freeing the send tag.

MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-11-24 13:07:59 +00:00
Hans Petter Selasky
7eefcb5eea Make mlx5_cmd_exec_cb() a safe API in mlx5core.
APIs that have deferred callbacks should have some kind of cleanup
function that callers can use to fence the callbacks. Otherwise things
like module unloading can lead to dangling function pointers, or worse.

The IB MR code is the only place that calls this function and had a
really poor attempt at creating this fence. Provide a good version in
the core code as future patches will add more places that need this
fence.

Linux commit:
e355477ed9e4f401e3931043df97325d38552d54

MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-11-16 10:15:03 +00:00
Hans Petter Selasky
f34f0a65b2 Report EQE data upon CQ completion in mlx5core.
Report EQE data upon CQ completion to let upper layers use this data.

Linux commit:
4e0e2ea1886afe8c001971ff767f6670312a9b04

MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-11-16 10:10:53 +00:00
Hans Petter Selasky
ffdb195f31 Enhance the mlx5_core_create_cq() function in mlx5core.
Enhance mlx5_core_create_cq() to get the command out buffer from the
callers to let them use the output.

Linux commit:
38164b771947be9baf06e78ffdfb650f8f3e908e

MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-11-16 10:06:10 +00:00
Hans Petter Selasky
4a64b690f1 Use mlx5core to create/destroy all Dynamically Connected Targets, DCTs.
To prevent a hardware memory leak when a DEVX DCT object is destroyed
without calling drain DCT before, (e.g. under cleanup flow), need to
manage its creation and destruction via mlx5 core.

Linux commit:
c5ae1954c47d3fd8815bd5a592aba18702c93f33

MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-11-16 10:03:18 +00:00
Hans Petter Selasky
8114aeea44 Fix error handling order in create_kernel_qp in mlx5ib.
Make sure order of cleanup is exactly the opposite of initialization.

Linux commit:
f4044dac63e952ac1137b6df02b233d37696e2f5

MFC after:	1 week
Sponsored by:	Mellanox Technologies // NVIDIA Networking
2020-11-16 10:00:21 +00:00
Konstantin Belousov
0b8e170d95 mlx5en: Set ifmr_current same as ifmr_active.
This both:
- makes ifconfig media line similar to that of other drivers.
- fixes ENXIO in case when paradoxical current media word is not registered.

Now e.g.
      ifconfig mce0 -mediaopt txpause,rxpause
works by disabling pauses if enabled.

Sponsored by:	Mellanox Technologies/NVidia Networking
MFC after:	1 week
2020-11-12 02:25:10 +00:00