Commit graph

608 commits

Author SHA1 Message Date
Ariel Ehrenberg
b0b932804b mlx5: Fix handling of port_module_event
(cherry picked from commit 253a1fa16b98ac5f73f0820cfdd4f5ad7378757a)
2024-11-30 02:34:54 +02:00
Konstantin Belousov
8925ea58c2 mlx5en: improve reporting of kernel TLS, IPSEC offload, and ratelimit caps
Sponsored by:	NVidia networking

(cherry picked from commit de7a92756f0ab50e5e243ce9ac680e27f5c41370)
2024-11-19 07:20:09 +02:00
Konstantin Belousov
5b1211bb35 mlx5en: limit reporting eeprom read failure due to unplugged module to verboseboot
(cherry picked from commit 2204a4829083bf2a40304ea873d287a5498973d7)
2024-08-06 05:46:26 +03:00
Zhenlei Huang
6b1f530935 net: Remove unneeded NULL check for the allocated ifnet
Change 4787572d05 made if_alloc_domain() never fail, then also do the
wrappers if_alloc(), if_alloc_dev(), and if_gethandle().

No functional change intended.

Reviewed by:	kp, imp, glebius, stevek
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D45740

(cherry picked from commit aa3860851b9f6a6002d135b1cac7736e0995eedc)
2024-07-12 20:03:37 +08:00
Kristof Provost
9c86768b14 mlx5: handle vlan PF restrictions
Reviewed by:	kib
MFC after:	2 weeks
Sponsored by:	Orange Business Services
Differential Revision:	https://reviews.freebsd.org/D45427

(cherry picked from commit 7deadea2eb0aca0b83657d30f895d98795d9d81f)
2024-07-01 18:06:09 +02:00
Zhenlei Huang
d98ced6588 mlx4, mlx5: Eliminate redundent NULL check for packet filter
mlx4 and mlx5 are Ethernet devices and ether_ifattach() does an
unconditional bpfattach(). From commit 16d878cc99 [1] and on, we
should not check ifp->if_bpf to tell us whether or not we have any bpf
peers that might be interested in receiving packets. And since commit
2b9600b449 [2], ifp->if_bpf can not be NULL even after the network
interface has been detached.

No functional change intended.

1. 16d878cc99 Fix the following bpf(4) race condition which can result in a panic
2. 2b9600b449 Add dead_bpf_if structure, that should be used as fake bpf_if during ifnet detach

Reviewed by:	kp, kib
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D45196

(cherry picked from commit 2439ae948352766f6b993c5103a4c516376bec28)
2024-06-05 12:27:11 +08:00
Konstantin Belousov
ddabe1d3c5 mlx5en: add diagnostic in one more case of failed eeprom read preparation
(cherry picked from commit c097967b9af946cf46246cce5adde53f7e955ecc)
2024-05-13 12:51:29 +03:00
Mark Johnston
d87ebf35c8 mlx5: Zero DMA memory mlx5_alloc_cmd_msg() and alloc_cmd_page()
These functions may map more memory for DMA than is actually used, since
the allocator operates on multiples of a 4KB page size.  Thus,
bus_dmamap_sync() can trigger KMSAN reports when the unused portion of
a page is not zero-ed.

Reported by:	KMSAN
Reviewed by:	kib
MFC after:	2 weeks
Sponsored by:	Klara, Inc.
Sponsored by:	Juniper Networks, Inc.
Differential Revision:	https://reviews.freebsd.org/D43133

(cherry picked from commit 47a6fb9d5a2ebec12114a604053ffbd2929f0021)
2024-02-01 09:02:48 -05:00
Konstantin Belousov
a76475313d mlx5(4): only detach IOV children if iov was successfully initialized
(cherry picked from commit 987446fa39e8f6887ea16ad49f00f699b2efd210)
2024-01-11 18:46:52 +02:00
Patrisious Haddad
0312449c67 mlx5: Fix HCA cap 2 query
(cherry picked from commit 0cd90ee598cef68cef72db8b912241868d1067d0)
2023-12-06 02:27:14 +02:00
Martin Matuska
ac83e415ef mlx5_core: fix deadlock when using RXTLS
If removing a node of type FS_TYPE_FLOW_DEST we lock the flow group too
late. This can lead to a deadlock with fs_add_dst_fg().

PR:		274715
Reviewed by:	kib
Tested by:	mm
Differential Revision: https://reviews.freebsd.org/D42368

(cherry picked from commit a592812327deaf69ab226afc5c8a01af43dc03c2)
2023-11-22 09:00:23 +01:00
Konstantin Belousov
8377dd1c9a mlx5core: add linux/bitops.h include for mlx5_ifc.h use of BIT()
(cherry picked from commit 97beac79edf450851474934199e504e6244a7116)
2023-11-22 03:40:28 +02:00
Patrisious Haddad
588203bfbd mlx5: Introduce new destination type TABLE_TYPE
(cherry picked from commit 7b959396ca6fae5635260131eedb9bc19f2726a3)
2023-11-22 03:40:28 +02:00
Konstantin Belousov
d826188941 mlx5ib: adjust for the mlx5_create_auto_grouped_flow_table() interface change
(cherry picked from commit b94ef2a3bcbb369d85b276a45504d42f2f2cd369)
2023-11-22 03:40:28 +02:00
Mark Bloch
e073fccf14 mlx5: add ability to attach flow counter to steering rule
(cherry picked from commit ad744541311bfddd74ea3c5d49d52a4c366b9762)
2023-11-22 03:40:28 +02:00
Raed Salem
52164cb3bd mlx5: add fs_counters
(cherry picked from commit 35bbcf0916992d77fe1521962db42b3106a701fb)
2023-11-22 03:40:28 +02:00
Mark Bloch
5a2ff1f03a mlx5: Add a no-append flow insertion mode
(cherry picked from commit 6a6af22b6ec42eb0436381fae8dd1b86bc4c6327)
2023-11-22 03:40:28 +02:00
Mark Bloch
67a9c8868a net/mlx5: Allow creating autogroups with reserved entries
(cherry picked from commit 0a5db6bb3a953bd22f53f3607ae6853487548532)
2023-11-22 03:40:28 +02:00
Mark Bloch
4c6a46cea4 net/mlx5: Fix auto group size calculation
(cherry picked from commit 04db54fe4309e896c4c80baadbcc47b171722027)
2023-11-22 03:40:28 +02:00
Mark Bloch
0759f76e57 mlx5: Use software enum in APIs instead of PRM
(cherry picked from commit 76ed99ed8ad259792fea752461e2cd1ed481e8e1)
2023-11-22 03:40:28 +02:00
Mark Bloch
6fb2eebf64 mlx5: Add packet reformat support to flow rules
(cherry picked from commit 45e2e55df665c9b5749c9f2269d1b804147917eb)
2023-11-22 03:40:27 +02:00
Mark Bloch
8895a05096 mlx5: Add modify header support to flow rules
(cherry picked from commit 847542c60c2b3d922d636cc36ce51714032f9825)
2023-11-22 03:40:27 +02:00
Mark Bloch
08e7b322db mlx5: Refactor flow actions into a struct
(cherry picked from commit cb054a493a95cbd5a4b00c693c3924622914c51a)
2023-11-22 03:40:27 +02:00
Mark Bloch
87d86f3733 mlx5: Add packet reformat allocation support
(cherry picked from commit bb4645b95b0b3976decb4e68934b2e5cc002c53d)
2023-11-22 03:40:27 +02:00
Mark Bloch
2b729c222d mlx5: Add modify header support
(cherry picked from commit e4f84168b3c8bf99297dda712b147906d463b20e)
2023-11-22 03:40:27 +02:00
Yishai Hadas
f521f9c178 mlx5ib: Fix RSS Toeplitz setup to be aligned with the HW specification
The specification for the Toeplitz function doesn't require to set the key
explicitly to be symmetric. In case a symmetric functionality is required
a symmetric key can be simply used.

Wrongly forcing the algorithm to symmetric causes the wrong packet
distribution and a performance degradation.

Link: https://lore.kernel.org/r/20190723065733.4899-7-leon@kernel.org
Fixes: 28d6137008b2 ("IB/mlx5: Add RSS QP support")
Signed-off-by: Yishai Hadas <yishaih@mellanox.com>
Reviewed-by: Alex Vainman <alexv@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>

[khng: cherry-picked from Linux
b7165bd0d6cbb93732559be6ea8774653b204480]

Sponsored by:	Juniper Networks, Inc.
MFC after:      7 days
Reviewed by:	kib, zlei
Differential Revision:	https://reviews.freebsd.org/D42178

(cherry picked from commit 813d981e1e78daffde4b2a05df35d054fcb4343f)
2023-11-04 15:22:18 -04:00
Ka Ho Ng
83dbc1dc8b mlx5ib: Fix ethertype to be ETH_P_IPV6
Sponsored by:	Juniper Networks, Inc.
MFC after:	7 days
Reviewed by:	ae, kib, zlei
Differential Revision:	https://reviews.freebsd.org/D42184

(cherry picked from commit 3b173281764ba7c02f9de0a67caa1c4eca604413)
2023-11-04 15:22:18 -04:00
Warner Losh
685dc743dc sys: Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:54:36 -06:00
Warner Losh
95ee2897e9 sys: Remove $FreeBSD$: two-line .h pattern
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
2023-08-16 11:54:11 -06:00
Hans Petter Selasky
1943c40cd6 mlx5en(4): Don't wait for receive queue to fill up with mbufs during open channels.
Failure to get mbufs may be transient.
Don't permanently fail to open the channels due to lack of mbufs.
This also makes modifying channel parameters faster.

MFC after:	1 week
Sponsored by:	NVIDIA Networking
2023-04-18 15:01:07 +02:00
Hans Petter Selasky
6bd4bb9bdb mlx5en(4): Explain why CQE zipping is off.
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2023-04-18 15:01:07 +02:00
Hans Petter Selasky
80b4ef6d10 mlx5: Remove unused debugfs node pointers.
No functional change intended.

MFC after:	1 week
Sponsored by:	NVIDIA Networking
2023-04-18 15:01:07 +02:00
Hans Petter Selasky
aa7bbdabde mlx5: Implement diagostic counters as sysctl(8) nodes.
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2023-04-18 15:01:07 +02:00
Hans Petter Selasky
95bf70a4bf mlx5: Don't give zero number of pages to the firmware.
Can happen when using virtual mlx5_core<N> functions, VFs.

MFC after:	1 week
Sponsored by:	NVIDIA Networking
2023-04-18 15:01:06 +02:00
Hans Petter Selasky
273bfac08f mlx5: Implement mlx5_core_modify_cq_by_mask().
Implement one CQ modify function supporting all firmware versions,
instead of having more variants of CQ modify.

MFC after:	1 week
Sponsored by:	NVIDIA Networking
2023-04-18 15:01:06 +02:00
Hans Petter Selasky
2f7e9a8a21 mlx5: Fix duplicate free of default flow rule in error case.
MFC after:	1 week
Sponsored by:	NVIDIA Networking
2023-04-18 15:01:06 +02:00
Hans Petter Selasky
b0b87d9151 mlx5: Make mlx5_del_flow_rule() NULL safe.
This change factors out repeated NULL checks.

No functional change intended.

MFC after:	1 week
Sponsored by:	NVIDIA Networking
2023-04-18 15:01:06 +02:00
Hans Petter Selasky
3bb3e4768f mlx5: Make MLX5_COMP_EQ_SIZE tunable.
When using hardware pacing, this value can be increased, because more SQ's
means more EQ events aswell. Make it tunable, hw.mlx5.comp_eq_size .

MFC after:	1 week
Sponsored by:	NVIDIA Networking
2023-04-18 15:01:06 +02:00
Gleb Smirnoff
a6b55ee6be net: replace IFF_KNOWSEPOCH with IFF_NEEDSEPOCH
Expect that drivers call into the network stack with the net epoch
entered. This has already been the fact since early 2020. The net
interrupts, that are marked with INTR_TYPE_NET, were entering epoch
since 511d1afb6b. For the taskqueues there is NET_TASK_INIT() and
all drivers that were known back in 2020 we marked with it in
6c3e93cb5a. However in e87c494015 we took conservative approach
and preferred to opt-in rather than opt-out for the epoch.

This change not only reverts e87c494015 but adds a safety belt to
avoid panicing with INVARIANTS if there is a missed driver. With
INVARIANTS we will run in_epoch() check, print a warning and enter
the net epoch.  A driver that prints can be quickly fixed with the
IFF_NEEDSEPOCH flag, but better be augmented to properly enter the
epoch itself.

Note on TCP LRO: it is a backdoor to enter the TCP stack bypassing
some layers of net stack, ignoring either old IFF_KNOWSEPOCH or the
new IFF_NEEDSEPOCH.  But the tcp_lro_flush_all() asserts the presence
of network epoch.  Indeed, all NIC drivers that support LRO already
provide the epoch, either with help of INTR_TYPE_NET or just running
NET_EPOCH_ENTER() in their code.

Reviewed by:		zlei, gallatin, erj
Differential Revision:	https://reviews.freebsd.org/D39510
2023-04-17 09:08:35 -07:00
Zhenlei Huang
da4068c4e1 mlx5ib(4): Mark driver knows net epoch
This driver has already been EPOCH(9) aware since e48813009c.

Reviewed by:	hselasky
Tested by:	hselasky
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D39406
2023-04-06 00:08:23 +08:00
Justin Hibbits
70510800d1 mlx5: Enter network epoch when using if_foreach()
Summary: IFNET_RLOCK() is not sufficient, the epoch needs entered.

Reviewed by:	hselasky
Sponsored by:	Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D38711
2023-03-06 11:04:15 -05:00
Justin Hibbits
5dc00f00b7 Mechanically convert mlx5en(4) to IfAPI
Reviewed by:	zlei
Sponsored by:	Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D38595
2023-02-15 09:32:41 -05:00
Gleb Smirnoff
caf32b260a pfil: add pfil_mem_{in,out}() and retire pfil_run_hooks()
The 0b70e3e78b changed the original design of a single entry point
into pfil(9) chains providing separate functions for the filtering
points that always provide mbufs and know the direction of a flow.
The motivation was to reduce branching.  The logical continuation
would be to do the same for the filtering points that always provide
a memory pointer and retire the single entry point.

o Hooks now provide two functions: one for mbufs and optional for
  memory pointers.
o pfil_hook_args() has a new member and pfil_add_hook() has a
  requirement to zero out uninitialized data. Bump PFIL_VERSION.
o As it was before, a hook function for a memory pointer may realloc
  into an mbuf.  Such mbuf would be returned via a pointer that must
  be provided in argument.
o The only hook that supports memory pointers is ipfw:default-link.
  It is rewritten to provide two functions.
o All remaining uses of pfil_run_hooks() are converted to
  pfil_mem_in().
o Transparent union of pfil_packet_t and tricks to fix pointer
  alignment are retired. Internal pfil_realloc() reduces down to
  m_devget() and thus is retired, too.

Reviewed by:		mjg, ocochard
Differential revision:	https://reviews.freebsd.org/D37977
2023-02-14 10:02:49 -08:00
Elliott Mitchell
1c5e687117 mlx5: purge EOL release compatibility
Remove FreeBSD 10 support code

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/603
Differential Revision: https://reviews.freebsd.org/D35560
2023-02-04 09:13:09 -07:00
Konstantin Belousov
01143ba118 ifcapnv: fix IFCAP2 usage
IFCAP2_XXX constants are integers, they do not need shift for the
definition.  But their usage as bitmask for if_capenable2 does require
shift.  Add convenience macro IFCAP2_BIT() for consumers.

Fix the only existing consumer, mlx5(4) RXTLS enable bits.

Reported by:	jhb
Reviewed by:	jhb, jhibbits, hselasky
Coverity CID:	1501659
Sponsored by:	NVIDIA networking
Differential revision:	https://reviews.freebsd.org/D37862
2023-01-03 11:48:16 +02:00
John Baldwin
47cc457bd6 mlx5: Fix mismatch in array bounds.
Reported by:	GCC -Warray-parameter
Reviewed by:	hselasky, imp, emaste (earlier version)
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D37549
2022-12-07 12:32:54 -08:00
John Baldwin
f49fd63a6a kmem_malloc/free: Use void * instead of vm_offset_t for kernel pointers.
Reviewed by:	kib, markj
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D36549
2022-09-22 15:09:19 -07:00
Randall Stewart
7cc3ea9c6f mlx5 M_TSTMP accuracy looses quite a bit of precision so lets fix it.
The way that the clock is synchronized between the system and the current mlx5 for the purposes of the M_TSTMP
being carried we loose a lot of precision. Instead lets change the math that calculates this to separate out
the seconds/nanoseconds and operate on the two values so we don't get overflow instead of just
shifting the value down and loosing precision.

Reviewed by: kib, hselasky
Sponsored by: Netflix Inc
Differential Revision: https://reviews.freebsd.org/D36327
2022-09-20 13:12:16 -04:00
Gordon Bergling
e1a40dd294 mlx5en(4): Correct a typo in a kernel error message
- s/ouput/output

MFC after:	5 days
2022-09-03 19:29:33 +02:00
Gordon Bergling
a4181a3ec3 mlx5en(4): Fix a typo in a source code comment
- s/functino/function/

MFC after:	3 days
2022-07-31 10:28:20 +02:00