xref: /dpdk/doc/guides/cryptodevs/qat.rst (revision c13cecf60f128cc6ae89557d9799f4f92d785cdc)
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``
25259310f3SFiona Trahe* ``Intel QuickAssist Technology D15xx``
269cd9d3e7SAdam Dybkowski* ``Intel QuickAssist Technology P5xxx``
271703e94aSDeclan Doherty
281703e94aSDeclan Doherty
291703e94aSDeclan DohertyFeatures
3059ad25feSFiona Trahe~~~~~~~~
311703e94aSDeclan Doherty
32bfd84d7eSArek KusztalThe QAT SYM PMD has support for:
331703e94aSDeclan Doherty
341703e94aSDeclan DohertyCipher algorithms:
351703e94aSDeclan Doherty
36e1b7f509SFiona Trahe* ``RTE_CRYPTO_CIPHER_3DES_CBC``
37e1b7f509SFiona Trahe* ``RTE_CRYPTO_CIPHER_3DES_CTR``
38fddf3804SDeepak Kumar Jain* ``RTE_CRYPTO_CIPHER_AES128_CBC``
39fddf3804SDeepak Kumar Jain* ``RTE_CRYPTO_CIPHER_AES192_CBC``
40fddf3804SDeepak Kumar Jain* ``RTE_CRYPTO_CIPHER_AES256_CBC``
41fddf3804SDeepak Kumar Jain* ``RTE_CRYPTO_CIPHER_AES128_CTR``
42fddf3804SDeepak Kumar Jain* ``RTE_CRYPTO_CIPHER_AES192_CTR``
43fddf3804SDeepak Kumar Jain* ``RTE_CRYPTO_CIPHER_AES256_CTR``
447d5ef3bbSDamian Nowak* ``RTE_CRYPTO_CIPHER_AES_XTS``
45fddf3804SDeepak Kumar Jain* ``RTE_CRYPTO_CIPHER_SNOW3G_UEA2``
46db0e952aSDeepak Kumar Jain* ``RTE_CRYPTO_CIPHER_NULL``
47d4f27453SDeepak Kumar Jain* ``RTE_CRYPTO_CIPHER_KASUMI_F8``
486cd8b4d8SArek Kusztal* ``RTE_CRYPTO_CIPHER_DES_CBC``
49d18ab45fSFiona Trahe* ``RTE_CRYPTO_CIPHER_AES_DOCSISBPI``
50d18ab45fSFiona Trahe* ``RTE_CRYPTO_CIPHER_DES_DOCSISBPI``
51d9b7d5bbSArek Kusztal* ``RTE_CRYPTO_CIPHER_ZUC_EEA3``
521703e94aSDeclan Doherty
531703e94aSDeclan DohertyHash algorithms:
541703e94aSDeclan Doherty
551703e94aSDeclan Doherty* ``RTE_CRYPTO_AUTH_SHA1_HMAC``
56ebdbe12fSDeepak Kumar Jain* ``RTE_CRYPTO_AUTH_SHA224_HMAC``
571703e94aSDeclan Doherty* ``RTE_CRYPTO_AUTH_SHA256_HMAC``
58d905ee32SDeepak Kumar Jain* ``RTE_CRYPTO_AUTH_SHA384_HMAC``
591703e94aSDeclan Doherty* ``RTE_CRYPTO_AUTH_SHA512_HMAC``
601703e94aSDeclan Doherty* ``RTE_CRYPTO_AUTH_AES_XCBC_MAC``
61a38dfe97SDeepak Kumar Jain* ``RTE_CRYPTO_AUTH_SNOW3G_UIA2``
6261ec5181SArek Kusztal* ``RTE_CRYPTO_AUTH_MD5_HMAC``
63db0e952aSDeepak Kumar Jain* ``RTE_CRYPTO_AUTH_NULL``
64d4f27453SDeepak Kumar Jain* ``RTE_CRYPTO_AUTH_KASUMI_F9``
652fa64f84SArek Kusztal* ``RTE_CRYPTO_AUTH_AES_GMAC``
66d9b7d5bbSArek Kusztal* ``RTE_CRYPTO_AUTH_ZUC_EIA3``
6791c1daa4STomasz Cel* ``RTE_CRYPTO_AUTH_AES_CMAC``
681703e94aSDeclan Doherty
69b79e4c00SPablo de LaraSupported AEAD algorithms:
70655c901bSAndrea Grandi
71b79e4c00SPablo de Lara* ``RTE_CRYPTO_AEAD_AES_GCM``
727bd6f76eSTomasz Cel* ``RTE_CRYPTO_AEAD_AES_CCM``
73b79e4c00SPablo de Lara
741703e94aSDeclan Doherty
75bcd7e3e8SAdam DybkowskiSupported Chains
76bcd7e3e8SAdam Dybkowski~~~~~~~~~~~~~~~~
77bcd7e3e8SAdam Dybkowski
78bcd7e3e8SAdam DybkowskiAll the usual chains are supported and also some mixed chains:
79bcd7e3e8SAdam Dybkowski
80bcd7e3e8SAdam Dybkowski.. table:: Supported hash-cipher chains for wireless digest-encrypted cases
81bcd7e3e8SAdam Dybkowski
82bcd7e3e8SAdam Dybkowski   +------------------+-----------+-------------+----------+----------+
83bcd7e3e8SAdam Dybkowski   | Cipher algorithm | NULL AUTH | SNOW3G UIA2 | ZUC EIA3 | AES CMAC |
84bcd7e3e8SAdam Dybkowski   +==================+===========+=============+==========+==========+
85a1598e90SAdam Dybkowski   | NULL CIPHER      | Y         | 2&3         | 2&3      | Y        |
86bcd7e3e8SAdam Dybkowski   +------------------+-----------+-------------+----------+----------+
87a1598e90SAdam Dybkowski   | SNOW3G UEA2      | 2&3       | Y           | 2&3      | 2&3      |
88bcd7e3e8SAdam Dybkowski   +------------------+-----------+-------------+----------+----------+
89a1598e90SAdam Dybkowski   | ZUC EEA3         | 2&3       | 2&3         | 2&3      | 2&3      |
90bcd7e3e8SAdam Dybkowski   +------------------+-----------+-------------+----------+----------+
91a1598e90SAdam Dybkowski   | AES CTR          | Y         | 2&3         | 2&3      | Y        |
92bcd7e3e8SAdam Dybkowski   +------------------+-----------+-------------+----------+----------+
93bcd7e3e8SAdam Dybkowski
94bcd7e3e8SAdam Dybkowski* The combinations marked as "Y" are supported on all QAT hardware versions.
95bcd7e3e8SAdam Dybkowski* The combinations marked as "2&3" are supported on GEN2/GEN3 QAT hardware only.
96bcd7e3e8SAdam Dybkowski
97bcd7e3e8SAdam Dybkowski
981703e94aSDeclan DohertyLimitations
9959ad25feSFiona Trahe~~~~~~~~~~~
1001703e94aSDeclan Doherty
1011703e94aSDeclan Doherty* Only supports the session-oriented API implementation (session-less APIs are not supported).
1022142e6dcSPablo de Lara* SNOW 3G (UEA2), KASUMI (F8) and ZUC (EEA3) supported only if cipher length and offset fields are byte-multiple.
1039333cfbaSPablo de Lara* SNOW 3G (UIA2) and ZUC (EIA3) supported only if hash length and offset fields are byte-multiple.
1048831895bSFiona Trahe* No BSD support as BSD QAT kernel driver not available.
105d9b7d5bbSArek Kusztal* ZUC EEA3/EIA3 is not supported by dh895xcc devices
1062a7bb4fdSFiona 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.
107026f21c0SFiona Trahe* Queue-pairs are thread-safe on Intel CPUs but Queues are not (that is, within a single
108026f21c0SFiona Trahe  queue-pair all enqueues to the TX queue must be done from one thread and all dequeues
109026f21c0SFiona Trahe  from the RX queue must be done from one thread, but enqueues and dequeues may be done
110026f21c0SFiona Trahe  in different threads.)
111aa983f03SAdam Dybkowski* A GCM limitation exists, but only in the case where there are multiple
112aa983f03SAdam Dybkowski  generations of QAT devices on a single platform.
113aa983f03SAdam Dybkowski  To optimise performance, the GCM crypto session should be initialised for the
114aa983f03SAdam Dybkowski  device generation to which the ops will be enqueued. Specifically if a GCM
115aa983f03SAdam Dybkowski  session is initialised on a GEN2 device, but then attached to an op enqueued
116aa983f03SAdam Dybkowski  to a GEN3 device, it will work but cannot take advantage of hardware
117aa983f03SAdam Dybkowski  optimisations in the GEN3 device. And if a GCM session is initialised on a
118aa983f03SAdam Dybkowski  GEN3 device, then attached to an op sent to a GEN1/GEN2 device, it will not be
119aa983f03SAdam Dybkowski  enqueued to the device and will be marked as failed. The simplest way to
120aa983f03SAdam Dybkowski  mitigate this is to use the bdf whitelist to avoid mixing devices of different
121aa983f03SAdam Dybkowski  generations in the same process if planning to use for GCM.
122a1598e90SAdam Dybkowski* The mixed algo feature on GEN2 is not supported by all kernel drivers. Check
123a1598e90SAdam Dybkowski  the notes under the Available Kernel Drivers table below for specific details.
1241703e94aSDeclan Doherty
125bb44fb6fSFiona TraheExtra notes on KASUMI F9
12659ad25feSFiona Trahe~~~~~~~~~~~~~~~~~~~~~~~~
1271703e94aSDeclan Doherty
128bb44fb6fSFiona TraheWhen using KASUMI F9 authentication algorithm, the input buffer must be
129aa38c849SFiona Traheconstructed according to the
130aa38c849SFiona Trahe`3GPP KASUMI specification <http://cryptome.org/3gpp/35201-900.pdf>`_
131aa38c849SFiona Trahe(section 4.4, page 13). The input buffer has to have COUNT (4 bytes),
132aa38c849SFiona TraheFRESH (4 bytes), MESSAGE and DIRECTION (1 bit) concatenated. After the DIRECTION
133aa38c849SFiona Trahebit, a single '1' bit is appended, followed by between 0 and 7 '0' bits, so that
134aa38c849SFiona Trahethe total length of the buffer is multiple of 8 bits. Note that the actual
135aa38c849SFiona Trahemessage can be any length, specified in bits.
136bb44fb6fSFiona Trahe
137bb44fb6fSFiona TraheOnce this buffer is passed this way, when creating the crypto operation,
138aa38c849SFiona Trahelength of data to authenticate "op.sym.auth.data.length" must be the length
139bb44fb6fSFiona Traheof all the items described above, including the padding at the end.
140aa38c849SFiona TraheAlso, offset of data to authenticate "op.sym.auth.data.offset"
141bb44fb6fSFiona Trahemust be such that points at the start of the COUNT bytes.
142bb44fb6fSFiona Trahe
143f81cbc20SArek KusztalAsymmetric Crypto Service on QAT
144f81cbc20SArek Kusztal--------------------------------
145bb44fb6fSFiona Trahe
146bfd84d7eSArek KusztalThe QAT asymmetric crypto PMD (hereafter referred to as `QAT ASYM [PMD]`) provides
147bfd84d7eSArek Kusztalpoll mode crypto driver support for the following hardware accelerator devices:
148f81cbc20SArek Kusztal
149bfd84d7eSArek Kusztal* ``Intel QuickAssist Technology DH895xCC``
150bfd84d7eSArek Kusztal* ``Intel QuickAssist Technology C62x``
151bfd84d7eSArek Kusztal* ``Intel QuickAssist Technology C3xxx``
152bfd84d7eSArek Kusztal* ``Intel QuickAssist Technology D15xx``
1539cd9d3e7SAdam Dybkowski* ``Intel QuickAssist Technology P5xxx``
154bfd84d7eSArek Kusztal
155bfd84d7eSArek KusztalThe QAT ASYM PMD has support for:
156bfd84d7eSArek Kusztal
157bfd84d7eSArek Kusztal* ``RTE_CRYPTO_ASYM_XFORM_MODEX``
158bfd84d7eSArek Kusztal* ``RTE_CRYPTO_ASYM_XFORM_MODINV``
159fb70b33bSArek Kusztal
160f81cbc20SArek KusztalLimitations
161f81cbc20SArek Kusztal~~~~~~~~~~~
162bb44fb6fSFiona Trahe
163bfd84d7eSArek Kusztal* Big integers longer than 4096 bits are not supported.
164026f21c0SFiona Trahe* Queue-pairs are thread-safe on Intel CPUs but Queues are not (that is, within a single
165026f21c0SFiona Trahe  queue-pair all enqueues to the TX queue must be done from one thread and all dequeues
166026f21c0SFiona Trahe  from the RX queue must be done from one thread, but enqueues and dequeues may be done
167026f21c0SFiona Trahe  in different threads.)
168e2c5f4eaSArek Kusztal* RSA-2560, RSA-3584 are not supported
169bfd84d7eSArek Kusztal
17059ad25feSFiona Trahe.. _building_qat:
17159ad25feSFiona Trahe
17259ad25feSFiona TraheBuilding PMDs on QAT
17359ad25feSFiona Trahe--------------------
174bb44fb6fSFiona Trahe
17502545b6cSFiona TraheA QAT device can host multiple acceleration services:
17602545b6cSFiona Trahe
17702545b6cSFiona Trahe* symmetric cryptography
17802545b6cSFiona Trahe* data compression
179f81cbc20SArek Kusztal* asymmetric cryptography
18002545b6cSFiona Trahe
18102545b6cSFiona TraheThese services are provided to DPDK applications via PMDs which register to
18202545b6cSFiona Traheimplement the corresponding cryptodev and compressdev APIs. The PMDs use
18302545b6cSFiona Trahecommon QAT driver code which manages the QAT PCI device. They also depend on a
18402545b6cSFiona TraheQAT kernel driver being installed on the platform, see :ref:`qat_kernel` below.
1851703e94aSDeclan Doherty
186bb44fb6fSFiona Trahe
18702545b6cSFiona TraheConfiguring and Building the DPDK QAT PMDs
18802545b6cSFiona Trahe~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
18902545b6cSFiona Trahe
19002545b6cSFiona Trahe
19102545b6cSFiona TraheFurther information on configuring, building and installing DPDK is described
19243628b3dSDavid Marchand:doc:`here <../linux_gsg/build_dpdk>`.
19302545b6cSFiona Trahe
19402545b6cSFiona Trahe
19502545b6cSFiona TraheQuick instructions for QAT cryptodev PMD are as follows:
196d6740135SEoin Breen
197d6740135SEoin Breen.. code-block:: console
198d6740135SEoin Breen
199f546c1edSFiona Trahe	cd to the top-level DPDK directory
20002545b6cSFiona Trahe	make defconfig
201bb44fb6fSFiona Trahe	sed -i 's,\(CONFIG_RTE_LIBRTE_PMD_QAT_SYM\)=n,\1=y,' build/.config
202bfd84d7eSArek Kusztal	or/and
203bfd84d7eSArek Kusztal	sed -i 's,\(CONFIG_RTE_LIBRTE_PMD_QAT_ASYM\)=n,\1=y,' build/.config
204d6740135SEoin Breen	make
205d6740135SEoin Breen
20602545b6cSFiona TraheQuick instructions for QAT compressdev PMD are as follows:
207bb44fb6fSFiona Trahe
20802545b6cSFiona Trahe.. code-block:: console
209bb44fb6fSFiona Trahe
21002545b6cSFiona Trahe	cd to the top-level DPDK directory
21102545b6cSFiona Trahe	make defconfig
21202545b6cSFiona Trahe	make
213bb44fb6fSFiona Trahe
214bb44fb6fSFiona Trahe
2155f40555bSTomasz Jozwiak.. _building_qat_config:
2165f40555bSTomasz Jozwiak
2177ce27b9eSFiona TraheBuild Configuration
2187ce27b9eSFiona Trahe~~~~~~~~~~~~~~~~~~~
2197ce27b9eSFiona Trahe
2207ce27b9eSFiona TraheThese are the build configuration options affecting QAT, and their default values:
2217ce27b9eSFiona Trahe
2227ce27b9eSFiona Trahe.. code-block:: console
2237ce27b9eSFiona Trahe
2247ce27b9eSFiona Trahe	CONFIG_RTE_LIBRTE_PMD_QAT=y
2257ce27b9eSFiona Trahe	CONFIG_RTE_LIBRTE_PMD_QAT_SYM=n
226bfd84d7eSArek Kusztal	CONFIG_RTE_LIBRTE_PMD_QAT_ASYM=n
2277ce27b9eSFiona Trahe	CONFIG_RTE_PMD_QAT_MAX_PCI_DEVICES=48
2284e8f2d6aSFiona Trahe	CONFIG_RTE_PMD_QAT_COMP_IM_BUFFER_SIZE=65536
2297ce27b9eSFiona Trahe
2307ce27b9eSFiona TraheCONFIG_RTE_LIBRTE_PMD_QAT must be enabled for any QAT PMD to be built.
2317ce27b9eSFiona Trahe
232bfd84d7eSArek KusztalBoth QAT SYM PMD and QAT ASYM PMD have an external dependency on libcrypto, so are not
233bfd84d7eSArek Kusztalbuilt by default. CONFIG_RTE_LIBRTE_PMD_QAT_SYM/ASYM should be enabled to build them.
2347ce27b9eSFiona Trahe
2357ce27b9eSFiona TraheThe QAT compressdev PMD has no external dependencies, so needs no configuration
2367ce27b9eSFiona Traheoptions and is built by default.
2377ce27b9eSFiona Trahe
2387ce27b9eSFiona TraheThe number of VFs per PF varies - see table below. If multiple QAT packages are
2397ce27b9eSFiona Traheinstalled on a platform then CONFIG_RTE_PMD_QAT_MAX_PCI_DEVICES should be
2407ce27b9eSFiona Traheadjusted to the number of VFs which the QAT common code will need to handle.
241bfd84d7eSArek Kusztal
242bfd84d7eSArek Kusztal.. Note::
243bfd84d7eSArek Kusztal
244bfd84d7eSArek Kusztal        There are separate config items (not QAT-specific) for max cryptodevs
245bfd84d7eSArek Kusztal        CONFIG_RTE_CRYPTO_MAX_DEVS and max compressdevs CONFIG_RTE_COMPRESS_MAX_DEVS,
246bfd84d7eSArek Kusztal        if necessary these should be adjusted to handle the total of QAT and other
247bfd84d7eSArek Kusztal        devices which the process will use. In particular for crypto, where each
248bfd84d7eSArek Kusztal        QAT VF may expose two crypto devices, sym and asym, it may happen that the
249bfd84d7eSArek Kusztal        number of devices will be bigger than MAX_DEVS and the process will show an error
250bfd84d7eSArek Kusztal        during PMD initialisation. To avoid this problem CONFIG_RTE_CRYPTO_MAX_DEVS may be
251bfd84d7eSArek Kusztal        increased or -w, pci-whitelist domain:bus:devid:func option may be used.
252bfd84d7eSArek Kusztal
2537ce27b9eSFiona Trahe
2544e8f2d6aSFiona TraheQAT compression PMD needs intermediate buffers to support Deflate compression
2554e8f2d6aSFiona Trahewith Dynamic Huffman encoding. CONFIG_RTE_PMD_QAT_COMP_IM_BUFFER_SIZE
2564e8f2d6aSFiona Trahespecifies the size of a single buffer, the PMD will allocate a multiple of these,
2575f40555bSTomasz Jozwiakplus some extra space for associated meta-data. For GEN2 devices, 20 buffers are
2585f40555bSTomasz Jozwiakallocated while for GEN1 devices, 12 buffers are allocated, plus 1472 bytes overhead.
2594e8f2d6aSFiona Trahe
2604e8f2d6aSFiona Trahe.. Note::
2614e8f2d6aSFiona Trahe
2624e8f2d6aSFiona Trahe	If the compressed output of a Deflate operation using Dynamic Huffman
2634e8f2d6aSFiona Trahe	Encoding is too big to fit in an intermediate buffer, then the
264*c13cecf6SAdam Dybkowski	operation will be split into smaller operations and their results will
265*c13cecf6SAdam Dybkowski	be merged afterwards.
266*c13cecf6SAdam Dybkowski	This is not possible if any checksum calculation was requested - in such
267*c13cecf6SAdam Dybkowski	case the code falls back to fixed compression.
268a720e674STomasz Jozwiak	To avoid this less performant case, applications should configure
269a720e674STomasz Jozwiak	the intermediate buffer size to be larger than the expected input data size
270a720e674STomasz Jozwiak	(compressed output size is usually unknown, so the only option is to make
271a720e674STomasz Jozwiak	larger than the input size).
2724e8f2d6aSFiona Trahe
273bb44fb6fSFiona Trahe
27447c3f7a4SArek KusztalRunning QAT PMD with minimum threshold for burst size
27547c3f7a4SArek Kusztal~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27647c3f7a4SArek Kusztal
27747c3f7a4SArek KusztalIf only a small number or packets can be enqueued. Each enqueue causes an expensive MMIO write.
27847c3f7a4SArek KusztalThese MMIO write occurrences can be optimised by setting any of the following parameters:
27947c3f7a4SArek Kusztal
28047c3f7a4SArek Kusztal- qat_sym_enq_threshold
28147c3f7a4SArek Kusztal- qat_asym_enq_threshold
28247c3f7a4SArek Kusztal- qat_comp_enq_threshold
28347c3f7a4SArek Kusztal
28447c3f7a4SArek KusztalWhen any of these parameters is set rte_cryptodev_enqueue_burst function will
28547c3f7a4SArek Kusztalreturn 0 (thereby avoiding an MMIO) if the device is congested and number of packets
28647c3f7a4SArek Kusztalpossible to enqueue is smaller.
28747c3f7a4SArek KusztalTo use this feature the user must set the parameter on process start as a device additional parameter::
28847c3f7a4SArek Kusztal
28947c3f7a4SArek Kusztal  -w 03:01.1,qat_sym_enq_threshold=32,qat_comp_enq_threshold=16
29047c3f7a4SArek Kusztal
29147c3f7a4SArek KusztalAll parameters can be used with the same device regardless of order. Parameters are separated
29247c3f7a4SArek Kusztalby comma. When the same parameter is used more than once first occurrence of the parameter
29347c3f7a4SArek Kusztalis used.
29447c3f7a4SArek KusztalMaximum threshold that can be set is 32.
29547c3f7a4SArek Kusztal
29647c3f7a4SArek Kusztal
297bb44fb6fSFiona TraheDevice and driver naming
29859ad25feSFiona Trahe~~~~~~~~~~~~~~~~~~~~~~~~
299bb44fb6fSFiona Trahe
300bfd84d7eSArek Kusztal* The qat cryptodev symmetric crypto driver name is "crypto_qat".
301bfd84d7eSArek Kusztal* The qat cryptodev asymmetric crypto driver name is "crypto_qat_asym".
302bb44fb6fSFiona Trahe
303bfd84d7eSArek KusztalThe "rte_cryptodev_devices_get()" returns the devices exposed by either of these drivers.
304bfd84d7eSArek Kusztal
305bfd84d7eSArek Kusztal* Each qat sym crypto device has a unique name, in format
306aa38c849SFiona Trahe  "<pci bdf>_<service>", e.g. "0000:41:01.0_qat_sym".
307bfd84d7eSArek Kusztal* Each qat asym crypto device has a unique name, in format
308bfd84d7eSArek Kusztal  "<pci bdf>_<service>", e.g. "0000:41:01.0_qat_asym".
309aa38c849SFiona Trahe  This name can be passed to "rte_cryptodev_get_dev_id()" to get the device_id.
310bb44fb6fSFiona Trahe
311bb44fb6fSFiona Trahe.. Note::
312bb44fb6fSFiona Trahe
313bfd84d7eSArek Kusztal	The cryptodev driver name is passed to the dpdk-test-crypto-perf tool in the "-devtype" parameter.
314bb44fb6fSFiona Trahe
315bb44fb6fSFiona Trahe	The qat crypto device name is in the format of the slave parameter passed to the crypto scheduler.
316bb44fb6fSFiona Trahe
317df8cca46SFiona Trahe* The qat compressdev driver name is "compress_qat".
318bb44fb6fSFiona Trahe  The rte_compressdev_devices_get() returns the devices exposed by this driver.
319bb44fb6fSFiona Trahe
320bb44fb6fSFiona Trahe* Each qat compression device has a unique name, in format
321bb44fb6fSFiona Trahe  <pci bdf>_<service>, e.g. "0000:41:01.0_qat_comp".
322bb44fb6fSFiona Trahe  This name can be passed to rte_compressdev_get_dev_id() to get the device_id.
323bb44fb6fSFiona Trahe
32402545b6cSFiona Trahe.. _qat_kernel:
32502545b6cSFiona Trahe
32602545b6cSFiona TraheDependency on the QAT kernel driver
32702545b6cSFiona Trahe~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32802545b6cSFiona Trahe
32902545b6cSFiona TraheTo use QAT an SRIOV-enabled QAT kernel driver is required. The VF
33002545b6cSFiona Trahedevices created and initialised by this driver will be used by the QAT PMDs.
33102545b6cSFiona Trahe
33202545b6cSFiona TraheInstructions for installation are below, but first an explanation of the
33302545b6cSFiona Traherelationships between the PF/VF devices and the PMDs visible to
33402545b6cSFiona TraheDPDK applications.
33502545b6cSFiona Trahe
33602545b6cSFiona TraheEach QuickAssist PF device exposes a number of VF devices. Each VF device can
337bfd84d7eSArek Kusztalenable one symmetric cryptodev PMD and/or one asymmetric cryptodev PMD and/or
338bfd84d7eSArek Kusztalone compressdev PMD.
33902545b6cSFiona TraheThese QAT PMDs share the same underlying device and pci-mgmt code, but are
34002545b6cSFiona Traheenumerated independently on their respective APIs and appear as independent
34102545b6cSFiona Trahedevices to applications.
34202545b6cSFiona Trahe
34302545b6cSFiona Trahe.. Note::
34402545b6cSFiona Trahe
34502545b6cSFiona Trahe   Each VF can only be used by one DPDK process. It is not possible to share
34602545b6cSFiona Trahe   the same VF across multiple processes, even if these processes are using
34702545b6cSFiona Trahe   different acceleration services.
34802545b6cSFiona Trahe
34902545b6cSFiona Trahe   Conversely one DPDK process can use one or more QAT VFs and can expose both
35002545b6cSFiona Trahe   cryptodev and compressdev instances on each of those VFs.
35102545b6cSFiona Trahe
352bb44fb6fSFiona Trahe
353bb44fb6fSFiona TraheAvailable kernel drivers
35459ad25feSFiona Trahe~~~~~~~~~~~~~~~~~~~~~~~~
355bb44fb6fSFiona Trahe
356ab3dec55SFiona TraheKernel drivers for each device for each service are listed in the following table. (Scroll right
357ab3dec55SFiona Traheto see the full table)
358bb44fb6fSFiona Trahe
3591703e94aSDeclan Doherty
360f546c1edSFiona Trahe.. _table_qat_pmds_drivers:
361f546c1edSFiona Trahe
362f5160653SArek Kusztal.. table:: QAT device generations, devices and drivers
363f546c1edSFiona Trahe
364ab3dec55SFiona Trahe   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
365ab3dec55SFiona Trahe   | S   | A   | C   | Gen | Device   | Driver/ver    | Kernel Module | Pci Driver | PF Did | #PFs | VF Did | VFs/PF |
366ab3dec55SFiona Trahe   +=====+=====+=====+=====+==========+===============+===============+============+========+======+========+========+
367ab3dec55SFiona Trahe   | Yes | No  | No  | 1   | DH895xCC | linux/4.4+    | qat_dh895xcc  | dh895xcc   | 435    | 1    | 443    | 32     |
368ab3dec55SFiona Trahe   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
369bfd84d7eSArek Kusztal   | Yes | Yes | No  | "   | "        | 01.org/4.2.0+ | "             | "          | "      | "    | "      | "      |
370ab3dec55SFiona Trahe   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
371bfd84d7eSArek Kusztal   | Yes | Yes | Yes | "   | "        | 01.org/4.3.0+ | "             | "          | "      | "    | "      | "      |
372ab3dec55SFiona Trahe   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
373ab3dec55SFiona Trahe   | Yes | No  | No  | 2   | C62x     | linux/4.5+    | qat_c62x      | c6xx       | 37c8   | 3    | 37c9   | 16     |
374ab3dec55SFiona Trahe   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
375bfd84d7eSArek Kusztal   | Yes | Yes | Yes | "   | "        | 01.org/4.2.0+ | "             | "          | "      | "    | "      | "      |
376ab3dec55SFiona Trahe   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
377ab3dec55SFiona Trahe   | Yes | No  | No  | 2   | C3xxx    | linux/4.5+    | qat_c3xxx     | c3xxx      | 19e2   | 1    | 19e3   | 16     |
378ab3dec55SFiona Trahe   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
379bfd84d7eSArek Kusztal   | Yes | Yes | Yes | "   | "        | 01.org/4.2.0+ | "             | "          | "      | "    | "      | "      |
380ab3dec55SFiona Trahe   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
381ab3dec55SFiona Trahe   | Yes | No  | No  | 2   | D15xx    | p             | qat_d15xx     | d15xx      | 6f54   | 1    | 6f55   | 16     |
382ab3dec55SFiona Trahe   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
3839cd9d3e7SAdam Dybkowski   | Yes | No  | No  | 3   | P5xxx    | p             | qat_p5xxx     | p5xxx      | 18a0   | 1    | 18a1   | 128    |
384ab3dec55SFiona Trahe   +-----+-----+-----+-----+----------+---------------+---------------+------------+--------+------+--------+--------+
385f546c1edSFiona Trahe
386a1598e90SAdam Dybkowski* Note: Symmetric mixed crypto algorithms feature on Gen 2 works only with 01.org driver version 4.9.0+
387a1598e90SAdam Dybkowski
388ab3dec55SFiona TraheThe first 3 columns indicate the service:
389ab3dec55SFiona Trahe
390ab3dec55SFiona Trahe* S = Symmetric crypto service (via cryptodev API)
391ab3dec55SFiona Trahe* A = Asymmetric crypto service  (via cryptodev API)
392ab3dec55SFiona Trahe* C = Compression service (via compressdev API)
393f546c1edSFiona Trahe
394f546c1edSFiona TraheThe ``Driver`` column indicates either the Linux kernel version in which
395f546c1edSFiona Trahesupport for this device was introduced or a driver available on Intel's 01.org
396ab3dec55SFiona Trahewebsite. There are both linux in-tree and 01.org kernel drivers available for some
397259310f3SFiona Trahedevices. p = release pending.
398f546c1edSFiona Trahe
399f546c1edSFiona TraheIf you are running on a kernel which includes a driver for your device, see
400f546c1edSFiona Trahe`Installation using kernel.org driver`_ below. Otherwise see
401f546c1edSFiona Trahe`Installation using 01.org QAT driver`_.
402f546c1edSFiona Trahe
403f546c1edSFiona Trahe
404f546c1edSFiona TraheInstallation using kernel.org driver
40559ad25feSFiona Trahe~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
406f546c1edSFiona Trahe
407f546c1edSFiona TraheThe examples below are based on the C62x device, if you have a different device
408f546c1edSFiona Traheuse the corresponding values in the above table.
409f546c1edSFiona Trahe
410f546c1edSFiona TraheIn BIOS ensure that SRIOV is enabled and either:
411f546c1edSFiona Trahe
412f546c1edSFiona Trahe* Disable VT-d or
413f546c1edSFiona Trahe* Enable VT-d and set ``"intel_iommu=on iommu=pt"`` in the grub file.
414f546c1edSFiona Trahe
415f546c1edSFiona TraheCheck that the QAT driver is loaded on your system, by executing::
416f546c1edSFiona Trahe
417f546c1edSFiona Trahe    lsmod | grep qa
418f546c1edSFiona Trahe
419f546c1edSFiona TraheYou should see the kernel module for your device listed, e.g.::
420f546c1edSFiona Trahe
421f546c1edSFiona Trahe    qat_c62x               5626  0
422f546c1edSFiona Trahe    intel_qat              82336  1 qat_c62x
423f546c1edSFiona Trahe
424f546c1edSFiona TraheNext, you need to expose the Virtual Functions (VFs) using the sysfs file system.
425f546c1edSFiona Trahe
426f546c1edSFiona TraheFirst find the BDFs (Bus-Device-Function) of the physical functions (PFs) of
427f546c1edSFiona Traheyour device, e.g.::
428f546c1edSFiona Trahe
429f546c1edSFiona Trahe    lspci -d:37c8
430f546c1edSFiona Trahe
431f546c1edSFiona TraheYou should see output similar to::
432f546c1edSFiona Trahe
433f546c1edSFiona Trahe    1a:00.0 Co-processor: Intel Corporation Device 37c8
434f546c1edSFiona Trahe    3d:00.0 Co-processor: Intel Corporation Device 37c8
435f546c1edSFiona Trahe    3f:00.0 Co-processor: Intel Corporation Device 37c8
436f546c1edSFiona Trahe
437f546c1edSFiona TraheEnable the VFs for each PF by echoing the number of VFs per PF to the pci driver::
438f546c1edSFiona Trahe
439f546c1edSFiona Trahe     echo 16 > /sys/bus/pci/drivers/c6xx/0000:1a:00.0/sriov_numvfs
440f546c1edSFiona Trahe     echo 16 > /sys/bus/pci/drivers/c6xx/0000:3d:00.0/sriov_numvfs
441f546c1edSFiona Trahe     echo 16 > /sys/bus/pci/drivers/c6xx/0000:3f:00.0/sriov_numvfs
442f546c1edSFiona Trahe
443f546c1edSFiona TraheCheck that the VFs are available for use. For example ``lspci -d:37c9`` should
444f546c1edSFiona Trahelist 48 VF devices available for a ``C62x`` device.
445f546c1edSFiona Trahe
446f546c1edSFiona TraheTo complete the installation follow the instructions in
447f546c1edSFiona Trahe`Binding the available VFs to the DPDK UIO driver`_.
448f546c1edSFiona Trahe
449f546c1edSFiona Trahe.. Note::
450f546c1edSFiona Trahe
451f546c1edSFiona Trahe   If the QAT kernel modules are not loaded and you see an error like ``Failed
452f546c1edSFiona Trahe   to load MMP firmware qat_895xcc_mmp.bin`` in kernel logs, this may be as a
453f546c1edSFiona Trahe   result of not using a distribution, but just updating the kernel directly.
454f546c1edSFiona Trahe
455f546c1edSFiona Trahe   Download firmware from the `kernel firmware repo
456f546c1edSFiona Trahe   <http://git.kernel.org/cgit/linux/kernel/git/firmware/linux-firmware.git/tree/>`_.
457f546c1edSFiona Trahe
458f546c1edSFiona Trahe   Copy qat binaries to ``/lib/firmware``::
459f546c1edSFiona Trahe
460f546c1edSFiona Trahe      cp qat_895xcc.bin /lib/firmware
461f546c1edSFiona Trahe      cp qat_895xcc_mmp.bin /lib/firmware
462f546c1edSFiona Trahe
463f546c1edSFiona Trahe   Change to your linux source root directory and start the qat kernel modules::
464f546c1edSFiona Trahe
465f546c1edSFiona Trahe      insmod ./drivers/crypto/qat/qat_common/intel_qat.ko
466f546c1edSFiona Trahe      insmod ./drivers/crypto/qat/qat_dh895xcc/qat_dh895xcc.ko
467f546c1edSFiona Trahe
468f546c1edSFiona Trahe
469f546c1edSFiona Trahe.. Note::
470f546c1edSFiona Trahe
471f546c1edSFiona Trahe   If you see the following warning in ``/var/log/messages`` it can be ignored:
472f546c1edSFiona Trahe   ``IOMMU should be enabled for SR-IOV to work correctly``.
473ae20c073SDeepak Kumar Jain
4741703e94aSDeclan Doherty
4751703e94aSDeclan DohertyInstallation using 01.org QAT driver
47659ad25feSFiona Trahe~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4771703e94aSDeclan Doherty
4781703e94aSDeclan DohertyDownload the latest QuickAssist Technology Driver from `01.org
479f546c1edSFiona Trahe<https://01.org/packet-processing/intel%C2%AE-quickassist-technology-drivers-and-patches>`_.
4801703e94aSDeclan DohertyConsult the *Getting Started Guide* at the same URL for further information.
4811703e94aSDeclan Doherty
4821703e94aSDeclan DohertyThe steps below assume you are:
4831703e94aSDeclan Doherty
484bb44fb6fSFiona Trahe* Building on a platform with one ``C62x`` device.
485bb44fb6fSFiona Trahe* Using package ``qat1.7.l.4.2.0-000xx.tar.gz``.
486bb44fb6fSFiona Trahe* On Fedora26 kernel ``4.11.11-300.fc26.x86_64``.
4871703e94aSDeclan Doherty
4881703e94aSDeclan DohertyIn the BIOS ensure that SRIOV is enabled and VT-d is disabled.
4891703e94aSDeclan Doherty
4901703e94aSDeclan DohertyUninstall any existing QAT driver, for example by running:
4911703e94aSDeclan Doherty
4921703e94aSDeclan Doherty* ``./installer.sh uninstall`` in the directory where originally installed.
4931703e94aSDeclan Doherty
4941703e94aSDeclan Doherty
4951703e94aSDeclan DohertyBuild and install the SRIOV-enabled QAT driver::
4961703e94aSDeclan Doherty
4971703e94aSDeclan Doherty    mkdir /QAT
4981703e94aSDeclan Doherty    cd /QAT
499f546c1edSFiona Trahe
500bb44fb6fSFiona Trahe    # Copy the package to this location and unpack
501bb44fb6fSFiona Trahe    tar zxof qat1.7.l.4.2.0-000xx.tar.gz
5021703e94aSDeclan Doherty
503bb44fb6fSFiona Trahe    ./configure --enable-icp-sriov=host
504bb44fb6fSFiona Trahe    make install
5051703e94aSDeclan Doherty
506bb44fb6fSFiona 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.
507bb44fb6fSFiona TraheYou can use ``lspci -d:37c9`` to confirm the presence of the 16 VF devices available per ``C62x`` PF.
508bb44fb6fSFiona Trahe
509bb44fb6fSFiona TraheConfirm the driver is correctly installed and is using firmware version 4.2.0::
510bb44fb6fSFiona Trahe
511bb44fb6fSFiona Trahe    cat /sys/kernel/debug/qat<your device type and bdf>/version/fw
512bb44fb6fSFiona Trahe
513bb44fb6fSFiona Trahe
514bb44fb6fSFiona TraheConfirm the presence of 48 VF devices - 16 per PF::
515bb44fb6fSFiona Trahe
516bb44fb6fSFiona Trahe    lspci -d:37c9
517bb44fb6fSFiona Trahe
5181703e94aSDeclan Doherty
5191703e94aSDeclan DohertyTo complete the installation - follow instructions in `Binding the available VFs to the DPDK UIO driver`_.
5201703e94aSDeclan Doherty
521f546c1edSFiona Trahe.. Note::
522f546c1edSFiona Trahe
523f546c1edSFiona Trahe   If using a later kernel and the build fails with an error relating to
524f546c1edSFiona Trahe   ``strict_stroul`` not being available apply the following patch:
5251703e94aSDeclan Doherty
5261703e94aSDeclan Doherty   .. code-block:: diff
5271703e94aSDeclan Doherty
5281703e94aSDeclan Doherty      /QAT/QAT1.6/quickassist/utilities/downloader/Target_CoreLibs/uclo/include/linux/uclo_platform.h
5291703e94aSDeclan Doherty      + #if LINUX_VERSION_CODE >= KERNEL_VERSION(3,18,5)
5301703e94aSDeclan Doherty      + #define STR_TO_64(str, base, num, endPtr) {endPtr=NULL; if (kstrtoul((str), (base), (num))) printk("Error strtoull convert %s\n", str); }
5311703e94aSDeclan Doherty      + #else
5321703e94aSDeclan Doherty      #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,38)
5331703e94aSDeclan Doherty      #define STR_TO_64(str, base, num, endPtr) {endPtr=NULL; if (strict_strtoull((str), (base), (num))) printk("Error strtoull convert %s\n", str); }
5341703e94aSDeclan Doherty      #else
5351703e94aSDeclan Doherty      #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
5361703e94aSDeclan Doherty      #define STR_TO_64(str, base, num, endPtr) {endPtr=NULL; strict_strtoll((str), (base), (num));}
5371703e94aSDeclan Doherty      #else
5381703e94aSDeclan Doherty      #define STR_TO_64(str, base, num, endPtr)                                 \
5391703e94aSDeclan Doherty           do {                                                               \
5401703e94aSDeclan Doherty                 if (str[0] == '-')                                           \
5411703e94aSDeclan Doherty                 {                                                            \
5421703e94aSDeclan Doherty                      *(num) = -(simple_strtoull((str+1), &(endPtr), (base))); \
5431703e94aSDeclan Doherty                 }else {                                                      \
5441703e94aSDeclan Doherty                      *(num) = simple_strtoull((str), &(endPtr), (base));      \
5451703e94aSDeclan Doherty                 }                                                            \
5461703e94aSDeclan Doherty           } while(0)
5471703e94aSDeclan Doherty      + #endif
5481703e94aSDeclan Doherty      #endif
5491703e94aSDeclan Doherty      #endif
5501703e94aSDeclan Doherty
5511703e94aSDeclan Doherty
552f546c1edSFiona Trahe.. Note::
5531703e94aSDeclan Doherty
554f546c1edSFiona Trahe   If the build fails due to missing header files you may need to do following::
5551703e94aSDeclan Doherty
556f546c1edSFiona Trahe      sudo yum install zlib-devel
557f546c1edSFiona Trahe      sudo yum install openssl-devel
558bb44fb6fSFiona Trahe      sudo yum install libudev-devel
5591703e94aSDeclan Doherty
560f546c1edSFiona Trahe.. Note::
5611703e94aSDeclan Doherty
562f546c1edSFiona Trahe   If the build or install fails due to mismatching kernel sources you may need to do the following::
5631703e94aSDeclan Doherty
564f546c1edSFiona Trahe      sudo yum install kernel-headers-`uname -r`
565f546c1edSFiona Trahe      sudo yum install kernel-src-`uname -r`
566f546c1edSFiona Trahe      sudo yum install kernel-devel-`uname -r`
5671703e94aSDeclan Doherty
568f2f639c6SDeepak Kumar Jain
5691703e94aSDeclan DohertyBinding the available VFs to the DPDK UIO driver
57059ad25feSFiona Trahe~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5711703e94aSDeclan Doherty
572f546c1edSFiona TraheUnbind the VFs from the stock driver so they can be bound to the uio driver.
5731703e94aSDeclan Doherty
574f546c1edSFiona TraheFor an Intel(R) QuickAssist Technology DH895xCC device
57559ad25feSFiona Trahe^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
576f546c1edSFiona Trahe
577f546c1edSFiona TraheThe unbind command below assumes ``BDFs`` of ``03:01.00-03:04.07``, if your
578f546c1edSFiona TraheVFs are different adjust the unbind command below::
5791703e94aSDeclan Doherty
5801703e94aSDeclan Doherty    for device in $(seq 1 4); do \
5811703e94aSDeclan Doherty        for fn in $(seq 0 7); do \
5821703e94aSDeclan Doherty            echo -n 0000:03:0${device}.${fn} > \
5831703e94aSDeclan Doherty            /sys/bus/pci/devices/0000\:03\:0${device}.${fn}/driver/unbind; \
5841703e94aSDeclan Doherty        done; \
5851703e94aSDeclan Doherty    done
5861703e94aSDeclan Doherty
587f546c1edSFiona TraheFor an Intel(R) QuickAssist Technology C62x device
58859ad25feSFiona Trahe^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
5891703e94aSDeclan Doherty
590f546c1edSFiona TraheThe unbind command below assumes ``BDFs`` of ``1a:01.00-1a:02.07``,
591f546c1edSFiona Trahe``3d:01.00-3d:02.07`` and ``3f:01.00-3f:02.07``, if your VFs are different
592f546c1edSFiona Traheadjust the unbind command below::
593ae20c073SDeepak Kumar Jain
594ae20c073SDeepak Kumar Jain    for device in $(seq 1 2); do \
595ae20c073SDeepak Kumar Jain        for fn in $(seq 0 7); do \
596ae20c073SDeepak Kumar Jain            echo -n 0000:1a:0${device}.${fn} > \
597ae20c073SDeepak Kumar Jain            /sys/bus/pci/devices/0000\:1a\:0${device}.${fn}/driver/unbind; \
598ae20c073SDeepak Kumar Jain
599ae20c073SDeepak Kumar Jain            echo -n 0000:3d:0${device}.${fn} > \
600ae20c073SDeepak Kumar Jain            /sys/bus/pci/devices/0000\:3d\:0${device}.${fn}/driver/unbind; \
601ae20c073SDeepak Kumar Jain
602ae20c073SDeepak Kumar Jain            echo -n 0000:3f:0${device}.${fn} > \
603ae20c073SDeepak Kumar Jain            /sys/bus/pci/devices/0000\:3f\:0${device}.${fn}/driver/unbind; \
604ae20c073SDeepak Kumar Jain        done; \
605ae20c073SDeepak Kumar Jain    done
606ae20c073SDeepak Kumar Jain
607259310f3SFiona TraheFor Intel(R) QuickAssist Technology C3xxx or D15xx device
60859ad25feSFiona Trahe^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
609ae20c073SDeepak Kumar Jain
610f546c1edSFiona TraheThe unbind command below assumes ``BDFs`` of ``01:01.00-01:02.07``, if your
611f546c1edSFiona TraheVFs are different adjust the unbind command below::
612f2f639c6SDeepak Kumar Jain
613f2f639c6SDeepak Kumar Jain    for device in $(seq 1 2); do \
614f2f639c6SDeepak Kumar Jain        for fn in $(seq 0 7); do \
615f2f639c6SDeepak Kumar Jain            echo -n 0000:01:0${device}.${fn} > \
616f2f639c6SDeepak Kumar Jain            /sys/bus/pci/devices/0000\:01\:0${device}.${fn}/driver/unbind; \
617f2f639c6SDeepak Kumar Jain        done; \
618f2f639c6SDeepak Kumar Jain    done
619f2f639c6SDeepak Kumar Jain
620f546c1edSFiona TraheBind to the DPDK uio driver
62159ad25feSFiona Trahe^^^^^^^^^^^^^^^^^^^^^^^^^^^
622f2f639c6SDeepak Kumar Jain
623f546c1edSFiona TraheInstall the DPDK igb_uio driver, bind the VF PCI Device id to it and use lspci
624f546c1edSFiona Traheto confirm the VF devices are now in use by igb_uio kernel driver,
625f546c1edSFiona Trahee.g. for the C62x device::
626f546c1edSFiona Trahe
627f546c1edSFiona Trahe    cd to the top-level DPDK directory
628f546c1edSFiona Trahe    modprobe uio
629f546c1edSFiona Trahe    insmod ./build/kmod/igb_uio.ko
630f546c1edSFiona Trahe    echo "8086 37c9" > /sys/bus/pci/drivers/igb_uio/new_id
631f546c1edSFiona Trahe    lspci -vvd:37c9
632cb4a1d14SEoin Breen
633cb4a1d14SEoin Breen
634f546c1edSFiona TraheAnother way to bind the VFs to the DPDK UIO driver is by using the
635f546c1edSFiona Trahe``dpdk-devbind.py`` script::
636cb4a1d14SEoin Breen
637f546c1edSFiona Trahe    cd to the top-level DPDK directory
638c6dab2a8SThomas Monjalon    ./usertools/dpdk-devbind.py -b igb_uio 0000:03:01.1
6399333cfbaSPablo de Lara
640b1c9177bSFiona TraheTesting
641b1c9177bSFiona Trahe~~~~~~~
642b1c9177bSFiona Trahe
643bfd84d7eSArek KusztalQAT SYM crypto PMD can be tested by running the test application::
644b1c9177bSFiona Trahe
645b1c9177bSFiona Trahe    make defconfig
646a9de470cSBruce Richardson    make -j
647b1c9177bSFiona Trahe    cd ./build/app
648b1c9177bSFiona Trahe    ./test -l1 -n1 -w <your qat bdf>
649b1c9177bSFiona Trahe    RTE>>cryptodev_qat_autotest
650b1c9177bSFiona Trahe
651bfd84d7eSArek KusztalQAT ASYM crypto PMD can be tested by running the test application::
652bfd84d7eSArek Kusztal
653bfd84d7eSArek Kusztal    make defconfig
654bfd84d7eSArek Kusztal    make -j
655bfd84d7eSArek Kusztal    cd ./build/app
656bfd84d7eSArek Kusztal    ./test -l1 -n1 -w <your qat bdf>
657bfd84d7eSArek Kusztal    RTE>>cryptodev_qat_asym_autotest
658bfd84d7eSArek Kusztal
659b1c9177bSFiona TraheQAT compression PMD can be tested by running the test application::
660b1c9177bSFiona Trahe
661b1c9177bSFiona Trahe    make defconfig
662b1c9177bSFiona Trahe    sed -i 's,\(CONFIG_RTE_COMPRESSDEV_TEST\)=n,\1=y,' build/.config
663a9de470cSBruce Richardson    make -j
664b1c9177bSFiona Trahe    cd ./build/app
665b1c9177bSFiona Trahe    ./test -l1 -n1 -w <your qat bdf>
666b1c9177bSFiona Trahe    RTE>>compressdev_autotest
667b1c9177bSFiona Trahe
6689333cfbaSPablo de Lara
6695394c11dSFiona TraheDebugging
67059ad25feSFiona Trahe~~~~~~~~~
6715394c11dSFiona Trahe
6725394c11dSFiona TraheThere are 2 sets of trace available via the dynamic logging feature:
6735394c11dSFiona Trahe
6745394c11dSFiona Trahe* pmd.qat_dp exposes trace on the data-path.
6755394c11dSFiona Trahe* pmd.qat_general exposes all other trace.
6765394c11dSFiona Trahe
6775394c11dSFiona Trahepmd.qat exposes both sets of traces.
6785394c11dSFiona TraheThey can be enabled using the log-level option (where 8=maximum log level) on
6795394c11dSFiona Trahethe process cmdline, e.g. using any of the following::
6805394c11dSFiona Trahe
6815394c11dSFiona Trahe    --log-level="pmd.qat_general,8"
6825394c11dSFiona Trahe    --log-level="pmd.qat_dp,8"
6835394c11dSFiona Trahe    --log-level="pmd.qat,8"
6845394c11dSFiona Trahe
6855394c11dSFiona Trahe.. Note::
6865394c11dSFiona Trahe
6875394c11dSFiona Trahe    The global RTE_LOG_DP_LEVEL overrides data-path trace so must be set to
6885394c11dSFiona Trahe    RTE_LOG_DEBUG to see all the trace. This variable is in config/rte_config.h
6895394c11dSFiona Trahe    for meson build and config/common_base for gnu make.
6905394c11dSFiona Trahe    Also the dynamic global log level overrides both sets of trace, so e.g. no
6915394c11dSFiona Trahe    QAT trace would display in this case::
6925394c11dSFiona Trahe
6935394c11dSFiona Trahe	--log-level="7" --log-level="pmd.qat_general,8"
694