Commit graph

71 commits

Author SHA1 Message Date
Doug Moore c8b0c33b03 log2: move log2 functions from linuxkpi to libkern
Linux has a header file that defines an ilog2 function and some simple
functions/macros that use it: roundup_pow_of_two, is_power_of_2,
rounddown_pow_of_two, and order_base_2.  This change moves three of
those simple functions (all but is_power_of_2) from linuxkpi to
libkern.  It also deletes a few implementations of these functions
that have previously been copied into code for various device drivers,
so that they can use the libkern version.  The is_power_of_2 macro was
not moved because powerof2 in param.h provides almost the same service
already (except that they disagree about whether 0 is a power of two).

Since the linux definitions of these functions were copied into
FreeBSD 11 years ago, linux has improved them, and this change
provides those improvements.  In particular, a giant table of log
values for evaluating ilog2 for constant values is no longer
necessary.

Reviewed by:	alc, markj (previous version)
Differential Revision:	https://reviews.freebsd.org/D45536
2024-06-24 02:00:31 -05:00
Mark Johnston 801b12ba89 qlnx: Use device_set_descf()
No functional change intended.

MFC after:	1 week
2024-06-02 19:38:41 -04:00
Keith Reynolds 1c45a62a2f qlnxe: Fix multiple locking issues
Multiple issues are reported with WITNESS and code inspection of the
locking and lock initialization.

PR:		278084
MFC after:	1 week
2024-05-27 23:41:05 -07:00
Kevin Bowling fb78e20b4e Revert "qlnxe: Fix multiple locking issues"
This commit is missing a file, revert so I can do it correctly,
atomically.

This reverts commit 29684d08fa.
2024-05-27 23:39:23 -07:00
Keith Reynolds 29684d08fa qlnxe: Fix multiple locking issues
Multiple issues are reported with WITNESS and code inspection of the
locking and lock initialization.

PR:		278084
MFC after:	1 week
2024-05-27 23:13:10 -07:00
Keith Reynolds e3ec564ecb qlnxe: Fix promiscuous and allmulti settings
PR:		278087
MFC after:	1 week
2024-05-27 22:57:44 -07:00
Fuqian Huang 9370f49ad1 qlnx: qlnxe: Fix kernel address leakage
In function qlnx_rdma_deregister_if,
the address of object rdma_if will be printed out.
rdma_if is the address of a global variable qlnxr_drv,
which is passed from dev/qlnx/qlnxr/qlnxr_os.c
A kernel address leakage happens.
Fix this by removing the printf statement.

PR:		238646
MFC after:	1 week
2024-05-27 22:45:52 -07:00
Jose Luis Duran 44bb80b0ad qlnx: Fix typo (triple M)
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/963
2024-02-02 18:35:00 -07:00
John Baldwin be909a79a8 qlnx: Fix a couple of type mismatches in function declarations
Reported by:	GCC 13 via -Wenum-int-mismatch
Reviewed by:	imp, emaste
Differential Revision:	https://reviews.freebsd.org/D42586
2023-11-14 18:37:06 -08: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 2ff63af9b8 sys: Remove $FreeBSD$: one-line .h pattern
Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/
2023-08-16 11:54:18 -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
Jessica Clarke 5684c8783b qlnxe: Add missing #ifdef INET to fix amd64 LINT-NOINET/NOIP builds
The approach here is copied directly from qlxgb.

Fixes:	b0d3d44dfe ("qlnxe: add driver to amd64 NOTES")
2023-07-08 00:54:07 +01:00
Mark O'Donovan 406ff3d57e Simplify buffer count calculation
Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/778
2023-07-07 16:36:28 -06:00
Mark O'Donovan 0b53a9971e Remove duplicate #include
Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/778
2023-07-07 16:36:28 -06:00
Mark O'Donovan 6f9388d505 qlnxe: remove unused variable from ecore_ll2.c
Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/779
2023-07-01 11:07:00 -06:00
Mark O'Donovan e4017d9b69 qlnxe: Fix building as in-kernel component
Add some extra files for building the driver as part of the kernel.
Change some #defines to match those used when building as a module.

PR: 268354

Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/779
2023-07-01 11:06:59 -06:00
Mark O'Donovan dc58675cfb qlnxe: Fix unused but set variable warning
Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/779
2023-07-01 11:06:58 -06:00
Mark O'Donovan b75c387a66 qlnxe: Remove #ifdef ECORE_PACKAGE
I do not know why this is here but it blocks compilation.
Removing it makes the builtin option the same as the module build

Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/779
2023-07-01 11:06:57 -06:00
Mark O'Donovan c1be7151d5 qlnxe: Fix too many args in call to internal_ram_wr()
internal_ram_wr() only takes 3 args when ECORE_CONFIG_DIRECT_HWFN
is defined

Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/779
2023-07-01 11:06:56 -06:00
Mark O'Donovan 99e5ffe1ba qlnxe: Move sriov includes to qlnx_os.c
SRIOV is being enabled in ecore.h but by then
the qlnx_os.h header has been processed and not
included the relevant headers

Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/779
2023-07-01 11:06:56 -06:00
Mark O'Donovan 134b093699 qlnxe: Remove -Wno-case-qual from module build
Signed-off-by: Mark O'Donovan <shiftee@posteo.net>
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/779
2023-07-01 11:06:55 -06:00
Justin Hibbits 727bfe3894 Mechanically convert qlnx(4) to IfAPI
Reviewed By:	zlei
Sponsored by:	Juniper Networks, Inc.
Differential Revision: https://reviews.freebsd.org/D37856
2023-03-24 10:09:53 -04:00
Elliott Mitchell 21e0b50796 qlnxr: cleanup secondary effects from EOL purge
DEFINE_ALLOC_MR became unconditionally true, but it isn't used anywhere
now.  Several places depended upon DEFINE_IB_FAST_REG, but that is now
always false.
Similarly DEFINE_IB_UMEM_WITH_CHUNK became always false/undefined.
DEFINE_IB_AH_ATTR_WITH_DMAC is now unconditionally true.

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
Elliott Mitchell bbe35708ad qlnx: purge EOL release compatibility
Drop code that supproted FreeBSD 10 and 11.

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:08 -07:00
Gordon Bergling 5daf88ea5e qlnxe(4): Fix a typo in a source code comment
- s/defult/default/

MFC after:	3 days
2022-10-26 17:27:07 +02:00
Gordon Bergling a5c1b9e332 qlnxe(4): Fix a typo in a source code comment
- s/paramters/parameters/

MFC after:	3 days
2022-09-15 10:31:05 +02:00
Gordon Bergling 37519e3ff3 qlnxe(4): Fix a typo in a source code comment
- s/pedning/pending/

MFC after:	3 days
2022-07-31 11:35:07 +02:00
Gordon Bergling a87f167c41 qlnxe(4): Fix a typo in a source code comment
- s/indepent/independent/

MFC after:	3 days
2022-06-05 09:15:33 +02:00
John Baldwin 2f87208e2d qlnx/qlxgb/qlxgbe/qlxge: Remove unused devclass arguments to DRIVER_MODULE. 2022-05-09 12:22:03 -07:00
Gordon Bergling 78fc83f096 qlnxe(4): Fix a typo in a source code comment
- s/mulitple/multiple/

MFC after:	3 days
2022-04-09 09:29:35 +02:00
John Baldwin eb147f78a4 qlnx: Mark variables only used in debug traces as unused. 2022-04-07 17:01:28 -07:00
John Baldwin ee07d71213 qlnx: Return error from qlnxr_mod_load if it fails.
Fix qlnx_rdma_register_if return ENXIO rather than -1 on error and
propagate that error to the caller in qlnxr_mod_load.
2022-04-07 17:01:27 -07:00
John Baldwin 885db9301e qlnx: Comment out remaining references to tx_data_bd. 2022-04-07 17:01:27 -07:00
John Baldwin 3415775dfa qlnx: Move all references to total_rx_count under #ifdef QLNX_SOFT_LRO. 2022-04-07 17:01:27 -07:00
John Baldwin 91aa93eb67 qlnx: Remove unused variables. 2022-04-07 17:01:27 -07:00
Gordon Bergling a216b9c2e0 qlnxe(4): Fix a typo in a source code comment
- s/existance/existence/

MFC after:	3 days
2022-03-28 19:31:18 +02: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
Gordon Bergling 957d9ba0c3 qlnxe: Fix typos in two error messages
- s/erorr/error/

MFC after:	1 week
2021-10-02 10:49:51 +02:00
Gordon Bergling 5bdf58e196 Fix some common typos in source code comments
- s/priviledged/privileged/
- s/funtion/function/
- s/doens't/doesn't/
- s/sychronization/synchronization/

MFC after:	3 days
2021-08-28 18:57:23 +02: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 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
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 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
Mark Johnston 56cbd386fb qlnxr: Properly initialize the Linux device structure
The driver needs to provide a LinuxKPI device structure to register
itself with the IB subsystem.  It was erroneously using a copy of its
FreeBSD device structure for this purpose.

Use linux_pci_attach_device() instead, following the example of the
Chelsio iwarp driver.  Also ensure that we don't leak the faked device
during detach.

Reviewed by:	hselasky
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D29595
2021-04-12 09:32:08 -04:00
Bjoern A. Zeeb 6c8dd7c863 qlnxr: remove netdevice.h
Remove unused #includes of a LinuxKPI header noticed while trying to
solve LinuxKPI struct net_device and related functions.
This takes qlnxr out of the picture of D29366.

Sponsored-by:	The FreeBSD Foundation
MFC-after:	2 weeks
X-D-R:		D29366 (extracted as further cleanup)
2021-03-26 17:17:10 +00:00
Bjoern A. Zeeb 5df6f7a840 qlnxr: remove duplicate defines
upper_32_bits() and lower_32_bits() are defined twice in this file.
With the extra conditinal removed on LinuxKPI in 3b1ecc9fa1
they are also included from there already.  Use the LinuxKPI version
and remove the two local ones.

Sponsored-by:	The FreeBSD Foundation
Reviewed-by:	hselasky
MFC-after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D29392
2021-03-24 23:03:30 +00:00
Mateusz Guzik 3720573374 qlnx: clean up empty lines in .c and .h files 2020-09-01 21:57:33 +00:00
Emmanuel Vadot 1d7d49c360 qnlx: Do not redifines types.
r360870 added linux/slab.h into liunx/bitmap.h and this include linux/types.h
The qlnx driver is redefining some of those types so remove them and add an
explicit linux/types.h include.

Pointy hat: manu
Reported by:	Austin Shafer <ashafer@badland.io>
2020-05-10 14:09:30 +00:00
Pawel Biernacki 7029da5c36 Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)
r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are
still not MPSAFE (or already are but aren’t properly marked).
Use it in preparation for a general review of all nodes.

This is non-functional change that adds annotations to SYSCTL_NODE and
SYSCTL_PROC nodes using one of the soon-to-be-required flags.

Mark all obvious cases as MPSAFE.  All entries that haven't been marked
as MPSAFE before are by default marked as NEEDGIANT

Approved by:	kib (mentor, blanket)
Commented by:	kib, gallatin, melifaro
Differential Revision:	https://reviews.freebsd.org/D23718
2020-02-26 14:26:36 +00:00