xref: /dpdk/doc/guides/cryptodevs/qat.rst (revision 3cc4d996fa758052cee5bafc4145095bdce5cc94)
15630257fSFerruh Yigit..  SPDX-License-Identifier: BSD-3-Clause
27d5ef3bbSDamian Nowak    Copyright(c) 2015-2019 Intel Corporation.
31703e94aSDeclan Doherty
4ae20c073SDeepak Kumar JainIntel(R) QuickAssist (QAT) Crypto Poll Mode Driver
5ae20c073SDeepak Kumar Jain==================================================
61703e94aSDeclan Doherty
759ad25feSFiona TraheQAT documentation consists of three parts:
859ad25feSFiona Trahe
9bfd84d7eSArek Kusztal* Details of the symmetric and asymmetric crypto services below.
1043628b3dSDavid Marchand* Details of the :doc:`compression service <../compressdevs/qat_comp>`
1159ad25feSFiona Trahe  in the compressdev drivers section.
1259ad25feSFiona Trahe* Details of building the common QAT infrastructure and the PMDs to support the
1359ad25feSFiona Trahe  above services. See :ref:`building_qat` below.
1459ad25feSFiona Trahe
1559ad25feSFiona Trahe
1659ad25feSFiona TraheSymmetric Crypto Service on QAT
1759ad25feSFiona Trahe-------------------------------
1859ad25feSFiona Trahe
19bfd84d7eSArek KusztalThe QAT symmetric crypto PMD (hereafter referred to as `QAT SYM [PMD]`) provides
20bfd84d7eSArek Kusztalpoll mode crypto driver support for the following hardware accelerator devices:
21f546c1edSFiona Trahe
22f546c1edSFiona Trahe* ``Intel QuickAssist Technology DH895xCC``
23f546c1edSFiona Trahe* ``Intel QuickAssist Technology C62x``
24f546c1edSFiona Trahe* ``Intel QuickAssist Technology C3xxx``
257b08003bSAdam Dybkowski* ``Intel QuickAssist Technology 200xx``
26259310f3SFiona Trahe* ``Intel QuickAssist Technology D15xx``
27cb440babSAdam Dybkowski* ``Intel QuickAssist Technology C4xxx``
281703e94aSDeclan Doherty
291703e94aSDeclan Doherty
301703e94aSDeclan DohertyFeatures
3159ad25feSFiona Trahe~~~~~~~~
321703e94aSDeclan Doherty
33bfd84d7eSArek KusztalThe QAT SYM PMD has support for:
341703e94aSDeclan Doherty
351703e94aSDeclan DohertyCipher algorithms:
361703e94aSDeclan Doherty
37e1b7f509SFiona Trahe* ``RTE_CRYPTO_CIPHER_3DES_CBC``
38e1b7f509SFiona Trahe* ``RTE_CRYPTO_CIPHER_3DES_CTR``
39fddf3804SDeepak Kumar Jain* ``RTE_CRYPTO_CIPHER_AES128_CBC``
40fddf3804SDeepak Kumar Jain* ``RTE_CRYPTO_CIPHER_AES192_CBC``
41fddf3804SDeepak Kumar Jain* ``RTE_CRYPTO_CIPHER_AES256_CBC``
42fddf3804SDeepak Kumar Jain* ``RTE_CRYPTO_CIPHER_AES128_CTR``
43fddf3804SDeepak Kumar Jain* ``RTE_CRYPTO_CIPHER_AES192_CTR``
44fddf3804SDeepak Kumar Jain* ``RTE_CRYPTO_CIPHER_AES256_CTR``
457d5ef3bbSDamian Nowak* ``RTE_CRYPTO_CIPHER_AES_XTS``
46fddf3804SDeepak Kumar Jain* ``RTE_CRYPTO_CIPHER_SNOW3G_UEA2``
47db0e952aSDeepak Kumar Jain* ``RTE_CRYPTO_CIPHER_NULL``
48d4f27453SDeepak Kumar Jain* ``RTE_CRYPTO_CIPHER_KASUMI_F8``
496cd8b4d8SArek Kusztal* ``RTE_CRYPTO_CIPHER_DES_CBC``
50d18ab45fSFiona Trahe* ``RTE_CRYPTO_CIPHER_AES_DOCSISBPI``
51d18ab45fSFiona Trahe* ``RTE_CRYPTO_CIPHER_DES_DOCSISBPI``
52d9b7d5bbSArek Kusztal* ``RTE_CRYPTO_CIPHER_ZUC_EEA3``
531703e94aSDeclan Doherty
541703e94aSDeclan DohertyHash algorithms:
551703e94aSDeclan Doherty
566e21c1a5SAdam Dybkowski* ``RTE_CRYPTO_AUTH_SHA1``
571703e94aSDeclan Doherty* ``RTE_CRYPTO_AUTH_SHA1_HMAC``
586e21c1a5SAdam Dybkowski* ``RTE_CRYPTO_AUTH_SHA224``
59ebdbe12fSDeepak Kumar Jain* ``RTE_CRYPTO_AUTH_SHA224_HMAC``
606e21c1a5SAdam Dybkowski* ``RTE_CRYPTO_AUTH_SHA256``
611703e94aSDeclan Doherty* ``RTE_CRYPTO_AUTH_SHA256_HMAC``
626e21c1a5SAdam Dybkowski* ``RTE_CRYPTO_AUTH_SHA384``
63d905ee32SDeepak Kumar Jain* ``RTE_CRYPTO_AUTH_SHA384_HMAC``
646e21c1a5SAdam Dybkowski* ``RTE_CRYPTO_AUTH_SHA512``
651703e94aSDeclan Doherty* ``RTE_CRYPTO_AUTH_SHA512_HMAC``
661703e94aSDeclan Doherty* ``RTE_CRYPTO_AUTH_AES_XCBC_MAC``
67a38dfe97SDeepak Kumar Jain* ``RTE_CRYPTO_AUTH_SNOW3G_UIA2``
6861ec5181SArek Kusztal* ``RTE_CRYPTO_AUTH_MD5_HMAC``
69db0e952aSDeepak Kumar Jain* ``RTE_CRYPTO_AUTH_NULL``
70d4f27453SDeepak Kumar Jain* ``RTE_CRYPTO_AUTH_KASUMI_F9``
712fa64f84SArek Kusztal* ``RTE_CRYPTO_AUTH_AES_GMAC``
72d9b7d5bbSArek Kusztal* ``RTE_CRYPTO_AUTH_ZUC_EIA3``
7391c1daa4STomasz Cel* ``RTE_CRYPTO_AUTH_AES_CMAC``
741703e94aSDeclan Doherty
75b79e4c00SPablo de LaraSupported AEAD algorithms:
76655c901bSAndrea Grandi
77b79e4c00SPablo de Lara* ``RTE_CRYPTO_AEAD_AES_GCM``
787bd6f76eSTomasz Cel* ``RTE_CRYPTO_AEAD_AES_CCM``
79faa57df0SArek Kusztal* ``RTE_CRYPTO_AEAD_CHACHA20_POLY1305``
80b79e4c00SPablo de Lara
816f0ef237SDavid CoyleProtocol offloads:
826f0ef237SDavid Coyle
836f0ef237SDavid Coyle* ``RTE_SECURITY_PROTOCOL_DOCSIS``
841703e94aSDeclan Doherty
85bcd7e3e8SAdam DybkowskiSupported Chains
86bcd7e3e8SAdam Dybkowski~~~~~~~~~~~~~~~~
87bcd7e3e8SAdam Dybkowski
88bcd7e3e8SAdam DybkowskiAll the usual chains are supported and also some mixed chains:
89bcd7e3e8SAdam Dybkowski
90bcd7e3e8SAdam Dybkowski.. table:: Supported hash-cipher chains for wireless digest-encrypted cases
91bcd7e3e8SAdam Dybkowski
92bcd7e3e8SAdam Dybkowski   +------------------+-----------+-------------+----------+----------+
93bcd7e3e8SAdam Dybkowski   | Cipher algorithm | NULL AUTH | SNOW3G UIA2 | ZUC EIA3 | AES CMAC |
94bcd7e3e8SAdam Dybkowski   +==================+===========+=============+==========+==========+
95a1598e90SAdam Dybkowski   | NULL CIPHER      | Y         | 2&3         | 2&3      | Y        |
96bcd7e3e8SAdam Dybkowski   +------------------+-----------+-------------+----------+----------+
97a1598e90SAdam Dybkowski   | SNOW3G UEA2      | 2&3       | Y           | 2&3      | 2&3      |
98bcd7e3e8SAdam Dybkowski   +------------------+-----------+-------------+----------+----------+
99a1598e90SAdam Dybkowski   | ZUC EEA3         | 2&3       | 2&3         | 2&3      | 2&3      |
100bcd7e3e8SAdam Dybkowski   +------------------+-----------+-------------+----------+----------+
101a1598e90SAdam Dybkowski   | AES CTR          | Y         | 2&3         | 2&3      | Y        |
102bcd7e3e8SAdam Dybkowski   +------------------+-----------+-------------+----------+----------+
103bcd7e3e8SAdam Dybkowski
104bcd7e3e8SAdam Dybkowski* The combinations marked as "Y" are supported on all QAT hardware versions.
105bcd7e3e8SAdam Dybkowski* The combinations marked as "2&3" are supported on GEN2/GEN3 QAT hardware only.
106bcd7e3e8SAdam Dybkowski
107bcd7e3e8SAdam Dybkowski
1081703e94aSDeclan DohertyLimitations
10959ad25feSFiona Trahe~~~~~~~~~~~
1101703e94aSDeclan Doherty
1111703e94aSDeclan Doherty* Only supports the session-oriented API implementation (session-less APIs are not supported).
1122142e6dcSPablo de Lara* SNOW 3G (UEA2), KASUMI (F8) and ZUC (EEA3) supported only if cipher length and offset fields are byte-multiple.
1139333cfbaSPablo de Lara* SNOW 3G (UIA2) and ZUC (EIA3) supported only if hash length and offset fields are byte-multiple.
1148831895bSFiona Trahe* No BSD support as BSD QAT kernel driver not available.
115d9b7d5bbSArek Kusztal* ZUC EEA3/EIA3 is not supported by dh895xcc devices
1162a7bb4fdSFiona Trahe* Maximum additional authenticated data (AAD) for GCM is 240 bytes long and must be passed to the device in a buffer rounded up to the nearest block-size multiple (x16) and padded with zeros.
117026f21c0SFiona Trahe* Queue-pairs are thread-safe on Intel CPUs but Queues are not (that is, within a single
118026f21c0SFiona Trahe  queue-pair all enqueues to the TX queue must be done from one thread and all dequeues
119026f21c0SFiona Trahe  from the RX queue must be done from one thread, but enqueues and dequeues may be done
120026f21c0SFiona Trahe  in different threads.)
121aa983f03SAdam Dybkowski* A GCM limitation exists, but only in the case where there are multiple
122aa983f03SAdam Dybkowski  generations of QAT devices on a single platform.
123aa983f03SAdam Dybkowski  To optimise performance, the GCM crypto session should be initialised for the
124aa983f03SAdam Dybkowski  device generation to which the ops will be enqueued. Specifically if a GCM
125aa983f03SAdam Dybkowski  session is initialised on a GEN2 device, but then attached to an op enqueued
126aa983f03SAdam Dybkowski  to a GEN3 device, it will work but cannot take advantage of hardware
127aa983f03SAdam Dybkowski  optimisations in the GEN3 device. And if a GCM session is initialised on a
128aa983f03SAdam Dybkowski  GEN3 device, then attached to an op sent to a GEN1/GEN2 device, it will not be
129aa983f03SAdam Dybkowski  enqueued to the device and will be marked as failed. The simplest way to
130aa983f03SAdam Dybkowski  mitigate this is to use the bdf whitelist to avoid mixing devices of different
131aa983f03SAdam Dybkowski  generations in the same process if planning to use for GCM.
132a1598e90SAdam Dybkowski* The mixed algo feature on GEN2 is not supported by all kernel drivers. Check
133a1598e90SAdam Dybkowski  the notes under the Available Kernel Drivers table below for specific details.
1346f0ef237SDavid Coyle* Out-of-place is not supported for combined Crypto-CRC DOCSIS security
1356f0ef237SDavid Coyle  protocol.
1366f0ef237SDavid Coyle* ``RTE_CRYPTO_CIPHER_DES_DOCSISBPI`` is not supported for combined Crypto-CRC
1376f0ef237SDavid Coyle  DOCSIS security protocol.
1386b048cdfSDavid Coyle* Multi-segment buffers are not supported for combined Crypto-CRC DOCSIS
1396b048cdfSDavid Coyle  security protocol.
1401703e94aSDeclan Doherty
141bb44fb6fSFiona TraheExtra notes on KASUMI F9
14259ad25feSFiona Trahe~~~~~~~~~~~~~~~~~~~~~~~~
1431703e94aSDeclan Doherty
144bb44fb6fSFiona TraheWhen using KASUMI F9 authentication algorithm, the input buffer must be
145aa38c849SFiona Traheconstructed according to the
146aa38c849SFiona Trahe`3GPP KASUMI specification <http://cryptome.org/3gpp/35201-900.pdf>`_
147aa38c849SFiona Trahe(section 4.4, page 13). The input buffer has to have COUNT (4 bytes),
148aa38c849SFiona TraheFRESH (4 bytes), MESSAGE and DIRECTION (1 bit) concatenated. After the DIRECTION
149aa38c849SFiona Trahebit, a single '1' bit is appended, followed by between 0 and 7 '0' bits, so that
150aa38c849SFiona Trahethe total length of the buffer is multiple of 8 bits. Note that the actual
151aa38c849SFiona Trahemessage can be any length, specified in bits.
152bb44fb6fSFiona Trahe
153bb44fb6fSFiona TraheOnce this buffer is passed this way, when creating the crypto operation,
154aa38c849SFiona Trahelength of data to authenticate "op.sym.auth.data.length" must be the length
155bb44fb6fSFiona Traheof all the items described above, including the padding at the end.
156aa38c849SFiona TraheAlso, offset of data to authenticate "op.sym.auth.data.offset"
157bb44fb6fSFiona Trahemust be such that points at the start of the COUNT bytes.
158bb44fb6fSFiona Trahe
159f81cbc20SArek KusztalAsymmetric Crypto Service on QAT
160f81cbc20SArek Kusztal--------------------------------
161bb44fb6fSFiona Trahe
162bfd84d7eSArek KusztalThe QAT asymmetric crypto PMD (hereafter referred to as `QAT ASYM [PMD]`) provides
163bfd84d7eSArek Kusztalpoll mode crypto driver support for the following hardware accelerator devices:
164f81cbc20SArek Kusztal
165bfd84d7eSArek Kusztal* ``Intel QuickAssist Technology DH895xCC``
166bfd84d7eSArek Kusztal* ``Intel QuickAssist Technology C62x``
167bfd84d7eSArek Kusztal* ``Intel QuickAssist Technology C3xxx``
168bfd84d7eSArek Kusztal* ``Intel QuickAssist Technology D15xx``
169cb440babSAdam Dybkowski* ``Intel QuickAssist Technology C4xxx``
170bfd84d7eSArek Kusztal
171bfd84d7eSArek KusztalThe QAT ASYM PMD has support for:
172bfd84d7eSArek Kusztal
173bfd84d7eSArek Kusztal* ``RTE_CRYPTO_ASYM_XFORM_MODEX``
174bfd84d7eSArek Kusztal* ``RTE_CRYPTO_ASYM_XFORM_MODINV``
175fb70b33bSArek Kusztal
176f81cbc20SArek KusztalLimitations
177f81cbc20SArek Kusztal~~~~~~~~~~~
178bb44fb6fSFiona Trahe
179bfd84d7eSArek Kusztal* Big integers longer than 4096 bits are not supported.
180026f21c0SFiona Trahe* Queue-pairs are thread-safe on Intel CPUs but Queues are not (that is, within a single
181026f21c0SFiona Trahe  queue-pair all enqueues to the TX queue must be done from one thread and all dequeues
182026f21c0SFiona Trahe  from the RX queue must be done from one thread, but enqueues and dequeues may be done
183026f21c0SFiona Trahe  in different threads.)
184e2c5f4eaSArek Kusztal* RSA-2560, RSA-3584 are not supported
185bfd84d7eSArek Kusztal
18659ad25feSFiona Trahe.. _building_qat:
18759ad25feSFiona Trahe
18859ad25feSFiona TraheBuilding PMDs on QAT
18959ad25feSFiona Trahe--------------------
190bb44fb6fSFiona Trahe
19102545b6cSFiona TraheA QAT device can host multiple acceleration services:
19202545b6cSFiona Trahe
19302545b6cSFiona Trahe* symmetric cryptography
19402545b6cSFiona Trahe* data compression
195f81cbc20SArek Kusztal* asymmetric cryptography
19602545b6cSFiona Trahe
19702545b6cSFiona TraheThese services are provided to DPDK applications via PMDs which register to
19802545b6cSFiona Traheimplement the corresponding cryptodev and compressdev APIs. The PMDs use
19902545b6cSFiona Trahecommon QAT driver code which manages the QAT PCI device. They also depend on a
20002545b6cSFiona TraheQAT kernel driver being installed on the platform, see :ref:`qat_kernel` below.
2011703e94aSDeclan Doherty
202bb44fb6fSFiona Trahe
20302545b6cSFiona TraheConfiguring and Building the DPDK QAT PMDs
20402545b6cSFiona Trahe~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
20502545b6cSFiona Trahe
20602545b6cSFiona Trahe
20702545b6cSFiona TraheFurther information on configuring, building and installing DPDK is described
20843628b3dSDavid Marchand:doc:`here <../linux_gsg/build_dpdk>`.
20902545b6cSFiona Trahe
2105f40555bSTomasz Jozwiak.. _building_qat_config:
2115f40555bSTomasz Jozwiak
2127ce27b9eSFiona TraheBuild Configuration
2137ce27b9eSFiona Trahe~~~~~~~~~~~~~~~~~~~
2147ce27b9eSFiona Trahe
2157ce27b9eSFiona TraheThese are the build configuration options affecting QAT, and their default values:
2167ce27b9eSFiona Trahe
2177ce27b9eSFiona Trahe.. code-block:: console
2187ce27b9eSFiona Trahe
219fd5f9fb9SCiara Power	RTE_PMD_QAT_MAX_PCI_DEVICES=48
220fd5f9fb9SCiara Power	RTE_PMD_QAT_COMP_IM_BUFFER_SIZE=65536
2217ce27b9eSFiona Trahe
222bfd84d7eSArek KusztalBoth QAT SYM PMD and QAT ASYM PMD have an external dependency on libcrypto, so are not
223fd5f9fb9SCiara Powerbuilt by default.
2247ce27b9eSFiona Trahe
225fd5f9fb9SCiara PowerThe QAT compressdev PMD has no external dependencies, so is built by default.
2267ce27b9eSFiona Trahe
2277ce27b9eSFiona TraheThe number of VFs per PF varies - see table below. If multiple QAT packages are
228fd5f9fb9SCiara Powerinstalled on a platform then RTE_PMD_QAT_MAX_PCI_DEVICES should be
2297ce27b9eSFiona Traheadjusted to the number of VFs which the QAT common code will need to handle.
230bfd84d7eSArek Kusztal
231bfd84d7eSArek Kusztal.. Note::
232bfd84d7eSArek Kusztal
233bfd84d7eSArek Kusztal        There are separate config items (not QAT-specific) for max cryptodevs
234fd5f9fb9SCiara Power        RTE_CRYPTO_MAX_DEVS and max compressdevs RTE_COMPRESS_MAX_DEVS,
235bfd84d7eSArek Kusztal        if necessary these should be adjusted to handle the total of QAT and other
236bfd84d7eSArek Kusztal        devices which the process will use. In particular for crypto, where each
237bfd84d7eSArek Kusztal        QAT VF may expose two crypto devices, sym and asym, it may happen that the
238bfd84d7eSArek Kusztal        number of devices will be bigger than MAX_DEVS and the process will show an error
239fd5f9fb9SCiara Power        during PMD initialisation. To avoid this problem RTE_CRYPTO_MAX_DEVS may be
240bfd84d7eSArek Kusztal        increased or -w, pci-whitelist domain:bus:devid:func option may be used.
241bfd84d7eSArek Kusztal
2427ce27b9eSFiona Trahe
2434e8f2d6aSFiona TraheQAT compression PMD needs intermediate buffers to support Deflate compression
244fd5f9fb9SCiara Powerwith Dynamic Huffman encoding. RTE_PMD_QAT_COMP_IM_BUFFER_SIZE
2454e8f2d6aSFiona Trahespecifies the size of a single buffer, the PMD will allocate a multiple of these,
2465f40555bSTomasz Jozwiakplus some extra space for associated meta-data. For GEN2 devices, 20 buffers are
2475f40555bSTomasz Jozwiakallocated while for GEN1 devices, 12 buffers are allocated, plus 1472 bytes overhead.
2484e8f2d6aSFiona Trahe
2494e8f2d6aSFiona Trahe.. Note::
2504e8f2d6aSFiona Trahe
2514e8f2d6aSFiona Trahe	If the compressed output of a Deflate operation using Dynamic Huffman
2524e8f2d6aSFiona Trahe	Encoding is too big to fit in an intermediate buffer, then the
253c13cecf6SAdam Dybkowski	operation will be split into smaller operations and their results will
254c13cecf6SAdam Dybkowski	be merged afterwards.
255c13cecf6SAdam Dybkowski	This is not possible if any checksum calculation was requested - in such
256c13cecf6SAdam Dybkowski	case the code falls back to fixed compression.
257a720e674STomasz Jozwiak	To avoid this less performant case, applications should configure
258a720e674STomasz Jozwiak	the intermediate buffer size to be larger than the expected input data size
259a720e674STomasz Jozwiak	(compressed output size is usually unknown, so the only option is to make
260a720e674STomasz Jozwiak	larger than the input size).
2614e8f2d6aSFiona Trahe
262bb44fb6fSFiona Trahe
26347c3f7a4SArek KusztalRunning QAT PMD with minimum threshold for burst size
26447c3f7a4SArek Kusztal~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
26547c3f7a4SArek Kusztal
26647c3f7a4SArek KusztalIf only a small number or packets can be enqueued. Each enqueue causes an expensive MMIO write.
26747c3f7a4SArek KusztalThese MMIO write occurrences can be optimised by setting any of the following parameters:
26847c3f7a4SArek Kusztal
26947c3f7a4SArek Kusztal- qat_sym_enq_threshold
27047c3f7a4SArek Kusztal- qat_asym_enq_threshold
27147c3f7a4SArek Kusztal- qat_comp_enq_threshold
27247c3f7a4SArek Kusztal
27347c3f7a4SArek KusztalWhen any of these parameters is set rte_cryptodev_enqueue_burst function will
27447c3f7a4SArek Kusztalreturn 0 (thereby avoiding an MMIO) if the device is congested and number of packets
27547c3f7a4SArek Kusztalpossible to enqueue is smaller.
27647c3f7a4SArek KusztalTo use this feature the user must set the parameter on process start as a device additional parameter::
27747c3f7a4SArek Kusztal
27847c3f7a4SArek Kusztal  -w 03:01.1,qat_sym_enq_threshold=32,qat_comp_enq_threshold=16
27947c3f7a4SArek Kusztal
28047c3f7a4SArek KusztalAll parameters can be used with the same device regardless of order. Parameters are separated
28147c3f7a4SArek Kusztalby comma. When the same parameter is used more than once first occurrence of the parameter
28247c3f7a4SArek Kusztalis used.
28347c3f7a4SArek KusztalMaximum threshold that can be set is 32.
28447c3f7a4SArek Kusztal
28547c3f7a4SArek Kusztal
286bb44fb6fSFiona TraheDevice and driver naming
28759ad25feSFiona Trahe~~~~~~~~~~~~~~~~~~~~~~~~
288bb44fb6fSFiona Trahe
289bfd84d7eSArek Kusztal* The qat cryptodev symmetric crypto driver name is "crypto_qat".
290bfd84d7eSArek Kusztal* The qat cryptodev asymmetric crypto driver name is "crypto_qat_asym".
291bb44fb6fSFiona Trahe
292bfd84d7eSArek KusztalThe "rte_cryptodev_devices_get()" returns the devices exposed by either of these drivers.
293bfd84d7eSArek Kusztal
294bfd84d7eSArek Kusztal* Each qat sym crypto device has a unique name, in format
295aa38c849SFiona Trahe  "<pci bdf>_<service>", e.g. "0000:41:01.0_qat_sym".
296bfd84d7eSArek Kusztal* Each qat asym crypto device has a unique name, in format
297bfd84d7eSArek Kusztal  "<pci bdf>_<service>", e.g. "0000:41:01.0_qat_asym".
298aa38c849SFiona Trahe  This name can be passed to "rte_cryptodev_get_dev_id()" to get the device_id.
299bb44fb6fSFiona Trahe
300bb44fb6fSFiona Trahe.. Note::
301bb44fb6fSFiona Trahe
302bfd84d7eSArek Kusztal	The cryptodev driver name is passed to the dpdk-test-crypto-perf tool in the "-devtype" parameter.
303bb44fb6fSFiona Trahe
30485b00824SAdam Dybkowski	The qat crypto device name is in the format of the worker parameter passed to the crypto scheduler.
305bb44fb6fSFiona Trahe
306df8cca46SFiona Trahe* The qat compressdev driver name is "compress_qat".
307bb44fb6fSFiona Trahe  The rte_compressdev_devices_get() returns the devices exposed by this driver.
308bb44fb6fSFiona Trahe
309bb44fb6fSFiona Trahe* Each qat compression device has a unique name, in format
310bb44fb6fSFiona Trahe  <pci bdf>_<service>, e.g. "0000:41:01.0_qat_comp".
311bb44fb6fSFiona Trahe  This name can be passed to rte_compressdev_get_dev_id() to get the device_id.
312bb44fb6fSFiona Trahe
31302545b6cSFiona Trahe.. _qat_kernel:
31402545b6cSFiona Trahe
31502545b6cSFiona TraheDependency on the QAT kernel driver
31602545b6cSFiona Trahe~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31702545b6cSFiona Trahe
31802545b6cSFiona TraheTo use QAT an SRIOV-enabled QAT kernel driver is required. The VF
31902545b6cSFiona Trahedevices created and initialised by this driver will be used by the QAT PMDs.
32002545b6cSFiona Trahe
32102545b6cSFiona TraheInstructions for installation are below, but first an explanation of the
32202545b6cSFiona Traherelationships between the PF/VF devices and the PMDs visible to
32302545b6cSFiona TraheDPDK applications.
32402545b6cSFiona Trahe
32502545b6cSFiona TraheEach QuickAssist PF device exposes a number of VF devices. Each VF device can
326bfd84d7eSArek Kusztalenable one symmetric cryptodev PMD and/or one asymmetric cryptodev PMD and/or
327bfd84d7eSArek Kusztalone compressdev PMD.
32802545b6cSFiona TraheThese QAT PMDs share the same underlying device and pci-mgmt code, but are
32902545b6cSFiona Traheenumerated independently on their respective APIs and appear as independent
33002545b6cSFiona Trahedevices to applications.
33102545b6cSFiona Trahe
33202545b6cSFiona Trahe.. Note::
33302545b6cSFiona Trahe
33402545b6cSFiona Trahe   Each VF can only be used by one DPDK process. It is not possible to share
33502545b6cSFiona Trahe   the same VF across multiple processes, even if these processes are using
33602545b6cSFiona Trahe   different acceleration services.
33702545b6cSFiona Trahe
33802545b6cSFiona Trahe   Conversely one DPDK process can use one or more QAT VFs and can expose both
33902545b6cSFiona Trahe   cryptodev and compressdev instances on each of those VFs.
34002545b6cSFiona Trahe
341bb44fb6fSFiona Trahe
342bb44fb6fSFiona TraheAvailable kernel drivers
34359ad25feSFiona Trahe~~~~~~~~~~~~~~~~~~~~~~~~
344bb44fb6fSFiona Trahe
345ab3dec55SFiona TraheKernel drivers for each device for each service are listed in the following table. (Scroll right
346ab3dec55SFiona Traheto see the full table)
347bb44fb6fSFiona Trahe
3481703e94aSDeclan Doherty
349f546c1edSFiona Trahe.. _table_qat_pmds_drivers:
350f546c1edSFiona Trahe
351f5160653SArek Kusztal.. table:: QAT device generations, devices and drivers
352f546c1edSFiona Trahe
353ab3dec55SFiona Trahe   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
354ab3dec55SFiona Trahe   | S   | A   | C   | Gen | Device   | Driver/ver    | Kernel Module | Pci Driver | PF Did | #PFs | VF Did | VFs/PF |
355ab3dec55SFiona Trahe   +=====+=====+=====+=====+==========+===============+===============+============+========+======+========+========+
356ab3dec55SFiona Trahe   | Yes | No  | No  | 1   | DH895xCC | linux/4.4+    | qat_dh895xcc  | dh895xcc   | 435    | 1    | 443    | 32     |
357ab3dec55SFiona Trahe   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
358bfd84d7eSArek Kusztal   | Yes | Yes | No  | "   | "        | 01.org/4.2.0+ | "             | "          | "      | "    | "      | "      |
359ab3dec55SFiona Trahe   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
360bfd84d7eSArek Kusztal   | Yes | Yes | Yes | "   | "        | 01.org/4.3.0+ | "             | "          | "      | "    | "      | "      |
361ab3dec55SFiona Trahe   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
362ab3dec55SFiona Trahe   | Yes | No  | No  | 2   | C62x     | linux/4.5+    | qat_c62x      | c6xx       | 37c8   | 3    | 37c9   | 16     |
363ab3dec55SFiona Trahe   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
364bfd84d7eSArek Kusztal   | Yes | Yes | Yes | "   | "        | 01.org/4.2.0+ | "             | "          | "      | "    | "      | "      |
365ab3dec55SFiona Trahe   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
366ab3dec55SFiona Trahe   | Yes | No  | No  | 2   | C3xxx    | linux/4.5+    | qat_c3xxx     | c3xxx      | 19e2   | 1    | 19e3   | 16     |
367ab3dec55SFiona Trahe   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
368bfd84d7eSArek Kusztal   | Yes | Yes | Yes | "   | "        | 01.org/4.2.0+ | "             | "          | "      | "    | "      | "      |
369ab3dec55SFiona Trahe   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
3707b08003bSAdam Dybkowski   | Yes | No  | No  | 2   | 200xx    | p             | qat_200xx     | 200xx      | 18ee   | 1    | 18ef   | 16     |
3717b08003bSAdam Dybkowski   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
3721c22df86SAdam Dybkowski   | Yes | No  | No  | 2   | D15xx    | 01.org/4.2.0+ | qat_d15xx     | d15xx      | 6f54   | 1    | 6f55   | 16     |
373ab3dec55SFiona Trahe   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
374cb440babSAdam Dybkowski   | Yes | No  | No  | 3   | C4xxx    | p             | qat_c4xxx     | c4xxx      | 18a0   | 1    | 18a1   | 128    |
375ab3dec55SFiona Trahe   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
376f546c1edSFiona Trahe
377a1598e90SAdam Dybkowski* Note: Symmetric mixed crypto algorithms feature on Gen 2 works only with 01.org driver version 4.9.0+
378a1598e90SAdam Dybkowski
379ab3dec55SFiona TraheThe first 3 columns indicate the service:
380ab3dec55SFiona Trahe
381ab3dec55SFiona Trahe* S = Symmetric crypto service (via cryptodev API)
382ab3dec55SFiona Trahe* A = Asymmetric crypto service  (via cryptodev API)
383ab3dec55SFiona Trahe* C = Compression service (via compressdev API)
384f546c1edSFiona Trahe
385f546c1edSFiona TraheThe ``Driver`` column indicates either the Linux kernel version in which
386f546c1edSFiona Trahesupport for this device was introduced or a driver available on Intel's 01.org
387ab3dec55SFiona Trahewebsite. There are both linux in-tree and 01.org kernel drivers available for some
388259310f3SFiona Trahedevices. p = release pending.
389f546c1edSFiona Trahe
390f546c1edSFiona TraheIf you are running on a kernel which includes a driver for your device, see
391f546c1edSFiona Trahe`Installation using kernel.org driver`_ below. Otherwise see
392f546c1edSFiona Trahe`Installation using 01.org QAT driver`_.
393f546c1edSFiona Trahe
394f546c1edSFiona Trahe
395f546c1edSFiona TraheInstallation using kernel.org driver
39659ad25feSFiona Trahe~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
397f546c1edSFiona Trahe
398f546c1edSFiona TraheThe examples below are based on the C62x device, if you have a different device
399f546c1edSFiona Traheuse the corresponding values in the above table.
400f546c1edSFiona Trahe
401f546c1edSFiona TraheIn BIOS ensure that SRIOV is enabled and either:
402f546c1edSFiona Trahe
403f546c1edSFiona Trahe* Disable VT-d or
404f546c1edSFiona Trahe* Enable VT-d and set ``"intel_iommu=on iommu=pt"`` in the grub file.
405f546c1edSFiona Trahe
406f546c1edSFiona TraheCheck that the QAT driver is loaded on your system, by executing::
407f546c1edSFiona Trahe
408f546c1edSFiona Trahe    lsmod | grep qa
409f546c1edSFiona Trahe
410f546c1edSFiona TraheYou should see the kernel module for your device listed, e.g.::
411f546c1edSFiona Trahe
412f546c1edSFiona Trahe    qat_c62x               5626  0
413f546c1edSFiona Trahe    intel_qat              82336  1 qat_c62x
414f546c1edSFiona Trahe
415f546c1edSFiona TraheNext, you need to expose the Virtual Functions (VFs) using the sysfs file system.
416f546c1edSFiona Trahe
417f546c1edSFiona TraheFirst find the BDFs (Bus-Device-Function) of the physical functions (PFs) of
418f546c1edSFiona Traheyour device, e.g.::
419f546c1edSFiona Trahe
420f546c1edSFiona Trahe    lspci -d:37c8
421f546c1edSFiona Trahe
422f546c1edSFiona TraheYou should see output similar to::
423f546c1edSFiona Trahe
424f546c1edSFiona Trahe    1a:00.0 Co-processor: Intel Corporation Device 37c8
425f546c1edSFiona Trahe    3d:00.0 Co-processor: Intel Corporation Device 37c8
426f546c1edSFiona Trahe    3f:00.0 Co-processor: Intel Corporation Device 37c8
427f546c1edSFiona Trahe
428f546c1edSFiona TraheEnable the VFs for each PF by echoing the number of VFs per PF to the pci driver::
429f546c1edSFiona Trahe
430f546c1edSFiona Trahe     echo 16 > /sys/bus/pci/drivers/c6xx/0000:1a:00.0/sriov_numvfs
431f546c1edSFiona Trahe     echo 16 > /sys/bus/pci/drivers/c6xx/0000:3d:00.0/sriov_numvfs
432f546c1edSFiona Trahe     echo 16 > /sys/bus/pci/drivers/c6xx/0000:3f:00.0/sriov_numvfs
433f546c1edSFiona Trahe
434f546c1edSFiona TraheCheck that the VFs are available for use. For example ``lspci -d:37c9`` should
435f546c1edSFiona Trahelist 48 VF devices available for a ``C62x`` device.
436f546c1edSFiona Trahe
437f546c1edSFiona TraheTo complete the installation follow the instructions in
438*3cc4d996SAdam Dybkowski`Binding the available VFs to the vfio-pci driver`_.
439f546c1edSFiona Trahe
440f546c1edSFiona Trahe.. Note::
441f546c1edSFiona Trahe
442f546c1edSFiona Trahe   If the QAT kernel modules are not loaded and you see an error like ``Failed
443f546c1edSFiona Trahe   to load MMP firmware qat_895xcc_mmp.bin`` in kernel logs, this may be as a
444f546c1edSFiona Trahe   result of not using a distribution, but just updating the kernel directly.
445f546c1edSFiona Trahe
446f546c1edSFiona Trahe   Download firmware from the `kernel firmware repo
447f546c1edSFiona Trahe   <http://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/tree/>`_.
448f546c1edSFiona Trahe
449f546c1edSFiona Trahe   Copy qat binaries to ``/lib/firmware``::
450f546c1edSFiona Trahe
451f546c1edSFiona Trahe      cp qat_895xcc.bin /lib/firmware
452f546c1edSFiona Trahe      cp qat_895xcc_mmp.bin /lib/firmware
453f546c1edSFiona Trahe
454f546c1edSFiona Trahe   Change to your linux source root directory and start the qat kernel modules::
455f546c1edSFiona Trahe
456f546c1edSFiona Trahe      insmod ./drivers/crypto/qat/qat_common/intel_qat.ko
457f546c1edSFiona Trahe      insmod ./drivers/crypto/qat/qat_dh895xcc/qat_dh895xcc.ko
458f546c1edSFiona Trahe
459f546c1edSFiona Trahe.. Note::
460f546c1edSFiona Trahe
461f546c1edSFiona Trahe   If you see the following warning in ``/var/log/messages`` it can be ignored:
462f546c1edSFiona Trahe   ``IOMMU should be enabled for SR-IOV to work correctly``.
463ae20c073SDeepak Kumar Jain
4641703e94aSDeclan Doherty
4651703e94aSDeclan DohertyInstallation using 01.org QAT driver
46659ad25feSFiona Trahe~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4671703e94aSDeclan Doherty
4681703e94aSDeclan DohertyDownload the latest QuickAssist Technology Driver from `01.org
469f546c1edSFiona Trahe<https://01.org/packet-processing/intel%C2%AE-quickassist-technology-drivers-and-patches>`_.
4701703e94aSDeclan DohertyConsult the *Getting Started Guide* at the same URL for further information.
4711703e94aSDeclan Doherty
4721703e94aSDeclan DohertyThe steps below assume you are:
4731703e94aSDeclan Doherty
474bb44fb6fSFiona Trahe* Building on a platform with one ``C62x`` device.
475bb44fb6fSFiona Trahe* Using package ``qat1.7.l.4.2.0-000xx.tar.gz``.
476bb44fb6fSFiona Trahe* On Fedora26 kernel ``4.11.11-300.fc26.x86_64``.
4771703e94aSDeclan Doherty
4781703e94aSDeclan DohertyIn the BIOS ensure that SRIOV is enabled and VT-d is disabled.
4791703e94aSDeclan Doherty
4801703e94aSDeclan DohertyUninstall any existing QAT driver, for example by running:
4811703e94aSDeclan Doherty
4821703e94aSDeclan Doherty* ``./installer.sh uninstall`` in the directory where originally installed.
4831703e94aSDeclan Doherty
4841703e94aSDeclan Doherty
4851703e94aSDeclan DohertyBuild and install the SRIOV-enabled QAT driver::
4861703e94aSDeclan Doherty
4871703e94aSDeclan Doherty    mkdir /QAT
4881703e94aSDeclan Doherty    cd /QAT
489f546c1edSFiona Trahe
490bb44fb6fSFiona Trahe    # Copy the package to this location and unpack
491bb44fb6fSFiona Trahe    tar zxof qat1.7.l.4.2.0-000xx.tar.gz
4921703e94aSDeclan Doherty
493bb44fb6fSFiona Trahe    ./configure --enable-icp-sriov=host
494bb44fb6fSFiona Trahe    make install
4951703e94aSDeclan Doherty
496bb44fb6fSFiona TraheYou can use ``cat /sys/kernel/debug/qat<your device type and bdf>/version/fw`` to confirm the driver is correctly installed and is using firmware version 4.2.0.
497bb44fb6fSFiona TraheYou can use ``lspci -d:37c9`` to confirm the presence of the 16 VF devices available per ``C62x`` PF.
498bb44fb6fSFiona Trahe
499bb44fb6fSFiona TraheConfirm the driver is correctly installed and is using firmware version 4.2.0::
500bb44fb6fSFiona Trahe
501bb44fb6fSFiona Trahe    cat /sys/kernel/debug/qat<your device type and bdf>/version/fw
502bb44fb6fSFiona Trahe
503bb44fb6fSFiona Trahe
504bb44fb6fSFiona TraheConfirm the presence of 48 VF devices - 16 per PF::
505bb44fb6fSFiona Trahe
506bb44fb6fSFiona Trahe    lspci -d:37c9
507bb44fb6fSFiona Trahe
5081703e94aSDeclan Doherty
509*3cc4d996SAdam DybkowskiTo complete the installation - follow instructions in
510*3cc4d996SAdam Dybkowski`Binding the available VFs to the vfio-pci driver`_.
5111703e94aSDeclan Doherty
512f546c1edSFiona Trahe.. Note::
513f546c1edSFiona Trahe
514f546c1edSFiona Trahe   If using a later kernel and the build fails with an error relating to
515f546c1edSFiona Trahe   ``strict_stroul`` not being available apply the following patch:
5161703e94aSDeclan Doherty
5171703e94aSDeclan Doherty   .. code-block:: diff
5181703e94aSDeclan Doherty
5191703e94aSDeclan Doherty      /QAT/QAT1.6/quickassist/utilities/downloader/Target_CoreLibs/uclo/include/linux/uclo_platform.h
5201703e94aSDeclan Doherty      + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,5)
5211703e94aSDeclan Doherty      + #define STR_TO_64(str, base, num, endPtr) {endPtr=NULL; if (kstrtoul((str), (base), (num))) printk("Error strtoull convert %s\n", str); }
5221703e94aSDeclan Doherty      + #else
5231703e94aSDeclan Doherty      #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
5241703e94aSDeclan Doherty      #define STR_TO_64(str, base, num, endPtr) {endPtr=NULL; if (strict_strtoull((str), (base), (num))) printk("Error strtoull convert %s\n", str); }
5251703e94aSDeclan Doherty      #else
5261703e94aSDeclan Doherty      #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
5271703e94aSDeclan Doherty      #define STR_TO_64(str, base, num, endPtr) {endPtr=NULL; strict_strtoll((str), (base), (num));}
5281703e94aSDeclan Doherty      #else
5291703e94aSDeclan Doherty      #define STR_TO_64(str, base, num, endPtr)                                 \
5301703e94aSDeclan Doherty           do {                                                               \
5311703e94aSDeclan Doherty                 if (str[0] == '-')                                           \
5321703e94aSDeclan Doherty                 {                                                            \
5331703e94aSDeclan Doherty                      *(num) = -(simple_strtoull((str+1), &(endPtr), (base))); \
5341703e94aSDeclan Doherty                 }else {                                                      \
5351703e94aSDeclan Doherty                      *(num) = simple_strtoull((str), &(endPtr), (base));      \
5361703e94aSDeclan Doherty                 }                                                            \
5371703e94aSDeclan Doherty           } while(0)
5381703e94aSDeclan Doherty      + #endif
5391703e94aSDeclan Doherty      #endif
5401703e94aSDeclan Doherty      #endif
5411703e94aSDeclan Doherty
5421703e94aSDeclan Doherty
543f546c1edSFiona Trahe.. Note::
5441703e94aSDeclan Doherty
545f546c1edSFiona Trahe   If the build fails due to missing header files you may need to do following::
5461703e94aSDeclan Doherty
547f546c1edSFiona Trahe      sudo yum install zlib-devel
548f546c1edSFiona Trahe      sudo yum install openssl-devel
549bb44fb6fSFiona Trahe      sudo yum install libudev-devel
5501703e94aSDeclan Doherty
551f546c1edSFiona Trahe.. Note::
5521703e94aSDeclan Doherty
553f546c1edSFiona Trahe   If the build or install fails due to mismatching kernel sources you may need to do the following::
5541703e94aSDeclan Doherty
555f546c1edSFiona Trahe      sudo yum install kernel-headers-`uname -r`
556f546c1edSFiona Trahe      sudo yum install kernel-src-`uname -r`
557f546c1edSFiona Trahe      sudo yum install kernel-devel-`uname -r`
5581703e94aSDeclan Doherty
559f2f639c6SDeepak Kumar Jain
560*3cc4d996SAdam DybkowskiBinding the available VFs to the vfio-pci driver
56159ad25feSFiona Trahe~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5621703e94aSDeclan Doherty
563*3cc4d996SAdam DybkowskiNote:
564*3cc4d996SAdam Dybkowski
565*3cc4d996SAdam Dybkowski* Please note that due to security issues, the usage of older DPDK igb-uio
566*3cc4d996SAdam Dybkowski  driver is not recommended. This document shows how to use the more secure
567*3cc4d996SAdam Dybkowski  vfio-pci driver.
568*3cc4d996SAdam Dybkowski* If QAT fails to bind to vfio-pci on Linux kernel 5.9+, please see the
569*3cc4d996SAdam Dybkowski  QATE-39220 and QATE-7495 issues in
570*3cc4d996SAdam Dybkowski  `01.org doc <https://01.org/sites/default/files/downloads/336211-015-qatsoftwareforlinux-rn-hwv1.7-final.pdf>`_
571*3cc4d996SAdam Dybkowski  which details the constraint about trusted guests and add `disable_denylist=1`
572*3cc4d996SAdam Dybkowski  to the vfio-pci params to use QAT. See also `this patch description <https://lkml.org/lkml/2020/7/23/1155>`_.
573*3cc4d996SAdam Dybkowski
574*3cc4d996SAdam DybkowskiUnbind the VFs from the stock driver so they can be bound to the vfio-pci driver.
5751703e94aSDeclan Doherty
576f546c1edSFiona TraheFor an Intel(R) QuickAssist Technology DH895xCC device
57759ad25feSFiona Trahe^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
578f546c1edSFiona Trahe
579f546c1edSFiona TraheThe unbind command below assumes ``BDFs`` of ``03:01.00-03:04.07``, if your
580f546c1edSFiona TraheVFs are different adjust the unbind command below::
5811703e94aSDeclan Doherty
582*3cc4d996SAdam Dybkowski    cd to the top-level DPDK directory
5831703e94aSDeclan Doherty    for device in $(seq 1 4); do \
5841703e94aSDeclan Doherty        for fn in $(seq 0 7); do \
585*3cc4d996SAdam Dybkowski            usertools/dpdk-devbind.py -u 0000:03:0${device}.${fn}; \
5861703e94aSDeclan Doherty        done; \
5871703e94aSDeclan Doherty    done
5881703e94aSDeclan Doherty
589f546c1edSFiona TraheFor an Intel(R) QuickAssist Technology C62x device
59059ad25feSFiona Trahe^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5911703e94aSDeclan Doherty
592f546c1edSFiona TraheThe unbind command below assumes ``BDFs`` of ``1a:01.00-1a:02.07``,
593f546c1edSFiona Trahe``3d:01.00-3d:02.07`` and ``3f:01.00-3f:02.07``, if your VFs are different
594f546c1edSFiona Traheadjust the unbind command below::
595ae20c073SDeepak Kumar Jain
596*3cc4d996SAdam Dybkowski    cd to the top-level DPDK directory
597ae20c073SDeepak Kumar Jain    for device in $(seq 1 2); do \
598ae20c073SDeepak Kumar Jain        for fn in $(seq 0 7); do \
599*3cc4d996SAdam Dybkowski            usertools/dpdk-devbind.py -u 0000:1a:0${device}.${fn}; \
600*3cc4d996SAdam Dybkowski            usertools/dpdk-devbind.py -u 0000:3d:0${device}.${fn}; \
601*3cc4d996SAdam Dybkowski            usertools/dpdk-devbind.py -u 0000:3f:0${device}.${fn}; \
602ae20c073SDeepak Kumar Jain        done; \
603ae20c073SDeepak Kumar Jain    done
604ae20c073SDeepak Kumar Jain
6057b08003bSAdam DybkowskiFor Intel(R) QuickAssist Technology C3xxx or 200xx or D15xx device
6067b08003bSAdam Dybkowski^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
607ae20c073SDeepak Kumar Jain
608f546c1edSFiona TraheThe unbind command below assumes ``BDFs`` of ``01:01.00-01:02.07``, if your
609f546c1edSFiona TraheVFs are different adjust the unbind command below::
610f2f639c6SDeepak Kumar Jain
611*3cc4d996SAdam Dybkowski    cd to the top-level DPDK directory
612f2f639c6SDeepak Kumar Jain    for device in $(seq 1 2); do \
613f2f639c6SDeepak Kumar Jain        for fn in $(seq 0 7); do \
614*3cc4d996SAdam Dybkowski            usertools/dpdk-devbind.py -u 0000:01:0${device}.${fn}; \
615f2f639c6SDeepak Kumar Jain        done; \
616f2f639c6SDeepak Kumar Jain    done
617f2f639c6SDeepak Kumar Jain
618*3cc4d996SAdam DybkowskiBind to the vfio-pci driver
61959ad25feSFiona Trahe^^^^^^^^^^^^^^^^^^^^^^^^^^^
620f2f639c6SDeepak Kumar Jain
621*3cc4d996SAdam DybkowskiLoad the vfio-pci driver, bind the VF PCI Device id to it using the
622*3cc4d996SAdam Dybkowski``dpdk-devbind.py`` script then use the ``--status`` option
623*3cc4d996SAdam Dybkowskito confirm the VF devices are now in use by vfio-pci kernel driver,
624f546c1edSFiona Trahee.g. for the C62x device::
625f546c1edSFiona Trahe
626f546c1edSFiona Trahe    cd to the top-level DPDK directory
627*3cc4d996SAdam Dybkowski    modprobe vfio-pci
628*3cc4d996SAdam Dybkowski    usertools/dpdk-devbind.py -b vfio-pci 0000:03:01.1
629*3cc4d996SAdam Dybkowski    usertools/dpdk-devbind.py --status
630*3cc4d996SAdam Dybkowski
631*3cc4d996SAdam DybkowskiUse ``modprobe vfio-pci disable_denylist=1`` from kernel 5.9 onwards.
632*3cc4d996SAdam DybkowskiSee note in the section `Binding the available VFs to the vfio-pci driver`_
633*3cc4d996SAdam Dybkowskiabove.
6349333cfbaSPablo de Lara
635b1c9177bSFiona TraheTesting
636b1c9177bSFiona Trahe~~~~~~~
637b1c9177bSFiona Trahe
638bfd84d7eSArek KusztalQAT SYM crypto PMD can be tested by running the test application::
639b1c9177bSFiona Trahe
640fd5f9fb9SCiara Power    cd ./<build_dir>/app/test
641fd5f9fb9SCiara Power    ./dpdk-test -l1 -n1 -w <your qat bdf>
642b1c9177bSFiona Trahe    RTE>>cryptodev_qat_autotest
643b1c9177bSFiona Trahe
644bfd84d7eSArek KusztalQAT ASYM crypto PMD can be tested by running the test application::
645bfd84d7eSArek Kusztal
646fd5f9fb9SCiara Power    cd ./<build_dir>/app/test
647fd5f9fb9SCiara Power    ./dpdk-test -l1 -n1 -w <your qat bdf>
648bfd84d7eSArek Kusztal    RTE>>cryptodev_qat_asym_autotest
649bfd84d7eSArek Kusztal
650b1c9177bSFiona TraheQAT compression PMD can be tested by running the test application::
651b1c9177bSFiona Trahe
652fd5f9fb9SCiara Power    cd ./<build_dir>/app/test
653fd5f9fb9SCiara Power    ./dpdk-test -l1 -n1 -w <your qat bdf>
654b1c9177bSFiona Trahe    RTE>>compressdev_autotest
655b1c9177bSFiona Trahe
6569333cfbaSPablo de Lara
6575394c11dSFiona TraheDebugging
65859ad25feSFiona Trahe~~~~~~~~~
6595394c11dSFiona Trahe
6605394c11dSFiona TraheThere are 2 sets of trace available via the dynamic logging feature:
6615394c11dSFiona Trahe
6625394c11dSFiona Trahe* pmd.qat_dp exposes trace on the data-path.
6635394c11dSFiona Trahe* pmd.qat_general exposes all other trace.
6645394c11dSFiona Trahe
6655394c11dSFiona Trahepmd.qat exposes both sets of traces.
6665394c11dSFiona TraheThey can be enabled using the log-level option (where 8=maximum log level) on
6675394c11dSFiona Trahethe process cmdline, e.g. using any of the following::
6685394c11dSFiona Trahe
6695394c11dSFiona Trahe    --log-level="pmd.qat_general,8"
6705394c11dSFiona Trahe    --log-level="pmd.qat_dp,8"
6715394c11dSFiona Trahe    --log-level="pmd.qat,8"
6725394c11dSFiona Trahe
6735394c11dSFiona Trahe.. Note::
6745394c11dSFiona Trahe
6755394c11dSFiona Trahe    The global RTE_LOG_DP_LEVEL overrides data-path trace so must be set to
6765394c11dSFiona Trahe    RTE_LOG_DEBUG to see all the trace. This variable is in config/rte_config.h
677fd5f9fb9SCiara Power    for meson build.
6785394c11dSFiona Trahe    Also the dynamic global log level overrides both sets of trace, so e.g. no
6795394c11dSFiona Trahe    QAT trace would display in this case::
6805394c11dSFiona Trahe
6815394c11dSFiona Trahe	--log-level="7" --log-level="pmd.qat_general,8"
682