Commit graph

33 commits

Author SHA1 Message Date
Doug Moore b0056b31e9 libkern: add ilog2 macro
The kernel source contains several definitions of an ilog2 function;
some are slower than necessary, and one of them is incorrect.
Elimininate them all and define an ilog2 macro in libkern to replace
them, in a way that is fast, correct for all argument types, and, in a
GENERIC kernel, includes a check for an invalid zero parameter.

Folks at Microsoft have verified that having a correct ilog2
definition for their MANA driver doesn't break it.

Reviewed by:	alc, markj, mhorne (older version), jhibbits (older version)
Differential Revision:	https://reviews.freebsd.org/D45170
Differential Revision:	https://reviews.freebsd.org/D45235
2024-06-03 11:37:55 -05:00
Jose Luis Duran 6cd48617c4 qat: Fix typo (triple S)
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/955
2023-12-27 20:24:31 -07:00
Gordon Bergling ada4cd3f77 qat: Fix two typos in source code comments
- s/parmeters/parameters/

MFC after:	3 days
2023-12-17 15:18:57 +01:00
Warner Losh fdafd315ad sys: Automated cleanup of cdefs and other formatting
Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by:		Netflix
2023-11-26 22:24:00 -07:00
Piotr Kasierski 22cf89c938 qat: Intel 4xxx Series driver API extension
This commit introduces:
- Quick Assist API update for partial decompress and zero padding.
- Refactor of UIO locking.
- VF driver hotplug fix.
- Minor code style fixes for firmware API.

Patch co-authored by: Krzysztof Zdziarski <krzysztofx.zdziarski@intel.com>
Patch co-authored by: Michal Gulbicki <michalx.gulbicki@intel.com>
Patch co-authored by: Piotr Kasierski <piotrx.kasierski@intel.com>
Patch co-authored by: Karol Grzadziel <karolx.grzadziel@intel.com>

Sponsored by:	Intel Corporation
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D41613
2023-09-06 10:00:59 -04:00
Warner Losh 71625ec9ad sys: Remove $FreeBSD$: one-line .c comment pattern
Remove /^/[*/]\s*\$FreeBSD\$.*\n/
2023-08-16 11:54:24 -06:00
Krzysztof Zdziarski 266b0663c5 qat: Add Intel® 4xxx Series VF driver support
Overview:
Intel(R) QuickAssist Technology (Intel(R) QAT) provides hardware
acceleration for offloading security, authentication and compression
services from the CPU, thus significantly increasing the performance and
efficiency of standard platform solutions.

This commit introduces:
- Intel® 4xxx Series VF driver support.
- Device configurability via sysctls.
- UIO support for Intel® 4xxx Series devices.

Patch co-authored by: Krzysztof Zdziarski <krzysztofx.zdziarski@intel.com>
Patch co-authored by: Michal Gulbicki <michalx.gulbicki@intel.com>
Patch co-authored by: Julian Grajkowski <julianx.grajkowski@intel.com>
Patch co-authored by: Piotr Kasierski <piotrx.kasierski@intel.com>
Patch co-authored by: Lukasz Kolodzinski <lukaszx.kolodzinski@intel.com>
Patch co-authored by: Karol Grzadziel <karolx.grzadziel@intel.com>

Sponsored by:	Intel Corporation
Differential Revision: https://reviews.freebsd.org/D39850
2023-06-12 13:44:01 -04:00
Krzysztof Zdziarski c0a4a7bb94 qat: Fixed Coverity reported issue
This patch provides fixes for following Coverity issues:
CID 1504073
CID 1504075
CID 1504076
CID 1504077

Patch co-authored by: Krzysztof Zdziarski <krzysztofx.zdziarski@intel.com>
Patch co-authored by: Michal Gulbicki <michalx.gulbicki@intel.com>
Patch co-authored by: Julian Grajkowski <julianx.grajkowski@intel.com>
Patch co-authored by: Piotr Kasierski <piotrx.kasierski@intel.com>
Patch co-authored by: Lukasz Kolodzinski <lukaszx.kolodzinski@intel.com>
Patch co-authored by: Karol Grzadziel <karolx.grzadziel@intel.com>

Fixes:		a977168c48 ("qat: Add Intel® 4xxx Series platform support")
Reviewed by:	markj
Sponsored by:   Intel Corporation
Differential Revision: https://reviews.freebsd.org/D38339
2023-02-01 11:02:08 -05:00
Michal Gulbicki a977168c48 qat: Add Intel® 4xxx Series platform support
Overview:
Intel(R) QuickAssist Technology (Intel(R) QAT) provides hardware
acceleration for offloading security, authentication and compression
services from the CPU, thus significantly increasing the performance and
efficiency of standard platform solutions.

This commit introduces:
- Intel® 4xxx Series platform support.
- QuickAssist kernel API implementation update for Generation 4 device.
  Enabled services: symmetric cryptography and data compression.
- Increased default number of crypto instances in static configuration
  for performance purposes.

OCF backend changes:
- changed GCM/CCM MAC validation policy to generate MAC by HW
  and validate by SW due to the QAT HW limitations.

Patch co-authored by: Krzysztof Zdziarski <krzysztofx.zdziarski@intel.com>
Patch co-authored by: Michal Jaraczewski <michalx.jaraczewski@intel.com>
Patch co-authored by: Michal Gulbicki <michalx.gulbicki@intel.com>
Patch co-authored by: Julian Grajkowski <julianx.grajkowski@intel.com>
Patch co-authored by: Piotr Kasierski <piotrx.kasierski@intel.com>
Patch co-authored by: Adam Czupryna <adamx.czupryna@intel.com>
Patch co-authored by: Konrad Zelazny <konradx.zelazny@intel.com>
Patch co-authored by: Katarzyna Rucinska <katarzynax.kargol@intel.com>
Patch co-authored by: Lukasz Kolodzinski <lukaszx.kolodzinski@intel.com>
Patch co-authored by: Zbigniew Jedlinski <zbigniewx.jedlinski@intel.com>

Sponsored by:	Intel Corporation
Reviewed by:	markj, jhb
Differential Revision:	https://reviews.freebsd.org/D36254
2023-01-24 10:33:50 -05:00
Gordon Bergling c07d6445eb qat(4): Fix common typos in source code comments
- s/desciptor/descriptor/

MFC after:	3 days
2023-01-11 13:27:56 +01:00
Ed Maste dda082e009 qat: make function definition match prototype
LacSymCb_CallbacksRegister declared with a (void) argument list but was
defined with ().  With Clang 15 this produced a warning.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2022-09-05 21:24:58 -04:00
Gordon Bergling b197d4b893 qat(4): Correct some typos in source code comments
- s/occured/occurred/
- s/the the/the/

MFC after:	3 days
2022-09-04 12:51:22 +02:00
John Baldwin 1c4c92f91b qat: Add #includes for missing prototypes.
This fixes numerous -Wmissing-prototypes warnings when that warning
is enabled.

Reviewed by:	MichalX.Gulbicki_intel.com, markj
Sponsored by:	DARPA
Obtained from:	CheriBSD
Differential Revision:	https://reviews.freebsd.org/D36331
2022-09-02 14:51:54 -07:00
John Baldwin 50f1a377da qat: Add a prototype for icp_adf_is_dev_in_error.
Reviewed by:	MichalX.Gulbicki_intel.com, markj
Sponsored by:	DARPA
Obtained from:	CheriBSD
Differential Revision:	https://reviews.freebsd.org/D36330
2022-09-02 14:51:39 -07:00
John Baldwin e3b17b5042 qat: Drop extraneous parentheses from some macro values.
This header duplicates a few #defines in "adf_cfg_strings.h".  The
latter header does not use the unneeded parentheses, but if a C file
includes both of these headers, clang raises an error because the macro
is redefined with a different value.

Reviewed by:	markj
Sponsored by:	DARPA
Obtained from:	CheriBSD
Differential Revision:	https://reviews.freebsd.org/D36329
2022-09-02 14:49:40 -07:00
Mark Johnston d623883d11 qat: Add a required MODULE_DEPEND for firmware(9)
Reported by:	kib
Sponsored by:	The FreeBSD Foundation
2022-07-28 10:11:59 -04:00
Julian Grajkowski 78ee8d1c4c qat: Import a new Intel (R) QAT driver
QAT in-tree driver ported from out-of-tree release available
from 01.org.

The driver exposes complete cryptography and data compression
API in the kernel and integrates with Open Crypto Framework.
Details of supported operations, devices and usage can be found
in man and on 01.org.

Patch co-authored by: Krzysztof Zdziarski <krzysztofx.zdziarski@intel.com>
Patch co-authored by: Michal Jaraczewski <michalx.jaraczewski@intel.com>
Patch co-authored by: Michal Gulbicki <michalx.gulbicki@intel.com>
Patch co-authored by: Julian Grajkowski <julianx.grajkowski@intel.com>
Patch co-authored by: Piotr Kasierski <piotrx.kasierski@intel.com>
Patch co-authored by: Adam Czupryna <adamx.czupryna@intel.com>
Patch co-authored by: Konrad Zelazny <konradx.zelazny@intel.com>
Patch co-authored by: Katarzyna Rucinska <katarzynax.kargol@intel.com>
Patch co-authored by: Lukasz Kolodzinski <lukaszx.kolodzinski@intel.com>
Patch co-authored by: Zbigniew Jedlinski <zbigniewx.jedlinski@intel.com>

Reviewed by:	markj, jhb (OCF integration)
Reviewed by:	debdrup, pauamma (docs)
Sponsored by:	Intel Corporation
Differential Revision: https://reviews.freebsd.org/D34632
2022-07-27 11:12:35 -04:00
Mark Johnston f4f56ff43d qat: Rename to qat_c2xxx and remove support for modern chipsets
A replacement QAT driver will be imported, but this replacement does not
support Atom C2xxx hardware.  So, the existing driver will be kept
around to provide opencrypto offload support for those chipsets.

Reviewed by:	pauamma, emaste
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D35817
2022-07-27 11:10:52 -04:00
Gordon Bergling db1c3dbe82 qat(4): Fix a typo in a source code comment
- s/mirco/micro/

Obtained from:	NetBSD
MFC after:	3 days
2022-07-16 14:26:24 +02:00
Gordon Bergling e4a203234a qat(4): Fix a typo in a source code comment
- s/bufer/buffer/

Obtained from:	NetBSD
MFC after:	3 days
2022-07-16 13:47:14 +02:00
John Baldwin 578a173f22 qat: Remove unused devclass argument to DRIVER_MODULE. 2022-05-09 12:22:03 -07:00
Mark Johnston 8fcf230c13 qat: Address -Wunused-but-set-variable warnings
MFC after:	1 week
2021-12-17 13:10:22 -05:00
John Baldwin 6e17a2e00d crypto: Validate AES-GCM IV length in check_csp().
This centralizes the check for valid nonce lengths for AES-GCM.

While here, remove some duplicate checks for valid AES-GCM tag lengths
from ccp(4) and ccr(4).

Reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D33194
2021-12-09 11:52:41 -08:00
Mark Johnston 843d16436d qat: Make prototypes consistent with the implementation
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2021-04-05 16:30:00 -04:00
Mark Johnston bd674d8b1f qat: Add support for separate AAD and output buffers
MFC after:	1 week
Sponsored by:	Rubicon Communications, LLC ("Netgate")
2021-01-27 15:30:58 -05:00
Mark Johnston 6483fc224b qat: Free counters during detach
MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC (Netgate)
2021-01-14 11:41:28 -05:00
Mark Johnston a33b29a044 qat: Count request allocation failures
This can be useful for troubleshooting performance problems.

MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC (Netgate)
2021-01-14 11:41:28 -05:00
Mark Johnston 95ee7d9b87 qat: Fix DH895XCC firmware module autoloading
MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC (Netgate)
2021-01-14 11:41:28 -05:00
Ryan Libby 324f89d9c8 qat: quiet -Wredundant-decls
Reviewed by:	markj
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D27554
2020-12-11 22:51:53 +00:00
Mark Johnston e4b675c929 qat: Initialize the crypto device ID to -1 instead of 0
Otherwise qat_detach() may attempt to deregister an unrelated crypto
driver if an error occurs in qat_attach() before crypto_get_driverid()
is called, since 0 is a valid driver ID.

MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC (Netgate)
2020-11-30 20:53:45 +00:00
Mark Johnston 7695ced633 qat: Fix firmware module autoloading
If firmware_get() fails to find a loaded firmware image, it searches for
candidate KLDs to load.  It will search for a KLD containing a module
with the same name as the requested image, and failing that, will load a
KLD with the same basename as the requested image.

The module name given by fw_stub.awk is simply "<mangled KLD name>_fw".

QAT firmware modules contain two images, neither of which match either
of the names used during lookup, so automatic loading of firmware images
after mountroot does not work.  Work around this by using the same
string for the first image name and for the KLD basename.

MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC (Netgate)
2020-11-30 20:53:25 +00:00
Mark Johnston 381219b64d qat: Fix nits reported by Coverity
MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC (Netgate)
2020-11-12 15:00:48 +00:00
Mark Johnston 72143e89bb Add qat(4)
This provides an OpenCrypto driver for Intel QuickAssist devices.  The
driver was initially ported from NetBSD and comes with a few
improvements:
- support for GMAC/AES-GCM, AES-CTR and AES-XTS, and support for
  SHA/HMAC-authenticated encryption
- support for detaching the driver
- various bug fixes
- DH895X support

Discussed with:	jhb
MFC after:	3 days
Sponsored by:	Rubicon Communications, LLC (Netgate)
Differential Revision:	https://reviews.freebsd.org/D26963
2020-11-05 15:55:23 +00:00